Skip to content

Commit ae8373a

Browse files
committed
Merge tag 'x86_urgent_for_6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fix from Dave Hansen: "This works around and issue where the INVLPG instruction may miss invalidating kernel TLB entries in recent hybrid CPUs. I do expect an eventual microcode fix for this. When the microcode version numbers are known, we can circle back around and add them the model table to disable this workaround" * tag 'x86_urgent_for_6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mm: Avoid incomplete Global INVLPG flushes
2 parents 1177dcc + ce0b15d commit ae8373a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

arch/x86/mm/init.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/sched/task.h>
1010

1111
#include <asm/set_memory.h>
12+
#include <asm/cpu_device_id.h>
1213
#include <asm/e820/api.h>
1314
#include <asm/init.h>
1415
#include <asm/page.h>
@@ -261,6 +262,24 @@ static void __init probe_page_size_mask(void)
261262
}
262263
}
263264

265+
#define INTEL_MATCH(_model) { .vendor = X86_VENDOR_INTEL, \
266+
.family = 6, \
267+
.model = _model, \
268+
}
269+
/*
270+
* INVLPG may not properly flush Global entries
271+
* on these CPUs when PCIDs are enabled.
272+
*/
273+
static const struct x86_cpu_id invlpg_miss_ids[] = {
274+
INTEL_MATCH(INTEL_FAM6_ALDERLAKE ),
275+
INTEL_MATCH(INTEL_FAM6_ALDERLAKE_L ),
276+
INTEL_MATCH(INTEL_FAM6_ALDERLAKE_N ),
277+
INTEL_MATCH(INTEL_FAM6_RAPTORLAKE ),
278+
INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_P),
279+
INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_S),
280+
{}
281+
};
282+
264283
static void setup_pcid(void)
265284
{
266285
if (!IS_ENABLED(CONFIG_X86_64))
@@ -269,6 +288,12 @@ static void setup_pcid(void)
269288
if (!boot_cpu_has(X86_FEATURE_PCID))
270289
return;
271290

291+
if (x86_match_cpu(invlpg_miss_ids)) {
292+
pr_info("Incomplete global flushes, disabling PCID");
293+
setup_clear_cpu_cap(X86_FEATURE_PCID);
294+
return;
295+
}
296+
272297
if (boot_cpu_has(X86_FEATURE_PGE)) {
273298
/*
274299
* This can't be cr4_set_bits_and_update_boot() -- the

0 commit comments

Comments
 (0)