From: Cornelia Huck <cohuck@redhat.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jie Deng <jie.deng@intel.com>, Wolfram Sang <wsa@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: "Viresh Kumar" <viresh.kumar@linaro.org>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Jason Wang" <jasowang@redhat.com>,
"Bill Mills" <bill.mills@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
virtio-dev@lists.oasis-open.org, stratos-dev@op-lists.linaro.org,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Arnd Bergmann" <arnd@kernel.org>
Subject: [virtio-dev] Re: [PATCH V5 2/2] virtio: i2c: Allow zero-length transactions
Date: Wed, 13 Oct 2021 11:26:14 +0200 [thread overview]
Message-ID: <87bl3twa15.fsf@redhat.com> (raw)
In-Reply-To: <325276eec77c6ab3bd28382386055b821754396b.1634037711.git.viresh.kumar@linaro.org>
On Tue, Oct 12 2021, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> The I2C protocol allows zero-length requests with no data, like the
> SMBus Quick command, where the command is inferred based on the
> read/write flag itself.
>
> In order to allow such a request, allocate another bit,
> VIRTIO_I2C_FLAGS_M_RD(1), in the flags to pass the request type, as read
> or write. This was earlier done using the read/write permission to the
> buffer itself.
>
> Add a new feature flag for zero length requests and make it mandatory
> for it to be implemented, so we don't need to drag the old
> implementation around.
>
> Fixes: https://github.com/oasis-tcs/virtio-spec/issues/112
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> virtio-i2c.tex | 34 +++++++++++++++++++++++++++++++---
> 1 file changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/virtio-i2c.tex b/virtio-i2c.tex
> index 5d634aec6e7c..0e73348963ce 100644
> --- a/virtio-i2c.tex
> +++ b/virtio-i2c.tex
> @@ -17,7 +17,11 @@ \subsection{Virtqueues}\label{sec:Device Types / I2C Adapter Device / Virtqueues
>
> \subsection{Feature bits}\label{sec:Device Types / I2C Adapter Device / Feature bits}
>
> -None currently defined.
> +\begin{description}
> +\item[VIRTIO_I2C_F_ZERO_LENGTH_REQUEST (0)] The device supports zero-length I2C
> +request and \field{VIRTIO_I2C_FLAGS_M_RD} flag. It is mandatory to implement
> +this feature.
Maybe add a footnote, explaining that VIRTIO_I2C_FLAGS_M_RD had not been
specified initially, and that we need an easy way to detect incompatible
implementations?
> +\end{description}
>
> \subsection{Device configuration layout}\label{sec:Device Types / I2C Adapter Device / Device configuration layout}
>
(...)
> @@ -124,13 +140,23 @@ \subsubsection{Device Operation: Operation Status}\label{sec:Device Types / I2C
>
> \drivernormative{\subsubsection}{Device Operation}{Device Types / I2C Adapter Device / Device Operation}
>
> +A driver SHOULD implement the VIRTIO_I2C_F_ZERO_LENGTH_REQUEST feature.
Make this MUST, or maybe "MUST accept"? The central point of the feature
flag (at least for me) was to be able to change the semantics and format
without things breaking silently. I don't think we need to keep old
driver revisions compliant?
> +
> A driver MUST set \field{addr} and \field{flags} before sending the request.
>
> A driver MUST set the reserved bits of \field{flags} to be zero.
>
> +A driver MUST NOT send the \field{buf}, for a zero-length request.
> +
> A driver MUST NOT use \field{buf}, for a read request, if the final
> \field{status} returned from the device is VIRTIO_I2C_MSG_ERR.
>
> +A driver MUST set the \field{VIRTIO_I2C_FLAGS_M_RD} flag for a read operation,
> +where the buffer is write-only for the device.
> +
> +A driver MUST NOT set the \field{VIRTIO_I2C_FLAGS_M_RD} flag for a write
> +operation, where the buffer is read-only for the device.
> +
> A driver MUST queue the requests in order if multiple requests are going to
> be sent at a time.
>
> @@ -141,6 +167,8 @@ \subsubsection{Device Operation: Operation Status}\label{sec:Device Types / I2C
>
> \devicenormative{\subsubsection}{Device Operation}{Device Types / I2C Adapter Device / Device Operation}
>
> +A device SHOULD implement the VIRTIO_I2C_F_ZERO_LENGTH_REQUEST feature.
Same here, I would make this "MUST offer", and simply make old device
implementations non-compliant. The device should also reject any driver
that does not negotiate the flag, I think?
> +
> A device SHOULD keep consistent behaviors with the hardware as described in
> \hyperref[intro:I2C]{I2C}.
>
No objections from my side to the reset of the changes.
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
next prev parent reply other threads:[~2021-10-13 9:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 11:23 [PATCH V5 0/2] virtio: i2c: Allow zero-length transactions Viresh Kumar
2021-10-12 11:23 ` [PATCH V5 1/2] virtio: i2c: No need to have separate read-write buffers Viresh Kumar
2021-10-12 13:58 ` Arnd Bergmann
2021-10-12 11:23 ` [PATCH V5 2/2] virtio: i2c: Allow zero-length transactions Viresh Kumar
2021-10-12 14:09 ` Arnd Bergmann
2021-10-13 2:32 ` [virtio-dev] " Jie Deng
2021-10-13 3:39 ` Viresh Kumar
2021-10-13 4:07 ` [virtio-dev] " Jie Deng
2021-10-13 4:12 ` Viresh Kumar
2021-10-13 9:26 ` Cornelia Huck [this message]
2021-10-13 9:33 ` Viresh Kumar
2021-10-13 9:44 ` [virtio-dev] " Cornelia Huck
2021-10-13 10:43 ` Viresh Kumar
2021-10-13 11:10 ` [virtio-dev] " Cornelia Huck
2021-10-13 2:25 ` [PATCH V5 0/2] " 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=87bl3twa15.fsf@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=arnd@kernel.org \
--cc=bill.mills@linaro.org \
--cc=jasowang@redhat.com \
--cc=jie.deng@intel.com \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stratos-dev@op-lists.linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=virtio-dev@lists.oasis-open.org \
--cc=wsa@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.