Received: by 10.192.165.148 with SMTP id m20csp1937061imm; Thu, 3 May 2018 07:47:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoeaH2YFsF2yYdRyEIoSrQ+ruWUnML4RNrW743Amu9pXsXar8QtSEo4U627doiqoCLSmG6D X-Received: by 2002:a17:902:7405:: with SMTP id g5-v6mr24145422pll.102.1525358864040; Thu, 03 May 2018 07:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525358863; cv=none; d=google.com; s=arc-20160816; b=Z8n0pTIcSZa5/qJmPYH92XdS6M6JnG4vI1/arvg9miXKP1IDmXvKuTN5OjUsmU0W/a leNionINsnfiszrIEtX8SXUzdQIVvP8JjblluBnlz+/qDRgxPE+xuQZdlNa8iXu+QBgR LNuVah/NGE/TJER828Rg5snRPHwEtO8X00KoZXuf8EUgpZ28IpL3CKrWVRdxj2m0XiCq GtAiAYILNQb7vT9AAmOtQtMBJKtHE5eXxsgybXB6truefddo5EvOVEW1oFBYK3sQegDG fvhurKAcIHbwUz9X1rslaTKVypEHQQD531YPXZxOMsMd+f8RgQvJAHrmFspWmHyNlvJH oLfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3MPv7u5My6bzfJlj625U0NH4dCZUyzdOJTRvop07E/M=; b=XqMJKSBUwM7TcPMaaK5DS/wXIv5rggm7IxAuD33HHMUB05kr502dzCY4Dbwj0AzcYh ntu7g/u6+/lbPw6uXwBNH08PN3JjG97A4Oam8OrarhUV02WWQy8HM/N0Ei0TjsVqhmM9 2Vrqn7Xvs9D3iggEe9V7Y2pVxZISP9zTm+dME7Ro5tY+JX28FXfL2YyCBO4HbCLVA8iN +qCWhYVG/jGael7kvhEjw2TC0xb22egPvB7lodVJpvDITzcFaCA4IIE65IjepcTGv58L RvRFs5WiVDittvO2uoa26gHRPs9huEwVJLrT2h86i6rKjX6iCO5as69ITs/KSYSorVwb Rwiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t29-v6si11900670pgo.539.2018.05.03.07.47.30; Thu, 03 May 2018 07:47:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751245AbeECOqD (ORCPT + 99 others); Thu, 3 May 2018 10:46:03 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:63218 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbeECOqB (ORCPT ); Thu, 3 May 2018 10:46:01 -0400 X-IronPort-AV: E=Sophos;i="5.49,358,1520899200"; d="scan'208";a="72566510" From: Roger Pau Monne To: CC: Roger Pau Monne , Boris Ostrovsky , Juergen Gross , Subject: [PATCH 3/3] xen: share start flags between PV and PVH Date: Thu, 3 May 2018 15:45:45 +0100 Message-ID: <20180503144545.61123-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180503143646.60747-1-roger.pau@citrix.com> References: <20180503143646.60747-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use a global variable to store the start flags for both PV and PVH. This allows the xen_initial_domain macro to work properly on PVH. Signed-off-by: Boris Ostrovsky Signed-off-by: Roger Pau Monné --- Cc: Boris Ostrovsky Cc: Juergen Gross Cc: xen-devel@lists.xenproject.org --- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 4 +++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index c9081c6671f0..cdbd7b524133 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info; __read_mostly int xen_have_vector_callback; EXPORT_SYMBOL_GPL(xen_have_vector_callback); +/* + * NB: needs to live in .data because it's used by xen_prepare_pvh which runs + * before clearing the bss. + */ +uint32_t xen_start_flags __attribute__((section(".data"))) = 0; +EXPORT_SYMBOL_GPL(xen_start_flags); + /* * Point at some empty memory to start with. We map the real shared_info * page as soon as fixmap is up and running. diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index c36d23aa6c35..04a6914b8b85 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1227,6 +1227,7 @@ asmlinkage __visible void __init xen_start_kernel(void) return; xen_domain_type = XEN_PV_DOMAIN; + xen_start_flags = xen_start_info->flags; xen_setup_features(); diff --git a/arch/x86/xen/enlighten_pvh.c b/arch/x86/xen/enlighten_pvh.c index e039d1809809..2653eb9b5dd8 100644 --- a/arch/x86/xen/enlighten_pvh.c +++ b/arch/x86/xen/enlighten_pvh.c @@ -98,6 +98,7 @@ void __init xen_prepare_pvh(void) } xen_pvh = 1; + xen_start_flags = pvh_start_info.flags; wrmsr_safe(MSR_MTRRdefType, 0x800 | MTRR_TYPE_WRBACK, 0); diff --git a/include/xen/xen.h b/include/xen/xen.h index 9d4340c907d1..6b5bee7041db 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -25,12 +25,14 @@ extern bool xen_pvh; #define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN) #define xen_pvh_domain() (xen_pvh) +extern uint32_t xen_start_flags; + #ifdef CONFIG_XEN_DOM0 #include #include #define xen_initial_domain() (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN)) #else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain() (0) #endif /* CONFIG_XEN_DOM0 */ -- 2.17.0