File 0051-xen-SUSE-xenlinux-unplug-for-emulat.patch of Package qemu

From b6ab4af64ec46b0888036d949cf1973197e250ec Mon Sep 17 00:00:00 2001
From: Olaf Hering <ohering@suse.de>
Date: Tue, 21 Jun 2016 18:42:45 +0200
Subject: [PATCH] xen: SUSE xenlinux unplug for emulated PCI

Implement SUSE specific unplug protocol for emulated PCI devices
in PVonHVM guests
(bsc#953339, bsc#953362, bsc#953518, bsc#984981)

Signed-off-by: Olaf Hering <ohering@suse.de>
---
 hw/i386/xen/xen_platform.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index aa78393..48800c1 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -314,6 +314,28 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
     case 0: /* Platform flags */
         platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val);
         break;
+    case 4:
+        if (val == 1 && size == 1) {
+            /*
+             * SUSE unplug for Xenlinux
+             * xen-kmp used this since xen-3.0.4, instead the official protocol from xen-3.3+
+             * It did an unconditional "outl(1, (ioaddr + 4));"
+             * This approach was used until openSUSE 12.3, up to SLE11SP3 and in SLE10.
+             * Starting with openSUSE 13.1, SLE11SP4 and SLE12 the official protocol is used.
+             * pre VMDP 1.7 made use of 4 and 8 depending on how vmdp was configured.
+             * If VMDP was to control both disk and LAN it would use 4.
+             * If it controlled just disk or just LAN, it would use 8 below.
+             */
+            PCIDevice *pci_dev = PCI_DEVICE(s);
+            DPRINTF("unplug disks\n");
+            blk_drain_all();
+            blk_flush_all();
+            pci_unplug_disks(pci_dev->bus);
+            DPRINTF("unplug nics\n");
+            pci_unplug_nics(pci_dev->bus);
+            DPRINTF("done\n");
+        }
+        break;
     case 8:
         log_writeb(s, (uint32_t)val);
         break;
openSUSE Build Service is sponsored by