virtio-dev.lists.oasis-open.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-comment@lists.oasis-open.org,
	virtio-dev@lists.oasis-open.org, jasowang@redhat.com,
	cohuck@redhat.com, sgarzare@redhat.com, nrupal.jani@intel.com,
	Piotr.Uminski@intel.com, hang.yuan@intel.com,
	virtio@lists.oasis-open.org,
	Zhu Lingshan <lingshan.zhu@intel.com>,
	pasic@linux.ibm.com, Shahaf Shuler <shahafs@nvidia.com>,
	Parav Pandit <parav@nvidia.com>,
	Max Gurtovoy <mgurtovoy@nvidia.com>
Subject: [virtio-dev] Re: [PATCH v10 08/10] admin: command list discovery
Date: Thu, 2 Mar 2023 16:09:29 -0500	[thread overview]
Message-ID: <20230302210929.GH2554028@fedora> (raw)
In-Reply-To: <80c4bc60c9119f68b66f5a003564cec719cc1487.1677761896.git.mst@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 6643 bytes --]

On Thu, Mar 02, 2023 at 08:05:22AM -0500, Michael S. Tsirkin wrote:
> Add commands to find out which commands does each group support,
> as well as enable their use by driver.
> This will be especially useful once we have multiple group types.
> 
> An alternative is per-type VQs. This is possible but will
> require more per-transport work. Discovery through the vq
> helps keep things contained.
> 
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  admin.tex | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 96 insertions(+), 1 deletion(-)
> 
> diff --git a/admin.tex b/admin.tex
> index 3ffac2e..1172054 100644
> --- a/admin.tex
> +++ b/admin.tex
> @@ -99,7 +99,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
>  \hline
>  opcode & Name & Command Description \\
>  \hline \hline
> -0x0000 - 0x7FFF & - &  Group administration commands    \\
> +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type    \\
> +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\
> +0x0002 - 0x7FFF & - &  Group administration commands    \\
>  \hline
>  0x8000 - 0xFFFF & - & Reserved    \\
>  \hline
> @@ -156,6 +158,99 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
>  depends on these structures and is described separately or is
>  implicit in the structure description.
>  
> +Before sending any administration commands to the device, the driver
> +needs to communicate to the device which commands it is going to
> +use. Initially (after reset), only two commands are assumed to be used:
> +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE.
> +
> +Before sending any other commands for any member of a specific group to
> +the device, the driver queries the supported commands via
> +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via

"will use" probably means "is capable of using" rather than "is sure to
use"? It might be worth tweaking the language here to make that clear.

> +VIRTIO_ADMIN_CMD_LIST_USE.
> +
> +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and
> +VIRTIO_ADMIN_CMD_LIST_USE
> +both use the following structure describing the
> +command opcodes:
> +
> +\begin{lstlisting}
> +struct virtio_admin_cmd_list {
> +       /* Indicates which of the below fields were returned
> +       le64 device_admin_cmds[];
> +};
> +\end{lstlisting}
> +
> +This structure is an array of 64 bit values in little-endian byte
> +order, in which a bit is set if the specific command opcode
> +is supported. Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value
> +in this array corresponding to opcodes 0 to 63,
> +\field{device_admin_cmds[1]} is the second 64-bit value
> +corresponding to opcodes 64 to 127, etc.
> +For example, the array of size 2 including
> +the values 0x3 in \field{device_admin_cmds[0]}
> +and 0x1 in \field{device_admin_cmds[1]} indicates that only
> +opcodes 0, 1 and 64 are supported.
> +The length of the array depends on the supported opcodes - it is
> +large enough to include bits set for all supported opcodes,
> +that is the length can be calculated by starting with the largest
> +supported opcode adding one, dividing by 64 and rounding up.
> +In other words, for
> +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE the
> +length of \field{command_specific_result} and
> +\field{command_specific_data} respectively will be
> +$DIV_ROUND_UP(max_cmd, 64) * 8$ where DIV_ROUND_UP is integer division
> +with round up and \field{max_cmd} is the largest available command opcode.
> +
> +The array is also allowed to be larger and to additionally
> +include an arbitrary number of all-zero entries.
> +
> +Accordingly, bits 0 and 1 corresponding to opcode 0
> +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1
> +(VIRTIO_ADMIN_CMD_LIST_USE) are
> +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY.
> +
> +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0.
> +The \field{group_member_id} is unused. It is set to zero by driver.
> +This command has no command specific data.
> +The device, upon success, returns a result in
> +\field{command_specific_result} in the format
> +\field{struct virtio_admin_cmd_list} describing the
> +list of administration commands supported for the given group.
> +
> +
> +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode}
> +is set to 0x1.
> +The \field{group_member_id} is unused. It is set to zero by driver.
> +The \field{command_specific_data} is in the format
> +\field{struct virtio_admin_cmd_list} describing the
> +list of administration commands used by the driver.
> +This command has no command specific result.
> +
> +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to
> +query the list of commands valid for this group and before sending
> +any commands for any member of a group.
> +
> +The driver then enables use of some of the opcodes by sending to
> +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset
> +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is
> +both understood and used by the driver.
> +
> +If the device supports the command list used by the driver, the
> +device completes the command with status VIRTIO_ADMIN_STATUS_OK.
> +If the device does not support the command list, the device
> +completes the command with status
> +VIRTIO_ADMIN_STATUS_INVALID_FIELD.
> +
> +Note: drivers are assumed not to set bits in device_admin_cmds
> +if they are not familiar with how the command opcode
> +is used, since devices could have dependencies between
> +command opcodes.
> +
> +It is assumed that all members in a group support and are used
> +with the same list of commands. However, for owner devices
> +supporting multiple group types, the list of supported commands
> +might differ between different group types.

Is the purpose of VIRTIO_ADMIN_CMD_LIST_USE so that new commands can be
added that are mandatory for device operation. Failure to include them
in the VIRTIO_ADMIN_CMD_LIST_USE command terminates device
initialization with an error?

Are commands evolved by defining flag/version bits in the command
specific data struct? For example, if a new field needs to be added to a
command and a 0 value carries a meaning (so it cannot simply be added to
the end of the existing struct with backwards compatibility).

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-03-02 21:09 UTC|newest]

Thread overview: 169+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 13:04 [virtio-dev] [PATCH v10 00/10] Introduce device group and device management Michael S. Tsirkin
2023-03-02 13:04 ` [virtio-dev] [PATCH v10 01/10] virtio: document forward compatibility guarantees Michael S. Tsirkin
2023-03-02 18:39   ` [virtio-dev] " Parav Pandit
2023-03-02 23:43     ` [virtio-dev] " Michael S. Tsirkin
     [not found]   ` <m2leka0yvl.fsf@oracle.com>
2023-03-06 22:00     ` [virtio-dev] Re: [virtio] " Michael S. Tsirkin
2023-03-07 10:04       ` David Edmondson
2023-03-08 14:16         ` Cornelia Huck
2023-03-08 15:04           ` Michael S. Tsirkin
2023-03-02 13:04 ` [virtio-dev] [PATCH v10 02/10] admin: introduce device group and related concepts Michael S. Tsirkin
2023-03-02 18:39   ` [virtio-dev] " Parav Pandit
2023-03-02 23:44     ` [virtio-dev] " Michael S. Tsirkin
2023-03-02 19:40   ` [virtio-dev] Re: [virtio] " Stefan Hajnoczi
2023-03-06 17:00   ` David Edmondson
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 03/10] admin: introduce group administration commands Michael S. Tsirkin
2023-03-02 18:40   ` [virtio-dev] " Parav Pandit
2023-03-02 20:19     ` [virtio-dev] " Stefan Hajnoczi
2023-03-03  0:01       ` Michael S. Tsirkin
2023-03-03 13:17         ` Stefan Hajnoczi
2023-03-03 13:19           ` Michael S. Tsirkin
     [not found]             ` <4f869944-4ccd-c51e-0f30-dc3ba15ffd52@nvidia.com>
2023-03-07 18:33               ` [virtio-dev] " Parav Pandit
2023-03-08  0:34               ` [virtio-dev] " Michael S. Tsirkin
2023-03-08  1:01                 ` [virtio-dev] " Parav Pandit
2023-03-08  1:06                   ` [virtio-dev] " Michael S. Tsirkin
2023-03-08  1:14                     ` [virtio-dev] " Parav Pandit
     [not found]                 ` <6668fd7a-3eb3-0447-9cbf-72d308b1336a@nvidia.com>
2023-03-08 12:07                   ` [virtio-dev] " Michael S. Tsirkin
     [not found]                     ` <992e9a1e-3799-842c-79f3-e66f5c823356@nvidia.com>
2023-03-08 14:43                       ` Cornelia Huck
2023-03-08 14:54                         ` Michael S. Tsirkin
2023-03-08 15:21                       ` Michael S. Tsirkin
     [not found]                   ` <2ef47f53-5978-4b6a-593d-4e94eba0b9ac@nvidia.com>
2023-03-09  6:38                     ` [virtio-dev] Re: [virtio-comment] " Michael S. Tsirkin
2023-03-02 23:47     ` [virtio-dev] " Michael S. Tsirkin
2023-03-07 18:26       ` [virtio-dev] " Parav Pandit
2023-03-02 20:10   ` [virtio-dev] " Stefan Hajnoczi
2023-03-02 23:57     ` Michael S. Tsirkin
2023-03-03 13:13       ` Stefan Hajnoczi
2023-03-03 13:18         ` Michael S. Tsirkin
2023-03-03 20:23           ` Stefan Hajnoczi
2023-03-07 11:31             ` Jiri Pirko
2023-03-08 12:03               ` Michael S. Tsirkin
2023-03-07 10:31   ` [virtio-dev] Re: [virtio] " David Edmondson
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 04/10] admin: introduce virtio admin virtqueues Michael S. Tsirkin
2023-03-02 18:40   ` [virtio-dev] " Parav Pandit
2023-03-02 23:48     ` [virtio-dev] " Michael S. Tsirkin
2023-03-02 20:40   ` Stefan Hajnoczi
2023-03-03  0:05     ` Michael S. Tsirkin
2023-03-03 13:28       ` Stefan Hajnoczi
2023-03-03 13:37         ` Michael S. Tsirkin
2023-03-03 20:21           ` [virtio-dev] Re: [virtio] " Stefan Hajnoczi
2023-03-05  9:38             ` Michael S. Tsirkin
2023-03-06  0:03               ` Stefan Hajnoczi
2023-03-06  0:18                 ` Michael S. Tsirkin
     [not found]                   ` <20230306110340.GA35392@fedora>
2023-03-06 18:37                     ` Michael S. Tsirkin
2023-03-06 20:17                       ` Stefan Hajnoczi
2023-03-06 21:43                         ` Michael S. Tsirkin
2023-03-31 11:07                         ` Michael S. Tsirkin
2023-03-07  8:03                       ` [virtio-dev] Re: [virtio-comment] " Jiri Pirko
2023-03-07 14:39                         ` Stefan Hajnoczi
2023-03-07 15:07                           ` Jiri Pirko
2023-03-07 19:03                             ` Stefan Hajnoczi
2023-03-07 19:09                               ` [virtio-dev] " Parav Pandit
2023-03-08  5:17                                 ` [virtio-dev] Re: [virtio] " Jason Wang
2023-03-08 11:58                                   ` Stefan Hajnoczi
2023-03-08 11:59                                   ` Michael S. Tsirkin
2023-03-08 10:17                               ` [virtio-dev] " Jiri Pirko
2023-03-08 12:44                                 ` Stefan Hajnoczi
2023-03-08 12:57                                   ` [virtio-dev] Re: [virtio] " Jiri Pirko
2023-03-08 17:17                                     ` Stefan Hajnoczi
2023-03-07 16:13                         ` [virtio-dev] " Michael S. Tsirkin
2023-03-08 10:08                           ` Jiri Pirko
2023-03-08 11:44                             ` Michael S. Tsirkin
     [not found]                 ` <7f63fa0a-7deb-5875-6c6b-bfc651681653@redhat.com>
     [not found]                   ` <20230306112030.GB35392@fedora>
     [not found]                     ` <853c78d0-f752-05e9-d79d-811e82801627@nvidia.com>
2023-03-06 16:25                       ` [virtio-dev] " Stefan Hajnoczi
2023-03-07 19:04                         ` [virtio-dev] " Parav Pandit
     [not found]                         ` <e74483a4-38fa-99b5-86b8-785f0b98d029@nvidia.com>
2023-03-08 14:13                           ` [virtio-dev] Re: [virtio-comment] " Stefan Hajnoczi
2023-03-08 16:21                             ` [virtio-dev] " Parav Pandit
     [not found]                             ` <18ddbf69-19a6-3c6b-9e42-aaae66e20bcf@nvidia.com>
2023-03-08 17:15                               ` [virtio-dev] " Stefan Hajnoczi
2023-03-08 17:21                                 ` Michael S. Tsirkin
2023-03-09 12:35                                   ` Stefan Hajnoczi
2023-03-09 13:55                                     ` Michael S. Tsirkin
2023-03-09 15:56                                       ` Stefan Hajnoczi
     [not found]       ` <e8d41902-b794-66e9-8f15-e8617435047c@redhat.com>
2023-03-06 16:22         ` [virtio-dev] " Jiri Pirko
     [not found]       ` <027fff1b-8ed7-abc0-2331-b188b8822bf4@nvidia.com>
2023-03-06 22:49         ` [virtio-dev] Re: [virtio-comment] " Michael S. Tsirkin
     [not found]           ` <e12ab469-4586-f0f5-b084-8f2d7c031e11@nvidia.com>
2023-03-08 21:09             ` Michael S. Tsirkin
2023-03-08 21:17               ` [virtio-dev] " Parav Pandit
2023-03-09  7:28               ` [virtio-dev] " Jiri Pirko
2023-03-07  7:56         ` Jiri Pirko
     [not found]   ` <ZAXfegxCfvfLwiJT@nanopsycho>
2023-03-06 18:40     ` [virtio-dev] Re: [virtio] " Michael S. Tsirkin
2023-03-07  7:36       ` Jiri Pirko
2023-03-07 16:30         ` Michael S. Tsirkin
2023-03-08 10:05           ` [virtio-dev] Re: [virtio-comment] " Jiri Pirko
2023-03-08 11:50             ` Michael S. Tsirkin
2023-03-08 12:08               ` Jiri Pirko
     [not found]                 ` <18d51bc0-d759-1a05-cb7c-3d46c4ed2f1a@nvidia.com>
2023-03-08 18:01                   ` David Edmondson
2023-03-08 18:19                     ` Jiri Pirko
2023-03-08 21:25                     ` [virtio-dev] " Parav Pandit
2023-03-09  7:30                       ` [virtio-dev] " Jiri Pirko
2023-03-09 13:04                         ` [virtio-dev] " Parav Pandit
2023-03-09 13:57                           ` [virtio-dev] " Michael S. Tsirkin
2023-03-09 14:02                           ` [virtio-dev] " David Edmondson
2023-03-09 14:11                             ` Parav Pandit
2023-03-09 14:22                               ` [virtio-dev] " Michael S. Tsirkin
2023-03-09 14:30                                 ` [virtio-dev] " Parav Pandit
2023-03-09 14:43                                   ` [virtio-dev] " Michael S. Tsirkin
2023-03-09 16:53                                     ` [virtio-dev] " Parav Pandit
2023-03-09 17:14                                       ` [virtio-dev] " Michael S. Tsirkin
2023-03-09 17:16                                         ` [virtio-dev] " Parav Pandit
2023-03-08 21:45             ` Parav Pandit
2023-03-09  7:37               ` [virtio-dev] " Jiri Pirko
2023-03-09 12:36                 ` [virtio-dev] " Parav Pandit
2023-03-09 16:32                   ` [virtio-dev] " Jiri Pirko
     [not found]     ` <17471553-8981-eef9-656b-098e1acdda14@nvidia.com>
2023-03-06 18:44       ` [virtio-dev] " Michael S. Tsirkin
2023-03-07 10:41   ` David Edmondson
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 05/10] pci: add admin vq registers to virtio over pci Michael S. Tsirkin
2023-03-02 20:51   ` [virtio-dev] " Stefan Hajnoczi
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 06/10] mmio: document ADMIN_VQ as reserved Michael S. Tsirkin
2023-03-02 18:40   ` [virtio-dev] " Parav Pandit
2023-03-02 23:51     ` [virtio-dev] " Michael S. Tsirkin
2023-03-02 23:51     ` Michael S. Tsirkin
2023-03-03  8:34     ` Michael S. Tsirkin
     [not found]       ` <ZAXB44F3MS9CxIiK@nanopsycho>
2023-03-06 18:46         ` [virtio-dev] Re: [virtio] " Michael S. Tsirkin
2023-03-07  7:40           ` [virtio-dev] Re: [virtio-comment] " Jiri Pirko
2023-03-07 18:52       ` [virtio-dev] " Parav Pandit
2023-03-08 16:24         ` [virtio-dev] Re: [virtio-comment] " Cornelia Huck
2023-03-08 16:37           ` [virtio-dev] " Parav Pandit
2023-03-08 16:30         ` [virtio-dev] " Michael S. Tsirkin
2023-03-08 18:21           ` [virtio-dev] Re: [virtio] " Jiri Pirko
2023-03-02 20:52   ` [virtio-dev] " Stefan Hajnoczi
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 07/10] ccw: " Michael S. Tsirkin
2023-03-02 20:53   ` [virtio-dev] " Stefan Hajnoczi
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 08/10] admin: command list discovery Michael S. Tsirkin
2023-03-02 21:09   ` Stefan Hajnoczi [this message]
2023-03-31 11:39     ` [virtio-dev] " Michael S. Tsirkin
2023-03-07 10:54   ` [virtio-dev] " David Edmondson
     [not found]   ` <ZAXbBgN2jw8RhE/3@nanopsycho>
2023-03-08 11:54     ` Michael S. Tsirkin
2023-03-08 12:41       ` Jiri Pirko
2023-03-31 11:43         ` [virtio-dev] Re: [virtio-comment] " Michael S. Tsirkin
2023-03-08 12:38   ` Jiri Pirko
2023-03-10  8:14   ` [virtio-dev] " Zhu, Lingshan
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 09/10] admin: conformance clauses Michael S. Tsirkin
2023-03-07 11:04   ` [virtio-dev] Re: [virtio-comment] " David Edmondson
2023-03-08 11:58     ` Michael S. Tsirkin
2023-03-08 12:59       ` David Edmondson
2023-03-08 13:05         ` [virtio-dev] Re: [virtio] " Jiri Pirko
2023-03-08 13:22           ` Michael S. Tsirkin
2023-03-08 13:44           ` David Edmondson
2023-03-08 14:02             ` Jiri Pirko
2023-03-08 14:12               ` Michael S. Tsirkin
2023-03-10  9:10   ` [virtio-dev] " Zhu, Lingshan
2023-03-10  9:13     ` Michael S. Tsirkin
2023-03-10 18:00       ` Zhu Lingshan
2023-03-10  9:34     ` Michael S. Tsirkin
2023-03-02 13:05 ` [virtio-dev] [PATCH v10 10/10] ccw: document more reserved features Michael S. Tsirkin
2023-03-02 21:12   ` [virtio-dev] " Stefan Hajnoczi
2023-03-02 13:38 ` [virtio-dev] RE: [PATCH v10 00/10] Introduce device group and device management Parav Pandit
2023-03-02 23:27   ` [virtio-dev] " Michael S. Tsirkin
2023-03-02 18:39 ` [virtio-dev] " Parav Pandit
2023-03-06 16:40 ` [virtio-dev] Re: [virtio-comment] " Jiri Pirko
2023-03-06 22:48   ` Michael S. Tsirkin
2023-03-07  7:17     ` Jiri Pirko
2023-03-07 17:15       ` Michael S. Tsirkin
     [not found] ` <ZAXcqqdwfoLokT2l@nanopsycho>
2023-03-06 22:54   ` Michael S. Tsirkin
2023-03-07  7:21     ` Jiri Pirko
2023-03-07 17:20       ` Michael S. Tsirkin
2023-03-07 19:31         ` [virtio-dev] " Parav Pandit
2023-03-08  5:11           ` [virtio-dev] " Jason Wang
2023-03-08 12:02             ` [virtio-dev] " Parav Pandit
2023-03-10  8:32           ` [virtio-dev] " Zhu, Lingshan
2023-03-08  9:49         ` [virtio-dev] Re: [virtio] " Jiri Pirko
2023-03-08 16:30     ` [virtio-dev] " Cornelia Huck
2023-03-08 17:22       ` Michael S. Tsirkin
2023-03-08 18:15       ` Jiri Pirko

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=20230302210929.GH2554028@fedora \
    --to=stefanha@redhat.com \
    --cc=Piotr.Uminski@intel.com \
    --cc=cohuck@redhat.com \
    --cc=hang.yuan@intel.com \
    --cc=jasowang@redhat.com \
    --cc=lingshan.zhu@intel.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=mst@redhat.com \
    --cc=nrupal.jani@intel.com \
    --cc=parav@nvidia.com \
    --cc=pasic@linux.ibm.com \
    --cc=sgarzare@redhat.com \
    --cc=shahafs@nvidia.com \
    --cc=virtio-comment@lists.oasis-open.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtio@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;
as well as URLs for NNTP newsgroup(s).