[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 07/51] xen-platform: exclude vfio-pci from the PCI platform un
From: |
David Woodhouse |
Subject: |
[PATCH v6 07/51] xen-platform: exclude vfio-pci from the PCI platform unplug |
Date: |
Tue, 10 Jan 2023 12:19:58 +0000 |
From: Joao Martins <joao.m.martins@oracle.com>
Such that PCI passthrough devices work for Xen emulated guests.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
hw/i386/xen/xen_platform.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 7db0d94ec2..50174c2269 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -109,12 +109,25 @@ static void log_writeb(PCIXenPlatformState *s, char val)
#define _UNPLUG_NVME_DISKS 3
#define UNPLUG_NVME_DISKS (1u << _UNPLUG_NVME_DISKS)
+static bool pci_device_is_passthrough(PCIDevice *d)
+{
+ if (!strcmp(d->name, "xen-pci-passthrough")) {
+ return true;
+ }
+
+ if (xen_mode == XEN_EMULATE && !strcmp(d->name, "vfio-pci")) {
+ return true;
+ }
+
+ return false;
+}
+
static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
{
/* We have to ignore passthrough devices */
if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
PCI_CLASS_NETWORK_ETHERNET
- && strcmp(d->name, "xen-pci-passthrough") != 0) {
+ && !pci_device_is_passthrough(d)) {
object_unparent(OBJECT(d));
}
}
@@ -187,9 +200,8 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void
*opaque)
!(flags & UNPLUG_IDE_SCSI_DISKS);
/* We have to ignore passthrough devices */
- if (!strcmp(d->name, "xen-pci-passthrough")) {
+ if (pci_device_is_passthrough(d))
return;
- }
switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) {
case PCI_CLASS_STORAGE_IDE:
--
2.35.3
- [PATCH v6 37/51] hw/xen: Implement EVTCHNOP_reset, (continued)
- [PATCH v6 37/51] hw/xen: Implement EVTCHNOP_reset, David Woodhouse, 2023/01/10
- [PATCH v6 05/51] i386/kvm: handle Xen HVM cpuid leaves, David Woodhouse, 2023/01/10
- [PATCH v6 18/51] i386/xen: implement HYPERVISOR_hvm_op, David Woodhouse, 2023/01/10
- [PATCH v6 13/51] hw/xen: Add xen_overlay device for emulating shared xenheap pages, David Woodhouse, 2023/01/10
- [PATCH v6 39/51] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, David Woodhouse, 2023/01/10
- [PATCH v6 19/51] i386/xen: implement HYPERVISOR_vcpu_op, David Woodhouse, 2023/01/10
- [PATCH v6 06/51] i386/hvm: Set Xen vCPU ID in KVM, David Woodhouse, 2023/01/10
- [PATCH v6 07/51] xen-platform: exclude vfio-pci from the PCI platform unplug,
David Woodhouse <=
- [PATCH v6 28/51] hw/xen: Implement EVTCHNOP_status, David Woodhouse, 2023/01/10
- [PATCH v6 44/51] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson, David Woodhouse, 2023/01/10
- [PATCH v6 30/51] hw/xen: Implement EVTCHNOP_unmask, David Woodhouse, 2023/01/10
- [PATCH v6 14/51] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, David Woodhouse, 2023/01/10
- [PATCH v6 40/51] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback, David Woodhouse, 2023/01/10
- [PATCH v6 04/51] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support, David Woodhouse, 2023/01/10
- [PATCH v6 15/51] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/01/10