This patch should make it to 4.18, as it prevents random crashes on AMD Zen4 running outdated microcode.
Under certain conditions Zen4 may corrupt its own code stream when SMT is enabled and STIBP is not. The Linux thread in which this was highlighted is in patch2's commit message. NOTE: Still running in CI as of now, but tested locally. Pipeline here. https://gitlab.com/xen-project/people/agvallejo/xen/-/pipelines/1034895039 Patch 1: is just a minor refactor to ensure we don't get microarchitectures of different families mixed up now that we have 3 different families involved (Fam17h, Fam18h and Fam19h) Patch 2: The actual fix. It involves setting a bit in an MSR if it's a non virtualized zen4. It's not a direct copy of the Linux patch, as we have started using macros to find out microarchitectures from CPUID bits, rather than relying on models. Alejandro Vallejo (2): xen/x86: Add family guards to the is_zen[12]_uarch() macros x86/amd: Prevent potentially fetching wrong instruction bytes on Zen4 xen/arch/x86/cpu/amd.c | 16 +++++++++++++--- xen/arch/x86/include/asm/amd.h | 17 +++++++++++++---- xen/arch/x86/include/asm/msr-index.h | 2 ++ xen/arch/x86/spec_ctrl.c | 3 --- 4 files changed, 28 insertions(+), 10 deletions(-) -- 2.34.1