On 2021/10/13 11:39, Viresh Kumar wrote:
@@ -124,13 +140,23 @@ \subsubsection{Device Operation: Operation Status}\label{sec:Device Types / I2C
\drivernormative{\subsubsection}{Device Operation}{Device Types / I2C Adapter Device / Device Operation}
+A driver SHOULD implement the VIRTIO_I2C_F_ZERO_LENGTH_REQUEST feature.
I don't think this needs to be "SHOULD", as a driver may be written to only talk to certain i2c clients on the device side, and they do not need zero length requests. Maybe this could be
"A driver MAY assume that the VIRTIO_I2C_F_ZERO_LENGTH_REQUEST feature is available".
The problem here is that "VIRTIO_I2C_FLAGS_M_RD" is supported only with VIRTIO_I2C_F_ZERO_LENGTH_REQUEST feature. If the feature isn't available, then the device/driver need to encode/decode the direction of the transfer (read/write) to/from the permissions of the buffer.
The "VIRTIO_I2C_FLAGS_M_RD" is consistent with the permissions of the buffer.
When this flag is set, the buffer is also marked as device write -only with VIRTQ_DESC_F_WRITE set.
So if this feature isn't available we can use the the latter. We only need this flag when there is no buffer.