From patchwork Mon Sep 23 10:09:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11156563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2452317D4 for ; Mon, 23 Sep 2019 10:11:42 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F38AD20820 for ; Mon, 23 Sep 2019 10:11:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ep23HRbz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F38AD20820 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLI7-0006sx-Gy; Mon, 23 Sep 2019 10:09:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLI6-0006sY-9i for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:09:58 +0000 X-Inumbo-ID: 417988b8-ddea-11e9-b299-bc764e2007e4 Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 417988b8-ddea-11e9-b299-bc764e2007e4; Mon, 23 Sep 2019 10:09:40 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id m18so8619608wmc.1 for ; Mon, 23 Sep 2019 03:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UqfVM3xb9A0eu4hPr4BRnP3HYQakt7P75+x7Ufcd7qY=; b=Ep23HRbzXiZPbX58oxtkUbGl/KV0RWeBVEi+qndp39CTAXj1lvBfYSMNunVqxv0KEm PCz2by9LNNBZAv//itRcF6UZ/9k0vwOCMO7YyfCj88bQZie186pXZaju6TFx2guW4yak vdX3SXi3jS+w7PWOxVAEilBCMWGRiqYQH29oedGmRgzdgrJOaVscmo8L8I2G53AH5fPz U8OkzV0YmlDfgcAymkaomlA0MWzj3uatTrIqQJaG3TONHdu3N6iqcAZLX4EFCaewDkbA uTWB3Euto6x2oG3W67m/6d2sfYkWv3IjYiM78wxvDDB84t1/WermbPf9D8uGxTT7RI+l 0bgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UqfVM3xb9A0eu4hPr4BRnP3HYQakt7P75+x7Ufcd7qY=; b=UUicReG+ysM4dhmCNNHNAwOPweDEqzV671mI7X7BJ45JJgNy115rQd4fbhgd5x1JBJ 8rYNb1vKunYvAhbiDKT2FkEywATazlbUB2+b1q7qdVQJiwedt5a6pcJ6yiWAiPccae82 VsRg5lK2yWibcQ/JADrAllkaWhnH24AReu6PetwPDjs7H6JYGo9s5wjg8X4B/iGpSbwk KET0E733D0bH9iSQXALmuTpOWcg1FHuC2+hWvifZNK69J1KTC5hNTclkqx3JXRv0j7Pc nkATKdrH8uzTyHBPg6gUWDpZrBzrvSQRWvEqse4V0sASZxvQeIUr7+hGB1iEu1gXa7k1 RNEg== X-Gm-Message-State: APjAAAWtcs5UJFaL9a8B0csCI34VPIOXy/snbIAchOfWzjPcTkiY7JsB nrMncRpkMywAh7GektfdpxE9CLZJ X-Google-Smtp-Source: APXvYqwPDn7qWlE5iQ2Ta9VT5C8jG0MlQ/uyJZ0v21SIYsfPL6BHHneQyzJFPwI/nvgyOway1JNbgQ== X-Received: by 2002:a05:600c:c2:: with SMTP id u2mr12218904wmm.37.1569233379730; Mon, 23 Sep 2019 03:09:39 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:39 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:27 +0100 Message-Id: <20190923100931.29670-5-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 4/8] x86: factor out xen variants for hypervisor setup code X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Andrew Cooper , Michael Kelley , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" We will add Hyper-V specific implementations in the future. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/guest/xen/xen.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 78fc603996..f93c8fbd1c 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -67,7 +67,7 @@ static void __init find_xen_leaves(void) } } -void __init probe_hypervisor(void) +static void __init probe_xen(void) { if ( xen_guest ) return; @@ -87,6 +87,11 @@ void __init probe_hypervisor(void) xen_guest = true; } +void __init probe_hypervisor(void) +{ + probe_xen(); +} + static void map_shared_info(void) { mfn_t mfn; @@ -249,10 +254,8 @@ static void init_evtchn(void) } } -void __init hypervisor_setup(void) +static void __init xen_setup(void) { - init_memmap(); - map_shared_info(); set_vcpu_id(); @@ -277,13 +280,25 @@ void __init hypervisor_setup(void) init_evtchn(); } -void hypervisor_ap_setup(void) +void __init hypervisor_setup(void) +{ + init_memmap(); + + xen_setup(); +} + +static void xen_ap_setup(void) { set_vcpu_id(); map_vcpuinfo(); init_evtchn(); } +void hypervisor_ap_setup(void) +{ + xen_ap_setup(); +} + int hypervisor_alloc_unused_page(mfn_t *mfn) { unsigned long m; @@ -307,7 +322,7 @@ static void ap_resume(void *unused) init_evtchn(); } -void hypervisor_resume(void) +static void xen_resume(void) { /* Reset shared info page. */ map_shared_info(); @@ -330,6 +345,11 @@ void hypervisor_resume(void) pv_console_init(); } +void hypervisor_resume(void) +{ + xen_resume(); +} + /* * Local variables: * mode: C