git: 020a2480f553 - stable/14 - bhyve: Add CPUID_BHYVE_FEATURES leaf
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Apr 2026 15:12:14 UTC
The branch stable/14 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=020a2480f55303f757e9683d05213ae3266e7831
commit 020a2480f55303f757e9683d05213ae3266e7831
Author: David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: 2025-08-11 10:44:05 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-04-16 15:11:41 +0000
bhyve: Add CPUID_BHYVE_FEATURES leaf
This allows the hypervisor to advertise features to the guest. The first
such feature is CPUID_BHYVE_EXT_DEST_ID which advertises that 15 bits
of target APIC ID are available in MSI (and I/O APIC) interrupts, as
documented in http://david.woodhou.se/ExtDestId.pdf
This defines the guest ABI. The actual implementation will come in a
subsequent commit.
Reviewed by: kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1797
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
(cherry picked from commit 313a68ea20b48629f655cf38987f4a6ff822f1ab)
---
sys/amd64/vmm/x86.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index 744e2bfd57db..eea334562784 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -49,7 +49,12 @@ SYSCTL_DECL(_hw_vmm);
static SYSCTL_NODE(_hw_vmm, OID_AUTO, topology, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
NULL);
-#define CPUID_VM_HIGH 0x40000000
+#define CPUID_VM_SIGNATURE 0x40000000
+#define CPUID_BHYVE_FEATURES 0x40000001
+#define CPUID_VM_HIGH CPUID_BHYVE_FEATURES
+
+/* Features advertised in CPUID_BHYVE_FEATURES %eax */
+#define CPUID_BHYVE_FEAT_EXT_DEST_ID (1UL << 0) /* MSI Extended Dest ID */
static const char bhyve_id[12] = "bhyve bhyve ";
@@ -102,7 +107,7 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax, uint64_t *rbx,
if (cpu_exthigh != 0 && func >= 0x80000000) {
if (func > cpu_exthigh)
func = cpu_exthigh;
- } else if (func >= 0x40000000) {
+ } else if (func >= CPUID_VM_SIGNATURE) {
if (func > CPUID_VM_HIGH)
func = CPUID_VM_HIGH;
} else if (func > cpu_high) {
@@ -603,13 +608,20 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax, uint64_t *rbx,
regs[3] = 0;
break;
- case 0x40000000:
+ case CPUID_VM_SIGNATURE:
regs[0] = CPUID_VM_HIGH;
bcopy(bhyve_id, ®s[1], 4);
bcopy(bhyve_id + 4, ®s[2], 4);
bcopy(bhyve_id + 8, ®s[3], 4);
break;
+ case CPUID_BHYVE_FEATURES:
+ regs[0] = 0; /* No features to advertise yet */
+ regs[1] = 0;
+ regs[2] = 0;
+ regs[3] = 0;
+ break;
+
default:
default_leaf:
/*