From nobody Mon Feb 9 04:31:18 2026 Received: from out198-6.us.a.mail.aliyun.com (out198-6.us.a.mail.aliyun.com [47.90.198.6]) (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 EC4C6271457 for ; Fri, 30 Jan 2026 06:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.198.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769756104; cv=none; b=jb/VBRVZSX78y1ww/qFlQl6rsBEcmMu7HAIj/OZ9sRGS/MNK/Dndw6qKqsFH4J+vMab+k38JXgq5LIK2rGj7uNK7SzxrGW/mdBkbc5oa4pmg0vRerFVjDDZlFAp4l54Ce9KXaEkHKfs4sk/d2rQBAamWbDKoTb+L2ByK2/z/Z5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769756104; c=relaxed/simple; bh=9ombZwwISGB5HH7OzI8Btk4cF//LltI4Twak3chuXWg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kbJ6T6WU4+BkszNqksPf9rvG//Fg4T37EoS7Jp1fi73aGzh+seMAk6UC0yt/VqPnA/qIWjauYfeNIxpc2+oyxpk92vaJWxzXEAWX2SK0kh6YYxTRu6WEob7M8WQIC0ujJhgfTfuaqffjkRWCn57YPo6F5thdTqtsGsmuzXyNgAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bosc.ac.cn; spf=pass smtp.mailfrom=bosc.ac.cn; arc=none smtp.client-ip=47.90.198.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bosc.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bosc.ac.cn Received: from guoyaxing.localdomain(mailfrom:guoyaxing@bosc.ac.cn fp:SMTPD_---.gK.y6dm_1769756062 cluster:ay29) by smtp.aliyun-inc.com; Fri, 30 Jan 2026 14:54:48 +0800 From: Yaxing Guo To: tjeznach@rivosinc.com Cc: joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, iommu@lists.linux.dev, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Yaxing Guo Subject: [PATCH v1] iommu/riscv: Skip IRQ count check when using MSI interrupts Date: Fri, 30 Jan 2026 14:54:20 +0800 Message-Id: <20260130065420.16811-1-guoyaxing@bosc.ac.cn> X-Mailer: git-send-email 2.34.1 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" In RISC-V IOMMU platform devices that use MSI interrupts (indicated by the presence of 'msi-parent' in the device tree), there are no wired interrupt lines, so calling platform_get_irq_count() returns 0 or -ENXIO, causing the driver to fail during probe. However, MSI interrupts are allocated dynamically via the MSI subsystem and do not appear in the device tree 'interrupts' property. Therefore, the driver should not require a non-zero IRQ count when 'msi-parent' is present. This patch fixes the bug where probe fails when using MSI interrupts (which do not have an 'interrupts' property in the device tree).. Fixes: ("iommu/riscv: Add support for platform msi") Signed-off-by: Yaxing Guo Reviewed-by: Andrew Jones --- drivers/iommu/riscv/iommu-platform.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/riscv/iommu-platform.c b/drivers/iommu/riscv/iom= mu-platform.c index 83a28c83f991..8f15b06e8499 100644 --- a/drivers/iommu/riscv/iommu-platform.c +++ b/drivers/iommu/riscv/iommu-platform.c @@ -68,12 +68,7 @@ static int riscv_iommu_platform_probe(struct platform_de= vice *pdev) iommu->caps =3D riscv_iommu_readq(iommu, RISCV_IOMMU_REG_CAPABILITIES); iommu->fctl =3D riscv_iommu_readl(iommu, RISCV_IOMMU_REG_FCTL); =20 - iommu->irqs_count =3D platform_irq_count(pdev); - if (iommu->irqs_count <=3D 0) - return dev_err_probe(dev, -ENODEV, - "no IRQ resources provided\n"); - if (iommu->irqs_count > RISCV_IOMMU_INTR_COUNT) - iommu->irqs_count =3D RISCV_IOMMU_INTR_COUNT; + iommu->irqs_count =3D RISCV_IOMMU_INTR_COUNT; =20 igs =3D FIELD_GET(RISCV_IOMMU_CAPABILITIES_IGS, iommu->caps); switch (igs) { @@ -120,6 +115,13 @@ static int riscv_iommu_platform_probe(struct platform_= device *pdev) fallthrough; =20 case RISCV_IOMMU_CAPABILITIES_IGS_WSI: + iommu->irqs_count =3D platform_irq_count(pdev); + if (iommu->irqs_count <=3D 0) + return dev_err_probe(dev, -ENODEV, + "no IRQ resources provided\n"); + if (iommu->irqs_count > RISCV_IOMMU_INTR_COUNT) + iommu->irqs_count =3D RISCV_IOMMU_INTR_COUNT; + for (vec =3D 0; vec < iommu->irqs_count; vec++) iommu->irqs[vec] =3D platform_get_irq(pdev, vec); =20 --=20 2.34.1