linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Christian Benvenuti <benve@cisco.com>,
	Heiko Stuebner <heiko@sntech.de>,
	iommu@lists.linux.dev, Jernej Skrabec <jernej.skrabec@gmail.com>,
	Joerg Roedel <joro@8bytes.org>, Leon Romanovsky <leon@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	linux-mediatek@lists.infradead.org, linux-rdma@vger.kernel.org,
	linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Nelson Escobar <neescoba@cisco.com>,
	Rob Clark <robin.clark@oss.qualcomm.com>,
	Samuel Holland <samuel@sholland.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Chen-Yu Tsai <wens@csie.org>, Will Deacon <will@kernel.org>,
	Yong Wu <yong.wu@mediatek.com>,
	patches@lists.linux.dev
Subject: Re: [PATCH 2/3] iommu/amd: Don't call report_iommu_fault()
Date: Thu, 23 Oct 2025 11:26:57 -0300	[thread overview]
Message-ID: <20251023142657.GH262900@nvidia.com> (raw)
In-Reply-To: <579bdc4e-ab71-4120-8991-34400d4bbf8d@arm.com>

On Thu, Oct 23, 2025 at 01:34:21PM +0100, Robin Murphy wrote:
> On 2025-10-22 6:12 pm, Jason Gunthorpe wrote:
> > This old style API is only used by drivers/gpu/drm/msm and
> > drivers/remoteproc, neither are used on x86 HW. Remove the dead code to
> > discourage new users.
> 
> I'd be almost certain there's somebody somewhere using remoteproc on x86
> with some FPGA/bespoke PCI device/on-board MCU/etc. - whether they're doing
> it on AMD *and* care about its fault reporting mechanism is really the
> question.

Hmm!

Looking more closely

static int rproc_enable_iommu(struct rproc *rproc)
{
        struct iommu_domain *domain;
        struct device *dev = rproc->dev.parent;
        int ret;

        if (!rproc->has_iommu) {
                 ^^^^^^^^^^^^^
                dev_dbg(dev, "iommu not present\n");
                return 0;
        }

        iommu_set_fault_handler(domain, rproc_iommu_fault, rproc);

And then:

drivers/remoteproc/omap_remoteproc.c:   rproc->has_iommu = true;
drivers/remoteproc/qcom_q6v5_adsp.c:    .has_iommu = true,

config OMAP_REMOTEPROC
        tristate "OMAP remoteproc support"
        depends on ARCH_OMAP4 || SOC_OMAP5 || SOC_DRA7XX
        depends on OMAP_IOMMU

config QCOM_Q6V5_ADSP
        tristate "Qualcomm Technology Inc ADSP Peripheral Image Loader"
        depends on OF && ARCH_QCOM
        depends on QCOM_SMEM

So, I think it is safe. I will revise the commit message.

Seems like these drivers are definately used:

 drivers/iommu/arm/arm-smmu/arm-smmu.c    |  1 +
 drivers/iommu/arm/arm-smmu/qcom_iommu.c  |  1 +
 drivers/iommu/omap-iommu.c               |  1 +

But I wonder if these are all dead code too? Any thoughts?

 drivers/iommu/ipmmu-vmsa.c               |  1 +
 drivers/iommu/mtk_iommu.c                |  1 +
 drivers/iommu/mtk_iommu_v1.c             |  1 +
 drivers/iommu/rockchip-iommu.c           |  1 +
 drivers/iommu/sun50i-iommu.c             |  1 +

> >   	if (dev_data) {
> > -		/*
> > -		 * If this is a DMA fault (for which the I(nterrupt)
> > -		 * bit will be unset), allow report_iommu_fault() to
> > -		 * prevent logging it.
> > -		 */
> > -		if (IS_IOMMU_MEM_TRANSACTION(flags)) {
> > -			/* Device not attached to domain properly */
> > -			if (dev_data->domain == NULL) {
> > -				pr_err_ratelimited("Event logged [Device not attached to domain properly]\n");
> > -				pr_err_ratelimited("  device=%04x:%02x:%02x.%x domain=0x%04x\n",
> > -						   iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid),
> > -						   PCI_FUNC(devid), domain_id);
> > -				goto out;
> > -			}
> This part is unrelated to the report_iommu_fault() call - in fact it was
> specifically added even more recently.

Yeah, I'll fix it

Thanks,
Jason


  reply	other threads:[~2025-10-23 14:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 17:12 [PATCH 0/3] Cleanup around iommu_set_fault_handler() Jason Gunthorpe
2025-10-22 17:12 ` [PATCH 1/3] RDMA/usnic: Remove iommu_set_fault_handler() Jason Gunthorpe
2025-10-23  5:02   ` Baolu Lu
2025-10-22 17:12 ` [PATCH 2/3] iommu/amd: Don't call report_iommu_fault() Jason Gunthorpe
2025-10-23 12:34   ` Robin Murphy
2025-10-23 14:26     ` Jason Gunthorpe [this message]
2025-11-20 19:26       ` Jason Gunthorpe
2025-10-22 17:12 ` [PATCH 3/3] iommu: Allow drivers to say if they use report_iommu_fault() Jason Gunthorpe
2025-10-23  5:06   ` Baolu Lu
2025-10-23 11:24   ` Robin Murphy
2025-10-23 14:54     ` Jason Gunthorpe
2025-10-23 16:58       ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251023142657.GH262900@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benve@cisco.com \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux.dev \
    --cc=jernej.skrabec@gmail.com \
    --cc=joro@8bytes.org \
    --cc=leon@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=matthias.bgg@gmail.com \
    --cc=neescoba@cisco.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=robin.murphy@arm.com \
    --cc=samuel@sholland.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=wens@csie.org \
    --cc=will@kernel.org \
    --cc=yong.wu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).