git: 02f29c1324cf - main - msi: Support APIC Extended Destination IDs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Mar 2026 05:56:29 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=02f29c1324cf5193c3aec181cb409917b541f7fe
commit 02f29c1324cf5193c3aec181cb409917b541f7fe
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-02-22 04:08:59 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-03-28 05:54:17 +0000
msi: Support APIC Extended Destination IDs
If APIC Extended Destination ID support is enabled, use it in MSIs by
allowing APIC IDs up to 2^15 - 1 and encoding the high bits into
Intel "reserved" bits per the standard.
Tested on: EC2 r8i.96xlarge
MFC after: 3 weeks
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D55426
---
sys/x86/x86/msi.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sys/x86/x86/msi.c b/sys/x86/x86/msi.c
index b38247bf6e45..9d5409015de7 100644
--- a/sys/x86/x86/msi.c
+++ b/sys/x86/x86/msi.c
@@ -92,6 +92,10 @@
#define INTEL_ADDR(msi) \
(MSI_INTEL_ADDR_BASE | (msi)->msi_cpu << 12 | \
MSI_INTEL_ADDR_RH_OFF | MSI_INTEL_ADDR_DM_PHYSICAL)
+#define INTEL_ADDR_EXT(msi) \
+ (MSI_INTEL_ADDR_BASE | ((msi)->msi_cpu & 0xff) << 12 | \
+ ((msi)->msi_cpu & 0x7f00) >> 3 | \
+ MSI_INTEL_ADDR_RH_OFF | MSI_INTEL_ADDR_DM_PHYSICAL)
#define INTEL_DATA(msi) \
(MSI_INTEL_DATA_TRGREDG | MSI_INTEL_DATA_DELFIXED | (msi)->msi_vector)
@@ -652,13 +656,16 @@ msi_map(int irq, uint64_t *addr, uint32_t *data)
mtx_unlock(&msi_lock);
error = EOPNOTSUPP;
#endif
- if (error == EOPNOTSUPP && msi->msi_cpu > 0xff) {
+ if (error == EOPNOTSUPP &&
+ (msi->msi_cpu > 0x7fff ||
+ (msi->msi_cpu > 0xff && apic_ext_dest_id != 1))) {
printf("%s: unsupported destination APIC ID %u\n", __func__,
msi->msi_cpu);
error = EINVAL;
}
if (error == EOPNOTSUPP) {
- *addr = INTEL_ADDR(msi);
+ *addr = (apic_ext_dest_id == 1) ?
+ INTEL_ADDR_EXT(msi) : INTEL_ADDR(msi);
*data = INTEL_DATA(msi);
error = 0;
}