qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 08/21] xen_platform: exclude vfio-pci from the PCI platfo


From: Philippe Mathieu-Daudé
Subject: Re: [RFC PATCH 08/21] xen_platform: exclude vfio-pci from the PCI platform unplug
Date: Mon, 5 Dec 2022 23:03:54 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

On 5/12/22 18:31, David Woodhouse wrote:
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>
---
  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 710039851a..ae0a21f5bf 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")) {

The 'QOM way' to do this check is:

       if (object_dynamic_cast(OBJECT(d), TYPE_XEN_PT_DEVICE)) {

+        return true;
+    }
+
+    if (xen_mode == XEN_EMULATE && !strcmp(d->name, "vfio-pci")) {

       if (xen_mode == XEN_EMULATE
           && object_dynamic_cast(OBJECT(d), TYPE_VFIO_PCI)) {

+        return true;
+    }
+
+    return false;
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]