All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: "Juergen Gross" <jgross@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wei.liu2@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v3 5/7] x86/dom0: Improve dom0= useability
Date: Wed, 16 Jan 2019 09:00:48 +0000	[thread overview]
Message-ID: <1547629250-1405-6-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1547629250-1405-1-git-send-email-andrew.cooper3@citrix.com>

Having a pvh boolean isn't ideal.  If we gain a 3rd virtulsation mode,
what does `dom0=no-pvh` mean?

Change the syntax to be "dom0 = pv | pvh" which offers an option to more
obviously select PV mode.  Hide both options behind the relevent
CONFIG_* settings, and default to PVH mode when CONFIG_PV is compiled
out.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>

This is fine for compatibility purposes, as this option wasn't present
in Xen 4.11

v2:
 * New
v3:
 * Use cmdline_strcmp() rather than introducing yet more buggy strncmp()
---
 docs/misc/xen-command-line.pandoc | 16 +++++++++-------
 xen/arch/x86/dom0_build.c         |  8 +++++---
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 4f27e54..365d2ee 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -637,21 +637,23 @@ trace feature is only enabled in debugging builds of Xen.
 Specify the bit width of the DMA heap.
 
 ### dom0
-    = List of [ pvh=<bool>, shadow=<bool>, verbose=<bool> ]
+    = List of [ pv | pvh, shadow=<bool>, verbose=<bool> ]
 
     Applicability: x86
 
 Controls for how dom0 is constructed on x86 systems.
 
-*   The `pvh` boolean controls whether dom0 is constructed as a PV or a PVH
-    guest.  The default is PV.  In addition, the following requirements must
-    be met:
+*   The `pv` and `pvh` options select the virtualisation mode of dom0.
+
+    The `pv` option is only available when `CONFIG_PV` is compiled in.  The
+    `pvh` option is only available when `CONFIG_HVM` is compiled in.  When
+    both options are compiled in, the default is PV.
+
+    In addition, the following requirements must be met:
 
     *   The dom0 kernel selected by the boot loader must be capable of the
         selected mode.
-    *   For a PV dom0, Xen must have been compiled with `CONFIG_PV` enabled.
-    *   For a PVH dom0, Xen must have been compiled with `CONFIG_HVM` enabled,
-        and the hardware must have VT-x/SVM extensions available.
+    *   For a PVH dom0, the hardware must have VT-x/SVM extensions available.
 
 *   The `shadow` boolean is only applicable when dom0 is constructed as a PVH
     guest, and controls whether dom0 uses hardware assisted paging, or shadow
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 7f6ee7f..2b4d9e9 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -280,7 +280,7 @@ struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
 #ifdef CONFIG_SHADOW_PAGING
 bool __initdata opt_dom0_shadow;
 #endif
-bool __initdata dom0_pvh;
+bool __initdata dom0_pvh = !IS_ENABLED(CONFIG_PV);
 bool __initdata dom0_verbose;
 
 static int __init parse_dom0_param(const char *s)
@@ -295,8 +295,10 @@ static int __init parse_dom0_param(const char *s)
         if ( !ss )
             ss = strchr(s, '\0');
 
-        if ( (val = parse_boolean("pvh", s, ss)) >= 0 )
-            dom0_pvh = val;
+        if ( IS_ENABLED(CONFIG_PV) && !cmdline_strcmp(s, "pv") )
+            dom0_pvh = false;
+        else if ( IS_ENABLED(CONFIG_HVM) && !cmdline_strcmp(s, "pvh") )
+            dom0_pvh = true;
 #ifdef CONFIG_SHADOW_PAGING
         else if ( (val = parse_boolean("shadow", s, ss)) >= 0 )
             opt_dom0_shadow = val;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-01-16  9:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  9:00 [PATCH v3 for-4.12 0/7] Docs improvements, and dom0 construction fixes Andrew Cooper
2019-01-16  9:00 ` [PATCH v3 1/7] docs: Improve documentation for dom0= and dom0-iommu= Andrew Cooper
2019-01-16 10:53   ` Roger Pau Monné
2019-01-16 19:54     ` Andrew Cooper
2019-01-16 11:52   ` Jan Beulich
2019-01-16 19:51     ` Andrew Cooper
2019-01-17  8:43       ` Roger Pau Monné
2019-01-17  9:08         ` Andrew Cooper
2019-01-17  9:14           ` Juergen Gross
2019-01-17 11:59             ` Jan Beulich
2019-01-17 12:11             ` Andrew Cooper
2019-01-17 11:20       ` Jan Beulich
2019-01-17 12:15         ` Andrew Cooper
2019-01-17 12:26           ` Jan Beulich
2019-01-21 17:24             ` Andrew Cooper
2019-01-16  9:00 ` [PATCH v3 2/7] docs: Improve documentation and parsing for iommu= Andrew Cooper
2019-01-16 11:06   ` Roger Pau Monné
2019-01-21 17:30     ` Andrew Cooper
2019-01-16 13:47   ` Jan Beulich
2019-01-16  9:00 ` [PATCH v3 3/7] docs: Improve documentation and parsing for pci= Andrew Cooper
2019-01-16 11:08   ` Roger Pau Monné
2019-01-16 13:52   ` Jan Beulich
2019-01-16  9:00 ` [PATCH v3 4/7] docs: Improve documentation and parsing for efi= Andrew Cooper
2019-01-16 14:00   ` Jan Beulich
2019-01-16  9:00 ` Andrew Cooper [this message]
2019-01-16 11:13   ` [PATCH v3 5/7] x86/dom0: Improve dom0= useability Roger Pau Monné
2019-01-16 14:08   ` Jan Beulich
2019-01-16 19:58     ` Andrew Cooper
2019-01-17 11:21       ` Jan Beulich
2019-01-16  9:00 ` [PATCH v3 6/7] xen/dom0: Drop iommu_hwdom_inclusive entirely Andrew Cooper
2019-01-16 11:24   ` Roger Pau Monné
2019-01-17 13:32   ` Jan Beulich
2019-01-17 14:51     ` Roger Pau Monné
2019-01-16  9:00 ` [PATCH v3 7/7] xen/dom0: Add a dom0-iommu=none option Andrew Cooper
2019-01-16 11:32   ` Roger Pau Monné
2019-01-17 10:55   ` Wei Liu
2019-01-17 13:35   ` Jan Beulich
2019-01-21 18:08     ` Andrew Cooper
2019-01-22  8:06       ` Jan Beulich
2019-01-22 13:42         ` Andrew Cooper
2019-01-16 11:38 ` [PATCH v3 for-4.12 0/7] Docs improvements, and dom0 construction fixes Juergen Gross

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=1547629250-1405-6-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.