Skip to content

Commit

Permalink
arm64: topology: Use PPTT to determine if PE is a thread
Browse files Browse the repository at this point in the history
ACPI 6.3 adds a thread flag to represent if a CPU/PE is
actually a thread. Given that the MPIDR_MT bit may not
represent this information consistently on homogeneous machines
we should prefer the PPTT flag if its available.

Signed-off-by: Jeremy Linton <[email protected]>
Reviewed-by: Sudeep Holla <[email protected]>
Reviewed-by: Robert Richter <[email protected]>
[will: made acpi_cpu_is_threaded() return 'bool']
Signed-off-by: Will Deacon <[email protected]>
  • Loading branch information
jlintonarm authored and willdeacon committed Aug 12, 2019
1 parent bbd1b70 commit 98dc199
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions arch/arm64/kernel/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,25 +340,36 @@ void remove_cpu_topology(unsigned int cpu)
}

#ifdef CONFIG_ACPI
static bool __init acpi_cpu_is_threaded(int cpu)
{
int is_threaded = acpi_pptt_cpu_is_thread(cpu);

/*
* if the PPTT doesn't have thread information, assume a homogeneous
* machine and return the current CPU's thread state.
*/
if (is_threaded < 0)
is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;

return !!is_threaded;
}

/*
* Propagate the topology information of the processor_topology_node tree to the
* cpu_topology array.
*/
static int __init parse_acpi_topology(void)
{
bool is_threaded;
int cpu, topology_id;

is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;

for_each_possible_cpu(cpu) {
int i, cache_id;

topology_id = find_acpi_cpu_topology(cpu, 0);
if (topology_id < 0)
return topology_id;

if (is_threaded) {
if (acpi_cpu_is_threaded(cpu)) {
cpu_topology[cpu].thread_id = topology_id;
topology_id = find_acpi_cpu_topology(cpu, 1);
cpu_topology[cpu].core_id = topology_id;
Expand Down

0 comments on commit 98dc199

Please sign in to comment.