Description
There are a couple of things we are validating in Queue::is_valid() that are requirements according to the virtio spec. Calling is_valid()
is optional, but we should always try to validate the MUST things from the spec, and not let the user be able to configure something that is not conforming to the spec.
We can move the mandatory checks from is_valid
to the corresponding Queue setters, for example the following requirement The driver MUST ensure that the physical address of the first byte of each virtqueue part is a multiple of the specified alignment value in the above table. can be validated when setting the address of these parts. At this point these validations are done as part of is_valid
. There are also requirements for the queue size, e.g. Queue Size value is always a power of 2.
which can be done in the set_size()
method that is added in this PR.