[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a3vD0CpuJW=3w3nq0h9HECCiOigNWK-SvXq=m1zZpqvjA@mail.gmail.com>
Date: Mon, 28 Jun 2021 13:50:53 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Wolfram Sang <wsa@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Jie Deng <jie.deng@...el.com>,
Linux I2C <linux-i2c@...r.kernel.org>,
virtualization@...ts.linux-foundation.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
conghui.chen@...el.com, kblaiech@...lanox.com,
jarkko.nikula@...ux.intel.com,
Sergey Semin <Sergey.Semin@...kalelectronics.ru>,
Mike Rapoport <rppt@...nel.org>, loic.poulain@...aro.org,
Tali Perry <tali.perry1@...il.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
yu1.wang@...el.com, shuo.a.liu@...el.com,
Viresh Kumar <viresh.kumar@...aro.org>,
Stefan Hajnoczi <stefanha@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH v10] i2c: virtio: add a virtio i2c frontend driver
On Mon, Jun 28, 2021 at 12:13 PM Wolfram Sang <wsa@...nel.org> wrote:
>
>
> > Ok, that's what I thought. There is one corner case that I've struggled
> > with though: Suppose the host has an SMBus-only driver, and the
> > proposed driver exposes this as an I2C device to the guest, which
> > makes it available to guest user space (or a guest kernel driver)
> > using the emulated smbus command set. Is it always possible for
> > the host user space to turn the I2C transaction back into the
> > expected SMBus transaction on the host?
>
> If an SMBus commands gets converted to I2C messages, it can be converted
> back to an SMBus command. I don't see anything preventing that right
> now. However, the mapping-back code does look a bit clumsy, now that I
> envision it. Maybe it is better, after all, to support I2C_SMBUS
> directly and pass SMBus transactions as is. It should be a tad more
> effiecient, too.
You can fine Viresh's vhost-user implementation at
https://lore.kernel.org/qemu-devel/cover.1617278395.git.viresh.kumar@linaro.org/t/#m3b5044bad9769b170f505e63bd081eb27cef8db2
As you say, it does get a bit clumsy, but I think there is also a good argument
to be made that the clumsiness is based on the host Linux user interface
more than the on the requirements of the physical interface,
and that should not have to be reflected in the virtio specification.
> Speaking of it, I recall another gory detail: SMBus has transfers named
> "read block data" and "block process call". These also need special
> support from I2C host controllers before they can be emulated because
> the length of the read needs to be adjusted in flight. These commands
> are rare and not hard to implement. However, it makes exposing what is
> supported a little more difficult.
Right, this one has come up before as well: the preliminary result
was to assume that this probably won't be needed, but would be easy
enough to add later if necessary.
Arnd
Powered by blists - more mailing lists