From: Jie Deng <jie.deng@intel.com>
To: Jason Wang <jasowang@redhat.com>,
linux-i2c@vger.kernel.org,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Cc: mst@redhat.com, wsa@kernel.org, wsa+renesas@sang-engineering.com,
andriy.shevchenko@linux.intel.com, conghui.chen@intel.com,
arnd@arndb.de, kblaiech@mellanox.com,
jarkko.nikula@linux.intel.com, Sergey.Semin@baikalelectronics.ru,
rppt@kernel.org, loic.poulain@linaro.org, tali.perry1@gmail.com,
u.kleine-koenig@pengutronix.de, bjorn.andersson@linaro.org,
yu1.wang@intel.com, shuo.a.liu@intel.com,
viresh.kumar@linaro.org, stefanha@redhat.com,
pbonzini@redhat.com
Subject: Re: [PATCH v6] i2c: virtio: add a virtio i2c frontend driver
Date: Fri, 5 Mar 2021 16:12:44 +0800 [thread overview]
Message-ID: <b1b66c2a-beec-c864-77a0-3bd0c6842e2e@intel.com> (raw)
In-Reply-To: <7aa23b71-01eb-5824-b1db-892ede690fce@redhat.com>
On 2021/3/5 15:23, Jason Wang wrote:
>
>>>> + virtqueue_kick(vq);
>>>> +
>>>> + time_left = wait_for_completion_timeout(&vi->completion,
>>>> adap->timeout);
>>>> + if (!time_left) {
>>>> + dev_err(&adap->dev, "virtio i2c backend timeout.\n");
>>>> + ret = -ETIMEDOUT;
>>>> + goto err_unlock_free;
>>>
>>>
>>> So if the request is finished after the timerout, all the following
>>> request will fail, is this expected?
>>>
>>>
>> This is an expected behavior. If timeout happens, we don't need to
>> care about the requests whether
>> really completed by "HW" or not. Just return error and let the i2c
>> core to decide whether to resend.
>
>
> So you need at least reinit the completion at least?
>
Right. Will fix it. Thank you.
>
>>>> + }
>>>> +
>>>> + ret = virtio_i2c_complete_reqs(vq, reqs, msgs, nr);
>>>
>>>
>>> So consider driver queue N requests, can device raise interrupt if
>>> it completes the first request? If yes, the code break, if not it
>>> need to be clarified in the spec.
>> The device can raise interrupt when some requests are still not
>> completed though this is not a good operation.
>
>
> Then you need forbid this in the spec.
>
Yeah, but I think we can add some description to explain this clearly
instead of forbid it directly.
>
>> In this case, the remaining requests in the vq will be ignored and
>> the i2c_algorithm. master_xfer will return 1 for
>> your example. And let the i2c core to decide whether to resend.
>>>
>>> Acaultly I remember there's no VIRTIO_I2C_FLAGS_FAIL_NEXT in
>>> previous versions, and after reading the spec I still don't get the
>>> motivation for that (it may complicates both driver and device
>>> actually).
>>>
>> This flag is introduced by Stefan. Please check following link for
>> the details
>> https://lists.oasis-open.org/archives/virtio-comment/202012/msg00075.html.
>>
>
>
> > We just need to make sure that once the driver adds some requests to
> the
> > virtqueue,
> > it should complete them (either success or fail) before adding new
> requests.
> > I think this
> > is a behavior of physical I2C adapter drivers and we can follow.
>
>
> Is this a driver requirement or device? If it's the driver, the code
> have already did something like this. E.g you wait for the completion
> of the request and forbid new request via i2c_lock.
>
> Thanks
>
The driver. VIRTIO_I2C_FLAGS_FAIL_NEXT doesn't help in Linux driver.
But I agree with Stefan that
VIRTIO is not specific to Linux so the specs design should avoid the
limitations of the current
Linux driver behavior.
>
>>
>
next prev parent reply other threads:[~2021-03-05 8:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 1:59 [PATCH v6] i2c: virtio: add a virtio i2c frontend driver Jie Deng
2021-03-04 5:37 ` kernel test robot
2021-03-04 5:40 ` kernel test robot
2021-03-04 6:06 ` Viresh Kumar
2021-03-05 1:46 ` Jie Deng
2021-03-05 3:09 ` Viresh Kumar
2021-03-05 7:00 ` Jie Deng
2021-03-05 7:29 ` Viresh Kumar
2021-03-04 6:22 ` kernel test robot
2021-03-04 9:15 ` Jason Wang
2021-03-05 5:47 ` Jie Deng
2021-03-05 7:23 ` Jason Wang
2021-03-05 8:12 ` Jie Deng [this message]
2021-03-10 2:22 ` Jie Deng
2021-03-10 3:59 ` Jason Wang
2021-03-10 8:27 ` Arnd Bergmann
2021-03-11 5:59 ` Jie Deng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b1b66c2a-beec-c864-77a0-3bd0c6842e2e@intel.com \
--to=jie.deng@intel.com \
--cc=Sergey.Semin@baikalelectronics.ru \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bjorn.andersson@linaro.org \
--cc=conghui.chen@intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jasowang@redhat.com \
--cc=kblaiech@mellanox.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rppt@kernel.org \
--cc=shuo.a.liu@intel.com \
--cc=stefanha@redhat.com \
--cc=tali.perry1@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=viresh.kumar@linaro.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@kernel.org \
--cc=yu1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).