admin: Enable driver to send admin commands before DRIVER_OK
PATCH 1/1 admin: Enable driver to send admin commands before DRIVER_OK
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached DRIVER_OK stage similar to all other queues. This is a limiting factor.
Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the DRIVER_OK stage. Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.
b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed to DRIVER_OK and follow the current flow.
To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before DRIVER_OK via the available interface such as administration virtqueue.
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)
admin.tex +16 -0
@@ -334,6 +334,11 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between different group types. +When the driver has negotiated the feature VIRTIO_F_EARLY_CAP_ADMIN_CMD, the +driver can use administration commands VIRTIO_ADMIN_CMD_LIST_QUERY, +VIRTIO_ADMIN_CMD_LIST_USE and commands related to device and driver capabilities +listed in \ref[sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device and driver capabilities]{device and driver capabilities} for the self-group type before the driver indicates DRIVER_OK status to the device. + \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}
@@ -608,6 +613,14 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic or VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOT have any side effects, making it safe to retry. +If VIRTIO_F_EARLY_CAP_ADMIN_CMD feature is negotiated, the device MUST process +administration commands related to device and driver capabilities before the +driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMD features are negotiated, +the device MUST be able to generate notifications related to the administration +virtqueue before the driver indicates DRIVER_OK to the device. + \drivernormative{\subsection}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} The driver MAY supply device-readable or device-writeable parts
@@ -641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic The driver SHOULD retry a command that completed with \field{status} VIRTIO_ADMIN_STATUS_EAGAIN. + +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, the driver MAY send commands +only to the first administration queue defined by the specific transport.
content.tex +12 -1
@@ -540,6 +540,8 @@ \section{Device Initialization}\label{sec:General Initialization And Device Oper device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues. +\item\label{itm:General Initialization And Device Operation / Device Initialization / Capabilities Access} Optionally get device capabilities and set driver capabilities if VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated. + \item\label{itm:General Initialization And Device Operation / Device Initialization / Set DRIVER-OK} Set the DRIVER_OK status bit. At this point the device is ``live''. \end{enumerate}
@@ -550,7 +552,9 @@ \section{Device Initialization}\label{sec:General Initialization And Device Oper driver MUST NOT continue initialization in that case. The driver MUST NOT send any buffer available notifications to -the device before setting DRIVER_OK. +the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated. \subsection{Legacy Interface: Device Initialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacy devices did not support the FEATURES_OK status bit, and thus did
@@ -879,6 +883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for handling features reserved for future use. + \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicates that the device + exposes an administration command interface which is accessible to the driver + before the driver indicates DRIVER_OK device status. When this feature is + negotiated, once the the administration commands interface is configured, it can be + used by the driver to issue administration commands related to device and driver + capabilities. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
transport-pci.tex +6 -0
@@ -495,6 +495,12 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues. +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been negotiated, +the device MUST support administration commands through the +administration virtqueue identified by the \field{admin_queue_index} +after the administration virtqueue is enabled and +before the driver sets DRIVER_OK to the \field{device_status}. + \drivernormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout} The driver MUST NOT write to \field{device_feature}, \field{num_queues},
Signature · 1 line
2.34.1
Quoted 19 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage. Some examples are:a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.
Quoted 5 lines
To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administration virtqueue.Signed-off-by Parav Pandit <[email protected]>
We were there in 1.0 and it's messy. And next thing you do, you will want it before features ok, and we will keep piling up hacks. I think that if we want to do admin commands before VQs are active, we should just add a capability with registers for that. People wanted that anyway.
Quoted 101 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +16
-0@@ -334,6 +334,11 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between different group types. +When the driver has negotiated the feature VIRTIO_F_EARLY_CAP_ADMIN_CMD, the +driver can use administration commands VIRTIO_ADMIN_CMD_LIST_QUERY, +VIRTIO_ADMIN_CMD_LIST_USE and commands related to device and driver capabilities +listed in \ref[sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device and driver capabilities]{device and driver capabilities} for the self-group type before the driver indicates DRIVER_OK status to the device. + \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic or VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOT have any side effects, making it safe to retry. +If VIRTIO_F_EARLY_CAP_ADMIN_CMD feature is negotiated, the device MUST process +administration commands related to device and driver capabilities before the +driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMD features are negotiated, +the device MUST be able to generate notifications related to the administration +virtqueue before the driver indicates DRIVER_OK to the device. + \drivernormative{\subsection}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} The driver MAY supply device-readable or device-writeable parts@@ -641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic The driver SHOULD retry a command that completed with \field{status} VIRTIO_ADMIN_STATUS_EAGAIN. + +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, the driver MAY send commands +only to the first administration queue defined by the specific transport.content.tex +12
-1@@ -540,6 +540,8 @@ \section{Device Initialization}\label{sec:General Initialization And Device Oper device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues. +\item\label{itm:General Initialization And Device Operation / Device Initialization / Capabilities Access} Optionally get device capabilities and set driver capabilities if VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated. + \item\label{itm:General Initialization And Device Operation / Device Initialization / Set DRIVER-OK} Set the DRIVER_OK status bit. At this point the device is ``live''. \end{enumerate}@@ -550,7 +552,9 @@ \section{Device Initialization}\label{sec:General Initialization And Device Oper driver MUST NOT continue initialization in that case. The driver MUST NOT send any buffer available notifications to -the device before setting DRIVER_OK. +the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated. \subsection{Legacy Interface: Device Initialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacy devices did not support the FEATURES_OK status bit, and thus did@@ -879,6 +883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for handling features reserved for future use. + \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicates that the device + exposes an administration command interface which is accessible to the driver + before the driver indicates DRIVER_OK device status. When this feature is + negotiated, once the the administration commands interface is configured, it can be + used by the driver to issue administration commands related to device and driver + capabilities. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}transport-pci.tex +6
-0@@ -495,6 +495,12 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues. +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been negotiated, +the device MUST support administration commands through the +administration virtqueue identified by the \field{admin_queue_index} +after the administration virtqueue is enabled and +before the driver sets DRIVER_OK to the \field{device_status}. + \drivernormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout} The driver MUST NOT write to \field{device_feature}, \field{num_queues},Signature · 1 line
2.34.1
Quoted 29 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 23 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage. Some examples are:a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administration virtqueue.
Quoted 5 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
Never before features ok, feature negotiation is two ways communication that indicates device, that queue notification is coming.
Quoted 4 lines
I think that if we want
to do admin commands before VQs are active, we should just add a capability with registers for that. People wanted that anyway.
We discussed before that pci-sig discourages piling up vendor specific caps.
So better to avoid that.
An alternative would be to bump up the pci revision_id, which would align to pci-sig and its known early enough.
Though it does not take away the feature bit because device preparation is needed to setup early admin commands.
And feature bit can be a good hint to inform that.
Only revision_id (from device to driver) is not good enough as there can be large sw stack which may never use it and no point in enabling this in the device without driver using it. So feature bit proposed here is self-contained, and its early enough.
Quoted 134 lines
Quoted 15 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 2 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
admin.tex
Quoted 4 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use administration +commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 1 line
+commands related to device and driver capabilities listed in \ref[sec:Basic
Facilities of a Virtio Device / Device groups / Group administration commands / Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus to the device.Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOT haveany side effects, making it safe to retry.
admin.tex
Quoted 6 lines
admin.tex +5
-0+If VIRTIO_F_EARLY_CAP_ADMIN_CMD feature is negotiated, the device +MUST process administration commands related to device and driver +capabilities before the driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMD featuresare
admin.tex
Quoted 2 lines
admin.tex +2
-0+negotiated, the device MUST be able to generate notifications related +to the administration virtqueue before the driver indicates DRIVER_OK tothe device.
admin.tex
Quoted 13 lines
+
\drivernormative{\subsection}{Group administration commands}{Basic
Facilities of a Virtio Device / Administration virtqueues}The driver MAY supply device-readable or device-writeable parts @@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with \field{status}
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +3
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, the driver +MAY send commands only to the first administration queue defined bythe specific transport.
content.tex \section{Device Initialization}\label{sec:General
Quoted 4 lines
content.tex +0
-0@@ -540,6 +540,8 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper
content.tex \section{Device Initialization}\label{sec:General Initialization And Device Oper
Quoted 4 lines
content.tex +1
-0device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues. +\item\label{itm:General Initialization And Device Operation / DeviceInitialization / Capabilities Access} Optionally get device capabilities and set driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDis negotiated.content.tex \section{Device Initialization}\label{sec:General · line 545
Quoted 2 lines
content.tex +1
-0+ \item\label{itm:General Initialization And Device Operation / DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this point the device isQuoted 4 lines
content.tex +0
-0``live''. \end{enumerate}@@ -550,7 +552,9 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper driver MUST NOT continue initialization in
that case.
Quoted 10 lines
The driver MUST NOT send any buffer available notifications to -the
device before settingDRIVER_OK.content.tex +3
-0+the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated. \subsection{Legacy Interface: DeviceInitialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacy
devices did not support the
FEATURES_OKstatus bit, and thus did @@ -879,6 +883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}Quoted 1 line
\ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
for
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Quoted 3 lines
content.tex +1
-0handling features reserved for future use. + \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicatesthat the device
Quoted 1 line
+ exposes an administration command interface which is accessible to the
driver
Quoted 1 line
+ before the driver indicates
DRIVER_OKdevice status. When this featureis
Quoted 1 line
+ negotiated, once the the administration commands interface is
configured, it can be
Quoted 1 line
+ used by the driver to issue administration commands related to device
and driver
Quoted 13 lines
content.tex +2
-0+ capabilities. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved FeatureBits} diff --git a/transport-pci.tex b/transport-pci.tex index 95b08b8..a612b34 100644
transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configuration structurelayout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues.
transport-pci.tex
Quoted 5 lines
transport-pci.tex +5
-0+If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been +negotiated, the device MUST support administration commands through +the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue is +enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 29 lines · Parav Pandit
Quoted 29 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 23 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage. Some examples are:a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administration virtqueue.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
I do. And I keep saying, we need to be proactive, address more than one problem with each feature and try to predict what will be needed, otherwise it will be a mess of a million conflicting features.
Quoted 8 lines
Never before features ok, feature negotiation is two ways communication that indicates device, that queue notification is coming.
Quoted 4 lines
I think that if we want
to do admin commands before VQs are active, we should just add a capability with registers for that. People wanted that anyway.We discussed before that pci-sig discourages piling up vendor specific caps. So better to avoid that.
Well, that's a separate issue. Actually pci endpoint guys already want a way to access device without messing up with capabilities. So we'll likely create a way to put capabilities in a BAR.
Quoted 5 lines
An alternative would be to bump up the pci
revision_id, which would align to pci-sig and its known early enough.
Though it does not take away the feature bit because device preparation is needed to setup early admin commands.
And feature bit can be a good hint to inform that.
Onlyrevision_id(from device to driver) is not good enough as there can be large sw stack which may never use it and no point in enabling this in the device without driver using it. So feature bit proposed here is self-contained, and its early enough.
I don't really get what this revision_id discussion is about.
Quoted 134 lines
Quoted 134 lines
Quoted 15 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 2 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
admin.tex
Quoted 4 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use administration +commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 1 line
+commands related to device and driver capabilities listed in \ref[sec:Basic
Facilities of a Virtio Device / Device groups / Group administration commands / Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus to the device.Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOT haveany side effects, making it safe to retry.
admin.tex
Quoted 6 lines
admin.tex +5
-0+If VIRTIO_F_EARLY_CAP_ADMIN_CMD feature is negotiated, the device +MUST process administration commands related to device and driver +capabilities before the driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMD featuresare
admin.tex
Quoted 2 lines
admin.tex +2
-0+negotiated, the device MUST be able to generate notifications related +to the administration virtqueue before the driver indicates DRIVER_OK tothe device.
admin.tex
Quoted 13 lines
+
\drivernormative{\subsection}{Group administration commands}{Basic
Facilities of a Virtio Device / Administration virtqueues}The driver MAY supply device-readable or device-writeable parts @@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with \field{status}
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +3
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, the driver +MAY send commands only to the first administration queue defined bythe specific transport.
content.tex \section{Device Initialization}\label{sec:General
Quoted 4 lines
content.tex +0
-0@@ -540,6 +540,8 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper
content.tex \section{Device Initialization}\label{sec:General Initialization And Device Oper
Quoted 4 lines
content.tex +1
-0device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues. +\item\label{itm:General Initialization And Device Operation / DeviceInitialization / Capabilities Access} Optionally get device capabilities and set driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDis negotiated.content.tex \section{Device Initialization}\label{sec:General · line 545
Quoted 2 lines
content.tex +1
-0+ \item\label{itm:General Initialization And Device Operation / DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this point the device isQuoted 4 lines
content.tex +0
-0``live''. \end{enumerate}@@ -550,7 +552,9 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper driver MUST NOT continue initialization in
that case.
Quoted 10 lines
The driver MUST NOT send any buffer available notifications to -the
device before settingDRIVER_OK.content.tex +3
-0+the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated. \subsection{Legacy Interface: DeviceInitialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacy
devices did not support the
FEATURES_OKstatus bit, and thus did @@ -879,6 +883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}Quoted 1 line
\ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
for
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Quoted 3 lines
content.tex +1
-0handling features reserved for future use. + \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicatesthat the device
Quoted 1 line
+ exposes an administration command interface which is accessible to the
driver
Quoted 1 line
+ before the driver indicates
DRIVER_OKdevice status. When this featureis
Quoted 1 line
+ negotiated, once the the administration commands interface is
configured, it can be
Quoted 1 line
+ used by the driver to issue administration commands related to device
and driver
Quoted 13 lines
content.tex +2
-0+ capabilities. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved FeatureBits} diff --git a/transport-pci.tex b/transport-pci.tex index 95b08b8..a612b34 100644
transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configuration structurelayout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues.
transport-pci.tex
Quoted 5 lines
transport-pci.tex +5
-0+If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been +negotiated, the device MUST support administration commands through +the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue is +enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 28 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 8 lines
Quoted 8 lines · Parav Pandit
Quoted 7 lines
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.
Quoted 13 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationvirtqueue.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
I do.
Can you please share the motivation, why one wants to enable the AQ before features_ok?
And how would it configure all the basic things to operate a AQ before, for example, PACKED, VERSION, PLATFORM?
If the motivation to negotiate device specific features via admin command, then that is still possible with current proposal.
Quoted 4 lines
And I keep saying, we need to be proactive, address more than one problem with each feature and try to predict what will be needed, otherwise it will be a mess of a million conflicting features.
Sure. make sense.
Quoted 6 lines
Quoted 1 line
Never before features ok, feature negotiation is two ways communication
that indicates device, that queue notification is coming.
Quoted 3 lines
Quoted 3 lines
I think that if we want
to do admin commands before VQs are active, we should just add acapability
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
with registers for that. People wanted that anyway.
We discussed before that pci-sig discourages piling up vendor specific caps. So better to avoid that.
Well, that's a separate issue. Actually pci endpoint guys already want a way to access device without messing up with capabilities. So we'll likely create a way to put capabilities in a BAR.
So lets take the base line design requirement and see what more options do we have.
a. do not extend pci capability
b. utilize the current q config registers
c. have bidirectional negotiation if driver will use the AQ early enough or not.
With that what do you propose?
A new register in the BAR instead of feature bits?
How does the driver tell the device after reset and before features ok?
Quoted 5 lines
Quoted 2 lines
An alternative would be to bump up the pci
revision_id, which would alignto pci-sig and its known early enough.
Quoted 1 line
Though it does not take away the feature bit because device preparation is
needed to setup early admin commands.
Quoted 9 lines
Quoted 2 lines
And feature bit can be a good hint to inform that.
Onlyrevision_id(from device to driver) is not good enough as there can belarge sw stack which may never use it and no point in enabling this in the device without driver using it.
Quoted 1 line
So feature bit proposed here is self-contained, and its early enough.
I don't really get what this
revision_iddiscussion is about.
I will pause explaining the issue with rev_id for a moment and see what is the efficient way than proposed?
Quoted 150 lines
Quoted 19 lines
Quoted 19 lines
Quoted 15 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 2 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
Quoted 1 line
Quoted 5 lines
Quoted 5 lines
admin.tex
Quoted 3 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use administration +commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 1 line
+commands related to device and driver capabilities listed in
\ref[sec:Basic
Quoted 1 line
Quoted 1 line
Facilities of a Virtio Device / Device groups / Group administration
commands
Quoted 9 lines
Quoted 9 lines
/ Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus to the device.Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOThave
Quoted 7 lines
Quoted 7 lines
any side effects, making it safe to retry.
admin.tex
Quoted 6 lines
admin.tex +5
-0+If VIRTIO_F_EARLY_CAP_ADMIN_CMD feature is negotiated, the device +MUST process administration commands related to device and driver +capabilities before the driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMDfeatures
Quoted 3 lines
Quoted 3 lines
are
admin.tex
Quoted 2 lines
admin.tex +2
-0+negotiated, the device MUST be able to generate notifications related +to the administration virtqueue before the driver indicates DRIVER_OKto
Quoted 10 lines
Quoted 10 lines
the device.
Quoted 9 lines
+
\drivernormative{\subsection}{Group administration commands}{Basic
Facilities of a Virtio Device / Administration virtqueues}The driver MAY supply device-readable or device-writeable parts @@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with
\field{status}
Quoted 3 lines
Quoted 3 lines
admin.tex
Quoted 3 lines
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +2
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, thedriver
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+MAY send commands only to the first administration queue defined by
the specific transport.
content.tex \section{Device Initialization}\label{sec:General
Quoted 4 lines
content.tex +0
-0@@ -540,6 +540,8 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper
Quoted 5 lines
Quoted 5 lines
content.tex \section{Device Initialization}\label{sec:General Initialization And Device Oper
Quoted 4 lines
content.tex +1
-0device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues. +\item\label{itm:General Initialization And Device Operation / DeviceInitialization / Capabilities Access} Optionally get device capabilities and
set
Quoted 4 lines
Quoted 4 lines
driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDis negotiated.content.tex \section{Device Initialization}\label{sec:General · line 545
Quoted 2 lines
content.tex +1
-0+ \item\label{itm:General Initialization And Device Operation / DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this pointthe
Quoted 5 lines
Quoted 5 lines
device is
Quoted 4 lines
content.tex +0
-0``live''. \end{enumerate}@@ -550,7 +552,9 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper driver MUST NOT continue initialization
in
Quoted 8 lines
Quoted 8 lines
that case.
Quoted 7 lines
The driver MUST NOT send any buffer available notifications to -the
device before settingDRIVER_OK.content.tex +3
-0+the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated.Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
\subsection{Legacy Interface: Device
Initialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacydevices did not support the
FEATURES_OKstatus bit, and thus did @@ -879,6
Quoted 9 lines
Quoted 9 lines
+883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Quoted 1 line
\ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
for
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Quoted 3 lines
content.tex +1
-0handling features reserved for future use. + \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicatesthat the device
Quoted 1 line
+ exposes an administration command interface which is accessible to
the
Quoted 2 lines
Quoted 2 lines
driver
Quoted 1 line
+ before the driver indicates
DRIVER_OKdevice status. When thisfeature
Quoted 4 lines
Quoted 4 lines
is
Quoted 1 line
+ negotiated, once the the administration commands interface is
configured, it can be
Quoted 1 line
+ used by the driver to issue administration commands related to
device
Quoted 11 lines
Quoted 11 lines
and driver
transport-pci.tex \subsubsection{Common configuration
Quoted 10 lines
content.tex +2
-0+ capabilities. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved FeatureBits} diff --git a/transport-pci.tex b/transport-pci.tex index 95b08b8..a612b34 100644
transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configurationstructure
Quoted 5 lines
Quoted 5 lines
transport-pci.tex
Quoted 5 lines
layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues.
transport-pci.tex +2
-0+If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been +negotiated, the device MUST support administration commandsthrough
Quoted 13 lines
Quoted 13 lines
transport-pci.tex
Quoted 3 lines
transport-pci.tex +3
-0+the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue is +enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 30 lines · Parav Pandit
Quoted 30 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 4 lines · Parav Pandit
Quoted 4 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 8 lines
Quoted 8 lines · Parav Pandit
Quoted 7 lines
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationvirtqueue.
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set the DRIVER_OK status bit. At this point the device is “live”.
And no vqs are active before DRIVER_OK. How can the device assume that the driver is ready before DRIVER_OK? Why admin vq is special? The common config space is not enough to init a device?
If you see a gap, how about fix it in the common cfg?
Thanks
Quoted 199 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
I do.
Can you please share the motivation, why one wants to enable the AQ before
features_ok?
And how would it configure all the basic things to operate a AQ before, for example, PACKED, VERSION, PLATFORM?If the motivation to negotiate device specific features via admin command, then that is still possible with current proposal.
Quoted 4 lines
And I keep saying, we need to be proactive, address more than one problem with each feature and try to predict what will be needed, otherwise it will be a mess of a million conflicting features.
Sure. make sense.
Quoted 4 lines
Quoted 1 line
Never before features ok, feature negotiation is two ways communication
that indicates device, that queue notification is coming.
Quoted 2 lines
Quoted 2 lines
I think that if we want
to do admin commands before VQs are active, we should just add aQuoted 9 lines
capability
Quoted 4 lines
Quoted 2 lines
with registers for that. People wanted that anyway.
We discussed before that pci-sig discourages piling up vendor specific caps. So better to avoid that.
Well, that's a separate issue. Actually pci endpoint guys already want a way to access device without messing up with capabilities. So we'll likely create a way to put capabilities in a BAR.
So lets take the base line design requirement and see what more options do we have.
a. do not extend pci capability
b. utilize the current q config registers
c. have bidirectional negotiation if driver will use the AQ early enough or not.With that what do you propose?
A new register in the BAR instead of feature bits?
How does the driver tell the device after reset and before features ok?Quoted 12 lines
Quoted 1 line
An alternative would be to bump up the pci
revision_id, which would alignto pci-sig and its known early enough.
Quoted 1 line
Though it does not take away the feature bit because device preparation is
needed to setup early admin commands.
Quoted 2 lines
And feature bit can be a good hint to inform that.
Onlyrevision_id(from device to driver) is not good enough as there can belarge sw stack which may never use it and no point in enabling this in the device without driver using it.
Quoted 1 line
So feature bit proposed here is self-contained, and its early enough.
I don't really get what this
revision_iddiscussion is about.I will pause explaining the issue with
rev_idfor a moment and see what is the efficient way than proposed?Quoted 146 lines
Quoted 17 lines
Quoted 17 lines
Quoted 14 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 2 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
Quoted 5 lines
Quoted 5 lines
admin.tex
Quoted 3 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use administration +commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 1 line
+commands related to device and driver capabilities listed in
\ref[sec:Basic
Quoted 1 line
Quoted 1 line
Facilities of a Virtio Device / Device groups / Group administration
commands
Quoted 9 lines
Quoted 9 lines
/ Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus to the device.Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOThave
Quoted 6 lines
Quoted 6 lines
any side effects, making it safe to retry.
admin.tex
Quoted 5 lines
admin.tex +5
-0+If VIRTIO_F_EARLY_CAP_ADMIN_CMD feature is negotiated, the device +MUST process administration commands related to device and driver +capabilities before the driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMDfeatures
Quoted 3 lines
Quoted 3 lines
are
admin.tex
Quoted 2 lines
admin.tex +2
-0+negotiated, the device MUST be able to generate notifications related +to the administration virtqueue before the driver indicates DRIVER_OKto
Quoted 10 lines
Quoted 10 lines
the device.
Quoted 9 lines
+
\drivernormative{\subsection}{Group administration commands}{Basic
Facilities of a Virtio Device / Administration virtqueues}The driver MAY supply device-readable or device-writeable parts @@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with
\field{status}
Quoted 3 lines
Quoted 3 lines
admin.tex
Quoted 3 lines
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +2
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, thedriver
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+MAY send commands only to the first administration queue defined by
the specific transport.
content.tex \section{Device Initialization}\label{sec:General
Quoted 4 lines
content.tex +0
-0@@ -540,6 +540,8 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper
Quoted 5 lines
Quoted 5 lines
content.tex \section{Device Initialization}\label{sec:General Initialization And Device Oper
Quoted 4 lines
content.tex +1
-0device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues. +\item\label{itm:General Initialization And Device Operation / DeviceInitialization / Capabilities Access} Optionally get device capabilities and
set
Quoted 4 lines
Quoted 4 lines
driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDis negotiated.content.tex \section{Device Initialization}\label{sec:General · line 545
Quoted 2 lines
content.tex +1
-0+ \item\label{itm:General Initialization And Device Operation / DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this pointthe
Quoted 5 lines
Quoted 5 lines
device is
Quoted 4 lines
content.tex +0
-0``live''. \end{enumerate}@@ -550,7 +552,9 @@ \section{Device Initialization}\label{sec:GeneralInitialization And Device Oper driver MUST NOT continue initialization
in
Quoted 11 lines
Quoted 11 lines
that case.
Quoted 9 lines
The driver MUST NOT send any buffer available notifications to -the
device before settingDRIVER_OK.content.tex +3
-0+the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated. \subsection{Legacy Interface: DeviceInitialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacy
devices did not support the
FEATURES_OKstatus bit, and thus did @@ -879,6
Quoted 9 lines
Quoted 9 lines
+883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Quoted 1 line
\ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
for
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Quoted 3 lines
content.tex +1
-0handling features reserved for future use. + \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicatesthat the device
Quoted 1 line
+ exposes an administration command interface which is accessible to
the
Quoted 2 lines
Quoted 2 lines
driver
Quoted 1 line
+ before the driver indicates
DRIVER_OKdevice status. When thisfeature
Quoted 4 lines
Quoted 4 lines
is
Quoted 1 line
+ negotiated, once the the administration commands interface is
configured, it can be
Quoted 1 line
+ used by the driver to issue administration commands related to
device
Quoted 11 lines
Quoted 11 lines
and driver
transport-pci.tex \subsubsection{Common configuration
Quoted 10 lines
content.tex +2
-0+ capabilities. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved FeatureBits} diff --git a/transport-pci.tex b/transport-pci.tex index 95b08b8..a612b34 100644
transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configurationstructure
Quoted 5 lines
Quoted 5 lines
transport-pci.tex
Quoted 5 lines
layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues.
transport-pci.tex +2
-0+If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been +negotiated, the device MUST support administration commandsthrough
Quoted 13 lines
Quoted 13 lines
transport-pci.tex
Quoted 3 lines
transport-pci.tex +3
-0+the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue is +enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 46 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 34 lines · Parav Pandit
Quoted 34 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 4 lines · Parav Pandit
Quoted 4 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 8 lines
Quoted 8 lines · Parav Pandit
Quoted 7 lines
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administration
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
virtqueue.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.
This patch upgrades this detail. Please read through.
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?
Device does not assume.
When the feature described in this patch is negotiated, device knows that AQ will be live before DRIVER_OK.
Quoted 1 line
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities discovery. Please read the commit log that describes the motivation.
Quoted 1 line
The common config space is not enough to init a device?
No.
Quoted 1 line
If you see a gap, how about fix it in the common cfg?
Admin command is the interface do perform administration work.
Quoted 232 lines
Thanks
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
I do.
Can you please share the motivation, why one wants to enable the AQ
before
features_ok?Quoted 1 line
And how would it configure all the basic things to operate a AQ before, for
example, PACKED, VERSION, PLATFORM?
Quoted 2 lines
If the motivation to negotiate device specific features via admin command,
then that is still possible with current proposal.
Quoted 16 lines
Quoted 5 lines
And I keep saying, we need to be proactive, address more than one problem with each feature and try to predict what will be needed, otherwise it will be a mess of a million conflicting features.
Sure. make sense.
Quoted 9 lines
Quoted 2 lines
Never before features ok, feature negotiation is two ways communication
that indicates device, that queue notification is coming.
Quoted 2 lines
Quoted 2 lines
I think that if we want
to do admin commands before VQs are active, we should just add acapability
Quoted 3 lines
Quoted 2 lines
with registers for that. People wanted that anyway.
We discussed before that pci-sig discourages piling up vendor specific
caps.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
So better to avoid that.
Well, that's a separate issue. Actually pci endpoint guys already want a way to access device without messing up with capabilities. So we'll likely create a way to put capabilities in a BAR.
So lets take the base line design requirement and see what more options do
we have.
Quoted 18 lines
a. do not extend pci capability
b. utilize the current q config registers c. have bidirectional negotiation if driver will use the AQ early enough or not.With that what do you propose?
A new register in the BAR instead of feature bits?
How does the driver tell the device after reset and before features ok?Quoted 9 lines
Quoted 2 lines
An alternative would be to bump up the pci
revision_id, which would alignto pci-sig and its known early enough.
Quoted 2 lines
Though it does not take away the feature bit because device preparation is
needed to setup early admin commands.
Quoted 3 lines
And feature bit can be a good hint to inform that.
Onlyrevision_id(from device to driver) is not good enough as there can beQuoted 7 lines
Quoted 6 lines
large sw stack which may never use it and no point in enabling this in the device without driver using it.
Quoted 1 line
So feature bit proposed here is self-contained, and its early enough.
I don't really get what this
revision_iddiscussion is about.I will pause explaining the issue with
rev_idfor a moment and see what is theefficient way than proposed?
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 14 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 3 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
admin.tex
Quoted 3 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use administration +commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+commands related to device and driver capabilities listed in
\ref[sec:Basic
Quoted 2 lines
Quoted 2 lines
Facilities of a Virtio Device / Device groups / Group administration
commands
Quoted 2 lines
Quoted 2 lines
/ Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus tothe device.
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOThave
Quoted 2 lines
Quoted 2 lines
any side effects, making it safe to retry.
Quoted 1 line
+If
VIRTIO_F_EARLY_CAP_ADMIN_CMDfeature is negotiated, thedevice
Quoted 127 lines
Quoted 126 lines
Quoted 4 lines
Quoted 4 lines
admin.tex
Quoted 4 lines
admin.tex +4
-0+MUST process administration commands related to device and driver +capabilities before the driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMDfeatures
Quoted 4 lines
Quoted 4 lines
are
admin.tex
Quoted 3 lines
admin.tex +3
-0+negotiated, the device MUST be able to generate notifications +related to the administration virtqueue before the driver +indicates DRIVER_OKto
Quoted 6 lines
Quoted 6 lines
the device.
Quoted 5 lines
+
\drivernormative{\subsection}{Group administration
commands}{Basic Facilities of a Virtio Device / Administration virtqueues}Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The driver MAY supply device-readable or device-writeable parts
@@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with
\field{status}
Quoted 3 lines
Quoted 3 lines
admin.tex
Quoted 3 lines
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +2
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, thedriver
Quoted 10 lines
Quoted 10 lines
admin.tex
Quoted 2 lines
admin.tex +2
-0+MAY send commands only to the first administration queue defined +bythe specific transport.
Quoted 6 lines
content.tex index c32c218..12f9224 renamed from content.tex +0
-0100644
content.tex +0
-0@@ -540,6 +540,8 @@ \section{DeviceInitialization}\label{sec:General
Initialization And Device Oper
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues.
+\item\label{itm:General Initialization And Device Operation / +Device
Initialization / Capabilities Access} Optionally get device capabilities and
set
Quoted 6 lines
Quoted 6 lines
driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDis negotiated.Quoted 3 lines
+
\item\label{itm:General Initialization And Device Operation /
DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this pointthe
Quoted 6 lines
Quoted 6 lines
device is
Quoted 5 lines
``live''.\end{enumerate}
content.tex +0
-0@@ -550,7 +552,9 @@ \section{DeviceInitialization}\label{sec:General Initialization And Device Oper driver MUST NOT continue initialization
in
Quoted 7 lines
Quoted 7 lines
that case.
Quoted 6 lines
The driver MUST NOT send any buffer available notifications to
content.tex +3
-1-the device before setting DRIVER_OK. +the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated.Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
\subsection{Legacy Interface: Device
Initialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacydevices did not support the
FEATURES_OKstatus bit, and thus did @@ -879,6
Quoted 5 lines
Quoted 5 lines
+883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved +Feature
Bits}Quoted 2 lines
\ref{devicenormative:Basic Facilities of a Virtio Device /
Feature Bits}Quoted 7 lines
Quoted 7 lines
for
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Quoted 3 lines
content.tex +1
-0handling features reserved for future use. + \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicatesthat the device
Quoted 2 lines
+ exposes an administration command interface which is
+ accessible tothe
Quoted 2 lines
Quoted 2 lines
driver
Quoted 1 line
+ before the driver indicates
DRIVER_OKdevice status. When thisfeature
Quoted 4 lines
Quoted 4 lines
is
Quoted 1 line
+ negotiated, once the the administration commands interface is
configured, it can be
Quoted 1 line
+ used by the driver to issue administration commands related to
device
Quoted 5 lines
Quoted 5 lines
and driver
Quoted 4 lines
content.tex +2
-0+ capabilities. + \end{description}Quoted 7 lines
Quoted 7 lines
transport-pci.tex \subsubsection{Common configuration
Quoted 7 lines
\drivernormative{\section}{Reserved Feature Bits}{Reserved
Feature Bits} diff --git a/transport-pci.tex b/transport-pci.tex index
95b08b8..a612b34 100644transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configurationstructure
Quoted 5 lines
Quoted 5 lines
transport-pci.tex
Quoted 5 lines
layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues.
transport-pci.tex +2
-0+If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been +negotiated, the device MUST support administration commandsthrough
Quoted 13 lines
Quoted 13 lines
transport-pci.tex
Quoted 3 lines
transport-pci.tex +3
-0+the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue is +enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 58 lines · Parav Pandit
Quoted 47 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 34 lines · Parav Pandit
Quoted 34 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 4 lines · Parav Pandit
Quoted 4 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 8 lines
Quoted 8 lines · Parav Pandit
Quoted 7 lines
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationQuoted 9 lines
Quoted 6 lines
Quoted 5 lines
virtqueue.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.This patch upgrades this detail. Please read through.
Quoted 7 lines
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?Device does not assume.
When the feature described in this patch is negotiated, device knows that AQ will be live beforeDRIVER_OK.Quoted 1 line
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities discovery.
Then you need another transport or a control device.
Thanks
Quoted 240 lines
Please read the commit log that describes the motivation.
Quoted 1 line
The common config space is not enough to init a device?
No.
Quoted 1 line
If you see a gap, how about fix it in the common cfg?
Admin command is the interface do perform administration work.
Quoted 232 lines
Thanks
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
I do.
Can you please share the motivation, why one wants to enable the AQ
before
features_ok?Quoted 1 line
And how would it configure all the basic things to operate a AQ before, for
example, PACKED, VERSION, PLATFORM?
Quoted 2 lines
If the motivation to negotiate device specific features via admin command,
then that is still possible with current proposal.
Quoted 16 lines
Quoted 5 lines
And I keep saying, we need to be proactive, address more than one problem with each feature and try to predict what will be needed, otherwise it will be a mess of a million conflicting features.
Sure. make sense.
Quoted 9 lines
Quoted 2 lines
Never before features ok, feature negotiation is two ways communication
that indicates device, that queue notification is coming.
Quoted 2 lines
Quoted 2 lines
I think that if we want
to do admin commands before VQs are active, we should just add acapability
Quoted 3 lines
Quoted 2 lines
with registers for that. People wanted that anyway.
We discussed before that pci-sig discourages piling up vendor specific
caps.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
So better to avoid that.
Well, that's a separate issue. Actually pci endpoint guys already want a way to access device without messing up with capabilities. So we'll likely create a way to put capabilities in a BAR.
So lets take the base line design requirement and see what more options do
we have.
Quoted 18 lines
a. do not extend pci capability
b. utilize the current q config registers c. have bidirectional negotiation if driver will use the AQ early enough or not.With that what do you propose?
A new register in the BAR instead of feature bits?
How does the driver tell the device after reset and before features ok?Quoted 9 lines
Quoted 2 lines
An alternative would be to bump up the pci
revision_id, which would alignto pci-sig and its known early enough.
Quoted 2 lines
Though it does not take away the feature bit because device preparation is
needed to setup early admin commands.
Quoted 3 lines
And feature bit can be a good hint to inform that.
Onlyrevision_id(from device to driver) is not good enough as there can beQuoted 7 lines
Quoted 6 lines
large sw stack which may never use it and no point in enabling this in the device without driver using it.
Quoted 1 line
So feature bit proposed here is self-contained, and its early enough.
I don't really get what this
revision_iddiscussion is about.I will pause explaining the issue with
rev_idfor a moment and see what is theefficient way than proposed?
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 14 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 3 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
admin.tex
Quoted 3 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use administration +commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+commands related to device and driver capabilities listed in
\ref[sec:Basic
Quoted 2 lines
Quoted 2 lines
Facilities of a Virtio Device / Device groups / Group administration
commands
Quoted 2 lines
Quoted 2 lines
/ Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus tothe device.
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOThave
Quoted 2 lines
Quoted 2 lines
any side effects, making it safe to retry.
Quoted 1 line
+If
VIRTIO_F_EARLY_CAP_ADMIN_CMDfeature is negotiated, thedevice
Quoted 127 lines
Quoted 126 lines
Quoted 4 lines
Quoted 4 lines
admin.tex
Quoted 4 lines
admin.tex +4
-0+MUST process administration commands related to device and driver +capabilities before the driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMDfeatures
Quoted 4 lines
Quoted 4 lines
are
admin.tex
Quoted 3 lines
admin.tex +3
-0+negotiated, the device MUST be able to generate notifications +related to the administration virtqueue before the driver +indicates DRIVER_OKto
Quoted 6 lines
Quoted 6 lines
the device.
Quoted 5 lines
+
\drivernormative{\subsection}{Group administration
commands}{Basic Facilities of a Virtio Device / Administration virtqueues}Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The driver MAY supply device-readable or device-writeable parts
@@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with
\field{status}
Quoted 3 lines
Quoted 3 lines
admin.tex
Quoted 3 lines
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +2
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, thedriver
Quoted 10 lines
Quoted 10 lines
admin.tex
Quoted 2 lines
admin.tex +2
-0+MAY send commands only to the first administration queue defined +bythe specific transport.
Quoted 6 lines
content.tex index c32c218..12f9224 renamed from content.tex +0
-0100644
content.tex +0
-0@@ -540,6 +540,8 @@ \section{DeviceInitialization}\label{sec:General
Initialization And Device Oper
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues.
+\item\label{itm:General Initialization And Device Operation / +Device
Initialization / Capabilities Access} Optionally get device capabilities and
set
Quoted 6 lines
Quoted 6 lines
driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDis negotiated.Quoted 3 lines
+
\item\label{itm:General Initialization And Device Operation /
DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this pointthe
Quoted 6 lines
Quoted 6 lines
device is
Quoted 5 lines
``live''.\end{enumerate}
content.tex +0
-0@@ -550,7 +552,9 @@ \section{DeviceInitialization}\label{sec:General Initialization And Device Oper driver MUST NOT continue initialization
in
Quoted 7 lines
Quoted 7 lines
that case.
Quoted 6 lines
The driver MUST NOT send any buffer available notifications to
content.tex +3
-1-the device before setting DRIVER_OK. +the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated.Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
\subsection{Legacy Interface: Device
Initialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacydevices did not support the
FEATURES_OKstatus bit, and thus did @@ -879,6
Quoted 5 lines
Quoted 5 lines
+883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved +Feature
Bits}Quoted 2 lines
\ref{devicenormative:Basic Facilities of a Virtio Device /
Feature Bits}Quoted 7 lines
Quoted 7 lines
for
Quoted 3 lines
handling features reserved for future use.
+ \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicates
that the device
Quoted 2 lines
+ exposes an administration command interface which is
+ accessible tothe
Quoted 2 lines
Quoted 2 lines
driver
Quoted 1 line
+ before the driver indicates
DRIVER_OKdevice status. When thisfeature
Quoted 4 lines
Quoted 4 lines
is
Quoted 1 line
+ negotiated, once the the administration commands interface is
configured, it can be
Quoted 1 line
+ used by the driver to issue administration commands related to
device
Quoted 5 lines
Quoted 5 lines
and driver
Quoted 4 lines
content.tex +2
-0+ capabilities. + \end{description}Quoted 7 lines
Quoted 7 lines
transport-pci.tex \subsubsection{Common configuration
Quoted 7 lines
\drivernormative{\section}{Reserved Feature Bits}{Reserved
Feature Bits} diff --git a/transport-pci.tex b/transport-pci.tex index
95b08b8..a612b34 100644transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configurationstructure
Quoted 5 lines
Quoted 5 lines
transport-pci.tex
Quoted 5 lines
layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues.
transport-pci.tex +2
-0+If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been +negotiated, the device MUST support administration commandsthrough
Quoted 13 lines
Quoted 13 lines
transport-pci.tex
Quoted 3 lines
transport-pci.tex +3
-0+the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue is +enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 74 lines
From: Jason Wang <[email protected]>
Sent: Wednesday, September 11, 2024 10:08 AM
To: Parav Pandit <[email protected]>
Cc: Zhu Lingshan <[email protected]>; Michael S. Tsirkin <[email protected]>; [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 41 lines · Parav Pandit
Quoted 41 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 27 lines · Parav Pandit
Quoted 27 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMOn Tue, Sep 10, 2024 at 08:07:23PM +0300, Parav Pandit wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the currentflow.
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationQuoted 9 lines
Quoted 6 lines
Quoted 5 lines
virtqueue.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.This patch upgrades this detail. Please read through.
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?
Quoted 8 lines
Quoted 2 lines
Device does not assume.
When the feature described in this patch is negotiated, device knows that AQwill be live before
DRIVER_OK.Quoted 3 lines
Quoted 2 lines
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities discovery.
Then you need another transport or a control device.
I don’t think so.
Please explain the motivation to complicate it.
Quoted 261 lines
Thanks
Quoted 118 lines
Please read the commit log that describes the motivation.
Quoted 1 line
The common config space is not enough to init a device?
No.
Quoted 1 line
If you see a gap, how about fix it in the common cfg?
Admin command is the interface do perform administration work.
Quoted 111 lines
Thanks
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
I do.
Can you please share the motivation, why one wants to enable the AQ
before
features_ok?Quoted 2 lines
And how would it configure all the basic things to operate a AQ before, for
example, PACKED, VERSION, PLATFORM?
Quoted 3 lines
If the motivation to negotiate device specific features via admin command,
then that is still possible with current proposal.
Quoted 18 lines
Quoted 5 lines
And I keep saying, we need to be proactive, address more than one problem with each feature and try to predict what will be needed, otherwise it will be a mess of a million conflicting features.
Sure. make sense.
Quoted 11 lines
Quoted 2 lines
Never before features ok, feature negotiation is two ways communication
that indicates device, that queue notification is coming.
Quoted 3 lines
Quoted 3 lines
I think that if we want
to do admin commands before VQs are active, we should just add acapability
Quoted 4 lines
Quoted 2 lines
with registers for that. People wanted that anyway.
We discussed before that pci-sig discourages piling up vendor specific
caps.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
So better to avoid that.
Well, that's a separate issue. Actually pci endpoint guys already want a way to access device without messing up with capabilities. So we'll likely create a way to put capabilities in a BAR.
So lets take the base line design requirement and see what more options do
we have.
Quoted 18 lines
a. do not extend pci capability
b. utilize the current q config registers c. have bidirectional negotiation if driver will use the AQ early enough or not.With that what do you propose?
A new register in the BAR instead of feature bits?
How does the driver tell the device after reset and before features ok?Quoted 9 lines
Quoted 2 lines
An alternative would be to bump up the pci
revision_id, which would alignto pci-sig and its known early enough.
Quoted 2 lines
Though it does not take away the feature bit because device preparation is
needed to setup early admin commands.
Quoted 3 lines
And feature bit can be a good hint to inform that. Only
revision_id(from device to driver) is not good enough as there can beQuoted 8 lines
Quoted 6 lines
large sw stack which may never use it and no point in enabling this in the device without driver using it.
Quoted 1 line
So feature bit proposed here is self-contained, and its early enough.
I don't really get what this
revision_iddiscussion is about.I will pause explaining the issue with
rev_idfor a moment and see what is theefficient way than proposed?
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 15 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex index 39fc072..95054ed renamed from admin.tex +0
-0100644
admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 3 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
admin.tex
Quoted 3 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use +administration commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+commands related to device and driver capabilities listed in
\ref[sec:Basic
Quoted 2 lines
Quoted 2 lines
Facilities of a Virtio Device / Device groups / Group administration
commands
Quoted 3 lines
Quoted 3 lines
/ Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus tothe device.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOThave
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
any side effects, making it safe to retry.
Quoted 1 line
+If
VIRTIO_F_EARLY_CAP_ADMIN_CMDfeature is negotiated, thedevice
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
admin.tex
Quoted 2 lines
admin.tex +2
-0+MUST process administration commands related to device and +driver capabilities before the driver indicates DRIVER_OK to thedevice.
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 2 lines
Quoted 2 lines
admin.tex
Quoted 2 lines
admin.tex +2
-0+ +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMDfeatures
Quoted 4 lines
Quoted 4 lines
are
admin.tex
Quoted 3 lines
admin.tex +3
-0+negotiated, the device MUST be able to generate notifications +related to the administration virtqueue before the driver +indicates DRIVER_OKto
Quoted 6 lines
Quoted 6 lines
the device.
Quoted 5 lines
+
\drivernormative{\subsection}{Group administration
commands}{Basic Facilities of a Virtio Device / Administration virtqueues}Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The driver MAY supply device-readable or device-writeable
parts @@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with
\field{status}
Quoted 3 lines
Quoted 3 lines
admin.tex
Quoted 3 lines
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +2
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, thedriver
Quoted 13 lines
Quoted 13 lines
admin.tex
Quoted 2 lines
admin.tex +2
-0+MAY send commands only to the first administration queue +defined bythe specific transport.
Quoted 6 lines
content.tex index c32c218..12f9224 renamed from content.tex +0
-0100644
content.tex +0
-0@@ -540,6 +540,8 @@ \section{DeviceInitialization}\label{sec:General
Initialization And Device Oper
Quoted 3 lines
device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
+\item\label{itm:General Initialization And Device Operation / +Device
Initialization / Capabilities Access} Optionally get device capabilities and
set
Quoted 1 line
Quoted 1 line
driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDisnegotiated.
Quoted 66 lines
Quoted 66 lines
Quoted 66 lines
Quoted 66 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
+
\item\label{itm:General Initialization And Device Operation /
DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this pointthe
Quoted 6 lines
Quoted 6 lines
device is
Quoted 5 lines
``live''.\end{enumerate}
content.tex +0
-0@@ -550,7 +552,9 @@ \section{DeviceInitialization}\label{sec:General Initialization And Device Oper driver MUST NOT continue initialization
in
Quoted 7 lines
Quoted 7 lines
that case.
Quoted 6 lines
The driver MUST NOT send any buffer available notifications
to -the device before settingDRIVER_OK.content.tex +3
-0+the device before setting DRIVER_OK; however, the driver MAY +send buffer available notifications before setting DRIVER_OK +if VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated.Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
\subsection{Legacy Interface: Device
Initialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacydevices did not support the
FEATURES_OKstatus bit, and thus did @@
-879,6
Quoted 5 lines
Quoted 5 lines
+883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved +Feature
Bits}Quoted 2 lines
\ref{devicenormative:Basic Facilities of a Virtio
Device / Feature Bits}Quoted 8 lines
Quoted 8 lines
for
Quoted 4 lines
handling features reserved for future use.
+ \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature
+ indicatesthat the device
Quoted 2 lines
+ exposes an administration command interface which is
+ accessible tothe
Quoted 3 lines
Quoted 3 lines
driver
Quoted 2 lines
+ before the driver indicates
DRIVER_OKdevice status. When
+ thisfeature
Quoted 6 lines
Quoted 6 lines
is
Quoted 2 lines
+ negotiated, once the the administration commands interface
+ isconfigured, it can be
Quoted 2 lines
+ used by the driver to issue administration commands
+ related todevice
Quoted 5 lines
Quoted 5 lines
and driver
Quoted 4 lines
content.tex +2
-0+ capabilities. + \end{description}Quoted 7 lines
Quoted 7 lines
transport-pci.tex \subsubsection{Common configuration
Quoted 7 lines
\drivernormative{\section}{Reserved Feature Bits}{Reserved
Feature Bits} diff --git a/transport-pci.tex b/transport-pci.tex index
95b08b8..a612b34 100644transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configurationstructure
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other
virtqueues.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+If
VIRTIO_F_ADMIN_VQandVIRTIO_F_EARLY_ADMIN_CMDhasbeen
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+negotiated, the device MUST support administration commands
through
Quoted 13 lines
Quoted 13 lines
transport-pci.tex
Quoted 3 lines
transport-pci.tex +3
-0+the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue +is enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 55 lines · Jason Wang
Quoted 54 lines · Parav Pandit
Quoted 44 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 32 lines · Parav Pandit
Quoted 32 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 7 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationQuoted 8 lines
Quoted 5 lines
Quoted 4 lines
virtqueue.
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.This patch upgrades this detail. Please read through.
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?Device does not assume.
When the feature described in this patch is negotiated, device knows that AQ will be live beforeDRIVER_OK.Quoted 1 line
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities discovery.
Then you need another transport or a control device.
So Maybe it is a good chance for me to continue the "transport vq" work?
Quoted 233 lines
Thanks
Quoted 230 lines
Please read the commit log that describes the motivation.
Quoted 1 line
The common config space is not enough to init a device?
No.
Quoted 1 line
If you see a gap, how about fix it in the common cfg?
Admin command is the interface do perform administration work.
Quoted 223 lines
Thanks
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
want it before features ok, and we will keep piling up hacks.
I don't see any motivation to do before feature bit.
I do.
Can you please share the motivation, why one wants to enable the AQ
before
features_ok?Quoted 1 line
And how would it configure all the basic things to operate a AQ before, for
example, PACKED, VERSION, PLATFORM?
Quoted 1 line
If the motivation to negotiate device specific features via admin command,
then that is still possible with current proposal.
Quoted 4 lines
Quoted 4 lines
And I keep saying, we need to be proactive, address more than one problem with each feature and try to predict what will be needed, otherwise it will be a mess of a million conflicting features.
Quoted 11 lines
Sure. make sense.
Quoted 9 lines
Quoted 2 lines
Never before features ok, feature negotiation is two ways communication
that indicates device, that queue notification is coming.
Quoted 2 lines
Quoted 2 lines
I think that if we want
to do admin commands before VQs are active, we should just add acapability
Quoted 3 lines
Quoted 2 lines
with registers for that. People wanted that anyway.
We discussed before that pci-sig discourages piling up vendor specific
caps.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
So better to avoid that.
Well, that's a separate issue. Actually pci endpoint guys already want a way to access device without messing up with capabilities. So we'll likely create a way to put capabilities in a BAR.
So lets take the base line design requirement and see what more options do
we have.
Quoted 17 lines
a. do not extend pci capability
b. utilize the current q config registers c. have bidirectional negotiation if driver will use the AQ early enough or not.With that what do you propose?
A new register in the BAR instead of feature bits?
How does the driver tell the device after reset and before features ok?Quoted 9 lines
Quoted 2 lines
An alternative would be to bump up the pci
revision_id, which would alignto pci-sig and its known early enough.
Quoted 2 lines
Though it does not take away the feature bit because device preparation is
needed to setup early admin commands.
Quoted 3 lines
And feature bit can be a good hint to inform that.
Onlyrevision_id(from device to driver) is not good enough as there can beQuoted 6 lines
Quoted 5 lines
large sw stack which may never use it and no point in enabling this in the device without driver using it.
Quoted 1 line
So feature bit proposed here is self-contained, and its early enough.
I don't really get what this
revision_iddiscussion is about.I will pause explaining the issue with
rev_idfor a moment and see what is theefficient way than proposed?
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 12 lines
--- admin.tex | 16 ++++++++++++++++ content.tex | 13 ++++++++++++- transport-pci.tex | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-)admin.tex +0
-0@@ -334,6 +334,11 @@ \subsection{Group administrationQuoted 3 lines
commands}\label{sec:Basic Facilities of a Virti supporting multiple group types, the list of supported commands might differ between
different group types.
admin.tex
Quoted 3 lines
admin.tex +3
-0+When the driver has negotiated the feature +VIRTIO_F_EARLY_CAP_ADMIN_CMD, the driver can use administration +commands VIRTIO_ADMIN_CMD_LIST_QUERY,
VIRTIO_ADMIN_CMD_LIST_USEandQuoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+commands related to device and driver capabilities listed in
\ref[sec:Basic
Quoted 2 lines
Quoted 2 lines
Facilities of a Virtio Device / Device groups / Group administration
commands
Quoted 2 lines
Quoted 2 lines
/ Device and driver capabilities]{device and driver capabilities} for the self- group type before the driver indicates
DRIVER_OKstatus tothe device.
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
admin.tex +1
-0+ \input{admin-cmds-legacy-interface.tex} \input{admin-cmds-capabilities.tex} \input{admin-cmds-resource-objects.tex}@@ -608,6 +613,14 @@ \section{AdministrationVirtqueues}\label{sec:Basic Facilities of a Virtio Devic or
VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOThave
Quoted 2 lines
Quoted 2 lines
any side effects, making it safe to retry.
Quoted 1 line
+If
VIRTIO_F_EARLY_CAP_ADMIN_CMDfeature is negotiated, thedevice
Quoted 126 lines
Quoted 126 lines
Quoted 4 lines
Quoted 4 lines
admin.tex
Quoted 4 lines
admin.tex +4
-0+MUST process administration commands related to device and driver +capabilities before the driver indicates DRIVER_OK to the device. + +If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_CAP_ADMIN_CMDfeatures
Quoted 4 lines
Quoted 4 lines
are
admin.tex
Quoted 3 lines
admin.tex +3
-0+negotiated, the device MUST be able to generate notifications +related to the administration virtqueue before the driver +indicates DRIVER_OKto
Quoted 6 lines
Quoted 6 lines
the device.
Quoted 5 lines
+
\drivernormative{\subsection}{Group administration
commands}{Basic Facilities of a Virtio Device / Administration virtqueues}Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The driver MAY supply device-readable or device-writeable parts
@@
-641,3 +654,6 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio DevicThe driver SHOULD retry a command that completed with
\field{status}
Quoted 3 lines
Quoted 3 lines
admin.tex
Quoted 3 lines
VIRTIO_ADMIN_STATUS_EAGAIN.admin.tex +2
-0+ +When the VIRTIO_F_EARLY_ADMIN_CMD feature is negotiated, thedriver
Quoted 10 lines
Quoted 10 lines
admin.tex
Quoted 2 lines
admin.tex +2
-0+MAY send commands only to the first administration queue defined +bythe specific transport.
Quoted 6 lines
content.tex index c32c218..12f9224 renamed from content.tex +0
-0100644
content.tex +0
-0@@ -540,6 +540,8 @@ \section{DeviceInitialization}\label{sec:General
Initialization And Device Oper
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
device, optional per-bus setup, reading and possibly writing the device's virtio configuration space, and population of virtqueues.
+\item\label{itm:General Initialization And Device Operation / +Device
Initialization / Capabilities Access} Optionally get device capabilities and
set
Quoted 6 lines
Quoted 6 lines
driver capabilities if
VIRTIO_F_EARLY_CAP_ADMIN_CMDis negotiated.Quoted 3 lines
+
\item\label{itm:General Initialization And Device Operation /
DeviceInitialization / Set DRIVER-OK} Set the
DRIVER_OKstatus bit. At this pointthe
Quoted 6 lines
Quoted 6 lines
device is
Quoted 5 lines
``live''.\end{enumerate}
content.tex +0
-0@@ -550,7 +552,9 @@ \section{DeviceInitialization}\label{sec:General Initialization And Device Oper driver MUST NOT continue initialization
in
Quoted 7 lines
Quoted 7 lines
that case.
Quoted 6 lines
The driver MUST NOT send any buffer available notifications to
content.tex +3
-1-the device before setting DRIVER_OK. +the device before setting DRIVER_OK; however, the driver MAY send +buffer available notifications before setting DRIVER_OK if +VIRTIO_F_EARLY_CAP_ADMIN_CMD is negotiated.Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
\subsection{Legacy Interface: Device
Initialization}\label{sec:General Initialization And Device Operation / Device Initialization / Legacy Interface: Device Initialization} Legacydevices did not support the
FEATURES_OKstatus bit, and thus did @@ -879,6
Quoted 5 lines
Quoted 5 lines
+883,13 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved +Feature
Bits}Quoted 2 lines
\ref{devicenormative:Basic Facilities of a Virtio Device /
Feature Bits}Quoted 7 lines
Quoted 7 lines
for
Quoted 3 lines
handling features reserved for future use.
+ \item[VIRTIO_F_EARLY_CAP_ADMIN_CMD(42)] This feature indicates
that the device
Quoted 2 lines
+ exposes an administration command interface which is
+ accessible tothe
Quoted 2 lines
Quoted 2 lines
driver
Quoted 1 line
+ before the driver indicates
DRIVER_OKdevice status. When thisfeature
Quoted 4 lines
Quoted 4 lines
is
Quoted 1 line
+ negotiated, once the the administration commands interface is
configured, it can be
Quoted 1 line
+ used by the driver to issue administration commands related to
device
Quoted 5 lines
Quoted 5 lines
and driver
Quoted 4 lines
content.tex +2
-0+ capabilities. + \end{description}Quoted 7 lines
Quoted 7 lines
transport-pci.tex \subsubsection{Common configuration
Quoted 7 lines
\drivernormative{\section}{Reserved Feature Bits}{Reserved
Feature Bits} diff --git a/transport-pci.tex b/transport-pci.tex index
95b08b8..a612b34 100644transport-pci.tex +0
-0@@ -495,6 +495,12 @@ \subsubsection{Common configurationstructure
Quoted 5 lines
Quoted 5 lines
transport-pci.tex
Quoted 5 lines
layout}\label{sec:Virtio Transport to ensure that indices of valid admin queues fit into a 16 bit range beyond all other virtqueues.
transport-pci.tex +2
-0+If VIRTIO_F_ADMIN_VQ and VIRTIO_F_EARLY_ADMIN_CMD has been +negotiated, the device MUST support administration commandsthrough
Quoted 13 lines
Quoted 13 lines
transport-pci.tex
Quoted 3 lines
transport-pci.tex +3
-0+the administration virtqueue identified by the +\field{admin_queue_index} after the administration virtqueue is +enabled and before the driver sets DRIVER_OK to the\field{device_status}.
Quoted 9 lines
+
\drivernormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}The driver MUST NOT write to \field{device_feature},
\field{num_queues},
--
2.34.1
Quoted 67 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 10:12 AMQuoted 1 line · Jason Wang
On Wed, Sep 11, 2024 at 12:12 PM Parav Pandit <[email protected]>
Quoted 37 lines · wrote:
Quoted 37 lines
Quoted 37 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 24 lines · Parav Pandit
Quoted 24 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 7 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the currentflow.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationvirtqueue.
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.Quoted 6 lines
Quoted 6 lines
This patch upgrades this detail. Please read through.
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?Device does not assume.
When the feature described in this patch is negotiated, device knows that
Quoted 7 lines
AQ will be live before
DRIVER_OK.Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities
discovery.
Quoted 1 line
Then you need another transport or a control device.
So Maybe it is a good chance for me to continue the "transport vq" work?
Nop.
AQ has delivered what all was required uniformly for sw based device, PCI PF, PCI VFs. Lets first understand the motivation of the complication from Jason.
Quoted 70 lines · Parav Pandit
Quoted 70 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 10:12 AMQuoted 1 line · Jason Wang
On Wed, Sep 11, 2024 at 12:12 PM Parav Pandit <[email protected]>
Quoted 37 lines · wrote:
Quoted 37 lines
Quoted 37 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 24 lines · Parav Pandit
Quoted 24 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 7 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the currentflow.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationvirtqueue.
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.Quoted 6 lines
Quoted 6 lines
This patch upgrades this detail. Please read through.
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?Device does not assume.
When the feature described in this patch is negotiated, device knows thatAQ will be live before
DRIVER_OK.Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities
discovery.
Quoted 1 line
Then you need another transport or a control device.
So Maybe it is a good chance for me to continue the "transport vq" work?
Nop.
AQ has delivered what all was required uniformly for sw based device, PCI PF, PCI VFs. Lets first understand the motivation of the complication from Jason.
It's not a complication but a simplification because "fundamental device and driver capabilities discovery" has already been the charge of the transport.
Thanks
Quoted 86 lines
From: Jason Wang <[email protected]>
Sent: Wednesday, September 11, 2024 10:34 AMQuoted 34 lines · Parav Pandit
Quoted 34 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 10:12 AMQuoted 1 line · Jason Wang
On Wed, Sep 11, 2024 at 12:12 PM Parav Pandit <[email protected]>
Quoted 26 lines · wrote:
Quoted 26 lines
Quoted 26 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 13 lines · Parav Pandit
Quoted 13 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 9 lines · Parav Pandit
Quoted 9 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 5 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-
net
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that itno
Quoted 34 lines
Quoted 34 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
longer uses queue_* registers for non admin queues.
b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the
currentflow.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationvirtqueue.
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.Quoted 7 lines
Quoted 7 lines
This patch upgrades this detail. Please read through.
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?Device does not assume.
When the feature described in this patch is negotiated, device knows thatAQ will be live before
DRIVER_OK.Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities
discovery.
Quoted 1 line
Then you need another transport or a control device.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So Maybe it is a good chance for me to continue the "transport vq" work?
Nop.
AQ has delivered what all was required uniformly for sw based device, PCIPF, PCI VFs.
Quoted 1 line
Lets first understand the motivation of the complication from Jason.
It's not a complication but a simplification because "fundamental device and driver capabilities discovery" has already been the charge of the transport.
This does not explain the motivation at all.
Admin command interface is part of it already to discover the capabilities both direction.
Quoted 61 lines · Zhu Lingshan
Quoted 57 lines · Jason Wang
Quoted 56 lines · Parav Pandit
Quoted 44 lines
From: Zhu Lingshan <[email protected]>
Sent: Wednesday, September 11, 2024 9:30 AM
To: Parav Pandit <[email protected]>; Michael S. Tsirkin <[email protected]>
Cc: [email protected]; [email protected]; Shahaf Shuler <[email protected]>
Subject: Re: [PATCH] admin: Enable driver to send admin commands beforeDRIVER_OKQuoted 32 lines · Parav Pandit
Quoted 32 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 2:06 AMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, September 11, 2024 12:02 AMQuoted 7 lines · Parav Pandit
Currently the driver can operate administration commands using administration virtqueues. Administration virtqueues must be enabled before it reached
DRIVER_OKstage similar to all other queues. This is a limiting factor.Many of the device functionalties needs to be discovered and configured early enough before the driver reaches the
DRIVER_OKstage.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Some examples are:
a. driver wants to dynamically create the virtqueues of virtio-net
device with more parameters, for example header data split, multiple physical addresses.
Here, the driver needs to tell PCI device early enough that it no longer uses queue_* registers for non admin queues.b. driver wants to discover these features and related attributes
early enough so it has chance to decide to proceed via admin cmd interface or proceed toDRIVER_OKand follow the current flow.To overcome these limitations, introduce a feature bit that enables the driver to send capabilities related admin commands before
DRIVER_OKvia the available interface such as administrationQuoted 8 lines
Quoted 5 lines
Quoted 4 lines
virtqueue.
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Parav Pandit <[email protected]>We were there in 1.0 and it's messy. And next thing you do, you will
Also if you can explain what exactly is the mess, if there is one?
As far as I can see, the spec says:
Set theDRIVER_OKstatus bit. At this point the device is “live”.This patch upgrades this detail. Please read through.
Quoted 2 lines
And no vqs are active before
DRIVER_OK. How can the device assume that the driver is ready beforeDRIVER_OK?
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Device does not assume.
When the feature described in this patch is negotiated, device knows that AQ will be live beforeDRIVER_OK.Quoted 1 line
Why admin vq is special?
Because it is used to do fundamental device and driver capabilities discovery.
Then you need another transport or a control device.
So Maybe it is a good chance for me to continue the "transport vq" work?
I think this could be one way.
Thanks
Quoted 1 line
So Maybe it is a good chance for me to continue the "transport vq" work?
Transport over admin commands was envisioned more or less from day one. I think it's useful.
But what Parav is asking for seems somewhat orthogonal.
Signature · 1 line
MST
Quoted 5 lines · Michael S. Tsirkin
Quoted 1 line
So Maybe it is a good chance for me to continue the "transport vq" work?
Transport over admin commands was envisioned more or less from day one. I think it's useful.
But what Parav is asking for seems somewhat orthogonal.
Thanks! However, admin vq is a control plane, and we are implementing a new transport, so IMHO an individual transport vq may make more sense.
Thanks
Zhu Lingshan