Commit bbd1b706 authored by Jeremy Linton's avatar Jeremy Linton Committed by Will Deacon

ACPI/PPTT: Add support for ACPI 6.3 thread flag

ACPI 6.3 adds a flag to the CPU node to indicate whether
the given PE is a thread. Add a function to return that
information for a given linux logical CPU.
Signed-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Reviewed-by: default avatarRobert Richter <rrichter@marvell.com>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent e21a712a
...@@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) ...@@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
return retval; return retval;
} }
/**
* check_acpi_cpu_flag() - Determine if CPU node has a flag set
* @cpu: Kernel logical CPU number
* @rev: The minimum PPTT revision defining the flag
* @flag: The flag itself
*
* Check the node representing a CPU for a given flag.
*
* Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
* the table revision isn't new enough.
* 1, any passed flag set
* 0, flag unset
*/
static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
{
struct acpi_table_header *table;
acpi_status status;
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
struct acpi_pptt_processor *cpu_node = NULL;
int ret = -ENOENT;
status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
if (ACPI_FAILURE(status)) {
acpi_pptt_warn_missing();
return ret;
}
if (table->revision >= rev)
cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
if (cpu_node)
ret = (cpu_node->flags & flag) != 0;
acpi_put_table(table);
return ret;
}
/** /**
* acpi_find_last_cache_level() - Determines the number of cache levels for a PE * acpi_find_last_cache_level() - Determines the number of cache levels for a PE
* @cpu: Kernel logical CPU number * @cpu: Kernel logical CPU number
...@@ -604,6 +642,20 @@ int cache_setup_acpi(unsigned int cpu) ...@@ -604,6 +642,20 @@ int cache_setup_acpi(unsigned int cpu)
return status; return status;
} }
/**
* acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
* @cpu: Kernel logical CPU number
*
* Return: 1, a thread
* 0, not a thread
* -ENOENT ,if the PPTT doesn't exist, the CPU cannot be found or
* the table revision isn't new enough.
*/
int acpi_pptt_cpu_is_thread(unsigned int cpu)
{
return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD);
}
/** /**
* find_acpi_cpu_topology() - Determine a unique topology value for a given CPU * find_acpi_cpu_topology() - Determine a unique topology value for a given CPU
* @cpu: Kernel logical CPU number * @cpu: Kernel logical CPU number
...@@ -664,7 +716,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level) ...@@ -664,7 +716,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
return ret; return ret;
} }
/** /**
* find_acpi_cpu_topology_package() - Determine a unique CPU package value * find_acpi_cpu_topology_package() - Determine a unique CPU package value
* @cpu: Kernel logical CPU number * @cpu: Kernel logical CPU number
......
...@@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address) ...@@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
#endif #endif
#ifdef CONFIG_ACPI_PPTT #ifdef CONFIG_ACPI_PPTT
int acpi_pptt_cpu_is_thread(unsigned int cpu);
int find_acpi_cpu_topology(unsigned int cpu, int level); int find_acpi_cpu_topology(unsigned int cpu, int level);
int find_acpi_cpu_topology_package(unsigned int cpu); int find_acpi_cpu_topology_package(unsigned int cpu);
int find_acpi_cpu_topology_hetero_id(unsigned int cpu); int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
int find_acpi_cpu_cache_topology(unsigned int cpu, int level); int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
#else #else
static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
{
return -EINVAL;
}
static inline int find_acpi_cpu_topology(unsigned int cpu, int level) static inline int find_acpi_cpu_topology(unsigned int cpu, int level)
{ {
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment