Re: [virtio-comment] [PATCH v3] virtio-i2c: add the device specification

From
Paolo Bonzini <>
Date
2020-10-28T20:10:27+00:00
ID
Thread
Re: [virtio-comment] [PATCH v3] virtio-i2c: add the device specification
On 27/10/20 07:00, Jie Deng wrote:
> +The driver queues requests to the virtqueue, and they are used by the
> +device. The request is the representation of one segment of an I2C
> +transaction. Each request is of form:
> +
> +\begin{lstlisting}
> +struct virtio_i2c_req {
> +        le16 addr;
> +        le16 flags;
> +        le16 len;
> +        u8 buf[];
> +        u8 status;
> +};
> +\end{lstlisting}

Hi,

one extremely common two-segment I2C transaction is not reproducible
with virtio-i2c.  This is when a write is followed by a read: the master
starts off the transmission with a write, then sends a second START,
then continues with a read from the same address.

Would it make sense to define the request like

struct virtio_i2c_req {
	le16 addr;
	le16 written;
	le16 read;
	u8 bufwrite[];
	u8 status;
	u8 bufread[];
};

instead?

Thanks,

Paolo