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: 23329 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34B7420540 for ; Fri, 17 Jan 2014 12:46:46 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id uq10sf2366078igb.1 for ; Fri, 17 Jan 2014 04:46:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=srCEgU9StBsCGNMdgsM0+TxNnjDcekI5whggmjNEtfY=; b=Ex+0YQqsMH9vtrwXFaqyflOxTpIkhF4suH3ZXotNlnDBB8UAXtE4dMR/jj9JK6p7Tf 0qqSOvL7bTNXn/l1F0DPlMRWkQkvBe//ku7EOhiWQ/5RgQtrSBCHm7fTgzVh7jtBaLTq aT4vijKfh86NgOb4zSOwBXzqahQ+0XxCyfnzZBwEONkYRn3iXDtZnuFcYT4UZKkUo5Gy W5nuFmkusLbdQZDFkxBgT4+x497QhV6wWCMM7s4hyPwy7vP511FZ2lDGDSN91MbwpNjs f/zoJQjSgUgJ8geOEEFgcCbUmjo7qBBB/EKlx38rq9mMdXC8wBPWLU3GNDt2ZcN0crte qfkA== X-Gm-Message-State: ALoCoQldWCoEyq4CnUBFmtuW9vbgChRB18l/FYhvqXxkGgpNQK+A9cbRVMEGRocQzuXRescJD+c0 X-Received: by 10.43.100.129 with SMTP id cw1mr521086icc.30.1389962805500; Fri, 17 Jan 2014 04:46:45 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.116 with SMTP id b107ls434470qga.64.gmail; Fri, 17 Jan 2014 04:46:45 -0800 (PST) X-Received: by 10.220.162.196 with SMTP id w4mr88319vcx.58.1389962805402; Fri, 17 Jan 2014 04:46:45 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id dq5si4859074vcb.99.2014.01.17.04.46.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 04:46:45 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id x14so1516053vbb.36 for ; Fri, 17 Jan 2014 04:46:45 -0800 (PST) X-Received: by 10.52.108.40 with SMTP id hh8mr81142vdb.51.1389962805290; Fri, 17 Jan 2014 04:46:45 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp17009ved; Fri, 17 Jan 2014 04:46:44 -0800 (PST) X-Received: by 10.68.212.10 with SMTP id ng10mr1797932pbc.95.1389962804242; Fri, 17 Jan 2014 04:46:44 -0800 (PST) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by mx.google.com with ESMTPS id ek3si10048570pbd.205.2014.01.17.04.46.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 04:46:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.44 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.160.44; Received: by mail-pb0-f44.google.com with SMTP id rq2so4032296pbb.17 for ; Fri, 17 Jan 2014 04:46:43 -0800 (PST) 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 Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Grant Likely , Matthew Garrett , Olof Johansson , Linus Walleij , Bjorn Helgaas , Rob Herring , Mark Rutland , Arnd Bergmann , patches@linaro.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, Charles.Garcia-Tobin@arm.com, Hanjun Guo 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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