Re: [PATCH 2/3] iommu/amd: Don't call report_iommu_fault()

Jason Gunthorpe
2025-11-20T19:33:44Z

On Thu, Oct 23, 2025 at 11:26:57AM -0300, Jason Gunthorpe wrote:
> > > 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

Coming back to this, it was right in the v1, it should be deleted.

The (dev_data->domain == NULL) test was added because calling
report_iommu_fault() will crash if the domain is NULL. This removed
that call it so we can't crash anymore.

Instead we fall through to this:

if (__ratelimit(&dev_data->rs)) {
pci_err(pdev, "Event logged [IO_PAGE_FAULT domain=0x%04x address=0x%llx flags=0x%04x]\n",
domain_id, address, flags);
}

Which prints the same information, the "domain is null" is not
especially useful. Further this only happens when dev_data is set it
so is very unlikely to be NULL anyhow, there is only a short period
after probe before the default domain is attached.

I will add some remarks to the commit message since I forgot why I did
it when you asked :\

Jason