A new user interface for you! Read more...

File xen_pvonhvm.xen_emul_unplug.patch of Package xen

fate#311487

Handle xen_emul_unplug from xenlinux based core kernel.

If the kernel was booted with xen_emul_unplug=(never|ide-disks|nics) unplug only
what was requested. Kernel cmdline option is prefered over module option.

---
 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: xen-4.7.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
===================================================================
--- xen-4.7.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ xen-4.7.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
@@ -39,6 +39,9 @@
 #include <xen/interface/hvm/params.h>
 #include <xen/features.h>
 #include <xen/evtchn.h>
+#ifdef HAVE_XEN_PVONHVM_UNPLUG
+#include <xen/xen_pvonhvm.h>
+#endif
 #ifdef __ia64__
 #include <asm/xen/xencomm.h>
 #endif
@@ -290,6 +293,18 @@ static int check_platform_magic(struct d
 	short magic, unplug = 0;
 	char protocol, *p, *q, *err;
 
+#ifdef HAVE_XEN_PVONHVM_UNPLUG
+	if (xen_pvonhvm_unplug) {
+		/* Use kernel cmdline setting */
+		if (dev_unplug)
+			printk(KERN_INFO DRV_NAME ": ignoring option dev_unplug=%s \n", dev_unplug);
+		dev_unplug = NULL;
+		if (xen_pvonhvm_unplugged_disks)
+			unplug |= UNPLUG_ALL_IDE_DISKS | UNPLUG_AUX_IDE_DISKS;
+		if (xen_pvonhvm_unplugged_nics)
+			unplug |= UNPLUG_ALL_NICS;
+	} else
+#endif
 	/* Unconditionally unplug everything */
 	if (!dev_unplug)
 		unplug = UNPLUG_ALL;