Skip to contentSkip to conversation

xen-pvdevice: make device-id property compulsory

PATCH In review Paul Durrant 2 participants 5 messages Nov 13, 2013 – Nov 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-pvdevice: make device-id property compulsory

The intention of the Xen PV device is that it is used as a parent device for PV drivers in Xen HVM guests and the set of PV drivers that bind to the device is determined by its device ID (and possibly vendor ID and revision). As such, the device should not have a default device ID, it should always be supplied by the Xen toolstack.

---
 hw/xen/xen_pvdevice.c    |    6 +++++-
 include/hw/pci/pci_ids.h |    1 -
 2 files changed, 5 insertions(+), 2 deletions(-)
hw/xen/xen_pvdevice.c +5 -1
index 1132c89..c218947 100644
@@ -74,6 +74,10 @@ static int xen_pv_init(PCIDevice *pci_dev)
     XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
     uint8_t *pci_conf;
 
+    /* device-id property must always be supplied */
+    if (d->device_id == 0xffff)
+	    return -1;
+
     pci_conf = pci_dev->config;
 
     pci_set_word(pci_conf + PCI_VENDOR_ID, d->vendor_id);
@@ -99,7 +103,7 @@ static int xen_pv_init(PCIDevice *pci_dev)
 
 static Property xen_pv_props[] = {
     DEFINE_PROP_UINT16("vendor-id", XenPVDevice, vendor_id, PCI_VENDOR_ID_XEN),
-    DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, PCI_DEVICE_ID_XEN_PVDEVICE),
+    DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, 0xffff),
     DEFINE_PROP_UINT8("revision", XenPVDevice, revision, 0x01),
     DEFINE_PROP_UINT32("size", XenPVDevice, size, 0x400000),
     DEFINE_PROP_END_OF_LIST()
include/hw/pci/pci_ids.h +0 -1
index 4c0002b..e597070 100644
@@ -146,7 +146,6 @@
 
 #define PCI_VENDOR_ID_XEN                0x5853
 #define PCI_DEVICE_ID_XEN_PLATFORM       0x0001
-#define PCI_DEVICE_ID_XEN_PVDEVICE       0x0002
 
 #define PCI_VENDOR_ID_NEC                0x1033
 #define PCI_DEVICE_ID_NEC_UPD720200      0x0194
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · Paul Durrant

The intention of the Xen PV device is that it is used as a parent device for PV drivers in Xen HVM guests and the set of PV drivers that bind to the device is determined by its device ID (and possibly vendor ID and revision). As such, the device should not have a default device ID, it should always be supplied by the Xen toolstack.

I'll add it to my queue

Quoted 44 lines
 hw/xen/xen_pvdevice.c    |    6 +++++-
 include/hw/pci/pci_ids.h |    1 -
 2 files changed, 5 insertions(+), 2 deletions(-)
hw/xen/xen_pvdevice.c +5 -1
index 1132c89..c218947 100644
@@ -74,6 +74,10 @@ static int xen_pv_init(PCIDevice *pci_dev)
     XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
     uint8_t *pci_conf;
 
+    /* device-id property must always be supplied */
+    if (d->device_id == 0xffff)
+	    return -1;
+
     pci_conf = pci_dev->config;
 
     pci_set_word(pci_conf + PCI_VENDOR_ID, d->vendor_id);
@@ -99,7 +103,7 @@ static int xen_pv_init(PCIDevice *pci_dev)
 
 static Property xen_pv_props[] = {
     DEFINE_PROP_UINT16("vendor-id", XenPVDevice, vendor_id, PCI_VENDOR_ID_XEN),
-    DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, PCI_DEVICE_ID_XEN_PVDEVICE),
+    DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, 0xffff),
     DEFINE_PROP_UINT8("revision", XenPVDevice, revision, 0x01),
     DEFINE_PROP_UINT32("size", XenPVDevice, size, 0x400000),
     DEFINE_PROP_END_OF_LIST()
include/hw/pci/pci_ids.h +0 -1
index 4c0002b..e597070 100644
@@ -146,7 +146,6 @@
 
 #define PCI_VENDOR_ID_XEN                0x5853
 #define PCI_DEVICE_ID_XEN_PLATFORM       0x0001
-#define PCI_DEVICE_ID_XEN_PVDEVICE       0x0002
 
 #define PCI_VENDOR_ID_NEC                0x1033
 #define PCI_DEVICE_ID_NEC_UPD720200      0x0194
Signature · 1 line
1.7.10.4
#2 lore raw
In reply to Paul Durrant
Quoted 7 lines · Paul Durrant

The intention of the Xen PV device is that it is used as a parent device for PV drivers in Xen HVM guests and the set of PV drivers that bind to the device is determined by its device ID (and possibly vendor ID and revision). As such, the device should not have a default device ID, it should always be supplied by the Xen toolstack.

I'll add it to my queue

Quoted 44 lines
 hw/xen/xen_pvdevice.c    |    6 +++++-
 include/hw/pci/pci_ids.h |    1 -
 2 files changed, 5 insertions(+), 2 deletions(-)
hw/xen/xen_pvdevice.c +5 -1
index 1132c89..c218947 100644
@@ -74,6 +74,10 @@ static int xen_pv_init(PCIDevice *pci_dev)
     XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
     uint8_t *pci_conf;
 
+    /* device-id property must always be supplied */
+    if (d->device_id == 0xffff)
+	    return -1;
+
     pci_conf = pci_dev->config;
 
     pci_set_word(pci_conf + PCI_VENDOR_ID, d->vendor_id);
@@ -99,7 +103,7 @@ static int xen_pv_init(PCIDevice *pci_dev)
 
 static Property xen_pv_props[] = {
     DEFINE_PROP_UINT16("vendor-id", XenPVDevice, vendor_id, PCI_VENDOR_ID_XEN),
-    DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, PCI_DEVICE_ID_XEN_PVDEVICE),
+    DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, 0xffff),
     DEFINE_PROP_UINT8("revision", XenPVDevice, revision, 0x01),
     DEFINE_PROP_UINT32("size", XenPVDevice, size, 0x400000),
     DEFINE_PROP_END_OF_LIST()
include/hw/pci/pci_ids.h +0 -1
index 4c0002b..e597070 100644
@@ -146,7 +146,6 @@
 
 #define PCI_VENDOR_ID_XEN                0x5853
 #define PCI_DEVICE_ID_XEN_PLATFORM       0x0001
-#define PCI_DEVICE_ID_XEN_PVDEVICE       0x0002
 
 #define PCI_VENDOR_ID_NEC                0x1033
 #define PCI_DEVICE_ID_NEC_UPD720200      0x0194
Signature · 1 line
1.7.10.4
#3 lore raw
Quoted 15 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 13 November 2013 18:06
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] xen-pvdevice: make device-id property compulsory

Quoted 6 lines · Paul Durrant

The intention of the Xen PV device is that it is used as a parent device for PV drivers in Xen HVM guests and the set of PV drivers that bind to the device is determined by its device ID (and possibly vendor ID and revision). As such, the device should not have a default device ID, it should always be supplied by the Xen toolstack.

Quoted 4 lines
Quoted 1 line

I'll add it to my queue

Thanks!

Paul

#4 lore raw
In reply to Stefano Stabellini
Quoted 15 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 13 November 2013 18:06
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] xen-pvdevice: make device-id property compulsory

Quoted 6 lines · Paul Durrant

The intention of the Xen PV device is that it is used as a parent device for PV drivers in Xen HVM guests and the set of PV drivers that bind to the device is determined by its device ID (and possibly vendor ID and revision). As such, the device should not have a default device ID, it should always be supplied by the Xen toolstack.

Quoted 4 lines
Quoted 1 line

I'll add it to my queue

Thanks!

Paul