Skip to contentSkip to conversation

allocate pci id for mdpy

PATCH In review Gerd Hoffmann 3 participants 7 messages Apr 24, 2018 – Apr 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 allocate pci id for mdpy

mdpy is a sample pci device for vfio-mdev. Not (yet) merged upstream, patch available here:

https://www.kraxel.org/cgit/linux/commit/?h=vfio-sample-display&id=6fd86cff3d7df38ab89625b16fdd6434b1c18749

Cc Alex Williamson <[email protected]>
---
 docs/specs/pci-ids.txt | 1 +
 include/hw/pci/pci.h   | 1 +
 2 files changed, 2 insertions(+)
docs/specs/pci-ids.txt +1 -0
index bb99a0257e..4d53e5c7d9 100644
@@ -62,6 +62,7 @@ PCI devices (other than virtio):
 1b36:000a  PCI-PCI bridge (multiseat)
 1b36:000b  PCIe Expander Bridge (-device pxb-pcie)
 1b36:000d  PCI xhci usb host adapter
+1b36:000f  mdpy (mdev sample device), linux/samples/vfio-mdev/mdpy.c
 
 All these devices are documented in docs/specs.
 
include/hw/pci/pci.h +1 -0
index a9c3ee5aa2..990d6fcbde 100644
@@ -101,6 +101,7 @@ extern bool pci_available;
 #define PCI_DEVICE_ID_REDHAT_PCIE_RP     0x000c
 #define PCI_DEVICE_ID_REDHAT_XHCI        0x000d
 #define PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE 0x000e
+#define PCI_DEVICE_ID_REDHAT_MDPY        0x000f
 #define PCI_DEVICE_ID_REDHAT_QXL         0x0100
 
 #define FMT_PCIBUS                      PRIx64
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Gerd Hoffmann

mdpy is a sample pci device for vfio-mdev. Not (yet) merged upstream, patch available here:

https://www.kraxel.org/cgit/linux/commit/?h=vfio-sample-display&id=6fd86cff3d7df38ab89625b16fdd6434b1c18749

Cc Alex Williamson <[email protected]>

I presume this should be merged together with the device implementation in qemu, or do you want this in tree sooner?

Quoted 31 lines
---
 docs/specs/pci-ids.txt | 1 +
 include/hw/pci/pci.h   | 1 +
 2 files changed, 2 insertions(+)
docs/specs/pci-ids.txt +1 -0
index bb99a0257e..4d53e5c7d9 100644
@@ -62,6 +62,7 @@ PCI devices (other than virtio):
 1b36:000a  PCI-PCI bridge (multiseat)
 1b36:000b  PCIe Expander Bridge (-device pxb-pcie)
 1b36:000d  PCI xhci usb host adapter
+1b36:000f  mdpy (mdev sample device), linux/samples/vfio-mdev/mdpy.c
 
 All these devices are documented in docs/specs.
 
include/hw/pci/pci.h +1 -0
index a9c3ee5aa2..990d6fcbde 100644
@@ -101,6 +101,7 @@ extern bool pci_available;
 #define PCI_DEVICE_ID_REDHAT_PCIE_RP     0x000c
 #define PCI_DEVICE_ID_REDHAT_XHCI        0x000d
 #define PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE 0x000e
+#define PCI_DEVICE_ID_REDHAT_MDPY        0x000f
 #define PCI_DEVICE_ID_REDHAT_QXL         0x0100
 
 #define FMT_PCIBUS                      PRIx64
Signature · 1 line
2.9.3
#2 lore raw
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Gerd Hoffmann

mdpy is a sample pci device for vfio-mdev. Not (yet) merged upstream, patch available here:

https://www.kraxel.org/cgit/linux/commit/?h=vfio-sample-display&id=6fd86cff3d7df38ab89625b16fdd6434b1c18749

Quoted 8 lines
Quoted 2 lines
Cc Alex Williamson <[email protected]>

I presume this should be merged together with the device implementation in qemu, or do you want this in tree sooner?

There isn't a device implementation in qemu. It's a mdev device provided by the kernel. Can be used with qemu using vfio.

cheers,
Gerd

#3 lore raw
Quoted 16 lines · Gerd Hoffmann
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Gerd Hoffmann

mdpy is a sample pci device for vfio-mdev. Not (yet) merged upstream, patch available here:

https://www.kraxel.org/cgit/linux/commit/?h=vfio-sample-display&id=6fd86cff3d7df38ab89625b16fdd6434b1c18749

Quoted 8 lines
Quoted 2 lines
Cc Alex Williamson <[email protected]>

I presume this should be merged together with the device implementation in qemu, or do you want this in tree sooner?

Quoted 5 lines

There isn't a device implementation in qemu. It's a mdev device provided by the kernel. Can be used with qemu using vfio.

cheers,
Gerd

Why do we need a define in pci.h then?

Signature · 1 line
MST
#4 lore raw
Quoted 13 lines · On Thu, 26 Apr 2018 18:40:40 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 12 lines · Gerd Hoffmann
Quoted 11 lines · Michael S. Tsirkin
Quoted 7 lines · Gerd Hoffmann

mdpy is a sample pci device for vfio-mdev. Not (yet) merged upstream, patch available here:

https://www.kraxel.org/cgit/linux/commit/?h=vfio-sample-display&id=6fd86cff3d7df38ab89625b16fdd6434b1c18749

Cc Alex Williamson <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I presume this should be merged together with the device implementation in qemu, or do you want this in tree sooner?

There isn't a device implementation in qemu. It's a mdev device provided by the kernel. Can be used with qemu using vfio.

Why do we need a define in pci.h then?

Because we want to allocate the device ID rather than squat on an unused one and risk that it later conflicts with an another device. Do we track device ID allocations from the RH vendor ID other than here in QEMU? Thanks,

Alex

#5 lore raw
Quoted 23 lines · Alex Williamson
Quoted 20 lines · On Thu, 26 Apr 2018 18:40:40 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 18 lines · Gerd Hoffmann
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Gerd Hoffmann

mdpy is a sample pci device for vfio-mdev. Not (yet) merged upstream, patch available here:

https://www.kraxel.org/cgit/linux/commit/?h=vfio-sample-display&id=6fd86cff3d7df38ab89625b16fdd6434b1c18749

Quoted 8 lines
Quoted 2 lines
Cc Alex Williamson <[email protected]>

I presume this should be merged together with the device implementation in qemu, or do you want this in tree sooner?

There isn't a device implementation in qemu. It's a mdev device provided by the kernel. Can be used with qemu using vfio.

Quoted 8 lines
Quoted 1 line

Why do we need a define in pci.h then?

Because we want to allocate the device ID rather than squat on an unused one and risk that it later conflicts with an another device. Do we track device ID allocations from the RH vendor ID other than here in QEMU? Thanks,

Alex

We have pci-ids.txt, yes. Unused macros just might get pruned down the line. If you like, add a comment in pci.h saying 0xf is reserved for mdpy.

Signature · 1 line
MST
#6 lore raw
In reply to Michael S. Tsirkin
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · Gerd Hoffmann
Quoted 14 lines · Michael S. Tsirkin
Quoted 7 lines · Gerd Hoffmann

mdpy is a sample pci device for vfio-mdev. Not (yet) merged upstream, patch available here:

https://www.kraxel.org/cgit/linux/commit/?h=vfio-sample-display&id=6fd86cff3d7df38ab89625b16fdd6434b1c18749

Cc Alex Williamson <[email protected]>

I presume this should be merged together with the device implementation in qemu, or do you want this in tree sooner?

Quoted 7 lines
Quoted 5 lines

There isn't a device implementation in qemu. It's a mdev device provided by the kernel. Can be used with qemu using vfio.

cheers,
Gerd

Why do we need a define in pci.h then?

Looks like a good way to make sure we don't hand out the ID twice as docs/specs/pci-ids.txt is not fully in sync with include/hw/pci/pci.h. 1b36:000c and 1b36:000e are missing in docs/specs/pci-ids.txt.

cheers,
Gerd