Skip to contentSkip to conversation

content: document the behaviours for SR-IOV

PATCH In review Tiwei Bie 2 participants 3 messages Jun 7, 2018 – Jun 8, 2018

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

PATCH 1/1 content: document the behaviours for SR-IOV

Document the device and driver behaviours for SR-IOV.

---
 content.tex | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
content.tex +16 -0
index 73981b7..3b45a6c 100644
@@ -5387,6 +5387,18 @@ A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered.
 If VIRTIO_F_IO_BARRIER has been negotiated, a driver MUST use
 the barriers suitable for hardware devices.
 
+If VIRTIO_F_SR_IOV has been negotiated, a driver can enable
+virtual functions through the device's PCI SR-IOV capability
+structure.  A driver MUST NOT negotiate VIRTIO_F_SR_IOV if
+the device does not have a PCI SR-IOV capability structure
+or is not a PCI device.  A driver MUST negotiate
+VIRTIO_F_SR_IOV and complete the feature negotiation
+(including checking the FEATURES_OK \field{status} bit) before
+the first time to enable virtual functions through the device's
+PCI SR-IOV capability structure, and the driver MAY remember
+the VIRTIO_F_SR_IOV feature bit negotiation result until it
+unbinds from the device.
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5403,6 +5415,10 @@ buffers in the same order in which they have been available.
 A device MAY fail to operate further if VIRTIO_F_IO_BARRIER
 is not accepted.
 
+A device SHOULD offer VIRTIO_F_SR_IOV if it is a PCI device
+and presents a PCI SR-IOV capability structure, otherwise
+it MUST NOT offer VIRTIO_F_SR_IOV.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:
Signature · 6 lines
2.17.0


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#1 lore raw

Subject should be "document SR-IOV driver requirements" I think.

Quoted 14 lines · Tiwei Bie

Document the device and driver behaviours for SR-IOV.

---
 content.tex | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
content.tex +0 -0
index 73981b7..3b45a6c 100644

content.tex A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered. · line 5390

Quoted 4 lines
content.tex +1 -0
@@ -5387,6 +5387,18 @@ A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered.
 If VIRTIO_F_IO_BARRIER has been negotiated, a driver MUST use
 the barriers suitable for hardware devices.
 
+If VIRTIO_F_SR_IOV has been negotiated, a driver can enable

can -> MAY

content.tex A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered.

Quoted 6 lines
content.tex +6 -0
+virtual functions through the device's PCI SR-IOV capability
+structure.  A driver MUST NOT negotiate VIRTIO_F_SR_IOV if
+the device does not have a PCI SR-IOV capability structure
+or is not a PCI device.  A driver MUST negotiate
+VIRTIO_F_SR_IOV and complete the feature negotiation
+(including checking the FEATURES_OK \field{status} bit)

OK.

Quoted 2 lines

before
+the first time to enable virtual functions

before enabling virtual functions

Quoted 2 lines

through the device's
+PCI SR-IOV capability structure,

I'd end the sentence here and start a new one.

content.tex A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered. · line 5401

Quoted 4 lines

and the driver MAY remember

content.tex +3 -0
+the VIRTIO_F_SR_IOV feature bit negotiation result until it
+unbinds from the device.
+

I'm not sure what does this mean. We generally take it to mean the DRIVER status bit and that gets cleared by device reset.

How about:

After once successfully negotiating VIRTIO_F_SR_IOV, the driver MAY enable virtual functions through the device's PCI SR-IOV capability structure even if the device or the system has been fully or partially reset, and even without re-negotiating VIRTIO_F_SR_IOV after the reset.

Quoted 4 lines

\devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}

A device MUST offer VIRTIO_F_VERSION_1. A device MAY fail to operate further

content.tex buffers in the same order in which they have been available. · line 5424

Quoted 10 lines
content.tex +4 -0
@@ -5403,6 +5415,10 @@ buffers in the same order in which they have been available.
 A device MAY fail to operate further if VIRTIO_F_IO_BARRIER
 is not accepted.
 
+A device SHOULD offer VIRTIO_F_SR_IOV if it is a PCI device
+and presents a PCI SR-IOV capability structure, otherwise
+it MUST NOT offer VIRTIO_F_SR_IOV.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:

This part has been committed aleady.

I suspect we want to add somewhere in the general section:

If device has successfully negotiated a set of features at least once (by setting the FEATURES_OK \field{status} bit) then it SHOULD NOT fail re-negotiation of the same set of features after a device or system reset. Failure to do so would interfere with resume from suspend and error recovery.

That's a general statement though, I think it's worth a separate issue in github.

Quoted 7 lines
Signature · 6 lines
2.17.0


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

author
#2 lore raw
Quoted 1 line · Michael S. Tsirkin

Subject should be "document SR-IOV driver requirements" I think.

Yeah!

Quoted 50 lines · Tiwei Bie
Quoted 14 lines

Document the device and driver behaviours for SR-IOV.

---
 content.tex | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
content.tex +0 -0
index 73981b7..3b45a6c 100644

content.tex A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered. · line 5390

Quoted 4 lines
content.tex +1 -0
@@ -5387,6 +5387,18 @@ A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered.
 If VIRTIO_F_IO_BARRIER has been negotiated, a driver MUST use
 the barriers suitable for hardware devices.
 
+If VIRTIO_F_SR_IOV has been negotiated, a driver can enable

can -> MAY

content.tex A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered.

Quoted 6 lines
content.tex +6 -0
+virtual functions through the device's PCI SR-IOV capability
+structure.  A driver MUST NOT negotiate VIRTIO_F_SR_IOV if
+the device does not have a PCI SR-IOV capability structure
+or is not a PCI device.  A driver MUST negotiate
+VIRTIO_F_SR_IOV and complete the feature negotiation
+(including checking the FEATURES_OK \field{status} bit)

OK.

Quoted 2 lines

before
+the first time to enable virtual functions

before enabling virtual functions

Quoted 2 lines

through the device's
+PCI SR-IOV capability structure,

I'd end the sentence here and start a new one.

content.tex A driver SHOULD accept VIRTIO_F_IO_BARRIER if it is offered. · line 5401

Quoted 4 lines

and the driver MAY remember

content.tex +3 -0
+the VIRTIO_F_SR_IOV feature bit negotiation result until it
+unbinds from the device.
+

I'm not sure what does this mean. We generally take it to mean the DRIVER status bit and that gets cleared by device reset.

Quoted 7 lines

How about:

After once successfully negotiating VIRTIO_F_SR_IOV, the driver MAY enable virtual functions through the device's PCI SR-IOV capability structure even if the device or the system has been fully or partially reset, and even without re-negotiating VIRTIO_F_SR_IOV after the reset.

Thanks for all your review and suggestion!
I'll send a new version to address them.

Quoted 22 lines
Quoted 6 lines

\devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}

A device MUST offer VIRTIO_F_VERSION_1. A device MAY fail to operate further

content.tex buffers in the same order in which they have been available. · line 5424

Quoted 10 lines
content.tex +4 -0
@@ -5403,6 +5415,10 @@ buffers in the same order in which they have been available.
 A device MAY fail to operate further if VIRTIO_F_IO_BARRIER
 is not accepted.
 
+A device SHOULD offer VIRTIO_F_SR_IOV if it is a PCI device
+and presents a PCI SR-IOV capability structure, otherwise
+it MUST NOT offer VIRTIO_F_SR_IOV.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:

This part has been committed aleady.

I suspect we want to add somewhere in the general section:

Quoted 8 lines

If device has successfully negotiated a set of features at least once (by setting the FEATURES_OK \field{status} bit) then it SHOULD NOT fail re-negotiation of the same set of features after a device or system reset. Failure to do so would interfere with resume from suspend and error recovery.

That's a general statement though, I think it's worth a separate issue in github.

Yeah. It makes sense. I'd like to do that.
Thanks for the suggestion!

Best regards,
Tiwei Bie

Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 
2.17.0
Quoted 8 lines
Quoted 3 lines

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]