From patchwork Tue May 24 22:35:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 9134427 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 5BCCD607D3 for ; Tue, 24 May 2016 22:41:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50C16281E3 for ; Tue, 24 May 2016 22:41:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4589C2822B; Tue, 24 May 2016 22:41:13 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CAD7E281E3 for ; Tue, 24 May 2016 22:41:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5Ky6-0000An-UZ; Tue, 24 May 2016 22:38:30 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5KwE-0006nz-KS for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2016 22:36:36 +0000 Received: by mail-pf0-x241.google.com with SMTP id b124so2929686pfb.0 for ; Tue, 24 May 2016 15:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PgmbBv+jO+oqOGVwQc94qjfjaJDqkNBeRK3S8v6lZL4=; b=hU7XS+nTMYfUKADLeaTirdf7nAeXTmPoG7DNWioBePZsifZmfiVTjwNL05S9weuDSW c4gu0hOWI2NXtixad02t0JznYcn31e5b0RtTaXxX7UtKscntIXI4gctU6Aybe/TeNW2N TBpZqNdgUmT3vNogPtBJSo/c1Le9fss1J1pL2sYHt7CcPh5oy8RWSYj6p/F6/rhrM5yE gGfx40ZeHDekD9i7OHh0oGIWfixTLTWbTHWHlLI1kqzOGqvak0QWAk3cKagr9sIlENjO D1lBw6YS9XCe/RjY5Vr/X9kwv0yA0fKk2K/2/gGAdC9h9NYB+RNYCMng1teMM2Hj4O86 P6NA== 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=PgmbBv+jO+oqOGVwQc94qjfjaJDqkNBeRK3S8v6lZL4=; b=KTtegauGLXQ/h4AFFLWM2ORcEjUBgoHtfH8niFAuzUnpqpeIMr8A8Tt3y/YxW1lBP7 BNw+86HnLW7RAih2YEN9uw70brksCUyWXPVJDH+/13NRwjBpTQP3iT4muMLmlGqVXZg4 57KwLuUnNub7ERHPP9B6ZARpLGz6fhI+Q9qxK/PoWdS7wZ28SvhUpJw1S5Hy3FkJQTme k/hPhrlKb1YqFxYaOe0+SjpLkMeS9uNWnu5D2T2h4cgTWYXQnSFpoDllKzHWGZPBYCcl 0mYyagX8xt3Y1RfmnSrtmpuPAWEFNB2QRxH33C8CtC88pKSmsJ+uHIiVx/OV5U3Mgfcz vdzQ== X-Gm-Message-State: ALyK8tJw9uNz3Mtj0WTIUYAGhFvx4zbhy7MbKytikxC4JoSkcBINtkUgmKaWoourZ85sBQ== X-Received: by 10.98.94.194 with SMTP id s185mr799097pfb.135.1464129377537; Tue, 24 May 2016 15:36:17 -0700 (PDT) Received: from dl.caveonetworks.com ([50.233.148.158]) by smtp.gmail.com with ESMTPSA id x123sm56695980pfb.54.2016.05.24.15.36.04 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 May 2016 15:36:09 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id u4OMa3GL019088; Tue, 24 May 2016 15:36:03 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u4OMa3d8019087; Tue, 24 May 2016 15:36:03 -0700 From: David Daney To: Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Catalin Marinas , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand , Grant Likely , Robert Moore , Lv Zheng , Hanjun Guo , Marc Zyngier , linux-ia64@vger.kernel.org, linux-acpi@vger.kernel.org, devel@acpica.org Subject: [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry(). Date: Tue, 24 May 2016 15:35:43 -0700 Message-Id: <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> References: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160524_153634_888600_24355F3E X-CRM114-Status: GOOD ( 15.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Richter , linux-kernel@vger.kernel.org, David Daney 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 From: David Daney Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early (before kmalloc is usable). Add acpi_map_madt_entry() which, indirectly, uses early_memremap()/early_memunmap() to access the table and parse out the mpidr. The existing implementation of map_madt_entry() is modified to take a pointer to the MADT as a parameter and the callers adjusted. Signed-off-by: David Daney Acked-by: Catalin Marinas --- drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++---- include/acpi/processor.h | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 33a38d6..9125d7d 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry, return -EINVAL; } -static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) +static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, + int type, u32 acpi_id) { unsigned long madt_end, entry; phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ - struct acpi_table_madt *madt; - madt = get_madt_table(); if (!madt) return phys_id; @@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) return phys_id; } +phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id) +{ + struct acpi_table_madt *madt = NULL; + acpi_size tbl_size; + phys_cpuid_t rv; + + acpi_get_table_with_size(ACPI_SIG_MADT, 0, + (struct acpi_table_header **)&madt, + &tbl_size); + if (!madt) + return PHYS_CPUID_INVALID; + + rv = map_madt_entry(madt, 1, acpi_id); + + early_acpi_os_unmap_memory(madt, tbl_size); + + return rv; +} + static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -185,7 +203,7 @@ phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) phys_id = map_mat_entry(handle, type, acpi_id); if (invalid_phys_cpuid(phys_id)) - phys_id = map_madt_entry(type, acpi_id); + phys_id = map_madt_entry(get_madt_table(), type, acpi_id); return phys_id; } diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 6f1805d..f473e66 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -309,6 +309,7 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) /* in processor_core.c */ phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id); +phys_cpuid_t acpi_map_madt_entry(u32 acpi_id); int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id); int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);