• Yazen Ghannam's avatar
    x86/cpu/AMD: Clean up cpu_llc_id assignment per topology feature · b6a50cdd
    Yazen Ghannam authored
    These changes do not affect current hw - just a cleanup:
    
    Currently, we assume that a system has a single Last Level Cache (LLC)
    per node, and that the cpu_llc_id is thus equal to the node_id. This no
    longer applies since Fam17h can have multiple last level caches within a
    node.
    
    So group the cpu_llc_id assignment by topology feature and family in
    order to make the computation of cpu_llc_id on the different families
    more clear.
    
    Here is how the LLC ID is being computed on the different families:
    
    The NODEID_MSR feature only applies to Fam10h in which case the LLC is
    at the node level.
    
    The TOPOEXT feature is used on families 15h, 16h and 17h. So far we only
    see multiple last level caches if L3 caches are available. Otherwise,
    the cpu_llc_id will default to be the phys_proc_id.
    
    We have L3 caches only on families 15h and 17h:
    
     - on Fam15h, the LLC is at the node level.
    
     - on Fam17h, the LLC is at the core complex level and can be found by
       right shifting the APIC ID. Also, keep the family checks explicit so that
       new families will fall back to the default, which will be node_id for
       TOPOEXT systems.
    
    Single node systems in families 10h and 15h will have a Node ID of 0
    which will be the same as the phys_proc_id, so we don't need to check
    for multiple nodes before using the node_id.
    Tested-by: default avatarBorislav Petkov <bp@suse.de>
    Signed-off-by: default avatarYazen Ghannam <Yazen.Ghannam@amd.com>
    [ Rewrote the commit message. ]
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: Aravind Gopalakrishnan <aravindksg.lkml@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/20161108153054.bs3sajbyevq6a6uu@pd.tnicSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    b6a50cdd
amd.c 23.8 KB