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

2021-04-15 Thread Jie Deng
On 2021/4/15 16:18, Wolfram Sang wrote: On Thu, Apr 15, 2021 at 04:15:07PM +0800, Jie Deng wrote: On 2021/4/15 15:28, Wolfram Sang wrote: Now that we were able to catch you, I will use the opportunity to clarify the doubts I had. - struct mutex lock in struct virtio_i2c, I don't think this

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

2021-04-15 Thread Wolfram Sang
On Thu, Apr 15, 2021 at 04:15:07PM +0800, Jie Deng wrote: > On 2021/4/15 15:28, Wolfram Sang wrote: > > > > Now that we were able to catch you, I will use the opportunity to > > > clarify the doubts I had. > > > > > > - struct mutex lock in struct virtio_i2c, I don't think this is > > >requir

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

2021-04-15 Thread Jie Deng
On 2021/4/15 15:28, Wolfram Sang wrote: Now that we were able to catch you, I will use the opportunity to clarify the doubts I had. - struct mutex lock in struct virtio_i2c, I don't think this is required since the core takes care of locking in absence of this. This is likely correct. OK

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

2021-04-15 Thread Viresh Kumar
On 15-04-21, 09:28, Wolfram Sang wrote: > > > Now that we were able to catch you, I will use the opportunity to > > clarify the doubts I had. > > > > - struct mutex lock in struct virtio_i2c, I don't think this is > > required since the core takes care of locking in absence of this. > > This i

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

2021-04-15 Thread Wolfram Sang
> Now that we were able to catch you, I will use the opportunity to > clarify the doubts I had. > > - struct mutex lock in struct virtio_i2c, I don't think this is > required since the core takes care of locking in absence of this. This is likely correct. > - Use of I2C_CLASS_DEPRECATED flag,

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

2021-04-15 Thread Viresh Kumar
On 15-04-21, 09:21, Wolfram Sang wrote: > > > I didn't forget this. It is a very small change. I'm not sure if the > > maintainer Wolfram > > > > has any comments so that I can address them together in one version. > > Noted. I'll have a look in the next days. Now that we were able to catch you

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

2021-04-15 Thread Wolfram Sang
> I didn't forget this. It is a very small change. I'm not sure if the > maintainer Wolfram > > has any comments so that I can address them together in one version. Noted. I'll have a look in the next days. signature.asc Description: PGP signature

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

2021-04-15 Thread Viresh Kumar
On 15-04-21, 14:56, Jie Deng wrote: > > On 2021/4/15 14:45, Viresh Kumar wrote: > > On 23-03-21, 10:27, Arnd Bergmann wrote: > > > I usually recommend the use of __maybe_unused for the suspend/resume > > > callbacks for drivers that use SIMPLE_DEV_PM_OPS() or similar helpers > > > that hide the ex

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

2021-04-14 Thread Jie Deng
On 2021/4/15 14:45, Viresh Kumar wrote: On 23-03-21, 10:27, Arnd Bergmann wrote: I usually recommend the use of __maybe_unused for the suspend/resume callbacks for drivers that use SIMPLE_DEV_PM_OPS() or similar helpers that hide the exact conditions under which the functions get called. In t

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

2021-04-14 Thread Viresh Kumar
On 23-03-21, 10:27, Arnd Bergmann wrote: > I usually recommend the use of __maybe_unused for the suspend/resume > callbacks for drivers that use SIMPLE_DEV_PM_OPS() or similar helpers > that hide the exact conditions under which the functions get called. > > In this driver, there is an explicit #i

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

2021-04-14 Thread Jie Deng
On 2021/4/14 11:52, Viresh Kumar wrote: Is i2c/for-next the right tree to merge it ? It should be. Thanks Viresh. Hi Wolfram, Do you have any comments for this patch ? Your opinion will be important to improve this patch since you are the maintainer of I2C. Thanks, Jie

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

2021-04-14 Thread Jie Deng
On 2021/4/15 11:51, Jason Wang wrote: +    for (i = 0; i < nr; i++) { +    /* Detach the ith request from the vq */ +    req = virtqueue_get_buf(vq, &len); + +    /* + * Condition (req && req == &reqs[i]) should always meet since + * we have total nr requests in th

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

2021-04-14 Thread Jason Wang
在 2021/3/23 下午10:19, 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-com

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

2021-04-13 Thread Viresh Kumar
On 14-04-21, 10:07, Jie Deng wrote: > Hi maintainers, > > What's the status of this patch based on the review comments you got ? I was expecting a new version to be honest.. > Is i2c/for-next the right tree to merge it > ? It should be. -- viresh

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

2021-04-13 Thread Jie Deng
Hi maintainers, What's the status of this patch ? Is i2c/for-next the right tree to merge it ? Thanks, Jie On 2021/3/23 22:19, 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 followi

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

2021-03-23 Thread Viresh Kumar
On 24-03-21, 14:41, Jie Deng wrote: > > On 2021/3/24 14:09, Viresh Kumar wrote: > > On 24-03-21, 14:05, Jie Deng wrote: > > Or, now that I think about it a bit more, another thing we can do here is > > see if > > virtqueue_get_buf() returns NULL, if it does then we should keep expecting > > more

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

2021-03-23 Thread Jie Deng
On 2021/3/24 14:09, Viresh Kumar wrote: On 24-03-21, 14:05, Jie Deng wrote: Or, now that I think about it a bit more, another thing we can do here is see if virtqueue_get_buf() returns NULL, if it does then we should keep expecting more messages as it may be early interrupt. What do you say ?

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

2021-03-23 Thread Viresh Kumar
On 24-03-21, 14:05, Jie Deng wrote: > For simplicity, the original patch sent only 1 message to vq each time . I > changed the way to send I missed those earlier discussions :) > a batch of requests in one time in order to improve efficiency according to > Jason' suggestion. I agree. > As we di

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

2021-03-23 Thread Jie Deng
On 2021/3/24 12:20, Viresh Kumar wrote: On 23-03-21, 22:19, Jie Deng wrote: +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct virtio_i2c *vi = i2c_get_adapdata(adap); + struct virtqueue *vq = vi->vq; + struct virtio_i2c_req *req

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

2021-03-23 Thread Viresh Kumar
On 23-03-21, 22:19, Jie Deng wrote: > +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, > int num) > +{ > + struct virtio_i2c *vi = i2c_get_adapdata(adap); > + struct virtqueue *vq = vi->vq; > + struct virtio_i2c_req *reqs; > + unsigned long time_left; > +

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

2021-03-23 Thread Viresh Kumar
On 24-03-21, 12:00, Jie Deng wrote: > > On 2021/3/24 11:52, Viresh Kumar wrote: > > On 24-03-21, 08:53, Jie Deng wrote: > > > On 2021/3/23 17:38, Viresh Kumar wrote: > > > > On 23-03-21, 14:31, Viresh Kumar wrote: > > > > > On 23-03-21, 22:19, Jie Deng wrote: > > > > > > +static int virtio_i2c_xfe

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

2021-03-23 Thread Viresh Kumar
On 24-03-21, 09:17, Jie Deng wrote: > I didn't see the "struct virtio_driver" has a member "struct dev_pm_ops *pm" > > It defines its own hooks (freeze and restore) though it includes "struct > device_driver" > > which has a "struct dev_pm_ops *pm". > > I just follow other virtio drivers to dire

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

2021-03-23 Thread Jie Deng
On 2021/3/24 11:52, Viresh Kumar wrote: On 24-03-21, 08:53, Jie Deng wrote: On 2021/3/23 17:38, Viresh Kumar wrote: On 23-03-21, 14:31, Viresh Kumar wrote: On 23-03-21, 22:19, Jie Deng wrote: +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + st

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

2021-03-23 Thread Viresh Kumar
On 24-03-21, 08:53, Jie Deng wrote: > > On 2021/3/23 17:38, Viresh Kumar wrote: > > On 23-03-21, 14:31, Viresh Kumar wrote: > > > On 23-03-21, 22:19, Jie Deng wrote: > > > > +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg > > > > *msgs, int num) > > > > +{ > > > > + str

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

2021-03-23 Thread Jie Deng
On 2021/3/23 17:27, Arnd Bergmann wrote: On Tue, Mar 23, 2021 at 9:33 AM Jie Deng wrote: On 2021/3/23 15:27, Viresh Kumar wrote: On 23-03-21, 22:19, Jie Deng wrote: +static int __maybe_unused virtio_i2c_freeze(struct virtio_device *vdev) +{ +virtio_i2c_del_vqs(vdev); +return 0; +}

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

2021-03-23 Thread Jie Deng
On 2021/3/23 17:38, Viresh Kumar wrote: On 23-03-21, 14:31, Viresh Kumar wrote: On 23-03-21, 22:19, Jie Deng wrote: +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct virtio_i2c *vi = i2c_get_adapdata(adap); + struct virtqueue *vq = v

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

2021-03-23 Thread Viresh Kumar
On 23-03-21, 14:31, Viresh Kumar wrote: > On 23-03-21, 22:19, Jie Deng wrote: > > +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, > > int num) > > +{ > > + struct virtio_i2c *vi = i2c_get_adapdata(adap); > > + struct virtqueue *vq = vi->vq; > > + struct virtio_i2c

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

2021-03-23 Thread Arnd Bergmann
On Tue, Mar 23, 2021 at 9:33 AM Jie Deng wrote: > > On 2021/3/23 15:27, Viresh Kumar wrote: > > > On 23-03-21, 22:19, Jie Deng wrote: > >> +static int __maybe_unused virtio_i2c_freeze(struct virtio_device *vdev) > >> +{ > >> +virtio_i2c_del_vqs(vdev); > >> +return 0; > >> +} > >> + > >> +s

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

2021-03-23 Thread Viresh Kumar
On 23-03-21, 22:19, Jie Deng wrote: > +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, > int num) > +{ > + struct virtio_i2c *vi = i2c_get_adapdata(adap); > + struct virtqueue *vq = vi->vq; > + struct virtio_i2c_req *reqs; > + unsigned long time_left; > +

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

2021-03-23 Thread Viresh Kumar
On 23-03-21, 16:33, Jie Deng wrote: > On 2021/3/23 15:27, Viresh Kumar wrote: > > > On 23-03-21, 22:19, Jie Deng wrote: > > > +static int __maybe_unused virtio_i2c_freeze(struct virtio_device *vdev) > > > +{ > > > + virtio_i2c_del_vqs(vdev); > > > + return 0; > > > +} > > > + > > > +static int __m

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

2021-03-23 Thread Jie Deng
On 2021/3/23 15:27, Viresh Kumar wrote: On 23-03-21, 22:19, Jie Deng wrote: +static int __maybe_unused virtio_i2c_freeze(struct virtio_device *vdev) +{ + virtio_i2c_del_vqs(vdev); + return 0; +} + +static int __maybe_unused virtio_i2c_restore(struct virtio_device *vdev) +{ + r

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

2021-03-23 Thread Viresh Kumar
On 23-03-21, 22:19, Jie Deng wrote: > +static int __maybe_unused virtio_i2c_freeze(struct virtio_device *vdev) > +{ > + virtio_i2c_del_vqs(vdev); > + return 0; > +} > + > +static int __maybe_unused virtio_i2c_restore(struct virtio_device *vdev) > +{ > + return virtio_i2c_setup_vqs(vdev-

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

2021-03-22 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