git: 3007e4a7dd49 - stable/14 - msi: Support APIC Extended Destination IDs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Apr 2026 15:12:21 UTC
The branch stable/14 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=3007e4a7dd495151df4ef87792f51572cbb52c6b
commit 3007e4a7dd495151df4ef87792f51572cbb52c6b
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-02-22 04:08:59 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-04-16 15:11:54 +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
(cherry picked from commit 02f29c1324cf5193c3aec181cb409917b541f7fe)
---
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 9d5a51f9753c..9ecdfca3e01b 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)
@@ -644,13 +648,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;
}