[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v15 07/60] xen-platform: exclude vfio-pci from the PCI platform u
From: |
David Woodhouse |
Subject: |
[PATCH v15 07/60] xen-platform: exclude vfio-pci from the PCI platform unplug |
Date: |
Wed, 1 Mar 2023 13:51:30 +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 3795a203d4..8a61697053 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -108,12 +108,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));
}
}
@@ -186,9 +199,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.39.0
- [PATCH v15 49/60] i386/xen: handle HVMOP_get_param, (continued)
- [PATCH v15 49/60] i386/xen: handle HVMOP_get_param, David Woodhouse, 2023/03/01
- [PATCH v15 32/60] hw/xen: Implement EVTCHNOP_bind_virq, David Woodhouse, 2023/03/01
- [PATCH v15 41/60] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback, David Woodhouse, 2023/03/01
- [PATCH v15 54/60] i386/xen: Implement HYPERVISOR_physdev_op, David Woodhouse, 2023/03/01
- [PATCH v15 16/60] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/03/01
- [PATCH v15 24/60] i386/xen: implement HYPERVISOR_event_channel_op, David Woodhouse, 2023/03/01
- [PATCH v15 06/60] i386/kvm: Set Xen vCPU ID in KVM, David Woodhouse, 2023/03/01
- [PATCH v15 56/60] hw/xen: Support GSI mapping to PIRQ, David Woodhouse, 2023/03/01
- [PATCH v15 01/60] include: import Xen public headers to hw/xen/interface, David Woodhouse, 2023/03/01
- [PATCH v15 25/60] i386/xen: implement HVMOP_set_evtchn_upcall_vector, David Woodhouse, 2023/03/01
- [PATCH v15 07/60] xen-platform: exclude vfio-pci from the PCI platform unplug,
David Woodhouse <=
- [PATCH v15 20/60] i386/xen: implement HYPERVISOR_vcpu_op, David Woodhouse, 2023/03/01
- [PATCH v15 28/60] i386/xen: Add support for Xen event channel delivery to vCPU, David Woodhouse, 2023/03/01
- [PATCH v15 58/60] kvm/i386: Add xen-evtchn-max-pirq property, David Woodhouse, 2023/03/01
- [PATCH v15 57/60] hw/xen: Support MSI mapping to PIRQ, David Woodhouse, 2023/03/01
- [PATCH v15 47/60] i386/xen: handle PV timer hypercalls, David Woodhouse, 2023/03/01
- [PATCH v15 03/60] xen: Add XEN_DISABLED mode and make it default, David Woodhouse, 2023/03/01
- [PATCH v15 17/60] i386/xen: implement HYPERVISOR_memory_op, David Woodhouse, 2023/03/01
- [PATCH v15 40/60] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, David Woodhouse, 2023/03/01