diff options
author | Jeremy Linton <jeremy.linton@arm.com> | 2019-06-26 17:37:16 -0400 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2019-06-27 11:53:18 -0400 |
commit | 56855a99f3d0d1e9f1f4e24f5851f9bf14c83296 (patch) | |
tree | 32211f461b703b6145dd9348caf70d6aa6d0c6e3 | |
parent | ed2b664fcc8073c09394393756df3fc86977bbac (diff) |
ACPI/PPTT: Add function to return ACPI 6.3 Identical tokens
ACPI 6.3 adds a flag to indicate that child nodes are all
identical cores. This is useful to authoritatively determine
if a set of (possibly offline) cores are identical or not.
Since the flag doesn't give us a unique id we can generate
one and use it to create bitmaps of sibling nodes, or simply
in a loop to determine if a subset of cores are identical.
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | drivers/acpi/pptt.c | 26 | ||||
-rw-r--r-- | include/linux/acpi.h | 5 |
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index 05344413f199..1e7ac0bd0d3a 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c | |||
@@ -683,3 +683,29 @@ int find_acpi_cpu_topology_package(unsigned int cpu) | |||
683 | return find_acpi_cpu_topology_tag(cpu, PPTT_ABORT_PACKAGE, | 683 | return find_acpi_cpu_topology_tag(cpu, PPTT_ABORT_PACKAGE, |
684 | ACPI_PPTT_PHYSICAL_PACKAGE); | 684 | ACPI_PPTT_PHYSICAL_PACKAGE); |
685 | } | 685 | } |
686 | |||
687 | /** | ||
688 | * find_acpi_cpu_topology_hetero_id() - Get a core architecture tag | ||
689 | * @cpu: Kernel logical CPU number | ||
690 | * | ||
691 | * Determine a unique heterogeneous tag for the given CPU. CPUs with the same | ||
692 | * implementation should have matching tags. | ||
693 | * | ||
694 | * The returned tag can be used to group peers with identical implementation. | ||
695 | * | ||
696 | * The search terminates when a level is found with the identical implementation | ||
697 | * flag set or we reach a root node. | ||
698 | * | ||
699 | * Due to limitations in the PPTT data structure, there may be rare situations | ||
700 | * where two cores in a heterogeneous machine may be identical, but won't have | ||
701 | * the same tag. | ||
702 | * | ||
703 | * Return: -ENOENT if the PPTT doesn't exist, or the CPU cannot be found. | ||
704 | * Otherwise returns a value which represents a group of identical cores | ||
705 | * similar to this CPU. | ||
706 | */ | ||
707 | int find_acpi_cpu_topology_hetero_id(unsigned int cpu) | ||
708 | { | ||
709 | return find_acpi_cpu_topology_tag(cpu, PPTT_ABORT_PACKAGE, | ||
710 | ACPI_PPTT_ACPI_IDENTICAL); | ||
711 | } | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d315d86844e4..5bcd23e5ccd6 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -1303,6 +1303,7 @@ static inline int lpit_read_residency_count_address(u64 *address) | |||
1303 | #ifdef CONFIG_ACPI_PPTT | 1303 | #ifdef CONFIG_ACPI_PPTT |
1304 | int find_acpi_cpu_topology(unsigned int cpu, int level); | 1304 | int find_acpi_cpu_topology(unsigned int cpu, int level); |
1305 | int find_acpi_cpu_topology_package(unsigned int cpu); | 1305 | int find_acpi_cpu_topology_package(unsigned int cpu); |
1306 | int find_acpi_cpu_topology_hetero_id(unsigned int cpu); | ||
1306 | int find_acpi_cpu_cache_topology(unsigned int cpu, int level); | 1307 | int find_acpi_cpu_cache_topology(unsigned int cpu, int level); |
1307 | #else | 1308 | #else |
1308 | static inline int find_acpi_cpu_topology(unsigned int cpu, int level) | 1309 | static inline int find_acpi_cpu_topology(unsigned int cpu, int level) |
@@ -1313,6 +1314,10 @@ static inline int find_acpi_cpu_topology_package(unsigned int cpu) | |||
1313 | { | 1314 | { |
1314 | return -EINVAL; | 1315 | return -EINVAL; |
1315 | } | 1316 | } |
1317 | static inline int find_acpi_cpu_topology_hetero_id(unsigned int cpu) | ||
1318 | { | ||
1319 | return -EINVAL; | ||
1320 | } | ||
1316 | static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) | 1321 | static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) |
1317 | { | 1322 | { |
1318 | return -EINVAL; | 1323 | return -EINVAL; |