qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* missing entries from docs/specs/pci-ids.txt ?
@ 2022-09-27 12:05 Peter Maydell
  2022-09-29 13:31 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2022-09-27 12:05 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Gerd Hoffmann

I noticed today that docs/specs/pci-ids.txt doesn't have
an entry for the virtio-iommu, which is defined in pci.h as

#define PCI_DEVICE_ID_VIRTIO_IOMMU       0x1014

There seem to be a few other virtio ID values defined in the
header but not in the txt file too -- do we need to update it?

Conversely, none of the "modern" ID values in the txt file seem
to have a #define. I suspect I'm missing something about how
this works.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: missing entries from docs/specs/pci-ids.txt ?
  2022-09-27 12:05 missing entries from docs/specs/pci-ids.txt ? Peter Maydell
@ 2022-09-29 13:31 ` Gerd Hoffmann
  2022-09-29 13:48   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2022-09-29 13:31 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

On Tue, Sep 27, 2022 at 01:05:36PM +0100, Peter Maydell wrote:
> I noticed today that docs/specs/pci-ids.txt doesn't have
> an entry for the virtio-iommu, which is defined in pci.h as
> 
> #define PCI_DEVICE_ID_VIRTIO_IOMMU       0x1014
> 
> There seem to be a few other virtio ID values defined in the
> header but not in the txt file too -- do we need to update it?

Yep.

> Conversely, none of the "modern" ID values in the txt file seem
> to have a #define. I suspect I'm missing something about how
> this works.

Added a short paragraph explaining this.

Not sure what to do with the modern device list.  Add everything ?
Or just point to include/standard-headers/linux/virtio_ids.h ?

take care,
  Gerd

commit 4dac16edd97dd7bdf499f3cedd725a6a87523510
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Thu Sep 29 15:25:19 2022 +0200

    pci-ids: sync docs + header
    
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt
index dd6859d039d0..628b87c29dfa 100644
--- a/docs/specs/pci-ids.txt
+++ b/docs/specs/pci-ids.txt
@@ -15,6 +15,9 @@ The 1000 -> 10ff device ID range is used as follows for virtio-pci devices.
 Note that this allocation separate from the virtio device IDs, which are
 maintained as part of the virtio specification.
 
+Modern virtio-pci devices have a strict id mapping and the rule is:
+pci-device-id = 0x1040 + virtio-device-id
+
 1af4:1000  network device (legacy)
 1af4:1001  block device (legacy)
 1af4:1002  balloon device (legacy)
@@ -22,6 +25,10 @@ maintained as part of the virtio specification.
 1af4:1004  SCSI host bus adapter device (legacy)
 1af4:1005  entropy generator device (legacy)
 1af4:1009  9p filesystem device (legacy)
+1af4:1012  vsock device (legacy)
+1af4:1013  pmem device (legacy)
+1af4:1014  iommu device (legacy)
+1af4:1015  mem device (legacy)
 
 1af4:1041  network device (modern)
 1af4:1042  block device (modern)
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index b54b6ef88fc3..3b852199660c 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -71,7 +71,12 @@ extern bool pci_available;
 #define PCI_DEVICE_ID_INTEL_82557        0x1229
 #define PCI_DEVICE_ID_INTEL_82801IR      0x2922
 
-/* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */
+/*
+ * Red Hat / Qumranet (for QEMU)
+ *
+ * These are documented in docs/specs/pci-ids.txt
+ * PLEASE KEEP HEADER + DOCS IN SYNC
+ */
 #define PCI_VENDOR_ID_REDHAT_QUMRANET    0x1af4
 #define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4
 #define PCI_SUBDEVICE_ID_QEMU            0x1100



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: missing entries from docs/specs/pci-ids.txt ?
  2022-09-29 13:31 ` Gerd Hoffmann
@ 2022-09-29 13:48   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2022-09-29 13:48 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On Thu, 29 Sept 2022 at 14:31, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Tue, Sep 27, 2022 at 01:05:36PM +0100, Peter Maydell wrote:
> > I noticed today that docs/specs/pci-ids.txt doesn't have
> > an entry for the virtio-iommu, which is defined in pci.h as
> >
> > #define PCI_DEVICE_ID_VIRTIO_IOMMU       0x1014
> >
> > There seem to be a few other virtio ID values defined in the
> > header but not in the txt file too -- do we need to update it?
>
> Yep.
>
> > Conversely, none of the "modern" ID values in the txt file seem
> > to have a #define. I suspect I'm missing something about how
> > this works.
>
> Added a short paragraph explaining this.
>
> Not sure what to do with the modern device list.  Add everything ?
> Or just point to include/standard-headers/linux/virtio_ids.h ?

At the moment we have entries for 9 of the 41 'modern' devices.
We should either (a) have entries for all of them or
(b) delete the existing individual 'modern' entries and instead
document the range as being used for modern devices with a
suitable pointer to where to find the list of virtio IDs.
(How far up does the range go? All the way to 01ef?)

If we are strictly following the virtio-ID-to-modern-PCI-ID
rule then it seems like we're just making work for ourselves
if we add a line to this file for every virtio ID, so I
would favour option b.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-29 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-27 12:05 missing entries from docs/specs/pci-ids.txt ? Peter Maydell
2022-09-29 13:31 ` Gerd Hoffmann
2022-09-29 13:48   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).