Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Max Gurtovoy <mgurtovoy@nvidia.com>
Cc: virtio-comment@lists.oasis-open.org, cohuck@redhat.com,
	virtio-dev@lists.oasis-open.org, jasowang@redhat.com,
	parav@nvidia.com, shahafs@nvidia.com, oren@nvidia.com,
	stefanha@redhat.com
Subject: Re: [PATCH v1 3/5] Introduce DEVICE INFO Admin command
Date: Mon, 4 Apr 2022 12:09:29 -0400	[thread overview]
Message-ID: <20220404120613-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <a373e0e4-6eb8-5a35-b7fa-4d790b72c7b4@nvidia.com>

On Mon, Apr 04, 2022 at 06:44:11PM +0300, Max Gurtovoy wrote:
> 
> On 4/4/2022 3:57 PM, Michael S. Tsirkin wrote:
> > On Wed, Mar 02, 2022 at 05:56:06PM +0200, Max Gurtovoy wrote:
> > > The DEVICE INFO command will return a basic information for a virtio
> > > device.
> > > 
> > > Reviewed-by: Parav Pandit <parav@nvidia.com>
> > > Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> > > ---
> > >   admin.tex | 35 +++++++++++++++++++++++++++++++++--
> > >   1 file changed, 33 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/admin.tex b/admin.tex
> > > index 1e30e01..9a8969b 100644
> > > --- a/admin.tex
> > > +++ b/admin.tex
> > > @@ -67,7 +67,9 @@ \section{Admin command set}\label{sec:Basic Facilities of a Virtio Device / Admi
> > >   \hline
> > >   0001h   & VIRTIO_ADMIN_SUBSYSTEM_IDENTIFY    & O  \\
> > >   \hline
> > > -0002h - 7FFFh   & Generic admin cmds    & -  \\
> > > +0002h   & VIRTIO_ADMIN_DEVICE_INFO    & O  \\
> > > +\hline
> > > +0003h - 7FFFh   & Generic admin cmds    & -  \\
> > >   \hline
> > >   8000h - FFFFh   & Reserved    & - \\
> > >   \hline
> > > @@ -94,7 +96,8 @@ \subsection{VIRTIO ADMIN DEVICE IDENTIFY command}\label{sec:Basic Facilities of
> > >          /* This field indicates which of the below optional admin
> > >           * capabilities are supported by the device:
> > >           * Bit 0 - if set, VIRTIO_ADMIN_SUBSYSTEM_IDENTIFY supported
> > > -        * Bits 1 - 63 - reserved for future capabilities.
> > > +        * Bit 1 - if set, VIRTIO_ADMIN_DEVICE_INFO supported
> > > +        * Bits 2 - 63 - reserved for future capabilities.
> > >           */
> > >          le64 optional_caps_support;
> > >          u8 reserved[4072];
> > > @@ -127,3 +130,31 @@ \subsection{VIRTIO ADMIN SUBSYSTEM IDENTIFY command}\label{sec:Basic Facilities
> > >          u8 reserved[4056];
> > >   };
> > >   \end{lstlisting}
> > > +
> > > +\subsection{VIRTIO ADMIN DEVICE INFO command}\label{sec:Basic Facilities of a Virtio Device / Admin command set / VIRTIO ADMIN DEVICE INFO command}
> > > +
> > > +The VIRTIO_ADMIN_DEVICE_INFO command has no command specific data set by the driver.
> > > +The \field{command} is set to VIRTIO_ADMIN_DEVICE_INFO.
> > > +
> > > +The VIRTIO_ADMIN_DEVICE_INFO upon success, returns a data buffer that describes a basic information for the target virtio device.
> > > +Upon success, the returned data buffer is of form:
> > > +\begin{lstlisting}
> > > +struct virtio_admin_device_info_result {
> > > +        /* For compatibility - indicates which of the below fields were returned
> > > +         * (1 means that field was returned):
> > So how is this supposed to be handled. You need to write this up.
> > Also having each command have a bitmap seems like an overkill
> > to me. But if that is the way you are going just put
> > this in the generic part.
> > 
> > 
> > > +         * Bit 0 - vf_number
> > > +         * Bits 1 - 63 - reserved for future fields
> > we generally say "future use" not "future fields".
> 
> ok.
> 
> 
> > > +         */
> > > +        le64 attrs_mask;
> > > +        /* The virtual function number */
> > > +        le16 vf_number;
> > > +        u8 reserved[1014];
> > > +};
> > > +\end{lstlisting}
> > > +
> > > +\begin{note}
> > > +{Bit 0 in \field{attrs_mask} will be set only if the target virtio device represents a PCI Virtual function.
> > > +In this case, the \field{vf_number} value can't be greater than TotalVFs value as defined in the PCI
> > > +specification and can't be equal to zero. If bit 0 is not set, the driver will ignore \field{vf_number}.}
> > > +\end{note}
> > 
> > I personally would just make vf # *be* the device ID, with no need for an
> > extra indirection. It doesn't hurt much though ...
> 
> This is implementation specific.
> 
> You need to have a way to identify the vf number.

So my point is, I see no need to have a random set
of VFs or have an abstract ID as an indirection layer -
we can just say id == VF# and always manage all VF #s up to N.

This will cut out a bunch of commands.

And hey, if we see the need for an indirection down the road we
will be add it as a separate dst_type.

> > 
> > But I do not seem to understand how it all works here. I think a generic
> > description explaining how all this is used is necessary, pls add a
> > writeup.
> > 
> > E.g.
> > 
> > So I start with a device and through a feature bit I find out it
> > supports admin commands. Then I query that and find the max vdev id.
> > Query the ID of each device. Then through that query VF number.
> > Something like this.
> > 
> > Looks in device operation section for some examples.
> 
> Ok I'll try to add more explanation.
> 
> 
> > 
> > 
> > > +
> > > -- 
> > > 2.21.0


  reply	other threads:[~2022-04-04 16:09 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 15:56 [PATCH v1 0/5] Introduce virtio subsystem and Admin virtqueue Max Gurtovoy
2022-03-02 15:56 ` [PATCH v1 1/5] virtio: Introduce virtio subsystem Max Gurtovoy
2022-04-04 12:03   ` [virtio-dev] " Michael S. Tsirkin
2022-04-04 15:06     ` [virtio-comment] " Max Gurtovoy
2022-03-02 15:56 ` [virtio-comment] [PATCH v1 2/5] Introduce Admin Command Set Max Gurtovoy
2022-04-04 12:50   ` Michael S. Tsirkin
2022-04-04 15:35     ` Max Gurtovoy
2022-04-04 16:26       ` Michael S. Tsirkin
2022-04-05 10:58         ` [virtio-comment] " Max Gurtovoy
2022-04-05 12:28           ` [virtio-dev] " Michael S. Tsirkin
2022-04-06 17:03             ` [virtio-comment] " Max Gurtovoy
2022-03-02 15:56 ` [PATCH v1 3/5] Introduce DEVICE INFO Admin command Max Gurtovoy
2022-04-04 12:57   ` Michael S. Tsirkin
2022-04-04 15:44     ` Max Gurtovoy
2022-04-04 16:09       ` Michael S. Tsirkin [this message]
2022-04-05 11:27         ` [virtio-comment] " Max Gurtovoy
2022-04-05 12:20           ` Michael S. Tsirkin
2022-04-06 17:17             ` [virtio-comment] " Max Gurtovoy
2022-03-02 15:56 ` [PATCH v1 4/5] Add virtio Admin virtqueue Max Gurtovoy
2022-04-04 13:02   ` Michael S. Tsirkin
2022-04-04 15:49     ` Max Gurtovoy
2022-04-04 16:13       ` Michael S. Tsirkin
2022-04-05 11:13         ` [virtio-comment] " Max Gurtovoy
2022-04-05 12:32           ` [virtio-dev] " Michael S. Tsirkin
2022-03-02 15:56 ` [PATCH v1 5/5] Add miscellaneous configuration structure for PCI Max Gurtovoy
2022-04-04 13:04   ` Michael S. Tsirkin
2022-04-04 15:52     ` Max Gurtovoy
2022-04-04 16:16       ` Michael S. Tsirkin
2022-04-05 11:20         ` [virtio-comment] " Max Gurtovoy
2022-04-05 12:12           ` Michael S. Tsirkin
2022-03-09  7:42 ` [PATCH v1 0/5] Introduce virtio subsystem and Admin virtqueue Michael S. Tsirkin
2022-03-10 10:38   ` Max Gurtovoy
2022-03-10 12:49     ` Michael S. Tsirkin
2022-03-10 13:08       ` Max Gurtovoy
2022-03-20 21:41         ` [virtio-comment] " Michael S. Tsirkin
2022-03-27 15:40           ` Max Gurtovoy

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=20220404120613-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=oren@nvidia.com \
    --cc=parav@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=stefanha@redhat.com \
    --cc=virtio-comment@lists.oasis-open.org \
    --cc=virtio-dev@lists.oasis-open.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox