On newer Ryzen/EPYC, we need to hide the HwPstate CPUID
80000007:EDX
field for HwPstate, or guests will try to access the MSRs associated
with those, and that will fail with #GP.
ok deraadt
-/* $OpenBSD: identcpu.c,v 1.137 2023/08/16 04:07:37 jsg Exp $ */
+/* $OpenBSD: identcpu.c,v 1.138 2023/09/03 09:30:43 mlarkin Exp $ */
/* $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*
}, cpu_cpuid_perf_eax[] = {
{ CPUIDEAX_VERID, "PERF" },
}, cpu_cpuid_apmi_edx[] = {
+ { CPUIDEDX_HWPSTATE, "HWPSTATE" },
{ CPUIDEDX_ITSC, "ITSC" },
}, cpu_amdspec_ebxfeatures[] = {
{ CPUIDEBX_INVLPGB, "INVLPGB" },
-/* $OpenBSD: vmm_machdep.c,v 1.5 2023/08/15 08:27:29 miod Exp $ */
+/* $OpenBSD: vmm_machdep.c,v 1.6 2023/09/03 09:30:43 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
*rax = eax;
*rbx = ebx;
*rcx = ecx;
- *rdx = edx;
+ *rdx = edx & VMM_APMI_EDX_MASK;
break;
case 0x80000008: /* Phys bits info and topology (AMD) */
*rax = eax;
-/* $OpenBSD: specialreg.h,v 1.108 2023/08/16 04:07:37 jsg Exp $ */
+/* $OpenBSD: specialreg.h,v 1.109 2023/09/03 09:30:43 mlarkin Exp $ */
/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */
/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */
* "Advanced Power Management Information" bits (CPUID function 0x80000007):
* EDX bits.
*/
+#define CPUIDEDX_HWPSTATE (1 << 7) /* Hardware P State Control */
#define CPUIDEDX_ITSC (1 << 8) /* Invariant TSC */
/*
-/* $OpenBSD: vmmvar.h,v 1.91 2023/04/26 15:11:21 mlarkin Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.92 2023/09/03 09:30:43 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
CPUIDEBX_STIBP | CPUIDEBX_IBRS_ALWAYSON | CPUIDEBX_STIBP_ALWAYSON | \
CPUIDEBX_IBRS_PREF | CPUIDEBX_SSBD | CPUIDEBX_VIRT_SSBD | \
CPUIDEBX_SSBD_NOTREQ)
+#define VMM_APMI_EDX_MASK ~(CPUIDEDX_HWPSTATE)
/*
* SEFF flags - copy from host minus: