Re: [PATCH 08/12] iommufd/selftest: Put iopf enablement in domain attach path

From: Jason Gunthorpe
Date: Thu Feb 20 2025 - 13:00:37 EST


On Thu, Feb 20, 2025 at 03:03:21PM +0800, Baolu Lu wrote:
> On 2/20/25 09:02, Jason Gunthorpe wrote:
> > On Fri, Feb 14, 2025 at 02:11:00PM +0800, Lu Baolu wrote:
> > > @@ -197,11 +201,19 @@ static int mock_domain_nop_attach(struct iommu_domain *domain,
> > > if (domain->dirty_ops && (mdev->flags & MOCK_FLAGS_DEVICE_NO_DIRTY))
> > > return -EINVAL;
> > > + return mock_dev_enable_iopf(dev, domain);
> > > +}
> >
> > This isn't going to work for a replace type operation? Maybe like:
> >
> > if (old_domain->iopf_handler && !domain->iopf_handler)
> > return mock_dev_disable_iopf(dev, domain);
> > if (old_domain->iopf_handler && domain->iopf_handler)
> > return 0;
> > return mock_dev_enable_iopf(dev, domain);
> >
> > ?
>
> The iommufd mock device driver appears not to support replacement.

That's not technically a choice the driver gets to have ..

> The
> replacement operation on this driver is likely handled as follows:
>
> - attach domain_a attach blocking_domain attach domain_b

Nothing actually does that though?

Jason