From patchwork Fri Jul 29 16:28:59 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: 9252683 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 5124260757 for ; Fri, 29 Jul 2016 16:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43033283E1 for ; Fri, 29 Jul 2016 16:31:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37CF5283E3; Fri, 29 Jul 2016 16:31:54 +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 DA593283E1 for ; Fri, 29 Jul 2016 16:31:53 +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 1bTAf6-0003Rm-DH; Fri, 29 Jul 2016 16:29:24 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bTAf5-0003RK-KI for xen-devel@lists.xenproject.org; Fri, 29 Jul 2016 16:29:23 +0000 Received: from [193.109.254.147] by server-14.bemta-14.messagelabs.com id F4/5C-17024-2648B975; Fri, 29 Jul 2016 16:29:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsXitHSDvW5Sy+x wg/Ntkhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aaL9PYCl6IVzz/2sTWwHhPsIuRk0NCwF/i 4eGzLCA2m4COxMW5O9m6GDk4RARUJG7vNQAxmQXKJWbciAepEBZwk5jfOosdxGYRUJV4/ek6W CevgIvEk1WTGCEm6ko8PPebFaSVU8BV4v+qahBTCKikoSkUolpQ4uTMJ2CdzAKaEq3bf7ND2P ISzVtnM4PYQgKKEv3zHrBBTOSWuH16KvMERv5ZSNpnIWmfhaR9ASPzKkaN4tSistQiXUNDvaS izPSMktzEzBwgz0QvN7W4ODE9NScxqVgvOT93EyMw+BiAYAfjmRXOhxglOZiURHkXrJgVLsSX lJ9SmZFYnBFfVJqTWnyIUYODQ2Dz2tUXGKVY8vLzUpUkeBOaZ4cLCRalpqdWpGXmAOMDplSCg 0dJhHcWSJq3uCAxtzgzHSJ1ilGXY8uCG2uZhMBmSInz6oMUCYAUZZTmwY2AxeolRlkpYV5GoA OFeApSi3IzS1DlXzGKczAqCfNWgkzhycwrgdv0CugIJqAjimNngBxRkoiQkmpgbD3bt9r0ss2 vro8KmYdaz543MJq35urircqcheVpfhazzzoezL3Oe2m+j1+R8k35z8Umx88Fl3poq+ruvyd2 3Or5BbPVC2QXXe6bbPUxwFVhpaPaTdPrm6Pn5xxX5v4vM0Gv0f2t4/9W3tjCzHahefEyP1I43 4h+CU34rT39/Nfmrx3RG+p5lViKMxINtZiLihMB5HEpD9ACAAA= X-Env-Sender: prvs=011b0443a=roger.pau@citrix.com X-Msg-Ref: server-15.tower-27.messagelabs.com!1469809760!1527603!1 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.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12189 invoked from network); 29 Jul 2016 16:29:22 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-15.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 29 Jul 2016 16:29:22 -0000 X-IronPort-AV: E=Sophos;i="5.28,440,1464652800"; d="scan'208";a="376340848" From: Roger Pau Monne To: Date: Fri, 29 Jul 2016 18:28:59 +0200 Message-ID: <1469809747-11176-5-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) In-Reply-To: <1469809747-11176-1-git-send-email-roger.pau@citrix.com> References: <1469809747-11176-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Andrew Cooper , Jan Beulich , Roger Pau Monne Subject: [Xen-devel] [PATCH RFC 04/12] 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 --- xen/arch/x86/domain_build.c | 27 ++++++++++++++++++++++++++- xen/arch/x86/setup.c | 9 +++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c index 09d79be..c0ef40f 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, @@ -1647,6 +1647,31 @@ 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(d, image, image_headroom, initrd, + bootstrap_map, cmdline) : + 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 217c775..8d9c3a0 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. */ @@ -1492,6 +1496,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