ACPI / PPTT: Add a helper to fill a cpumask from a processor container
ANBZ: #1644 cherry-picked from https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git The ACPI table for MPAM describes a set of CPUs with the UID of a processor container. These exist both in the namespace and the PPTT. Using the existing for-each helpers, provide a helper to find the specified processor container in the PPTT, and fill a cpumask with the CPUs that belong to it. 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
c26f26205c
commit
49e15ee7cb
|
@ -388,6 +388,41 @@ u32 acpi_pptt_count_containers(void)
|
|||
return count;
|
||||
}
|
||||
|
||||
struct __cpus_from_container_arg {
|
||||
u32 acpi_cpu_id;
|
||||
cpumask_t *cpus;
|
||||
};
|
||||
|
||||
static int __cpus_from_container(struct acpi_pptt_processor *container, void *arg)
|
||||
{
|
||||
struct __cpus_from_container_arg *params = arg;
|
||||
|
||||
if (container->acpi_processor_id == params->acpi_cpu_id)
|
||||
acpi_pptt_get_child_cpus(container, params->cpus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* acpi_pptt_get_cpus_from_container() - Populate a cpumask with all CPUs in a
|
||||
* processor containers
|
||||
*
|
||||
* Find the specified Processor Container, and fill cpus with all the cpus
|
||||
* below it.
|
||||
*
|
||||
* Return: 0 for a complete walk, or an error if the mask is incomplete.
|
||||
*/
|
||||
int acpi_pptt_get_cpus_from_container(u32 acpi_cpu_id, cpumask_t *cpus)
|
||||
{
|
||||
struct __cpus_from_container_arg params;
|
||||
|
||||
params.acpi_cpu_id = acpi_cpu_id;
|
||||
params.cpus = cpus;
|
||||
|
||||
cpumask_clear(cpus);
|
||||
return acpi_pptt_for_each_container(&__cpus_from_container, ¶ms);
|
||||
}
|
||||
|
||||
/*
|
||||
* acpi_pptt_find_cache_backwards() - Given a PPTT cache find a processor node
|
||||
* that points to it. This lets us find a cacheinfo node by fw_token, but
|
||||
|
|
|
@ -1366,6 +1366,7 @@ int find_acpi_cache_level_from_id(u32 cache_id);
|
|||
u32 acpi_pptt_count_containers(void);
|
||||
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);
|
||||
int acpi_pptt_get_cpus_from_container(u32 acpi_cpu_id, cpumask_t *cpus);
|
||||
#else
|
||||
static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
|
||||
{
|
||||
|
@ -1405,6 +1406,11 @@ acpi_pptt_get_child_cpus(struct acpi_pptt_processor *parent_node,
|
|||
cpumask_t *cpus)
|
||||
{
|
||||
}
|
||||
static inline int acpi_pptt_get_cpus_from_container(u32 acpi_cpu_id,
|
||||
cpumask_t *cpus)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
|
Loading…
Reference in New Issue