OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [PATCH] fixup pci: switch from subsystem id to device id


Patch sent to list (and applied by Rusty in
commit fffcbe327c69e510239fff5627034aa2ab4b2d84
    pci: switch from subsystem id to device id
) did not actually implement what commit log said
it implements.

The result is wrong for transitional devices:
Adding 0xfff works for for net+block only;
for transitional pci devices there is no fixed scheme:

~/projects/qemu/include # grep VIRTIO_ID hw/virtio/*.h
hw/virtio/virtio-balloon.h:#define VIRTIO_ID_BALLOON 5
hw/virtio/virtio-blk.h:#define VIRTIO_ID_BLOCK 2
hw/virtio/virtio-net.h:#define VIRTIO_ID_NET   1
hw/virtio/virtio-rng.h:#define VIRTIO_ID_RNG    4
hw/virtio/virtio-scsi.h:#define VIRTIO_ID_SCSI  8
hw/virtio/virtio-serial.h:#define VIRTIO_ID_CONSOLE             3

~/projects/qemu/include # grep VIRTIO hw/pci/*.h
hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_NET         0x1000
hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_BLOCK       0x1001
hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_BALLOON     0x1002
hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_CONSOLE     0x1003
hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_SCSI        0x1004
hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_9P          0x1009

I am guessing TC went by the commit log
(which said "Let's use a new range 0x1040 to 0x107f")
when it approved the change,
so I intend to commit this fixup directly within a
couple of days, unless I hear otherwise.

Cc: Andrew Thornton <andrewth@google.com>
Cc: Rusty Russell <rusty@ozlabs.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 content.tex | 48 +++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 41 insertions(+), 7 deletions(-)

diff --git a/content.tex b/content.tex
index e81636c..f944bed 100644
--- a/content.tex
+++ b/content.tex
@@ -964,23 +964,48 @@ respectively.
 \subsection{PCI Device Discovery}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Discovery}
 
 Any PCI device with PCI Vendor ID 0x1AF4, and PCI Device ID 0x1000 through
-0x103F inclusive is a virtio device. The actual value within this range
+0x107F inclusive is a virtio device. The actual value within this range
 indicates which virtio device is supported by the device.
-The PCI Device ID is calculated by adding 0xFFF to the Virtio Device ID,
+The PCI Device ID is calculated by adding 0x1040 to the Virtio Device ID,
 as indicated in section \ref{sec:Device Types}.
+Additionally, devices MAY utilize a Transitional PCI Device ID range,
+0x1000 to 0x103F depending on the device type.
 
 \devicenormative{\subsubsection}{PCI Device Discovery}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Discovery}
 
 Devices MUST have the PCI Vendor ID 0x1AF4.
-Devices MUST have the PCI Device ID calculated by adding 0xFFF
-to the Virtio Device ID,
-as indicated in section \ref{sec:Device Types}.
+Devices MUST either have the PCI Device ID calculated by adding 0x1040
+to the Virtio Device ID, as indicated in section \ref{sec:Device
+Types} or have the Transitional PCI Device ID depending on the device type,
+as follows:
+\begin{tabular} { |l|c| }
+\hline
+Transitional PCI Device ID  &  Virtio Device    \\
+\hline \hline
+0x1000      &   network card     \\
+\hline
+0x1001     &   block device     \\
+\hline
+0x1002     & memory ballooning (legacy)  \\
+\hline
+0x1003     &      console       \\
+\hline
+0x1004     &     SCSI host      \\
+\hline
+0x1005     &  entropy source    \\
+\hline
+0x1009     &   9P transport     \\
+\hline
+\end{tabular}
+
 For example, the network card device with the Virtio Device ID 1
-has the PCI Device ID 0x1000.
+has the PCI Device ID 0x1041 or the Transitional PCI Device ID 0x1000.
 
 The PCI Subsystem Vendor ID and the PCI Subsystem Device ID MAY reflect
 the PCI Vendor and Device ID of the environment (for informational purposes by the driver).
 
+Non-transitional devices SHOULD have a PCI Device ID in the range
+0x1040 to 0x107f.
 Non-transitional devices SHOULD have a PCI Revision ID of 1 or higher.
 Non-transitional devices SHOULD have a PCI Subsystem Device ID of 0x40 or higher.
 
@@ -989,8 +1014,15 @@ to drive the device.
 
 \drivernormative{\subsubsection}{PCI Device Discovery}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Discovery}
 Drivers MUST match devices with the PCI Vendor ID 0x1AF4 and
-the PCI Device ID calculated by adding 0xFFF to the Virtio Device ID,
+the PCI Device ID in the range 0x1040 to 0x107f,
+calculated by adding 0x1040 to the Virtio Device ID,
 as indicated in section \ref{sec:Device Types}.
+Drivers for device types listed in section \ref{sec:Virtio
+Transport Options / Virtio Over PCI Bus / PCI Device Discovery}
+MUST match devices with the PCI Vendor ID 0x1AF4 and
+the Transitional PCI Device ID indicated in section
+ \ref{sec:Virtio
+Transport Options / Virtio Over PCI Bus / PCI Device Discovery}.
 
 Drivers MUST match any PCI Revision ID value.
 Drivers MAY match any PCI Subsystem Vendor ID and any
@@ -1000,6 +1032,8 @@ PCI Subsystem Device ID value.
 Transitional devices MUST have a PCI Revision ID of 0.
 Transitional devices MUST have the PCI Subsystem Device ID
 matching the Virtio Device ID, as indicated in section \ref{sec:Device Types}.
+Transitional devices MUST have the Transitional PCI Device ID in
+the range 0x1000 to 0x103f.
 
 This is to match legacy drivers.
 
-- 
MST


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]