Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1406479

[PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry().

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From David Daney <ddaney.cavm@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry().
Date Wed, 25 May 2016 00:40:01 +0200
Message-ID <rCt9v-R2-9@gated-at.bofh.it> (permalink)
References <rCt9v-R2-5@gated-at.bofh.it>
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=lqbX2QDQWXC2tb+IDmnxEj85L28WK+bO8CQmVH90av6bAkZ1r9pMfoXSuPxCE6wprL 5v+/mxa1tKZ4TZPrJJcHj5bDNfwwXIIF6tj0Ovn8vJwfjvTP/WUoXhL4XFhQeon2yOfw kIGYhX/1IMXg+0gM8Ja4pTQFDIu8IbMmbokQ6AL2WXJim0luu9GTHfvuxwKI5PF20BEh UmIFaDzB5pjgh58XtwYqGa2wmH8B3BL29G59/KJuLeXoaArW2Qd6nnjIeUtXa8BxZoAp ZKAPXPwuNdiu0FlaHuval+1b5s7YgLvHUentXtg7jgOvQMGyvlYbB6xGIcmwogx741Gv kXGA==
X-Gm-Message-State ALyK8tIvMlikWATV668kJYx2WDBHGwxktJatW28Cqkahb+R+66QgdE0UaUeHq4Jt9Rx/FQ==
X-Received by 10.98.94.194 with SMTP id s185mr799097pfb.135.1464129377537; Tue, 24 May 2016 15:36:17 -0700 (PDT)
X-Mailer git-send-email 1.7.11.7
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 86
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, Robert Richter <rrichter@cavium.com>, David Daney <david.daney@cavium.com>
X-Original-Date Tue, 24 May 2016 15:35:43 -0700
X-Original-Message-ID <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com>
X-Original-References <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1406479

Show key headers only | View raw


From: David Daney <david.daney@cavium.com>

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 <david.daney@cavium.com>
---
 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);
 
-- 
1.7.11.7

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 00/15] ACPI NUMA support for ARM64 David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 02/15] acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 09/15] acpi, numa: move bad_srat() and srat_disabled() to drivers/acpi/numa.c David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 12/15] acpi, numa, srat: Improve SRAT error detection and add messages. David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry(). David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
    Re: [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry(). Catalin Marinas <catalin.marinas@arm.com> - 2016-05-25 16:50 +0200
  [PATCH v7 11/15] acpi, numa: Move acpi_numa_memory_affinity_init() to drivers/acpi/numa.c David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 10/15] acpi, numa: remove unneeded acpi_numa=1 David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT and SLIT David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
    Re: [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Catalin Marinas <catalin.marinas@arm.com> - 2016-05-25 16:50 +0200
    Re: [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Dennis Chen <dennis.chen@linaro.org> - 2016-05-27 10:10 +0200
  [PATCH v7 15/15] acpi, numa: Enable ACPI based NUMA on ARM64 David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 05/15] acpi, numa: move acpi_numa_slit_init() to drivers/acpi/numa.c David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 07/15] arm64, numa: Cleanup NUMA disabled messages. David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
    Re: [PATCH v7 07/15] arm64, numa: Cleanup NUMA disabled messages. Dennis Chen <dennis.chen@linaro.org> - 2016-05-27 10:00 +0200
  [PATCH v7 08/15] x86, acpi, numa: cleanup acpi_numa_processor_affinity_init() David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:40 +0200
  [PATCH v7 06/15] arm64, numa: rework numa_add_memblk() David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:50 +0200
  [PATCH v7 04/15] acpi, numa: Move acpi_numa_arch_fixup() to ia64 only David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:50 +0200
  [PATCH v7 03/15] acpi, numa: remove duplicate NULL check David Daney <ddaney.cavm@gmail.com> - 2016-05-25 00:50 +0200

csiph-web