Re: [PATCH v3 6/7] iommu: Park TDISP T=0 devices in the blocking domain
From: Jason Gunthorpe
Date: Thu Nov 26 2026 - 10:02:32 EST
On Wed, Nov 25, 2026 at 10:21:48PM -0800, Nicolin Chen wrote:
> On Wed, Nov 25, 2026 at 02:07:45PM -0400, Jason Gunthorpe wrote:
> > > [ ... 28 lines skipped ... ]
> > > @@ -1238,6 +1238,14 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,
> > > unsigned long pg_size;
> > > int ret = 0;
> > >
> > > + /*
> > > + * The direct-map reserved regions are still fine because the T=0 stream
> > > + * always goes to an identity mapping. Skip them: recording the request
> > > + * would only refuse the device its blocking domain.
> > > + */
> > > + if (iommu_using_t0_stream(dev))
> > > + return 0;
> > > +
> >
> > Not sure about this. If we are allocating a paging domain then it
> > should always have the direct mappings setup in it.
>
> Hmm, is there a paging domain for t0? I thought it's always on the
> blocked domain..
>
> Even if there is one, t0 would ignore those mappings, since it goes
> through the underlying hypervisor path, right?
Right, but this function is part of allocating a paging domain, the
above argument is we don't use the paging domain in t0. So if we are
going to allocate one it is for t1 and that means it should have this
stuff in it. So why have this test here?
> > I think this patch is the right idea, but it should probably be
> > removed from this series for now if we don't need it to make a basic
> > trusted vIOMMU work.
>
> Without it, every device sets dev->iommu->require_direct for RMR:
>
> if (entry->type == IOMMU_RESV_DIRECT)
> dev->iommu->require_direct = 1;
>
> Then, __iommu_device_set_domain() would fail the first test:
>
> if (dev->iommu->require_direct &&
> (new_domain->type == IOMMU_DOMAIN_BLOCKED ||
> new_domain == group->blocking_domain)) {
> dev_warn(dev,
> "Firmware has requested this device have a 1:1 IOMMU mapping, rejecting configuring the device without a 1:1 mapping. Contact your platform vendor.\n");
> return -EINVAL;
> }
This should be covered with another test if the viommu is bypassed,
not by messing with require_direct..
Jason