From nobody Fri Apr 3 17:32:20 2026 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B60DD373BFB; Tue, 24 Mar 2026 01:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774316887; cv=none; b=Aaujli3m7x5WgZXwyAre2iqhIsis6ARjgx0f3kjAziawH8cxArdWSowzYzf+84b+GYkO9EWFwAlvhHNceO5IxfC1Ky9KZQhPvwIB7r2DgYGtgB7NliDHqnzGjcVSjafR1ttK8NtpHP06+tOgfMiy3xX1JvHiGTL+t0Q+unWmyVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774316887; c=relaxed/simple; bh=JktCjhFZabcsLjdKweCP0Vqn7bSOAUd96mfgnRMpwGQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NogSTep2fmN9mArtHnmll9Ponp1FTpwUz9q+FTwBkRRAthxzgL+VcnmpPwYu48umVbBCYb40CTB+VD0ejI6npTVa4I3ZbwwX501G/DXGGrb7rpULLfrAqWzYcGRsLEYLTZEJ2NaXRRIbtrQt1h5/SKhxqMIUVHaEQVF6x7eJ6BY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=ehAkL+ZL; arc=none smtp.client-ip=115.124.30.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="ehAkL+ZL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1774316883; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=+0ljYcayl6sv7PogxsQyaUadtMcWIj5HBduWRDMwPFg=; b=ehAkL+ZLOxMOahhXnlKdkr++eYRhuzb5oWIARv6gkcRx+DoHM8qoUQF8fYym+UQSIpjAkdhi9c0kHSqVUm6Qy8YXs9WVVUDeCgZiRsTmqwoh0EmEVtAouCximV7bFDohU59TnFUi74HwGfDwc3uQEz5tHJem61vIGziJtoRqPvQ= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R751e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045133197;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0X.cs3UD_1774316878; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0X.cs3UD_1774316878 cluster:ay36) by smtp.aliyun-inc.com; Tue, 24 Mar 2026 09:48:03 +0800 From: Guixin Liu To: Bjorn Helgaas , Thomas Gleixner , Lorenzo Pieralisi , Marc Zyngier , Jonathan Cameron , Inochi Amaoto , Nam Cao , Shradha Gupta , Randy Dunlap Cc: Xunlei Pang , oliver.yang@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH 1/2] genirq/msi: Introduce update hwsize helper Date: Tue, 24 Mar 2026 09:47:53 +0800 Message-Id: <20260324014754.4973-2-kanie@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f In-Reply-To: <20260324014754.4973-1-kanie@linux.alibaba.com> References: <20260324014754.4973-1-kanie@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce msi_domain_update_hwsize() helper for updating hwsize. Signed-off-by: Guixin Liu Reviewed-by: Guanghui Feng --- include/linux/msi.h | 3 +++ kernel/irq/msi.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/linux/msi.h b/include/linux/msi.h index fa41eed62868..6de938ba2245 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -647,6 +647,9 @@ bool msi_create_device_irq_domain(struct device *dev, u= nsigned int domid, void *chip_data); void msi_remove_device_irq_domain(struct device *dev, unsigned int domid); =20 +int msi_domain_update_hwsize(struct device *dev, unsigned int domid, + unsigned int hwsize_new); + bool msi_match_device_irq_domain(struct device *dev, unsigned int domid, enum irq_domain_bus_token bus_token); =20 diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 3cafa40e6ce3..162e7263ef7f 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -1133,6 +1133,28 @@ void msi_remove_device_irq_domain(struct device *dev= , unsigned int domid) kfree(container_of(info, struct msi_domain_template, info)); } =20 +int msi_domain_update_hwsize(struct device *dev, unsigned int domid, + unsigned int hwsize_new) +{ + struct msi_domain_info *info; + struct irq_domain *domain; + + if (hwsize_new > MSI_XA_DOMAIN_SIZE) + return -EINVAL; + if (!hwsize_new) + hwsize_new =3D MSI_XA_DOMAIN_SIZE; + + domain =3D msi_get_device_domain(dev, domid); + if (!domain) + return -ENODEV; + + info =3D domain->host_data; + if (hwsize_new !=3D info->hwsize) + info->hwsize =3D hwsize_new; + + return 0; +} + /** * msi_match_device_irq_domain - Match a device irq domain against a bus t= oken * @dev: Pointer to the device --=20 2.32.0.3.g01195cf9f From nobody Fri Apr 3 17:32:20 2026 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A8E6373BFB; Tue, 24 Mar 2026 01:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.118 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774316892; cv=none; b=szjI79Wzdrjq3cUk52oth4a1oqW7WKvETXe+nWc8DRLYVWqBmHLQtjtDWlD9kVVGbsE2MD95HS73Eq/AQaR4YLIT7+zyThqSMLAR/37axIxVS5E07YiQge4T0EPhQ/sPNf5G99Fz2Ew9HIukT1Sa0mSsrgOcrefjxFfTrWAB2wY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774316892; c=relaxed/simple; bh=qvS8/bf1yAGUwyuLbWJU61DbVJ05PWk7sDR3i+CJSJA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L8vhUfjG+FT7QD3+FHf2dqFxmlnh+rk3TSqEqguWX9T5MTD0FH59gj6TC3esVFIVg6aldMIJ+gMfCa5s7C1hdQYVqmHxSIjaMuCEcBZIvtUgQ3W7bLUa3nr964S0FrGRyVAiDW/CTTyDYzxD2pqoxICkcIz9pSR5epWBPZn58XI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=IoWTHl/b; arc=none smtp.client-ip=115.124.30.118 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="IoWTHl/b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1774316887; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=RWy+3c5Bm0p4YKZZwOcV4Wu9qajSmC47kJEN5o9JRhE=; b=IoWTHl/bBp8Rxs4l+YZ41AhE/4tc4u1N8wwSE6OfQeQ/yJOQLGqT0kYg8DF7xK9zkwWPvUSHeiUVLC84MV446rmJM3tS1xzM4JvqMuiix0ZWYwKYXBtbrRoogVH2m7ZLJn3IdtdZztkXXef9AvFkmryYSHA0ZbQbmuFeDKfdYjA= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0X.cpSPQ_1774316883; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0X.cpSPQ_1774316883 cluster:ay36) by smtp.aliyun-inc.com; Tue, 24 Mar 2026 09:48:07 +0800 From: Guixin Liu To: Bjorn Helgaas , Thomas Gleixner , Lorenzo Pieralisi , Marc Zyngier , Jonathan Cameron , Inochi Amaoto , Nam Cao , Shradha Gupta , Randy Dunlap Cc: Xunlei Pang , oliver.yang@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH 2/2] PCI/MSI: Update MSI-X irq domain hwsize Date: Tue, 24 Mar 2026 09:47:54 +0800 Message-Id: <20260324014754.4973-3-kanie@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f In-Reply-To: <20260324014754.4973-1-kanie@linux.alibaba.com> References: <20260324014754.4973-1-kanie@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" After the upper-layer driver removes the device and before the next probe, events such as firmware updates may increase the number of interrupts supported by the device. However, the irq_domain still retains the old hwsize, which causes subsequent interrupt allocation failures. Update hwsize during MSI-X device domain setup to fix this issue. Signed-off-by: Guixin Liu Reviewed-by: Guanghui Feng --- drivers/pci/msi/irqdomain.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c index 6e65f0f44112..485bfba059cc 100644 --- a/drivers/pci/msi/irqdomain.c +++ b/drivers/pci/msi/irqdomain.c @@ -274,8 +274,11 @@ bool pci_setup_msix_device_domain(struct pci_dev *pdev= , unsigned int hwsize) if (WARN_ON_ONCE(pdev->msi_enabled)) return false; =20 - if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSIX)) + if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSIX)) { + if (msi_domain_update_hwsize(&pdev->dev, MSI_DEFAULT_DOMAIN, hwsize)) + pr_warn("too big MSI-X hwsize:%u\n", hwsize); return true; + } if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSI)) msi_remove_device_irq_domain(&pdev->dev, MSI_DEFAULT_DOMAIN); =20 --=20 2.32.0.3.g01195cf9f