From patchwork Wed Mar 2 07:34:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 63366 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2242219lbc; Tue, 1 Mar 2016 23:37:24 -0800 (PST) X-Received: by 10.55.72.130 with SMTP id v124mr31720299qka.13.1456904244088; Tue, 01 Mar 2016 23:37:24 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id d9si7016406qgf.7.2016.03.01.23.37.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Mar 2016 23:37:24 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ab1KK-0004o2-D2; Wed, 02 Mar 2016 07:36:08 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ab1KI-0004mv-Nu for xen-devel@lists.xen.org; Wed, 02 Mar 2016 07:36:06 +0000 Received: from [193.109.254.147] by server-9.bemta-14.messagelabs.com id B8/33-02984-6E796D65; Wed, 02 Mar 2016 07:36:06 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1456904160!28064890!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16204 invoked from network); 2 Mar 2016 07:36:05 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-5.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 2 Mar 2016 07:36:05 -0000 Received: from 172.24.1.47 (EHLO SZXEML424-HUB.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BXB04004; Wed, 02 Mar 2016 15:35:40 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML424-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.3.235.1; Wed, 2 Mar 2016 15:35:16 +0800 From: Shannon Zhao To: Date: Wed, 2 Mar 2016 15:34:32 +0800 Message-ID: <1456904083-13168-7-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1456904083-13168-1-git-send-email-zhaoshenglong@huawei.com> References: <1456904083-13168-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.56D697CC.00AF, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 726768bb82ff71b4f930e1f6171fc040 Cc: zhaoshenglong@huawei.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v8 06/17] arm/acpi: Add ACPI support for SMP initialization 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" From: Shannon Zhao ACPI 5.1 only has two explicit methods to boot up SMP, PSCI and Parking protocol, but the Parking protocol is only specified for ARMv7 now, so make PSCI as the only way for the SMP boot protocol before some updates for the ACPI spec or the Parking protocol spec. ACPI only supports PSCI 0.2+, since prior to PSCI 0.2 function IDs are not well-defined. Signed-off-by: Hanjun Guo Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- xen/arch/arm/arm64/smpboot.c | 7 ++++++- xen/arch/arm/psci.c | 35 ++++++++++++++++++++++++++++------- xen/arch/arm/smpboot.c | 7 ++++++- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/arm64/smpboot.c b/xen/arch/arm/arm64/smpboot.c index 7928f69..4fd0ac6 100644 --- a/xen/arch/arm/arm64/smpboot.c +++ b/xen/arch/arm/arm64/smpboot.c @@ -7,6 +7,7 @@ #include #include #include +#include struct smp_enable_ops { int (*prepare_cpu)(int); @@ -96,7 +97,11 @@ static int __init dt_arch_cpu_init(int cpu, struct dt_device_node *dn) int __init arch_cpu_init(int cpu, struct dt_device_node *dn) { - return dt_arch_cpu_init(cpu, dn); + if ( acpi_disabled ) + return dt_arch_cpu_init(cpu, dn); + else + /* acpi only supports psci at present */ + return smp_psci_init(cpu); } int __init arch_cpu_up(int cpu) diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c index d800cb6..7966b5e 100644 --- a/xen/arch/arm/psci.c +++ b/xen/arch/arm/psci.c @@ -22,6 +22,7 @@ #include #include #include +#include /* * While a 64-bit OS can make calls with SMC32 calling conventions, for @@ -86,6 +87,12 @@ int __init psci_init_0_1(void) int ret; const struct dt_device_node *psci; + if ( !acpi_disabled ) + { + printk("PSCI 0.1 is not supported when using ACPI\n"); + return -EINVAL; + } + psci = dt_find_compatible_node(NULL, NULL, "arm,psci"); if ( !psci ) return -EOPNOTSUPP; @@ -116,15 +123,26 @@ int __init psci_init_0_2(void) { /* sentinel */ }, }; int ret; - const struct dt_device_node *psci; - psci = dt_find_matching_node(NULL, psci_ids); - if ( !psci ) - return -EOPNOTSUPP; + if ( acpi_disabled ) + { + const struct dt_device_node *psci; - ret = psci_is_smc_method(psci); - if ( ret ) - return -EINVAL; + psci = dt_find_matching_node(NULL, psci_ids); + if ( !psci ) + return -EOPNOTSUPP; + + ret = psci_is_smc_method(psci); + if ( ret ) + return -EINVAL; + } + else + { + if ( acpi_psci_hvc_present() ) { + printk("PSCI conduit must be SMC, but is HVC\n"); + return -EINVAL; + } + } psci_ver = call_smc(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0); @@ -148,6 +166,9 @@ int __init psci_init(void) { int ret; + if ( !acpi_disabled && !acpi_psci_present() ) + return -EOPNOTSUPP; + ret = psci_init_0_2(); if ( ret ) ret = psci_init_0_1(); diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index b6119d1..c5109bf 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -31,6 +31,7 @@ #include #include #include +#include cpumask_t cpu_online_map; cpumask_t cpu_present_map; @@ -247,7 +248,11 @@ void __init smp_init_cpus(void) return; } - dt_smp_init_cpus(); + if ( acpi_disabled ) + dt_smp_init_cpus(); + else + acpi_smp_init_cpus(); + } int __init