diff options
author | Ed Maste <emaste@FreeBSD.org> | 2023-08-08 23:42:09 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2023-08-09 17:52:43 +0000 |
commit | cbf845052f1c2862a64e66dbaf38e887a7592474 (patch) | |
tree | 6e4f6ebf92bee9105d6f9610b5c70bdb4a06ec6f | |
parent | 13da84237a37961938e9e237171ac111ddc1897c (diff) | |
download | src-cbf845052f1c2862a64e66dbaf38e887a7592474.tar.gz src-cbf845052f1c2862a64e66dbaf38e887a7592474.zip |
msi: report error for attempt to use APIC ID > 255
The MSI/MSI-X address includes 8 bits to encode the Destination ID.
Previously IDs over 255 overlapped with the fixed portion of the
address, resulting in an invalid value (and a nonfunctional interrupt).
Instead, print an error message and return EINVAL. The interrupt will
still not work, but the user will have a clue as to why.
PR: 273022
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41395
-rw-r--r-- | sys/x86/x86/msi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/x86/x86/msi.c b/sys/x86/x86/msi.c index f85d4a5161e5..de8f42c0fa68 100644 --- a/sys/x86/x86/msi.c +++ b/sys/x86/x86/msi.c @@ -620,6 +620,11 @@ msi_map(int irq, uint64_t *addr, uint32_t *data) mtx_unlock(&msi_lock); error = EOPNOTSUPP; #endif + if (error == EOPNOTSUPP && msi->msi_cpu > 0xff) { + printf("%s: unsupported destination APIC ID %u\n", __func__, + msi->msi_cpu); + error = EINVAL; + } if (error == EOPNOTSUPP) { *addr = INTEL_ADDR(msi); *data = INTEL_DATA(msi); |