Re: [PATCH] pci: Rename pci_dev->untrusted to pci_dev->external

From: Bjorn Helgaas
Date: Tue Apr 20 2021 - 13:07:13 EST


On Tue, Apr 20, 2021 at 07:10:06AM +0100, Christoph Hellwig wrote:
> On Mon, Apr 19, 2021 at 05:30:49PM -0700, Rajat Jain wrote:
> > The current flag name "untrusted" is not correct as it is populated
> > using the firmware property "external-facing" for the parent ports. In
> > other words, the firmware only says which ports are external facing, so
> > the field really identifies the devices as external (vs internal).
> >
> > Only field renaming. No functional change intended.
>
> I don't think this is a good idea. First the field should have been
> added to the generic struct device as requested multiple times before.

Fair point. There isn't anything PCI-specific about this idea. The
ACPI "ExternalFacingPort" and DT "external-facing" are currently only
defined for PCI devices, but could be applied elsewhere.

> Right now this requires horrible hacks in the IOMMU code to get at the
> pci_dev, and also doesn't scale to various other potential users.

Agreed, this is definitely suboptimal. Do you have other users in
mind? Maybe they could help inform the plan.

> Second the untrusted is objectively a better name. Because untrusted
> is how we treat the device, which is what mattes. External is just
> how we come to that conclusion.

The decision to treat "external" as being "untrusted" is a little bit
of policy that the PCI core really doesn't care about, so I think it
does make some sense to let the places that *do* care decide what to
trust based on "external" and possibly other factors, e.g., whether
the device is a BMC or processes untrusted data, etc.

But I guess it makes sense to wait until we have a better motivation
before renaming it, since we don't gain any functionality here.

Bjorn