git: 9ab5aa3d4c78 - main - KVM: Detect Extended Destination ID support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Mar 2026 05:56:32 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=9ab5aa3d4c7879d5518afc7587a864ba880e7ee9
commit 9ab5aa3d4c7879d5518afc7587a864ba880e7ee9
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-02-22 04:09:00 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-03-28 05:54:35 +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
---
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 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;
+ }
}
/*