[PATCH v4 29/34] x86/amd_nb: Trickle down 'struct cpuinfo_x86' reference
"Ahmed S. Darwish" <[email protected]>
| Newsgroups | dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Prepare cpuid_amd_hygon_has_l3_cache(), which is internally a CPUID(0x80000006) call site, for using the parsed CPUID API instead of invoking direct CPUID queries. Since such an API requires a 'struct cpuinfo_x86' reference, trickle it down from the start of the amd_nb initcall. Note, accessing the CPUID tables at initcall_5 using this_cpu_ptr() should be safe, since the 'struct cpuinfo_x86' per-CPU presentation is finalized at arch/x86/kernel/cpu/common.c :: arch_cpu_finalize_init(). Meanwhile, at kernel init/main.c, do_initcalls() are done much later. Signed-off-by: Ahmed S. Darwish <[email protected]> --- arch/x86/kernel/amd_nb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index c1acead6227a..a8809778b208 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c @@ -16,6 +16,7 @@ #include <asm/amd/nb.h> #include <asm/cpuid/api.h> +#include <asm/processor.h> static u32 *flush_words; @@ -58,7 +59,7 @@ struct amd_northbridge *node_to_amd_nb(int node) } EXPORT_SYMBOL_GPL(node_to_amd_nb); -static int amd_cache_northbridges(void) +static int amd_cache_northbridges(struct cpuinfo_x86 *c) { struct amd_northbridge *nb; u16 i; @@ -315,11 +316,13 @@ static __init void fix_erratum_688(void) static __init int init_amd_nbs(void) { + struct cpuinfo_x86 *c = this_cpu_ptr(&cpu_info); + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) return 0; - amd_cache_northbridges(); + amd_cache_northbridges(c); amd_cache_gart(); fix_erratum_688(); -- 2.50.1