xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: [PATCH 1/3] xen: pvhvm: allow user to request no emulated device unplug
Date: Thu, 19 Aug 2010 10:59:04 +0100	[thread overview]
Message-ID: <1282211946-8629-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1282211932.3170.2341.camel@zakaz.uk.xensource.com>

this allows the user to disable pvhvm and revert to emulated devices
in case of a system misconfiguration (e.g. initramfs with only
emulated drivers in it).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Documentation/kernel-parameters.txt |    1 +
 arch/x86/xen/platform-pci-unplug.c  |   12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 2c85c06..8bbe83b 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2631,6 +2631,7 @@ and is between 256 and 4096 characters. It is defined in the file
 			all -- unplug all emulated devices (NICs and IDE disks)
 			ignore -- continue loading the Xen platform PCI driver even
 				if the version check failed
+			never -- do not unplug even if version check succeeds
 
 	xirc2ps_cs=	[NET,PCMCIA]
 			Format:
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 554c002..c82ce1e 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -33,7 +33,7 @@
 int xen_platform_pci_unplug;
 EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
 #ifdef CONFIG_XEN_PVHVM
-static int xen_emul_unplug;
+static int xen_emul_unplug = -1;
 
 static int __init check_platform_magic(void)
 {
@@ -72,18 +72,23 @@ void __init xen_unplug_emulated_devices(void)
 {
 	int r;
 
+	/* user explicitly requested no unplug */
+	if (xen_emul_unplug == 0)
+		return;
 	/* check the version of the xen platform PCI device */
 	r = check_platform_magic();
 	/* If the version matches enable the Xen platform PCI driver.
 	 * Also enable the Xen platform PCI driver if the version is really old
 	 * and the user told us to ignore it. */
 	if (r && !(r == XEN_PLATFORM_ERR_MAGIC &&
+			(xen_emul_unplug != -1) &&
 			(xen_emul_unplug & XEN_UNPLUG_IGNORE)))
 		return;
 	/* Set the default value of xen_emul_unplug depending on whether or
 	 * not the Xen PV frontends and the Xen platform PCI driver have
 	 * been compiled for this kernel (modules or built-in are both OK). */
-	if (!xen_emul_unplug) {
+	if (xen_emul_unplug == -1) {
+		xen_emul_unplug = 0;
 		if (xen_must_unplug_nics()) {
 			printk(KERN_INFO "Netfront and the Xen platform PCI driver have "
 					"been compiled for this kernel: unplug emulated NICs.\n");
@@ -109,6 +114,7 @@ static int __init parse_xen_emul_unplug(char *arg)
 	char *p, *q;
 	int l;
 
+	xen_emul_unplug = 0;
 	for (p = arg; p; p = q) {
 		q = strchr(p, ',');
 		if (q) {
@@ -127,6 +133,8 @@ static int __init parse_xen_emul_unplug(char *arg)
 			xen_emul_unplug |= XEN_UNPLUG_ALL_NICS;
 		else if (!strncmp(p, "ignore", l))
 			xen_emul_unplug |= XEN_UNPLUG_IGNORE;
+		else if (!strncmp(p, "never", l))
+			/* Nothing to do. xen_emul_unplug = 0 above */;
 		else
 			printk(KERN_WARNING "unrecognised option '%s' "
 				 "in parameter 'xen_emul_unplug'\n", p);
-- 
1.5.6.5

  reply	other threads:[~2010-08-19  9:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19  9:58 [GIT/PATCH 0/3] pvhvm emul unplug fixes Ian Campbell
2010-08-19  9:59 ` Ian Campbell [this message]
2010-08-19 10:37   ` [PATCH 1/3] xen: pvhvm: allow user to request no emulated device unplug Stefano Stabellini
2010-08-19 10:50     ` Ian Campbell
2010-08-19 10:52       ` Ian Campbell
2010-08-19 10:54         ` Stefano Stabellini
2010-08-19 16:10           ` Jeremy Fitzhardinge
2010-08-19 16:34             ` Gianni Tedesco
2010-08-19 16:44               ` Jeremy Fitzhardinge
2010-08-19 16:52                 ` Ian Campbell
2010-08-20  8:13                   ` [GIT/PATCH v2 0/3] pvhvm emul unplug fixes Ian Campbell
2010-08-20  8:14                     ` [PATCH 1/3] xen: pvhvm: allow user to request no emulated device unplug Ian Campbell
2010-08-20  8:14                     ` [PATCH 2/3] xen: pvhvm: rename xen_emul_unplug=ignore to =unnnecessary Ian Campbell
2010-08-20  8:14                     ` [PATCH 3/3] xen: pvhvm: make it clearer that XEN_UNPLUG_* define bits in a bitfield Ian Campbell
2010-08-20 11:10                     ` [GIT/PATCH v2 0/3] pvhvm emul unplug fixes Stefano Stabellini
2010-08-20 16:41                     ` Jeremy Fitzhardinge
2010-08-19  9:59 ` [PATCH 2/3] xen: pvhvm: rename xen_emul_unplug=ignore to =unnnecessary Ian Campbell
2010-08-19  9:59 ` [PATCH 3/3] xen: pvhvm: make it clearer that XEN_UNPLUG_* individual bits Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282211946-8629-1-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=jeremy@goop.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).