ACPI / PPTT: Add a helper to build a cpumask from a cpu_node
ANBZ: #1644 cherry-picked from https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git To enable PPI partitions, the irqchip driver needs to know which CPUs are in each partition. As a partition is identified by a Processor Container, provide a helper to map this to a cpumask. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Xin Hao <xhao@linux.alibaba.com> Signed-off-by: Shawn Wang <shawnwang@linux.alibaba.com> Reviewed-by: Xin Hao <xhao@linux.alibaba.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
This commit is contained in:
parent
ca074c3cb0
commit
b43ae7ab81
|
@ -281,6 +281,37 @@ static struct acpi_pptt_processor *acpi_find_processor_node(struct acpi_table_he
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* parent_node points into the table, but the table isn't provided. */
|
||||||
|
void acpi_pptt_get_child_cpus(struct acpi_pptt_processor *parent_node, cpumask_t *cpus)
|
||||||
|
{
|
||||||
|
struct acpi_pptt_processor *cpu_node;
|
||||||
|
struct acpi_table_header *table_hdr;
|
||||||
|
acpi_status status;
|
||||||
|
u32 acpi_id;
|
||||||
|
int cpu;
|
||||||
|
|
||||||
|
status = acpi_get_table(ACPI_SIG_PPTT, 0, &table_hdr);
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for_each_possible_cpu(cpu) {
|
||||||
|
acpi_id = get_acpi_id_for_cpu(cpu);
|
||||||
|
cpu_node = acpi_find_processor_node(table_hdr, acpi_id);
|
||||||
|
|
||||||
|
while (cpu_node) {
|
||||||
|
if (cpu_node == parent_node) {
|
||||||
|
cpumask_set_cpu(cpu, cpus);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cpu_node = fetch_pptt_node(table_hdr, cpu_node->parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
acpi_put_table(table_hdr);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* acpi_pptt_for_each_container() - Iterate over all processor containers
|
* acpi_pptt_for_each_container() - Iterate over all processor containers
|
||||||
*
|
*
|
||||||
|
|
|
@ -1364,6 +1364,7 @@ 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);
|
||||||
u32 acpi_pptt_count_containers(void);
|
u32 acpi_pptt_count_containers(void);
|
||||||
int acpi_pptt_for_each_container(acpi_pptt_cpu_callback_t callback, void *arg);
|
int acpi_pptt_for_each_container(acpi_pptt_cpu_callback_t callback, void *arg);
|
||||||
|
void acpi_pptt_get_child_cpus(struct acpi_pptt_processor *parent_node, cpumask_t *cpus);
|
||||||
#else
|
#else
|
||||||
static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
|
static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
|
||||||
{
|
{
|
||||||
|
@ -1394,6 +1395,11 @@ acpi_pptt_for_each_container(acpi_pptt_cpu_callback_t *callback, void *arg)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
static inline void
|
||||||
|
acpi_pptt_get_child_cpus(struct acpi_pptt_processor *parent_node,
|
||||||
|
cpumask_t *cpus)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
|
|
Loading…
Reference in New Issue