aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2026-02-22 04:09:00 +0000
committerColin Percival <cperciva@FreeBSD.org>2026-03-28 05:54:35 +0000
commit9ab5aa3d4c7879d5518afc7587a864ba880e7ee9 (patch)
treeaf60cd8a9bcab6bac2f5a5665ee8740b5aa74489
parentb0e1b1069d655f12ab69cf3a1dc1904dd35ad1da (diff)
KVM: Detect Extended Destination ID support
KVM advertises support for the Extended Destination ID standard via bit 15 of the value returned in the EAX register when KVM features are queried via CPUID. Tested on: EC2 r8i.96xlarge MFC after: 3 weeks Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D55427
-rw-r--r--sys/x86/include/kvm.h1
-rw-r--r--sys/x86/x86/local_apic.c11
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/x86/include/kvm.h b/sys/x86/include/kvm.h
index fef26bde226a..83dd20fa8d23 100644
--- a/sys/x86/include/kvm.h
+++ b/sys/x86/include/kvm.h
@@ -49,6 +49,7 @@
#define KVM_FEATURE_CLOCKSOURCE 0x00000001
#define KVM_FEATURE_CLOCKSOURCE2 0x00000008
+#define KVM_FEATURE_MSI_EXT_DEST_ID 0x00008000
#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 0x01000000
/* Deprecated: for the CLOCKSOURCE feature. */
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 21934b41ea62..fb3b93e4164f 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -72,6 +72,7 @@
#include <machine/smp.h>
#include <machine/specialreg.h>
#include <x86/init.h>
+#include <x86/kvm.h>
#ifdef DDB
#include <sys/interrupt.h>
@@ -2095,6 +2096,16 @@ SYSCTL_INT(_machdep, OID_AUTO, apic_ext_dest_id, CTLFLAG_RDTUN, &apic_ext_dest_i
static void
detect_extended_dest_id(void)
{
+ u_int regs[4];
+
+ /* Check if we support extended destination IDs. */
+ switch (vm_guest) {
+ case VM_GUEST_KVM:
+ kvm_cpuid_get_features(regs);
+ if (regs[0] & KVM_FEATURE_MSI_EXT_DEST_ID)
+ apic_ext_dest_id = 1;
+ break;
+ }
}
/*