Coregroup information is present in the associativity hierarchy when there is an associativity level beyond the primary NUMA domain.
Factor out the check for the presence of the coregroup associativity level into a helper so that it can be reused when determining coregroup availability. No functional change intended. Signed-off-by: Srikar Dronamraju <[email protected]> --- arch/powerpc/mm/numa.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index df3b51a1beb4..7cb37cb0c5db 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -889,6 +889,16 @@ static int __init numa_setup_drmem_lmb(struct drmem_lmb *lmb, return 0; } +/* + * Coregroup info is present in associativity property just after + * primary_domain_index. In dedicated LPARs, coregroup info is present only + * if primary_domain_index is third from the last or earlier. + */ +static bool has_coregroup_level(int index) +{ + return index > primary_domain_index + 1; +} + /* * If hierarchy extends beyond primary_domain_index + 1, then next * level corresponds to coregroup. @@ -899,8 +909,7 @@ static int detect_and_enable_coregroup(const __be32 *associativity, int index) goto out; index = of_read_number(associativity, 1); - - if (index > primary_domain_index + 1) { + if (has_coregroup_level(index)) { coregroup_enabled = 1; return index; } -- 2.47.1
