From 8df652f368a190ef9d7457309c52614bf5e93a13 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Sun, 14 Apr 2019 20:19:37 -0700 Subject: [PATCH] cpumask: Add cpumasks for big and LITTLE CPU clusters Add cpu_lp_mask and cpu_perf_mask to represent the CPUs that belong to each cluster in a dual-cluster, heterogeneous system. Signed-off-by: Sultan Alsawaf --- arch/arm64/Kconfig | 14 ++++++++++++++ include/linux/cpumask.h | 4 ++++ kernel/cpu.c | 16 ++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index ec6a6c058c7b..cf1832ff70bc 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -683,6 +683,20 @@ config NR_CPUS # These have to remain sorted largest to smallest default "64" +config LITTLE_CPU_MASK + int "Bitmask of available LITTLE CPUs" + help + This is a bitmask specifying which of the CPUs are LITTLE in a + heterogeneous system. Use 0 if you are unsure, which just results in + this storing the bitmask of all available CPUs. + +config BIG_CPU_MASK + int "Bitmask of available big CPUs" + help + This is a bitmask specifying which of the CPUs are big in a + heterogeneous system. Use 0 if you are unsure, which just results in + this storing the bitmask of all available CPUs. + config HOTPLUG_CPU bool "Support for hot-pluggable CPUs" select GENERIC_IRQ_MIGRATION diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index e0bfecde4e7b..322be3ee6d1d 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -54,6 +54,8 @@ extern int nr_cpu_ids; * cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler * cpu_active_mask - has bit 'cpu' set iff cpu available to migration * cpu_isolated_mask- has bit 'cpu' set iff cpu isolated + * cpu_lp_mask - has bit 'cpu' set iff cpu is part of little cluster + * cpu_perf_mask - has bit 'cpu' set iff cpu is part of big cluster * * If !CONFIG_HOTPLUG_CPU, present == possible, and active == online. * @@ -91,6 +93,8 @@ extern const struct cpumask *const cpu_online_mask; extern const struct cpumask *const cpu_present_mask; extern const struct cpumask *const cpu_active_mask; extern const struct cpumask *const cpu_isolated_mask; +extern const struct cpumask *const cpu_lp_mask; +extern const struct cpumask *const cpu_perf_mask; #if NR_CPUS > 1 #define num_online_cpus() cpumask_weight(cpu_online_mask) diff --git a/kernel/cpu.c b/kernel/cpu.c index 223f8f208df1..f7f441be4bed 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -857,6 +857,22 @@ static DECLARE_BITMAP(cpu_isolated_bits, CONFIG_NR_CPUS) __read_mostly; const struct cpumask *const cpu_isolated_mask = to_cpumask(cpu_isolated_bits); EXPORT_SYMBOL(cpu_isolated_mask); +#if CONFIG_LITTLE_CPU_MASK +static const unsigned long lp_cpu_bits = CONFIG_LITTLE_CPU_MASK; +const struct cpumask *const cpu_lp_mask = to_cpumask(&lp_cpu_bits); +#else +const struct cpumask *const cpu_lp_mask = cpu_possible_mask; +#endif +EXPORT_SYMBOL(cpu_lp_mask); + +#if CONFIG_BIG_CPU_MASK +static const unsigned long perf_cpu_bits = CONFIG_BIG_CPU_MASK; +const struct cpumask *const cpu_perf_mask = to_cpumask(&perf_cpu_bits); +#else +const struct cpumask *const cpu_perf_mask = cpu_possible_mask; +#endif +EXPORT_SYMBOL(cpu_perf_mask); + void set_cpu_possible(unsigned int cpu, bool possible) { if (possible) -- 2.11.0