Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f009d85 authored by Sultan Alsawaf's avatar Sultan Alsawaf Committed by Akshay Kakatkar
Browse files

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: default avatarSultan Alsawaf <sultan@kerneltoast.com>
[kdrag0n: Forward-ported to k4.19]
Signed-off-by: default avatarDanny Lin <danny@kdrag0n.dev>
parent cfeb0ee7
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -786,6 +786,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
+6 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ extern unsigned 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.
 *
@@ -92,11 +94,15 @@ extern struct cpumask __cpu_online_mask;
extern struct cpumask __cpu_present_mask;
extern struct cpumask __cpu_active_mask;
extern struct cpumask __cpu_isolated_mask;
extern struct cpumask __cpu_lp_mask;
extern struct cpumask __cpu_perf_mask;
#define cpu_possible_mask ((const struct cpumask *)&__cpu_possible_mask)
#define cpu_online_mask   ((const struct cpumask *)&__cpu_online_mask)
#define cpu_present_mask  ((const struct cpumask *)&__cpu_present_mask)
#define cpu_active_mask   ((const struct cpumask *)&__cpu_active_mask)
#define cpu_isolated_mask ((const struct cpumask *)&__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)
+16 −0
Original line number Diff line number Diff line
@@ -2330,6 +2330,22 @@ EXPORT_SYMBOL(__cpu_active_mask);
struct cpumask __cpu_isolated_mask __read_mostly;
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 init_cpu_present(const struct cpumask *src)
{
	cpumask_copy(&__cpu_present_mask, src);