[patch 06/11] x86/topology: Provide helper to retrieve number of cpu packages

From: Thomas Gleixner
Date: Wed Feb 17 2016 - 08:52:50 EST


For services which are per package, e.g. intel_uncore, we need to know the
number of possible packages in the system. Provide a helper. Unfortunately a
macro to avoid inclue hell.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/x86/include/asm/topology.h | 3 +++
1 file changed, 3 insertions(+)

--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -127,6 +127,9 @@ extern const struct cpumask *cpu_coregro
#define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
#endif

+#define topology_max_packages() \
+ DIV_ROUND_UP(num_possible_cpus(), boot_cpu_data.x86_max_cores * smp_num_siblings)
+
static inline void arch_fix_phys_package_id(int num, u32 slot)
{
}