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

[QEMU][PATCH v1 1/7] xen: when unplugging emulated devices skip virtio devices


  • To: <qemu-devel@xxxxxxxxxx>
  • From: Vikram Garhwal <vikram.garhwal@xxxxxxx>
  • Date: Thu, 5 Oct 2023 11:16:23 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EqJO5eINxVHCO0CwH0LZUqYjnBPafl1pauyRsQ+lAX4=; b=JcMDSmld7eKl/ofCPEqiXrY661cj9ArZbAI5fXJEpAmdBsN88kh7cFb5I4ui6PvM9c8YrL0mCyWopu5XR6u2S4ffu6LWHMYeG8W4lsccBepUeZeDb12mLV/2AKXq7ZhmxUKxApn5/yRCogI7xiCXLEzOtUdwMj8u5sLSaw6C8NGQHGl+BJRPrpiXE0aIcE67pGYX0hki4JObKQPPsvCaNvYwnt5S4Q1l5j7TFu78vJwXzSNpzFx8q2n75pct+LfJHrwoyn1kCmn+Hy6GL8m2/yNhfQ+9TqPl/4cv6/5i3FC3NOzpcIgfzaFl+AVkdIFJAn989TYXBxxETfrmAFC9Xw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gDKRGH+EJZY7bPcyD2/FmFYx5xVAT0MbSNddyIvGQIniGlN40ohAvEup8QaDjivvJp508mqlw8e4UD108M1iNQ4Zh2B1HKnrYA+omZDFG5JaPWbWogLUP2Juudc0lTPr3WEZsV2rYF8R58833VMu2pmd2WhUnOdGaBHrRoIpSUynHhEziEEacP3XaT0x4bX9NJvbkSGhwF6MhwVouhtW3+mMGLiO3zbqRQKhYvQCol4ccdlMR1G2WaEoVg2vf4tVD8Ei4qkpsw+hJvWl8dZ+nRkGbU6n6uM3RpDhyiK9xUYongblDUE6c6acyxOF827IE8VWchYV6qy4mrk+UaWdAg==
  • Cc: <sstabellini@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Vikram Garhwal <vikram.garhwal@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, "Paul Durrant" <paul@xxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, "Marcel Apfelbaum" <marcel.apfelbaum@xxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Eduardo Habkost <eduardo@xxxxxxxxxxx>, "open list:X86 Xen CPUs" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 05 Oct 2023 18:17:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Juergen Gross <jgross@xxxxxxxx>

Virtio devices should never be unplugged at boot time, as they are
similar to pci passthrough devices.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
---
 hw/i386/xen/xen_platform.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 17457ff3de..3560eaf8c8 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -28,6 +28,7 @@
 #include "hw/ide/pci.h"
 #include "hw/pci/pci.h"
 #include "migration/vmstate.h"
+#include "hw/virtio/virtio-bus.h"
 #include "net/net.h"
 #include "trace.h"
 #include "sysemu/xen.h"
@@ -132,7 +133,8 @@ 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
-            && !pci_device_is_passthrough(d)) {
+            && !pci_device_is_passthrough(d)
+            && !qdev_get_child_bus(&d->qdev, TYPE_VIRTIO_BUS)) {
         object_unparent(OBJECT(d));
     }
 }
@@ -208,6 +210,10 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void 
*opaque)
     /* We have to ignore passthrough devices */
     if (pci_device_is_passthrough(d))
         return;
+    /* Ignore virtio devices */
+    if (qdev_get_child_bus(&d->qdev, TYPE_VIRTIO_BUS)) {
+        return;
+    }
 
     switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) {
     case PCI_CLASS_STORAGE_IDE:
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.