Re: [PATCH 17/17] PCI: Replace untrusted state with device trust
From: Leon Romanovsky
Date: Mon Nov 16 2026 - 09:41:16 EST
On Mon, Nov 16, 2026 at 09:20:46AM -0400, Jason Gunthorpe wrote:
> On Mon, Nov 16, 2026 at 06:38:25PM +0530, Aneesh Kumar K.V wrote:
> > > +static inline bool
> > > +pci_dev_default_is_restricted(const struct pci_dev *pdev)
> > > +{
> > > + enum device_trust_policy policy = READ_ONCE(pdev->dev.trust_policy);
> > > +
> > > + return policy == DEVICE_TRUST_POLICY_DISABLED ||
> > > + policy == DEVICE_TRUST_POLICY_ADVERSARY;
> > > +}
> > > +
> >
> > Could you clarify how this series will work alongside device acceptance
> > and private-memory access?
> >
> > In particular, what should callers of device_cc_accepted() use under
> > this model?
>
> Who is calling device_cc_accepted? I thought we were keeping that
> internal to the DMA PI?
>
> > My understanding is that trust describes the operating
> > policy, not TDISP acceptance or DMA access to private memory.
>
> Right.
>
> > Therefore,
> > neither FULL nor ADVERSARY alone indicates whether a device can access
> > private memory?
>
> Right.
>
> Once you turn on TDISP you effectively activate DMA, just like turning
> on the IOMMU.
>
> Userspace then gets to choose how the rest of the system behavess. You
> can still run a strict viommu with an adversarial driver even if you
> enabled TDISP and can DMA to all memory.
>
> I don't know if many people would choose that combination, but it is
> there.
>
> > You also mention that once a trust level other than DISABLED is set, it
> > cannot be changed during the device's lifetime. If a device initially
> > operates in ADVERSARY mode and later attestation justifies FULL
> > operation, is that transition intentionally unsupported for the existing
> > device object? As documented, unbind/rebind and reset preserve the
> > committed level.
>
> I think it should only be for the duration of a bound driver?
For now, I decided to disallow state changes because the IOMMU may outlive the
bound device. Unbinding does not fully reset the device, so we must quiesce it
to ensure complete security.
Thanks
>
> > It would help to describe how the trust framework fits together with
> > those separate mechanisms, including which pieces are left for follow-up
> > series.
>
> The main thing it brings is the pause to allow userspace to measure
> the device and put it into RUN if it so chooses before any driver is
> bound.
>
> It doesn't change how any of the DMA or TDSIP flows work.
>
> Jason