Skip to contentSkip to conversation

Citrix PV Bus device [V3]

PATCH In review Paul Durrant 5 participants 26 messages Jul 2, 2013 – Jul 3, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Citrix PV Bus device [V3]

This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.

V3:
- Addresses comments from Anthony Liguori and Peter Maydell

V2:
- Addresses comments from Andreas Farber and Paolo Bonzini

---
 hw/misc/Makefile.objs    |    2 +
 hw/misc/citrix_pv_bus.c  |  127 ++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci/pci_ids.h |    7 ++-
 trace-events             |    4 ++
 4 files changed, 138 insertions(+), 2 deletions(-)
 create mode 100644 hw/misc/citrix_pv_bus.c
hw/misc/Makefile.objs +2 -0
index 2578e29..ffd29ea 100644
@@ -41,3 +41,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_XEN) += citrix-pv-bus.o
hw/misc/citrix_pv_bus.c new file +127 -0

127 lines not on this page · raw message

include/hw/pci/pci_ids.h +5 -2
index d8dc2f1..95b236f 100644
@@ -142,8 +142,11 @@
 
 #define PCI_DEVICE_ID_INTEL_Q35_MCH      0x29c0
 
-#define PCI_VENDOR_ID_XEN               0x5853
-#define PCI_DEVICE_ID_XEN_PLATFORM      0x0001
+#define PCI_VENDOR_ID_CITRIX             0x5853
+#define PCI_DEVICE_ID_CITRIX_PV_BUS      0x0002
+
+#define PCI_VENDOR_ID_XEN                (PCI_VENDOR_ID_CITRIX)
+#define PCI_DEVICE_ID_XEN_PLATFORM       0x0001
 
 #define PCI_VENDOR_ID_NEC                0x1033
 #define PCI_DEVICE_ID_NEC_UPD720200      0x0194
trace-events +4 -0
index c5f1ccb..63052b9 100644
@@ -1161,3 +1161,7 @@ kvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
 # qom/object.c
 object_dynamic_cast_assert(const char *type, const char *target, const char *file, int line, const char *func) "%s->%s (%s:%d:%s)"
 object_class_dynamic_cast_assert(const char *type, const char *target, const char *file, int line, const char *func) "%s->%s (%s:%d:%s)"
+
+# hw/i386/citrix_pv_bus.c
+citrix_pv_bus_mmio_read(uint64_t addr) "WARNING: read from Citrix PV MMIO space (address %"PRIx64")"
+citrix_pv_bus_mmio_write(uint64_t addr) "WARNING: write to Citrix PV MMIO space (address %"PRIx64")"
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 10 lines · Paul Durrant

This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.

Quoted 7 lines

V3:
- Addresses comments from Anthony Liguori and Peter Maydell

V2:
- Addresses comments from Andreas Farber and Paolo Bonzini

I do realize that this is v3 and I didn't step in the discussion before, sorry for the delay in my response. I admit I didn't read the entire thread, so excuse me if I repeat things already said before.

Quoted 133 lines
 hw/misc/Makefile.objs    |    2 +
 hw/misc/citrix_pv_bus.c  |  127 ++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci/pci_ids.h |    7 ++-
 trace-events             |    4 ++
 4 files changed, 138 insertions(+), 2 deletions(-)
 create mode 100644 hw/misc/citrix_pv_bus.c
hw/misc/Makefile.objs +2 -0
index 2578e29..ffd29ea 100644
@@ -41,3 +41,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_XEN) += citrix-pv-bus.o
hw/misc/citrix_pv_bus.c new file +110 -0
new file mode 100644
index 0000000..76e5e13
@@ -0,0 +1,127 @@
+
+/* Copyright (c) Citrix Systems Inc.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, 
+ * with or without modification, are permitted provided 
+ * that the following conditions are met:
+ * 
+ * *   Redistributions of source code must retain the above 
+ *     copyright notice, this list of conditions and the 
+ *     following disclaimer.
+ * *   Redistributions in binary form must reproduce the above 
+ *     copyright notice, this list of conditions and the 
+ *     following disclaimer in the documentation and/or other 
+ *     materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ * SUCH DAMAGE.
+ */
+
+#include "hw/hw.h"
+#include "hw/pci/pci.h"
+#include "trace.h"
+
+#define TYPE_CITRIX_PV_BUS_DEVICE  "citrix-pv"
+
+#define CITRIX_PV_BUS_DEVICE(obj) \
+     OBJECT_CHECK(CitrixPVBusDevice, (obj), TYPE_CITRIX_PV_BUS_DEVICE)
+
+typedef struct CitrixPVBusDevice {
+    /*< private >*/
+    PCIDevice       parent_obj;
+    /*< public >*/
+    uint8_t         revision;
+    uint32_t        size;
+    MemoryRegion    mmio;
+} CitrixPVBusDevice;
+
+static uint64_t citrix_pv_bus_mmio_read(void *opaque, hwaddr addr,
+                                        unsigned size)
+{
+    trace_citrix_pv_bus_mmio_read(addr);
+
+    return ~(uint64_t)0;
+}
+
+static void citrix_pv_bus_mmio_write(void *opaque, hwaddr addr,
+                                     uint64_t val, unsigned size)
+{
+    trace_citrix_pv_bus_mmio_write(addr);
+}
+
+static const MemoryRegionOps citrix_pv_bus_mmio_ops = {
+    .read = &citrix_pv_bus_mmio_read,
+    .write = &citrix_pv_bus_mmio_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int citrix_pv_bus_init(PCIDevice *pci_dev)
+{
+    CitrixPVBusDevice *d = CITRIX_PV_BUS_DEVICE(pci_dev);
+    uint8_t *pci_conf;
+
+    pci_conf = pci_dev->config;
+
+    pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_MEMORY);
+    pci_set_byte(pci_conf + PCI_REVISION_ID, d->revision);
+
+    pci_config_set_prog_interface(pci_conf, 0);
+
+    pci_conf[PCI_INTERRUPT_PIN] = 1;
+
+    memory_region_init_io(&d->mmio, &citrix_pv_bus_mmio_ops, d,
+                          "citrix-bus-mmio", d->size);
+
+    pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
+                     &d->mmio);
+
+    return 0;
+}
+
+static Property citrix_pv_bus_props[] = {
+    DEFINE_PROP_UINT8("revision", CitrixPVBusDevice, revision, 0x01),
+    DEFINE_PROP_UINT32("size", CitrixPVBusDevice, size, 0x400000),
+    DEFINE_PROP_END_OF_LIST()
+};
+
+static void citrix_pv_bus_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = citrix_pv_bus_init;
+    k->vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->device_id = PCI_DEVICE_ID_CITRIX_PV_BUS;
+    k->class_id = PCI_CLASS_SYSTEM_OTHER;
+    k->subsystem_vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->subsystem_id = PCI_DEVICE_ID_CITRIX_PV_BUS;

hw/misc/citrix_pv_bus.c line 120

Quoted 10 lines
hw/misc/citrix_pv_bus.c new file +10 -0
+    dc->desc = "Citrix PV Bus";
+    dc->props = citrix_pv_bus_props;
+}
+
+static const TypeInfo citrix_pv_bus_type_info = {
+    .name          = TYPE_CITRIX_PV_BUS_DEVICE,
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(CitrixPVBusDevice),
+    .class_init    = citrix_pv_bus_class_init,
+};

I get that we need a new device because Windows drivers from Windows Update need to bind to it and we can't simply "force" an update to all the Windows HVM instances out there.
For example one might have installed another vendor's Windows PV drivers and might not want to switch to the ones provided by Citrix.

However we simply can't add a new device in QEMU for each vendor that decides to implement Windows Xen PV drivers. We have to make this configurable.

Finally if possible we shouldn't assume that the admin knows beforehand what operating system is installed in the VM.

As a result I think that:

- it's a good idea to add a new device but at the same time we should also leave the old one there, so that existing installations (Linux, BSD, Solaris, etc.) will keep working without troubles and people that wants to manually install the Windows PV drivers from the installer can keep doing so;

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

- Windows PV drivers vendors might want to consider continuing on providing a Windows PV drivers installer that binds to the current PCI vendor and device ids so that people can continue consuming them the same way they have been doing so far without requiring host admin intervention.

Quoted 8 lines
include/hw/pci/pci_ids.h +0 -0
index d8dc2f1..95b236f 100644
@@ -142,8 +142,11 @@
 
 #define PCI_DEVICE_ID_INTEL_Q35_MCH      0x29c0
 

include/hw/pci/pci_ids.h line 152

Quoted 10 lines
include/hw/pci/pci_ids.h +5 -2
-#define PCI_VENDOR_ID_XEN               0x5853
-#define PCI_DEVICE_ID_XEN_PLATFORM      0x0001
+#define PCI_VENDOR_ID_CITRIX             0x5853
+#define PCI_DEVICE_ID_CITRIX_PV_BUS      0x0002
+
+#define PCI_VENDOR_ID_XEN                (PCI_VENDOR_ID_CITRIX)
+#define PCI_DEVICE_ID_XEN_PLATFORM       0x0001
 
 #define PCI_VENDOR_ID_NEC                0x1033
 #define PCI_DEVICE_ID_NEC_UPD720200      0x0194

This is unacceptable. Since when the xenproject pci vendor ID has become the Citrix vendor ID?

#2 lore raw
In reply to Paul Durrant
Quoted 10 lines · Paul Durrant

This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.

Quoted 7 lines

V3:
- Addresses comments from Anthony Liguori and Peter Maydell

V2:
- Addresses comments from Andreas Farber and Paolo Bonzini

I do realize that this is v3 and I didn't step in the discussion before, sorry for the delay in my response. I admit I didn't read the entire thread, so excuse me if I repeat things already said before.

Quoted 133 lines
 hw/misc/Makefile.objs    |    2 +
 hw/misc/citrix_pv_bus.c  |  127 ++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci/pci_ids.h |    7 ++-
 trace-events             |    4 ++
 4 files changed, 138 insertions(+), 2 deletions(-)
 create mode 100644 hw/misc/citrix_pv_bus.c
hw/misc/Makefile.objs +2 -0
index 2578e29..ffd29ea 100644
@@ -41,3 +41,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_XEN) += citrix-pv-bus.o
hw/misc/citrix_pv_bus.c new file +110 -0
new file mode 100644
index 0000000..76e5e13
@@ -0,0 +1,127 @@
+
+/* Copyright (c) Citrix Systems Inc.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, 
+ * with or without modification, are permitted provided 
+ * that the following conditions are met:
+ * 
+ * *   Redistributions of source code must retain the above 
+ *     copyright notice, this list of conditions and the 
+ *     following disclaimer.
+ * *   Redistributions in binary form must reproduce the above 
+ *     copyright notice, this list of conditions and the 
+ *     following disclaimer in the documentation and/or other 
+ *     materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ * SUCH DAMAGE.
+ */
+
+#include "hw/hw.h"
+#include "hw/pci/pci.h"
+#include "trace.h"
+
+#define TYPE_CITRIX_PV_BUS_DEVICE  "citrix-pv"
+
+#define CITRIX_PV_BUS_DEVICE(obj) \
+     OBJECT_CHECK(CitrixPVBusDevice, (obj), TYPE_CITRIX_PV_BUS_DEVICE)
+
+typedef struct CitrixPVBusDevice {
+    /*< private >*/
+    PCIDevice       parent_obj;
+    /*< public >*/
+    uint8_t         revision;
+    uint32_t        size;
+    MemoryRegion    mmio;
+} CitrixPVBusDevice;
+
+static uint64_t citrix_pv_bus_mmio_read(void *opaque, hwaddr addr,
+                                        unsigned size)
+{
+    trace_citrix_pv_bus_mmio_read(addr);
+
+    return ~(uint64_t)0;
+}
+
+static void citrix_pv_bus_mmio_write(void *opaque, hwaddr addr,
+                                     uint64_t val, unsigned size)
+{
+    trace_citrix_pv_bus_mmio_write(addr);
+}
+
+static const MemoryRegionOps citrix_pv_bus_mmio_ops = {
+    .read = &citrix_pv_bus_mmio_read,
+    .write = &citrix_pv_bus_mmio_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int citrix_pv_bus_init(PCIDevice *pci_dev)
+{
+    CitrixPVBusDevice *d = CITRIX_PV_BUS_DEVICE(pci_dev);
+    uint8_t *pci_conf;
+
+    pci_conf = pci_dev->config;
+
+    pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_MEMORY);
+    pci_set_byte(pci_conf + PCI_REVISION_ID, d->revision);
+
+    pci_config_set_prog_interface(pci_conf, 0);
+
+    pci_conf[PCI_INTERRUPT_PIN] = 1;
+
+    memory_region_init_io(&d->mmio, &citrix_pv_bus_mmio_ops, d,
+                          "citrix-bus-mmio", d->size);
+
+    pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
+                     &d->mmio);
+
+    return 0;
+}
+
+static Property citrix_pv_bus_props[] = {
+    DEFINE_PROP_UINT8("revision", CitrixPVBusDevice, revision, 0x01),
+    DEFINE_PROP_UINT32("size", CitrixPVBusDevice, size, 0x400000),
+    DEFINE_PROP_END_OF_LIST()
+};
+
+static void citrix_pv_bus_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = citrix_pv_bus_init;
+    k->vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->device_id = PCI_DEVICE_ID_CITRIX_PV_BUS;
+    k->class_id = PCI_CLASS_SYSTEM_OTHER;
+    k->subsystem_vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->subsystem_id = PCI_DEVICE_ID_CITRIX_PV_BUS;

hw/misc/citrix_pv_bus.c line 120

Quoted 10 lines
hw/misc/citrix_pv_bus.c new file +10 -0
+    dc->desc = "Citrix PV Bus";
+    dc->props = citrix_pv_bus_props;
+}
+
+static const TypeInfo citrix_pv_bus_type_info = {
+    .name          = TYPE_CITRIX_PV_BUS_DEVICE,
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(CitrixPVBusDevice),
+    .class_init    = citrix_pv_bus_class_init,
+};

I get that we need a new device because Windows drivers from Windows Update need to bind to it and we can't simply "force" an update to all the Windows HVM instances out there.
For example one might have installed another vendor's Windows PV drivers and might not want to switch to the ones provided by Citrix.

However we simply can't add a new device in QEMU for each vendor that decides to implement Windows Xen PV drivers. We have to make this configurable.

Finally if possible we shouldn't assume that the admin knows beforehand what operating system is installed in the VM.

As a result I think that:

- it's a good idea to add a new device but at the same time we should also leave the old one there, so that existing installations (Linux, BSD, Solaris, etc.) will keep working without troubles and people that wants to manually install the Windows PV drivers from the installer can keep doing so;

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

- Windows PV drivers vendors might want to consider continuing on providing a Windows PV drivers installer that binds to the current PCI vendor and device ids so that people can continue consuming them the same way they have been doing so far without requiring host admin intervention.

Quoted 8 lines
include/hw/pci/pci_ids.h +0 -0
index d8dc2f1..95b236f 100644
@@ -142,8 +142,11 @@
 
 #define PCI_DEVICE_ID_INTEL_Q35_MCH      0x29c0
 

include/hw/pci/pci_ids.h line 152

Quoted 10 lines
include/hw/pci/pci_ids.h +5 -2
-#define PCI_VENDOR_ID_XEN               0x5853
-#define PCI_DEVICE_ID_XEN_PLATFORM      0x0001
+#define PCI_VENDOR_ID_CITRIX             0x5853
+#define PCI_DEVICE_ID_CITRIX_PV_BUS      0x0002
+
+#define PCI_VENDOR_ID_XEN                (PCI_VENDOR_ID_CITRIX)
+#define PCI_DEVICE_ID_XEN_PLATFORM       0x0001
 
 #define PCI_VENDOR_ID_NEC                0x1033
 #define PCI_DEVICE_ID_NEC_UPD720200      0x0194

This is unacceptable. Since when the xenproject pci vendor ID has become the Citrix vendor ID?

#3 lore raw
Quoted 7 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Anthony,
would you be happy to have a PCI device in QEMU with configurable vendor and device IDs?
If not, would you be OK with a PCI device with the Xen vendor ID but a configurable device ID?

#4 lore raw
In reply to Stefano Stabellini
Quoted 7 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Anthony,
would you be happy to have a PCI device in QEMU with configurable vendor and device IDs?
If not, would you be OK with a PCI device with the Xen vendor ID but a configurable device ID?

#5 lore raw
Quoted 9 lines · Stefano Stabellini
Quoted 7 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 3 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable vendor and device IDs?

We already have this in other places (USB devices, for instance), so yeah, no problem there.

I will say that having to force a user to choose which "vendor" drivers they use sucks. It's ashame that both Xen and KVM suffer this problem of everyone introducing their own variants of pv drivers.

Regards,

Anthony Liguori

Quoted 2 lines

If not, would you be OK with a PCI device with the Xen vendor ID but a configurable device ID?

#6 lore raw
In reply to Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 7 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 3 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable vendor and device IDs?

We already have this in other places (USB devices, for instance), so yeah, no problem there.

I will say that having to force a user to choose which "vendor" drivers they use sucks. It's ashame that both Xen and KVM suffer this problem of everyone introducing their own variants of pv drivers.

Regards,

Anthony Liguori

Quoted 2 lines

If not, would you be OK with a PCI device with the Xen vendor ID but a configurable device ID?

#17 lore raw
In reply to Stefano Stabellini
Quoted 191 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 02 July 2013 17:42
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 7 lines · Paul Durrant

This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may

not be

Quoted 10 lines

desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.

V3:
- Addresses comments from Anthony Liguori and Peter Maydell

V2:
- Addresses comments from Andreas Farber and Paolo Bonzini

I do realize that this is v3 and I didn't step in the discussion before, sorry for the delay in my response. I admit I didn't read the entire thread, so excuse me if I repeat things already said before.

Quoted 2 lines
 hw/misc/Makefile.objs    |    2 +
 hw/misc/citrix_pv_bus.c  |  127

++++++++++++++++++++++++++++++++++++++++++++++

Quoted 51 lines
 include/hw/pci/pci_ids.h |    7 ++-
 trace-events             |    4 ++
 4 files changed, 138 insertions(+), 2 deletions(-)
 create mode 100644 hw/misc/citrix_pv_bus.c
hw/misc/Makefile.objs +2 -0
index 2578e29..ffd29ea 100644
@@ -41,3 +41,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_XEN) += citrix-pv-bus.o
hw/misc/citrix_pv_bus.c new file +30 -0
new file mode 100644
index 0000000..76e5e13
@@ -0,0 +1,127 @@
+
+/* Copyright (c) Citrix Systems Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer.
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
+ *     materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.

hw/misc/citrix_pv_bus.c line 40

Quoted 10 lines
hw/misc/citrix_pv_bus.c new file +10 -0
+ */
+
+#include "hw/hw.h"
+#include "hw/pci/pci.h"
+#include "trace.h"
+
+#define TYPE_CITRIX_PV_BUS_DEVICE  "citrix-pv"
+
+#define CITRIX_PV_BUS_DEVICE(obj) \
+     OBJECT_CHECK(CitrixPVBusDevice, (obj),

TYPE_CITRIX_PV_BUS_DEVICE)

Quoted 70 lines
hw/misc/citrix_pv_bus.c new file +70 -0
+
+typedef struct CitrixPVBusDevice {
+    /*< private >*/
+    PCIDevice       parent_obj;
+    /*< public >*/
+    uint8_t         revision;
+    uint32_t        size;
+    MemoryRegion    mmio;
+} CitrixPVBusDevice;
+
+static uint64_t citrix_pv_bus_mmio_read(void *opaque, hwaddr addr,
+                                        unsigned size)
+{
+    trace_citrix_pv_bus_mmio_read(addr);
+
+    return ~(uint64_t)0;
+}
+
+static void citrix_pv_bus_mmio_write(void *opaque, hwaddr addr,
+                                     uint64_t val, unsigned size)
+{
+    trace_citrix_pv_bus_mmio_write(addr);
+}
+
+static const MemoryRegionOps citrix_pv_bus_mmio_ops = {
+    .read = &citrix_pv_bus_mmio_read,
+    .write = &citrix_pv_bus_mmio_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int citrix_pv_bus_init(PCIDevice *pci_dev)
+{
+    CitrixPVBusDevice *d = CITRIX_PV_BUS_DEVICE(pci_dev);
+    uint8_t *pci_conf;
+
+    pci_conf = pci_dev->config;
+
+    pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_MEMORY);
+    pci_set_byte(pci_conf + PCI_REVISION_ID, d->revision);
+
+    pci_config_set_prog_interface(pci_conf, 0);
+
+    pci_conf[PCI_INTERRUPT_PIN] = 1;
+
+    memory_region_init_io(&d->mmio, &citrix_pv_bus_mmio_ops, d,
+                          "citrix-bus-mmio", d->size);
+
+    pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
+                     &d->mmio);
+
+    return 0;
+}
+
+static Property citrix_pv_bus_props[] = {
+    DEFINE_PROP_UINT8("revision", CitrixPVBusDevice, revision, 0x01),
+    DEFINE_PROP_UINT32("size", CitrixPVBusDevice, size, 0x400000),
+    DEFINE_PROP_END_OF_LIST()
+};
+
+static void citrix_pv_bus_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = citrix_pv_bus_init;
+    k->vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->device_id = PCI_DEVICE_ID_CITRIX_PV_BUS;
+    k->class_id = PCI_CLASS_SYSTEM_OTHER;
+    k->subsystem_vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->subsystem_id = PCI_DEVICE_ID_CITRIX_PV_BUS;

hw/misc/citrix_pv_bus.c line 120

Quoted 10 lines
hw/misc/citrix_pv_bus.c new file +10 -0
+    dc->desc = "Citrix PV Bus";
+    dc->props = citrix_pv_bus_props;
+}
+
+static const TypeInfo citrix_pv_bus_type_info = {
+    .name          = TYPE_CITRIX_PV_BUS_DEVICE,
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(CitrixPVBusDevice),
+    .class_init    = citrix_pv_bus_class_init,
+};

I get that we need a new device because Windows drivers from Windows Update need to bind to it and we can't simply "force" an update to all the Windows HVM instances out there.
For example one might have installed another vendor's Windows PV drivers and might not want to switch to the ones provided by Citrix.

However we simply can't add a new device in QEMU for each vendor that decides to implement Windows Xen PV drivers. We have to make this configurable.

Finally if possible we shouldn't assume that the admin knows beforehand what operating system is installed in the VM.

Quoted 8 lines

As a result I think that:

- it's a good idea to add a new device but at the same time we should also leave the old one there, so that existing installations (Linux, BSD, Solaris, etc.) will keep working without troubles and people that wants to manually install the Windows PV drivers from the installer can keep doing so;

Absolutely, and since Alex Bligh's comment on my original xen-platform-2 patch I realise this had to be the case; hence the idea of the secondary device.

Quoted 8 lines

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 5 lines

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

This all sounds fine; it's a generalization of what I've already coded up so I'm happy to refactor it. Any suggestions on a name? "xen-pvdevice", perhaps, to link it to your proposed VM config option?

Quoted 6 lines

- Windows PV drivers vendors might want to consider continuing on providing a Windows PV drivers installer that binds to the current PCI vendor and device ids so that people can continue consuming them the same way they have been doing so far without requiring host admin intervention.

We (Citrix) may well do that too. The build script for the win-xenbus driver takes the binding information as an argument so it's trivial for anyone to build that driver to bind to any PCI device.

Paul

#18 lore raw
In reply to Stefano Stabellini
Quoted 191 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 02 July 2013 17:42
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 7 lines · Paul Durrant

This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may

not be

Quoted 10 lines

desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.

V3:
- Addresses comments from Anthony Liguori and Peter Maydell

V2:
- Addresses comments from Andreas Farber and Paolo Bonzini

I do realize that this is v3 and I didn't step in the discussion before, sorry for the delay in my response. I admit I didn't read the entire thread, so excuse me if I repeat things already said before.

Quoted 2 lines
 hw/misc/Makefile.objs    |    2 +
 hw/misc/citrix_pv_bus.c  |  127

++++++++++++++++++++++++++++++++++++++++++++++

Quoted 51 lines
 include/hw/pci/pci_ids.h |    7 ++-
 trace-events             |    4 ++
 4 files changed, 138 insertions(+), 2 deletions(-)
 create mode 100644 hw/misc/citrix_pv_bus.c
hw/misc/Makefile.objs +2 -0
index 2578e29..ffd29ea 100644
@@ -41,3 +41,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_XEN) += citrix-pv-bus.o
hw/misc/citrix_pv_bus.c new file +30 -0
new file mode 100644
index 0000000..76e5e13
@@ -0,0 +1,127 @@
+
+/* Copyright (c) Citrix Systems Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer.
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
+ *     materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.

hw/misc/citrix_pv_bus.c line 40

Quoted 10 lines
hw/misc/citrix_pv_bus.c new file +10 -0
+ */
+
+#include "hw/hw.h"
+#include "hw/pci/pci.h"
+#include "trace.h"
+
+#define TYPE_CITRIX_PV_BUS_DEVICE  "citrix-pv"
+
+#define CITRIX_PV_BUS_DEVICE(obj) \
+     OBJECT_CHECK(CitrixPVBusDevice, (obj),

TYPE_CITRIX_PV_BUS_DEVICE)

Quoted 70 lines
hw/misc/citrix_pv_bus.c new file +70 -0
+
+typedef struct CitrixPVBusDevice {
+    /*< private >*/
+    PCIDevice       parent_obj;
+    /*< public >*/
+    uint8_t         revision;
+    uint32_t        size;
+    MemoryRegion    mmio;
+} CitrixPVBusDevice;
+
+static uint64_t citrix_pv_bus_mmio_read(void *opaque, hwaddr addr,
+                                        unsigned size)
+{
+    trace_citrix_pv_bus_mmio_read(addr);
+
+    return ~(uint64_t)0;
+}
+
+static void citrix_pv_bus_mmio_write(void *opaque, hwaddr addr,
+                                     uint64_t val, unsigned size)
+{
+    trace_citrix_pv_bus_mmio_write(addr);
+}
+
+static const MemoryRegionOps citrix_pv_bus_mmio_ops = {
+    .read = &citrix_pv_bus_mmio_read,
+    .write = &citrix_pv_bus_mmio_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int citrix_pv_bus_init(PCIDevice *pci_dev)
+{
+    CitrixPVBusDevice *d = CITRIX_PV_BUS_DEVICE(pci_dev);
+    uint8_t *pci_conf;
+
+    pci_conf = pci_dev->config;
+
+    pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_MEMORY);
+    pci_set_byte(pci_conf + PCI_REVISION_ID, d->revision);
+
+    pci_config_set_prog_interface(pci_conf, 0);
+
+    pci_conf[PCI_INTERRUPT_PIN] = 1;
+
+    memory_region_init_io(&d->mmio, &citrix_pv_bus_mmio_ops, d,
+                          "citrix-bus-mmio", d->size);
+
+    pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
+                     &d->mmio);
+
+    return 0;
+}
+
+static Property citrix_pv_bus_props[] = {
+    DEFINE_PROP_UINT8("revision", CitrixPVBusDevice, revision, 0x01),
+    DEFINE_PROP_UINT32("size", CitrixPVBusDevice, size, 0x400000),
+    DEFINE_PROP_END_OF_LIST()
+};
+
+static void citrix_pv_bus_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = citrix_pv_bus_init;
+    k->vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->device_id = PCI_DEVICE_ID_CITRIX_PV_BUS;
+    k->class_id = PCI_CLASS_SYSTEM_OTHER;
+    k->subsystem_vendor_id = PCI_VENDOR_ID_CITRIX;
+    k->subsystem_id = PCI_DEVICE_ID_CITRIX_PV_BUS;

hw/misc/citrix_pv_bus.c line 120

Quoted 10 lines
hw/misc/citrix_pv_bus.c new file +10 -0
+    dc->desc = "Citrix PV Bus";
+    dc->props = citrix_pv_bus_props;
+}
+
+static const TypeInfo citrix_pv_bus_type_info = {
+    .name          = TYPE_CITRIX_PV_BUS_DEVICE,
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(CitrixPVBusDevice),
+    .class_init    = citrix_pv_bus_class_init,
+};

I get that we need a new device because Windows drivers from Windows Update need to bind to it and we can't simply "force" an update to all the Windows HVM instances out there.
For example one might have installed another vendor's Windows PV drivers and might not want to switch to the ones provided by Citrix.

However we simply can't add a new device in QEMU for each vendor that decides to implement Windows Xen PV drivers. We have to make this configurable.

Finally if possible we shouldn't assume that the admin knows beforehand what operating system is installed in the VM.

Quoted 8 lines

As a result I think that:

- it's a good idea to add a new device but at the same time we should also leave the old one there, so that existing installations (Linux, BSD, Solaris, etc.) will keep working without troubles and people that wants to manually install the Windows PV drivers from the installer can keep doing so;

Absolutely, and since Alex Bligh's comment on my original xen-platform-2 patch I realise this had to be the case; hence the idea of the secondary device.

Quoted 8 lines

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 5 lines

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

This all sounds fine; it's a generalization of what I've already coded up so I'm happy to refactor it. Any suggestions on a name? "xen-pvdevice", perhaps, to link it to your proposed VM config option?

Quoted 6 lines

- Windows PV drivers vendors might want to consider continuing on providing a Windows PV drivers installer that binds to the current PCI vendor and device ids so that people can continue consuming them the same way they have been doing so far without requiring host admin intervention.

We (Citrix) may well do that too. The build script for the win-xenbus driver takes the binding information as an argument so it's trivial for anyone to build that driver to bind to any PCI device.

Paul

#7 lore raw
In reply to Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 7 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 3 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable vendor and device IDs?

IIRC there is also a revision field in the PCI config space. Might as well make that configurable too.

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 7 lines

If not, would you be OK with a PCI device with the Xen vendor ID but a configurable device ID?

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw
In reply to Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 7 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl would then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 3 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable vendor and device IDs?

IIRC there is also a revision field in the PCI config space. Might as well make that configurable too.

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 7 lines

If not, would you be OK with a PCI device with the Xen vendor ID but a configurable device ID?

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw
Quoted 19 lines

-----Original Message-----
From: Ian Campbell
Sent: 03 July 2013 09:29
To: Stefano Stabellini
Cc: Paolo Bonzini; Paul Durrant; [email protected]; Anthony Liguori; [email protected]
Subject: Re: [Xen-devel] [Qemu-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl

would

Quoted 4 lines
Quoted 3 lines

then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 8 lines
Quoted 2 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable

vendor

Quoted 1 line

and device IDs?

IIRC there is also a revision field in the PCI config space. Might as well make that configurable too.

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

Paul

#10 lore raw
In reply to Ian Campbell
Quoted 19 lines

-----Original Message-----
From: Ian Campbell
Sent: 03 July 2013 09:29
To: Stefano Stabellini
Cc: Paolo Bonzini; Paul Durrant; [email protected]; Anthony Liguori; [email protected]
Subject: Re: [Xen-devel] [Qemu-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl

would

Quoted 4 lines
Quoted 3 lines

then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 8 lines
Quoted 2 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable

vendor

Quoted 1 line

and device IDs?

IIRC there is also a revision field in the PCI config space. Might as well make that configurable too.

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

Paul

#11 lore raw
Quoted 35 lines · Paul Durrant
Quoted 19 lines

-----Original Message-----
From: Ian Campbell
Sent: 03 July 2013 09:29
To: Stefano Stabellini
Cc: Paolo Bonzini; Paul Durrant; [email protected]; Anthony Liguori; [email protected]
Subject: Re: [Xen-devel] [Qemu-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl

would

Quoted 4 lines
Quoted 3 lines

then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 8 lines
Quoted 2 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable

vendor

Quoted 1 line

and device IDs?

IIRC there is also a revision field in the PCI config space. Might as well make that configurable too.

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 5 lines

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

I figured it was so the board vendor could add "value" in their drivers by taking advantage of the higher precedence given to the binding to the sub-ids by OSs.

#12 lore raw
In reply to Paul Durrant
Quoted 35 lines · Paul Durrant
Quoted 19 lines

-----Original Message-----
From: Ian Campbell
Sent: 03 July 2013 09:29
To: Stefano Stabellini
Cc: Paolo Bonzini; Paul Durrant; [email protected]; Anthony Liguori; [email protected]
Subject: Re: [Xen-devel] [Qemu-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Stefano Stabellini

- the new device should have configurable vendor and device ids, so that host admins can select which vendor's PV drivers are going to be automatically installed on all your Windows guests. This should probably be a VM config option (pvdevice=<gplpv|citrix|suse|oracle|etc>, libxl

would

Quoted 4 lines
Quoted 3 lines

then pass a vendor and device id pair to QEMU via command line. We can come up with a config syntax that would support both numeric pairs as well as simple labels.

Quoted 8 lines
Quoted 2 lines

Anthony,
would you be happy to have a PCI device in QEMU with configurable

vendor

Quoted 1 line

and device IDs?

IIRC there is also a revision field in the PCI config space. Might as well make that configurable too.

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 5 lines

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

I figured it was so the board vendor could add "value" in their drivers by taking advantage of the higher precedence given to the binding to the sub-ids by OSs.

#19 lore raw
In reply to Paul Durrant
Quoted 7 lines · Paul Durrant
Quoted 5 lines

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

This all sounds fine; it's a generalization of what I've already coded up so I'm happy to refactor it. Any suggestions on a name? "xen-pvdevice", perhaps, to link it to your proposed VM config option?

xen-pvdevice is good for me

#20 lore raw
In reply to Paul Durrant
Quoted 7 lines · Paul Durrant
Quoted 5 lines

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

This all sounds fine; it's a generalization of what I've already coded up so I'm happy to refactor it. Any suggestions on a name? "xen-pvdevice", perhaps, to link it to your proposed VM config option?

xen-pvdevice is good for me

#21 lore raw
Quoted 12 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 03 July 2013 11:50
To: Paul Durrant
Cc: Stefano Stabellini; [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 3 lines · Paul Durrant
Quoted 3 lines

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't

have

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

to acquire their own PCI vendor ids.

This all sounds fine; it's a generalization of what I've already coded up so I'm

happy to refactor it. Any suggestions on a name? "xen-pvdevice", perhaps, to link it to your proposed VM config option?

xen-pvdevice is good for me

Cool, new patch coming up.

#22 lore raw
In reply to Stefano Stabellini
Quoted 12 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 03 July 2013 11:50
To: Paul Durrant
Cc: Stefano Stabellini; [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH] Citrix PV Bus device [V3]

Quoted 3 lines · Paul Durrant
Quoted 3 lines

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't

have

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

to acquire their own PCI vendor ids.

This all sounds fine; it's a generalization of what I've already coded up so I'm

happy to refactor it. Any suggestions on a name? "xen-pvdevice", perhaps, to link it to your proposed VM config option?

xen-pvdevice is good for me

Cool, new patch coming up.

#23 lore raw
In reply to Stefano Stabellini
Quoted 4 lines · Stefano Stabellini

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

(removing qemu-devel)

I agree - this makes sense. There are already a few known uses of other device IDs such as:

0002 - used by Citrix for a version of Windows PV drivers [1] c110 - Virtualized HID [2]
c147 - Virtualized Graphics Device [2]

I suggest we have a file somewhere in the Xen tree to record reservations, e.g. docs/misc/pci-device-reservations.txt - changes to this would then be managed via the usual patch submission process and therefore be transparent and subject to community review. For example we could allocate to a Xen vendor such as Citrix XenClient a range of device IDs like c100-c1ff and let it use the range as it desires.

In addition to these reservations we could encourage vendors to record individual device IDs within their reservation with pciids.sourceforge.net/www.pcidatabase.com as with the two XenClient cases above.

Cheers,
James

[1] http://pciids.sourceforge.net/
[2] http://www.pcidatabase.com

#24 lore raw
Quoted 6 lines · James Bulpin
Quoted 4 lines · Stefano Stabellini

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't have to acquire their own PCI vendor ids.

Quoted 6 lines

(removing qemu-devel)

I agree - this makes sense. There are already a few known uses of other device IDs such as:

0002 - used by Citrix for a version of Windows PV drivers [1]

In the wild I presume?

Quoted 7 lines

c110 - Virtualized HID [2]
c147 - Virtualized Graphics Device [2]

I suggest we have a file somewhere in the Xen tree to record reservations, e.g. docs/misc/pci-device-reservations.txt - changes to this would then be managed via the usual patch submission process and therefore be transparent and subject to community review.

This sounds like a good idea to me.

Apart from grandfathering in 0002 lets keep the per-vendor IDs in the 0xc000-0xfffe range to start with, reducing the possibility of clashes with community IDs assigned from the bottom up.

Is someone going to send an initial patch adding the currently know IDs?

Quoted 4 lines

For
example we could allocate to a Xen vendor such as Citrix XenClient a range of device IDs like c100-c1ff and let it use the range as it desires.

Well, they'd presumably have to submit the patch themselves, but yes.

Quoted 4 lines

In addition to these reservations we could encourage vendors to record individual device IDs within their reservation with pciids.sourceforge.net/www.pcidatabase.com as with the two XenClient cases above.

Good idea.

Ian.

Quoted 11 lines

Cheers,
James

[1] http://pciids.sourceforge.net/
[2] http://www.pcidatabase.com

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#25 lore raw
Quoted 8 lines · Ian Campbell
Quoted 4 lines · James Bulpin
Quoted 3 lines · Stefano Stabellini

- the Citrix [vendor id|device id] pair has to be different from the xenproject one (0x5853|0x0001). I am sure we can arrange the xenproject device id space so that Windows PV drivers vendors don't

have

Quoted 2 lines
Quoted 1 line

to acquire their own PCI vendor ids.

Quoted 8 lines
Quoted 6 lines

(removing qemu-devel)

I agree - this makes sense. There are already a few known uses of other device IDs such as:

0002 - used by Citrix for a version of Windows PV drivers [1]

In the wild I presume?

Yes.

Quoted 8 lines
Quoted 7 lines

c110 - Virtualized HID [2]
c147 - Virtualized Graphics Device [2]

I suggest we have a file somewhere in the Xen tree to record reservations, e.g. docs/misc/pci-device-reservations.txt - changes to this would then be managed via the usual patch submission process and therefore be transparent and subject to community review.

Quoted 5 lines

This sounds like a good idea to me.

Apart from grandfathering in 0002 lets keep the per-vendor IDs in the 0xc000-0xfffe range to start with, reducing the possibility of clashes with community IDs assigned from the bottom up.

Agreed.

Quoted 1 line

Is someone going to send an initial patch adding the currently know IDs?

I'll do so later today.

Quoted 6 lines
Quoted 4 lines

For
example we could allocate to a Xen vendor such as Citrix XenClient a range of device IDs like c100-c1ff and let it use the range as it desires.

Well, they'd presumably have to submit the patch themselves, but yes.

Yes, that's what I meant - poor wording on my part.

#13 lore raw
In reply to Ian Campbell
Quoted 14 lines · Ian Campbell
Quoted 7 lines · Paul Durrant

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 5 lines

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

Quoted 3 lines

I figured it was so the board vendor could add "value" in their drivers by taking advantage of the higher precedence given to the binding to the sub-ids by OSs.

It's essentially an OEM id. Often times it's an EEPROM setting on real hardware. A different subsystem vendor/device does not indicate a different programming interface.

We set it to a vendor/device ID reserved for QEMU by default. It's best to keep it the QEMU ID to identify it as a device implemented by QEMU.

It's mighty handy as it lets software figure out that it's a Cirrus VGA card emulated by QEMU (not real hardware). In fact, I believe the kernel KMS driver for Cirrus only binds to the QEMU vendor/device ID since that's the only thing reasonably testable these days.

Regards,

Anthony Liguori

#14 lore raw
In reply to Ian Campbell
Quoted 14 lines · Ian Campbell
Quoted 7 lines · Paul Durrant

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 5 lines

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

Quoted 3 lines

I figured it was so the board vendor could add "value" in their drivers by taking advantage of the higher precedence given to the binding to the sub-ids by OSs.

It's essentially an OEM id. Often times it's an EEPROM setting on real hardware. A different subsystem vendor/device does not indicate a different programming interface.

We set it to a vendor/device ID reserved for QEMU by default. It's best to keep it the QEMU ID to identify it as a device implemented by QEMU.

It's mighty handy as it lets software figure out that it's a Cirrus VGA card emulated by QEMU (not real hardware). In fact, I believe the kernel KMS driver for Cirrus only binds to the QEMU vendor/device ID since that's the only thing reasonably testable these days.

Regards,

Anthony Liguori

#15 lore raw
Quoted 24 lines · Anthony Liguori
Quoted 14 lines · Ian Campbell
Quoted 7 lines · Paul Durrant

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 5 lines

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

Quoted 3 lines

I figured it was so the board vendor could add "value" in their drivers by taking advantage of the higher precedence given to the binding to the sub-ids by OSs.

It's essentially an OEM id. Often times it's an EEPROM setting on real hardware. A different subsystem vendor/device does not indicate a different programming interface.

Quoted 7 lines

We set it to a vendor/device ID reserved for QEMU by default. It's best to keep it the QEMU ID to identify it as a device implemented by QEMU.

It's mighty handy as it lets software figure out that it's a Cirrus VGA card emulated by QEMU (not real hardware). In fact, I believe the kernel KMS driver for Cirrus only binds to the QEMU vendor/device ID since that's the only thing reasonably testable these days.

That makes sense.

Quoted 5 lines

Regards,

Anthony Liguori

#16 lore raw
In reply to Anthony Liguori
Quoted 24 lines · Anthony Liguori
Quoted 14 lines · Ian Campbell
Quoted 7 lines · Paul Durrant

Already did that :-)

Quoted 4 lines

There are also sub-vendor and sub-device IDs but I don't think they are so useful for us (AFAIK they are intended to allow the board manufacturer to "subclass" the IDs baked into the ASIC).

Quoted 5 lines

I'm always hazy about what those mean. I thought the idea was that a vendor may collect together many devices, potentially from different vendors, into a single chip/board and they should use common subsystem vendor/device info for all those devices to indicate that they were all part of that larger unit - but maybe I'm completely wrong.

Quoted 3 lines

I figured it was so the board vendor could add "value" in their drivers by taking advantage of the higher precedence given to the binding to the sub-ids by OSs.

It's essentially an OEM id. Often times it's an EEPROM setting on real hardware. A different subsystem vendor/device does not indicate a different programming interface.

Quoted 7 lines

We set it to a vendor/device ID reserved for QEMU by default. It's best to keep it the QEMU ID to identify it as a device implemented by QEMU.

It's mighty handy as it lets software figure out that it's a Cirrus VGA card emulated by QEMU (not real hardware). In fact, I believe the kernel KMS driver for Cirrus only binds to the QEMU vendor/device ID since that's the only thing reasonably testable these days.

That makes sense.

Quoted 5 lines

Regards,

Anthony Liguori