Skip to content

Commit

Permalink
x86/CPU/AMD: Fix LLC ID bit-shift calculation
Browse files Browse the repository at this point in the history
The current logic incorrectly calculates the LLC ID from the APIC ID.

Unless specified otherwise, the LLC ID should be calculated by removing
the Core and Thread ID bits from the least significant end of the APIC
ID. For more info, see "ApicId Enumeration Requirements" in any Fam17h
PPR document.

[ bp: Improve commit message. ]

Fixes: 68091ee ("Calculate last level cache ID from number of sharing threads")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1528915390-30533-1-git-send-email-suravee.suthikulpanit@amd.com
  • Loading branch information
Suravee Suthikulpanit authored and Thomas Gleixner committed Jun 22, 2018
1 parent 7731b8b commit 964d978
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id)
num_sharing_cache = ((eax >> 14) & 0xfff) + 1;

if (num_sharing_cache) {
int bits = get_count_order(num_sharing_cache) - 1;
int bits = get_count_order(num_sharing_cache);

per_cpu(cpu_llc_id, cpu) = c->apicid >> bits;
}
Expand Down

0 comments on commit 964d978

Please sign in to comment.