Introduce device group and device management
v9 cover Introduce device group and device management
Change log:
since v8:
addressed comments by Cornelia - as we agreed on list
since v7:
make high level error codes match linux, with virtio specific codes
in a separate field
renamed _ACCEPT to _USE since that's what it does clarified forward compatibility and non pci transports support multiple admin vqs
conformance statements
lots of changes all over the place to I changed author from Max to myself. Don't need to take credit but also don't want to blame Max for my mistakes.
since v6:
- removed some extentions intended for future use. We'll do them when we get there.
- brought back command list query from v5 in a simplified form - it's here to address the case where a single parent can address multiple groups, such as PF addressing transport vq and sriov vfs.
- attempt to make terminology more formal. In particular a term for whoever controls the group. I am still going back
and forth between "parent" and "owner" - owner might be better after all since it will work if we ever have a self group. For now it's parent.
TODO (maybe?) - probably ok to defer until this part is upstream:
Add "all members" member id.
Add commands for MSI, feature discovery.
Add commands for transport vq.
My intent is to try and support both SR-IOV and SIOV usecases with the same structure and maybe even the same VQ.
For example, it might make sense to split creating/destroying SIOV devices from the transport passing data from the guest - the driver would then not negotiate VIRTIO_F_SR_IOV (which then means auto-provisioning).
This is out of RFC, since we have two commands which are useful to discover supported group types (ATM can be none or SR-IOV).
Michael S. Tsirkin (10):
virtio: document forward compatibility guarantees
admin: introduce device group and related concepts
admin: introduce group administration commands
admin: introduce virtio admin virtqueues
pci: add admin vq registers to virtio over pci
mmio: document ADMIN_VQ as reserved
ccw: document ADMIN_VQ as reserved
admin: command list discovery
admin: conformance clauses
ccw: document more reserved features
admin.tex | 435 ++++++++++++++++++++++++++++++++++++++++++++++++++++ content.tex | 111 +++++++++++++- 2 files changed, 544 insertions(+), 2 deletions(-) create mode 100644 admin.tex
Signature · 1 line
MST
PATCH v9 1/10 virtio: document forward compatibility guarantees
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
content.tex +42 -0
@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit. +To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.) Likewise, it is important that +drivers \em{do not} accept feature bits they do not know how to handle +(even though devices are not supposed to offer them in the first place, +according to this version of the specification.) The preferred way for +handling reserved and unexpected features is that the driver ignores +them. + +In particular, this is +especially important for features limited to specific transports, +as enabling these for more transports in future versions of the +specification is highly likely to require changing the behaviour +from drivers and devices. Drivers and devices supporting +multiple transports need to carefully maintain per-transport +lists of allowed features. + \drivernormative{\subsection}{Feature Bits}{Basic Facilities of a Virtio Device / Feature Bits} The driver MUST NOT accept a feature which the device did not offer, and MUST NOT accept a feature which requires another feature which was not accepted. +The driver MUST validate the feature bits offered by the device. +The driver MUST ignore and MUST NOT accept any feature bit that is +\begin{itemize} +\item not described in this specification, +\item marked as reserved, +\item not supported for the specific transport, +\item not defined for the device type. +\end{itemize} + The driver SHOULD go into backwards compatibility mode if the device does not offer a feature it understands, otherwise MUST set the FAILED \field{device status} bit and cease initialization. +By contrast, the driver MUST NOT fail solely because a feature +it does not understand has been offered by the device. + \devicenormative{\subsection}{Feature Bits}{Basic Facilities of a Virtio Device / Feature Bits} The device MUST NOT offer a feature which requires another feature which was not offered. The device SHOULD accept any valid subset of features the driver accepts, otherwise it MUST fail to set the FEATURES_OK \field{device status} bit when the driver writes it. +The device MUST NOT offer feature bits corresponding to features +it would not support if accepted by the driver (even if the +driver is prohibited from accepting the feature bits by the +specification); for the sake of clarity, this refers to feature +bits not described in this specification, reserved feature bits +and feature bits reserved or not supported for the specific +transport or the specific device type, but this does not preclude +devices written to a future version of this specification from +offering such feature bits should such a specification have a +provision for devices to support the corresponding features. + If a device has successfully negotiated a set of features at least once (by accepting the FEATURES_OK \field{device status} bit during device initialization), then it SHOULD
Signature · 1 line
MST
Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 16 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 121
Quoted 8 lines
content.tex +5
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit. +To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)
It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 126
Quoted 6 lines
Likewise, it is important that
content.tex +5
-0+drivers \em{do not} accept feature bits they do not know how to handle +(even though devices are not supposed to offer them in the first place, +according to this version of the specification.) The preferred way for +handling reserved and unexpected features is that the driver ignores +them.
I'm not sure this is the best way or whether we've defined the "unexpected features" before. It might be better to say that to accept the features that the driver understands.
Quoted 12 lines
content.tex +9
-0+ +In particular, this is +especially important for features limited to specific transports, +as enabling these for more transports in future versions of the +specification is highly likely to require changing the behaviour +from drivers and devices. Drivers and devices supporting +multiple transports need to carefully maintain per-transport +lists of allowed features. + \drivernormative{\subsection}{Feature Bits}{Basic Facilities of a Virtio Device / Feature Bits} The driver MUST NOT accept a feature which the device did not offer, and MUST NOT accept a feature which requires another feature which was
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 148
Quoted 10 lines
content.tex +8
-0not accepted. +The driver MUST validate the feature bits offered by the device. +The driver MUST ignore and MUST NOT accept any feature bit that is +\begin{itemize} +\item not described in this specification, +\item marked as reserved, +\item not supported for the specific transport, +\item not defined for the device type. +\end{itemize}
Do we need a similar part for the device?
Quoted 18 lines
content.tex +8
-0+ The driver SHOULD go into backwards compatibility mode if the device does not offer a feature it understands, otherwise MUST set the FAILED \field{device status} bit and cease initialization. +By contrast, the driver MUST NOT fail solely because a feature +it does not understand has been offered by the device. + \devicenormative{\subsection}{Feature Bits}{Basic Facilities of a Virtio Device / Feature Bits} The device MUST NOT offer a feature which requires another feature which was not offered. The device SHOULD accept any valid subset of features the driver accepts, otherwise it MUST fail to set the FEATURES_OK \field{device status} bit when the driver writes it. +The device MUST NOT offer feature bits corresponding to features +it would not support if accepted by the driver (even if the +driver is prohibited from accepting the feature bits by the +specification); for the sake of clarity, this refers to feature
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 176
Quoted 10 lines
content.tex +7
-0+bits not described in this specification, reserved feature bits +and feature bits reserved or not supported for the specific +transport or the specific device type, but this does not preclude +devices written to a future version of this specification from +offering such feature bits should such a specification have a +provision for devices to support the corresponding features. + If a device has successfully negotiated a set of features at least once (by accepting the FEATURES_OK \field{device status} bit during device initialization), then it SHOULD
This sentence is incomplete.
Thanks
Quoted 3 lines
--
MST
Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 20 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit.
Quoted 10 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
Quoted 5 lines
content.tex +5
-0+To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
I'm not sure about "not sufficient". It's sufficient as long as you just want to extend features. What triggered this work is adding a transport specific feature.
Quoted 10 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 126
Quoted 6 lines
Likewise, it is important that
content.tex +5
-0+drivers \em{do not} accept feature bits they do not know how to handle +(even though devices are not supposed to offer them in the first place, +according to this version of the specification.) The preferred way for +handling reserved and unexpected features is that the driver ignores +them.I'm not sure this is the best way or whether we've defined the "unexpected features" before. It might be better to say that to accept the features that the driver understands.
So specifically, if feature is documented as pci only and then down the road we enable it for ccw. Does driver "understand" it? Or not? It is clearly unexpected.
I am not too worried about using terms we didn't define this is not part of a conformance statement.
And people seem to get the meaning ;)
Quoted 14 lines
Quoted 14 lines
content.tex +9
-0+ +In particular, this is +especially important for features limited to specific transports, +as enabling these for more transports in future versions of the +specification is highly likely to require changing the behaviour +from drivers and devices. Drivers and devices supporting +multiple transports need to carefully maintain per-transport +lists of allowed features. + \drivernormative{\subsection}{Feature Bits}{Basic Facilities of a Virtio Device / Feature Bits} The driver MUST NOT accept a feature which the device did not offer, and MUST NOT accept a feature which requires another feature which was not accepted.
Quoted 10 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 148
Quoted 8 lines
content.tex +8
-0+The driver MUST validate the feature bits offered by the device. +The driver MUST ignore and MUST NOT accept any feature bit that is +\begin{itemize} +\item not described in this specification, +\item marked as reserved, +\item not supported for the specific transport, +\item not defined for the device type. +\end{itemize}Do we need a similar part for the device?
Nope, we don't need devices to accept features they did not offer.
Quoted 14 lines
Quoted 14 lines
content.tex +4
-0+ The driver SHOULD go into backwards compatibility mode if the device does not offer a feature it understands, otherwise MUST set the FAILED \field{device status} bit and cease initialization. +By contrast, the driver MUST NOT fail solely because a feature +it does not understand has been offered by the device. + \devicenormative{\subsection}{Feature Bits}{Basic Facilities of a Virtio Device / Feature Bits} The device MUST NOT offer a feature which requires another feature which was not offered. The device SHOULD accept any valid subset of features the driver accepts, otherwise it MUST fail to set the FEATURES_OK \field{device status} bit when the driver writes it.
Quoted 16 lines
Quoted 4 lines
content.tex +4
-0+The device MUST NOT offer feature bits corresponding to features +it would not support if accepted by the driver (even if the +driver is prohibited from accepting the feature bits by the +specification); for the sake of clarity, this refers to featurecontent.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 176
Quoted 10 lines
content.tex +7
-0+bits not described in this specification, reserved feature bits +and feature bits reserved or not supported for the specific +transport or the specific device type, but this does not preclude +devices written to a future version of this specification from +offering such feature bits should such a specification have a +provision for devices to support the corresponding features. + If a device has successfully negotiated a set of features at least once (by accepting the FEATURES_OK \field{device status} bit during device initialization), then it SHOULDThis sentence is incomplete.
Because it's context produced by git diff? That cuts off after 3 lines.
Quoted 5 lines
Thanks
Quoted 3 lines
--
MST
Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 33 lines · Michael S. Tsirkin
Quoted 20 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit.Quoted 10 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
Quoted 5 lines
content.tex +5
-0+To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
Quoted 3 lines
I'm not sure about "not sufficient". It's sufficient as long as you just want to extend features. What triggered this work is adding a transport specific feature.
E.g:
For status: Devices do not offer any status bit it would not be able to handle. For virtqueue size: Devices do not offer virtqueue size it would not be able to handle.
?
Quoted 13 lines
Quoted 12 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 126
Quoted 8 lines
Likewise, it is important that
content.tex +5
-0+drivers \em{do not} accept feature bits they do not know how to handle +(even though devices are not supposed to offer them in the first place, +according to this version of the specification.) The preferred way for +handling reserved and unexpected features is that the driver ignores +them.I'm not sure this is the best way or whether we've defined the "unexpected features" before. It might be better to say that to accept the features that the driver understands.
Quoted 6 lines
So specifically, if feature is documented as pci only and then down the road we enable it for ccw. Does driver "understand" it? Or not? It is clearly unexpected.
I am not too worried about using terms we didn't define this is not part of a conformance statement.
And people seem to get the meaning ;)
Ok.
Thanks
Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 38 lines · Jason Wang
Quoted 33 lines · Michael S. Tsirkin
Quoted 20 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit.Quoted 10 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
Quoted 5 lines
content.tex +5
-0+To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
Quoted 3 lines
I'm not sure about "not sufficient". It's sufficient as long as you just want to extend features. What triggered this work is adding a transport specific feature.
Quoted 7 lines
E.g:
For status: Devices do not offer any status bit it would not be able to handle. For virtqueue size: Devices do not offer virtqueue size it would not be able to handle.
?
Jason I think what you miss here is this part:
"even though drivers are not
supposed to accept them in the first place even if offered, according to this version of the specification"
does not apply to status and virtqueue size.
Let me clarify what all this means.
It seems safe for a device to offer a reserved feature bit since drivers are not supposed to accept it.
This text says device must not rely on this.
How would this apply to status or vq size? I don't see.
Quoted 23 lines
Quoted 13 lines
Quoted 12 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 126
Quoted 8 lines
Likewise, it is important that
content.tex +5
-0+drivers \em{do not} accept feature bits they do not know how to handle +(even though devices are not supposed to offer them in the first place, +according to this version of the specification.) The preferred way for +handling reserved and unexpected features is that the driver ignores +them.I'm not sure this is the best way or whether we've defined the "unexpected features" before. It might be better to say that to accept the features that the driver understands.
Quoted 6 lines
So specifically, if feature is documented as pci only and then down the road we enable it for ccw. Does driver "understand" it? Or not? It is clearly unexpected.
I am not too worried about using terms we didn't define this is not part of a conformance statement.
And people seem to get the meaning ;)Ok.
Thanks
[virtio-dev] Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 56 lines · Michael S. Tsirkin
Quoted 38 lines · Jason Wang
Quoted 33 lines · Michael S. Tsirkin
Quoted 20 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit.Quoted 10 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
Quoted 5 lines
content.tex +5
-0+To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
Quoted 3 lines
I'm not sure about "not sufficient". It's sufficient as long as you just want to extend features. What triggered this work is adding a transport specific feature.
Quoted 7 lines
E.g:
For status: Devices do not offer any status bit it would not be able to handle. For virtqueue size: Devices do not offer virtqueue size it would not be able to handle.
?
Jason I think what you miss here is this part:
"even though drivers are not
supposed to accept them in the first place even if offered, according to this version of the specification"does not apply to status and virtqueue size.
Quoted 6 lines
Let me clarify what all this means.
It seems safe for a device to offer a reserved feature bit since drivers are not supposed to accept it.
This text says device must not rely on this.How would this apply to status or vq size? I don't see.
Me neither... for the status, it's about either the driver noting its progress, or the device indicating that a reset is needed. The only case where setting something requires kind of an ack is FEATURES_OK, and there we already spell out the conditions clearly. For the queue size, we specify that the device states what it can support, and that the driver may only reduce it, that seems clear enough to me.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 49 lines · Cornelia Huck
Quoted 47 lines · Michael S. Tsirkin
Quoted 33 lines · Jason Wang
Quoted 29 lines · Michael S. Tsirkin
Quoted 19 lines · Jason Wang
Quoted 18 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit.Quoted 9 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
Quoted 5 lines
content.tex +5
-0+To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
Quoted 3 lines
I'm not sure about "not sufficient". It's sufficient as long as you just want to extend features. What triggered this work is adding a transport specific feature.
Quoted 7 lines
E.g:
For status: Devices do not offer any status bit it would not be able to handle. For virtqueue size: Devices do not offer virtqueue size it would not be able to handle.
?
Jason I think what you miss here is this part:
"even though drivers are not
supposed to accept them in the first place even if offered, according to this version of the specification"
Quoted 5 lines
Quoted 5 lines
does not apply to status and virtqueue size.
Let me clarify what all this means.
It seems safe for a device to offer a reserved feature bit
This depends really on the behaviour of the drivers.
Quoted 1 line
Quoted 1 line
since drivers are not supposed to accept it.
So this is the case of the ADMIN_VQ.
Quoted 7 lines
Quoted 3 lines
This text says device must not rely on this.
How would this apply to status or vq size? I don't see.
Me neither... for the status, it's about either the driver noting its progress, or the device indicating that a reset is needed. The only case where setting something requires kind of an ack is
FEATURES_OK, and there we already spell out the conditions clearly.
I basically meant something like:
Assuming we have a feature like VIRTIO_RING_F_NEW and a new status bit was mapped to this feature, VIRTIO_CONFIG_S_NEW. And for some reason this feature is reserved for some transports. Should we mention device does not offer VIRTIO_CONFIG_S_NEW as well, or we assume it is implied that we don't offer VIRTIO_CONFIG_S_NEW in this case?
Quoted 3 lines
For the queue size,
we specify that the device states what it can support, and that the driver may only reduce it, that seems clear enough to me.
Similar to the above, assuming a feature VIRTIO_R_F_MAXSIZE_XXX, and it is reserved. Should we mention that the new max virtqueue size should not be advertised or it is implied in the feature advertisement?
Thanks
[virtio-dev] Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 75 lines · Jason Wang
Quoted 49 lines · Cornelia Huck
Quoted 47 lines · Michael S. Tsirkin
Quoted 33 lines · Jason Wang
Quoted 29 lines · Michael S. Tsirkin
Quoted 19 lines · Jason Wang
Quoted 18 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit.Quoted 9 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 121
Quoted 5 lines
content.tex +5
-0+To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
Quoted 3 lines
I'm not sure about "not sufficient". It's sufficient as long as you just want to extend features. What triggered this work is adding a transport specific feature.
Quoted 7 lines
E.g:
For status: Devices do not offer any status bit it would not be able to handle. For virtqueue size: Devices do not offer virtqueue size it would not be able to handle.
?
Jason I think what you miss here is this part:
"even though drivers are not
supposed to accept them in the first place even if offered, according to this version of the specification"Quoted 5 lines
Quoted 5 lines
does not apply to status and virtqueue size.
Let me clarify what all this means.
It seems safe for a device to offer a reserved feature bitThis depends really on the behaviour of the drivers.
Quoted 1 line
Quoted 1 line
since drivers are not supposed to accept it.
So this is the case of the
ADMIN_VQ.Quoted 7 lines
Quoted 3 lines
This text says device must not rely on this.
How would this apply to status or vq size? I don't see.
Me neither... for the status, it's about either the driver noting its progress, or the device indicating that a reset is needed. The only case where setting something requires kind of an ack is
FEATURES_OK, and there we already spell out the conditions clearly.
Quoted 7 lines
I basically meant something like:
Assuming we have a feature like
VIRTIO_RING_F_NEWand a new status bit was mapped to this feature,VIRTIO_CONFIG_S_NEW. And for some reason this feature is reserved for some transports. Should we mention device does not offerVIRTIO_CONFIG_S_NEWas well, or we assume it is implied that we don't offerVIRTIO_CONFIG_S_NEWin this case?
I'm not sure that adding a feature-specific status bit would make sense, given that the status bits either need to work before feature negotiation is complete, or are actually needed for feature negotiation. Also, the status-bit space is way more limited than the feature-bit space. Therefore, I think we can safely ignore the status bits.
Quoted 10 lines
Quoted 5 lines
For the queue size,
we specify that the device states what it can support, and that the driver may only reduce it, that seems clear enough to me.Similar to the above, assuming a feature
VIRTIO_R_F_MAXSIZE_XXX, and it is reserved. Should we mention that the new max virtqueue size should not be advertised or it is implied in the feature advertisement?
I'd say it's implied in the feature bit handling already.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PATCH v9 01/10] virtio: document forward compatibility guarantees
Quoted 76 lines · Cornelia Huck
Quoted 74 lines · Jason Wang
Quoted 49 lines · Cornelia Huck
Quoted 47 lines · Michael S. Tsirkin
Quoted 33 lines · Jason Wang
Quoted 29 lines · Michael S. Tsirkin
Quoted 19 lines · Jason Wang
Quoted 18 lines · Michael S. Tsirkin
Feature negotiation forms the basis of forward compatibility guarantees of virtio but has never been properly documented. Do it now.
Suggested-by Halil Pasic <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)content.tex +0
-0@@ -114,21 +114,63 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B In particular, new fields in the device configuration space are indicated by offering a new feature bit.Quoted 9 lines
content.tex \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B · line 121
Quoted 5 lines
content.tex +5
-0+To keep te feature negotiation mechanism extensible, it is important +that devices \em{do not} offer any feature bits that they would not be +able to handle if the driver accepted them (even though drivers are not +supposed to accept them in the first place even if offered, according to +this version of the specification.)It looks to me if we want to clarify like this, feature negotiation is not sufficient. Do we need to do something similar in other basic facilities? Generally, we probably need to do this for facilities that are similar to features (status, virtqueue size and others).
Quoted 3 lines
I'm not sure about "not sufficient". It's sufficient as long as you just want to extend features. What triggered this work is adding a transport specific feature.
Quoted 7 lines
E.g:
For status: Devices do not offer any status bit it would not be able to handle. For virtqueue size: Devices do not offer virtqueue size it would not be able to handle.
?
Jason I think what you miss here is this part:
"even though drivers are not
supposed to accept them in the first place even if offered, according to this version of the specification"Quoted 5 lines
Quoted 5 lines
does not apply to status and virtqueue size.
Let me clarify what all this means.
It seems safe for a device to offer a reserved feature bitThis depends really on the behaviour of the drivers.
Quoted 1 line
Quoted 1 line
since drivers are not supposed to accept it.
So this is the case of the
ADMIN_VQ.Quoted 7 lines
Quoted 3 lines
This text says device must not rely on this.
How would this apply to status or vq size? I don't see.
Me neither... for the status, it's about either the driver noting its progress, or the device indicating that a reset is needed. The only case where setting something requires kind of an ack is
FEATURES_OK, and there we already spell out the conditions clearly.I basically meant something like:
Quoted 8 lines
Quoted 5 lines
Assuming we have a feature like
VIRTIO_RING_F_NEWand a new status bit was mapped to this feature,VIRTIO_CONFIG_S_NEW. And for some reason this feature is reserved for some transports. Should we mention device does not offerVIRTIO_CONFIG_S_NEWas well, or we assume it is implied that we don't offerVIRTIO_CONFIG_S_NEWin this case?I'm not sure that adding a feature-specific status bit would make sense, given that the status bits either need to work before feature negotiation is complete, or are actually needed for feature negotiation.
It can work only after the feature negotiation. E.g the device stop (only makes sense after DRIVER_OK is set).
Quoted 4 lines
Also, the status-bit space is way more limited than the feature-bit space. Therefore, I think we can safely ignore the status bits.
Quoted 1 line
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
For the queue size,
we specify that the device states what it can support, and that the driver may only reduce it, that seems clear enough to me.Similar to the above, assuming a feature
VIRTIO_R_F_MAXSIZE_XXX, and it is reserved. Should we mention that the new max virtqueue size should not be advertised or it is implied in the feature advertisement?I'd say it's implied in the feature bit handling already.
Ok.
Thanks
Quoted 1 line
PATCH v9 2/10 admin: introduce device group and related concepts
In reply to Michael S. TsirkinEach device group has a type. For now, define one initial group:
SR-IOV type - PCI SR-IOV virtual functions (VFs) of a given PCI SR-IOV physical function (PF). This group may contain one or more virtio devices.
Each device within a group has a unique identifier. This identifier is the group member identifier.
Note: one can argue both ways whether the new device group handling functionality (this and following patches) is closer
to a new device type or a new transport type.
However, I expect that we will add more features in the near future. To facilitate this as much as possible of the text is located in the new admin chapter.
I did my best to minimize transport-specific text.
--- admin.tex | 45 +++++++++++++++++++++++++++++++++++++++++++++ content.tex | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 admin.tex
admin.tex new file +45 -0
@@ -0,0 +1,45 @@ +\section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device groups} + +It is occasionally useful to have a device control a group of +other devices. Terminology used in such cases: + +\begin{description} +\item[Device group] + or just group, includes zero or more devices. +\item[Owner device] + or owner, the device controlling the group. +\item[Member device] + a device within a group. The owner device itself is not + a member of the group. +\item[Member identifier] + each member has this identifier, unique within the group + and used to address it through the owner device. +\item[Group type identifier] + specifies what kind of member devices there are in a + group, how is the member identifier is interpreted + and what kind of control the owner has. + A given owner can control a single group of a given type, + thus the type and the owner together identify the group. +\end{description} + +The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}). + +The PF device itself is not a member of the group. + +The group type identifier for this group is 0x1. + +A member identifier for this group can have a value 0x1 to 0xFFFF +and equals the SR-IOV VF number of the member device (see +\hyperref[intro:PCIe]{[PCIe]}). + +Both owner and member devices for this group type use the Virtio +PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). +\end{description} + +
content.tex +2 -0
@@ -491,6 +491,8 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo types. It is RECOMMENDED that devices generate version 4 UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}. +\input{admin.tex} + \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation} We start with an overview of device initialization, then expand on the
Signature · 1 line
MST
Re: [PATCH v9 02/10] admin: introduce device group and related concepts
Quoted 55 lines · Michael S. Tsirkin
Each device group has a type. For now, define one initial group:
SR-IOV type - PCI SR-IOV virtual functions (VFs) of a given PCI SR-IOV physical function (PF). This group may contain one or more virtio devices.
Each device within a group has a unique identifier. This identifier is the group member identifier.
Note: one can argue both ways whether the new device group handling functionality (this and following patches) is closer
to a new device type or a new transport type.However, I expect that we will add more features in the near future. To facilitate this as much as possible of the text is located in the new admin chapter.
I did my best to minimize transport-specific text.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 45 +++++++++++++++++++++++++++++++++++++++++++++ content.tex | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 admin.texadmin.tex new file +21
-0@@ -0,0 +1,45 @@ +\section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device groups} + +It is occasionally useful to have a device control a group of +other devices. Terminology used in such cases: + +\begin{description} +\item[Device group] + or just group, includes zero or more devices. +\item[Owner device] + or owner, the device controlling the group. +\item[Member device] + a device within a group. The owner device itself is not + a member of the group. +\item[Member identifier] + each member has this identifier, unique within the group + and used to address it through the owner device. +\item[Group type identifier] + specifies what kind of member devices there are in a + group, how is the member identifier is interpreted + and what kind of control the owner has. + A given owner can control a single group of a given type,
admin.tex line 31
Quoted 10 lines
admin.tex new file +10
-0+ thus the type and the owner together identify the group. +\end{description} + +The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).
So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Thanks
Quoted 30 lines
admin.tex new file +14
-0+ +The PF device itself is not a member of the group. + +The group type identifier for this group is 0x1. + +A member identifier for this group can have a value 0x1 to 0xFFFF +and equals the SR-IOV VF number of the member device (see +\hyperref[intro:PCIe]{[PCIe]}). + +Both owner and member devices for this group type use the Virtio +PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). +\end{description} + +content.tex +2
-1@@ -491,6 +491,8 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo types. It is RECOMMENDED that devices generate version 4 UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}. +\input{admin.tex} + \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation} We start with an overview of device initialization, then expand on the --MST
Re: [PATCH v9 02/10] admin: introduce device group and related concepts
Quoted 72 lines · Jason Wang
Quoted 55 lines · Michael S. Tsirkin
Each device group has a type. For now, define one initial group:
SR-IOV type - PCI SR-IOV virtual functions (VFs) of a given PCI SR-IOV physical function (PF). This group may contain one or more virtio devices.
Each device within a group has a unique identifier. This identifier is the group member identifier.
Note: one can argue both ways whether the new device group handling functionality (this and following patches) is closer
to a new device type or a new transport type.However, I expect that we will add more features in the near future. To facilitate this as much as possible of the text is located in the new admin chapter.
I did my best to minimize transport-specific text.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 45 +++++++++++++++++++++++++++++++++++++++++++++ content.tex | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 admin.texadmin.tex new file +21
-0@@ -0,0 +1,45 @@ +\section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device groups} + +It is occasionally useful to have a device control a group of +other devices. Terminology used in such cases: + +\begin{description} +\item[Device group] + or just group, includes zero or more devices. +\item[Owner device] + or owner, the device controlling the group. +\item[Member device] + a device within a group. The owner device itself is not + a member of the group. +\item[Member identifier] + each member has this identifier, unique within the group + and used to address it through the owner device. +\item[Group type identifier] + specifies what kind of member devices there are in a + group, how is the member identifier is interpreted + and what kind of control the owner has. + A given owner can control a single group of a given type,admin.tex line 31
Quoted 10 lines
admin.tex new file +10
-0+ thus the type and the owner together identify the group. +\end{description} + +The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Quoted 1 line
Thanks
So we burn up an identifier, ccw and mmio won't be able to use it. Big deal? Why? And I think we might find a use for this with MMIO down the road with some kind of passthrough. Who knows.
Quoted 30 lines
Quoted 30 lines
admin.tex new file +14
-0+ +The PF device itself is not a member of the group. + +The group type identifier for this group is 0x1. + +A member identifier for this group can have a value 0x1 to 0xFFFF +and equals the SR-IOV VF number of the member device (see +\hyperref[intro:PCIe]{[PCIe]}). + +Both owner and member devices for this group type use the Virtio +PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). +\end{description} + +content.tex +2
-1@@ -491,6 +491,8 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo types. It is RECOMMENDED that devices generate version 4 UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}. +\input{admin.tex} + \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation} We start with an overview of device initialization, then expand on the --MST
Re: [virtio-dev] Re: [PATCH v9 02/10] admin: introduce device group and related concepts
Quoted 74 lines · Michael S. Tsirkin
Quoted 72 lines · Jason Wang
Quoted 55 lines · Michael S. Tsirkin
Each device group has a type. For now, define one initial group:
SR-IOV type - PCI SR-IOV virtual functions (VFs) of a given PCI SR-IOV physical function (PF). This group may contain one or more virtio devices.
Each device within a group has a unique identifier. This identifier is the group member identifier.
Note: one can argue both ways whether the new device group handling functionality (this and following patches) is closer
to a new device type or a new transport type.However, I expect that we will add more features in the near future. To facilitate this as much as possible of the text is located in the new admin chapter.
I did my best to minimize transport-specific text.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 45 +++++++++++++++++++++++++++++++++++++++++++++ content.tex | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 admin.texadmin.tex new file +21
-0@@ -0,0 +1,45 @@ +\section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device groups} + +It is occasionally useful to have a device control a group of +other devices. Terminology used in such cases: + +\begin{description} +\item[Device group] + or just group, includes zero or more devices. +\item[Owner device] + or owner, the device controlling the group. +\item[Member device] + a device within a group. The owner device itself is not + a member of the group. +\item[Member identifier] + each member has this identifier, unique within the group + and used to address it through the owner device. +\item[Group type identifier] + specifies what kind of member devices there are in a + group, how is the member identifier is interpreted + and what kind of control the owner has. + A given owner can control a single group of a given type,admin.tex line 31
Quoted 10 lines
admin.tex new file +10
-0+ thus the type and the owner together identify the group. +\end{description} + +The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Quoted 4 lines
Quoted 1 line
Thanks
So we burn up an identifier, ccw and mmio won't be able to use it. Big deal? Why?
Because it is transport specific. The basic facility should be transport independent.
Quoted 2 lines
And I think we might find a use for this with MMIO down the road with some kind of passthrough. Who knows.
Probably, but can it be modeled exactly as what SR-IOV looks like? Or anyhow, it's not too late to define this for MMIO at that time. For example, we know MSI-X may work for MMIO but we define it only for PCI now.
Thanks
Quoted 39 lines
Quoted 25 lines
Quoted 25 lines
admin.tex new file +14
-0+ +The PF device itself is not a member of the group. + +The group type identifier for this group is 0x1. + +A member identifier for this group can have a value 0x1 to 0xFFFF +and equals the SR-IOV VF number of the member device (see +\hyperref[intro:PCIe]{[PCIe]}). + +Both owner and member devices for this group type use the Virtio +PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). +\end{description} + +content.tex +0
-0@@ -491,6 +491,8 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo types. It is RECOMMENDED that devices generate version 4 UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}.Quoted 8 lines
Quoted 8 lines
content.tex +2
-1+\input{admin.tex} + \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation} We start with an overview of device initialization, then expand on the --MST
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [virtio-dev] Re: [PATCH v9 02/10] admin: introduce device group and related concepts
Quoted 75 lines · Jason Wang
Quoted 74 lines · Michael S. Tsirkin
Quoted 72 lines · Jason Wang
Quoted 55 lines · Michael S. Tsirkin
Each device group has a type. For now, define one initial group:
SR-IOV type - PCI SR-IOV virtual functions (VFs) of a given PCI SR-IOV physical function (PF). This group may contain one or more virtio devices.
Each device within a group has a unique identifier. This identifier is the group member identifier.
Note: one can argue both ways whether the new device group handling functionality (this and following patches) is closer
to a new device type or a new transport type.However, I expect that we will add more features in the near future. To facilitate this as much as possible of the text is located in the new admin chapter.
I did my best to minimize transport-specific text.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 45 +++++++++++++++++++++++++++++++++++++++++++++ content.tex | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 admin.texadmin.tex new file +21
-0@@ -0,0 +1,45 @@ +\section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device groups} + +It is occasionally useful to have a device control a group of +other devices. Terminology used in such cases: + +\begin{description} +\item[Device group] + or just group, includes zero or more devices. +\item[Owner device] + or owner, the device controlling the group. +\item[Member device] + a device within a group. The owner device itself is not + a member of the group. +\item[Member identifier] + each member has this identifier, unique within the group + and used to address it through the owner device. +\item[Group type identifier] + specifies what kind of member devices there are in a + group, how is the member identifier is interpreted + and what kind of control the owner has. + A given owner can control a single group of a given type,admin.tex line 31
Quoted 10 lines
admin.tex new file +10
-0+ thus the type and the owner together identify the group. +\end{description} + +The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thanks
So we burn up an identifier, ccw and mmio won't be able to use it. Big deal? Why?
Because it is transport specific. The basic facility should be transport independent.
I tried this but the result is spread all over the spec and does not result in a readable cohesive whole.
So we give up on the transport independent purity a bit and it seems worth it.
Also explained this in the cover letter - have you seen that?
Quoted 9 lines
Quoted 2 lines
And I think we might find a use for this with MMIO down the road with some kind of passthrough. Who knows.
Probably, but can it be modeled exactly as what SR-IOV looks like? Or anyhow, it's not too late to define this for MMIO at that time. For example, we know MSI-X may work for MMIO but we define it only for PCI now.
Thanks
Right. So if we reserve the id for all transports then it will be easy to do.
Quoted 39 lines
Quoted 39 lines
Quoted 25 lines
Quoted 25 lines
admin.tex new file +14
-0+ +The PF device itself is not a member of the group. + +The group type identifier for this group is 0x1. + +A member identifier for this group can have a value 0x1 to 0xFFFF +and equals the SR-IOV VF number of the member device (see +\hyperref[intro:PCIe]{[PCIe]}). + +Both owner and member devices for this group type use the Virtio +PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). +\end{description} + +content.tex +0
-0@@ -491,6 +491,8 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo types. It is RECOMMENDED that devices generate version 4 UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}.Quoted 8 lines
Quoted 8 lines
content.tex +2
-1+\input{admin.tex} + \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation} We start with an overview of device initialization, then expand on the --MST
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [virtio-dev] Re: [PATCH v9 02/10] admin: introduce device group and related concepts
Quoted 42 lines · Michael S. Tsirkin
Quoted 17 lines · Jason Wang
Quoted 16 lines · Michael S. Tsirkin
Quoted 14 lines · Jason Wang
admin.tex line 31
Quoted 7 lines · Michael S. Tsirkin
admin.tex new file +7
-0+The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thanks
So we burn up an identifier, ccw and mmio won't be able to use it. Big deal? Why?
Because it is transport specific. The basic facility should be transport independent.
I tried this but the result is spread all over the spec and does not result in a readable cohesive whole.
So we give up on the transport independent purity a bit and it seems worth it.
Also explained this in the cover letter - have you seen that?Quoted 8 lines
Quoted 2 lines
And I think we might find a use for this with MMIO down the road with some kind of passthrough. Who knows.
Probably, but can it be modeled exactly as what SR-IOV looks like? Or anyhow, it's not too late to define this for MMIO at that time. For example, we know MSI-X may work for MMIO but we define it only for PCI now.
Quoted 4 lines
Quoted 1 line
Thanks
Right. So if we reserve the id for all transports then it will be easy to do.
Also, if we go with transport-specific ids, we might end up with different ids per transport when we add a future transport-independent feature. The global id space really should be big enough to accommodate even single-transport groups.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [virtio-dev] Re: [PATCH v9 02/10] admin: introduce device group and related concepts
Quoted 18 lines · Cornelia Huck
Quoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · Jason Wang
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Jason Wang
admin.tex line 31
Quoted 7 lines · Michael S. Tsirkin
admin.tex new file +7
-0+The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Thanks
So we burn up an identifier, ccw and mmio won't be able to use it. Big deal? Why?
Because it is transport specific. The basic facility should be transport independent.
I tried this but the result is spread all over the spec and does not result in a readable cohesive whole.
I may miss something, but it looks to me it's just a subsection in the PCI transport to describe the SR-IOV group identifier.
Quoted 3 lines
Quoted 3 lines
So we give up on the transport independent purity a bit and it seems worth it.
Also explained this in the cover letter - have you seen that?
Sorry, I don't.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
And I think we might find a use for this with MMIO down the road with some kind of passthrough. Who knows.
Probably, but can it be modeled exactly as what SR-IOV looks like? Or anyhow, it's not too late to define this for MMIO at that time. For example, we know MSI-X may work for MMIO but we define it only for PCI now.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Thanks
Right. So if we reserve the id for all transports then it will be easy to do.
Also, if we go with transport-specific ids, we might end up with different ids per transport when we add a future transport-independent feature.
I'm not sure this is a real problem:
1) all the basic facilities are now transport-independent but they are implemented via different transport specific registers/commands/offsets etc.
2) I'm not quite sure there would be a transport-independent group identifier other than the virtqueue transport, so I wonder if it makes sense to split the id space into global ones as well as the transport specific ones
Quoted 2 lines
The global id space really should be big enough to accommodate
even single-transport groups.
Yes, so it's not about the space but about whether or it it's worth/correct/expensive to describe a transport specific identifier in the basic facility part.
Thanks
Quoted 6 lines
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
[virtio] Re: [virtio-dev] Re: [PATCH v9 02/10] admin: introduce device group and related concepts
Quoted 58 lines · Jason Wang
Quoted 18 lines · Cornelia Huck
Quoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · Jason Wang
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Jason Wang
Review
Quoted 7 lines · Michael S. Tsirkin
(quoted diff) +7
-0+The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Thanks
So we burn up an identifier, ccw and mmio won't be able to use it. Big deal? Why?
Because it is transport specific. The basic facility should be transport independent.
I tried this but the result is spread all over the spec and does not result in a readable cohesive whole.
I may miss something, but it looks to me it's just a subsection in the PCI transport to describe the SR-IOV group identifier.
Quoted 3 lines
Quoted 3 lines
So we give up on the transport independent purity a bit and it seems worth it.
Also explained this in the cover letter - have you seen that?Sorry, I don't.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
And I think we might find a use for this with MMIO down the road with some kind of passthrough. Who knows.
Probably, but can it be modeled exactly as what SR-IOV looks like? Or anyhow, it's not too late to define this for MMIO at that time. For example, we know MSI-X may work for MMIO but we define it only for PCI now.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Thanks
Right. So if we reserve the id for all transports then it will be easy to do.
Also, if we go with transport-specific ids, we might end up with different ids per transport when we add a future transport-independent feature.
Quoted 4 lines
I'm not sure this is a real problem:
1) all the basic facilities are now transport-independent but they are implemented via different transport specific registers/commands/offsets etc.
Yes, but in this case we're using the same basic structure, just with a different id. I think that has a high potential for errors.
Quoted 4 lines
2) I'm not quite sure there would be a transport-independent group identifier other than the virtqueue transport, so I wonder if it makes sense to split the id space into global ones as well as the transport specific ones
I think global vs. transport-specific is overkill here. I don't think we expect a flood of new group types.
Quoted 9 lines
Quoted 4 lines
The global id space really should be big enough to accommodate
even single-transport groups.Yes, so it's not about the space but about whether or it it's worth/correct/expensive to describe a transport specific identifier in the basic facility part.
IMHO, splitting this or using transport-specific namespaces is making this complicated for not much in return. What do others think?
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that generates this mail. Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
Re: [virtio-dev] Re: [PATCH v9 02/10] admin: introduce device group and related concepts
In reply to Jason WangQuoted 23 lines · Jason Wang
Quoted 21 lines · Cornelia Huck
Quoted 19 lines · Michael S. Tsirkin
Quoted 18 lines · Jason Wang
Quoted 17 lines · Michael S. Tsirkin
Quoted 13 lines · Jason Wang
Review
Quoted 7 lines · Michael S. Tsirkin
(quoted diff) +7
-0+The following group types, and their identifiers, are currently specified): +\begin{description} +\item[SR-IOV group type (0x1)] +This device group has a PCI Single Root I/O Virtualization +(SR-IOV) physical function (PF) device as the owner and includes +all its SR-IOV virtual functions (VFs) as members (see +\hyperref[intro:PCIe]{[PCIe]}).So I wonder what's the advantage of using a global identifier over the transport specific one. There's almost no way for CCW/MMIO to use SR-IOV. Limiting it to PCI seems much easier and avoids layer violation.
Quoted 1 line
Thanks
So we burn up an identifier, ccw and mmio won't be able to use it. Big deal? Why?
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Because it is transport specific. The basic facility should be transport independent.
I tried this but the result is spread all over the spec and does not result in a readable cohesive whole.
I may miss something, but it looks to me it's just a subsection in the PCI transport to describe the SR-IOV group identifier.
right so everything is in admin.tex except for the identifier which is in pci. I find this split annoying - not enough material here where splitting makes things cleaner.
But we can move it down the road.
Quoted 53 lines
Quoted 3 lines
Quoted 3 lines
So we give up on the transport independent purity a bit and it seems worth it.
Also explained this in the cover letter - have you seen that?Sorry, I don't.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
And I think we might find a use for this with MMIO down the road with some kind of passthrough. Who knows.
Probably, but can it be modeled exactly as what SR-IOV looks like? Or anyhow, it's not too late to define this for MMIO at that time. For example, we know MSI-X may work for MMIO but we define it only for PCI now.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Thanks
Right. So if we reserve the id for all transports then it will be easy to do.
Also, if we go with transport-specific ids, we might end up with different ids per transport when we add a future transport-independent feature.
I'm not sure this is a real problem:
1) all the basic facilities are now transport-independent but they are implemented via different transport specific registers/commands/offsets etc.
2) I'm not quite sure there would be a transport-independent group identifier other than the virtqueue transport, so I wonder if it makes sense to split the id space into global ones as well as the transport specific onesQuoted 2 lines
The global id space really should be big enough to accommodate
even single-transport groups.Yes, so it's not about the space but about whether or it it's worth/correct/expensive to describe a transport specific identifier in the basic facility part.
Thanks
Quoted 6 lines
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
PATCH v9 3/10 admin: introduce group administration commands
In reply to Michael S. TsirkinThis introduces a general structure for group administration commands, used to control device groups through their owner.
Following patches will introduce specific commands and an interface for submitting these commands to the owner.
--- admin.tex | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
admin.tex +98 -0
@@ -42,4 +42,102 @@ \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). \end{description} +\subsection{Group administration commands}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands} +Group administration commands can be issued through an owner +device to control member devices of a group. This mechanism can +be used, for example, to configure a member device before it is +initialized by its driver. + +All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|} +\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline +0x8000 - 0xFFFF & - & Reserved \\ +\hline +\end{tabular} + +The \field{group_type} specifies the group type identifier. +The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier. + +The following table describes possible \field{status} values; +to simplify common implementations, they are intentionally +matching common Linux names and error numbers: + +\begin{tabular}{|l|l|l|} +\hline +Status (decimal) & Name & Description \\ +\hline \hline +00 & VIRTIO_ADMIN_STATUS_OK & successful completion \\ +\hline +22 & VIRTIO_ADMIN_STATUS_EINVAL & invalid command \\ +\hline +other & - & group administration command error \\ +\hline +\end{tabular} + +When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier} +is reserved and set to zero by the device. + +When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, +the following table describes possible \field{status_qialifier} values: +\begin{tabular}{|l|l|l|} +\hline +Status & Name & Description \\ +\hline \hline +0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command error: no additional information \\ +\hline +0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or invalid \field{opcode} \\ +\hline +0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or invalid field within \field{command_specific_data} \\ +\hline +0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or invalid \field{group_type} \\ +\hline +0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEM & unsupported or invalid \field{group_member_id} \\ +\hline +0x05-0xFFFF & - & reserved for future use \\ +\hline +\end{tabular}
Signature · 1 line
MST
[virtio-dev] Re: [PATCH v9 03/10] admin: introduce group administration commands
Quoted 18 lines · Michael S. Tsirkin
This introduces a general structure for group administration commands, used to control device groups through their owner.
Following patches will introduce specific commands and an interface for submitting these commands to the owner.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)admin.tex +0
-0
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 50
Quoted 9 lines
admin.tex +5
-0@@ -42,4 +42,102 @@ \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). \end{description} +\subsection{Group administration commands}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands} +Group administration commands can be issued through an owner +device to control member devices of a group. This mechanism can +be used, for example, to configure a member device before it is +initialized by its driver.
This excludes any possible runtime configuration, is this intended?
Quoted 40 lines
admin.tex +40
-0+ +All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|}
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 100
Quoted 10 lines
admin.tex +10
-0+\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline +0x8000 - 0xFFFF & - & Reserved \\ +\hline +\end{tabular} + +The \field{group_type} specifies the group type identifier.
So this means there's no way for having a group specific adminq? E.g one queue for SR-IOV and another for SIOV.
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 108
Quoted 8 lines
admin.tex +8
-0+The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier. + +The following table describes possible \field{status} values; +to simplify common implementations, they are intentionally +matching common Linux names and error numbers:
I may miss something but I don't see how it matches Linux error numbers.
Thanks
Quoted 36 lines
admin.tex +35
-1+ +\begin{tabular}{|l|l|l|} +\hline +Status (decimal) & Name & Description \\ +\hline \hline +00 & VIRTIO_ADMIN_STATUS_OK & successful completion \\ +\hline +22 & VIRTIO_ADMIN_STATUS_EINVAL & invalid command \\ +\hline +other & - & group administration command error \\ +\hline +\end{tabular} + +When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier} +is reserved and set to zero by the device. + +When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, +the following table describes possible \field{status_qialifier} values: +\begin{tabular}{|l|l|l|} +\hline +Status & Name & Description \\ +\hline \hline +0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command error: no additional information \\ +\hline +0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or invalid \field{opcode} \\ +\hline +0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or invalid field within \field{command_specific_data} \\ +\hline +0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or invalid \field{group_type} \\ +\hline +0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEM & unsupported or invalid \field{group_member_id} \\ +\hline +0x05-0xFFFF & - & reserved for future use \\ +\hline +\end{tabular} --
Quoted 2 lines
MST
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PATCH v9 03/10] admin: introduce group administration commands
Quoted 22 lines · Jason Wang
Quoted 21 lines · Michael S. Tsirkin
This introduces a general structure for group administration commands, used to control device groups through their owner.
Following patches will introduce specific commands and an interface for submitting these commands to the owner.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)admin.tex +0
-0@@ -42,4 +42,102 @@ \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). \end{description}
Quoted 8 lines
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 50
Quoted 6 lines
admin.tex +5
-0+\subsection{Group administration commands}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands} +Group administration commands can be issued through an owner +device to control member devices of a group. This mechanism can +be used, for example, to configure a member device before it is +initialized by its driver.This excludes any possible runtime configuration, is this intended?
No idea - what kind of runtime configuration are you talking about? This explicitly says "to configure a member device" and that's certainly at runtime.
Quoted 55 lines
Quoted 41 lines
admin.tex +40
-0+ +All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|}admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 100
Quoted 10 lines
admin.tex +10
-0+\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline +0x8000 - 0xFFFF & - & Reserved \\ +\hline +\end{tabular} + +The \field{group_type} specifies the group type identifier.So this means there's no way for having a group specific adminq? E.g one queue for SR-IOV and another for SIOV.
Quoted 10 lines
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 108
Quoted 8 lines
admin.tex +8
-0+The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier. + +The following table describes possible \field{status} values; +to simplify common implementations, they are intentionally +matching common Linux names and error numbers:I may miss something but I don't see how it matches Linux error numbers.
include/uapi/asm-generic/errno-base.h:#define EINVAL 22 /* Invalid argument */
Quoted 40 lines
Thanks
Quoted 38 lines
admin.tex +35
-1+ +\begin{tabular}{|l|l|l|} +\hline +Status (decimal) & Name & Description \\ +\hline \hline +00 & VIRTIO_ADMIN_STATUS_OK & successful completion \\ +\hline +22 & VIRTIO_ADMIN_STATUS_EINVAL & invalid command \\ +\hline +other & - & group administration command error \\ +\hline +\end{tabular} + +When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier} +is reserved and set to zero by the device. + +When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, +the following table describes possible \field{status_qialifier} values: +\begin{tabular}{|l|l|l|} +\hline +Status & Name & Description \\ +\hline \hline +0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command error: no additional information \\ +\hline +0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or invalid \field{opcode} \\ +\hline +0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or invalid field within \field{command_specific_data} \\ +\hline +0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or invalid \field{group_type} \\ +\hline +0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEM & unsupported or invalid \field{group_member_id} \\ +\hline +0x05-0xFFFF & - & reserved for future use \\ +\hline +\end{tabular} --MST
Re: [PATCH v9 03/10] admin: introduce group administration commands
Quoted 33 lines · Michael S. Tsirkin
Quoted 22 lines · Jason Wang
Quoted 21 lines · Michael S. Tsirkin
This introduces a general structure for group administration commands, used to control device groups through their owner.
Following patches will introduce specific commands and an interface for submitting these commands to the owner.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)admin.tex +0
-0@@ -42,4 +42,102 @@ \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). \end{description}Quoted 8 lines
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 50
Quoted 6 lines
admin.tex +5
-0+\subsection{Group administration commands}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands} +Group administration commands can be issued through an owner +device to control member devices of a group. This mechanism can +be used, for example, to configure a member device before it is +initialized by its driver.This excludes any possible runtime configuration, is this intended?
Quoted 3 lines
No idea - what kind of runtime configuration are you talking about? This explicitly says "to configure a member device" and that's certainly at runtime.
Not sure, but if we say something like we, it means we need a group of commands to support runtime stuff in the future?
Quoted 69 lines
Quoted 57 lines
Quoted 43 lines
admin.tex +40
-0+ +All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|}admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 100
Quoted 10 lines
admin.tex +10
-0+\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline +0x8000 - 0xFFFF & - & Reserved \\ +\hline +\end{tabular} + +The \field{group_type} specifies the group type identifier.So this means there's no way for having a group specific adminq? E.g one queue for SR-IOV and another for SIOV.
Quoted 10 lines
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 108
Quoted 8 lines
admin.tex +8
-0+The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier. + +The following table describes possible \field{status} values; +to simplify common implementations, they are intentionally +matching common Linux names and error numbers:I may miss something but I don't see how it matches Linux error numbers.
Quoted 1 line
include/uapi/asm-generic/errno-base.h:#define EINVAL 22 /* Invalid argument */
Ok, only this one was matched but any advantages of menting the matching? I believe not all the error numbers are meaningful for a device interface (e.g EINTR).
Thanks
Quoted 43 lines
Quoted 42 lines
Thanks
Quoted 38 lines
admin.tex +35
-1+ +\begin{tabular}{|l|l|l|} +\hline +Status (decimal) & Name & Description \\ +\hline \hline +00 & VIRTIO_ADMIN_STATUS_OK & successful completion \\ +\hline +22 & VIRTIO_ADMIN_STATUS_EINVAL & invalid command \\ +\hline +other & - & group administration command error \\ +\hline +\end{tabular} + +When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier} +is reserved and set to zero by the device. + +When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, +the following table describes possible \field{status_qialifier} values: +\begin{tabular}{|l|l|l|} +\hline +Status & Name & Description \\ +\hline \hline +0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command error: no additional information \\ +\hline +0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or invalid \field{opcode} \\ +\hline +0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or invalid field within \field{command_specific_data} \\ +\hline +0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or invalid \field{group_type} \\ +\hline +0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEM & unsupported or invalid \field{group_member_id} \\ +\hline +0x05-0xFFFF & - & reserved for future use \\ +\hline +\end{tabular} --MST
Re: [PATCH v9 03/10] admin: introduce group administration commands
Quoted 34 lines · Jason Wang
Quoted 33 lines · Michael S. Tsirkin
Quoted 30 lines · Jason Wang
Quoted 18 lines · Michael S. Tsirkin
This introduces a general structure for group administration commands, used to control device groups through their owner.
Following patches will introduce specific commands and an interface for submitting these commands to the owner.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)admin.tex +0
-0admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 50
Quoted 9 lines
admin.tex +5
-0@@ -42,4 +42,102 @@ \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). \end{description} +\subsection{Group administration commands}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands} +Group administration commands can be issued through an owner +device to control member devices of a group. This mechanism can +be used, for example, to configure a member device before it is +initialized by its driver.This excludes any possible runtime configuration, is this intended?
Quoted 6 lines
Quoted 3 lines
No idea - what kind of runtime configuration are you talking about? This explicitly says "to configure a member device" and that's certainly at runtime.
Not sure, but if we say something like we, it means we need a group of commands to support runtime stuff in the future?
we'll need commands to provision members - is this what you mean? for sure.
Quoted 69 lines
Quoted 69 lines
Quoted 67 lines
Quoted 43 lines
admin.tex +40
-0+ +All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|}admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 100
Quoted 10 lines
admin.tex +10
-0+\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline +0x8000 - 0xFFFF & - & Reserved \\ +\hline +\end{tabular} + +The \field{group_type} specifies the group type identifier.So this means there's no way for having a group specific adminq? E.g one queue for SR-IOV and another for SIOV.
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 108
Quoted 8 lines
admin.tex +8
-0+The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier. + +The following table describes possible \field{status} values; +to simplify common implementations, they are intentionally +matching common Linux names and error numbers:I may miss something but I don't see how it matches Linux error numbers.
Quoted 7 lines
Quoted 1 line
include/uapi/asm-generic/errno-base.h:#define EINVAL 22 /* Invalid argument */
Ok, only this one was matched but any advantages of menting the matching? I believe not all the error numbers are meaningful for a device interface (e.g EINTR).
Thanks
Makes it easier for driver to decide on an error to report to userspace. If we don't use all error codes that's fine.
Quoted 43 lines
Quoted 43 lines
Quoted 42 lines
Thanks
Quoted 38 lines
admin.tex +35
-1+ +\begin{tabular}{|l|l|l|} +\hline +Status (decimal) & Name & Description \\ +\hline \hline +00 & VIRTIO_ADMIN_STATUS_OK & successful completion \\ +\hline +22 & VIRTIO_ADMIN_STATUS_EINVAL & invalid command \\ +\hline +other & - & group administration command error \\ +\hline +\end{tabular} + +When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier} +is reserved and set to zero by the device. + +When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, +the following table describes possible \field{status_qialifier} values: +\begin{tabular}{|l|l|l|} +\hline +Status & Name & Description \\ +\hline \hline +0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command error: no additional information \\ +\hline +0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or invalid \field{opcode} \\ +\hline +0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or invalid field within \field{command_specific_data} \\ +\hline +0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or invalid \field{group_type} \\ +\hline +0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEM & unsupported or invalid \field{group_member_id} \\ +\hline +0x05-0xFFFF & - & reserved for future use \\ +\hline +\end{tabular} --MST
[virtio-comment] Re: [PATCH v9 03/10] admin: introduce group administration commands
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Jason Wang
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Jason Wang
Quoted 17 lines · Michael S. Tsirkin
This introduces a general structure for group administration commands, used to control device groups through their owner.
Following patches will introduce specific commands and an interface for submitting these commands to the owner.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)admin.tex +0
-0admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 50
Quoted 9 lines
admin.tex +5
-0@@ -42,4 +42,102 @@ \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). \end{description} +\subsection{Group administration commands}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands} +Group administration commands can be issued through an owner +device to control member devices of a group. This mechanism can +be used, for example, to configure a member device before it is +initialized by its driver.This excludes any possible runtime configuration, is this intended?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
No idea - what kind of runtime configuration are you talking about? This explicitly says "to configure a member device" and that's certainly at runtime.
Not sure, but if we say something like we, it means we need a group of commands to support runtime stuff in the future?
we'll need commands to provision members - is this what you mean? for sure.
Yes.
Quoted 66 lines
Quoted 66 lines
Quoted 66 lines
Quoted 55 lines
Quoted 42 lines
admin.tex +40
-0+ +All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|}admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 100
Quoted 10 lines
admin.tex +10
-0+\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline +0x8000 - 0xFFFF & - & Reserved \\ +\hline +\end{tabular} + +The \field{group_type} specifies the group type identifier.So this means there's no way for having a group specific adminq? E.g one queue for SR-IOV and another for SIOV.
Quoted 9 lines
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 108
Quoted 8 lines
admin.tex +8
-0+The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier. + +The following table describes possible \field{status} values; +to simplify common implementations, they are intentionally +matching common Linux names and error numbers:I may miss something but I don't see how it matches Linux error numbers.
include/uapi/asm-generic/errno-base.h:#define EINVAL 22 /* Invalid argument */
Quoted 8 lines
Quoted 5 lines
Ok, only this one was matched but any advantages of menting the matching? I believe not all the error numbers are meaningful for a device interface (e.g EINTR).
Thanks
Makes it easier for driver to decide on an error to report to userspace. If we don't use all error codes that's fine.
Ok.
Thanks
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Thanks
Quoted 30 lines
admin.tex +30
-0+ +\begin{tabular}{|l|l|l|} +\hline +Status (decimal) & Name & Description \\ +\hline \hline +00 & VIRTIO_ADMIN_STATUS_OK & successful completion \\ +\hline +22 & VIRTIO_ADMIN_STATUS_EINVAL & invalid command \\ +\hline +other & - & group administration command error \\ +\hline +\end{tabular} + +When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier} +is reserved and set to zero by the device. + +When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, +the following table describes possible \field{status_qialifier} values: +\begin{tabular}{|l|l|l|} +\hline +Status & Name & Description \\ +\hline \hline +0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command error: no additional information \\ +\hline +0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or invalid \field{opcode} \\ +\hline +0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or invalid field within \field{command_specific_data} \\ +\hline +0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or invalid \field{group_type} \\ +\hline
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
admin.tex +5
-1+0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEM & unsupported or invalid \field{group_member_id} \\ +\hline +0x05-0xFFFF & - & reserved for future use \\ +\hline +\end{tabular} --MST
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Re: [virtio-dev] Re: [PATCH v9 03/10] admin: introduce group administration commands
In reply to Jason WangQuoted 45 lines · Jason Wang
Quoted 44 lines · Michael S. Tsirkin
admin.tex +44
-0+All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|} +\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline
Quoted 8 lines
Review
Quoted 5 lines
+0x8000 -
0xFFFF& - & Reserved \\
+\hline
+\end{tabular}(quoted diff) +2
-0+ +The \field{group_type} specifies the group type identifier.So this means there's no way for having a group specific adminq? E.g one queue for SR-IOV and another for SIOV.
I don't see anything that prevents the device from exposing two admin queues... do you mean that we should provide a mechanism for the device to mandate that only commands for a certain group id can go on a certain admin queue?
Quoted 5 lines
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 104
Quoted 5 lines
admin.tex +4
-0+The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [virtio-dev] Re: [PATCH v9 03/10] admin: introduce group administration commands
Quoted 54 lines · Cornelia Huck
Quoted 44 lines · Jason Wang
Quoted 43 lines · Michael S. Tsirkin
admin.tex +43
-0+All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|} +\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\Quoted 8 lines
Review
Quoted 6 lines
+\hline
+0x8000 -0xFFFF& - & Reserved \\
+\hline
+\end{tabular}(quoted diff) +2
-0+ +The \field{group_type} specifies the group type identifier.So this means there's no way for having a group specific adminq? E.g one queue for SR-IOV and another for SIOV.
Quoted 4 lines
I don't see anything that prevents the device from exposing two admin queues... do you mean that we should provide a mechanism for the device to mandate that only commands for a certain group id can go on a certain admin queue?
Yes, and rethink about this, it seems to be possible by only returning the specific commands for a single type of group via query.
Thanks
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
admin.tex +4
-0+The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier.
Re: [virtio-comment] [PATCH v9 03/10] admin: introduce group administration commands
In reply to Michael S. TsirkinQuoted 17 lines · Michael S. Tsirkin
This introduces a general structure for group administration commands, used to control device groups through their owner.
Following patches will introduce specific commands and an interface for submitting these commands to the owner.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)admin.tex +0
-0
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 50
Quoted 9 lines
admin.tex +5
-0@@ -42,4 +42,102 @@ \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g PCI transport (see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus}). \end{description} +\subsection{Group administration commands}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands} +Group administration commands can be issued through an owner +device to control member devices of a group. This mechanism can +be used, for example, to configure a member device before it is +initialized by its driver.
If we want "transport vq" to rebase on "admin vq", then there can be something more than administrative commands, like "config msix" from the guest driver and kicking a vq.
Thanks
Zhu Lingshan
Quoted 83 lines
admin.tex +83
-0+ +All the group administration commands are of the following form: + +\begin{lstlisting} +struct virtio_admin_cmd { + /* Device-readable part */ + le16 opcode; + /* + * 1 - SR-IOV + * 2 - 65535 reserved + */ + le16 group_type; + /* unused, reserved for future extensions */ + u8 reserved1[12]; + le64 group_member_id; + u8 command_specific_data[]; + + /* Device-writable part */ + le16 status; + le16 status_qualifier; + /* unused, reserved for future extensions */ + u8 reserved2[4]; + u8 command_specific_result[]; +}; +\end{lstlisting} + +For all commands, \field{opcode}, \field{group_type} and if +necessary \field{group_member_id} and \field{command_specific_data} are +set by the driver, and the owner device sets \field{status} and if +needed \field{status_qualifier} and +\field{command_specific_result}. + +As a rule, any unused device-readable fields are set to zero by the driver +and ignored by the device. Any unused device-writeable fields are set to zero +by the device and ignored by the driver. + +\field{opcode} specifies the command. The valid +values for \field{opcode} can be found in the following table: + +\begin{tabular}{|l|l|} +\hline +opcode & Name & Command Description \\ +\hline \hline +0x0000 - 0x7FFF & - & Group administration commands \\ +\hline +0x8000 - 0xFFFF & - & Reserved \\ +\hline +\end{tabular} + +The \field{group_type} specifies the group type identifier. +The \field{group_member_id} specifies the member identifier within the group. +See section \ref{sec:Introduction / Terminology / Device group} +for the definition of the group type identifier and group member +identifier. + +The following table describes possible \field{status} values; +to simplify common implementations, they are intentionally +matching common Linux names and error numbers: + +\begin{tabular}{|l|l|l|} +\hline +Status (decimal) & Name & Description \\ +\hline \hline +00 & VIRTIO_ADMIN_STATUS_OK & successful completion \\ +\hline +22 & VIRTIO_ADMIN_STATUS_EINVAL & invalid command \\ +\hline +other & - & group administration command error \\ +\hline +\end{tabular} + +When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier} +is reserved and set to zero by the device. + +When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, +the following table describes possible \field{status_qialifier} values: +\begin{tabular}{|l|l|l|} +\hline +Status & Name & Description \\ +\hline \hline +0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command error: no additional information \\ +\hline +0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or invalid \field{opcode} \\
admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 143
Quoted 10 lines
admin.tex +10
-0+\hline +0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or invalid field within \field{command_specific_data} \\ +\hline +0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or invalid \field{group_type} \\ +\hline +0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEM & unsupported or invalid \field{group_member_id} \\ +\hline +0x05-0xFFFF & - & reserved for future use \\ +\hline +\end{tabular}
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
PATCH v9 4/10 admin: introduce virtio admin virtqueues
In reply to Michael S. TsirkinThe admin virtqueues will be the first interface to issue admin commands.
Currently virtio specification defines control virtqueue to manipulate features and configuration of the device it operates on. However, control virtqueue commands are device type specific, which makes it very difficult to extend for device agnostic commands.
To support this requirement in a more generic way, this patch introduces a new admin virtqueue interface.
We also support more than one admin virtqueue, for QoS and scalability requirements.
--- admin.tex | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ content.tex | 7 +++++-- 2 files changed, 59 insertions(+), 2 deletions(-)
admin.tex +54 -0
@@ -141,3 +141,57 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti 0x05-0xFFFF & - & reserved for future use \\ \hline \end{tabular} + +\section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues} + +An administration virtqueue of an owner device is used to submit +group administration commands. An owner device can have more +than one administration virtqueue. + +If VIRTIO_F_ADMIN_VQ has been negotiated, an owner device exposes one +or more adminstration virtqueues. The number and locations of the +administration virtqueues are exposed by the owner device in a transport +specific manner. + +The driver submits commands by queueing them to an arbitrary +administration virtqueue, and they are processed by the +device in the order in which they are queued. It is the +responsibility of the driver to ensure ordering for commands +placed on different administration virtqueues, because they will +be executed with no order constraints. + +Administration virtqueues are used as follows: +\begin{itemize} +\item The driver submits the command using the \field{struct virtio_admin_cmd} +structure using two buffers: a device-readable one followed by a +device-writable one. +\item the device-readable buffer includes fields from \field{opcode} +through \field{command_specific_data}. +\item the device-writeable buffer includes fields from \field{status} +through \field{command_specific_result} inclusive. +\end{itemize} + +It is legal for the driver to submit commands with +device-writeable and device-readable structures with buffer +length both shorter or longer than the length of the +\field{command_specific_data} structure described in this +specification. The device silently truncates the structures +to either the length submitted by the driver, or the length +described in this specification, whichever is shorter. +The device silently ignores any data falling outside +the shorter of the two lengths. Any missing fields are assumed to be +set to zero. + +Similarly, it is legal for the device to use, for a specific +command, a shorter part of the \field{command_specific_result} +buffer than the length of the structure described in this +specification. The driver silently ignores any data falling outside +the used buffer length reported by the device. Any missing +fields are assumed to be set to zero. + +This simplifies driver implementations since the driver can +simply maintain a single large C structure for a command and its +result. As new versions of the specification are designed, +new fields can be added to the tail of a structure, +with the driver using the full structure without concern +for versioning.
content.tex +5 -2
@@ -99,10 +99,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B \begin{description} \item[0 to 23, and 50 to 127] Feature bits for the specific device type -\item[24 to 40] Feature bits reserved for extensions to the queue and +\item[24 to 41] Feature bits reserved for extensions to the queue and feature negotiation mechanisms -\item[41 to 49, and 128 and above] Feature bits reserved for future extensions. +\item[42 to 49, and 128 and above] Feature bits reserved for future extensions. \end{description} \begin{note}
@@ -6990,6 +6990,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} that the driver can reset a queue individually. See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}. + \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more + administration virtqueues. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
Signature · 1 line
MST
Re: [virtio-comment] [PATCH v9 04/10] admin: introduce virtio admin virtqueues
Quoted 53 lines · Michael S. Tsirkin
The admin virtqueues will be the first interface to issue admin commands.
Currently virtio specification defines control virtqueue to manipulate features and configuration of the device it operates on. However, control virtqueue commands are device type specific, which makes it very difficult to extend for device agnostic commands.
To support this requirement in a more generic way, this patch introduces a new admin virtqueue interface.
We also support more than one admin virtqueue, for QoS and scalability requirements.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ content.tex | 7 +++++-- 2 files changed, 59 insertions(+), 2 deletions(-)admin.tex +25
-0@@ -141,3 +141,57 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti 0x05-0xFFFF & - & reserved for future use \\ \hline \end{tabular} + +\section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues} + +An administration virtqueue of an owner device is used to submit +group administration commands. An owner device can have more +than one administration virtqueue. + +If VIRTIO_F_ADMIN_VQ has been negotiated, an owner device exposes one +or more adminstration virtqueues. The number and locations of the +administration virtqueues are exposed by the owner device in a transport +specific manner. + +The driver submits commands by queueing them to an arbitrary +administration virtqueue, and they are processed by the +device in the order in which they are queued. It is the +responsibility of the driver to ensure ordering for commands +placed on different administration virtqueues, because they will +be executed with no order constraints. + +Administration virtqueues are used as follows: +\begin{itemize} +\item The driver submits the command using the \field{struct virtio_admin_cmd} +structure using two buffers: a device-readable one followed by a +device-writable one. +\item the device-readable buffer includes fields from \field{opcode}
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 178
Quoted 10 lines
admin.tex +10
-0+through \field{command_specific_data}. +\item the device-writeable buffer includes fields from \field{status} +through \field{command_specific_result} inclusive. +\end{itemize} + +It is legal for the driver to submit commands with +device-writeable and device-readable structures with buffer +length both shorter or longer than the length of the +\field{command_specific_data} structure described in this +specification. The device silently truncates the structures
Maybe I have missed something, I did not
find the length defined in this series
And there is two buffers, does it implies two chained descriptors? If so, we can calculate the data length by the descriptor length, but just as what described in this series, we may extend the contents, so it looks like we still need an explicit long enough data length.
Thanks
Quoted 37 lines
admin.tex +19
-0+to either the length submitted by the driver, or the length +described in this specification, whichever is shorter. +The device silently ignores any data falling outside +the shorter of the two lengths. Any missing fields are assumed to be +set to zero. + +Similarly, it is legal for the device to use, for a specific +command, a shorter part of the \field{command_specific_result} +buffer than the length of the structure described in this +specification. The driver silently ignores any data falling outside +the used buffer length reported by the device. Any missing +fields are assumed to be set to zero. + +This simplifies driver implementations since the driver can +simply maintain a single large C structure for a command and its +result. As new versions of the specification are designed, +new fields can be added to the tail of a structure, +with the driver using the full structure without concern +for versioning.content.tex +2
-2@@ -99,10 +99,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B \begin{description} \item[0 to 23, and 50 to 127] Feature bits for the specific device type -\item[24 to 40] Feature bits reserved for extensions to the queue and +\item[24 to 41] Feature bits reserved for extensions to the queue and feature negotiation mechanisms -\item[41 to 49, and 128 and above] Feature bits reserved for future extensions. +\item[42 to 49, and 128 and above] Feature bits reserved for future extensions. \end{description} \begin{note}
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} · line 6998
Quoted 9 lines
content.tex +3
-0@@ -6990,6 +6990,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} that the driver can reset a queue individually. See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}. + \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more + administration virtqueues. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
PATCH v9 5/10 pci: add admin vq registers to virtio over pci
In reply to Michael S. TsirkinAdd new registers to the PCI common configuration structure.
These registers will be used for querying the indices of the admin virtqueues of the owner device. To configure, reset or enable the admin virtqueues, the driver should follow existing queue configuration/setup sequence.
--- content.tex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
content.tex +34 -0
@@ -946,6 +946,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport le64 queue_device; /* read-write */ le16 queue_notify_data; /* read-only for driver */ le16 queue_reset; /* read-write */ + + /* About the administration virtqueue. */ + le16 admin_queue_index; /* read-only for driver */ + le16 admin_queue_num; /* read-only for driver */ }; \end{lstlisting}
@@ -1031,6 +1035,19 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport This field exists only if VIRTIO_F_RING_RESET has been negotiated. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +\item[\field{admin_queue_index}] + The device uses this to report the index of the first administration virtqueue. + This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated. +\item[\field{admin_queue_num}] + The device uses this to report the number of the + supported administration virtqueues. Virtqueues with index + between \field{admin_queue_index} and (\field{admin_queue_index} + + \field{admin_queue_num}) inclusive serve as administration + virtqueues. + Thus the number of administration virtqueues equals + (\field{admin_queue_num} + 1). + This field is valid only if VIRTIO_F_ADMIN_VQ has been + negotiated. \end{description} \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}
@@ -1117,6 +1134,14 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport were used before the queue reset. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +If VIRTIO_F_ADMIN_VQ has been negotiated, and if the driver +configures any administration virtqueues, the driver MUST +configure the administration virtqueues using the index +in the range \field{admin_queue_index} to +\field{admin_queue_index} + \field{admin_queue_num} inclusive. +The driver MAY configure less administration virtqueues than +supported by the device. + \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability} The notification location is found using the VIRTIO_PCI_CAP_NOTIFY_CFG
@@ -6992,6 +7017,15 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more administration virtqueues. + At the moment this feature is only supported for devices using + \ref{sec:Virtio Transport Options / Virtio Over PCI + Bus}~\nameref{sec:Virtio Transport Options / Virtio Over PCI Bus} + as the transport and is reserved for future use for + devices using other transports (see + \ref{drivernormative:Basic Facilities of a Virtio Device / Feature Bits} + and + \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for + handling features reserved for future use. \end{description}
Signature · 1 line
MST
Re: [PATCH v9 05/10] pci: add admin vq registers to virtio over pci
Quoted 19 lines · Michael S. Tsirkin
Add new registers to the PCI common configuration structure.
These registers will be used for querying the indices of the admin virtqueues of the owner device. To configure, reset or enable the admin virtqueues, the driver should follow existing queue configuration/setup sequence.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)content.tex +0
-0
content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 952
Quoted 7 lines
content.tex +4
-0@@ -946,6 +946,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport le64 queue_device; /* read-write */ le16 queue_notify_data; /* read-only for driver */ le16 queue_reset; /* read-write */ + + /* About the administration virtqueue. */ + le16 admin_queue_index; /* read-only for driver */ + le16 admin_queue_num; /* read-only for driver */
If we are adding more queue related functionality, it would be placed under the above two fields which seems not elegant. I wonder if a new structure is needed here.
Thanks
Quoted 57 lines
content.tex +30
-1}; \end{lstlisting}@@ -1031,6 +1035,19 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport This field exists only if VIRTIO_F_RING_RESET has been negotiated. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +\item[\field{admin_queue_index}] + The device uses this to report the index of the first administration virtqueue. + This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated. +\item[\field{admin_queue_num}] + The device uses this to report the number of the + supported administration virtqueues. Virtqueues with index + between \field{admin_queue_index} and (\field{admin_queue_index} + + \field{admin_queue_num}) inclusive serve as administration + virtqueues. + Thus the number of administration virtqueues equals + (\field{admin_queue_num} + 1). + This field is valid only if VIRTIO_F_ADMIN_VQ has been + negotiated. \end{description} \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}@@ -1117,6 +1134,14 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport were used before the queue reset. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +If VIRTIO_F_ADMIN_VQ has been negotiated, and if the driver +configures any administration virtqueues, the driver MUST +configure the administration virtqueues using the index +in the range \field{admin_queue_index} to +\field{admin_queue_index} + \field{admin_queue_num} inclusive. +The driver MAY configure less administration virtqueues than +supported by the device. + \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability} The notification location is found using the VIRTIO_PCI_CAP_NOTIFY_CFG@@ -6992,6 +7017,15 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more administration virtqueues. + At the moment this feature is only supported for devices using + \ref{sec:Virtio Transport Options / Virtio Over PCI + Bus}~\nameref{sec:Virtio Transport Options / Virtio Over PCI Bus} + as the transport and is reserved for future use for + devices using other transports (see + \ref{drivernormative:Basic Facilities of a Virtio Device / Feature Bits} + and + \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for + handling features reserved for future use. \end{description} --MST
Re: [PATCH v9 05/10] pci: add admin vq registers to virtio over pci
Quoted 32 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Add new registers to the PCI common configuration structure.
These registers will be used for querying the indices of the admin virtqueues of the owner device. To configure, reset or enable the admin virtqueues, the driver should follow existing queue configuration/setup sequence.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)content.tex +0
-0content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 952
Quoted 7 lines
content.tex +4
-0@@ -946,6 +946,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport le64 queue_device; /* read-write */ le16 queue_notify_data; /* read-only for driver */ le16 queue_reset; /* read-write */ + + /* About the administration virtqueue. */ + le16 admin_queue_index; /* read-only for driver */ + le16 admin_queue_num; /* read-only for driver */If we are adding more queue related functionality, it would be placed under the above two fields which seems not elegant. I wonder if a new structure is needed here.
Quoted 1 line
Thanks
I don't expect more, if that happens we can always refactor it. Generally this is not C, no one compiles this directly. So we do not need to add structures unless
they are referred to in spec text.
Quoted 57 lines
Quoted 57 lines
content.tex +30
-1}; \end{lstlisting}@@ -1031,6 +1035,19 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport This field exists only if VIRTIO_F_RING_RESET has been negotiated. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +\item[\field{admin_queue_index}] + The device uses this to report the index of the first administration virtqueue. + This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated. +\item[\field{admin_queue_num}] + The device uses this to report the number of the + supported administration virtqueues. Virtqueues with index + between \field{admin_queue_index} and (\field{admin_queue_index} + + \field{admin_queue_num}) inclusive serve as administration + virtqueues. + Thus the number of administration virtqueues equals + (\field{admin_queue_num} + 1). + This field is valid only if VIRTIO_F_ADMIN_VQ has been + negotiated. \end{description} \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}@@ -1117,6 +1134,14 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport were used before the queue reset. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +If VIRTIO_F_ADMIN_VQ has been negotiated, and if the driver +configures any administration virtqueues, the driver MUST +configure the administration virtqueues using the index +in the range \field{admin_queue_index} to +\field{admin_queue_index} + \field{admin_queue_num} inclusive. +The driver MAY configure less administration virtqueues than +supported by the device. + \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability} The notification location is found using the VIRTIO_PCI_CAP_NOTIFY_CFG@@ -6992,6 +7017,15 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more administration virtqueues. + At the moment this feature is only supported for devices using + \ref{sec:Virtio Transport Options / Virtio Over PCI + Bus}~\nameref{sec:Virtio Transport Options / Virtio Over PCI Bus} + as the transport and is reserved for future use for + devices using other transports (see + \ref{drivernormative:Basic Facilities of a Virtio Device / Feature Bits} + and + \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for + handling features reserved for future use. \end{description} --MST
Re: [PATCH v9 05/10] pci: add admin vq registers to virtio over pci
Quoted 34 lines · Michael S. Tsirkin
Quoted 32 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Add new registers to the PCI common configuration structure.
These registers will be used for querying the indices of the admin virtqueues of the owner device. To configure, reset or enable the admin virtqueues, the driver should follow existing queue configuration/setup sequence.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)content.tex +0
-0content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 952
Quoted 7 lines
content.tex +4
-0@@ -946,6 +946,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport le64 queue_device; /* read-write */ le16 queue_notify_data; /* read-only for driver */ le16 queue_reset; /* read-write */ + + /* About the administration virtqueue. */ + le16 admin_queue_index; /* read-only for driver */ + le16 admin_queue_num; /* read-only for driver */If we are adding more queue related functionality, it would be placed under the above two fields which seems not elegant. I wonder if a new structure is needed here.
Quoted 3 lines
Quoted 1 line
Thanks
I don't expect more, if that happens we can always refactor it.
I may miss something but it should be a part of ABI. How could we refactor it without breaking ABI?
Thanks
Quoted 62 lines
Generally this is not C, no one compiles this directly. So we do not need to add structures unless they are referred to in spec text.
Quoted 57 lines
Quoted 57 lines
content.tex +30
-1}; \end{lstlisting}@@ -1031,6 +1035,19 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport This field exists only if VIRTIO_F_RING_RESET has been negotiated. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +\item[\field{admin_queue_index}] + The device uses this to report the index of the first administration virtqueue. + This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated. +\item[\field{admin_queue_num}] + The device uses this to report the number of the + supported administration virtqueues. Virtqueues with index + between \field{admin_queue_index} and (\field{admin_queue_index} + + \field{admin_queue_num}) inclusive serve as administration + virtqueues. + Thus the number of administration virtqueues equals + (\field{admin_queue_num} + 1). + This field is valid only if VIRTIO_F_ADMIN_VQ has been + negotiated. \end{description} \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}@@ -1117,6 +1134,14 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport were used before the queue reset. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +If VIRTIO_F_ADMIN_VQ has been negotiated, and if the driver +configures any administration virtqueues, the driver MUST +configure the administration virtqueues using the index +in the range \field{admin_queue_index} to +\field{admin_queue_index} + \field{admin_queue_num} inclusive. +The driver MAY configure less administration virtqueues than +supported by the device. + \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability} The notification location is found using the VIRTIO_PCI_CAP_NOTIFY_CFG@@ -6992,6 +7017,15 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more administration virtqueues. + At the moment this feature is only supported for devices using + \ref{sec:Virtio Transport Options / Virtio Over PCI + Bus}~\nameref{sec:Virtio Transport Options / Virtio Over PCI Bus} + as the transport and is reserved for future use for + devices using other transports (see + \ref{drivernormative:Basic Facilities of a Virtio Device / Feature Bits} + and + \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for + handling features reserved for future use. \end{description} --MST
Re: [PATCH v9 05/10] pci: add admin vq registers to virtio over pci
Quoted 35 lines · Jason Wang
Quoted 34 lines · Michael S. Tsirkin
Quoted 32 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Add new registers to the PCI common configuration structure.
These registers will be used for querying the indices of the admin virtqueues of the owner device. To configure, reset or enable the admin virtqueues, the driver should follow existing queue configuration/setup sequence.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)content.tex +0
-0content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 952
Quoted 7 lines
content.tex +4
-0@@ -946,6 +946,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport le64 queue_device; /* read-write */ le16 queue_notify_data; /* read-only for driver */ le16 queue_reset; /* read-write */ + + /* About the administration virtqueue. */ + le16 admin_queue_index; /* read-only for driver */ + le16 admin_queue_num; /* read-only for driver */If we are adding more queue related functionality, it would be placed under the above two fields which seems not elegant. I wonder if a new structure is needed here.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Thanks
I don't expect more, if that happens we can always refactor it.
I may miss something but it should be a part of ABI. How could we refactor it without breaking ABI?
Thanks
/* About the administration virtqueue. */
- le16 admin_queue_index; /* read-only for driver */
- le16 admin_queue_num; /* read-only for driver */
+ struct { /* read-only for driver */
+ le16 index;
+ le16 num;+ } admin_queue;
does not affect the ABI. But the order of things makes it less readable.
We would also have to change references to admin_queue_index with admin_queue.index and explain the "." notation in introduction.
All doable but this patchset is large enough as it is.
Quoted 62 lines
Quoted 62 lines
Generally this is not C, no one compiles this directly. So we do not need to add structures unless they are referred to in spec text.
Quoted 57 lines
Quoted 57 lines
content.tex +30
-1}; \end{lstlisting}@@ -1031,6 +1035,19 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport This field exists only if VIRTIO_F_RING_RESET has been negotiated. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +\item[\field{admin_queue_index}] + The device uses this to report the index of the first administration virtqueue. + This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated. +\item[\field{admin_queue_num}] + The device uses this to report the number of the + supported administration virtqueues. Virtqueues with index + between \field{admin_queue_index} and (\field{admin_queue_index} + + \field{admin_queue_num}) inclusive serve as administration + virtqueues. + Thus the number of administration virtqueues equals + (\field{admin_queue_num} + 1). + This field is valid only if VIRTIO_F_ADMIN_VQ has been + negotiated. \end{description} \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}@@ -1117,6 +1134,14 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport were used before the queue reset. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +If VIRTIO_F_ADMIN_VQ has been negotiated, and if the driver +configures any administration virtqueues, the driver MUST +configure the administration virtqueues using the index +in the range \field{admin_queue_index} to +\field{admin_queue_index} + \field{admin_queue_num} inclusive. +The driver MAY configure less administration virtqueues than +supported by the device. + \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability} The notification location is found using the VIRTIO_PCI_CAP_NOTIFY_CFG@@ -6992,6 +7017,15 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more administration virtqueues. + At the moment this feature is only supported for devices using + \ref{sec:Virtio Transport Options / Virtio Over PCI + Bus}~\nameref{sec:Virtio Transport Options / Virtio Over PCI Bus} + as the transport and is reserved for future use for + devices using other transports (see + \ref{drivernormative:Basic Facilities of a Virtio Device / Feature Bits} + and + \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for + handling features reserved for future use. \end{description} --MST
Re: [PATCH v9 05/10] pci: add admin vq registers to virtio over pci
Quoted 47 lines · Michael S. Tsirkin
Quoted 32 lines · Jason Wang
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Jason Wang
Quoted 18 lines · Michael S. Tsirkin
Add new registers to the PCI common configuration structure.
These registers will be used for querying the indices of the admin virtqueues of the owner device. To configure, reset or enable the admin virtqueues, the driver should follow existing queue configuration/setup sequence.
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)content.tex +0
-0content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 952
Quoted 7 lines
content.tex +4
-0@@ -946,6 +946,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport le64 queue_device; /* read-write */ le16 queue_notify_data; /* read-only for driver */ le16 queue_reset; /* read-write */ + + /* About the administration virtqueue. */ + le16 admin_queue_index; /* read-only for driver */ + le16 admin_queue_num; /* read-only for driver */If we are adding more queue related functionality, it would be placed under the above two fields which seems not elegant. I wonder if a new structure is needed here.
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Thanks
I don't expect more, if that happens we can always refactor it.
I may miss something but it should be a part of ABI. How could we refactor it without breaking ABI?
Thanks
/* About the administration virtqueue. */(quoted diff) +4
-2- le16 admin_queue_index; /* read-only for driver */ - le16 admin_queue_num; /* read-only for driver */ + struct { /* read-only for driver */ + le16 index; + le16 num; + } admin_queue;
Quoted 1 line
does not affect the ABI. But the order of things makes it less readable.
Yes, so I basically meant if we need a dedicated capability for admin virtqueue.
(Btw, I wonder if we need a sentence to document the implication for notification area, e.g if vendor choose to use a large index but still want to use page-per-vq notification area).
Quoted 6 lines
We would also have to change references to
admin_queue_indexwith admin_queue.index and explain the "." notation in introduction.All doable but this patchset is large enough as it is.
Can we split the PCI part on top?
Thanks
Quoted 64 lines
Quoted 64 lines
Quoted 64 lines
Generally this is not C, no one compiles this directly. So we do not need to add structures unless they are referred to in spec text.
Quoted 57 lines
Quoted 57 lines
content.tex +30
-1}; \end{lstlisting}@@ -1031,6 +1035,19 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport This field exists only if VIRTIO_F_RING_RESET has been negotiated. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +\item[\field{admin_queue_index}] + The device uses this to report the index of the first administration virtqueue. + This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated. +\item[\field{admin_queue_num}] + The device uses this to report the number of the + supported administration virtqueues. Virtqueues with index + between \field{admin_queue_index} and (\field{admin_queue_index} + + \field{admin_queue_num}) inclusive serve as administration + virtqueues. + Thus the number of administration virtqueues equals + (\field{admin_queue_num} + 1). + This field is valid only if VIRTIO_F_ADMIN_VQ has been + negotiated. \end{description} \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}@@ -1117,6 +1134,14 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport were used before the queue reset. (see \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}). +If VIRTIO_F_ADMIN_VQ has been negotiated, and if the driver +configures any administration virtqueues, the driver MUST +configure the administration virtqueues using the index +in the range \field{admin_queue_index} to +\field{admin_queue_index} + \field{admin_queue_num} inclusive. +The driver MAY configure less administration virtqueues than +supported by the device. + \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability} The notification location is found using the VIRTIO_PCI_CAP_NOTIFY_CFG@@ -6992,6 +7017,15 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} \item[VIRTIO_F_ADMIN_VQ(41)] This feature indicates that the device exposes one or more administration virtqueues. + At the moment this feature is only supported for devices using + \ref{sec:Virtio Transport Options / Virtio Over PCI + Bus}~\nameref{sec:Virtio Transport Options / Virtio Over PCI Bus} + as the transport and is reserved for future use for + devices using other transports (see + \ref{drivernormative:Basic Facilities of a Virtio Device / Feature Bits} + and + \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for + handling features reserved for future use. \end{description} --MST
PATCH v9 6/10 mmio: document ADMIN_VQ as reserved
In reply to Michael S. TsirkinAdding relevant registers needs more work and it's not clear what the use-case will be as currently only the PCI transport is supported. But let's keep the door open on this.
We already say it's reserved in a central place, but it does not hurt to remind implementers to mask it.
--- content.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)
content.tex +12 -0
@@ -2362,6 +2362,18 @@ \subsection{Legacy interface}\label{sec:Virtio Transport Options / Virtio Over M Notification mechanisms did not change. +\subsection{Features reserved for future use}\label{sec:Virtio Transport Options / Virtio Over MMIO / Features reserved for future use} + +At this time, devices and drivers utilizing Virtio Over MMIO +do not support the following features: +\begin{itemize} + +\item VIRTIO_F_ADMIN_VQ + +\end{itemize} + +These features are reserved for future use. + \section{Virtio Over Channel I/O}\label{sec:Virtio Transport Options / Virtio Over Channel I/O} S/390 based virtual machines support neither PCI nor MMIO, so a
Signature · 1 line
MST
Re: [PATCH v9 06/10] mmio: document ADMIN_VQ as reserved
Quoted 18 lines · Michael S. Tsirkin
Adding relevant registers needs more work and it's not clear what the use-case will be as currently only the PCI transport is supported. But let's keep the door open on this.
We already say it's reserved in a central place, but it does not hurt to remind implementers to mask it.Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)content.tex +0
-0
content.tex \subsection{Legacy interface}\label{sec:Virtio Transport Options / Virtio Over M · line 2371
Quoted 10 lines
content.tex +7
-0@@ -2362,6 +2362,18 @@ \subsection{Legacy interface}\label{sec:Virtio Transport Options / Virtio Over M Notification mechanisms did not change. +\subsection{Features reserved for future use}\label{sec:Virtio Transport Options / Virtio Over MMIO / Features reserved for future use} + +At this time, devices and drivers utilizing Virtio Over MMIO +do not support the following features: +\begin{itemize} + +\item VIRTIO_F_ADMIN_VQ
Do we need to add VIRTIO_F_SR_IOV here? And probably SR-IOV group type?
Thanks
Quoted 11 lines
content.tex +5
-1+ +\end{itemize} + +These features are reserved for future use. + \section{Virtio Over Channel I/O}\label{sec:Virtio Transport Options / Virtio Over Channel I/O} S/390 based virtual machines support neither PCI nor MMIO, so a --MST
Re: [PATCH v9 06/10] mmio: document ADMIN_VQ as reserved
Quoted 32 lines · Jason Wang
Quoted 18 lines · Michael S. Tsirkin
Adding relevant registers needs more work and it's not clear what the use-case will be as currently only the PCI transport is supported. But let's keep the door open on this.
We already say it's reserved in a central place, but it does not hurt to remind implementers to mask it.Signed-off-by Michael S. Tsirkin <[email protected]>--- content.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)content.tex +0
-0content.tex \subsection{Legacy interface}\label{sec:Virtio Transport Options / Virtio Over M · line 2371
Quoted 10 lines
content.tex +7
-0@@ -2362,6 +2362,18 @@ \subsection{Legacy interface}\label{sec:Virtio Transport Options / Virtio Over M Notification mechanisms did not change. +\subsection{Features reserved for future use}\label{sec:Virtio Transport Options / Virtio Over MMIO / Features reserved for future use} + +At this time, devices and drivers utilizing Virtio Over MMIO +do not support the following features: +\begin{itemize} + +\item VIRTIO_F_ADMIN_VQDo we need to add
VIRTIO_F_SR_IOVhere? And probably SR-IOV group type?
Quoted 1 line
Thanks
yea we can add more as patches on top.
as all of VIRTIO_F_ADMIN_VQ is not there I don't think we need to call out SR-IOV group type separately.
Quoted 11 lines
Quoted 11 lines
content.tex +5
-1+ +\end{itemize} + +These features are reserved for future use. + \section{Virtio Over Channel I/O}\label{sec:Virtio Transport Options / Virtio Over Channel I/O} S/390 based virtual machines support neither PCI nor MMIO, so a --MST
PATCH v9 7/10 ccw: document ADMIN_VQ as reserved
In reply to Michael S. TsirkinAdding relevant registers needs more work and it's not clear what the use-case will be as currently only the PCI transport is supported. But let's keep the door open on this.
We already say it's reserved in a central place, but it does not hurt to remind implementers to mask it.
Note: there are more features to add to this list. Will be done later with a patch on top.
--- content.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)
content.tex +12 -0
@@ -2976,6 +2976,18 @@ \subsubsection{Resetting Devices}\label{sec:Virtio Transport Options / Virtio ov MAY also choose to verify reset completion by reading \field{device status} via CCW_CMD_READ_STATUS and checking whether it is 0 afterwards. +\subsection{Features reserved for future use}\label{sec:Virtio Transport Options / Virtio over channel I/O / Features reserved for future use} + +At this time, devices and drivers utilizing Virtio over channel I/O +do not support the following features: +\begin{itemize} + +\item VIRTIO_F_ADMIN_VQ + +\end{itemize} + +These features are reserved for future use. + \chapter{Device Types}\label{sec:Device Types} On top of the queues, config space and feature negotiation facilities
Signature · 1 line
MST
PATCH v9 8/10 admin: command list discovery
In reply to Michael S. TsirkinAdd commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.
An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.
--- admin.tex | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)
admin.tex +81 -1
@@ -91,7 +91,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline opcode & Name & Command Description \\ \hline \hline -0x0000 - 0x7FFF & - & Group administration commands \\ +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type \\ +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\ +0x0002 - 0x7FFF & - & Group administration commands \\ \hline 0x8000 - 0xFFFF & - & Reserved \\ \hline
@@ -142,6 +144,84 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline \end{tabular} +Before sending any administration commands to the device, the driver +needs to communicate to the device which commands it is going to +use. Initially (after reset), only two commands are assumed to be used: +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +Before sending any other commands for any member of a specific group to +the device, the driver queries the supported commands via +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via +VIRTIO_ADMIN_CMD_LIST_USE. + +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE +both use the following structure describing the +command opcodes: + +\begin{lstlisting} +struct virtio_admin_cmd_list { + /* Indicates which of the below fields were returned + le32 device_admin_cmds[]; +}; +\end{lstlisting} + +This structure is an array of 32 bit values in little-endian byte +order, in which a bit is set if the specific command opcode +is supported. Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value +in this array corresponding to opcodes 0 to 31, +\field{device_admin_cmds[1]} is the second 32-bit value +corresponding to opcodes 32 to 63, etc. +For example, the array of size 2 including +the values 0x3 in \field{device_admin_cmds[0]} +and 0x1 in \field{device_admin_cmds[1]} indicates that only opcodes 0, 1 and 32 +are supported. + +Accordingly, bits 0 and 1 corresponding to opcode 0 +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1 +(VIRTIO_ADMIN_CMD_LIST_USE) are +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY. + +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0. +The \field{group_member_id} is unused. It is set to zero by driver. +This command has no command specific data. +The device, upon success, returns a result in +\field{command_specific_result} in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands supported for the given group. + + +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode} +is set to 0x1. +The \field{group_member_id} is unused. It is set to zero by driver. +The \field{command_specific_data} is in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands used by the driver. +This command has no command specific result. + +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to +query the list of commands valid for this group and before sending +any commands for any member of a group. + +The driver then enables use of some of the opcodes by sending to +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is +both understood and used by the driver. + +If the device supports the command list used by the driver, the +device completes the command with status VIRTIO_ADMIN_STATUS_OK. +If the device does not support the command list, the device +completes the command with status +VIRTIO_ADMIN_STATUS_INVALID_FIELD. + +Note: drivers are assumed not to set bits in device_admin_cmds +if they are not familiar with how the command opcode +is used, since devices could have dependencies between +command opcodes. + +It is assumed that all members in a group support and are used +with the same list of commands. + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues} An administration virtqueue of an owner device is used to submit
Signature · 1 line
MST
Re: [PATCH v9 08/10] admin: command list discovery
Quoted 8 lines · Michael S. Tsirkin
Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.
This seems to complicate the migration (compatibility) of the adminq itself. We need check both features and command list.
More below.
Quoted 41 lines
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)admin.tex +18
-1@@ -91,7 +91,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline opcode & Name & Command Description \\ \hline \hline -0x0000 - 0x7FFF & - & Group administration commands \\ +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type \\ +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\ +0x0002 - 0x7FFF & - & Group administration commands \\ \hline 0x8000 - 0xFFFF & - & Reserved \\ \hline@@ -142,6 +144,84 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline \end{tabular} +Before sending any administration commands to the device, the driver +needs to communicate to the device which commands it is going to +use. Initially (after reset), only two commands are assumed to be used: +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +Before sending any other commands for any member of a specific group to +the device, the driver queries the supported commands via +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via +VIRTIO_ADMIN_CMD_LIST_USE. + +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE +both use the following structure describing the +command opcodes: +
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 171
Quoted 10 lines
admin.tex +10
-0+\begin{lstlisting} +struct virtio_admin_cmd_list { + /* Indicates which of the below fields were returned + le32 device_admin_cmds[]; +}; +\end{lstlisting} + +This structure is an array of 32 bit values in little-endian byte +order, in which a bit is set if the specific command opcode +is supported.
Is this simpler if we map group type instead of a single opcode? E.g virtqueue transport will introduce 10+ commands, using a bit for a specific opcode will complicate things.
Quoted 29 lines
admin.tex +29
-0+Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value +in this array corresponding to opcodes 0 to 31, +\field{device_admin_cmds[1]} is the second 32-bit value +corresponding to opcodes 32 to 63, etc. +For example, the array of size 2 including +the values 0x3 in \field{device_admin_cmds[0]} +and 0x1 in \field{device_admin_cmds[1]} indicates that only opcodes 0, 1 and 32 +are supported. + +Accordingly, bits 0 and 1 corresponding to opcode 0 +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1 +(VIRTIO_ADMIN_CMD_LIST_USE) are +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY. + +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0. +The \field{group_member_id} is unused. It is set to zero by driver. +This command has no command specific data. +The device, upon success, returns a result in +\field{command_specific_result} in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands supported for the given group. + + +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode} +is set to 0x1. +The \field{group_member_id} is unused. It is set to zero by driver. +The \field{command_specific_data} is in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands used by the driver.
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 209
Quoted 10 lines
admin.tex +10
-0+This command has no command specific result. + +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to +query the list of commands valid for this group and before sending +any commands for any member of a group. + +The driver then enables use of some of the opcodes by sending to +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is +both understood and used by the driver.
Any reason we need to invent a negotiation process here? (This seems only useful when some commands/opcodes are mutually exclusive)
Thanks
Quoted 21 lines
admin.tex +15
-1+ +If the device supports the command list used by the driver, the +device completes the command with status VIRTIO_ADMIN_STATUS_OK. +If the device does not support the command list, the device +completes the command with status +VIRTIO_ADMIN_STATUS_INVALID_FIELD. + +Note: drivers are assumed not to set bits in device_admin_cmds +if they are not familiar with how the command opcode +is used, since devices could have dependencies between +command opcodes. + +It is assumed that all members in a group support and are used +with the same list of commands. + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues} An administration virtqueue of an owner device is used to submit --MST
Re: [PATCH v9 08/10] admin: command list discovery
Quoted 6 lines · Jason Wang
Quoted 5 lines · Michael S. Tsirkin
Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.
Quoted 6 lines
Quoted 3 lines
An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.
This seems to complicate the migration (compatibility) of the adminq itself. We need check both features and command list.
Yes. There's no way around this though - commands need to be per group and a pci device can host at least both SIOV and SRIOV children.
Quoted 49 lines
More below.
Quoted 47 lines
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)admin.tex +24
-1@@ -91,7 +91,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline opcode & Name & Command Description \\ \hline \hline -0x0000 - 0x7FFF & - & Group administration commands \\ +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type \\ +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\ +0x0002 - 0x7FFF & - & Group administration commands \\ \hline 0x8000 - 0xFFFF & - & Reserved \\ \hline@@ -142,6 +144,84 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline \end{tabular} +Before sending any administration commands to the device, the driver +needs to communicate to the device which commands it is going to +use. Initially (after reset), only two commands are assumed to be used: +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +Before sending any other commands for any member of a specific group to +the device, the driver queries the supported commands via +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via +VIRTIO_ADMIN_CMD_LIST_USE. + +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE +both use the following structure describing the +command opcodes: + +\begin{lstlisting} +struct virtio_admin_cmd_list { + /* Indicates which of the below fields were returned + le32 device_admin_cmds[]; +}; +\end{lstlisting}
Quoted 8 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
Quoted 4 lines
admin.tex +4
-0+ +This structure is an array of 32 bit values in little-endian byte +order, in which a bit is set if the specific command opcode +is supported.Is this simpler if we map group type instead of a single opcode? E.g virtqueue transport will introduce 10+ commands, using a bit for a specific opcode will complicate things.
I think more flexibility is better, and bits are cheap.
Quoted 43 lines
Quoted 29 lines
admin.tex +29
-0+Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value +in this array corresponding to opcodes 0 to 31, +\field{device_admin_cmds[1]} is the second 32-bit value +corresponding to opcodes 32 to 63, etc. +For example, the array of size 2 including +the values 0x3 in \field{device_admin_cmds[0]} +and 0x1 in \field{device_admin_cmds[1]} indicates that only opcodes 0, 1 and 32 +are supported. + +Accordingly, bits 0 and 1 corresponding to opcode 0 +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1 +(VIRTIO_ADMIN_CMD_LIST_USE) are +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY. + +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0. +The \field{group_member_id} is unused. It is set to zero by driver. +This command has no command specific data. +The device, upon success, returns a result in +\field{command_specific_result} in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands supported for the given group. + + +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode} +is set to 0x1. +The \field{group_member_id} is unused. It is set to zero by driver. +The \field{command_specific_data} is in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands used by the driver.admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 209
Quoted 10 lines
admin.tex +10
-0+This command has no command specific result. + +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to +query the list of commands valid for this group and before sending +any commands for any member of a group. + +The driver then enables use of some of the opcodes by sending to +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is +both understood and used by the driver.Any reason we need to invent a negotiation process here? (This seems only useful when some commands/opcodes are mutually exclusive)
Quoted 1 line
Thanks
yes, features don't help because they are per owner. this is per group.
imagine vq transport. SET_FEATURES commands sets the features for the child. we need something to negotiate with owner but still within the vq.
Quoted 21 lines
Quoted 21 lines
admin.tex +15
-1+ +If the device supports the command list used by the driver, the +device completes the command with status VIRTIO_ADMIN_STATUS_OK. +If the device does not support the command list, the device +completes the command with status +VIRTIO_ADMIN_STATUS_INVALID_FIELD. + +Note: drivers are assumed not to set bits in device_admin_cmds +if they are not familiar with how the command opcode +is used, since devices could have dependencies between +command opcodes. + +It is assumed that all members in a group support and are used +with the same list of commands. + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues} An administration virtqueue of an owner device is used to submit --MST
Re: [virtio-comment] Re: [PATCH v9 08/10] admin: command list discovery
Quoted 71 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 7 lines · Michael S. Tsirkin
Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.
This seems to complicate the migration (compatibility) of the adminq itself. We need check both features and command list.
Yes. There's no way around this though - commands need to be per group and a pci device can host at least both SIOV and SRIOV children.
Quoted 47 lines
More below.
Quoted 45 lines
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)admin.tex +23
-1@@ -91,7 +91,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline opcode & Name & Command Description \\ \hline \hline -0x0000 - 0x7FFF & - & Group administration commands \\ +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type \\ +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\ +0x0002 - 0x7FFF & - & Group administration commands \\ \hline 0x8000 - 0xFFFF & - & Reserved \\ \hline@@ -142,6 +144,84 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline \end{tabular} +Before sending any administration commands to the device, the driver +needs to communicate to the device which commands it is going to +use. Initially (after reset), only two commands are assumed to be used: +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +Before sending any other commands for any member of a specific group to +the device, the driver queries the supported commands via +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via +VIRTIO_ADMIN_CMD_LIST_USE. + +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE +both use the following structure describing the +command opcodes: + +\begin{lstlisting} +struct virtio_admin_cmd_list { + /* Indicates which of the below fields were returned + le32 device_admin_cmds[]; +};Quoted 8 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
Quoted 5 lines
admin.tex +5
-0+\end{lstlisting} + +This structure is an array of 32 bit values in little-endian byte +order, in which a bit is set if the specific command opcode +is supported.Is this simpler if we map group type instead of a single opcode? E.g virtqueue transport will introduce 10+ commands, using a bit for a specific opcode will complicate things.
Quoted 1 line
I think more flexibility is better, and bits are cheap.
So we may end up with something like:
If VIRTIO_F_TRANSPORT_VQ is supported, device MUST return the following opcodes via VIRTIO_ADMIN_CMD_LIST_QUERY
[opX, opY, ....]
Probably fine.
Quoted 44 lines
Quoted 44 lines
Quoted 31 lines
admin.tex +29
-0+Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value +in this array corresponding to opcodes 0 to 31, +\field{device_admin_cmds[1]} is the second 32-bit value +corresponding to opcodes 32 to 63, etc. +For example, the array of size 2 including +the values 0x3 in \field{device_admin_cmds[0]} +and 0x1 in \field{device_admin_cmds[1]} indicates that only opcodes 0, 1 and 32 +are supported. + +Accordingly, bits 0 and 1 corresponding to opcode 0 +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1 +(VIRTIO_ADMIN_CMD_LIST_USE) are +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY. + +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0. +The \field{group_member_id} is unused. It is set to zero by driver. +This command has no command specific data. +The device, upon success, returns a result in +\field{command_specific_result} in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands supported for the given group. + + +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode} +is set to 0x1. +The \field{group_member_id} is unused. It is set to zero by driver. +The \field{command_specific_data} is in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands used by the driver.admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 209
Quoted 10 lines
admin.tex +10
-0+This command has no command specific result. + +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to +query the list of commands valid for this group and before sending +any commands for any member of a group. + +The driver then enables use of some of the opcodes by sending to +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is +both understood and used by the driver.Any reason we need to invent a negotiation process here? (This seems only useful when some commands/opcodes are mutually exclusive)
Quoted 7 lines
Quoted 1 line
Thanks
yes, features don't help because they are per owner. this is per group.
imagine vq transport.
SET_FEATUREScommands sets the features for the child. we need something to negotiate with owner but still within the vq.
Should we document what happens if driver use a opcode that it doesn't negotiate? (It looks to me we don't document this for at leave virtio-net control virtqueue).
Thanks
Quoted 40 lines
Quoted 19 lines
Quoted 19 lines
admin.tex +15
-0+ +If the device supports the command list used by the driver, the +device completes the command with status VIRTIO_ADMIN_STATUS_OK. +If the device does not support the command list, the device +completes the command with status +VIRTIO_ADMIN_STATUS_INVALID_FIELD. + +Note: drivers are assumed not to set bits in device_admin_cmds +if they are not familiar with how the command opcode +is used, since devices could have dependencies between +command opcodes. + +It is assumed that all members in a group support and are used +with the same list of commands. + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 4 lines
Quoted 4 lines
An administration virtqueue of an owner device is used to submit
--
MSTThis publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Re: [virtio-comment] Re: [PATCH v9 08/10] admin: command list discovery
Quoted 76 lines · Jason Wang
Quoted 71 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 7 lines · Michael S. Tsirkin
Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.
This seems to complicate the migration (compatibility) of the adminq itself. We need check both features and command list.
Yes. There's no way around this though - commands need to be per group and a pci device can host at least both SIOV and SRIOV children.
Quoted 47 lines
More below.
Quoted 45 lines
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)admin.tex +23
-1@@ -91,7 +91,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline opcode & Name & Command Description \\ \hline \hline -0x0000 - 0x7FFF & - & Group administration commands \\ +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type \\ +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\ +0x0002 - 0x7FFF & - & Group administration commands \\ \hline 0x8000 - 0xFFFF & - & Reserved \\ \hline@@ -142,6 +144,84 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline \end{tabular} +Before sending any administration commands to the device, the driver +needs to communicate to the device which commands it is going to +use. Initially (after reset), only two commands are assumed to be used: +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +Before sending any other commands for any member of a specific group to +the device, the driver queries the supported commands via +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via +VIRTIO_ADMIN_CMD_LIST_USE. + +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE +both use the following structure describing the +command opcodes: + +\begin{lstlisting} +struct virtio_admin_cmd_list { + /* Indicates which of the below fields were returned + le32 device_admin_cmds[]; +};Quoted 8 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
Quoted 5 lines
admin.tex +5
-0+\end{lstlisting} + +This structure is an array of 32 bit values in little-endian byte +order, in which a bit is set if the specific command opcode +is supported.Is this simpler if we map group type instead of a single opcode? E.g virtqueue transport will introduce 10+ commands, using a bit for a specific opcode will complicate things.
Quoted 1 line
I think more flexibility is better, and bits are cheap.
Quoted 9 lines
So we may end up with something like:
If
VIRTIO_F_TRANSPORT_VQis supported, device MUST return the following opcodes viaVIRTIO_ADMIN_CMD_LIST_QUERY[opX, opY, ....]
Probably fine.
I think I would tie the commands to a group type.
Quoted 54 lines
Quoted 45 lines
Quoted 45 lines
Quoted 32 lines
admin.tex +29
-0+Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value +in this array corresponding to opcodes 0 to 31, +\field{device_admin_cmds[1]} is the second 32-bit value +corresponding to opcodes 32 to 63, etc. +For example, the array of size 2 including +the values 0x3 in \field{device_admin_cmds[0]} +and 0x1 in \field{device_admin_cmds[1]} indicates that only opcodes 0, 1 and 32 +are supported. + +Accordingly, bits 0 and 1 corresponding to opcode 0 +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1 +(VIRTIO_ADMIN_CMD_LIST_USE) are +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY. + +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0. +The \field{group_member_id} is unused. It is set to zero by driver. +This command has no command specific data. +The device, upon success, returns a result in +\field{command_specific_result} in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands supported for the given group. + + +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode} +is set to 0x1. +The \field{group_member_id} is unused. It is set to zero by driver. +The \field{command_specific_data} is in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands used by the driver.admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 209
Quoted 10 lines
admin.tex +10
-0+This command has no command specific result. + +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to +query the list of commands valid for this group and before sending +any commands for any member of a group. + +The driver then enables use of some of the opcodes by sending to +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is +both understood and used by the driver.Any reason we need to invent a negotiation process here? (This seems only useful when some commands/opcodes are mutually exclusive)
Quoted 7 lines
Quoted 1 line
Thanks
yes, features don't help because they are per owner. this is per group.
imagine vq transport.
SET_FEATUREScommands sets the features for the child. we need something to negotiate with owner but still within the vq.
Quoted 6 lines
Should we document what happens if driver use a opcode that it doesn't negotiate? (It looks to me we don't document this for at leave virtio-net control virtqueue).
Thanks
documented in the conformance section.
Quoted 40 lines
Quoted 40 lines
Quoted 19 lines
Quoted 19 lines
admin.tex +15
-0+ +If the device supports the command list used by the driver, the +device completes the command with status VIRTIO_ADMIN_STATUS_OK. +If the device does not support the command list, the device +completes the command with status +VIRTIO_ADMIN_STATUS_INVALID_FIELD. + +Note: drivers are assumed not to set bits in device_admin_cmds +if they are not familiar with how the command opcode +is used, since devices could have dependencies between +command opcodes. + +It is assumed that all members in a group support and are used +with the same list of commands. + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 4 lines
Quoted 4 lines
An administration virtqueue of an owner device is used to submit
--
MSTThis publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Re: [virtio-comment] Re: [PATCH v9 08/10] admin: command list discovery
Quoted 77 lines · Michael S. Tsirkin
Quoted 76 lines · Jason Wang
Quoted 71 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 7 lines · Michael S. Tsirkin
Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.
This seems to complicate the migration (compatibility) of the adminq itself. We need check both features and command list.
Yes. There's no way around this though - commands need to be per group and a pci device can host at least both SIOV and SRIOV children.
Quoted 47 lines
More below.
Quoted 45 lines
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)admin.tex +23
-1@@ -91,7 +91,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline opcode & Name & Command Description \\ \hline \hline -0x0000 - 0x7FFF & - & Group administration commands \\ +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type \\ +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\ +0x0002 - 0x7FFF & - & Group administration commands \\ \hline 0x8000 - 0xFFFF & - & Reserved \\ \hline@@ -142,6 +144,84 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline \end{tabular} +Before sending any administration commands to the device, the driver +needs to communicate to the device which commands it is going to +use. Initially (after reset), only two commands are assumed to be used: +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +Before sending any other commands for any member of a specific group to +the device, the driver queries the supported commands via +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via +VIRTIO_ADMIN_CMD_LIST_USE. + +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE +both use the following structure describing the +command opcodes: + +\begin{lstlisting} +struct virtio_admin_cmd_list { + /* Indicates which of the below fields were returned + le32 device_admin_cmds[]; +};Quoted 8 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
Quoted 5 lines
admin.tex +5
-0+\end{lstlisting} + +This structure is an array of 32 bit values in little-endian byte +order, in which a bit is set if the specific command opcode +is supported.Is this simpler if we map group type instead of a single opcode? E.g virtqueue transport will introduce 10+ commands, using a bit for a specific opcode will complicate things.
Quoted 1 line
I think more flexibility is better, and bits are cheap.
So we may end up with something like:
Quoted 8 lines
Quoted 7 lines
If
VIRTIO_F_TRANSPORT_VQis supported, device MUST return the following opcodes viaVIRTIO_ADMIN_CMD_LIST_QUERY[opX, opY, ....]
Probably fine.
I think I would tie the commands to a group type.
Right, that's what I understood, but it looks to me it can't be achieved via LIST_QUERY now (which is based on opcodes).
Thanks
Quoted 99 lines
Quoted 52 lines
Quoted 44 lines
Quoted 44 lines
Quoted 31 lines
admin.tex +29
-0+Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value +in this array corresponding to opcodes 0 to 31, +\field{device_admin_cmds[1]} is the second 32-bit value +corresponding to opcodes 32 to 63, etc. +For example, the array of size 2 including +the values 0x3 in \field{device_admin_cmds[0]} +and 0x1 in \field{device_admin_cmds[1]} indicates that only opcodes 0, 1 and 32 +are supported. + +Accordingly, bits 0 and 1 corresponding to opcode 0 +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1 +(VIRTIO_ADMIN_CMD_LIST_USE) are +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY. + +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0. +The \field{group_member_id} is unused. It is set to zero by driver. +This command has no command specific data. +The device, upon success, returns a result in +\field{command_specific_result} in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands supported for the given group. + + +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode} +is set to 0x1. +The \field{group_member_id} is unused. It is set to zero by driver. +The \field{command_specific_data} is in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands used by the driver.admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 209
Quoted 10 lines
admin.tex +10
-0+This command has no command specific result. + +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to +query the list of commands valid for this group and before sending +any commands for any member of a group. + +The driver then enables use of some of the opcodes by sending to +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is +both understood and used by the driver.Any reason we need to invent a negotiation process here? (This seems only useful when some commands/opcodes are mutually exclusive)
Quoted 7 lines
Quoted 1 line
Thanks
yes, features don't help because they are per owner. this is per group.
imagine vq transport.
SET_FEATUREScommands sets the features for the child. we need something to negotiate with owner but still within the vq.Quoted 6 lines
Should we document what happens if driver use a opcode that it doesn't negotiate? (It looks to me we don't document this for at leave virtio-net control virtqueue).
Thanks
documented in the conformance section.
Quoted 38 lines
Quoted 38 lines
Quoted 18 lines
Quoted 18 lines
admin.tex +15
-0+ +If the device supports the command list used by the driver, the +device completes the command with status VIRTIO_ADMIN_STATUS_OK. +If the device does not support the command list, the device +completes the command with status +VIRTIO_ADMIN_STATUS_INVALID_FIELD. + +Note: drivers are assumed not to set bits in device_admin_cmds +if they are not familiar with how the command opcode +is used, since devices could have dependencies between +command opcodes. + +It is assumed that all members in a group support and are used +with the same list of commands. + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 4 lines
Quoted 4 lines
An administration virtqueue of an owner device is used to submit
--
MSTThis publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Re: [virtio-comment] Re: [PATCH v9 08/10] admin: command list discovery
Quoted 86 lines · Jason Wang
Quoted 84 lines · Michael S. Tsirkin
Quoted 83 lines · Jason Wang
Quoted 71 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 7 lines · Michael S. Tsirkin
Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.
This seems to complicate the migration (compatibility) of the adminq itself. We need check both features and command list.
Yes. There's no way around this though - commands need to be per group and a pci device can host at least both SIOV and SRIOV children.
Quoted 47 lines
More below.
Quoted 45 lines
Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)admin.tex +23
-1@@ -91,7 +91,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline opcode & Name & Command Description \\ \hline \hline -0x0000 - 0x7FFF & - & Group administration commands \\ +0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type \\ +0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\ +0x0002 - 0x7FFF & - & Group administration commands \\ \hline 0x8000 - 0xFFFF & - & Reserved \\ \hline@@ -142,6 +144,84 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline \end{tabular} +Before sending any administration commands to the device, the driver +needs to communicate to the device which commands it is going to +use. Initially (after reset), only two commands are assumed to be used: +VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +Before sending any other commands for any member of a specific group to +the device, the driver queries the supported commands via +VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via +VIRTIO_ADMIN_CMD_LIST_USE. + +Commands VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE +both use the following structure describing the +command opcodes: + +\begin{lstlisting} +struct virtio_admin_cmd_list { + /* Indicates which of the below fields were returned + le32 device_admin_cmds[]; +};Quoted 8 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
Quoted 5 lines
admin.tex +5
-0+\end{lstlisting} + +This structure is an array of 32 bit values in little-endian byte +order, in which a bit is set if the specific command opcode +is supported.Is this simpler if we map group type instead of a single opcode? E.g virtqueue transport will introduce 10+ commands, using a bit for a specific opcode will complicate things.
Quoted 1 line
I think more flexibility is better, and bits are cheap.
So we may end up with something like:
If
VIRTIO_F_TRANSPORT_VQis supported, device MUST return the following opcodes viaVIRTIO_ADMIN_CMD_LIST_QUERY[opX, opY, ....]
Probably fine.
Quoted 8 lines
Quoted 1 line
I think I would tie the commands to a group type.
Right, that's what I understood, but it looks to me it can't be achieved via
LIST_QUERYnow (which is based on opcodes).Thanks
My idea was that if a given group type is not supported by the owner then VIRTIO_ADMIN_CMD_LIST_QUERY fails with invalid group type status qualifier.
Quoted 99 lines
Quoted 99 lines
Quoted 52 lines
Quoted 44 lines
Quoted 44 lines
Quoted 31 lines
admin.tex +29
-0+Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value +in this array corresponding to opcodes 0 to 31, +\field{device_admin_cmds[1]} is the second 32-bit value +corresponding to opcodes 32 to 63, etc. +For example, the array of size 2 including +the values 0x3 in \field{device_admin_cmds[0]} +and 0x1 in \field{device_admin_cmds[1]} indicates that only opcodes 0, 1 and 32 +are supported. + +Accordingly, bits 0 and 1 corresponding to opcode 0 +(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1 +(VIRTIO_ADMIN_CMD_LIST_USE) are +always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY. + +For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0. +The \field{group_member_id} is unused. It is set to zero by driver. +This command has no command specific data. +The device, upon success, returns a result in +\field{command_specific_result} in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands supported for the given group. + + +For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode} +is set to 0x1. +The \field{group_member_id} is unused. It is set to zero by driver. +The \field{command_specific_data} is in the format +\field{struct virtio_admin_cmd_list} describing the +list of administration commands used by the driver.admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 209
Quoted 10 lines
admin.tex +10
-0+This command has no command specific result. + +The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to +query the list of commands valid for this group and before sending +any commands for any member of a group. + +The driver then enables use of some of the opcodes by sending to +the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset +of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is +both understood and used by the driver.Any reason we need to invent a negotiation process here? (This seems only useful when some commands/opcodes are mutually exclusive)
Quoted 7 lines
Quoted 1 line
Thanks
yes, features don't help because they are per owner. this is per group.
imagine vq transport.
SET_FEATUREScommands sets the features for the child. we need something to negotiate with owner but still within the vq.Quoted 6 lines
Should we document what happens if driver use a opcode that it doesn't negotiate? (It looks to me we don't document this for at leave virtio-net control virtqueue).
Thanks
documented in the conformance section.
Quoted 38 lines
Quoted 38 lines
Quoted 18 lines
Quoted 18 lines
admin.tex +15
-0+ +If the device supports the command list used by the driver, the +device completes the command with status VIRTIO_ADMIN_STATUS_OK. +If the device does not support the command list, the device +completes the command with status +VIRTIO_ADMIN_STATUS_INVALID_FIELD. + +Note: drivers are assumed not to set bits in device_admin_cmds +if they are not familiar with how the command opcode +is used, since devices could have dependencies between +command opcodes. + +It is assumed that all members in a group support and are used +with the same list of commands. + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 4 lines
Quoted 4 lines
An administration virtqueue of an owner device is used to submit
--
MSTThis publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
PATCH v9 9/10 admin: conformance clauses
In reply to Michael S. TsirkinAdd conformance clauses for admin commands and admin virtqueues.
--- admin.tex | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)
admin.tex +158 -0
@@ -222,6 +222,107 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti It is assumed that all members in a group support and are used with the same list of commands. +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The device MUST validate \field{opcode}, \field{group_type} and +\field{group_member_id}, set \field{status} to VIRTIO_ADMIN_STATUS_EINVAL and +nd if any of these has an invalid or unsupported value, set +\field{status_qualifier} accordingly. + +If a command completes successfully, the device MUST set +\field{status} to VIRTIO_ADMIN_STATUS_OK. + +If a command fails, the device MUST set +\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK. + +If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the +device state MUST NOT change, that is the command MUST NOT have +any side effects on the device, in particular the device MUST not +enter an error state as a result of this command. + +If a command fails, the device state generally SHOULD NOT change, +as far as possible. + +The device MAY enforce additional restrictions and dependencies on +opcodes used by the driver and MAY fail the command +VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD +if the list of commands used violate internal device dependencies. + +If the device supports multiple group types, commands for each group +type MUST operate independently of each other, in particular, +the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY +for different group types. + +After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +After completing VIRTIO_ADMIN_CMD_LIST_USE successfully, +the device MUST set the list of legal commands used by the driver +to the one supplied in \field{command_specific_data}. + +The device MUST set the list of legal commands used by the driver +to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE. + +The device MUST validate commands against the list used by +the driver and MUST fail any commands not in the list with +\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE. + +The list of supported commands MUST NOT shrink (but MAY expand): +after reporting a given command as supported through +VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it +as unsupported. Further, after a given set of commands has been +used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a +device or system reset the device SHOULD complete successfully +any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same +list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails +after a device or system reset, the device MUST not fail it +solely because of the command list used. Failure to do so would +interfere with resuming from suspend and error recovery. + + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The driver MAY discover whether device supports a specific group type +by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching +\field{group_type}. + +The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE +and wait for it to be completed with status +VIRTIO_ADMIN_STATUS_OK before issuing any commands +(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY +and VIRTIO_ADMIN_CMD_LIST_USE). + +The driver SHOULD NOT set bits in device_admin_cmds +if it is not familiar with how the command opcode +is used, as dependencies between command opcodes might exist. + +The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE) +the use of any commands not previously reported as +supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY. + +The driver MUST NOT use any commands for a given group type +before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct +list of command opcodes and group type. + +The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE +with respective bits cleared in \field{command_specific_data}. + +The driver MUST handle a command error with a reserved \field{status} +value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +(except possibly for different error reporting/diagnostic messages). + +The driver MUST handle a command error with a reserved +\field{status_qualifier} value in the same way as +\field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for +different error reporting/diagnostic messages). + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues} An administration virtqueue of an owner device is used to submit
@@ -275,3 +376,60 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic new fields can be added to the tail of a structure, with the driver using the full structure without concern for versioning. + +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, and +\item discarding data that would be written outside the +specified device-writeable buffers. +\end{enumerate} + +The device MUST support device-readable and device-writeable buffers +longer than described in this specification, by +\begin{enumerate} +\item ignoring any data in device-readable buffers outside +the expected length, and +\item only writing the expected structure to the device-writeable +buffers, ignoring any extra buffers, and reporting the +actual length of data written, in bytes, +as buffer used length. +\end{enumerate} + +The device SHOULD initialize the device-writeable buffer +up to the length of the structure described by this specification or +the length of the buffer supplied by the driver (even if the buffer is +all set to zero), whichever is shorter. + +The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification. + +The device MUST process commands on a given administration virtqueue +in the order in which they are queued. + +If multiple administration virtqueues have been configured, +device MAY process commands on distinct virtqueues with +no order constraints. + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The driver MAY supply device-readable and device-writeable buffers +longer than described in this specification. + +The driver SHOULD supply device-readable buffers at least as +large as the structure described by this specification +(even if the buffer is all set to zero). + +The driver MUST NOT assume that the device will initialize the whole +structure as described in the specification; instead, +the driver MUST assume that the structure +outside the part of the buffer used by the device +is set to zero. + +If multiple administration virtqueues have been configured, +the driver MUST ensure ordering for commands +placed on different administration virtqueues.
Signature · 1 line
MST
Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 13 lines · Michael S. Tsirkin
Add conformance clauses for admin commands and admin virtqueues.
Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)admin.tex +0
-0
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 229
Quoted 8 lines
admin.tex +5
-0@@ -222,6 +222,107 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti It is assumed that all members in a group support and are used with the same list of commands. +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The device MUST validate \field{opcode}, \field{group_type} and +\field{group_member_id}, set \field{status} to VIRTIO_ADMIN_STATUS_EINVAL and +nd if any of these has an invalid or unsupported value, set
typo
Quoted 101 lines
admin.tex +96
-0+\field{status_qualifier} accordingly. + +If a command completes successfully, the device MUST set +\field{status} to VIRTIO_ADMIN_STATUS_OK. + +If a command fails, the device MUST set +\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK. + +If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the +device state MUST NOT change, that is the command MUST NOT have +any side effects on the device, in particular the device MUST not +enter an error state as a result of this command. + +If a command fails, the device state generally SHOULD NOT change, +as far as possible. + +The device MAY enforce additional restrictions and dependencies on +opcodes used by the driver and MAY fail the command +VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD +if the list of commands used violate internal device dependencies. + +If the device supports multiple group types, commands for each group +type MUST operate independently of each other, in particular, +the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY +for different group types. + +After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +After completing VIRTIO_ADMIN_CMD_LIST_USE successfully, +the device MUST set the list of legal commands used by the driver +to the one supplied in \field{command_specific_data}. + +The device MUST set the list of legal commands used by the driver +to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE. + +The device MUST validate commands against the list used by +the driver and MUST fail any commands not in the list with +\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE. + +The list of supported commands MUST NOT shrink (but MAY expand): +after reporting a given command as supported through +VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it +as unsupported. Further, after a given set of commands has been +used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a +device or system reset the device SHOULD complete successfully +any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same +list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails +after a device or system reset, the device MUST not fail it +solely because of the command list used. Failure to do so would +interfere with resuming from suspend and error recovery. + + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The driver MAY discover whether device supports a specific group type +by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching +\field{group_type}. + +The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE +and wait for it to be completed with status +VIRTIO_ADMIN_STATUS_OK before issuing any commands +(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY +and VIRTIO_ADMIN_CMD_LIST_USE). + +The driver SHOULD NOT set bits in device_admin_cmds +if it is not familiar with how the command opcode +is used, as dependencies between command opcodes might exist. + +The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE) +the use of any commands not previously reported as +supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY. + +The driver MUST NOT use any commands for a given group type +before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct +list of command opcodes and group type. + +The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE +with respective bits cleared in \field{command_specific_data}. + +The driver MUST handle a command error with a reserved \field{status} +value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +(except possibly for different error reporting/diagnostic messages). + +The driver MUST handle a command error with a reserved +\field{status_qualifier} value in the same way as +\field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for +different error reporting/diagnostic messages). + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues} An administration virtqueue of an owner device is used to submit@@ -275,3 +376,60 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic new fields can be added to the tail of a structure,
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 10 lines
admin.tex +8
-0with the driver using the full structure without concern for versioning. + +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, and
s/"is set"/"are set"
Quoted 13 lines
admin.tex +13
-0+\item discarding data that would be written outside the +specified device-writeable buffers. +\end{enumerate} + +The device MUST support device-readable and device-writeable buffers +longer than described in this specification, by +\begin{enumerate} +\item ignoring any data in device-readable buffers outside +the expected length, and +\item only writing the expected structure to the device-writeable +buffers, ignoring any extra buffers, and reporting the +actual length of data written, in bytes, +as buffer used length.
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 10 lines
admin.tex +10
-0+\end{enumerate} + +The device SHOULD initialize the device-writeable buffer +up to the length of the structure described by this specification or +the length of the buffer supplied by the driver (even if the buffer is +all set to zero), whichever is shorter. + +The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.
I may miss something but how can it work if the buffer is shorter?
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 412
Quoted 3 lines
admin.tex +3
-0+ +The device MUST process commands on a given administration virtqueue +in the order in which they are queued.
Is it better to use "complete" than "process" here? Or we can reuse part of the in-order description.
(Or maybe a flush command)
Quoted 9 lines
admin.tex +9
-0+ +If multiple administration virtqueues have been configured, +device MAY process commands on distinct virtqueues with +no order constraints. + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The driver MAY supply device-readable and device-writeable buffers +longer than described in this specification.
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 431
Quoted 10 lines
admin.tex +10
-0+ +The driver SHOULD supply device-readable buffers at least as +large as the structure described by this specification +(even if the buffer is all set to zero). + +The driver MUST NOT assume that the device will initialize the whole +structure as described in the specification; instead, +the driver MUST assume that the structure +outside the part of the buffer used by the device +is set to zero.
Won't this have security implications? E.g information leak.
Thanks
Quoted 7 lines
admin.tex +4
-1+ +If multiple administration virtqueues have been configured, +the driver MUST ensure ordering for commands +placed on different administration virtqueues. --MST
Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 17 lines · Jason Wang
Quoted 16 lines · Michael S. Tsirkin
Add conformance clauses for admin commands and admin virtqueues.
Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)admin.tex +0
-0@@ -222,6 +222,107 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti It is assumed that all members in a group support and are used with the same list of commands.
Quoted 7 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 229
Quoted 5 lines
admin.tex +5
-0+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The device MUST validate \field{opcode}, \field{group_type} and +\field{group_member_id}, set \field{status} to VIRTIO_ADMIN_STATUS_EINVAL and +nd if any of these has an invalid or unsupported value, settypo
thanks!
Quoted 98 lines
Quoted 98 lines
admin.tex +96
-0+\field{status_qualifier} accordingly. + +If a command completes successfully, the device MUST set +\field{status} to VIRTIO_ADMIN_STATUS_OK. + +If a command fails, the device MUST set +\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK. + +If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the +device state MUST NOT change, that is the command MUST NOT have +any side effects on the device, in particular the device MUST not +enter an error state as a result of this command. + +If a command fails, the device state generally SHOULD NOT change, +as far as possible. + +The device MAY enforce additional restrictions and dependencies on +opcodes used by the driver and MAY fail the command +VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD +if the list of commands used violate internal device dependencies. + +If the device supports multiple group types, commands for each group +type MUST operate independently of each other, in particular, +the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY +for different group types. + +After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +After completing VIRTIO_ADMIN_CMD_LIST_USE successfully, +the device MUST set the list of legal commands used by the driver +to the one supplied in \field{command_specific_data}. + +The device MUST set the list of legal commands used by the driver +to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE. + +The device MUST validate commands against the list used by +the driver and MUST fail any commands not in the list with +\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE. + +The list of supported commands MUST NOT shrink (but MAY expand): +after reporting a given command as supported through +VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it +as unsupported. Further, after a given set of commands has been +used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a +device or system reset the device SHOULD complete successfully +any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same +list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails +after a device or system reset, the device MUST not fail it +solely because of the command list used. Failure to do so would +interfere with resuming from suspend and error recovery. + + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The driver MAY discover whether device supports a specific group type +by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching +\field{group_type}. + +The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE +and wait for it to be completed with status +VIRTIO_ADMIN_STATUS_OK before issuing any commands +(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY +and VIRTIO_ADMIN_CMD_LIST_USE). + +The driver SHOULD NOT set bits in device_admin_cmds +if it is not familiar with how the command opcode +is used, as dependencies between command opcodes might exist. + +The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE) +the use of any commands not previously reported as +supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY. + +The driver MUST NOT use any commands for a given group type +before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct +list of command opcodes and group type. + +The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE +with respective bits cleared in \field{command_specific_data}. + +The driver MUST handle a command error with a reserved \field{status} +value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +(except possibly for different error reporting/diagnostic messages). + +The driver MUST handle a command error with a reserved +\field{status_qualifier} value in the same way as +\field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for +different error reporting/diagnostic messages). + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}
Quoted 15 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 13 lines
admin.tex +8
-0An administration virtqueue of an owner device is used to submit@@ -275,3 +376,60 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic new fields can be added to the tail of a structure, with the driver using the full structure without concern for versioning. + +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, ands/"is set"/"are set"
thanks
Quoted 17 lines
Quoted 17 lines
admin.tex +17
-0+\item discarding data that would be written outside the +specified device-writeable buffers. +\end{enumerate} + +The device MUST support device-readable and device-writeable buffers +longer than described in this specification, by +\begin{enumerate} +\item ignoring any data in device-readable buffers outside +the expected length, and +\item only writing the expected structure to the device-writeable +buffers, ignoring any extra buffers, and reporting the +actual length of data written, in bytes, +as buffer used length. +\end{enumerate} + +The device SHOULD initialize the device-writeable buffer +up to the length of the structure described by this specification or
Quoted 8 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 6 lines
admin.tex +6
-0+the length of the buffer supplied by the driver (even if the buffer is +all set to zero), whichever is shorter. + +The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
Quoted 5 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 412
Quoted 3 lines
admin.tex +3
-0+ +The device MUST process commands on a given administration virtqueue +in the order in which they are queued.Is it better to use "complete" than "process" here?
I am not sure we need to require they complete in order, unless IN_ORDER is set (unfortunately it is global for all of device).
Quoted 4 lines
Or we can reuse
part of the in-order description.(Or maybe a flush command)
these can be used if offered.
Quoted 22 lines
Quoted 9 lines
admin.tex +9
-0+ +If multiple administration virtqueues have been configured, +device MAY process commands on distinct virtqueues with +no order constraints. + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The driver MAY supply device-readable and device-writeable buffers +longer than described in this specification.admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 431
Quoted 10 lines
admin.tex +10
-0+ +The driver SHOULD supply device-readable buffers at least as +large as the structure described by this specification +(even if the buffer is all set to zero). + +The driver MUST NOT assume that the device will initialize the whole +structure as described in the specification; instead, +the driver MUST assume that the structure +outside the part of the buffer used by the device +is set to zero.Won't this have security implications? E.g information leak.
Quoted 1 line
Thanks
hmm this is not clear enough. it should ignore the contents and behave as if it was set to zero. Will fix.
Quoted 7 lines
Quoted 7 lines
admin.tex +4
-1+ +If multiple administration virtqueues have been configured, +the driver MUST ensure ordering for commands +placed on different administration virtqueues. --MST
Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 163 lines · Michael S. Tsirkin
Quoted 16 lines · Jason Wang
Quoted 15 lines · Michael S. Tsirkin
Add conformance clauses for admin commands and admin virtqueues.
Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)admin.tex +0
-0@@ -222,6 +222,107 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti It is assumed that all members in a group support and are used with the same list of commands.Quoted 6 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 229
Quoted 5 lines
admin.tex +5
-0+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The device MUST validate \field{opcode}, \field{group_type} and +\field{group_member_id}, set \field{status} to VIRTIO_ADMIN_STATUS_EINVAL and +nd if any of these has an invalid or unsupported value, settypo
thanks!
Quoted 98 lines
Quoted 98 lines
admin.tex +96
-0+\field{status_qualifier} accordingly. + +If a command completes successfully, the device MUST set +\field{status} to VIRTIO_ADMIN_STATUS_OK. + +If a command fails, the device MUST set +\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK. + +If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the +device state MUST NOT change, that is the command MUST NOT have +any side effects on the device, in particular the device MUST not +enter an error state as a result of this command. + +If a command fails, the device state generally SHOULD NOT change, +as far as possible. + +The device MAY enforce additional restrictions and dependencies on +opcodes used by the driver and MAY fail the command +VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD +if the list of commands used violate internal device dependencies. + +If the device supports multiple group types, commands for each group +type MUST operate independently of each other, in particular, +the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY +for different group types. + +After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +After completing VIRTIO_ADMIN_CMD_LIST_USE successfully, +the device MUST set the list of legal commands used by the driver +to the one supplied in \field{command_specific_data}. + +The device MUST set the list of legal commands used by the driver +to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE. + +The device MUST validate commands against the list used by +the driver and MUST fail any commands not in the list with +\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE. + +The list of supported commands MUST NOT shrink (but MAY expand): +after reporting a given command as supported through +VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it +as unsupported. Further, after a given set of commands has been +used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a +device or system reset the device SHOULD complete successfully +any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same +list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails +after a device or system reset, the device MUST not fail it +solely because of the command list used. Failure to do so would +interfere with resuming from suspend and error recovery. + + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The driver MAY discover whether device supports a specific group type +by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching +\field{group_type}. + +The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE +and wait for it to be completed with status +VIRTIO_ADMIN_STATUS_OK before issuing any commands +(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY +and VIRTIO_ADMIN_CMD_LIST_USE). + +The driver SHOULD NOT set bits in device_admin_cmds +if it is not familiar with how the command opcode +is used, as dependencies between command opcodes might exist. + +The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE) +the use of any commands not previously reported as +supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY. + +The driver MUST NOT use any commands for a given group type +before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct +list of command opcodes and group type. + +The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE +with respective bits cleared in \field{command_specific_data}. + +The driver MUST handle a command error with a reserved \field{status} +value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +(except possibly for different error reporting/diagnostic messages). + +The driver MUST handle a command error with a reserved +\field{status_qualifier} value in the same way as +\field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for +different error reporting/diagnostic messages). + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 14 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 13 lines
admin.tex +8
-0An administration virtqueue of an owner device is used to submit@@ -275,3 +376,60 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic new fields can be added to the tail of a structure, with the driver using the full structure without concern for versioning. + +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, ands/"is set"/"are set"
thanks
Quoted 16 lines
Quoted 16 lines
admin.tex +16
-0+\item discarding data that would be written outside the +specified device-writeable buffers. +\end{enumerate} + +The device MUST support device-readable and device-writeable buffers +longer than described in this specification, by +\begin{enumerate} +\item ignoring any data in device-readable buffers outside +the expected length, and +\item only writing the expected structure to the device-writeable +buffers, ignoring any extra buffers, and reporting the +actual length of data written, in bytes, +as buffer used length. +\end{enumerate} + +The device SHOULD initialize the device-writeable bufferQuoted 8 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 7 lines
admin.tex +7
-0+up to the length of the structure described by this specification or +the length of the buffer supplied by the driver (even if the buffer is +all set to zero), whichever is shorter. + +The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
Quoted 5 lines
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
For example:
The patch said:
struct virtio_admin_cmd_list {
/* Indicates which of the below fields were returned le32 device_admin_cmds[];
};
Does it mean the query can still succeed even if there's no space for virtio_admin_cmd_list in the writable buffer?
Quoted 8 lines
Quoted 6 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 412
Quoted 5 lines
admin.tex +3
-0+ +The device MUST process commands on a given administration virtqueue +in the order in which they are queued.Is it better to use "complete" than "process" here?
I am not sure we need to require they complete in order, unless
IN_ORDERis set (unfortunately it is global for all of device).
So I'm not sure the "process" can help in this case. Consider we have two commands X and Y. And Y depends on X.
If we say device processes the commands in order, driver can't submit Y until it see X is completed. This seems no changes if we allow the device to process the command out of order.
Quoted 29 lines
Quoted 5 lines
Or we can reuse
part of the in-order description.(Or maybe a flush command)
these can be used if offered.
Quoted 21 lines
Quoted 9 lines
admin.tex +9
-0+ +If multiple administration virtqueues have been configured, +device MAY process commands on distinct virtqueues with +no order constraints. + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The driver MAY supply device-readable and device-writeable buffers +longer than described in this specification.admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 431
Quoted 10 lines
admin.tex +10
-0+ +The driver SHOULD supply device-readable buffers at least as +large as the structure described by this specification +(even if the buffer is all set to zero). + +The driver MUST NOT assume that the device will initialize the whole +structure as described in the specification; instead, +the driver MUST assume that the structure +outside the part of the buffer used by the device +is set to zero.Won't this have security implications? E.g information leak.
Quoted 3 lines
Quoted 1 line
Thanks
hmm this is not clear enough. it should ignore the contents and behave as if it was set to zero. Will fix.
Ok.
Thanks
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
admin.tex +4
-1+ +If multiple administration virtqueues have been configured, +the driver MUST ensure ordering for commands +placed on different administration virtqueues. --MST
[virtio] Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 18 lines · Jason Wang
Quoted 11 lines · Michael S. Tsirkin
Quoted 5 lines · Jason Wang
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 3 lines · Michael S. Tsirkin
admin.tex +3
-0+The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
For example:
The patch said:
Quoted 7 lines
struct
virtio_admin_cmd_list{
/* Indicates which of the below fields were returned le32 device_admin_cmds[];
};Does it mean the query can still succeed even if there's no space for
virtio_admin_cmd_listin the writable buffer?
Can we pick an absolute minimum length? All drivers need to be able to at least accommodate this one. Or is it ok for the driver to send a completely useless query that doesn't get any data back?
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that generates this mail. Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 25 lines · Cornelia Huck
Quoted 23 lines · Jason Wang
Quoted 11 lines · Michael S. Tsirkin
Quoted 5 lines · Jason Wang
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 3 lines · Michael S. Tsirkin
admin.tex +3
-0+The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
For example:
The patch said:
struct
virtio_admin_cmd_list{
/* Indicates which of the below fields were returned le32 device_admin_cmds[];
};
Quoted 6 lines
Quoted 2 lines
Does it mean the query can still succeed even if there's no space for
virtio_admin_cmd_listin the writable buffer?Can we pick an absolute minimum length? All drivers need to be able to at least accommodate this one. Or is it ok for the driver to send a completely useless query that doesn't get any data back?
I think it might be a way to check that a group exists.
Signature · 1 line
MST
[virtio] Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Cornelia Huck
Quoted 23 lines · Jason Wang
Quoted 11 lines · Michael S. Tsirkin
Quoted 5 lines · Jason Wang
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 3 lines · Michael S. Tsirkin
admin.tex +3
-0+The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
For example:
The patch said:
struct
virtio_admin_cmd_list{
/* Indicates which of the below fields were returned le32 device_admin_cmds[];
};
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Does it mean the query can still succeed even if there's no space for
virtio_admin_cmd_listin the writable buffer?Can we pick an absolute minimum length? All drivers need to be able to at least accommodate this one. Or is it ok for the driver to send a completely useless query that doesn't get any data back?
I think it might be a way to check that a group exists.
Ok, so not completely useless.
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that generates this mail. Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
Re: [PATCH v9 09/10] admin: conformance clauses
In reply to Jason WangQuoted 176 lines · Jason Wang
Quoted 163 lines · Michael S. Tsirkin
Quoted 16 lines · Jason Wang
Quoted 15 lines · Michael S. Tsirkin
Add conformance clauses for admin commands and admin virtqueues.
Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)admin.tex +0
-0@@ -222,6 +222,107 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti It is assumed that all members in a group support and are used with the same list of commands.Quoted 6 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 229
Quoted 5 lines
admin.tex +5
-0+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The device MUST validate \field{opcode}, \field{group_type} and +\field{group_member_id}, set \field{status} to VIRTIO_ADMIN_STATUS_EINVAL and +nd if any of these has an invalid or unsupported value, settypo
thanks!
Quoted 98 lines
Quoted 98 lines
admin.tex +96
-0+\field{status_qualifier} accordingly. + +If a command completes successfully, the device MUST set +\field{status} to VIRTIO_ADMIN_STATUS_OK. + +If a command fails, the device MUST set +\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK. + +If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the +device state MUST NOT change, that is the command MUST NOT have +any side effects on the device, in particular the device MUST not +enter an error state as a result of this command. + +If a command fails, the device state generally SHOULD NOT change, +as far as possible. + +The device MAY enforce additional restrictions and dependencies on +opcodes used by the driver and MAY fail the command +VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD +if the list of commands used violate internal device dependencies. + +If the device supports multiple group types, commands for each group +type MUST operate independently of each other, in particular, +the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY +for different group types. + +After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +After completing VIRTIO_ADMIN_CMD_LIST_USE successfully, +the device MUST set the list of legal commands used by the driver +to the one supplied in \field{command_specific_data}. + +The device MUST set the list of legal commands used by the driver +to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE. + +The device MUST validate commands against the list used by +the driver and MUST fail any commands not in the list with +\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE. + +The list of supported commands MUST NOT shrink (but MAY expand): +after reporting a given command as supported through +VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it +as unsupported. Further, after a given set of commands has been +used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a +device or system reset the device SHOULD complete successfully +any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same +list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails +after a device or system reset, the device MUST not fail it +solely because of the command list used. Failure to do so would +interfere with resuming from suspend and error recovery. + + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The driver MAY discover whether device supports a specific group type +by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching +\field{group_type}. + +The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE +and wait for it to be completed with status +VIRTIO_ADMIN_STATUS_OK before issuing any commands +(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY +and VIRTIO_ADMIN_CMD_LIST_USE). + +The driver SHOULD NOT set bits in device_admin_cmds +if it is not familiar with how the command opcode +is used, as dependencies between command opcodes might exist. + +The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE) +the use of any commands not previously reported as +supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY. + +The driver MUST NOT use any commands for a given group type +before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct +list of command opcodes and group type. + +The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE +with respective bits cleared in \field{command_specific_data}. + +The driver MUST handle a command error with a reserved \field{status} +value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +(except possibly for different error reporting/diagnostic messages). + +The driver MUST handle a command error with a reserved +\field{status_qualifier} value in the same way as +\field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for +different error reporting/diagnostic messages). + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 14 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 13 lines
admin.tex +8
-0An administration virtqueue of an owner device is used to submit@@ -275,3 +376,60 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic new fields can be added to the tail of a structure, with the driver using the full structure without concern for versioning. + +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, ands/"is set"/"are set"
thanks
Quoted 16 lines
Quoted 16 lines
admin.tex +16
-0+\item discarding data that would be written outside the +specified device-writeable buffers. +\end{enumerate} + +The device MUST support device-readable and device-writeable buffers +longer than described in this specification, by +\begin{enumerate} +\item ignoring any data in device-readable buffers outside +the expected length, and +\item only writing the expected structure to the device-writeable +buffers, ignoring any extra buffers, and reporting the +actual length of data written, in bytes, +as buffer used length. +\end{enumerate} + +The device SHOULD initialize the device-writeable bufferQuoted 8 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 7 lines
admin.tex +7
-0+up to the length of the structure described by this specification or +the length of the buffer supplied by the driver (even if the buffer is +all set to zero), whichever is shorter. + +The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
Quoted 5 lines
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
For example:
The patch said:
Quoted 8 lines
struct
virtio_admin_cmd_list{
/* Indicates which of the below fields were returned le32 device_admin_cmds[];
};Does it mean the query can still succeed even if there's no space for
virtio_admin_cmd_listin the writable buffer?
yes you just skip it. E.g. it's a way to check that query is supported. And this (truncated buffer) is exactly what will happen when we have e.g. 1k opcodes.
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 412
Quoted 5 lines
admin.tex +3
-0+ +The device MUST process commands on a given administration virtqueue +in the order in which they are queued.Is it better to use "complete" than "process" here?
I am not sure we need to require they complete in order, unless
IN_ORDERis set (unfortunately it is global for all of device).
Quoted 8 lines
So I'm not sure the "process" can help in this case. Consider we have two commands X and Y. And Y depends on X.
If we say device processes the commands in order, driver can't submit Y until it see X is completed.
This seems no changes if we allow the device to
process the command out of order.
Depends on command.
Consider transport vq, some read following a write. read must not bypass it but you do not need to wait for write.
Quoted 49 lines
Quoted 30 lines
Quoted 6 lines
Or we can reuse
part of the in-order description.(Or maybe a flush command)
these can be used if offered.
Quoted 21 lines
Quoted 9 lines
admin.tex +9
-0+ +If multiple administration virtqueues have been configured, +device MAY process commands on distinct virtqueues with +no order constraints. + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The driver MAY supply device-readable and device-writeable buffers +longer than described in this specification.admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 431
Quoted 10 lines
admin.tex +10
-0+ +The driver SHOULD supply device-readable buffers at least as +large as the structure described by this specification +(even if the buffer is all set to zero). + +The driver MUST NOT assume that the device will initialize the whole +structure as described in the specification; instead, +the driver MUST assume that the structure +outside the part of the buffer used by the device +is set to zero.Won't this have security implications? E.g information leak.
Quoted 3 lines
Quoted 1 line
Thanks
hmm this is not clear enough. it should ignore the contents and behave as if it was set to zero. Will fix.
Ok.
Thanks
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
admin.tex +4
-1+ +If multiple administration virtqueues have been configured, +the driver MUST ensure ordering for commands +placed on different administration virtqueues. --MST
Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 180 lines · Michael S. Tsirkin
Quoted 179 lines · Jason Wang
Quoted 163 lines · Michael S. Tsirkin
Quoted 16 lines · Jason Wang
Quoted 15 lines · Michael S. Tsirkin
Add conformance clauses for admin commands and admin virtqueues.
Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)admin.tex +0
-0@@ -222,6 +222,107 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti It is assumed that all members in a group support and are used with the same list of commands.Quoted 6 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 229
Quoted 5 lines
admin.tex +5
-0+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The device MUST validate \field{opcode}, \field{group_type} and +\field{group_member_id}, set \field{status} to VIRTIO_ADMIN_STATUS_EINVAL and +nd if any of these has an invalid or unsupported value, settypo
thanks!
Quoted 98 lines
Quoted 98 lines
admin.tex +96
-0+\field{status_qualifier} accordingly. + +If a command completes successfully, the device MUST set +\field{status} to VIRTIO_ADMIN_STATUS_OK. + +If a command fails, the device MUST set +\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK. + +If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the +device state MUST NOT change, that is the command MUST NOT have +any side effects on the device, in particular the device MUST not +enter an error state as a result of this command. + +If a command fails, the device state generally SHOULD NOT change, +as far as possible. + +The device MAY enforce additional restrictions and dependencies on +opcodes used by the driver and MAY fail the command +VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD +if the list of commands used violate internal device dependencies. + +If the device supports multiple group types, commands for each group +type MUST operate independently of each other, in particular, +the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY +for different group types. + +After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +After completing VIRTIO_ADMIN_CMD_LIST_USE successfully, +the device MUST set the list of legal commands used by the driver +to the one supplied in \field{command_specific_data}. + +The device MUST set the list of legal commands used by the driver +to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE. + +The device MUST validate commands against the list used by +the driver and MUST fail any commands not in the list with +\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE. + +The list of supported commands MUST NOT shrink (but MAY expand): +after reporting a given command as supported through +VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it +as unsupported. Further, after a given set of commands has been +used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a +device or system reset the device SHOULD complete successfully +any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same +list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails +after a device or system reset, the device MUST not fail it +solely because of the command list used. Failure to do so would +interfere with resuming from suspend and error recovery. + + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The driver MAY discover whether device supports a specific group type +by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching +\field{group_type}. + +The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE +and wait for it to be completed with status +VIRTIO_ADMIN_STATUS_OK before issuing any commands +(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY +and VIRTIO_ADMIN_CMD_LIST_USE). + +The driver SHOULD NOT set bits in device_admin_cmds +if it is not familiar with how the command opcode +is used, as dependencies between command opcodes might exist. + +The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE) +the use of any commands not previously reported as +supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY. + +The driver MUST NOT use any commands for a given group type +before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct +list of command opcodes and group type. + +The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE +with respective bits cleared in \field{command_specific_data}. + +The driver MUST handle a command error with a reserved \field{status} +value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +(except possibly for different error reporting/diagnostic messages). + +The driver MUST handle a command error with a reserved +\field{status_qualifier} value in the same way as +\field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for +different error reporting/diagnostic messages). + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 14 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 13 lines
admin.tex +8
-0An administration virtqueue of an owner device is used to submit@@ -275,3 +376,60 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic new fields can be added to the tail of a structure, with the driver using the full structure without concern for versioning. + +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, ands/"is set"/"are set"
thanks
Quoted 16 lines
Quoted 16 lines
admin.tex +16
-0+\item discarding data that would be written outside the +specified device-writeable buffers. +\end{enumerate} + +The device MUST support device-readable and device-writeable buffers +longer than described in this specification, by +\begin{enumerate} +\item ignoring any data in device-readable buffers outside +the expected length, and +\item only writing the expected structure to the device-writeable +buffers, ignoring any extra buffers, and reporting the +actual length of data written, in bytes, +as buffer used length. +\end{enumerate} + +The device SHOULD initialize the device-writeable bufferQuoted 8 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 7 lines
admin.tex +7
-0+up to the length of the structure described by this specification or +the length of the buffer supplied by the driver (even if the buffer is +all set to zero), whichever is shorter. + +The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
Quoted 5 lines
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
For example:
The patch said:
struct
virtio_admin_cmd_list{
/* Indicates which of the below fields were returned le32 device_admin_cmds[];
};
Quoted 4 lines
Quoted 3 lines
Does it mean the query can still succeed even if there's no space for
virtio_admin_cmd_listin the writable buffer?yes you just skip it. E.g. it's a way to check that query is supported.
Interesting, I thought it should be assumed by the driver that at least the QUERY is supported:
+After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume
+that the list of legal commands used by the driver consists of
+the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE.
Quoted 2 lines
And this (truncated buffer) is exactly what will happen when we have e.g. 1k opcodes.
Yes, this is what I understood.
Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 6 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 412
Quoted 5 lines
admin.tex +3
-0+ +The device MUST process commands on a given administration virtqueue +in the order in which they are queued.Is it better to use "complete" than "process" here?
I am not sure we need to require they complete in order, unless
IN_ORDERis set (unfortunately it is global for all of device).So I'm not sure the "process" can help in this case. Consider we have two commands X and Y. And Y depends on X.
Quoted 8 lines
Quoted 5 lines
If we say device processes the commands in order, driver can't submit Y until it see X is completed.
This seems no changes if we allow the device to
process the command out of order.Depends on command.
Consider transport vq, some read following a write. read must not bypass it but you do not need to wait for write.
Right, but it looks to me that the "bypass" here means "complete before" here.
Thanks
Quoted 45 lines
Quoted 45 lines
Quoted 28 lines
Quoted 5 lines
Or we can reuse
part of the in-order description.(Or maybe a flush command)
these can be used if offered.
Quoted 21 lines
Quoted 9 lines
admin.tex +9
-0+ +If multiple administration virtqueues have been configured, +device MAY process commands on distinct virtqueues with +no order constraints. + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The driver MAY supply device-readable and device-writeable buffers +longer than described in this specification.admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 431
Quoted 10 lines
admin.tex +10
-0+ +The driver SHOULD supply device-readable buffers at least as +large as the structure described by this specification +(even if the buffer is all set to zero). + +The driver MUST NOT assume that the device will initialize the whole +structure as described in the specification; instead, +the driver MUST assume that the structure +outside the part of the buffer used by the device +is set to zero.Won't this have security implications? E.g information leak.
Quoted 3 lines
Quoted 1 line
Thanks
hmm this is not clear enough. it should ignore the contents and behave as if it was set to zero. Will fix.
Ok.
Thanks
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
admin.tex +4
-1+ +If multiple administration virtqueues have been configured, +the driver MUST ensure ordering for commands +placed on different administration virtqueues. --MST
Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 191 lines · Jason Wang
Quoted 180 lines · Michael S. Tsirkin
Quoted 179 lines · Jason Wang
Quoted 163 lines · Michael S. Tsirkin
Quoted 16 lines · Jason Wang
Quoted 15 lines · Michael S. Tsirkin
Add conformance clauses for admin commands and admin virtqueues.
Signed-off-by Michael S. Tsirkin <[email protected]>--- admin.tex | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)admin.tex +0
-0@@ -222,6 +222,107 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti It is assumed that all members in a group support and are used with the same list of commands.Quoted 6 lines
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 229
Quoted 5 lines
admin.tex +5
-0+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The device MUST validate \field{opcode}, \field{group_type} and +\field{group_member_id}, set \field{status} to VIRTIO_ADMIN_STATUS_EINVAL and +nd if any of these has an invalid or unsupported value, settypo
thanks!
Quoted 98 lines
Quoted 98 lines
admin.tex +96
-0+\field{status_qualifier} accordingly. + +If a command completes successfully, the device MUST set +\field{status} to VIRTIO_ADMIN_STATUS_OK. + +If a command fails, the device MUST set +\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK. + +If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the +device state MUST NOT change, that is the command MUST NOT have +any side effects on the device, in particular the device MUST not +enter an error state as a result of this command. + +If a command fails, the device state generally SHOULD NOT change, +as far as possible. + +The device MAY enforce additional restrictions and dependencies on +opcodes used by the driver and MAY fail the command +VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD +if the list of commands used violate internal device dependencies. + +If the device supports multiple group types, commands for each group +type MUST operate independently of each other, in particular, +the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY +for different group types. + +After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE. + +After completing VIRTIO_ADMIN_CMD_LIST_USE successfully, +the device MUST set the list of legal commands used by the driver +to the one supplied in \field{command_specific_data}. + +The device MUST set the list of legal commands used by the driver +to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE. + +The device MUST validate commands against the list used by +the driver and MUST fail any commands not in the list with +\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +and \field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE. + +The list of supported commands MUST NOT shrink (but MAY expand): +after reporting a given command as supported through +VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it +as unsupported. Further, after a given set of commands has been +used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a +device or system reset the device SHOULD complete successfully +any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same +list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails +after a device or system reset, the device MUST not fail it +solely because of the command list used. Failure to do so would +interfere with resuming from suspend and error recovery. + + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands} + +The driver MAY discover whether device supports a specific group type +by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching +\field{group_type}. + +The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE +and wait for it to be completed with status +VIRTIO_ADMIN_STATUS_OK before issuing any commands +(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY +and VIRTIO_ADMIN_CMD_LIST_USE). + +The driver SHOULD NOT set bits in device_admin_cmds +if it is not familiar with how the command opcode +is used, as dependencies between command opcodes might exist. + +The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE) +the use of any commands not previously reported as +supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY. + +The driver MUST NOT use any commands for a given group type +before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct +list of command opcodes and group type. + +The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and +VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE +with respective bits cleared in \field{command_specific_data}. + +The driver MUST handle a command error with a reserved \field{status} +value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL +(except possibly for different error reporting/diagnostic messages). + +The driver MUST handle a command error with a reserved +\field{status_qualifier} value in the same way as +\field{status_qualifier} set to +VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for +different error reporting/diagnostic messages). + \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}Quoted 14 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 13 lines
admin.tex +8
-0An administration virtqueue of an owner device is used to submit@@ -275,3 +376,60 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic new fields can be added to the tail of a structure, with the driver using the full structure without concern for versioning. + +\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, ands/"is set"/"are set"
thanks
Quoted 16 lines
Quoted 16 lines
admin.tex +16
-0+\item discarding data that would be written outside the +specified device-writeable buffers. +\end{enumerate} + +The device MUST support device-readable and device-writeable buffers +longer than described in this specification, by +\begin{enumerate} +\item ignoring any data in device-readable buffers outside +the expected length, and +\item only writing the expected structure to the device-writeable +buffers, ignoring any extra buffers, and reporting the +actual length of data written, in bytes, +as buffer used length. +\end{enumerate} + +The device SHOULD initialize the device-writeable bufferQuoted 8 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 409
Quoted 7 lines
admin.tex +7
-0+up to the length of the structure described by this specification or +the length of the buffer supplied by the driver (even if the buffer is +all set to zero), whichever is shorter. + +The device MUST NOT fail a command solely because the buffers +provided are shorter or longer than described in this +specification.I may miss something but how can it work if the buffer is shorter?
Quoted 5 lines
driver does not care what's there.
this is mostly for forward compatibility - we'll add more fields and I don't want to explain separately that old drivers post short buffers with less fields.
For example:
The patch said:
struct
virtio_admin_cmd_list{
/* Indicates which of the below fields were returned le32 device_admin_cmds[];
};Quoted 4 lines
Quoted 3 lines
Does it mean the query can still succeed even if there's no space for
virtio_admin_cmd_listin the writable buffer?yes you just skip it. E.g. it's a way to check that query is supported.
Interesting, I thought it should be assumed by the driver that at least the QUERY is supported:
admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 260
Quoted 4 lines
admin.tex +4
-0+After reset, and before receiving VIRTIO_ADMIN_CMD_LIST_USE for a given group type +the device MUST assume +that the list of legal commands used by the driver consists of +the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE.
Oh I see what the confusion is. It's supported if the group exists for the given owner. E.g. a VF won't support a SRIOV type, it's designed for a PF.
Quoted 81 lines
Quoted 3 lines
And this (truncated buffer) is exactly what will happen when we have e.g. 1k opcodes.
Yes, this is what I understood.
Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 6 lines
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 412
Quoted 5 lines
admin.tex +3
-0+ +The device MUST process commands on a given administration virtqueue +in the order in which they are queued.Is it better to use "complete" than "process" here?
I am not sure we need to require they complete in order, unless
IN_ORDERis set (unfortunately it is global for all of device).So I'm not sure the "process" can help in this case. Consider we have two commands X and Y. And Y depends on X.
Quoted 8 lines
Quoted 5 lines
If we say device processes the commands in order, driver can't submit Y until it see X is completed.
This seems no changes if we allow the device to
process the command out of order.Depends on command.
Consider transport vq, some read following a write. read must not bypass it but you do not need to wait for write.Right, but it looks to me that the "bypass" here means "complete before" here.
Thanks
Quoted 45 lines
Quoted 45 lines
Quoted 28 lines
Quoted 5 lines
Or we can reuse
part of the in-order description.(Or maybe a flush command)
these can be used if offered.
Quoted 21 lines
Quoted 9 lines
admin.tex +9
-0+ +If multiple administration virtqueues have been configured, +device MAY process commands on distinct virtqueues with +no order constraints. + +\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues} + +The driver MAY supply device-readable and device-writeable buffers +longer than described in this specification.admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 431
Quoted 10 lines
admin.tex +10
-0+ +The driver SHOULD supply device-readable buffers at least as +large as the structure described by this specification +(even if the buffer is all set to zero). + +The driver MUST NOT assume that the device will initialize the whole +structure as described in the specification; instead, +the driver MUST assume that the structure +outside the part of the buffer used by the device +is set to zero.Won't this have security implications? E.g information leak.
Quoted 3 lines
Quoted 1 line
Thanks
hmm this is not clear enough. it should ignore the contents and behave as if it was set to zero. Will fix.
Ok.
Thanks
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
admin.tex +4
-1+ +If multiple administration virtqueues have been configured, +the driver MUST ensure ordering for commands +placed on different administration virtqueues. --MST
[virtio] Re: [PATCH v9 09/10] admin: conformance clauses
In reply to Jason WangQuoted 8 lines · Jason Wang
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 5 lines · Michael S. Tsirkin
admin.tex +5
-0+The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, ands/"is set"/"are set"
I think "is set" is actually correct.
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that generates this mail. Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
Re: [PATCH v9 09/10] admin: conformance clauses
Quoted 10 lines · Cornelia Huck
Quoted 7 lines · Jason Wang
admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 386
Quoted 5 lines · Michael S. Tsirkin
admin.tex +5
-0+The device MUST support device-readable and device-writeable buffers +shorter than described in this specification, by +\begin{enumerate} +\item assuming that any data that would be read outside the +device-readable buffers is set to zero, ands/"is set"/"are set"
I think "is set" is actually correct.
You are right.
Thanks
Quoted 1 line
RFC PATCH v9 10/10 ccw: document more reserved features
In reply to Michael S. Tsirkinvq reset and shared memory are unsupported, too.
---
This is not strictly part of this patchset, but just to give you the idea of how we can expand this down the road.
content.tex | 2 ++ 1 file changed, 2 insertions(+)
content.tex +2 -0
@@ -2983,6 +2983,8 @@ \subsection{Features reserved for future use}\label{sec:Virtio Transport Options \begin{itemize} \item VIRTIO_F_ADMIN_VQ +\item VIRTIO_F_RING_RESET +\item Shared memory regions including VIRTIO_PMEM_F_SHMEM_REGION \end{itemize}
Signature · 1 line
MST
Re: [PATCH RFC v9 10/10] ccw: document more reserved features
Quoted 4 lines · Michael S. Tsirkin
vq reset and shared memory are unsupported, too.
Signed-off-by Michael S. Tsirkin <[email protected]>
I wonder if it's better to split this series into two since it doesn't have direct connection with the admin stuffs then the compatibility part can go first.
Thanks
Quoted 25 lines
---
This is not strictly part of this patchset, but just to give you the idea of how we can expand this down the road.
content.tex | 2 ++ 1 file changed, 2 insertions(+)content.tex +2
-1@@ -2983,6 +2983,8 @@ \subsection{Features reserved for future use}\label{sec:Virtio Transport Options \begin{itemize} \item VIRTIO_F_ADMIN_VQ +\item VIRTIO_F_RING_RESET +\item Shared memory regions including VIRTIO_PMEM_F_SHMEM_REGION \end{itemize} --MST
Re: [PATCH RFC v9 10/10] ccw: document more reserved features
Quoted 11 lines · Jason Wang
Quoted 4 lines · Michael S. Tsirkin
vq reset and shared memory are unsupported, too.
Signed-off-by Michael S. Tsirkin <[email protected]>I wonder if it's better to split this series into two since it doesn't have direct connection with the admin stuffs then the compatibility part can go first.
Thanks
cover letter explains that this is not part of the series, here for informational purposes.
I don't really have time to work on cleaning up ccw but once this lands others can take this up.
Quoted 25 lines
Quoted 25 lines
---
This is not strictly part of this patchset, but just to give you the idea of how we can expand this down the road.
content.tex | 2 ++ 1 file changed, 2 insertions(+)content.tex +2
-1@@ -2983,6 +2983,8 @@ \subsection{Features reserved for future use}\label{sec:Virtio Transport Options \begin{itemize} \item VIRTIO_F_ADMIN_VQ +\item VIRTIO_F_RING_RESET +\item Shared memory regions including VIRTIO_PMEM_F_SHMEM_REGION \end{itemize} --MST