Skip to contentSkip to conversation

content: support SR-IOV

PATCH Superseded Tiwei Bie 3 participants 9 messages May 22, 2018 – May 24, 2018

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

PATCH v3 1/1 content: support SR-IOV

Allocate a feature bit for virtio devices which support SR-IOV.

---
More details can be found from this thread:
https://patchwork.kernel.org/patch/10285541/

This patch needs below patch applied first:
https://github.com/oasis-tcs/virtio-spec/issues/10
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00046.html

v2 -> v3:
- Improve the wording (Cornelia);

v1 -> v2:
- s/Reserve/Allocate/ (MST);
- Add a Fixes tag (MST);
- Be more explicit in driver requirement (MST);
- Remove the "device MAY fail" description (MST);
- Rebase on IO_BARRIER patch;

RFC -> v1:
- Mention PCI in the description (Cornelia);

 content.tex | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
content.tex +13 -2
index 95c243f..e9e6f9a 100644
@@ -95,10 +95,10 @@ Feature bits are allocated as follows:
 \begin{description}
 \item[0 to 23] Feature bits for the specific device type
 
-\item[24 to 36] Feature bits reserved for extensions to the queue and
+\item[24 to 37] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[37 and above] Feature bits reserved for future extensions.
+\item[38 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}
@@ -5357,6 +5357,9 @@ Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp
   better performance.  This feature indicates whether
   a stronger form of barrier suitable for hardware
   devices is necessary.
+  \item[VIRTIO_F_SR_IOV(37)] This feature indicates that
+  the device supports Single Root I/O Virtualization.
+  Currently only PCI devices support this feature.
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
@@ -5376,6 +5379,11 @@ 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.
 
+A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.
+If VIRTIO_F_SR_IOV has been negotiated, a driver can
+enable virtual functions through the device's PCI SR-IOV
+capability structure.
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5392,6 +5400,9 @@ 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 presents a PCI
+SR-IOV capability structure.
+
 \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]
Reviewed-by on v3 1/1
#1 lore raw
Quoted 5 lines · On Tue, 22 May 2018 18:26:15 +0800 Tiwei Bie <[email protected]> wrote:

Allocate a feature bit for virtio devices which support SR-IOV.

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

#2 lore raw
In reply to Tiwei Bie
Quoted 47 lines · Tiwei Bie

Allocate a feature bit for virtio devices which support SR-IOV.

---
More details can be found from this thread:
https://patchwork.kernel.org/patch/10285541/

This patch needs below patch applied first:
https://github.com/oasis-tcs/virtio-spec/issues/10
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00046.html

v2 -> v3:
- Improve the wording (Cornelia);

v1 -> v2:
- s/Reserve/Allocate/ (MST);
- Add a Fixes tag (MST);
- Be more explicit in driver requirement (MST);
- Remove the "device MAY fail" description (MST);
- Rebase on IO_BARRIER patch;

RFC -> v1:
- Mention PCI in the description (Cornelia);

 content.tex | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
content.tex +2 -2
index 95c243f..e9e6f9a 100644
@@ -95,10 +95,10 @@ Feature bits are allocated as follows:
 \begin{description}
 \item[0 to 23] Feature bits for the specific device type
 
-\item[24 to 36] Feature bits reserved for extensions to the queue and
+\item[24 to 37] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[37 and above] Feature bits reserved for future extensions.
+\item[38 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}

content.tex Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp · line 5362

Quoted 6 lines
content.tex +3 -0
@@ -5357,6 +5357,9 @@ Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp
   better performance.  This feature indicates whether
   a stronger form of barrier suitable for hardware
   devices is necessary.
+  \item[VIRTIO_F_SR_IOV(37)] This feature indicates that
+  the device supports Single Root I/O Virtualization.
+  Currently only PCI devices support this feature.

I guess the assumption is that all VFs and the PF are of the same type?

I feel it might be handy down the road to support mixing types. For this reason, to avoid binding a wrong driver to a VF, I propose that all VFs have this bit too, and require that drivers ignore VFs without this bit.

What do you think?

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

Quoted 11 lines
content.tex +4 -0
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
@@ -5376,6 +5379,11 @@ 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.
 
+A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.
+If VIRTIO_F_SR_IOV has been negotiated, a driver can
+enable virtual functions through the device's PCI SR-IOV
+capability structure.

I feel the last sentence isn't clear enough. How about

a driver MUST negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 24 lines
content.tex +4 -0
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5392,6 +5400,9 @@ 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 presents a PCI
+SR-IOV capability structure.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:
Signature · 7 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]

#3 lore raw
Quoted 57 lines · Michael S. Tsirkin
Quoted 47 lines · Tiwei Bie

Allocate a feature bit for virtio devices which support SR-IOV.

---
More details can be found from this thread:
https://patchwork.kernel.org/patch/10285541/

This patch needs below patch applied first:
https://github.com/oasis-tcs/virtio-spec/issues/10
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00046.html

v2 -> v3:
- Improve the wording (Cornelia);

v1 -> v2:
- s/Reserve/Allocate/ (MST);
- Add a Fixes tag (MST);
- Be more explicit in driver requirement (MST);
- Remove the "device MAY fail" description (MST);
- Rebase on IO_BARRIER patch;

RFC -> v1:
- Mention PCI in the description (Cornelia);

 content.tex | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
content.tex +2 -2
index 95c243f..e9e6f9a 100644
@@ -95,10 +95,10 @@ Feature bits are allocated as follows:
 \begin{description}
 \item[0 to 23] Feature bits for the specific device type
 
-\item[24 to 36] Feature bits reserved for extensions to the queue and
+\item[24 to 37] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[37 and above] Feature bits reserved for future extensions.
+\item[38 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}

content.tex Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp · line 5362

Quoted 6 lines
content.tex +3 -0
@@ -5357,6 +5357,9 @@ Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp
   better performance.  This feature indicates whether
   a stronger form of barrier suitable for hardware
   devices is necessary.
+  \item[VIRTIO_F_SR_IOV(37)] This feature indicates that
+  the device supports Single Root I/O Virtualization.
+  Currently only PCI devices support this feature.

I guess the assumption is that all VFs and the PF are of the same type?

Quoted 6 lines

I feel it might be handy down the road to support mixing types. For this reason, to avoid binding a wrong driver to a VF, I propose that all VFs have this bit too, and require that drivers ignore VFs without this bit.

What do you think?

Thinking more about it, I can see how this might interfere with passing VFs through to legacy nested guests. How about reversing it then?

Require that drivers MUST NOT negotiate VIRTIO_F_SR_IOV if device does not have an SRIOV capability or is not a PCI device, in particular a VF.

And say a device without SRIOV cap SHOULD NOT expose this bit.

Quoted 14 lines

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

Quoted 11 lines
content.tex +4 -0
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
@@ -5376,6 +5379,11 @@ 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.
 
+A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.
+If VIRTIO_F_SR_IOV has been negotiated, a driver can
+enable virtual functions through the device's PCI SR-IOV
+capability structure.

I feel the last sentence isn't clear enough. How about

Quoted 29 lines

a driver MUST negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 24 lines
content.tex +4 -0
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5392,6 +5400,9 @@ 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 presents a PCI
+SR-IOV capability structure.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:
Signature · 7 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
#4 lore raw
Quoted 65 lines · Michael S. Tsirkin
Quoted 57 lines · Michael S. Tsirkin
Quoted 47 lines · Tiwei Bie

Allocate a feature bit for virtio devices which support SR-IOV.

---
More details can be found from this thread:
https://patchwork.kernel.org/patch/10285541/

This patch needs below patch applied first:
https://github.com/oasis-tcs/virtio-spec/issues/10
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00046.html

v2 -> v3:
- Improve the wording (Cornelia);

v1 -> v2:
- s/Reserve/Allocate/ (MST);
- Add a Fixes tag (MST);
- Be more explicit in driver requirement (MST);
- Remove the "device MAY fail" description (MST);
- Rebase on IO_BARRIER patch;

RFC -> v1:
- Mention PCI in the description (Cornelia);

 content.tex | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
content.tex +2 -2
index 95c243f..e9e6f9a 100644
@@ -95,10 +95,10 @@ Feature bits are allocated as follows:
 \begin{description}
 \item[0 to 23] Feature bits for the specific device type
 
-\item[24 to 36] Feature bits reserved for extensions to the queue and
+\item[24 to 37] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[37 and above] Feature bits reserved for future extensions.
+\item[38 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}

content.tex Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp · line 5362

Quoted 6 lines
content.tex +3 -0
@@ -5357,6 +5357,9 @@ Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp
   better performance.  This feature indicates whether
   a stronger form of barrier suitable for hardware
   devices is necessary.
+  \item[VIRTIO_F_SR_IOV(37)] This feature indicates that
+  the device supports Single Root I/O Virtualization.
+  Currently only PCI devices support this feature.

I guess the assumption is that all VFs and the PF are of the same type?

Quoted 6 lines

I feel it might be handy down the road to support mixing types. For this reason, to avoid binding a wrong driver to a VF, I propose that all VFs have this bit too, and require that drivers ignore VFs without this bit.

What do you think?

Quoted 7 lines

Thinking more about it, I can see how this might interfere with passing VFs through to legacy nested guests. How about reversing it then?

Require that drivers MUST NOT negotiate VIRTIO_F_SR_IOV if device does not have an SRIOV capability or is not a PCI device, in particular a VF.

I think driver can accept this feature as long as it's able to handle the SR-IOV capability and there is no need for it to check whether the device has the SR-IOV capability. And device should make sure that it won't offer this feature if it doesn't present this capability.

How about changing the driver requirement to:

A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered. 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 negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 3 lines

And say a device without SRIOV cap SHOULD NOT expose this bit.

No problem. How about:

A device SHOULD offer VIRTIO_F_SR_IOV if it presents a PCI SR-IOV capability structure. A device SHOULD NOT offer VIRTIO_F_SR_IOV if it doesn't presents a PCI SR-IOV capability structure.

Quoted 38 lines
Quoted 38 lines

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

Quoted 13 lines
content.tex +4 -0
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
@@ -5376,6 +5379,11 @@ 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.
 
+A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.
+If VIRTIO_F_SR_IOV has been negotiated, a driver can
+enable virtual functions through the device's PCI SR-IOV
+capability structure.

I feel the last sentence isn't clear enough. How about

a driver MUST negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 14 lines
content.tex +4 -0
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5392,6 +5400,9 @@ 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 presents a PCI
+SR-IOV capability structure.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:
Quoted 7 lines
Quoted 7 lines
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]

#5 lore raw
Quoted 70 lines · Tiwei Bie
Quoted 69 lines · Michael S. Tsirkin
Quoted 57 lines · Michael S. Tsirkin
Quoted 47 lines · Tiwei Bie

Allocate a feature bit for virtio devices which support SR-IOV.

---
More details can be found from this thread:
https://patchwork.kernel.org/patch/10285541/

This patch needs below patch applied first:
https://github.com/oasis-tcs/virtio-spec/issues/10
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00046.html

v2 -> v3:
- Improve the wording (Cornelia);

v1 -> v2:
- s/Reserve/Allocate/ (MST);
- Add a Fixes tag (MST);
- Be more explicit in driver requirement (MST);
- Remove the "device MAY fail" description (MST);
- Rebase on IO_BARRIER patch;

RFC -> v1:
- Mention PCI in the description (Cornelia);

 content.tex | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
content.tex +2 -2
index 95c243f..e9e6f9a 100644
@@ -95,10 +95,10 @@ Feature bits are allocated as follows:
 \begin{description}
 \item[0 to 23] Feature bits for the specific device type
 
-\item[24 to 36] Feature bits reserved for extensions to the queue and
+\item[24 to 37] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[37 and above] Feature bits reserved for future extensions.
+\item[38 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}

content.tex Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp · line 5362

Quoted 6 lines
content.tex +3 -0
@@ -5357,6 +5357,9 @@ Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp
   better performance.  This feature indicates whether
   a stronger form of barrier suitable for hardware
   devices is necessary.
+  \item[VIRTIO_F_SR_IOV(37)] This feature indicates that
+  the device supports Single Root I/O Virtualization.
+  Currently only PCI devices support this feature.

I guess the assumption is that all VFs and the PF are of the same type?

Quoted 6 lines

I feel it might be handy down the road to support mixing types. For this reason, to avoid binding a wrong driver to a VF, I propose that all VFs have this bit too, and require that drivers ignore VFs without this bit.

What do you think?

Thinking more about it, I can see how this might interfere with passing VFs through to legacy nested guests. How about reversing it then?

Quoted 8 lines
Quoted 3 lines

Require that drivers MUST NOT negotiate VIRTIO_F_SR_IOV if device does not have an SRIOV capability or is not a PCI device, in particular a VF.

I think driver can accept this feature as long as it's able to handle the SR-IOV capability and there is no need for it to check whether the device has the SR-IOV capability.

So my point is this, VFs themselves do not have
this feature.

Should all of them have it? None of them?
I don't see what use it is to VFs, but maybe
we will come with a use down the road.

I propose we require that
1. drivers ignore this if there is
no SRIOV cap, and

2. that devices do not expose it.

This way if we come up with a use down the road, only new drivers will negotiate it.

Quoted 5 lines

And device should make sure that it won't
offer this feature if it doesn't present this capability. How about changing the driver requirement to:

A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.

This part won't address the issue above.

Quoted 10 lines

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 negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

And say a device without SRIOV cap SHOULD NOT expose this bit.

No problem. How about:

A device SHOULD offer VIRTIO_F_SR_IOV if it presents a PCI SR-IOV capability structure. A device SHOULD NOT offer VIRTIO_F_SR_IOV if it doesn't presents

doesn't present

Quoted 2 lines

a PCI SR-IOV
capability structure.

Assuming we teach drivers they should ignore it
if it is there without SRIOV, then this last one I'd make MUST NOT.

Quoted 38 lines
Quoted 38 lines
Quoted 38 lines

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

Quoted 13 lines
content.tex +4 -0
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
@@ -5376,6 +5379,11 @@ 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.
 
+A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.
+If VIRTIO_F_SR_IOV has been negotiated, a driver can
+enable virtual functions through the device's PCI SR-IOV
+capability structure.

I feel the last sentence isn't clear enough. How about

a driver MUST negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 14 lines
content.tex +4 -0
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5392,6 +5400,9 @@ 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 presents a PCI
+SR-IOV capability structure.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
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
#6 lore raw
Quoted 75 lines · Michael S. Tsirkin
Quoted 74 lines · Tiwei Bie
Quoted 72 lines · Michael S. Tsirkin
Quoted 57 lines · Michael S. Tsirkin
Quoted 47 lines · Tiwei Bie

Allocate a feature bit for virtio devices which support SR-IOV.

---
More details can be found from this thread:
https://patchwork.kernel.org/patch/10285541/

This patch needs below patch applied first:
https://github.com/oasis-tcs/virtio-spec/issues/10
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00046.html

v2 -> v3:
- Improve the wording (Cornelia);

v1 -> v2:
- s/Reserve/Allocate/ (MST);
- Add a Fixes tag (MST);
- Be more explicit in driver requirement (MST);
- Remove the "device MAY fail" description (MST);
- Rebase on IO_BARRIER patch;

RFC -> v1:
- Mention PCI in the description (Cornelia);

 content.tex | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
content.tex +2 -2
index 95c243f..e9e6f9a 100644
@@ -95,10 +95,10 @@ Feature bits are allocated as follows:
 \begin{description}
 \item[0 to 23] Feature bits for the specific device type
 
-\item[24 to 36] Feature bits reserved for extensions to the queue and
+\item[24 to 37] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[37 and above] Feature bits reserved for future extensions.
+\item[38 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}

content.tex Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp · line 5362

Quoted 6 lines
content.tex +3 -0
@@ -5357,6 +5357,9 @@ Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp
   better performance.  This feature indicates whether
   a stronger form of barrier suitable for hardware
   devices is necessary.
+  \item[VIRTIO_F_SR_IOV(37)] This feature indicates that
+  the device supports Single Root I/O Virtualization.
+  Currently only PCI devices support this feature.

I guess the assumption is that all VFs and the PF are of the same type?

Quoted 6 lines

I feel it might be handy down the road to support mixing types. For this reason, to avoid binding a wrong driver to a VF, I propose that all VFs have this bit too, and require that drivers ignore VFs without this bit.

What do you think?

Thinking more about it, I can see how this might interfere with passing VFs through to legacy nested guests. How about reversing it then?

Require that drivers MUST NOT negotiate VIRTIO_F_SR_IOV if device does not have an SRIOV capability or is not a PCI device, in particular a VF.

Quoted 7 lines
Quoted 4 lines

I think driver can accept this feature as long as it's able to handle the SR-IOV capability and there is no need for it to check whether the device has the SR-IOV capability.

So my point is this, VFs themselves do not have
this feature.

Yeah. I also think VFs shouldn't present this feature.

Quoted 5 lines

Should all of them have it? None of them?
I don't see what use it is to VFs, but maybe
we will come with a use down the road.

Quoted 8 lines

I propose we require that
1. drivers ignore this if there is
no SRIOV cap, and

2. that devices do not expose it.

This way if we come up with a use down the road, only new drivers will negotiate it.

I got your point now. Thanks!

How about:

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 setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 25 lines
Quoted 8 lines

And device should make sure that it won't
offer this feature if it doesn't present this capability. How about changing the driver requirement to:

A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.

This part won't address the issue above.

Quoted 13 lines

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 negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 3 lines

And say a device without SRIOV cap SHOULD NOT expose this bit.

Quoted 7 lines
Quoted 5 lines

No problem. How about:

A device SHOULD offer VIRTIO_F_SR_IOV if it presents a PCI SR-IOV capability structure. A device SHOULD NOT offer VIRTIO_F_SR_IOV if it doesn't presents

doesn't present

Right. Thanks for catching it!

Quoted 6 lines
Quoted 3 lines

a PCI SR-IOV
capability structure.

Assuming we teach drivers they should ignore it
if it is there without SRIOV, then this last one I'd make MUST NOT.

Okay, how about

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.

Best regards,
Tiwei Bie

Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 7 lines
content.tex +0 -0
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}

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

Quoted 7 lines
content.tex +4 -0
@@ -5376,6 +5379,11 @@ 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.
 
+A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.
+If VIRTIO_F_SR_IOV has been negotiated, a driver can
+enable virtual functions through the device's PCI SR-IOV
+capability structure.

I feel the last sentence isn't clear enough. How about

a driver MUST negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 21 lines
content.tex +4 -0
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5392,6 +5400,9 @@ 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 presents a PCI
+SR-IOV capability structure.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:
Signature · 2 lines
-- 
2.17.0
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 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]

#7 lore raw
Quoted 104 lines · Tiwei Bie
Quoted 75 lines · Michael S. Tsirkin
Quoted 74 lines · Tiwei Bie
Quoted 72 lines · Michael S. Tsirkin
Quoted 57 lines · Michael S. Tsirkin
Quoted 47 lines · Tiwei Bie

Allocate a feature bit for virtio devices which support SR-IOV.

---
More details can be found from this thread:
https://patchwork.kernel.org/patch/10285541/

This patch needs below patch applied first:
https://github.com/oasis-tcs/virtio-spec/issues/10
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00046.html

v2 -> v3:
- Improve the wording (Cornelia);

v1 -> v2:
- s/Reserve/Allocate/ (MST);
- Add a Fixes tag (MST);
- Be more explicit in driver requirement (MST);
- Remove the "device MAY fail" description (MST);
- Rebase on IO_BARRIER patch;

RFC -> v1:
- Mention PCI in the description (Cornelia);

 content.tex | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
content.tex +2 -2
index 95c243f..e9e6f9a 100644
@@ -95,10 +95,10 @@ Feature bits are allocated as follows:
 \begin{description}
 \item[0 to 23] Feature bits for the specific device type
 
-\item[24 to 36] Feature bits reserved for extensions to the queue and
+\item[24 to 37] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[37 and above] Feature bits reserved for future extensions.
+\item[38 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}

content.tex Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp · line 5362

Quoted 6 lines
content.tex +3 -0
@@ -5357,6 +5357,9 @@ Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Supp
   better performance.  This feature indicates whether
   a stronger form of barrier suitable for hardware
   devices is necessary.
+  \item[VIRTIO_F_SR_IOV(37)] This feature indicates that
+  the device supports Single Root I/O Virtualization.
+  Currently only PCI devices support this feature.

I guess the assumption is that all VFs and the PF are of the same type?

Quoted 6 lines

I feel it might be handy down the road to support mixing types. For this reason, to avoid binding a wrong driver to a VF, I propose that all VFs have this bit too, and require that drivers ignore VFs without this bit.

What do you think?

Thinking more about it, I can see how this might interfere with passing VFs through to legacy nested guests. How about reversing it then?

Require that drivers MUST NOT negotiate VIRTIO_F_SR_IOV if device does not have an SRIOV capability or is not a PCI device, in particular a VF.

Quoted 7 lines
Quoted 4 lines

I think driver can accept this feature as long as it's able to handle the SR-IOV capability and there is no need for it to check whether the device has the SR-IOV capability.

So my point is this, VFs themselves do not have
this feature.

Yeah. I also think VFs shouldn't present this feature.

Quoted 5 lines

Should all of them have it? None of them?
I don't see what use it is to VFs, but maybe
we will come with a use down the road.

Quoted 8 lines

I propose we require that
1. drivers ignore this if there is
no SRIOV cap, and

2. that devices do not expose it.

This way if we come up with a use down the road, only new drivers will negotiate it.

I got your point now. Thanks!

How about:

Quoted 9 lines

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 setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Sounds good.

Quoted 43 lines
Quoted 26 lines
Quoted 9 lines

And device should make sure that it won't
offer this feature if it doesn't present this capability. How about changing the driver requirement to:

A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.

This part won't address the issue above.

Quoted 13 lines

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 negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 3 lines

And say a device without SRIOV cap SHOULD NOT expose this bit.

Quoted 7 lines
Quoted 5 lines

No problem. How about:

A device SHOULD offer VIRTIO_F_SR_IOV if it presents a PCI SR-IOV capability structure. A device SHOULD NOT offer VIRTIO_F_SR_IOV if it doesn't presents

doesn't present

Right. Thanks for catching it!

Quoted 6 lines
Quoted 3 lines

a PCI SR-IOV
capability structure.

Assuming we teach drivers they should ignore it
if it is there without SRIOV, then this last one I'd make MUST NOT.

Quoted 8 lines

Okay, how about

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.

Best regards,
Tiwei Bie

Sounds good.

Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 7 lines
content.tex +0 -0
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}

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

Quoted 7 lines
content.tex +4 -0
@@ -5376,6 +5379,11 @@ 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.
 
+A driver SHOULD accept VIRTIO_F_SR_IOV if it is offered.
+If VIRTIO_F_SR_IOV has been negotiated, a driver can
+enable virtual functions through the device's PCI SR-IOV
+capability structure.

I feel the last sentence isn't clear enough. How about

a driver MUST negotiate VIRTIO_F_SR_IOV and complete the feature negotiation (including setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Quoted 21 lines
content.tex +4 -0
+
 \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
 
 A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further
@@ -5392,6 +5400,9 @@ 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 presents a PCI
+SR-IOV capability structure.
+
 \section{Legacy Interface: Reserved Feature Bits}\label{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 
 Transitional devices MAY offer the following:
Signature · 2 lines
-- 
2.17.0
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 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]

author
#8 lore raw
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Tiwei Bie
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Tiwei Bie
Quoted 2 lines · Michael S. Tsirkin
Quoted 1 line · Michael S. Tsirkin

On Tue, May 22, 2018 at 06:26:15PM +0800, Tiwei Bie wrote:

[...]

Quoted 36 lines
Quoted 24 lines
Quoted 3 lines

So my point is this, VFs themselves do not have this feature.

Yeah. I also think VFs shouldn't present this feature.

Quoted 5 lines

Should all of them have it? None of them? I don't see what use it is to VFs, but maybe we will come with a use down the road.

Quoted 8 lines

I propose we require that
1. drivers ignore this if there is
no SRIOV cap, and

2. that devices do not expose it.

This way if we come up with a use down the road, only new drivers will negotiate it.

I got your point now. Thanks!

How about:

Quoted 9 lines

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 setting the DRIVER_OK \field{status} bit) before enabling virtual functions through the device's PCI SR-IOV capability structure.

Sounds good.

[...]

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Assuming we teach drivers they should ignore it
if it is there without SRIOV, then this last one I'd make MUST NOT.

Okay, how about

Quoted 8 lines
Quoted 6 lines

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.

Best regards,
Tiwei Bie

Sounds good.

Thanks a lot! I'll send a new version.

Best regards,
Tiwei Bie

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