git: 7b6be0014a4e - main - Hyper-V: Detect Extended Destination ID support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Mar 2026 05:56:37 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=7b6be0014a4eb81943491122bae70914b7fd82b6
commit 7b6be0014a4eb81943491122bae70914b7fd82b6
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-02-22 04:09:01 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-03-28 05:54:59 +0000
Hyper-V: Detect Extended Destination ID support
Hyper-V advertises support for the Extended Destination ID standard via
bit 2 of the value returned in the EAX register when the hypervisor
stack properties are queried via CPUID.
This is based on a commit to the Linux kernel, as there does not seem
to be any other documentation of this feature.
Reviewed by: Souradeep Chakrabarti
MFC after: 3 weeks
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D55432
---
sys/dev/hyperv/vmbus/x86/hyperv_reg.h | 6 ++++++
sys/x86/x86/local_apic.c | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/sys/dev/hyperv/vmbus/x86/hyperv_reg.h b/sys/dev/hyperv/vmbus/x86/hyperv_reg.h
index 0597a1fea953..e7560d00f25e 100644
--- a/sys/dev/hyperv/vmbus/x86/hyperv_reg.h
+++ b/sys/dev/hyperv/vmbus/x86/hyperv_reg.h
@@ -45,4 +45,10 @@
#define CPUID_LEAF_HV_IDENTITY 0x40000002
#define CPUID_LEAF_HV_FEATURES 0x40000003
#define CPUID_LEAF_HV_RECOMMENDS 0x40000004
+
+#define CPUID_LEAF_HV_STACK_INTERFACE 0x40000081
+#define HYPERV_STACK_INTERFACE_EAX_SIG 0x31235356 /* "VS#1" */
+#define CPUID_LEAF_HV_STACK_PROPERTIES 0x40000082
+#define HYPERV_PROPERTIES_EXT_DEST_ID 0x00000004
+
#endif /* !_HYPERV_REG_H_ */
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 20f095a13574..cd5e4d474080 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -75,6 +75,7 @@
#include <x86/kvm.h>
#include <contrib/xen/arch-x86/cpuid.h>
#include <x86/bhyve.h>
+#include <dev/hyperv/vmbus/x86/hyperv_reg.h>
#ifdef DDB
#include <sys/interrupt.h>
@@ -2107,6 +2108,14 @@ detect_extended_dest_id(void)
if (regs[0] & XEN_HVM_CPUID_EXT_DEST_ID)
apic_ext_dest_id = 1;
break;
+ case VM_GUEST_HV:
+ cpuid_count(CPUID_LEAF_HV_STACK_INTERFACE, 0, regs);
+ if (regs[0] != HYPERV_STACK_INTERFACE_EAX_SIG)
+ break;
+ cpuid_count(CPUID_LEAF_HV_STACK_PROPERTIES, 0, regs);
+ if (regs[0] & HYPERV_PROPERTIES_EXT_DEST_ID)
+ apic_ext_dest_id = 1;
+ break;
case VM_GUEST_KVM:
kvm_cpuid_get_features(regs);
if (regs[0] & KVM_FEATURE_MSI_EXT_DEST_ID)