All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: virtio-comment@lists.oasis-open.org
Subject: Re: [virtio-comment] [PATCH v2 1/4] Add virtio Admin Virtqueue
Date: Thu, 27 Jan 2022 11:14:18 +0800	[thread overview]
Message-ID: <1b77bbb8-a488-a2a8-1374-b8691356ac15@redhat.com> (raw)
In-Reply-To: <20220124093918.34371-2-mgurtovoy@nvidia.com>


在 2022/1/24 下午5:39, Max Gurtovoy 写道:
> In one of the many use cases a user wants to manipulate features and
> configuration of the virtio devices regardless of the device type
> (net/block/console). Some of this configuration is generic enough. i.e
> Number of MSI-X vectors of a virtio PCI VF device. There is a need to do
> such features query and manipulation by its parent PCI PF.
>
> Currently virtio specification defines control virtqueue to manipulate
> features and configuration of the device it operates on. However,
> control virtqueue commands are device type specific, which makes it very
> difficult to extend for device agnostic commands.
>
> To support this requirement in elegant way, this patch introduces a new
> admin virtqueue. Admin virtqueue will use the same command format for all
> types of virtio devices.
>
> Manipulate features via admin virtqueue is asynchronous, scalable, easy
> to extend and doesn't require additional and expensive on-die resources
> to be allocated for every new feature that will be added in the future.
>
> Subsequent patches make use of this admin virtqueue.
>
> Reviewed-by: Parav Pandit <parav@nvidia.com>
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> ---
>   admin-virtq.tex | 89 +++++++++++++++++++++++++++++++++++++++++++++++++
>   content.tex     |  9 +++--
>   2 files changed, 96 insertions(+), 2 deletions(-)
>   create mode 100644 admin-virtq.tex
>
> diff --git a/admin-virtq.tex b/admin-virtq.tex
> new file mode 100644
> index 0000000..1a41c22
> --- /dev/null
> +++ b/admin-virtq.tex
> @@ -0,0 +1,89 @@
> +\section{Admin Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Admin Virtqueues}
> +
> +Admin virtqueue is used to send administrative commands to manipulate
> +various features of the device and/or to manipulate various features,
> +if possible, of another device within the same group (e.g. PCI VFs of
> +a parent PCI PF device are grouped together. These devices can be
> +optionally managed by its parent PCI PF using its admin virtqueue.).
> +
> +Use of Admin virtqueue is negotiated by the VIRTIO_F_ADMIN_VQ
> +feature bit.
> +
> +Admin virtqueue index may vary among different device types.
> +
> +Regardless of device offering VIRTIO_F_IN_ORDER, admin queue command buffers
> +are used by the device in out of order manner.
> +
> +The Admin command set defines the commands that may be issued only to the admin
> +virtqueue. Each virtio device that advertises the VIRTIO_F_ADMIN_VQ feature, MUST
> +support all the mandatory admin commands. A device MAY support also one or more
> +optional admin commands. All commands are of the following form:


Do we need a way for advertising the supported optional commands (or 
features bits)? Otherwise dealing with the compatibility will result of 
per command probing.


> +
> +\begin{lstlisting}
> +struct virtio_admin_cmd {
> +        /* Device-readable part */
> +        u16 command;


Two questions:

1) It looks to me it's better to have a explicit device_id here other 
than embed it in each command

2) virtio-net cvq use class/command which seems more elegant, e.g all 
commands belongs to MSI could be grouped into the same class


> +        u8 command_specific_data[];
> +
> +        /* Device-writable part */
> +        u8 status;
> +        u8 command_specific_error;


I wonder the reason why not using a single field for the above two 
fields. (Or any value for separating command specific error out, we 
don't do that for virtio-net cvq).


> +        u8 command_specific_result[];
> +};
> +\end{lstlisting}
> +
> +The following table describes the generic Admin status codes:
> +
> +\begin{tabular}{|l|l|l|}
> +\hline
> +Opcode & Status & Description \\
> +\hline \hline
> +00h   & VIRTIO_ADMIN_STATUS_OK    & successful completion  \\
> +\hline
> +01h   & VIRTIO_ADMIN_STATUS_CS_ERR    & command specific error  \\
> +\hline
> +02h   & VIRTIO_ADMIN_STATUS_COMMAND_UNSUPPORTED    & unsupported or invalid opcode  \\
> +\hline
> +\end{tabular}
> +
> +The \field{command} and \field{command_specific_data} are
> +set by the driver, and the device sets the \field{status}, the
> +\field{command_specific_error} and the \field{command_specific_result},
> +if needed.
> +
> +The \field{command_specific_error} should be inspected by the driver only if \field{status} is set to
> +VIRTIO_ADMIN_STATUS_CS_ERR by the device. In this case, the content of \field{command_specific_error}
> +holds the command specific error. If \field{status} is not set to VIRTIO_ADMIN_STATUS_CS_ERR, the
> +\field{command_specific_error} value is undefined.
> +
> +The following table describes the Admin command set:
> +
> +\begin{tabular}{|l|l|l|}
> +\hline
> +Opcode & Command & M/O \\
> +\hline \hline
> +0000h   & VIRTIO_ADMIN_CAPS_IDENTIFY    & M  \\
> +\hline
> +0001h - 7FFFh   & Generic admin cmds    & -  \\
> +\hline
> +8000h - FFFFh   & Reserved    & - \\
> +\hline
> +\end{tabular}


See above, I'd suggest to use class/command as virtio-net cvq.


> +
> +\subsection{VIRTIO ADMIN CAPS IDENTIFY command}\label{sec:Basic Facilities of a Virtio Device / Admin Virtqueues / VIRTIO ADMIN CAPS IDENTIFY command}
> +
> +The VIRTIO_ADMIN_CAPS_IDENTIFY command has no command specific data set by the driver.
> +This command upon success, returns a data buffer that describes information about the supported
> +admin capabilities by the device. This information is of form:
> +\begin{lstlisting}
> +struct virtio_admin_caps_identify_result {
> +       /*
> +        * caps[0] - Bit 0x0 - Bit 0x7 are reserved
> +        * caps[1] - Bit 0x0 - Bit 0x7 are reserved
> +        * caps[2] - Bit 0x0 - Bit 0x7 are reserved
> +        * ....
> +        * caps[8191] - Bit 0x0 - Bit 0x7 are reserved
> +        */
> +       u8 caps[8192];
> +};


Ok, so I see the identify command. But I wonder if we can do that via 
the feature bits?

Thanks


> +\end{lstlisting}
> diff --git a/content.tex b/content.tex
> index 32de668..c524fab 100644
> --- a/content.tex
> +++ b/content.tex
> @@ -99,10 +99,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
>   \begin{description}
>   \item[0 to 23] Feature bits for the specific device type
>   
> -\item[24 to 40] Feature bits reserved for extensions to the queue and
> +\item[24 to 41] Feature bits reserved for extensions to the queue and
>     feature negotiation mechanisms
>   
> -\item[41 and above] Feature bits reserved for future extensions.
> +\item[42 and above] Feature bits reserved for future extensions.
>   \end{description}
>   
>   \begin{note}
> @@ -449,6 +449,8 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo
>   types. It is RECOMMENDED that devices generate version 4
>   UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}.
>   
> +\input{admin-virtq.tex}
> +
>   \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation}
>   
>   We start with an overview of device initialization, then expand on the
> @@ -6847,6 +6849,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
>     that the driver can reset a queue individually.
>     See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}.
>   
> +  \item[VIRTIO_F_ADMIN_VQ (41)] This feature indicates that
> +  the device supports administration virtqueue negotiation.
> +
>   \end{description}
>   
>   \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/


  parent reply	other threads:[~2022-01-27  3:14 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24  9:39 [PATCH v2 0/4] VIRTIO: Provision maximum MSI-X vectors for a VF Max Gurtovoy
2022-01-24  9:39 ` [PATCH v2 1/4] Add virtio Admin Virtqueue Max Gurtovoy
2022-01-26 14:40   ` Michael S. Tsirkin
2022-01-26 14:54     ` [virtio-comment] " Max Gurtovoy
2022-01-26 15:03       ` Michael S. Tsirkin
2022-01-26 15:16         ` [virtio-comment] " Max Gurtovoy
2022-01-27  3:56         ` Parav Pandit
2022-01-27  3:55     ` Parav Pandit
2022-01-27  3:56       ` Jason Wang
2022-01-27  3:14   ` Jason Wang [this message]
2022-01-27 10:25     ` [virtio-comment] " Max Gurtovoy
2022-01-27 13:03       ` Jason Wang
2022-01-27 14:46         ` Max Gurtovoy
2022-01-28  3:18           ` Jason Wang
2022-01-30 10:31             ` Max Gurtovoy
2022-02-09  2:45               ` Jason Wang
2022-02-09 11:43                 ` Max Gurtovoy
2022-01-28 12:14   ` [virtio-comment] " Cornelia Huck
2022-01-28 12:47     ` Michael S. Tsirkin
2022-01-28 15:49       ` [virtio-comment] " Cornelia Huck
2022-01-28 15:52         ` Michael S. Tsirkin
2022-01-28 16:14           ` [virtio-dev] " Cornelia Huck
2022-01-28 16:16             ` Michael S. Tsirkin
2022-01-28 16:23               ` [virtio-dev] " Cornelia Huck
2022-01-29  3:53           ` Jason Wang
2022-01-30  9:13             ` Max Gurtovoy
2022-01-30  9:40               ` Michael S. Tsirkin
2022-01-30  9:56                 ` Max Gurtovoy
2022-01-30 14:41                   ` Michael S. Tsirkin
2022-01-30 15:12                     ` Max Gurtovoy
2022-01-30 15:30                       ` Michael S. Tsirkin
2022-01-30 18:23                         ` [virtio-comment] " Max Gurtovoy
2022-01-30 21:15                           ` Michael S. Tsirkin
2022-01-31  9:16                         ` [virtio-dev] " Cornelia Huck
2022-01-31 13:40                           ` Michael S. Tsirkin
2022-01-31 14:26                             ` [virtio-comment] " Cornelia Huck
2022-01-31 14:52                               ` Michael S. Tsirkin
2022-01-31 15:48                                 ` [virtio-dev] " Cornelia Huck
2022-01-31 16:00                                   ` Michael S. Tsirkin
2022-01-31 16:12                                 ` Halil Pasic
2022-01-31 17:10                                   ` [virtio-dev] " Cornelia Huck
2022-01-31 17:22                                     ` Michael S. Tsirkin
2022-02-01 11:53                                     ` [virtio-dev] " Halil Pasic
2022-02-01 17:01                                       ` Cornelia Huck
2022-02-01 18:34                                         ` Michael S. Tsirkin
2022-01-31 15:47                           ` Halil Pasic
2022-01-31 16:01                             ` Michael S. Tsirkin
2022-01-31 16:12                             ` Cornelia Huck
2022-02-09  2:27                         ` Jason Wang
2022-02-09  7:46                           ` Michael S. Tsirkin
2022-01-30  9:39             ` Michael S. Tsirkin
2022-01-30 11:21     ` [virtio-comment] " Max Gurtovoy
2022-01-30 14:37       ` Michael S. Tsirkin
2022-01-24  9:39 ` [virtio-comment] [PATCH v2 2/4] virtio-blk: add support for VIRTIO_F_ADMIN_VQ Max Gurtovoy
2022-01-24  9:39 ` [PATCH v2 3/4] virtio-net: " Max Gurtovoy
2022-01-24  9:39 ` [PATCH v2 4/4] Add support for MSI-X vectors configuration for PCI VFs Max Gurtovoy
2022-01-25 11:53   ` Michael S. Tsirkin
2022-01-26 13:03     ` Parav Pandit
2022-01-26 14:08       ` [virtio-comment] " Michael S. Tsirkin
2022-01-27  3:40         ` Parav Pandit
2022-01-27 12:39           ` Michael S. Tsirkin
2022-01-27 14:16             ` Parav Pandit
2022-01-27 17:28               ` Michael S. Tsirkin
2022-01-27  3:36   ` Jason Wang
2022-01-27  5:22     ` Parav Pandit
2022-01-28  3:23       ` [virtio-comment] " Jason Wang
2022-01-28  3:30         ` Parav Pandit
2022-01-28  3:35           ` Jason Wang
2022-01-28  3:45             ` Parav Pandit

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=1b77bbb8-a488-a2a8-1374-b8691356ac15@redhat.com \
    --to=jasowang@redhat.com \
    --cc=virtio-comment@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 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.