git: 17802b56ecb9 - stable/14 - amd64/vmm: Don't advertise AMD PerfMonV2 or performance counters
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Nov 2026 08:05:47 UTC
The branch stable/14 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=17802b56ecb9b1ff53f3a446d6f0a2b7f845a784
commit 17802b56ecb9b1ff53f3a446d6f0a2b7f845a784
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-02 17:15:33 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-13 08:05:26 +0000
amd64/vmm: Don't advertise AMD PerfMonV2 or performance counters
vmm does not handle CPUID leaf 0x80000022, so a FreeBSD guest on a
Family 19h or later host panics on "kldload hwpmc", which trusts the
PerfMonV2 bit and writes AMD_PMC_GLOBAL_CTL.
Tested by: Osvaldo Janeri Filho <ojanerif@amd.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Reviewed by: markj, kib
Differential Revision: https://reviews.freebsd.org/D61141
(cherry picked from commit 8fb539b081dbfe3e93e607a5d4d36184c53c8aaf)
---
sys/amd64/vmm/x86.c | 11 +++++++++++
sys/amd64/vmm/x86.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index ee07842a20c8..6065b1148785 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -300,6 +300,17 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax, uint64_t *rbx,
regs[3] = 0;
break;
+ case CPUID_8000_0022:
+ /*
+ * AMD uses this leaf to advertise performance
+ * counters and PerfMonV2. vmm implements neither.
+ */
+ regs[0] = 0;
+ regs[1] = 0;
+ regs[2] = 0;
+ regs[3] = 0;
+ break;
+
case CPUID_0000_0001:
do_cpuid(1, regs);
diff --git a/sys/amd64/vmm/x86.h b/sys/amd64/vmm/x86.h
index 56364f4f5cb4..9210e7abe1a3 100644
--- a/sys/amd64/vmm/x86.h
+++ b/sys/amd64/vmm/x86.h
@@ -52,6 +52,7 @@
#define CPUID_8000_0008 (0x80000008)
#define CPUID_8000_001D (0x8000001D)
#define CPUID_8000_001E (0x8000001E)
+#define CPUID_8000_0022 (0x80000022)
/*
* CPUID instruction Fn0000_0001: