From patchwork Fri Mar 10 11:04:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 9616093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1912E60414 for ; Fri, 10 Mar 2017 11:13:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3011328702 for ; Fri, 10 Mar 2017 11:13:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 247272870E; Fri, 10 Mar 2017 11:13:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CA98228702 for ; Fri, 10 Mar 2017 11:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vM/sxgFSnvQRQYwo1FwrvgYvh8o/Jhz2005dyJJ0MYY=; b=Za8RKmQKx5/cKLWrgEpFGQ8AVR ArpUjNAuCANAcROxco1KOVp9ZPZCcV94B96bPmCK4wZGoym7ebwoP6ssSxhFPTZ2rKeeUrxXcIYDK cwZ3Uz7/UkGNyRtSl53TotLGrf3z+9gInuplCyEW4+HVcYjKlq5ktNkb4Zh8qrg8biEySbdhbRmEi Imn3nV46xoPXCHgdO5c10k4rvzFYkYCBLMWBuE+iN7ZJnCEAPXB7kexdugFFszUOqVujyFrQDAwHH 3tlCNlmTycar04491PK5ve5mwLDskDAZlbumXF7h0EsGuDcCsFQrETXrSFXYHTu7IoiG4nx5zC6GN j05eCV9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cmIUZ-00008G-QC; Fri, 10 Mar 2017 11:13:51 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmITY-0007p0-J1 for linux-arm-kernel@bombadil.infradead.org; Fri, 10 Mar 2017 11:12:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=74F/k55ZMSY6cP3VWZDvS4UVM2RpHRgWcUc7vJRP7bo=; b=Gt9Q7l1gptKYH1oJlwAsQ55D5 3SP8njUf3vFpgMI++qEuaAqsdjkgC5hah7TSbXo4PvOAFq7Kx1HKT4waj45KoXH+GPRvUNP72rNxj tQhLuFJszPD6vZUKTh8Npa7k0yVrjpdVQpMxtMgTcXY6lGDGqNCE9ZIQQvIlzvcJ+wxWDLx8+32jn kckz30WH0UR2r4zlWomXcArR96QaOYq11aFKP7wfyHc4RVIa6AWM1hGCcqcRW8nqaQ4p6a4OZUNv6 s95tWVsu3EV+/gum8cKLT/07aNWvBInLqMxixFSo1W3XMgEaB73p1JVC2kBVZOT6yQ3XanfYfzP8X mMZJKUpuA==; Received: from foss.arm.com ([217.140.101.70]) by casper.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cmINS-0007Vv-5C for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2017 11:06:32 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5D96C153B; Fri, 10 Mar 2017 03:06:08 -0800 (PST) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 421BE3F3E1; Fri, 10 Mar 2017 03:06:07 -0800 (PST) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 11/14] arm64: add function to get a cpu's MADT GICC table Date: Fri, 10 Mar 2017 11:04:48 +0000 Message-Id: <1489143891-11596-12-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489143891-11596-1-git-send-email-mark.rutland@arm.com> References: <1489143891-11596-1-git-send-email-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170310_110630_344105_2EBB3EE2 X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, catalin.marinas@arm.com, lorenzo.pieralisi@arm.com, will.deacon@arm.com, jeremy.linton@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the ACPI parking protocol code needs to parse each CPU's MADT GICC table to extract the mailbox address and so on. Each time we parse a GICC table, we call back to the parking protocol code to parse it. This has been fine so far, but we're about to have more code that needs to extract data from the GICC tables, and adding a callback for each user is going to get unwieldy. Instead, this patch ensures that we stash a copy of each CPU's GICC table at boot time, such that anything needing to parse it can later request it. This will allow for other parsers of GICC, and for simplification to the ACPI parking protocol code. Note that we must store a copy, rather than a pointer, since the core ACPI code temporarily maps/unmaps tables while iterating over them. Since we parse the MADT before we know how many CPUs we have (and hence before we setup the percpu areas), we must use an NR_CPUS sized array. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Lorenzo Pieralisi Cc: Will Deacon Reviewed-by: Lorenzo Pieralisi --- arch/arm64/include/asm/acpi.h | 2 ++ arch/arm64/kernel/smp.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c1976c0..0e99978 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -85,6 +85,8 @@ static inline bool acpi_has_cpu_in_madt(void) return true; } +struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu); + static inline void arch_fix_phys_package_id(int num, u32 slot) { } void __init acpi_init_cpus(void); diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index ef1caae..390c277 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -518,6 +518,13 @@ static int __init smp_cpu_setup(int cpu) static unsigned int cpu_count = 1; #ifdef CONFIG_ACPI +static struct acpi_madt_generic_interrupt cpu_madt_gicc[NR_CPUS]; + +struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu) +{ + return &cpu_madt_gicc[cpu]; +} + /* * acpi_map_gic_cpu_interface - parse processor MADT entry * @@ -552,6 +559,7 @@ static int __init smp_cpu_setup(int cpu) return; } bootcpu_valid = true; + cpu_madt_gicc[0] = *processor; early_map_cpu_to_node(0, acpi_numa_get_nid(0, hwid)); return; } @@ -562,6 +570,8 @@ static int __init smp_cpu_setup(int cpu) /* map the logical cpu id to cpu MPIDR */ cpu_logical_map(cpu_count) = hwid; + cpu_madt_gicc[cpu_count] = *processor; + /* * Set-up the ACPI parking protocol cpu entries * while initializing the cpu_logical_map to