diff mbox series

allocate pci id for mdpy

Message ID 20180424063857.29246-1-kraxel@redhat.com
State New
Headers show
Series allocate pci id for mdpy | expand

Commit Message

Gerd Hoffmann April 24, 2018, 6:38 a.m. UTC
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 <alex.williamson@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 docs/specs/pci-ids.txt | 1 +
 include/hw/pci/pci.h   | 1 +
 2 files changed, 2 insertions(+)

Comments

Michael S. Tsirkin April 26, 2018, 3:10 p.m. UTC | #1
On Tue, Apr 24, 2018 at 08:38:57AM +0200, Gerd Hoffmann wrote:
> 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 <alex.williamson@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

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

> ---
>  docs/specs/pci-ids.txt | 1 +
>  include/hw/pci/pci.h   | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt
> index bb99a0257e..4d53e5c7d9 100644
> --- a/docs/specs/pci-ids.txt
> +++ b/docs/specs/pci-ids.txt
> @@ -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.
>  
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index a9c3ee5aa2..990d6fcbde 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -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
> -- 
> 2.9.3
Gerd Hoffmann April 26, 2018, 3:31 p.m. UTC | #2
On Thu, Apr 26, 2018 at 06:10:48PM +0300, Michael S. Tsirkin wrote:
> On Tue, Apr 24, 2018 at 08:38:57AM +0200, Gerd Hoffmann wrote:
> > 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 <alex.williamson@redhat.com>
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> 
> 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
Michael S. Tsirkin April 26, 2018, 3:40 p.m. UTC | #3
On Thu, Apr 26, 2018 at 05:31:48PM +0200, Gerd Hoffmann wrote:
> On Thu, Apr 26, 2018 at 06:10:48PM +0300, Michael S. Tsirkin wrote:
> > On Tue, Apr 24, 2018 at 08:38:57AM +0200, Gerd Hoffmann wrote:
> > > 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 <alex.williamson@redhat.com>
> > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > 
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > 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

Why do we need a define in pci.h then?
Alex Williamson April 26, 2018, 5 p.m. UTC | #4
On Thu, 26 Apr 2018 18:40:40 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Apr 26, 2018 at 05:31:48PM +0200, Gerd Hoffmann wrote:
> > On Thu, Apr 26, 2018 at 06:10:48PM +0300, Michael S. Tsirkin wrote:  
> > > On Tue, Apr 24, 2018 at 08:38:57AM +0200, Gerd Hoffmann wrote:  
> > > > 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 <alex.williamson@redhat.com>
> > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>  
> > > 
> > > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > > 
> > > 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
Michael S. Tsirkin April 26, 2018, 6:36 p.m. UTC | #5
On Thu, Apr 26, 2018 at 11:00:28AM -0600, Alex Williamson wrote:
> On Thu, 26 Apr 2018 18:40:40 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Apr 26, 2018 at 05:31:48PM +0200, Gerd Hoffmann wrote:
> > > On Thu, Apr 26, 2018 at 06:10:48PM +0300, Michael S. Tsirkin wrote:  
> > > > On Tue, Apr 24, 2018 at 08:38:57AM +0200, Gerd Hoffmann wrote:  
> > > > > 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 <alex.williamson@redhat.com>
> > > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>  
> > > > 
> > > > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > > > 
> > > > 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

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.
Gerd Hoffmann April 27, 2018, 6:18 a.m. UTC | #6
On Thu, Apr 26, 2018 at 06:40:40PM +0300, Michael S. Tsirkin wrote:
> On Thu, Apr 26, 2018 at 05:31:48PM +0200, Gerd Hoffmann wrote:
> > On Thu, Apr 26, 2018 at 06:10:48PM +0300, Michael S. Tsirkin wrote:
> > > On Tue, Apr 24, 2018 at 08:38:57AM +0200, Gerd Hoffmann wrote:
> > > > 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 <alex.williamson@redhat.com>
> > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > 
> > > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > > 
> > > 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
> 
> 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
diff mbox series

Patch

diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt
index bb99a0257e..4d53e5c7d9 100644
--- a/docs/specs/pci-ids.txt
+++ b/docs/specs/pci-ids.txt
@@ -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.
 
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index a9c3ee5aa2..990d6fcbde 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -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