On 19.09.2023 15:58, Paolo Bonzini wrote:
On 9/19/23 02:35, Anton Yakovlev wrote:
If the Linux virtio sound driver violates a specification, then there must be
a conformance statement that the driver does not follow. As far as I know,
there is no such thing at the moment.
There is one in 188.8.131.52: "The device MAY access the descriptor chains the
driver created and the memory they refer to immediately"
And likewise for packed virtqueues in 184.108.40.206: "The device MAY access the
descriptor and any following descriptors the driver created and the memory
they refer to immediately"
I think it's a mistake to use MAY here, as opposed to "may". This is not an
optional feature, it's a MUST NOT requirement on the driver's part that should
be in 220.127.116.11.1 and 18.104.22.168.1.
This does not prevent the virtio-snd spec from overriding this. If an
override is desirable (for example because other hardware behaves like this),
there should be a provision in 22.214.171.124.1 and 126.96.36.199.1. For example:
188.8.131.52.1 Unless the device specification specifies otherwise, the driver
MUST NOT write to the descriptor chains and the memory they refer to, between
the /idx/ update and the time the device places the driver on the used ring.
184.108.40.206.1 "Unless the device specification specifies otherwise, the driver
MUST NOT write to the descriptor, to any following descriptors the driver
created, nor to the memory the refer to, between the /flags/ update and the
time the device places the driver on the used ring.
In the virtio-snd there would be a normative statement like
220.127.116.11.1.1 The device MUST NOT read from available device-readable buffers
beyond the first buffer_bytes / period_bytes periods.
18.104.22.168.1.2 The driver MAY write to device-readable buffers beyond the first
buffer_bytes / period_bytes periods, even after offering them to the device.
Thanks for pointing this out.
Yes, it looks like the driver does not strictly follow the specification. But
in this case it's a matter of driver implementation in the Linux kernel, so I
don’t think there is a need to change the spec.
Senior Software Engineer
Rotherstr. 20, 10245 Berlin
Virtualization mailing list