From patchwork Fri Jan 17 12:25:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 3504131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B8A01C02DC for ; Fri, 17 Jan 2014 12:47:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8B642012F for ; Fri, 17 Jan 2014 12:47:53 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B01FE20120 for ; Fri, 17 Jan 2014 12:47:52 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48pX-00008o-Nk; Fri, 17 Jan 2014 12:47:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48pH-0007np-Ts; Fri, 17 Jan 2014 12:47:07 +0000 Received: from mail-pb0-f50.google.com ([209.85.160.50]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48pF-0007mj-5z for linux-arm-kernel@lists.infradead.org; Fri, 17 Jan 2014 12:47:05 +0000 Received: by mail-pb0-f50.google.com with SMTP id rq2so4047692pbb.23 for ; Fri, 17 Jan 2014 04:46:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=srCEgU9StBsCGNMdgsM0+TxNnjDcekI5whggmjNEtfY=; b=A7E1G//sT38IUW0wBRlYiwUEd75rh1aSwr3HtdSWv3S7kS6Zi9iAt/5ABaqwHmZ30S SbzTPYWzTC5w8YFpAPwH1EJbveO0Ses8TzpaZ8m35okR7QEwkauszsNApVSSS/2H8O5b mJd+XTDPO5GbdAH7zzKX0kjgO5bL43jlHzw5qKEMJVlwv17Xk+tqNXffu+kxVQMsiUt5 1QHQyCkSi1GoLU1rK7byIGFWCwuwYEWUXqqFYh25Au5mbV4umeVjy3k4UhphkvgMlnuH px6ql5yo/L/SM01O1iOr2QpFYYwEeufgg1DWrFBuibvEvHiZK7ZVOfZiCKEgYdtlGJAx ZC8Q== X-Gm-Message-State: ALoCoQkwFE8k+inkFJI/mnHXc1XAFeqp0qzwr1VDSdxmQkJb4Hqt2Ca6dZK3hSiDs3wIruqY9nzx X-Received: by 10.66.65.134 with SMTP id x6mr1966204pas.12.1389962803766; Fri, 17 Jan 2014 04:46:43 -0800 (PST) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id g6sm30387014pat.2.2014.01.17.04.46.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 Jan 2014 04:46:43 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Russell King - ARM Linux Subject: [PATCH 12/20] ARM64 / ACPI: Use Parked Address in GIC structure for spin table SMP initialisation Date: Fri, 17 Jan 2014 20:25:06 +0800 Message-Id: <1389961514-13562-13-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389961514-13562-1-git-send-email-hanjun.guo@linaro.org> References: <1389961514-13562-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140117_074705_308423_8573FDB5 X-CRM114-Status: GOOD ( 19.64 ) X-Spam-Score: -1.8 (-) Cc: Mark Rutland , Matthew Garrett , linaro-kernel@lists.linaro.org, Arnd Bergmann , Rob Herring , Linus Walleij , Olof Johansson , linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, linux-acpi@vger.kernel.org, Hanjun Guo , patches@linaro.org, Grant Likely , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Charles.Garcia-Tobin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Parked Address in GIC structure can be used as cpu release address for spin table SMP initialisation. This patch gets parked address from MADT and use it for SMP initialisation when DT is not available. Signed-off-by: Hanjun Guo --- arch/arm64/include/asm/acpi.h | 7 +++++++ arch/arm64/kernel/smp_spin_table.c | 12 ++++++++---- drivers/acpi/plat/arm-core.c | 24 +++++++++++++++++++++++- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 097394c..856a2e7 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -89,6 +89,8 @@ extern int arm_cpu_to_apicid[NR_CPUS]; extern const char *acpi_get_enable_method(int cpu); +extern int acpi_get_cpu_release_address(int cpu, u64 *release_address); + #else /* !CONFIG_ACPI */ #define acpi_disabled 1 /* ACPI sometimes enabled on ARM */ #define acpi_noirq 1 /* ACPI sometimes enabled on ARM */ @@ -100,6 +102,11 @@ static inline const char *acpi_get_enable_method(int cpu) return NULL; } +static inline int acpi_get_cpu_release_address(int cpu, u64 *release_address) +{ + return -ENODEV; +} + #endif #endif /*_ASM_ARM64_ACPI_H*/ diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c index 44c2280..ce86189 100644 --- a/arch/arm64/kernel/smp_spin_table.c +++ b/arch/arm64/kernel/smp_spin_table.c @@ -25,6 +25,7 @@ #include #include #include +#include extern void secondary_holding_pen(void); volatile unsigned long secondary_holding_pen_release = INVALID_HWID; @@ -47,7 +48,6 @@ static void write_pen_release(u64 val) __flush_dcache_area(start, size); } - static int smp_spin_table_cpu_init(struct device_node *dn, unsigned int cpu) { /* @@ -55,10 +55,14 @@ static int smp_spin_table_cpu_init(struct device_node *dn, unsigned int cpu) */ if (of_property_read_u64(dn, "cpu-release-addr", &cpu_release_addr[cpu])) { - pr_err("CPU %d: missing or invalid cpu-release-addr property\n", - cpu); - return -1; + /* try ACPI way */ + if (acpi_get_cpu_release_address(cpu, &cpu_release_addr[cpu])) { + pr_err("CPU %d: missing or invalid cpu-release-addr property\n", + cpu); + + return -1; + } } return 0; diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c index 2704633..7f1d709 100644 --- a/drivers/acpi/plat/arm-core.c +++ b/drivers/acpi/plat/arm-core.c @@ -60,6 +60,9 @@ static int available_cpus; int arm_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = -1 }; static int boot_cpu_apic_id = -1; +/* Parked Address in ACPI GIC structure */ +static u64 parked_address[NR_CPUS]; + #define BAD_MADT_ENTRY(entry, end) ( \ (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) @@ -193,6 +196,7 @@ static int __init acpi_parse_gic(struct acpi_subtable_header *header, const unsigned long end) { struct acpi_madt_generic_interrupt *processor = NULL; + int cpu; processor = (struct acpi_madt_generic_interrupt *)header; @@ -208,9 +212,16 @@ acpi_parse_gic(struct acpi_subtable_header *header, const unsigned long end) * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - acpi_register_gic_cpu_interface(processor->gic_id, + cpu = acpi_register_gic_cpu_interface(processor->gic_id, processor->flags & ACPI_MADT_ENABLED); + /* + * We need the parked address for SMP initialization with + * spin-table enable method + */ + if (cpu >= 0 && processor->parked_address) + parked_address[cpu] = processor->parked_address; + return 0; } @@ -269,6 +280,17 @@ static int __init acpi_parse_madt_gic_entries(void) return 0; } +/* Parked Address in ACPI GIC structure can be used as cpu release addr */ +int acpi_get_cpu_release_address(int cpu, u64 *release_address) +{ + if (!release_address || !parked_address[cpu]) + return -EINVAL; + + *release_address = parked_address[cpu]; + + return 0; +} + /* * Parse GIC distributor related entries in MADT * returns 0 on success, < 0 on error