--- zzzz-none-000/linux-5.4.213/drivers/pci/msi.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/drivers/pci/msi.c 2024-05-29 11:19:59.000000000 +0000 @@ -1116,14 +1116,17 @@ if (WARN_ON_ONCE(dev->msi_enabled)) return -EINVAL; - nvec = pci_msi_vec_count(dev); - if (nvec < 0) - return nvec; - if (nvec < minvec) - return -ENOSPC; - - if (nvec > maxvec) + if (maxvec > 32 && maxvec <= 128) { nvec = maxvec; + } else { + nvec = pci_msi_vec_count(dev); + if (nvec < 0) + return nvec; + if (nvec < minvec) + return -ENOSPC; + if (nvec > maxvec) + nvec = maxvec; + } for (;;) { if (affd) {