|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 1/5] x86/xen: Fill basic CPUID information early on PV boot
xen_start_kernel() scans the CPUID leaves and calls get_cpu_cap() to
know whether NX is supported, but cpu_detect() is never called before,
so boot_cpu_data.cpuid_level is still 0 at that point. As a result,
get_cpu_cap() skips all the standard leaves (0x1, 0x7, ...) and only
the extended ones are filled (which happens to be enough for NX).
Anything checking a standard leaf feature before early_cpu_init() thus
sees it as missing. E.g. kaslr_get_random_long() concludes that neither
RDRAND nor the TSC is available and falls back to reading the i8254 by
port I/O, which faults in a PV guest that early (no I/O privilege yet).
Call cpu_detect() before get_cpu_cap(), like early_identify_cpu() does,
so that boot_cpu_data reflects the actual CPU features.
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
Assisted-by: LLM
---
CC: Thomas Gleixner <tglx@xxxxxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxxxxx>
CC: Borislav Petkov <bp@xxxxxxxxx>
CC: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
CC: "H. Peter Anvin" <hpa@xxxxxxxxx>
CC: Juergen Gross <jgross@xxxxxxxx>
CC: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
I'm a bit surprised that we still check for TSC in KASLR despite 111cbb4596e3.
---
arch/x86/xen/enlighten_pv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index c5117a7730d6..4a37d493f57c 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1424,6 +1424,7 @@ asmlinkage __visible void __init xen_start_kernel(struct
start_info *si)
/* Work out if we support NX */
cpuid_scan_cpu(&boot_cpu_data);
+ cpu_detect(&boot_cpu_data);
get_cpu_cap(&boot_cpu_data);
x86_configure_nx();
--
2.56.1
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |