git: 2931aabc40ea - stable/15 - KVM: Detect Extended Destination ID support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Apr 2026 15:04:29 UTC
The branch stable/15 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=2931aabc40ea380781f882e0909fed75f8530b64
commit 2931aabc40ea380781f882e0909fed75f8530b64
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-02-22 04:09:00 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-04-16 15:03:59 +0000
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
(cherry picked from commit 9ab5aa3d4c7879d5518afc7587a864ba880e7ee9)
---
sys/x86/include/kvm.h | 1 +
sys/x86/x86/local_apic.c | 11 +++++++++++
2 files changed, 12 insertions(+)
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 cb7b03b313c1..ea5b14d92262 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>
@@ -2076,6 +2077,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;
+ }
}
/*