aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2026-02-22 04:08:59 +0000
committerColin Percival <cperciva@FreeBSD.org>2026-03-28 05:54:17 +0000
commit02f29c1324cf5193c3aec181cb409917b541f7fe (patch)
treed5f24fb0b3011fe9fa65ccb5e1ad593f7afd1755
parentd9db6d759dfcf4a4559e66e777599bb3fa8ca14c (diff)
-rw-r--r--sys/x86/x86/msi.c11
1 files 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;
}