[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] virtio-pci: Add subsystem-vendor-id property
From: |
ben |
Subject: |
[Qemu-devel] [PATCH] virtio-pci: Add subsystem-vendor-id property |
Date: |
Wed, 13 Dec 2017 00:26:44 -0800 |
From: Ben Warren <address@hidden>
Now that virtio-win guest drivers provided by non-Redhat vendors need to
use a different Subsystem Vendor ID value, a way is needed to set this
parameter on the host. This works with all of the PCI-based devices,
such as NetKVM, viostor, vioscsi, vioserial and balloon.
Signed-off-by: Ben Warren <address@hidden>
---
hw/virtio/virtio-pci.c | 5 +++++
hw/virtio/virtio-pci.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index e92837c..b5c86e3 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1757,6 +1757,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error
**errp)
if (proxy->disable_legacy == ON_OFF_AUTO_AUTO) {
proxy->disable_legacy = pcie_port ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF;
}
+ /* Set the PCI Subsystem Vendor ID */
+ k->parent_class.subsystem_vendor_id = proxy->subsystem_vendor_id;
+ pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID,
proxy->subsystem_vendor_id);
if (!virtio_pci_modern(proxy) && !virtio_pci_legacy(proxy)) {
error_setg(errp, "device cannot work as neither modern nor legacy mode"
@@ -1876,6 +1879,8 @@ static Property virtio_pci_properties[] = {
VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true),
DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
VIRTIO_PCI_FLAG_INIT_PM_BIT, true),
+ DEFINE_PROP_UINT16("subsystem-vendor-id", VirtIOPCIProxy,
+ subsystem_vendor_id, PCI_VENDOR_ID_REDHAT_QUMRANET),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 12d3a90..8a897ea 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -186,6 +186,7 @@ struct VirtIOPCIProxy {
VirtIOIRQFD *vector_irqfd;
int nvqs_with_notifiers;
VirtioBusState bus;
+ uint16_t subsystem_vendor_id;
};
static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)
--
2.7.4
- [Qemu-devel] [PATCH] virtio-pci: Add subsystem-vendor-id property,
ben <=