Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-03 Thread Jie Deng
On 2021/3/3 17:38, Viresh Kumar wrote: On 03-03-21, 16:46, Jie Deng wrote: This is not a problem. My original proposal was to mirror the struct i2c_msg. The code you looked at was based on that. However, the virtio TC prefer not to mirror it. They have some concerns. For example, there is a bi

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-03 Thread Stefan Hajnoczi
On Tue, Mar 02, 2021 at 11:54:02AM +0100, Arnd Bergmann wrote: > On Tue, Mar 2, 2021 at 10:51 AM Stefan Hajnoczi wrote: > > On Tue, Mar 02, 2021 at 10:42:06AM +0800, Jie Deng wrote: > > > > > +/* > > > > > + * Definitions for virtio I2C Adpter > > > > > + * > > > > > + * Copyright (c) 2021 Intel C

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-03 Thread Jie Deng
On 2021/3/3 15:54, Viresh Kumar wrote: On 01-03-21, 14:41, Jie Deng wrote: diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c +static int virtio_i2c_send_reqs(struct virtqueue *vq, + struct virtio_i2c_req *reqs, +

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-02 Thread Arnd Bergmann
On Tue, Mar 2, 2021 at 10:51 AM Stefan Hajnoczi wrote: > On Tue, Mar 02, 2021 at 10:42:06AM +0800, Jie Deng wrote: > > > > +/* > > > > + * Definitions for virtio I2C Adpter > > > > + * > > > > + * Copyright (c) 2021 Intel Corporation. All rights reserved. > > > > + */ > > > > + > > > > +#ifndef _U

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-02 Thread Stefan Hajnoczi
On Tue, Mar 02, 2021 at 10:42:06AM +0800, Jie Deng wrote: > > On 2021/3/1 23:19, Arnd Bergmann wrote: > > On Mon, Mar 1, 2021 at 7:41 AM Jie Deng wrote: > > > > > --- /dev/null > > > +++ b/include/uapi/linux/virtio_i2c.h > > > @@ -0,0 +1,56 @@ > > > +/* SPDX-License-Identifier: GPL-2.0-or-later

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-02 Thread Jie Deng
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, th

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jie Deng
On 2021/3/1 20:07, Andy Shevchenko wrote: On Mon, Mar 01, 2021 at 02:41:35PM +0800, Jie Deng wrote: Add an I2C bus driver for virtio para-virtualization. The controller can be emulated by the backend driver in any device model software by following the virtio protocol. The device specificati

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jie Deng
On 2021/3/2 11:43, Viresh Kumar wrote: On 02-03-21, 10:21, Jie Deng wrote: On 2021/3/1 19:54, Viresh Kumar wrote: That's my original proposal. I used to mirror this interface with "struct i2c_msg". But the design philosophy of virtio TC is that VIRTIO devices are not specific to Linux so the

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jie Deng
On 2021/3/2 11:43, Viresh Kumar wrote: On 02-03-21, 10:21, Jie Deng wrote: On 2021/3/1 19:54, Viresh Kumar wrote: That's my original proposal. I used to mirror this interface with "struct i2c_msg". But the design philosophy of virtio TC is that VIRTIO devices are not specific to Linux so the s

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jason Wang
On 2021/3/2 1:16 下午, Viresh Kumar wrote: On 02-03-21, 13:06, Jie Deng wrote: Yeah. Actually, the backend only needs "struct virtio_i2c_out_hdr out_hdr" and "struct virtio_i2c_in_hdr in_hdr" for communication. So we only need to keep the first two in uapi and move "struct virtio_i2c_req" into th

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jie Deng
On 2021/3/2 12:42, Viresh Kumar wrote: On 01-03-21, 14:41, Jie Deng wrote: +static int virtio_i2c_send_reqs(struct virtqueue *vq, + struct virtio_i2c_req *reqs, + struct i2c_msg *msgs, int nr) +{ + struct scatterlist *sgs[3], ou

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jie Deng
On 2021/3/2 12:22, Viresh Kumar wrote: On 02-03-21, 09:31, Viresh Kumar wrote: On 01-03-21, 16:19, Arnd Bergmann wrote: On Mon, Mar 1, 2021 at 7:41 AM Jie Deng wrote: --- /dev/null +++ b/include/uapi/linux/virtio_i2c.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later WITH Lin

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jie Deng
On 2021/3/1 23:19, Arnd Bergmann wrote: On Mon, Mar 1, 2021 at 7:41 AM Jie Deng wrote: --- /dev/null +++ b/include/uapi/linux/virtio_i2c.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */ +/* + * Definitions for virtio I2C Adpter + * + * Copyright (c)

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Jie Deng
On 2021/3/1 19:54, Viresh Kumar wrote: On 01-03-21, 14:41, Jie Deng wrote: +/** + * struct virtio_i2c_req - the virtio I2C request structure + * @out_hdr: the OUT header of the virtio I2C message + * @write_buf: contains one I2C segment being written to the device + * @read_buf: contains one I

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Arnd Bergmann
On Mon, Mar 1, 2021 at 1:10 PM Andy Shevchenko wrote: > On Mon, Mar 01, 2021 at 02:09:25PM +0200, Andy Shevchenko wrote: > > On Mon, Mar 01, 2021 at 05:24:41PM +0530, Viresh Kumar wrote: > > > On 01-03-21, 14:41, Jie Deng wrote: > > > > +/** > > > > + * struct virtio_i2c_req - the virtio I2C reque

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Arnd Bergmann
On Mon, Mar 1, 2021 at 7:41 AM Jie Deng wrote: > --- /dev/null > +++ b/include/uapi/linux/virtio_i2c.h > @@ -0,0 +1,56 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */ > +/* > + * Definitions for virtio I2C Adpter > + * > + * Copyright (c) 2021 Intel Corporation. All

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Andy Shevchenko
On Mon, Mar 01, 2021 at 05:24:41PM +0530, Viresh Kumar wrote: > On 01-03-21, 14:41, Jie Deng wrote: > > +/** > > + * struct virtio_i2c_req - the virtio I2C request structure > > + * @out_hdr: the OUT header of the virtio I2C message > > + * @write_buf: contains one I2C segment being written to the

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Andy Shevchenko
On Mon, Mar 01, 2021 at 02:41:35PM +0800, Jie Deng wrote: > Add an I2C bus driver for virtio para-virtualization. > > The controller can be emulated by the backend driver in > any device model software by following the virtio protocol. > > The device specification can be found on > https://lists.

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-03-01 Thread Andy Shevchenko
On Mon, Mar 01, 2021 at 02:09:25PM +0200, Andy Shevchenko wrote: > On Mon, Mar 01, 2021 at 05:24:41PM +0530, Viresh Kumar wrote: > > On 01-03-21, 14:41, Jie Deng wrote: > > > +/** > > > + * struct virtio_i2c_req - the virtio I2C request structure > > > + * @out_hdr: the OUT header of the virtio I2C

[PATCH v5] i2c: virtio: add a virtio i2c frontend driver

2021-02-28 Thread Jie Deng
Add an I2C bus driver for virtio para-virtualization. The controller can be emulated by the backend driver in any device model software by following the virtio protocol. The device specification can be found on https://lists.oasis-open.org/archives/virtio-comment/202101/msg8.html. By followi