Skip to contentSkip to conversation

Introduce transitional mmr pci device

PATCH In review Parav Pandit 8 participants 200 messages Mar 30, 2023 – May 21, 2023 1 message not in the archive Page 2 of 2

lore
Share & tools
lore
#155 lore raw

PATCH 11/11 conformance: Add transitional MMR interface conformance

In reply to Parav Pandit

Add conformance section for the transitional MMR interface.

Basically transitional MMR interface follows same requirements as that of the transitional device with few exceptions to it. List such delta requirements in the conformance section.

---
 conformance.tex      |  8 ++++++--
 tmmr-conformance.tex | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 tmmr-conformance.tex
conformance.tex +6 -2
index ccbc9bf..4cccba7 100644
@@ -11,7 +11,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 
 Conformance targets:
 \begin{description}
-\item[Driver] A driver MUST conform to four conformance clauses:
+\item[Driver] A driver MUST conform to five conformance clauses:
   \begin{itemize}
     \item Clause \ref{sec:Conformance / Driver Conformance}.
     \item One of clauses \ref{sec:Conformance / Driver Conformance / PCI Driver Conformance}, \ref{sec:Conformance / Driver Conformance / MMIO Driver Conformance} or \ref{sec:Conformance / Driver Conformance / Channel I/O Driver Conformance}.
@@ -36,8 +36,9 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \ref{sec:Conformance / Driver Conformance / PMEM Driver Conformance}.
 
     \item Clause \ref{sec:Conformance / Legacy Interface: Transitional Device and Transitional Driver Conformance}.
+    \item Clause \ref{sec:Conformance / Transitional MMR Interface: Transitional MMR Device and Transitional MMR Driver Conformance}.
   \end{itemize}
-\item[Device] A device MUST conform to four conformance clauses:
+\item[Device] A device MUST conform to five conformance clauses:
   \begin{itemize}
     \item Clause \ref{sec:Conformance / Device Conformance}.
     \item One of clauses \ref{sec:Conformance / Device Conformance / PCI Device Conformance}, \ref{sec:Conformance / Device Conformance / MMIO Device Conformance} or \ref{sec:Conformance / Device Conformance / Channel I/O Device Conformance}.
@@ -63,6 +64,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \ref{sec:Conformance / Device Conformance / PMEM Device Conformance}.
 
     \item Clause \ref{sec:Conformance / Legacy Interface: Transitional Device and Transitional Driver Conformance}.
+    \item Clause \ref{sec:Conformance / Transitional MMR Interface: Transitional MMR Device and Transitional MMR Driver Conformance}.
   \end{itemize}
 \end{description}
 
@@ -294,3 +296,5 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \item Section \ref{sec:Device Types / SCSI Host Device / Device Operation / Device Operation: eventq / Legacy Interface: Device Operation: eventq}
 \item Section \ref{sec:Reserved Feature Bits / Legacy Interface: Reserved Feature Bits}
 \end{itemize}
+
+\input{tmmr-conformance.tex}
tmmr-conformance.tex new file +27 -0
new file mode 100644
index 0000000..ad3489b
@@ -0,0 +1,27 @@
+\conformance{\section}{Transitional MMR Interface: Transitional MMR Device and Transitional MMR Driver Conformance}\label{sec:Conformance / Transitional MMR Interface: Transitional MMR Device and Transitional MMR Driver Conformance}
+
+An implementation MAY choose to implement OPTIONAL support for the
+transitional MMR interface, by conforming to all of the MUST
+level requirements for the transitional MMR interface for the
+transitional devices and drivers.
+
+The requirements for the transitional MMR interface follows all
+the legacy interface requirements listed in section
+\ref{sec:Conformance / Legacy Interface: Transitional Device and
+Transitional Driver Conformance} with the following exceptions.
+
+Following requirements MUST NOT be implemented:
+
+\begin{itemize}
+\item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Discovery / Legacy Interfaces: A Note on PCI Device Discovery}
+\item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / Virtio Structure PCI Capabilities / Common configuration structure layout / Legacy Interfaces: A Note on Configuration Registers}
+\end{itemize}
+
+Instead following requirements MUST be implemented:
+
+\begin{itemize}
+\item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Discovery / Transitional MMR Interface: A Note on PCI Device Discovery}
+\item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / Virtio Structure PCI Capabilities / Common configuration structure layout / Transitional MMR Interface: A Note on Configuration Registers}
+\item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / Virtio Structure PCI Capabilities / Notification capability / Transitional MMR Interface}
+\item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / Virtio Structure PCI Capabilities / Transitional MMR Interface: Legacy Memory Mapped Configuration Registers Capability}
+\end{itemize}
Signature · 18 lines
2.26.2


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/
#156 lore raw
In reply to Parav Pandit
Quoted 52 lines · Parav Pandit

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device. It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

Such transitional MMR devices will be used at the scale of thousands of devices using PCI SR-IOV and/or future scalable virtualization technology to provide backward compatibility (for legacy devices) and also future compatibility with new features.

Usecase:
--------
1. A hypervisor/system needs to provide transitional virtio devices to the guest VM at scale of thousands, typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

Motivation/Background:
----------------------
The existing transitional PCI device is missing support for PCI SR-IOV based devices. Currently it does not work beyond PCI PF, or as software emulated device in reality. It currently has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from the physical-memory address space. The I/O address space consists of 64K individually addressable 8-bit I/O ports, numbered 0 through FFFFH.

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be aligned to a 4 KB boundary.

[d] I/O region accesses at PCI system level is slow as they are non-posted operations in PCIe fabric.

Quoted 6 lines

The usecase requirements and limitations above can be solved by extending the transitional device, mapping legacy and device specific configuration registers in a memory PCI BAR instead of using non composable I/O region.

Please review.

So as you explain in a lot of detail above, IO support is going away, so the transitional device can no longer be used through the legacy interface.

OK but this does not answer the following question:
since a legacy driver can not bind to this type of MMR device, a new driver is needed anyway so
why not implement a modern driver?

I think we discussed this at some call and it made some kind of sense. Unfortunately it has been a while and I am not sure I remember the detail, so I can no longer say for sure whether this proposal is fit for the purpose. Here is what I vaguely remember:

A valid use-case is an emulation layer (e.g. a hypervisor) translating a legacy driver I/O accesses to MMIO. Ideally layering this emulation on top of a modern device would work ok
but there are several things making this approach problematic. One is a different virtio net header size between legacy and modern driver. Another is use of control VQ by modern where legacy used IO writes. In both cases the different would require the emulation getting involved on the DMA path, in particular somehow finding private addresses for communication between emulation and modern device.

Does above summarize it reasonably?

And if yes, would an alternative approach of adding legacy config support to transport vq work well? I can not say I thought about this deeply so maybe there's some problem, or maybe it's a worse approach - could you comment on this? It looks like this could be a smaller change, but maybe it isn't? Did you consider this option?

More review later.

Quoted 136 lines

Patch summary:
--------------
patch 1 to 5 prepares the spec
patch 6 to 11 defines transitional mmr device

patch-1 uses lower case alphabets to name device id patch-2 move transitional device id in legay section along with
revision id
patch-3 splits legacy feature bits description from device id patch-4 rename and moves virtio config registers next to 1.x
registers section
patch-5 Adds missing helper verb in terminology definitions patch-6 introduces transitional mmr device
patch-7 introduces transitional mmr device pci device ids patch-8 introduces virtio extended pci capability patch-9 describes new pci capability to locate legacy mmr
registers
patch-10 extended usage of driver notification capability for
the transitional mmr device
patch-11 adds conformance section of the transitional mmr device

This design and details further described below.

Design:
-------
Below picture captures the main small difference between current transitional PCI SR-IOV VF and transitional MMR SR-IOV VF.

+------------------+ +--------------------+ +--------------------+
|virtio 1.x        | |Transitional        | |Transitional        |
|SRIOV VF          | |SRIOV VF            | |MMR SRIOV VF        |
|                  | |                    | |                    |
++---------------+ | ++---------------+   | ++---------------+   |
||dev_id =       | | ||dev_id =       |   | ||dev_id =       |   |
||{0x1040-0x106C}| | ||{0x1000-0x103f}|   | ||{0x10f9-0x10ff}|   |
|+---------------+ | |+---------------+   | |+---------------+   |
|                  | |                    | |                    |
|+------------+    | |+------------+      | |+-----------------+ |
||Memory BAR  |    | ||Memory BAR  |      | ||Memory BAR       | |
|+------------+    | |+------------+      | ||                 | |
|                  | |                    | || +--------------+| |
|                  | |+-----------------+ | || |legacy virtio || |
|                  | ||IOBAR impossible | | || |+ dev cfg     || |
|                  | |+-----------------+ | || |registers     || |
|                  | |                    | || +--------------+| |
|                  | |                    | |+-----------------+ |
+------------------+ +--------------------+ +--------------------+

Here transitional MMR SR-IOV VF has legacy configuration and legacy device specific registers located at an offset in the memory region BAR.

A memory region can be dedicated at BAR0 or it can be in an existing BAR, allowing flexibility when implementing support in a hardware device.

Transitional MMR SR-IOV VFs use a distinct device ID range to that of existing virtio SR-IOV VFs to allow flexibility in driver binding.

A more zoom-in version of transitional MMR SR-IOV device shows that the location of the legacy registers are discovered by the driver using a new capability.

+------------------------------+
|Transitional                  |
|MMR SRIOV VF                  |
|                              |
++---------------+             |
||dev_id =       |             |
||{0x10f9-0x10ff}|             |
|+---------------+             |
|                              |
++--------------------+        |
|| PCIe ext cap = 0xB |        |
|| cfg_type = 10      |        |
|| offset   = 0x1000  |        |
|| bar      = N {0..5}|        |
|+--|-----------------+        |
|   |                          |
|   |                          |
|   |    +-------------------+ |
|   |    | Memory BAR = A    | |
|   |    |                   | |
|   +------>+--------------+ | |
|        |  |legacy virtio | | |
|        |  |+ dev cfg     | | |
|        |  |registers     | | |
|        |  +--------------+ | |
|        +-----------------+ | |
+------------------------------+

Software usage:
---------------
Transitional MMR device can be used by multiple ways.

1. The most common way to use and map to the guest VM is by using vfio driver framework in Linux kernel.

                +----------------------+
                |pci_dev_id = 0x100X   |
+---------------|pci_rev_id = 0x0      |-----+
|vfio device    |BAR0 = I/O region     |     |
|               |Other attributes      |     |
|               +----------------------+     |
|                                            |
+   +--------------+     +-----------------+ |
|   |I/O to memory |     | Other vfio      | |
|   |rd/wr mapper  |     | functionalities | |
|   +--------------+     +-----------------+ |
|                                            |
+-------------------+------------------------+
                    |
       +------------+-----------------+
       |         Transitional         |
       |         MMR SRIOV VF         |
       +------------------------------+

2. Virtio pci driver to bind to the listed device id and use it as native device in the host.

3. Use it in a light weight hypervisor to run bare-metal OS.

Parav Pandit (11):
transport-pci: Use lowecase alphabets
transport-pci: Move transitional device id to legacy section
transport-pci: Split notes of PCI Device Layout
transport-pci: Rename and move legacy PCI Device layout section
introduction: Add missing helping verb
introduction: Introduce transitional MMR interface
transport-pci: Introduce transitional MMR device id
transport-pci: Introduce virtio extended capability
transport-pci: Describe PCI MMR dev config registers
transport-pci: Use driver notification PCI capability
conformance: Add transitional MMR interface conformance

Quoted 9 lines
 conformance.tex      |  11 +-
 introduction.tex     |  34 +++-
 tmmr-conformance.tex |  27 +++
 transport-pci.tex    | 405 ++++++++++++++++++++++++++++++-------------
 4 files changed, 354 insertions(+), 123 deletions(-)
 create mode 100644 tmmr-conformance.tex
Signature · 1 line
2.26.2

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

#157 lore raw
Quoted 6 lines · Michael S. Tsirkin

OK but this does not answer the following question:
since a legacy driver can not bind to this type of MMR device, a new driver is needed anyway so
why not implement a modern driver?

Not sure I follow "implement a modern driver".
If you mean hypervisor driver over modern driver, than yes, you captured those two problems below.

More reply below.

Quoted 2 lines

I think we discussed this at some call and it made some kind of sense.

Yep.

Quoted 6 lines

Unfortunately it has been a while and I am not sure I remember the detail, so I can no longer say for sure whether this proposal is fit for the purpose. Here is what I vaguely remember:

A valid use-case is an emulation layer (e.g. a hypervisor) translating a legacy driver I/O accesses to MMIO.

Yes.

Quoted 3 lines

Ideally layering this emulation
on top of a modern device would work ok
but there are several things making this approach problematic.

Right.

Quoted 7 lines

One is a different virtio net header size between legacy and modern driver. Another is use of control VQ by modern where legacy used IO writes. In both cases the different would require the emulation getting involved on the DMA path, in particular somehow finding private addresses for communication between emulation and modern device.

Both of these issues are resolved by this proposal.

Quoted 6 lines

Does above summarize it reasonably?

And if yes, would an alternative approach of adding legacy config support to transport vq work well?

VF is supplying the legacy config region (subset of 1.x) in memory mapped area.

A transport vq on the parent PF is yet another option for legacy register emulation. I think latency wise it will be a lot more higher, though it is not of lot of importance.

The good part of transport vq is, device reset is better as it can act as slow operation.

Given that device already implements part of registers in 1.x memory mapped area, it is reasonable for device to provide similar registers via memory map. (legacy is subset, no new addition).

Quoted 4 lines

I can not say I thought about this
deeply so maybe there's some problem, or maybe it's a worse approach - could you comment on this? It looks like this could be a smaller change, but maybe it isn't? Did you consider this option?

We can possibly let both the options open for device vendors to implement.

Change wise transport VQ is fairly big addition for both hypervisor driver and also for the device.

Quoted 4 lines

More review later.

ok.

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/

#158 lore raw
Quoted 9 lines · Parav Pandit
Quoted 4 lines

I can not say I thought about this
deeply so maybe there's some problem, or maybe it's a worse approach - could you comment on this? It looks like this could be a smaller change, but maybe it isn't? Did you consider this option?

We can possibly let both the options open for device vendors to implement.

Change wise transport VQ is fairly big addition for both hypervisor driver and also for the device.

OTOH it is presumably required for scalability anyway, no? And presumably it can all be done in firmware ... Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Signature · 18 lines
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/
#159 lore raw
Quoted 11 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 10:53 AM

Quoted 5 lines · Parav Pandit
Quoted 4 lines

I can not say I thought about this
deeply so maybe there's some problem, or maybe it's a worse approach
- could you comment on this? It looks like this could be a smaller change, but maybe it isn't? Did you consider this option?

Quoted 6 lines
Quoted 4 lines

We can possibly let both the options open for device vendors to implement.

Change wise transport VQ is fairly big addition for both hypervisor driver and also for the device.

OTOH it is presumably required for scalability anyway, no?

No.
Most new generation SIOV and SR-IOV devices operate without any para-virtualization.

Quoted 4 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.
Transport VQ has very high latency and DMA overheads for 2 to 4 bytes read/write.

And before discussing "why not that approach", lets finish reviewing "this approach" first.

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/

#160 lore raw
Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 10:53 AM

Quoted 5 lines · Parav Pandit
Quoted 4 lines

I can not say I thought about this
deeply so maybe there's some problem, or maybe it's a worse approach
- could you comment on this? It looks like this could be a smaller change, but maybe it isn't? Did you consider this option?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

We can possibly let both the options open for device vendors to implement.

Change wise transport VQ is fairly big addition for both hypervisor driver and also for the device.

OTOH it is presumably required for scalability anyway, no?

No.
Most new generation SIOV and SR-IOV devices operate without any para-virtualization.

Don't see the connection to PV. You need an emulation layer in the host if you want to run legacy guests. Looks like it could do transport vq just as well.

Quoted 5 lines
Quoted 4 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Quoted 1 line

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes read/write.

How many of these 2 byte accesses trigger from a typical guest?

Quoted 1 line

And before discussing "why not that approach", lets finish reviewing "this approach" first.

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Signature · 18 lines
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/
#161 lore raw
Quoted 5 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 11:07 AM

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

OTOH it is presumably required for scalability anyway, no?

No.
Most new generation SIOV and SR-IOV devices operate without any para-

virtualization.

Don't see the connection to PV. You need an emulation layer in the host if you want to run legacy guests. Looks like it could do transport vq just as well.

Transport vq for legacy MMR purpose seems fine with its latency and DMA overheads.
Your question was about "scalability".
After your latest response, I am unclear what "scalability" means.
Do you mean saving the register space in the PCI device?
If yes, than, no for legacy guests for scalability it is not required, because the legacy register is subset of 1.x.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Do not follow the question.
The proposed series will be implemented as PCI SR-IOV devices using MMR spec.

Quoted 5 lines
Quoted 1 line

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes

read/write.

How many of these 2 byte accesses trigger from a typical guest?

Mostly during the VM boot time. 20 to 40 registers read write access.

Quoted 5 lines
Quoted 1 line

And before discussing "why not that approach", lets finish reviewing "this

approach" first.

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Sure, so lets finish the review of current proposal details.
At the moment
a. I don't see any visible gain of transport VQ other than device reset part I explained. b. it can be a way with high latency, DMA overheads on the virtqueue for read/writes for small access.

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/

#162 lore raw
Quoted 10 lines · Parav Pandit
Quoted 10 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 11:07 AM

Quoted 3 lines
Quoted 1 line

OTOH it is presumably required for scalability anyway, no?

No.
Most new generation SIOV and SR-IOV devices operate without any para-

virtualization.

Quoted 7 lines
Quoted 3 lines

Don't see the connection to PV. You need an emulation layer in the host if you want to run legacy guests. Looks like it could do transport vq just as well.

Transport vq for legacy MMR purpose seems fine with its latency and DMA overheads. Your question was about "scalability".
After your latest response, I am unclear what "scalability" means.
Do you mean saving the register space in the PCI device?

yes that's how you used scalability in the past.

Quoted 1 line

If yes, than, no for legacy guests for scalability it is not required, because the legacy register is subset of 1.x.

Weird. what does guest being legacy have to do with a wish to save registers on the host hardware? You don't have so many legacy guests as modern guests? Why?

Quoted 12 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Do not follow the question.
The proposed series will be implemented as PCI SR-IOV devices using MMR spec.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes

read/write.

How many of these 2 byte accesses trigger from a typical guest?

Mostly during the VM boot time. 20 to 40 registers read write access.

That is not a lot! How long does a DMA operation take then?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

And before discussing "why not that approach", lets finish reviewing "this

approach" first.

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Sure, so lets finish the review of current proposal details.
At the moment
a. I don't see any visible gain of transport VQ other than device reset part I explained.

For example, we do not need a new range of device IDs and existing drivers can bind on the host.

Quoted 1 line

b. it can be a way with high latency, DMA overheads on the virtqueue for read/writes for small access.

numbers?

Signature · 18 lines
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/
#163 lore raw
Quoted 53 lines · Michael S. Tsirkin
Quoted 10 lines · Parav Pandit
Quoted 10 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 11:07 AM

Quoted 3 lines
Quoted 1 line

OTOH it is presumably required for scalability anyway, no?

No.
Most new generation SIOV and SR-IOV devices operate without any para-

virtualization.

Quoted 7 lines
Quoted 3 lines

Don't see the connection to PV. You need an emulation layer in the host if you want to run legacy guests. Looks like it could do transport vq just as well.

Transport vq for legacy MMR purpose seems fine with its latency and DMA overheads. Your question was about "scalability".
After your latest response, I am unclear what "scalability" means.
Do you mean saving the register space in the PCI device?

yes that's how you used scalability in the past.

Quoted 1 line

If yes, than, no for legacy guests for scalability it is not required, because the legacy register is subset of 1.x.

Weird. what does guest being legacy have to do with a wish to save registers on the host hardware? You don't have so many legacy guests as modern guests? Why?

Quoted 12 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Do not follow the question.
The proposed series will be implemented as PCI SR-IOV devices using MMR spec.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes

read/write.

How many of these 2 byte accesses trigger from a typical guest?

Mostly during the VM boot time. 20 to 40 registers read write access.

That is not a lot! How long does a DMA operation take then?

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

And before discussing "why not that approach", lets finish reviewing "this

approach" first.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Sure, so lets finish the review of current proposal details.
At the moment
a. I don't see any visible gain of transport VQ other than device reset part I explained.

For example, we do not need a new range of device IDs and existing drivers can bind on the host.

Another is that we can actually work around legacy bugs in the hypervisor. For example, atomicity and alignment bugs do not exist under DMA. Consider MAC field, writeable in legacy. Problem this write is not atomic, so there is a window where MAC is corrupted. If you do MMIO then you just have to copy this bug. If you do DMA then hypervisor can buffer all of MAC and send to device in one go.

Quoted 6 lines
Quoted 1 line

b. it can be a way with high latency, DMA overheads on the virtqueue for read/writes for small access.

numbers?

Signature · 1 line
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/

#164 lore raw
Quoted 11 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 11:34 AM

Another is that we can actually work around legacy bugs in the hypervisor. For example, atomicity and alignment bugs do not exist under DMA. Consider MAC field, writeable in legacy. Problem this write is not atomic, so there is a window where MAC is corrupted. If you do MMIO then you just have to copy this bug. If you do DMA then hypervisor can buffer all of MAC and send to device in one go.

I am familiar with this bug.
Users feedback that we received so far has kernels with driver support that uses CVQ for setting the mac address on legacy device. So, it may help but not super important.

Also, if I recollect correctly, the mac address is configuring bit early in if-scripts sequence before bringing up the interface. So, haven't seen real issue around it.

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/

#165 lore raw
Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 11:34 AM

Another is that we can actually work around legacy bugs in the hypervisor. For example, atomicity and alignment bugs do not exist under DMA. Consider MAC field, writeable in legacy. Problem this write is not atomic, so there is a window where MAC is corrupted. If you do MMIO then you just have to copy this bug. If you do DMA then hypervisor can buffer all of MAC and send to device in one go.

Quoted 6 lines

I am familiar with this bug.
Users feedback that we received so far has kernels with driver support that uses CVQ for setting the mac address on legacy device. So, it may help but not super important.

Also, if I recollect correctly, the mac address is configuring bit early in if-scripts sequence before bringing up the interface. So, haven't seen real issue around it.

It's an example, there are other bugs in legacy interfaces.

Take inability to decline feature negotiation as an example. With transport vq we can fail at transport level and hypervisor can decide what to do, such as stopping guest or unplugging device, etc.

So something like a vq would be a step up. I would like to understand the performance angle though. What you describe is pretty bad.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#166 lore raw
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 11:34 AM

Another is that we can actually work around legacy bugs in the hypervisor. For example, atomicity and alignment bugs do not exist under DMA. Consider MAC field, writeable in legacy. Problem this write is not atomic, so there is a window where MAC is corrupted. If you do MMIO then you just have to copy this bug. If you do DMA then hypervisor can buffer all of MAC and send to device in one go.

Quoted 9 lines
Quoted 6 lines

I am familiar with this bug.
Users feedback that we received so far has kernels with driver support that uses CVQ for setting the mac address on legacy device. So, it may help but not super important.

Also, if I recollect correctly, the mac address is configuring bit early in if-scripts sequence before bringing up the interface. So, haven't seen real issue around it.

It's an example, there are other bugs in legacy interfaces.

The intent is to provide backward compatibility to the legacy interface, and not really fixing the legacy interface in itself as it may break the legacy itself.

Quoted 1 line

Take inability to decline feature negotiation as an example.

Legacy driver would do this anyway. It would expect certain flow to work that has been worked for it when it was working over previous sw-hypervisor.

Hypervisor attempting to fail what was working before will not help.

Quoted 9 lines

With transport vq we can fail at transport level and hypervisor can decide what to do, such as stopping guest or unplugging device, etc.

So something like a vq would be a step up. I would like to understand the performance angle though. What you describe is pretty bad.

Do you mean latency is bad or the description?

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

#167 lore raw
Quoted 5 lines · Parav Pandit
Quoted 4 lines

So something like a vq would be a step up. I would like to understand the performance angle though. What you describe is pretty bad.

Do you mean latency is bad or the description?

I don't know. We need admin vq and transport vq to work. You describe latency numbers that make both unworkable. I am interested in fixing that somehow, since it's a blocker.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#168 lore raw
In reply to Michael S. Tsirkin
Quoted 5 lines

From: [email protected] <[email protected] open.org> On Behalf Of Michael S. Tsirkin

Quoted 8 lines
Quoted 1 line

Transport vq for legacy MMR purpose seems fine with its latency and DMA

overheads.

Quoted 3 lines

Your question was about "scalability".
After your latest response, I am unclear what "scalability" means. Do you mean saving the register space in the PCI device?

yes that's how you used scalability in the past.

Ok. I am aligned.

Quoted 5 lines
Quoted 1 line

If yes, than, no for legacy guests for scalability it is not required, because the

legacy register is subset of 1.x.

Weird. what does guest being legacy have to do with a wish to save registers on the host hardware?

Because legacy has subset of the registers of 1.x. So no new registers additional expected on legacy side.

Quoted 3 lines

You don't have so many legacy guests as modern
guests? Why?

This isn't true.

There is a trade-off, upto certain N, MMR based register access is fine.
This is because 1.x is exposing super set of registers of legacy.
Beyond a certain point device will have difficulty in doing MMR for legacy and 1.x.
At that point, legacy over tvq can be better scale but with lot higher latency order of magnitude higher compare to MMR. If tvq being the only transport for these registers access, it would hurt at lower scale too, due the primary nature of non_register access. And scale is relative from device to device.

Quoted 29 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Do not follow the question.
The proposed series will be implemented as PCI SR-IOV devices using MMR

spec.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes

read/write.

How many of these 2 byte accesses trigger from a typical guest?

Mostly during the VM boot time. 20 to 40 registers read write access.

That is not a lot! How long does a DMA operation take then?

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

And before discussing "why not that approach", lets finish reviewing "this

approach" first.

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Quoted 8 lines
Quoted 3 lines

Sure, so lets finish the review of current proposal details.
At the moment
a. I don't see any visible gain of transport VQ other than device reset part I

explained.

For example, we do not need a new range of device IDs and existing drivers can bind on the host.

So, unlikely due to already discussed limitation of feature negotiation. Existing transitional driver would also look for an IOBAR being second limitation.

Quoted 4 lines
Quoted 1 line

b. it can be a way with high latency, DMA overheads on the virtqueue for

read/writes for small access.

numbers?

It depends on the implementation, but at minimum, writes and reads can pay order of magnitude higher in 10 msec range.

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/

#169 lore raw
Quoted 25 lines · Parav Pandit
Quoted 5 lines

From: [email protected] <[email protected] open.org> On Behalf Of Michael S. Tsirkin

Quoted 8 lines
Quoted 1 line

Transport vq for legacy MMR purpose seems fine with its latency and DMA

overheads.

Quoted 3 lines

Your question was about "scalability".
After your latest response, I am unclear what "scalability" means. Do you mean saving the register space in the PCI device?

yes that's how you used scalability in the past.

Ok. I am aligned.

Quoted 5 lines
Quoted 1 line

If yes, than, no for legacy guests for scalability it is not required, because the

legacy register is subset of 1.x.

Weird. what does guest being legacy have to do with a wish to save registers on the host hardware?

Because legacy has subset of the registers of 1.x. So no new registers additional expected on legacy side.

Quoted 3 lines

You don't have so many legacy guests as modern
guests? Why?

Quoted 8 lines

This isn't true.

There is a trade-off, upto certain N, MMR based register access is fine.
This is because 1.x is exposing super set of registers of legacy.
Beyond a certain point device will have difficulty in doing MMR for legacy and 1.x.
At that point, legacy over tvq can be better scale but with lot higher latency order of magnitude higher compare to MMR. If tvq being the only transport for these registers access, it would hurt at lower scale too, due the primary nature of non_register access. And scale is relative from device to device.

Wow! Why an order of magnitide?

Quoted 32 lines
Quoted 32 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Do not follow the question.
The proposed series will be implemented as PCI SR-IOV devices using MMR

spec.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes

read/write.

How many of these 2 byte accesses trigger from a typical guest?

Mostly during the VM boot time. 20 to 40 registers read write access.

That is not a lot! How long does a DMA operation take then?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

And before discussing "why not that approach", lets finish reviewing "this

approach" first.

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Sure, so lets finish the review of current proposal details.
At the moment
a. I don't see any visible gain of transport VQ other than device reset part I

Quoted 7 lines
Quoted 5 lines

explained.

For example, we do not need a new range of device IDs and existing drivers can bind on the host.

So, unlikely due to already discussed limitation of feature negotiation. Existing transitional driver would also look for an IOBAR being second limitation.

Some confusion here.
If you have a transitional driver you do not need a legacy device.

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

b. it can be a way with high latency, DMA overheads on the virtqueue for

read/writes for small access.

numbers?

It depends on the implementation, but at minimum, writes and reads can pay order of magnitude higher in 10 msec range.

A single VQ roundtrip takes a minimum of 10 milliseconds? This is indeed completely unworkable for transport vq. Points:
- even for memory mapped you have an access take 1 millisecond?
Extremely slow. Why?
- Why is DMA 10x more expensive? I expect it to be 2x more expensive:
Normal read goes cpu -> device -> cpu, DMA does cpu -> device -> memory -> device -> cpu

Reason I am asking is because it is important for transport vq to have a workable design.

But let me guess. Is there a chance that you are talking about an interrupt driven design? *That* is going to be slow though I don't think 10msec, more like 10usec. But I expect transport vq to typically work by (adaptive?) polling mostly avoiding interrupts.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#170 lore raw
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Parav Pandit
Quoted 5 lines

From: [email protected] <[email protected] open.org> On Behalf Of Michael S. Tsirkin

Quoted 8 lines
Quoted 1 line

Transport vq for legacy MMR purpose seems fine with its latency and DMA

overheads.

Quoted 3 lines

Your question was about "scalability".
After your latest response, I am unclear what "scalability" means. Do you mean saving the register space in the PCI device?

yes that's how you used scalability in the past.

Ok. I am aligned.

Quoted 5 lines
Quoted 1 line

If yes, than, no for legacy guests for scalability it is not required, because the

legacy register is subset of 1.x.

Weird. what does guest being legacy have to do with a wish to save registers on the host hardware?

Because legacy has subset of the registers of 1.x. So no new registers additional expected on legacy side.

Quoted 3 lines

You don't have so many legacy guests as modern
guests? Why?

This isn't true.

Quoted 9 lines
Quoted 6 lines

There is a trade-off, upto certain N, MMR based register access is fine.
This is because 1.x is exposing super set of registers of legacy.
Beyond a certain point device will have difficulty in doing MMR for legacy and 1.x.
At that point, legacy over tvq can be better scale but with lot higher latency order of magnitude higher compare to MMR. If tvq being the only transport for these registers access, it would hurt at lower scale too, due the primary nature of non_register access. And scale is relative from device to device.

Wow! Why an order of magnitide?

Because vqs involve DMA operations.
It is left to the device implementation to do it, but a generic wisdom is not implement such slow work in the data path engines. So such register access vqs can/may be through firmware.
Hence it can involve a lot higher latency.

Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Do not follow the question.
The proposed series will be implemented as PCI SR-IOV devices using MMR

spec.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes

read/write.

How many of these 2 byte accesses trigger from a typical guest?

Mostly during the VM boot time. 20 to 40 registers read write access.

That is not a lot! How long does a DMA operation take then?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

And before discussing "why not that approach", lets finish reviewing "this

approach" first.

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Sure, so lets finish the review of current proposal details.
At the moment
a. I don't see any visible gain of transport VQ other than device reset part I

explained.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

For example, we do not need a new range of device IDs and existing drivers can bind on the host.

So, unlikely due to already discussed limitation of feature negotiation. Existing transitional driver would also look for an IOBAR being second limitation.

Some confusion here.

Yes.

Quoted 2 lines

If you have a transitional driver you do not need a legacy device.

IF I understood your thoughts split in two emails,

Your point was "we dont need new range of device IDs for transitional TVQ device because TVQ is new and its optional".

But this transitional TVQ device do not expose IOBAR expected by the existing transitional device, failing the driver load.

Your idea is not very clear.

Quoted 15 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

b. it can be a way with high latency, DMA overheads on the virtqueue for

read/writes for small access.

numbers?

It depends on the implementation, but at minimum, writes and reads can pay order of magnitude higher in 10 msec range.

A single VQ roundtrip takes a minimum of 10 milliseconds? This is indeed completely unworkable for transport vq. Points:
- even for memory mapped you have an access take 1 millisecond?
Extremely slow. Why?
- Why is DMA 10x more expensive? I expect it to be 2x more expensive:
Normal read goes cpu -> device -> cpu, DMA does cpu -> device -> memory -> device -> cpu

Quoted 9 lines

Reason I am asking is because it is important for transport vq to have a workable design.

But let me guess. Is there a chance that you are talking about an interrupt driven design? *That* is going to be slow though I don't think 10msec, more like 10usec. But I expect transport vq to typically work by (adaptive?) polling mostly avoiding interrupts.

No. Interrupt latency is in usec range.
The major latency contributors in msec range can arise from the device side.

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

#171 lore raw
Quoted 37 lines · Parav Pandit
Quoted 34 lines · Michael S. Tsirkin
Quoted 32 lines · Parav Pandit
Quoted 5 lines

From: [email protected] <[email protected] open.org> On Behalf Of Michael S. Tsirkin

Quoted 8 lines
Quoted 1 line

Transport vq for legacy MMR purpose seems fine with its latency and DMA

overheads.

Quoted 3 lines

Your question was about "scalability".
After your latest response, I am unclear what "scalability" means. Do you mean saving the register space in the PCI device?

yes that's how you used scalability in the past.

Ok. I am aligned.

Quoted 5 lines
Quoted 1 line

If yes, than, no for legacy guests for scalability it is not required, because the

legacy register is subset of 1.x.

Weird. what does guest being legacy have to do with a wish to save registers on the host hardware?

Because legacy has subset of the registers of 1.x. So no new registers additional expected on legacy side.

Quoted 3 lines

You don't have so many legacy guests as modern
guests? Why?

This isn't true.

There is a trade-off, upto certain N, MMR based register access is fine.
This is because 1.x is exposing super set of registers of legacy.
Beyond a certain point device will have difficulty in doing MMR for legacy and 1.x.
At that point, legacy over tvq can be better scale but with lot higher latency order of magnitude higher compare to MMR. If tvq being the only transport for these registers access, it would hurt at lower scale too, due the primary nature of non_register access. And scale is relative from device to device.

Quoted 7 lines
Quoted 2 lines

Wow! Why an order of magnitide?

Because vqs involve DMA operations.
It is left to the device implementation to do it, but a generic wisdom is not implement such slow work in the data path engines.
So such register access vqs can/may be through firmware. Hence it can involve a lot higher latency.

Then that wisdom is wrong? tens of microseconds is not workable even for ethtool operations, you are killing boot time.

I frankly don't know, if device vendors are going to interpret "DMA" as "can take insane time" then maybe we need to scrap the whole admin vq idea and make it all memory mapped like Jason wanted, so as not to lead them into temptation?

Quoted 46 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

And presumably it can all be done in firmware ...
Is there actual hardware that can't implement transport vq but is going to implement the mmr spec?

Nvidia and Marvell DPUs implement MMR spec.

Hmm implement it in what sense exactly?

Do not follow the question.
The proposed series will be implemented as PCI SR-IOV devices using MMR

spec.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Transport VQ has very high latency and DMA overheads for 2 to 4 bytes

read/write.

How many of these 2 byte accesses trigger from a typical guest?

Mostly during the VM boot time. 20 to 40 registers read write access.

That is not a lot! How long does a DMA operation take then?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

And before discussing "why not that approach", lets finish reviewing "this

approach" first.

That's a weird way to put it. We don't want so many ways to do legacy if we can help it.

Sure, so lets finish the review of current proposal details.
At the moment
a. I don't see any visible gain of transport VQ other than device reset part I

explained.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

For example, we do not need a new range of device IDs and existing drivers can bind on the host.

So, unlikely due to already discussed limitation of feature negotiation. Existing transitional driver would also look for an IOBAR being second limitation.

Some confusion here.

Yes.

Quoted 2 lines

If you have a transitional driver you do not need a legacy device.

IF I understood your thoughts split in two emails,

Quoted 7 lines

Your point was "we dont need new range of device IDs for transitional TVQ device because TVQ is new and its optional".

But this transitional TVQ device do not expose IOBAR expected by the existing transitional device, failing the driver load.

Your idea is not very clear.

Let me try again.

Modern host binds to modern interface. It can use the PF normally. Legacy guest IOBAR accesses to VF are translated to transport vq accesses.

Quoted 19 lines
Quoted 19 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

b. it can be a way with high latency, DMA overheads on the virtqueue for

read/writes for small access.

numbers?

It depends on the implementation, but at minimum, writes and reads can pay order of magnitude higher in 10 msec range.

A single VQ roundtrip takes a minimum of 10 milliseconds? This is indeed completely unworkable for transport vq. Points:
- even for memory mapped you have an access take 1 millisecond?
Extremely slow. Why?
- Why is DMA 10x more expensive? I expect it to be 2x more expensive:
Normal read goes cpu -> device -> cpu, DMA does cpu -> device -> memory -> device -> cpu

Reason I am asking is because it is important for transport vq to have a workable design.

Quoted 7 lines
Quoted 5 lines

But let me guess. Is there a chance that you are talking about an interrupt driven design? *That* is going to be slow though I don't think 10msec, more like 10usec. But I expect transport vq to typically work by (adaptive?) polling mostly avoiding interrupts.

No. Interrupt latency is in usec range.
The major latency contributors in msec range can arise from the device side.

So you are saying there are devices out there already with this MMR hack baked in, and in hardware not firmware, so it works reasonably?

Signature · 18 lines
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/
#172 lore raw
Quoted 4 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 2:02 PM

Quoted 9 lines
Quoted 5 lines

Because vqs involve DMA operations.
It is left to the device implementation to do it, but a generic wisdom is not implement such slow work in the data path engines. So such register access vqs can/may be through firmware. Hence it can involve a lot higher latency.

Then that wisdom is wrong? tens of microseconds is not workable even for ethtool operations, you are killing boot time.

Huh.
What ethtool latencies have you experienced? Number?

Quoted 4 lines

I frankly don't know, if device vendors are going to interpret "DMA" as "can take insane time" then maybe we need to scrap the whole admin vq idea and make it all memory mapped like Jason wanted, so as not to lead them into temptation?

DMA happens for all types of devices for control and data path.
Can you point to any existing industry specification and real implementation that highlights such timing requirements. This will be useful to understand where these requirements come from.

Multiple device implementors do not see memory mapped registers as way forward. Discussed many times.
There is no point in going that dead end.

Quoted 5 lines

Let me try again.

Modern host binds to modern interface. It can use the PF normally. Legacy guest IOBAR accesses to VF are translated to transport vq accesses.

I understand this part.
Transport VQ is on the PF, right? (Nothing but AQ, right?)

It can work in VF case with trade-off compared to memory mapped registers.
A lightweight hypervisor cannot benefit from this which wants to utilize this for transitional PF too. So providing both the options is useful.

Again, I want to emphasize that register read/write over tvq has merits with trade-off. And so the mmr has merits with trade-off too.

Better to list them and proceed forward.

Method-1: VF's register read/write via PF based transport VQ
Pros:
a. Light weight registers implementation in device for new memory region window

Cons:
a. Higher DMA read/write latency
b. Device requires synchronization between non legacy memory mapped registers and legacy regs access via tvq c. Can only work with the VF. Cannot work for thin hypervisor, which can map transitional PF to bare metal OS (also listed in cover letter)

Method-2: VF's register read/write via MMR (current proposal)
Pros:
a. Device utilizes the same legacy and non-legacy registers.
b. an order of magnitude lower latency due to avoidance of DMA on register accesses (Important but not critical)

Quoted 5 lines
Quoted 2 lines

No. Interrupt latency is in usec range.
The major latency contributors in msec range can arise from the device side.

So you are saying there are devices out there already with this MMR hack baked in, and in hardware not firmware, so it works reasonably?

It is better to not assert a solution a "hack", when you are still trying to understand the trade-offs of multiple solutions and when you are yet to fully review all requirements. (and when solution is also based on an offline feedback from you!)

No. I didn't say that device is out there.
However, large part of the proposed changes is done based on real devices (and not limited to virtio).

Regarding tvq, I have some idea on how to improve the register read/writes so that its optimal for devices to implement.

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/

#173 lore raw
Quoted 10 lines · Parav Pandit
Quoted 10 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 2:02 PM

Quoted 5 lines

Because vqs involve DMA operations.
It is left to the device implementation to do it, but a generic wisdom is not implement such slow work in the data path engines. So such register access vqs can/may be through firmware. Hence it can involve a lot higher latency.

Quoted 5 lines
Quoted 3 lines

Then that wisdom is wrong? tens of microseconds is not workable even for ethtool operations, you are killing boot time.

Huh.
What ethtool latencies have you experienced? Number?

I know an order of tens of eth calls happens during boot.
If as you said each takes tens of ms then we are talking close to a second. That is measureable.

Quoted 5 lines
Quoted 4 lines

I frankly don't know, if device vendors are going to interpret "DMA" as "can take insane time" then maybe we need to scrap the whole admin vq idea and make it all memory mapped like Jason wanted, so as not to lead them into temptation?

Quoted 7 lines

DMA happens for all types of devices for control and data path.
Can you point to any existing industry specification and real implementation that highlights such timing requirements. This will be useful to understand where these requirements come from.

Multiple device implementors do not see memory mapped registers as way forward. Discussed many times.
There is no point in going that dead end.

OK then. Then if it is a dead end then it looks weird to add a whole new config space as memory mapped.

Quoted 11 lines
Quoted 5 lines

Let me try again.

Modern host binds to modern interface. It can use the PF normally. Legacy guest IOBAR accesses to VF are translated to transport vq accesses.

I understand this part.
Transport VQ is on the PF, right? (Nothing but AQ, right?)

It can work in VF case with trade-off compared to memory mapped registers.
A lightweight hypervisor cannot benefit from this which wants to utilize this for transitional PF too. So providing both the options is useful.

If hardware vendors do not want to bear the costs of registers then they will not implement devices with registers, and then the whole thing will become yet another legacy thing we need to support. If legacy emulation without IO is useful, then can we not find a way to do it that will survive the test of time?

Quoted 8 lines

Again, I want to emphasize that register read/write over tvq has merits with trade-off. And so the mmr has merits with trade-off too.

Better to list them and proceed forward.

Method-1: VF's register read/write via PF based transport VQ
Pros:
a. Light weight registers implementation in device for new memory region window

Is that all? I mentioned more.

Quoted 3 lines

Cons:
a. Higher DMA read/write latency
b. Device requires synchronization between non legacy memory mapped registers and legacy regs access via tvq

Same as a separate mmemory bar really. Just don't do it. Either access legacy or non legacy.

Quoted 2 lines

c. Can only work with the VF. Cannot work for thin hypervisor, which can map transitional PF to bare metal OS (also listed in cover letter)

Is that a significant limitation? Why?

Quoted 3 lines

Method-2: VF's register read/write via MMR (current proposal) Pros:
a. Device utilizes the same legacy and non-legacy registers.

Not really. For starters endian-ness can be different. Maybe for some devices and systems.

Quoted 2 lines

b. an order of magnitude lower latency due to avoidance of DMA on register accesses (Important but not critical)

And no cons? Even if you could not see them yourself did I fail to express myself to such an extent?

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

No. Interrupt latency is in usec range.
The major latency contributors in msec range can arise from the device side.

So you are saying there are devices out there already with this MMR hack baked in, and in hardware not firmware, so it works reasonably?

It is better to not assert a solution a "hack",

Sorry if that sounded offensive. a hack is not necessary a bad thing. It's a quick solution to a very local problem, though.

Quoted 4 lines

when you are still
trying to understand the trade-offs of multiple solutions and when you are yet to fully review all requirements.
(and when solution is also based on an offline feedback from you!)

Sorry if I set you on a wrong path I frankly didn't realize how big a change the result will be. I was thinking more along the lines of a capability describing a portion of a memory bar, saying access there is equivalent to access to the io bar. That's it.

Quoted 2 lines

No. I didn't say that device is out there.
However, large part of the proposed changes is done based on real devices (and not limited to virtio).

Yes motivation is one of the things I'm trying to work out here. It does however not help that it's an 11 patch strong patchset adding 500 lines of text for what is supposedly a small change.

Quoted 1 line

Regarding tvq, I have some idea on how to improve the register read/writes so that its optimal for devices to implement.

Sounds useful, and maybe if tvq addresses legacy need then focus on that?

Signature · 18 lines
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/
#174 lore raw
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Parav Pandit
Quoted 13 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 2:02 PM

Quoted 5 lines

Because vqs involve DMA operations.
It is left to the device implementation to do it, but a generic wisdom is not implement such slow work in the data path engines. So such register access vqs can/may be through firmware. Hence it can involve a lot higher latency.

Then that wisdom is wrong? tens of microseconds is not workable even for ethtool operations, you are killing boot time.

Quoted 6 lines
Quoted 2 lines

Huh.
What ethtool latencies have you experienced? Number?

I know an order of tens of eth calls happens during boot.
If as you said each takes tens of ms then we are talking close to a second. That is measureable.

I said it can take, doesn't have to be always same for all the commands. Better to work with real numbers. :)

Let me take an example to walk through.

If a cvq or aq command takes 0.5msec, total of 100 such commands will take 50msec.

Once a while if two of commands say take 5msec, will result in 50 -> 60 msec.

Quoted 3 lines

OK then. Then if it is a dead end then it looks weird to add a whole new config space as memory mapped.

I am aligned with you to not add any new register as memory mapped for 1.x.
Or access through device own's tvq is fine if such q can be initialized before during device reset (init) phase.

I explained that legacy registers are sub-set of existing 1.x. They should not consume extra memory.

Lets walk through the merits and negatives of both to conclude.

Quoted 7 lines
Quoted 1 line
Quoted 1 line

Let me try again.

If hardware vendors do not want to bear the costs of registers then they will not implement devices with registers, and then the whole thing will become yet another legacy thing we need to support. If legacy emulation without IO is useful, then can we not find a way to do it that will survive the test of time?

legacy_register_transport_vq for VF can be a option, but not for PF emulation. More below.

Quoted 4 lines
Quoted 4 lines

Again, I want to emphasize that register read/write over tvq has merits with trade-off. And so the mmr has merits with trade-off too.

Quoted 8 lines
Quoted 5 lines

Better to list them and proceed forward.

Method-1: VF's register read/write via PF based transport VQ
Pros:
a. Light weight registers implementation in device for new memory region window

Is that all? I mentioned more.

b. device reset is more optimal with transport VQ
c. a hypervisor may want to check (but not necessary) register content
d. Some unknown guest VM driver which modifies mac address and still expect atomicity can benefit if hypervisor wants to do extra checks

Quoted 7 lines
Quoted 3 lines

Cons:
a. Higher DMA read/write latency
b. Device requires synchronization between non legacy memory mapped registers and legacy regs access via tvq

Same as a separate mmemory bar really. Just don't do it. Either access legacy or non legacy.

It is really not same to treat them equally as tvq encapsulation is different, and hw wouldn't prefer to treat them equally like regular memory writes.

Transitional device exposed by hypervisor contains both legacy I/O bar and also the memory mapped registers. So a guest vm can access both.

Quoted 4 lines
Quoted 2 lines

c. Can only work with the VF. Cannot work for thin hypervisor, which can map transitional PF to bare metal OS (also listed in cover letter)

Is that a significant limitation? Why?

It is a functional limitation for the PF, as PF has no parent. and PF can also utilize memory BAR.

Quoted 11 lines
Quoted 7 lines

Method-2: VF's register read/write via MMR (current proposal) Pros:
a. Device utilizes the same legacy and non-legacy registers.

b. an order of magnitude lower latency due to avoidance of DMA on register accesses (Important but not critical)

And no cons? Even if you could not see them yourself did I fail to express myself to such an extent?

Method-1 pros covered the advantage of it over method-2, but yes worth to list here for completeness.

Cons:
requires creating new memory region window in the device for configuration access

Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

No. Interrupt latency is in usec range.
The major latency contributors in msec range can arise from the device side.

So you are saying there are devices out there already with this MMR hack baked in, and in hardware not firmware, so it works reasonably?

It is better to not assert a solution a "hack",

Sorry if that sounded offensive. a hack is not necessary a bad thing. It's a quick solution to a very local problem, though.

It is a solution because device can do at near to zero extra memory for existing registers. Anyways, we have better technical details to resolve. :)
Lets focus on it.

Quoted 4 lines

Yes motivation is one of the things I'm trying to work out here. It does however not help that it's an 11 patch strong patchset adding 500 lines of text for what is supposedly a small change.

Many of the patches are rework and incorrect to attribute to the specific feature.

Like others it could have been one giant patch... but we see value in smaller patches..

Using tvq is even bigger change than this. So we shouldn't be afraid of making transitional device actually work using it with larger spec patch.

Quoted 5 lines
Quoted 1 line

Regarding tvq, I have some idea on how to improve the register read/writes so that its optimal for devices to implement.

Sounds useful, and maybe if tvq addresses legacy need then focus on that?

tvq specific for legacy register access make sense. Some generic tvq is abstract and dont see any relation here.

So better to name it as legacy_reg_transport_vq (lrt_vq).

How about having below format?

/* Format of 16B descriptors for lrt_vq
* lrt_vq = legacy register tranport vq.
*/

struct legacy_reg_req_vf {
	union {
		struct {
			le32 reg_wr_data;
			le32 reserved;
		} write;
		struct {
			le64 reg_read_addr;
		};
	};
	le8 rd_wr : 1;	/* rd=0, wr=1 */
	le8 reg_byte_offset : 7;
	le8 req_tag;	/* unique request tag on this vq */
	le16 vf_num;

	le16 flags; /* new flag below */
        le16 next;
};

#define VIRTQ_DESC_F_Q_DEFINED 8
/* Content of the VQ descriptor other than flags field is VQ
* specific and defined by the VQ type.
*/

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/

#175 lore raw
Quoted 26 lines · Parav Pandit
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Parav Pandit
Quoted 13 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 2:02 PM

Quoted 5 lines

Because vqs involve DMA operations.
It is left to the device implementation to do it, but a generic wisdom is not implement such slow work in the data path engines. So such register access vqs can/may be through firmware. Hence it can involve a lot higher latency.

Then that wisdom is wrong? tens of microseconds is not workable even for ethtool operations, you are killing boot time.

Quoted 6 lines
Quoted 2 lines

Huh.
What ethtool latencies have you experienced? Number?

I know an order of tens of eth calls happens during boot.
If as you said each takes tens of ms then we are talking close to a second. That is measureable.

I said it can take, doesn't have to be always same for all the commands. Better to work with real numbers. :)

Quoted 7 lines

Let me take an example to walk through.

If a cvq or aq command takes 0.5msec, total of 100 such commands will take 50msec.

Once a while if two of commands say take 5msec, will result in 50 -> 60 msec.

Not too bad. then it seems it should not be a problem to tunnel config over AQ then?

Quoted 15 lines
Quoted 4 lines

OK then. Then if it is a dead end then it looks weird to add a whole new config space as memory mapped.

I am aligned with you to not add any new register as memory mapped for 1.x. Or access through device own's tvq is fine if such q can be initialized before during device reset (init) phase.

I explained that legacy registers are sub-set of existing 1.x. They should not consume extra memory.

Lets walk through the merits and negatives of both to conclude.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Let me try again.

Quoted 7 lines
Quoted 5 lines

If hardware vendors do not want to bear the costs of registers then they will not implement devices with registers, and then the whole thing will become yet another legacy thing we need to support. If legacy emulation without IO is useful, then can we not find a way to do it that will survive the test of time?

legacy_register_transport_vq for VF can be a option, but not for PF emulation.

OK. Do we really care? Are you guys selling lots of high end cards without SRIOV that it matters?

Quoted 12 lines

More below.

Quoted 10 lines
Quoted 9 lines

Again, I want to emphasize that register read/write over tvq has merits with trade-off. And so the mmr has merits with trade-off too.

Better to list them and proceed forward.

Method-1: VF's register read/write via PF based transport VQ
Pros:
a. Light weight registers implementation in device for new memory region window

Quoted 6 lines
Quoted 2 lines

Is that all? I mentioned more.

b. device reset is more optimal with transport VQ
c. a hypervisor may want to check (but not necessary) register content d. Some unknown guest VM driver which modifies mac address and still expect atomicity can benefit if hypervisor wants to do extra checks

It's not hard to be more specific.
Old Linux kernels are like this, this was fixed with:

commit 7e58d5aea8abb993983a3f3088fd4a3f06180a1c

Author: Amos Kong <[email protected]>
Date:   Mon Jan 21 01:17:23 2013 +0000

Currently we write MAC address to pci config space byte by byte, this means that we have an intermediate step where mac is wrong. This patch introduced a new control command to set MAC address, it's atomic.

about 10 years ago.

Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

Cons:
a. Higher DMA read/write latency
b. Device requires synchronization between non legacy memory mapped registers and legacy regs access via tvq

Same as a separate mmemory bar really. Just don't do it. Either access legacy or non legacy.

It is really not same to treat them equally as tvq encapsulation is different, and hw wouldn't prefer to treat them equally like regular memory writes.

I think yoiu missunderstand what I said. You listed a problem:
the same device can be accessed through both
a modern and a legacy interface.
I said that it is not a problem at all, there is no reason to use both.

Quoted 2 lines

Transitional device exposed by hypervisor contains both legacy I/O bar and also the memory mapped registers. So a guest vm can access both.

But it must not, and some devices break if you do.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

c. Can only work with the VF. Cannot work for thin hypervisor, which can map transitional PF to bare metal OS (also listed in cover letter)

Is that a significant limitation? Why?

It is a functional limitation for the PF, as PF has no parent. and PF can also utilize memory BAR.

Yes it's a limitation, I just don't see why we care.

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines

Method-2: VF's register read/write via MMR (current proposal) Pros:
a. Device utilizes the same legacy and non-legacy registers.

b. an order of magnitude lower latency due to avoidance of DMA on register accesses (Important but not critical)

And no cons? Even if you could not see them yourself did I fail to express myself to such an extent?

Quoted 6 lines

Method-1 pros covered the advantage of it over method-2, but yes worth to list here for completeness.

Cons:
requires creating new memory region window in the device for configuration access

Parav please take a look at the discussion so far as collect more cons that were mentioned for the proposal, I definitely listed some and I don't really want to repeat myself. I expect a proposal to be balanced, not a sales pitch.

Quoted 19 lines
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

No. Interrupt latency is in usec range.
The major latency contributors in msec range can arise from the device side.

So you are saying there are devices out there already with this MMR hack baked in, and in hardware not firmware, so it works reasonably?

It is better to not assert a solution a "hack",

Sorry if that sounded offensive. a hack is not necessary a bad thing. It's a quick solution to a very local problem, though.

It is a solution because device can do at near to zero extra memory for existing registers.
Anyways, we have better technical details to resolve. :) Lets focus on it.

Quoted 4 lines

Yes motivation is one of the things I'm trying to work out here. It does however not help that it's an 11 patch strong patchset adding 500 lines of text for what is supposedly a small change.

Quoted 7 lines

Many of the patches are rework and incorrect to attribute to the specific feature.

Like others it could have been one giant patch... but we see value in smaller patches..

Using tvq is even bigger change than this.

The main thing is that there's no new ID so the PF device itself will stay usable with existing drivers.

Quoted 5 lines

So we shouldn't be afraid of
making transitional device actually work using it with larger spec patch.

Quoted 2 lines
Quoted 1 line

Regarding tvq, I have some idea on how to improve the register read/writes so that its optimal for devices to implement.

Quoted 8 lines
Quoted 3 lines

Sounds useful, and maybe if tvq addresses legacy need then focus on that?

tvq specific for legacy register access make sense. Some generic tvq is abstract and dont see any relation here.

So better to name it as legacy_reg_transport_vq (lrt_vq).

Again this assumes tvq will be rewritten on top of AQ. I guess legacy can then become a new type of AQ command?

And maybe you want a memory mapped register for AQ commands? I know Jason really wanted that.

Quoted 24 lines

How about having below format?

/* Format of 16B descriptors for lrt_vq
* lrt_vq = legacy register tranport vq.
*/

struct legacy_reg_req_vf {
	union {
		struct {
			le32 reg_wr_data;
			le32 reserved;
		} write;
		struct {
			le64 reg_read_addr;
		};
	};
	le8 rd_wr : 1;	/* rd=0, wr=1 */
	le8 reg_byte_offset : 7;
	le8 req_tag;	/* unique request tag on this vq */
	le16 vf_num;

	le16 flags; /* new flag below */
        le16 next;
};
Quoted 4 lines

#define VIRTQ_DESC_F_Q_DEFINED 8
/* Content of the VQ descriptor other than flags field is VQ
* specific and defined by the VQ type.
*/

Any way to allow accesses of arbitrary length?

Signature · 18 lines
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/
#176 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 8 lines · Parav Pandit
Quoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Parav Pandit
Quoted 3 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 2:02 PM

[...]

Quoted 4 lines
Quoted 4 lines

tvq specific for legacy register access make sense. Some generic tvq is abstract and dont see any relation here.

Quoted 8 lines
Quoted 1 line

So better to name it as legacy_reg_transport_vq (lrt_vq).

Again this assumes tvq will be rewritten on top of AQ. I guess legacy can then become a new type of AQ command?

And maybe you want a memory mapped register for AQ commands? I know Jason really wanted that.

That's exactly why we decouple the commands from a specific transport (queue or register). It allows sufficient flexibility.

Thanks

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

#177 lore raw
In reply to Parav Pandit
Quoted 3 lines · Parav Pandit

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device.

What does "MMR" mean?

Quoted 10 lines

It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

Such transitional MMR devices will be used at the scale of thousands of devices using PCI SR-IOV and/or future scalable virtualization technology to provide backward compatibility (for legacy devices) and also future compatibility with new features.

Quoted 8 lines

Usecase:
--------
1. A hypervisor/system needs to provide transitional virtio devices to the guest VM at scale of thousands, typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a vendor agnostic driver in the hypervisor system.

Is the idea that the hypervisor configures the new Transitional MMR devices and makes them appear like virtio-pci Transitional devices?

In other words, the guest doesn't know about Transitional MMR and does not need any code changes.

Quoted 5 lines

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

What does this paragraph mean?

Quoted 25 lines

Motivation/Background:
----------------------
The existing transitional PCI device is missing support for PCI SR-IOV based devices. Currently it does not work beyond PCI PF, or as software emulated device in reality. It currently has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from the physical-memory address space. The I/O address space consists of 64K individually addressable 8-bit I/O ports, numbered 0 through FFFFH.

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be aligned to a 4 KB boundary.

[d] I/O region accesses at PCI system level is slow as they are non-posted operations in PCIe fabric.

Quoted 6 lines

The usecase requirements and limitations above can be solved by extending the transitional device, mapping legacy and device specific configuration registers in a memory PCI BAR instead of using non composable I/O region.

Please review.

Modern devices were added to Linux in 2014 and support SR-IOV. Why is it important to support Transitional (which really means Legacy devices, otherwise Modern devices would be sufficient)?

Quoted 164 lines

Patch summary:
--------------
patch 1 to 5 prepares the spec
patch 6 to 11 defines transitional mmr device

patch-1 uses lower case alphabets to name device id patch-2 move transitional device id in legay section along with
revision id
patch-3 splits legacy feature bits description from device id patch-4 rename and moves virtio config registers next to 1.x
registers section
patch-5 Adds missing helper verb in terminology definitions patch-6 introduces transitional mmr device
patch-7 introduces transitional mmr device pci device ids patch-8 introduces virtio extended pci capability patch-9 describes new pci capability to locate legacy mmr
registers
patch-10 extended usage of driver notification capability for
the transitional mmr device
patch-11 adds conformance section of the transitional mmr device

This design and details further described below.

Design:
-------
Below picture captures the main small difference between current transitional PCI SR-IOV VF and transitional MMR SR-IOV VF.

+------------------+ +--------------------+ +--------------------+
|virtio 1.x        | |Transitional        | |Transitional        |
|SRIOV VF          | |SRIOV VF            | |MMR SRIOV VF        |
|                  | |                    | |                    |
++---------------+ | ++---------------+   | ++---------------+   |
||dev_id =       | | ||dev_id =       |   | ||dev_id =       |   |
||{0x1040-0x106C}| | ||{0x1000-0x103f}|   | ||{0x10f9-0x10ff}|   |
|+---------------+ | |+---------------+   | |+---------------+   |
|                  | |                    | |                    |
|+------------+    | |+------------+      | |+-----------------+ |
||Memory BAR  |    | ||Memory BAR  |      | ||Memory BAR       | |
|+------------+    | |+------------+      | ||                 | |
|                  | |                    | || +--------------+| |
|                  | |+-----------------+ | || |legacy virtio || |
|                  | ||IOBAR impossible | | || |+ dev cfg     || |
|                  | |+-----------------+ | || |registers     || |
|                  | |                    | || +--------------+| |
|                  | |                    | |+-----------------+ |
+------------------+ +--------------------+ +--------------------+

Here transitional MMR SR-IOV VF has legacy configuration and legacy device specific registers located at an offset in the memory region BAR.

A memory region can be dedicated at BAR0 or it can be in an existing BAR, allowing flexibility when implementing support in a hardware device.

Transitional MMR SR-IOV VFs use a distinct device ID range to that of existing virtio SR-IOV VFs to allow flexibility in driver binding.

A more zoom-in version of transitional MMR SR-IOV device shows that the location of the legacy registers are discovered by the driver using a new capability.

+------------------------------+
|Transitional                  |
|MMR SRIOV VF                  |
|                              |
++---------------+             |
||dev_id =       |             |
||{0x10f9-0x10ff}|             |
|+---------------+             |
|                              |
++--------------------+        |
|| PCIe ext cap = 0xB |        |
|| cfg_type = 10      |        |
|| offset   = 0x1000  |        |
|| bar      = N {0..5}|        |
|+--|-----------------+        |
|   |                          |
|   |                          |
|   |    +-------------------+ |
|   |    | Memory BAR = A    | |
|   |    |                   | |
|   +------>+--------------+ | |
|        |  |legacy virtio | | |
|        |  |+ dev cfg     | | |
|        |  |registers     | | |
|        |  +--------------+ | |
|        +-----------------+ | |
+------------------------------+

Software usage:
---------------
Transitional MMR device can be used by multiple ways.

1. The most common way to use and map to the guest VM is by using vfio driver framework in Linux kernel.

                +----------------------+
                |pci_dev_id = 0x100X   |
+---------------|pci_rev_id = 0x0      |-----+
|vfio device    |BAR0 = I/O region     |     |
|               |Other attributes      |     |
|               +----------------------+     |
|                                            |
+   +--------------+     +-----------------+ |
|   |I/O to memory |     | Other vfio      | |
|   |rd/wr mapper  |     | functionalities | |
|   +--------------+     +-----------------+ |
|                                            |
+-------------------+------------------------+
                    |
       +------------+-----------------+
       |         Transitional         |
       |         MMR SRIOV VF         |
       +------------------------------+

2. Virtio pci driver to bind to the listed device id and use it as native device in the host.

3. Use it in a light weight hypervisor to run bare-metal OS.

Parav Pandit (11):
transport-pci: Use lowecase alphabets
transport-pci: Move transitional device id to legacy section
transport-pci: Split notes of PCI Device Layout
transport-pci: Rename and move legacy PCI Device layout section
introduction: Add missing helping verb
introduction: Introduce transitional MMR interface
transport-pci: Introduce transitional MMR device id
transport-pci: Introduce virtio extended capability
transport-pci: Describe PCI MMR dev config registers
transport-pci: Use driver notification PCI capability
conformance: Add transitional MMR interface conformance

 conformance.tex      |  11 +-
 introduction.tex     |  34 +++-
 tmmr-conformance.tex |  27 +++
 transport-pci.tex    | 405 ++++++++++++++++++++++++++++++-------------
 4 files changed, 354 insertions(+), 123 deletions(-)
 create mode 100644 tmmr-conformance.tex
Signature · 18 lines
2.26.2


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/
#178 lore raw
Quoted 7 lines · Stefan Hajnoczi
Quoted 3 lines · Parav Pandit

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device.

What does "MMR" mean?

memory mapped registers.
Explained below in the design section and also in relevant patches 6 to 11.

Quoted 16 lines
Quoted 16 lines

It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

Such transitional MMR devices will be used at the scale of thousands of devices using PCI SR-IOV and/or future scalable virtualization technology to provide backward compatibility (for legacy devices) and also future compatibility with new features.

Usecase:
--------
1. A hypervisor/system needs to provide transitional virtio devices to the guest VM at scale of thousands, typically, one to eight devices per VM.

Quoted 6 lines
Quoted 2 lines

2. A hypervisor/system needs to provide such devices using a vendor agnostic driver in the hypervisor system.

Is the idea that the hypervisor configures the new Transitional MMR devices and makes them appear like virtio-pci Transitional devices?

Yes, but hypervisor is not involved in any configuration parsing or anything of that nature. It is only a passthrough fowarder from emulated IOBAR to memory mapped legacy registers. In other words, hypervisor do not care for the registers content at all.

Quoted 11 lines

In other words, the guest doesn't know about Transitional MMR and does not need any code changes.

Quoted 5 lines

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

What does this paragraph mean?

It means regardless of a VF being transitional MMR VF or 1.x VF without any MMR extensions, there is single vfio virtio driver handling both type of devices to map to the guest VM.

Quoted 7 lines

Modern devices were added to Linux in 2014 and support SR-IOV.

Why is it
important to support Transitional (which really means Legacy devices, otherwise Modern devices would be sufficient)?

To support guest VMs which only understand legacy devices and unfortunately they are still in much wider use by the users.

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

#179 lore raw
Quoted 32 lines · Parav Pandit
Quoted 7 lines · Stefan Hajnoczi
Quoted 3 lines · Parav Pandit

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device.

What does "MMR" mean?

memory mapped registers.
Explained below in the design section and also in relevant patches 6 to 11.

Quoted 19 lines
Quoted 18 lines

It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

Such transitional MMR devices will be used at the scale of thousands of devices using PCI SR-IOV and/or future scalable virtualization technology to provide backward compatibility (for legacy devices) and also future compatibility with new features.

Usecase:
--------
1. A hypervisor/system needs to provide transitional virtio devices to the guest VM at scale of thousands, typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a vendor agnostic driver in the hypervisor system.

Quoted 8 lines
Quoted 3 lines

Is the idea that the hypervisor configures the new Transitional MMR devices and makes them appear like virtio-pci Transitional devices?

Yes, but hypervisor is not involved in any configuration parsing or anything of that nature.
It is only a passthrough fowarder from emulated IOBAR to memory mapped legacy registers.
In other words, hypervisor do not care for the registers content at all.

This part I do not see as important. legacy is frozen in time. Implement it once and you are done. Datapath differences are more important.

Quoted 9 lines
Quoted 9 lines

In other words, the guest doesn't know about Transitional MMR and does not need any code changes.

Quoted 5 lines

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

Quoted 5 lines
Quoted 2 lines

What does this paragraph mean?

It means regardless of a VF being transitional MMR VF or 1.x VF without any MMR extensions, there is single vfio virtio driver handling both type of devices to map to the guest VM.

I don't think this can be vfio. You need a host layer translating things such as device ID etc.

Quoted 9 lines
Quoted 7 lines

Modern devices were added to Linux in 2014 and support SR-IOV.

Why is it
important to support Transitional (which really means Legacy devices, otherwise Modern devices would be sufficient)?

To support guest VMs which only understand legacy devices and unfortunately they are still in much wider use by the users.

OK but supporting them with a passthrough driver such as vfio does not seem that important.

Signature · 18 lines
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/
#180 lore raw
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · Parav Pandit
Quoted 7 lines · Stefan Hajnoczi
Quoted 5 lines · Parav Pandit

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

What does this paragraph mean?

It means regardless of a VF being transitional MMR VF or 1.x VF without any MMR extensions, there is single vfio virtio driver handling both type of devices to map to the guest VM.

I don't think this can be vfio. You need a host layer translating things such as device ID etc.

An mdev driver?

#181 lore raw
Quoted 12 lines · Stefan Hajnoczi
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Parav Pandit
Quoted 9 lines · Stefan Hajnoczi
Quoted 5 lines · Parav Pandit

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

What does this paragraph mean?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

It means regardless of a VF being transitional MMR VF or 1.x VF without any MMR extensions, there is single vfio virtio driver handling both type of devices to map to the guest VM.

I don't think this can be vfio. You need a host layer translating things such as device ID etc.

An mdev driver?

vdpa seems more likely. we can extend it to support legacy if we want to.

Signature · 18 lines
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/
#182 lore raw
In reply to Michael S. Tsirkin
Quoted 24 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 1:49 PM

Quoted 5 lines

Yes, but hypervisor is not involved in any configuration parsing or anything of that nature.
It is only a passthrough fowarder from emulated IOBAR to memory mapped legacy registers.
In other words, hypervisor do not care for the registers content at all.

This part I do not see as important. legacy is frozen in time. Implement it once and you are done. Datapath differences are more important.

Quoted 9 lines
Quoted 9 lines

In other words, the guest doesn't know about Transitional MMR and does not need any code changes.

Quoted 5 lines

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

What does this paragraph mean?

It means regardless of a VF being transitional MMR VF or 1.x VF without any MMR extensions, there is single vfio virtio driver handling both type of devices to map to the guest VM.

I don't think this can be vfio. You need a host layer translating things such as device ID etc.

vfio layer does it.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Modern devices were added to Linux in 2014 and support SR-IOV.

Why is it
important to support Transitional (which really means Legacy devices, otherwise Modern devices would be sufficient)?

Quoted 5 lines
Quoted 2 lines

To support guest VMs which only understand legacy devices and unfortunately they are still in much wider use by the users.

OK but supporting them with a passthrough driver such as vfio does not seem that important.

Not sure on what basis you assert it.
I clarified in the cover letter that these are the user level requirements to support transitional and non-transitional devices both via single vfio subsystem.

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/

#183 lore raw
Quoted 4 lines · Parav Pandit
Quoted 2 lines

OK but supporting them with a passthrough driver such as vfio does not seem that important.

Not sure on what basis you assert it.
I clarified in the cover letter that these are the user level requirements to support transitional and non-transitional devices both via single vfio subsystem.

And what is so wrong with vdpa? Really I don't see how the virtio spec needs to accomodate specific partitioning between linux modules, be it vdpa or vfio. Way beyond the scope of the driver.

But anyway, my main
point is about DMA. On the one hand you are asking for a VQ based management interface because it saves money. On the other you are saying DMA operations take extremely long to the point where they are unusable in the boot sequence.
So what is it? Was admin vq a mistake and we should do memory mapped? I know Jason really wanted that, and it makes a bunch of things easier. Or is legacy emulation doable over a vq and latency is not a concern, and the real reason is because it makes you push out a host driver with a bit less effort?

I just do not see how these claims do not contradict each other.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#184 lore raw
Quoted 7 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 4:03 PM

Quoted 2 lines · Parav Pandit
Quoted 2 lines

OK but supporting them with a passthrough driver such as vfio does not seem that important.

Quoted 8 lines
Quoted 2 lines

Not sure on what basis you assert it.
I clarified in the cover letter that these are the user level requirements to

support transitional and non-transitional devices both via single vfio subsystem.

And what is so wrong with vdpa? Really I don't see how the virtio spec needs to accomodate specific partitioning between linux modules, be it vdpa or vfio. Way beyond the scope of the driver.

vdpa has its own value.

Here requirements are different as listed so let's focus on it.

Quoted 5 lines

But anyway, my main
point is about DMA. On the one hand you are asking for a VQ based management interface because it saves money. On the other you are saying DMA operations take extremely long to the point where they are unusable in the boot sequence.

I think you missed the point I described few emails back.
The legacy registers are subset of the 1.x registers, so a device that implements existing 1.x registers, they get legacy registers for free. Hence, there is no _real_ saving.

Quoted 1 line

So what is it? Was admin vq a mistake and we should do memory mapped?

No. Certainly not.
AQ is needed for LM, SR-IOV (SR-PCIM management), SIOV device life cycle.

Quoted 4 lines

Or is
legacy emulation doable over a vq and latency is not a concern, and the real reason is because it makes you push out a host driver with a bit less effort?

Legacy registers emulation is doable over VQ and has its merits (I listed in previous email).
I forgot to mention in previous email that device reset is also better via tvq.
It is just that legacy_registers_transport_vq (LRT_VQ) requires more complex hypervisor driver and only works for the VFs.

At spec level, MMR has value on the PF as well, hence I previously proposed last week on your first email that spec should allow both.

Efforts of hypervisor not really a big concern.
Once we converge that LRT_VQ is good, it is viable option too.
I will shortly send out little more verbose command on lrt_vq so that its optimal enough.

Quoted 1 line

I just do not see how these claims do not contradict each other.

An AQ for queuing, parallelism, memory saving.

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/

#185 lore raw
Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 4:03 PM

Quoted 4 lines · Parav Pandit
Quoted 2 lines

OK but supporting them with a passthrough driver such as vfio does not seem that important.

Not sure on what basis you assert it.
I clarified in the cover letter that these are the user level requirements to

support transitional and non-transitional devices both via single vfio subsystem.

Quoted 7 lines
Quoted 4 lines

And what is so wrong with vdpa? Really I don't see how the virtio spec needs to accomodate specific partitioning between linux modules, be it vdpa or vfio. Way beyond the scope of the driver.

vdpa has its own value.

Here requirements are different as listed so let's focus on it.

I'm not sure how convincing that is. Yes simpler software is good, it's nice to have, but it's not such a hard requirement to use vfio when vdpa is there. And again, the cost is reduced robustness.

Quoted 9 lines
Quoted 5 lines

But anyway, my main
point is about DMA. On the one hand you are asking for a VQ based management interface because it saves money. On the other you are saying DMA operations take extremely long to the point where they are unusable in the boot sequence.

I think you missed the point I described few emails back.
The legacy registers are subset of the 1.x registers, so a device that implements existing 1.x registers, they get legacy registers for free. Hence, there is no _real_ saving.

First not 100%. E.g. MAC is writeable so that's a R/W register as opposed to RO. But generally, why implement 1.0 registers at all? Do it all in transport vq.

Quoted 14 lines
Quoted 1 line

So what is it? Was admin vq a mistake and we should do memory mapped?

No. Certainly not.
AQ is needed for LM, SR-IOV (SR-PCIM management), SIOV device life cycle.

Quoted 4 lines

Or is
legacy emulation doable over a vq and latency is not a concern, and the real reason is because it makes you push out a host driver with a bit less effort?

Legacy registers emulation is doable over VQ and has its merits (I listed in previous email).
I forgot to mention in previous email that device reset is also better via tvq.
It is just that legacy_registers_transport_vq (LRT_VQ) requires more complex hypervisor driver and only works for the VFs.

At spec level, MMR has value on the PF as well, hence I previously proposed last week on your first email that spec should allow both.

Quoted 7 lines

Efforts of hypervisor not really a big concern.
Once we converge that LRT_VQ is good, it is viable option too.
I will shortly send out little more verbose command on lrt_vq so that its optimal enough.

Quoted 1 line

I just do not see how these claims do not contradict each other.

An AQ for queuing, parallelism, memory saving.

Ok that all sounds good.

Signature · 18 lines
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/
#186 lore raw
Quoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · Parav Pandit
Quoted 15 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, April 3, 2023 4:03 PM

Quoted 4 lines · Parav Pandit
Quoted 2 lines

OK but supporting them with a passthrough driver such as vfio does not seem that important.

Not sure on what basis you assert it.
I clarified in the cover letter that these are the user level requirements to

support transitional and non-transitional devices both via single vfio subsystem.

And what is so wrong with vdpa? Really I don't see how the virtio spec needs to accomodate specific partitioning between linux modules, be it vdpa or vfio. Way beyond the scope of the driver.

Quoted 8 lines
Quoted 3 lines

vdpa has its own value.

Here requirements are different as listed so let's focus on it.

I'm not sure how convincing that is. Yes simpler software is good, it's nice to have, but it's not such a hard requirement to use vfio when vdpa is there. And again, the cost is reduced robustness.

It is not hard requirement to use vdpa or vfio one way or either.

vdpa users can use vdpa.
vfio users can use vfio.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

But anyway, my main
point is about DMA. On the one hand you are asking for a VQ based management interface because it saves money. On the other you are saying DMA operations take extremely long to the point where they are unusable in the boot sequence.

Quoted 8 lines
Quoted 3 lines

I think you missed the point I described few emails back.
The legacy registers are subset of the 1.x registers, so a device that implements existing 1.x registers, they get legacy registers for free. Hence, there is no _real_ saving.

First not 100%. E.g. MAC is writeable so that's a R/W register as opposed to RO. But generally, why implement 1.0 registers at all? Do it all in transport vq.

1.x non transitional VFs and SIOV devices will use their own register_transport_vq once that infrastructure is in place to access its registers. Such VQ is directly accessible in the guest VM without hypervisor intervention.

It is orthogonal to this use case (and such future VQ still works with this design).

In this approach a hypervisor needs to use PF's AQ because the VF device (its registers, features etc) is not owned by the hypervisor VF driver.

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/

#187 lore raw
In reply to Parav Pandit
Quoted 4 lines · Parav Pandit
Quoted 1 line · Stefan Hajnoczi

On Fri, Mar 31, 2023 at 01:58:23AM +0300, Parav Pandit wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device.

What does "MMR" mean?

memory mapped registers.
Explained below in the design section and also in relevant patches 6 to 11.

Maybe call it "Memory-mapped Transitional"? That name would be easier to understand.

Quoted 8 lines
Quoted 6 lines

Modern devices were added to Linux in 2014 and support SR-IOV.

Why is it
important to support Transitional (which really means Legacy devices, otherwise Modern devices would be sufficient)?

To support guest VMs which only understand legacy devices and unfortunately they are still in much wider use by the users.

I wonder which guest software without Modern VIRTIO support will still be supported by the time Transitional MMR software and hardware becomes available. Are you aiming for particular guest software versions?

Stefan

#188 lore raw
Quoted 8 lines

From: Stefan Hajnoczi <[email protected]>
Sent: Monday, April 3, 2023 3:10 PM

Maybe call it "Memory-mapped Transitional"? That name would be easier to understand.

Sounds fine to me.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Modern devices were added to Linux in 2014 and support SR-IOV.

Why is it
important to support Transitional (which really means Legacy devices, otherwise Modern devices would be sufficient)?

Quoted 6 lines
Quoted 2 lines

To support guest VMs which only understand legacy devices and unfortunately they are still in much wider use by the users.

I wonder which guest software without Modern VIRTIO support will still be supported by the time Transitional MMR software and hardware becomes available. Are you aiming for particular guest software versions?

Transitional MMR hardware is available almost now.
Transitional MMR software is also WIP to be available as soon as we ratify the spec via tvq or via mmr or both. This will be support the guest sw version such as 2.6.32.754 kernel.

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/

#189 lore raw
Quoted 19 lines · Parav Pandit
Quoted 8 lines

From: Stefan Hajnoczi <[email protected]>
Sent: Monday, April 3, 2023 3:10 PM

Maybe call it "Memory-mapped Transitional"? That name would be easier to understand.

Sounds fine to me.

Quoted 9 lines
Quoted 8 lines
Quoted 6 lines

Modern devices were added to Linux in 2014 and support SR-IOV.

Why is it
important to support Transitional (which really means Legacy devices, otherwise Modern devices would be sufficient)?

To support guest VMs which only understand legacy devices and unfortunately they are still in much wider use by the users.

Quoted 7 lines
Quoted 3 lines

I wonder which guest software without Modern VIRTIO support will still be supported by the time Transitional MMR software and hardware becomes available. Are you aiming for particular guest software versions?

Transitional MMR hardware is available almost now.
Transitional MMR software is also WIP to be available as soon as we ratify the spec via tvq or via mmr or both. This will be support the guest sw version such as 2.6.32.754 kernel.

That is a RHEL 6 kernel. RHEL 6 entered Extended Life Cycle Support on November 30, 2020 (https://access.redhat.com/articles/4665701).

I would use existing software emulation for really old guests, but if you see an opportunity for hardware passthrough, then why not.

Stefan

#190 lore raw
In reply to Parav Pandit
Quoted 19 lines · Parav Pandit

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device. It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

Such transitional MMR devices will be used at the scale of thousands of devices using PCI SR-IOV and/or future scalable virtualization technology to provide backward compatibility (for legacy devices) and also future compatibility with new features.

Usecase:
--------
1. A hypervisor/system needs to provide transitional virtio devices to the guest VM at scale of thousands, typically, one to eight devices per VM.

Quoted 8 lines

2. A hypervisor/system needs to provide such devices using a vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

The more I look at it the more issues I see.

Here is a counter proposal:

#define VIRTIO_NET_F_LEGACY_HEADER 52 /* Use the legacy 10 byte header for all packets */

Yes, sorry to say, you need to emulate legacy pci in software.

With notification hacks, and reset hacks, and legacy interrupt hacks, and writeable mac ... this thing best belongs in vdpa anyway.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#191 lore raw
Quoted 6 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, April 12, 2023 12:48 AM

Here is a counter proposal:

Quoted 8 lines

#define VIRTIO_NET_F_LEGACY_HEADER 52 /* Use the legacy 10 byte
header for all packets */

Yes, sorry to say, you need to emulate legacy pci in software.

With notification hacks, and reset hacks, and legacy interrupt hacks, and writeable mac ... this thing best belongs in vdpa anyway.

What? I don't follow.
Suddenly you attribute everything as hack with least explanation.

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

#192 lore raw
Quoted 10 lines · Parav Pandit
Quoted 10 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, April 12, 2023 12:48 AM

Here is a counter proposal:

#define VIRTIO_NET_F_LEGACY_HEADER 52 /* Use the legacy 10 byte
header for all packets */

Quoted 8 lines
Quoted 4 lines

Yes, sorry to say, you need to emulate legacy pci in software.

With notification hacks, and reset hacks, and legacy interrupt hacks, and writeable mac ... this thing best belongs in vdpa anyway.

What? I don't follow.
Suddenly you attribute everything as hack with least explanation.

Again hacks is not a bad thing but it's an attempt at reusing things in unexpected ways.

New issue I found today:
- if guest disables MSI-X host can not disable MSI-X. need some other channel to notify device about this.

Old issues we discussed before today:
- reset needs some special handling because real hardware can not guarantee returning 0 on the 1st read
- if guest writes into mac, reusing host mac (which is RO) will not work, need extra registers
- something about notification makes you want to poke at modern notification register? which of course is its own can of worms with VIRTIO_F_NOTIFICATION_DATA changing the format completely.

Signature · 18 lines
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/
#193 lore raw
Quoted 9 lines

From: [email protected] <[email protected] open.org> On Behalf Of Michael S. Tsirkin

New issue I found today:
- if guest disables MSI-X host can not disable MSI-X. need some other channel to notify device about this.

I will look into it.

Quoted 3 lines

Old issues we discussed before today:
- reset needs some special handling because real hardware can not guarantee returning 0 on the 1st read

When done through the legacy MMR as we discussed, it will.

Quoted 2 lines

- if guest writes into mac, reusing host mac (which is RO) will not work, need extra registers

No. Again legacy interface section of MMR behaves as legacy.

Quoted 4 lines

- something about notification makes you want to poke at modern notification register? which of course is its own can of worms with VIRTIO_F_NOTIFICATION_DATA changing the format completely.

There is no NOTIFICATION_DATA with legacy. So it is not applicable. Format is same with only vq index.

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/

#194 lore raw
Quoted 18 lines · Parav Pandit
Quoted 9 lines

From: [email protected] <[email protected] open.org> On Behalf Of Michael S. Tsirkin

New issue I found today:
- if guest disables MSI-X host can not disable MSI-X. need some other channel to notify device about this.

I will look into it.

Quoted 3 lines

Old issues we discussed before today:
- reset needs some special handling because real hardware can not guarantee returning 0 on the 1st read

When done through the legacy MMR as we discussed, it will.

Quoted 2 lines

- if guest writes into mac, reusing host mac (which is RO) will not work, need extra registers

Quoted 8 lines

No. Again legacy interface section of MMR behaves as legacy.

Quoted 4 lines

- something about notification makes you want to poke at modern notification register? which of course is its own can of worms with VIRTIO_F_NOTIFICATION_DATA changing the format completely.

There is no NOTIFICATION_DATA with legacy. So it is not applicable. Format is same with only vq index.

You are writing into modern register here. *what* are you writing there? with modern register the format depends on features. here you did not negotiate any features. what if NOTIFICATION_DATA is a required feature? with legacy there's no FEATURES_OK so no way to report failure. driver barrels on, sends wrong data in the kick and hangs.

Sure, we can add a section to notification register and come up with some behaviour. Without even trying to guess how messy or clean that will be, far from being a small clean contained thing this feature is sticking its fingers in lots of pies.

Look I know proposed this originally. I thought it's a small thing too. It was an idea. I am not sure it pans out though. Not all ideas work.

Signature · 18 lines
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/
#195 lore raw
Quoted 7 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, April 12, 2023 1:24 AM

You are writing into modern register here. *what* are you writing there? with modern register the format depends on features. here you did not negotiate any features.

Q notify content.

Quoted 1 line

what if NOTIFICATION_DATA is a required feature?

How can it be required when it is not defined in the legacy spec.

Quoted 3 lines

with legacy there's no FEATURES_OK so no way to report failure. driver barrels on, sends wrong data in the kick and hangs.

There is no need for FEATURE_OK because as 1.x configuration registers are not touched.

The device provide q notify register region for forwarding.

Quoted 3 lines

Look I know proposed this originally. I thought it's a small thing too. It was an idea. I am not sure it pans out though. Not all ideas work.

This one do work and we have been already testing it.
Described changes with modern devices are simpler than the original proposal indeed.

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

#196 lore raw
In reply to Michael S. Tsirkin
Quoted 9 lines

From: [email protected] <[email protected] open.org> On Behalf Of Michael S. Tsirkin
Sent: Wednesday, April 12, 2023 1:12 AM

New issue I found today:
- if guest disables MSI-X host can not disable MSI-X. need some other channel to notify device about this.

Not sure why you say so.
MSI-X is not coming from virtio side.
So host will be able to disable.

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/

#197 lore raw
In reply to Parav Pandit
Quoted 7 lines · On Fri, 31 Mar 2023 01:58:23 +0300 Parav Pandit <[email protected]> wrote:

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device. It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

I have some conceptual problems with the current wording. I have to admit the ongoing discussion is for me quite difficult to follow. Nevertheless I have the feeling most of my concerns were already voiced by mostly Michael.

[..]

Quoted 2 lines

Please review.

After reading trough everything, I have a feeling, I have at least a basic understanding of what you are trying to accomplish. If you don't mind I would prefer to wait for a v2, maybe things will settle down a little by then. I feel like me commenting right now would just muddy the waters even further, without any real merrit. But if you insist, you can get some...

Regards,
Halil

[..]

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/

#198 lore raw
In reply to Parav Pandit
Quoted 45 lines · Parav Pandit

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device. It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

Such transitional MMR devices will be used at the scale of thousands of devices using PCI SR-IOV and/or future scalable virtualization technology to provide backward compatibility (for legacy devices) and also future compatibility with new features.

Usecase:
--------
1. A hypervisor/system needs to provide transitional virtio devices to the guest VM at scale of thousands, typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

Motivation/Background:
----------------------
The existing transitional PCI device is missing support for PCI SR-IOV based devices. Currently it does not work beyond PCI PF, or as software emulated device in reality. It currently has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from the physical-memory address space. The I/O address space consists of 64K individually addressable 8-bit I/O ports, numbered 0 through FFFFH.

Quoted 7 lines

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be aligned to a 4 KB boundary.

[d] I/O region accesses at PCI system level is slow as they are non-posted operations in PCIe fabric.

After our last several discussions, feedback from Michel and Jason,
to support above use case requirements, I would like to update v1 with below proposal.

1. Use existing non transitional device to extend the legacy registers access.

2. AQ of the parent PF is the optimal choice to access VF legacy registers. (As opposed to MMR of the VF). This is because:
a. it enables to avoid complex reset flow at scale for the VFs.

b. it enables using existing driver notification which is already present at notification section of 1.x and transitional device.

3. New AQ command opcode for legacy register access read/write Input fields:
a. opcode 0x8000
b. group and VF member identifiers.
c. registers offset,
d. registers size (1 to 64B)
e. registers content (on write)

output fields:
a. cmd status
b. register content on read

4. New AQ command to return q notify address for legacy access. Inputs:
a. opcode 0x8001
b. group and VF member identifier or this can be just constant for all VFs?

Output:
a. BAR index
b. byte offset within the BAR

5. PCI Extended capabilities for all the existing capabilities located in the legacy section. Why?
a. This is for the new driver (such as vfio) to always rely on the new capabilities. b. Legacy PCI regions is close to its full capacity.

Few option questions:
1. Should the q notification query command be per VF or should be one for all group members (VF)?

Any further comments to address in v1?

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/

#199 lore raw

In line with our recent discussion about agreeing requirements for specification changes, I wanted to say that we have a significant existing estate of VMs using the legacy interface where the customer is disinclined to update their software to a newer version (which might consume the 1.x interface).

Given that, some mechanism for supporting a (mostly) hardware offloaded legacy interface would definitely be useful to us, and the proposal here seems like a sensible approach.

We are aware of vDPA, but that comes with its own challenges.

Quoted 117 lines · Parav Pandit
Quoted 45 lines · Parav Pandit

Overview:
---------
The Transitional MMR device is a variant of the transitional PCI device. It has its own small Device ID range. It does not have I/O region BAR; instead it exposes legacy configuration and device specific registers at an offset in the memory region BAR.

Such transitional MMR devices will be used at the scale of thousands of devices using PCI SR-IOV and/or future scalable virtualization technology to provide backward compatibility (for legacy devices) and also future compatibility with new features.

Usecase:
--------
1. A hypervisor/system needs to provide transitional virtio devices to the guest VM at scale of thousands, typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of virtio device type (net/blk) and be future compatible with a single vfio stack using SR-IOV or other scalable device virtualization technology to map PCI devices to the guest VM. (as transitional or otherwise)

Motivation/Background:
----------------------
The existing transitional PCI device is missing support for PCI SR-IOV based devices. Currently it does not work beyond PCI PF, or as software emulated device in reality. It currently has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from the physical-memory address space. The I/O address space consists of 64K individually addressable 8-bit I/O ports, numbered 0 through FFFFH.

Quoted 7 lines

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be aligned to a 4 KB boundary.

[d] I/O region accesses at PCI system level is slow as they are non-posted operations in PCIe fabric.

After our last several discussions, feedback from Michel and Jason, to support above use case requirements, I would like to update v1 with below proposal.

1. Use existing non transitional device to extend the legacy registers access.

2. AQ of the parent PF is the optimal choice to access VF legacy registers. (As opposed to MMR of the VF).
This is because:
a. it enables to avoid complex reset flow at scale for the VFs.

b. it enables using existing driver notification which is already present at notification section of 1.x and transitional device.

3. New AQ command opcode for legacy register access read/write Input fields:
a. opcode 0x8000
b. group and VF member identifiers.
c. registers offset,
d. registers size (1 to 64B)
e. registers content (on write)

output fields:
a. cmd status
b. register content on read

4. New AQ command to return q notify address for legacy access. Inputs:
a. opcode 0x8001
b. group and VF member identifier or this can be just constant for all VFs?

Output:
a. BAR index
b. byte offset within the BAR

5. PCI Extended capabilities for all the existing capabilities located in the legacy section.
Why?
a. This is for the new driver (such as vfio) to always rely on the new capabilities.
b. Legacy PCI regions is close to its full capacity.

Few option questions:
1. Should the q notification query command be per VF or should be one for all group members (VF)?

Any further comments to address in v1?

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/

Signature · 17 lines
And you're standing here beside me, I love the passing of time.

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/
#200 lore raw
Quoted 5 lines

From: David Edmondson <[email protected]>
Sent: Tuesday, May 2, 2023 3:18 AM

Quoted 9 lines

In line with our recent discussion about agreeing requirements for specification changes, I wanted to say that we have a significant existing estate of VMs using the legacy interface where the customer is disinclined to update their software to a newer version (which might consume the 1.x interface).

Given that, some mechanism for supporting a (mostly) hardware offloaded legacy interface would definitely be useful to us, and the proposal here seems like a sensible approach.

Thanks, David, for the inputs.
I am working on v1 to have legacy interface supported using proposed AQ.

I realized that below listed PCI extended capabilities is not useful for this work because existing capabilities in the legacy region need to be anyway there. And new AQ interface-based method doesn’t use any new capabilities.
So, I will drop below #5 for now.

Regarding, open question below, the AQ commands for the SR-IOV group are for specific group member. Hence, will keep the query as VF level, unless we want to optimize this further. Since its one-time query per VF, it is not hurting the perf.

Quoted 10 lines
Quoted 10 lines

5. PCI Extended capabilities for all the existing capabilities located in the legacy section.
Why?
a. This is for the new driver (such as vfio) to always rely on the new capabilities.
b. Legacy PCI regions is close to its full capacity.

Few option questions:
1. Should the q notification query command be per VF or should be one for all group members (VF)?