lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <720f5c0a-032c-b7af-4ca6-cd5adca77c37@intel.com>
Date:   Tue, 2 Mar 2021 16:17:48 +0800
From:   Jie Deng <jie.deng@...el.com>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     linux-i2c@...r.kernel.org,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org, mst@...hat.com, wsa@...nel.org,
        jasowang@...hat.com, wsa+renesas@...g-engineering.com,
        andriy.shevchenko@...ux.intel.com, conghui.chen@...el.com,
        arnd@...db.de, kblaiech@...lanox.com,
        jarkko.nikula@...ux.intel.com, Sergey.Semin@...kalelectronics.ru,
        rppt@...nel.org, loic.poulain@...aro.org, tali.perry1@...il.com,
        u.kleine-koenig@...gutronix.de, bjorn.andersson@...aro.org,
        yu1.wang@...el.com, shuo.a.liu@...el.com,
        Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver


On 2021/3/2 15:24, Viresh Kumar wrote:
> On 02-03-21, 14:24, Jie Deng wrote:
>> Not for the full duplex. As Paolo explained in those links.
>> We defined a combined request called "write-read request"
>>
>> "
>> 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.
> I think above talks about the real I2C protocol at bus level ?
>
>> In theory there's no difference between one multi-segment transaction
>> and many single-segment transactions _in a single-master scenario_.
>>
>> However, it is a plausible configuration to have multiple guests sharing
>> an I2C host device as if they were multiple master.
>>
>> So the spec should provide a way at least to support for transactions with
>> 1 write and 1 read segment in one request to the same address.
>> "
>>  From the perspective of specification design, it hopes to provide more
>> choices
>> while from the perspective of specific implementation, we can choose what we
>> need
>> as long as it does not violate the specification.
> That is fine, but what I was not able to understand was how do we get
> to know if we should expect both write and read bufs after the out
> header or only one of them ?
>
> I think I have understood that part now, we need to look at incnt and
> outcnt and make out what kind of transfer we need to do.
>
> - If outcnt == 1 and incnt == 2, then it is read operation.
> - If outcnt == 2 and incnt == 1, then it is write operation.
> - If outcnt == 2 and incnt == 2, then it is read-write operation.
>
> Anything else is invalid. Is my understanding correct here ?
Correct.  By checking the sequences of descriptor's R/W in the virtqueue,
You can know the type of request. A simple state machine can be used to
classify in this case.

O I  I   : read request.

O O I  : write request.

O O I I : read-write request.

But if only using the first two types like in this driver, the backend 
will be much easier to
implement since the request is fixed to 3 descriptors and we only need 
to check the second
descriptor to know the type.
>
>> Since the current Linux driver doesn't use this mechanism. I'm considering
>> to move
>> the "struct virtio_i2c_req" into the driver and use one "buf" instead.
> Linux can very much have its own definition of the structure and so I
> am not in favor of any such structure in the spec as well, it confuses
> people (like me) :).
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ