lkml.org 
[lkml]   [2020]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH v2 2/7] PCI: Set "untrusted" flag for truly external devices only
    Hello Bjorn,

    On Mon, Jul 6, 2020 at 4:30 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
    >
    > On Mon, Jul 06, 2020 at 03:31:47PM -0700, Rajat Jain wrote:
    > > On Mon, Jul 6, 2020 at 9:38 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
    > > > On Mon, Jun 29, 2020 at 09:49:38PM -0700, Rajat Jain wrote:
    >
    > > > > -static void pci_acpi_set_untrusted(struct pci_dev *dev)
    > > > > +static void pci_acpi_set_external_facing(struct pci_dev *dev)
    > > > > {
    > > > > u8 val;
    > > > >
    > > > > - if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT)
    > > > > + if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT &&
    > > > > + pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM)
    > > >
    > > > This looks like a change worthy of its own patch. We used to look for
    > > > "ExternalFacingPort" only on Root Ports; now we'll also do it for
    > > > Switch Downstream Ports.
    > >
    > > Can do. (please see below)
    > >
    > > > Can you include DT and ACPI spec references if they exist? I found
    > > > this mention:
    > > > https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports
    > > > which actually says it should only be implemented for Root Ports.
    > >
    > > I actually have no references. It seems to me that the microsoft spec
    > > assumes that all external ports must be implemented on root ports, but
    > > I think it would be equally fair for systems with PCIe switches to
    > > implement one on one of their switch downstream ports. I don't have an
    > > immediate use of this anyway, so if you think this should rather wait
    > > unless someone really has this case, this can wait. Let me know.
    >
    > I agree that it "makes sense" to pay attention to this property no
    > matter where it appears, but since that Microsoft doc went to the
    > trouble to restrict it to Root Ports, I think we should leave this
    > as-is and only look for it in the Root Port. Otherwise Linux will
    > accept something Windows will reject, and that seems like a needless
    > difference.
    >
    > We can at least include the above link to the Microsoft doc in the
    > commit log.

    Will do.

    >
    > > > It also mentions a "DmaProperty" that looks related. Maybe Linux
    > > > should also pay attention to this?
    > >
    > > Interesting. Since this is not in use currently by the kernel as well
    > > as not exposed by (our) BIOS, I don't have an immediate use case for
    > > this. I'd like to defer this for later (as-the-need-arises).
    >
    > I agree, you can defer this until you see a need for it. I just
    > pointed it out in case it would be useful to you.
    >
    > > > > + /*
    > > > > + * Devices are marked as external-facing using info from platform
    > > > > + * (ACPI / devicetree). An external-facing device is still an internal
    > > > > + * trusted device, but it faces external untrusted devices. Thus any
    > > > > + * devices enumerated downstream an external-facing device is marked
    > > > > + * as untrusted.
    > > >
    > > > This comment has a subject/verb agreement problem.
    > >
    > > I assume you meant s/is/are/ in last sentence. Will do.
    >
    > Right. There's also something wrong with "enumerated downstream an".

    I'm apparently really bad at English :-). This is what I have in my
    latest patch I am about to send out:

    "Thus any device enumerated downstream an external-facing device, is
    marked as untrusted."

    Are you suggesting s/an/a/ ? Please let me know what you would like to
    see and I'd copy it as-is :-)

    Thanks!

    Rajat

    \
     
     \ /
      Last update: 2020-07-07 01:44    [W:3.933 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site