Re: [PATCH V2] virtio: i2c: Allow zero-length transactions

From
Viresh Kumar <>
Date
2021-08-17T03:53:31+00:00
ID
20210817035324.r27cdx3yu2j4qmms@vireshk-i7
Thread
Re: [PATCH V2] virtio: i2c: Allow zero-length transactions
On 16-08-21, 10:45, Michael S. Tsirkin wrote:
> On Mon, Aug 16, 2021 at 03:17:23PM +0530, Viresh Kumar wrote:
> > The I2C protocol allows zero-length requests with no data, like the
> > SMBus Quick command, where the command is inferred based on the
> > read/write flag itself.
> 
> So I wonder. What if we allow zero-length buffers in virtio? Would that
> address the need?

There are three things this patch does, all of which are important
IMO:

1. Drop the need of passing both write and read buffers, as that isn't
   required really since we already have another way of linking
   different transfers using the fail-next flag.

2. Make the buffer optional, for zero-length transfers.

3. Pass the r/w flag separately, which is kind of relevant because of
   2 (zero-length transfers) only.


I think (1) can be done separately anyway, and we may be able to solve
(2) and (3) if we allow zero-length buffers in virtio itself.

-- 
viresh