Deine cpu_coregroup_mask() to export the per-cpu cpu_corgrp_map when
coregroups are supported(). When has_coregroup_support() returns false,
cpu_coregroup_mask() returns the mask used by the PKG domain.

Since this will only be used after CONFIG_SCHED_MC is added for PowerPC,
no functional changes are intended at this point.

Signed-off-by: K Prateek Nayak <kprateek.na...@amd.com>
---
 arch/powerpc/include/asm/smp.h | 2 ++
 arch/powerpc/kernel/smp.c      | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index b77927ccb0ab..86de4d0dd0aa 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -148,6 +148,8 @@ static inline const struct cpumask *cpu_smt_mask(int cpu)
 }
 #endif /* CONFIG_SCHED_SMT */
 
+extern const struct cpumask *cpu_coregroup_mask(int cpu);
+
 /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
  *
  * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 4f48262658cc..e623f2864dc4 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1059,6 +1059,14 @@ static bool has_coregroup_support(void)
        return coregroup_enabled;
 }
 
+const struct cpumask *cpu_coregroup_mask(int cpu)
+{
+       if (has_coregroup_support())
+               return per_cpu(cpu_corgrp_map, cpu);
+
+       return cpu_node_mask(cpu);
+}
+
 static const struct cpumask *cpu_mc_mask(struct sched_domain_topology_level 
*tl, int cpu)
 {
        return cpu_corgrp_mask(cpu);
-- 
2.34.1


Reply via email to