From patchwork Tue Sep 27 15:57:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9352207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0E39960757 for ; Tue, 27 Sep 2016 16:01:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00A0A2928B for ; Tue, 27 Sep 2016 16:01:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E95B62928E; Tue, 27 Sep 2016 16:01:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5A7582927A for ; Tue, 27 Sep 2016 16:01:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boum4-0007na-Fy; Tue, 27 Sep 2016 15:58:28 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boum3-0007lP-6i for xen-devel@lists.xenproject.org; Tue, 27 Sep 2016 15:58:27 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 02/22-30284-1279AE75; Tue, 27 Sep 2016 15:58:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRWlGSWpSXmKPExsXitHSDva7s9Ff hBm93qlp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmbv01jLPgvXXHr4EKWBsYLol2MnBwSAv4S V0/9ZwSx2QR0JC7O3cnWxcjBISKgInF7r0EXIxcHs8AGRonpj2+zgtQIC7hK/JqzmxnEZhFQl VjwbR6YzQsUX9fVyAgxU1fi4bnfYPWcQPHetgVMILaQgIvE3ZkfWSHqBSVOznzCAmIzC2hKtG 7/zQ5hy0s0b53NDFGvKNE/7wEbxExuidunpzJPYOSfhaR9FpL2WUjaFzAyr2LUKE4tKkst0jU 01EsqykzPKMlNzMzRNTQw1ctNLS5OTE/NSUwq1kvOz93ECAxCBiDYwbiy3fkQoyQHk5Ior0b7 q3AhvqT8lMqMxOKM+KLSnNTiQ4waHBwCm9euvsAoxZKXn5eqJMHrMRWoTrAoNT21Ii0zBxgnM KUSHDxKIrw804DSvMUFibnFmekQqVOMuhxbFtxYyyQENkNKnLcBZIYASFFGaR7cCFjMXmKUlR LmZQQ6UIinILUoN7MEVf4VozgHo5IwrwLIKp7MvBK4Ta+AjmACOmLpiRcgR5QkIqSkGhjz1nk +3uw+8+W542plEQbZ1z6Eike48E4uu3BpnvnnCKeF3ilax6Tv/rq1bl3Tj4LZkd1dzK0Nd+5r T9HIjYqedPzXHalrnI8/RxSLM25yl9441dm5UoLh+La2oJva2ZMDH384MFfxx5tuO5XwtWubb lhp9Ox8Gtj/58Xu6V+7zr4o1J56wX6SEktxRqKhFnNRcSIARFWhqtQCAAA= X-Env-Sender: prvs=071b8e69e=roger.pau@citrix.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1474991886!60100383!7 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18208 invoked from network); 27 Sep 2016 15:58:21 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 27 Sep 2016 15:58:21 -0000 X-IronPort-AV: E=Sophos;i="5.30,405,1470700800"; d="scan'208";a="389169559" From: Roger Pau Monne To: Date: Tue, 27 Sep 2016 17:57:06 +0200 Message-ID: <1474991845-27962-12-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) In-Reply-To: <1474991845-27962-1-git-send-email-roger.pau@citrix.com> References: <1474991845-27962-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Andrew Cooper , boris.ostrovsky@oracle.com, Roger Pau Monne , Jan Beulich Subject: [Xen-devel] [PATCH v2 11/30] xen/x86: split Dom0 build into PV and PVHv2 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Split the Dom0 builder into two different functions, one for PV (and classic PVH), and another one for PVHv2. Introduce a new command line parameter, dom0hvm in order to request the creation of a PVHv2 Dom0. Signed-off-by: Roger Pau Monné --- Cc: Jan Beulich Cc: Andrew Cooper --- Changes since RFC: - Add documentation for the new command line option. - Simplify the logic in construct_dom0. --- docs/misc/xen-command-line.markdown | 7 +++++++ xen/arch/x86/domain_build.c | 24 +++++++++++++++++++++++- xen/arch/x86/setup.c | 9 +++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index 8ff57fa..59d7210 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -663,6 +663,13 @@ Pin dom0 vcpus to their respective pcpus Flag that makes a 64bit dom0 boot in PVH mode. No 32bit support at present. +### dom0hvm +> `= ` + +> Default: `false` + +Flag that makes a dom0 boot in PVHv2 mode. + ### dtuart (ARM) > `= path [:options]` diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c index ffd0521..78980ae 100644 --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -952,7 +952,7 @@ static int __init setup_permissions(struct domain *d) return rc; } -int __init construct_dom0( +static int __init construct_dom0_pv( struct domain *d, const module_t *image, unsigned long image_headroom, module_t *initrd, @@ -1657,6 +1657,28 @@ out: return rc; } +static int __init construct_dom0_hvm(struct domain *d, const module_t *image, + unsigned long image_headroom, + module_t *initrd, + void *(*bootstrap_map)(const module_t *), + char *cmdline) +{ + + printk("** Building a PVH Dom0 **\n"); + + return 0; +} + +int __init construct_dom0(struct domain *d, const module_t *image, + unsigned long image_headroom, module_t *initrd, + void *(*bootstrap_map)(const module_t *), + char *cmdline) +{ + + return (is_hvm_domain(d) ? construct_dom0_hvm : construct_dom0_pv) + (d, image, image_headroom, initrd,bootstrap_map, cmdline); +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 1d27a6f..9272318 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -75,6 +75,10 @@ unsigned long __read_mostly cr4_pv32_mask; static bool_t __initdata opt_dom0pvh; boolean_param("dom0pvh", opt_dom0pvh); +/* Boot dom0 in HVM mode */ +static bool_t __initdata opt_dom0hvm; +boolean_param("dom0hvm", opt_dom0hvm); + /* **** Linux config option: propagated to domain0. */ /* "acpi=off": Sisables both ACPI table parsing and interpreter. */ /* "acpi=force": Override the disable blacklist. */ @@ -1495,6 +1499,11 @@ void __init noreturn __start_xen(unsigned long mbi_p) if ( opt_dom0pvh ) domcr_flags |= DOMCRF_pvh | DOMCRF_hap; + if ( opt_dom0hvm ) { + domcr_flags |= DOMCRF_hvm | (hvm_funcs.hap_supported ? DOMCRF_hap : 0); + config.emulation_flags = XEN_X86_EMU_LAPIC|XEN_X86_EMU_IOAPIC; + } + /* * Create initial domain 0. * x86 doesn't support arch-configuration. So it's fine to pass