From: Robin Murphy <robin.murphy@arm.com>
To: "mika.westerberg@linux.intel.com"
<mika.westerberg@linux.intel.com>,
"Limonciello, Mario" <Mario.Limonciello@amd.com>
Cc: "michael.jamet@intel.com" <michael.jamet@intel.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"YehezkelShB@gmail.com" <YehezkelShB@gmail.com>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
"andreas.noever@gmail.com" <andreas.noever@gmail.com>,
"hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH v2 2/2] thunderbolt: Make iommu_dma_protection more accurate
Date: Mon, 21 Mar 2022 11:11:42 +0000 [thread overview]
Message-ID: <fd86c2cf-3068-1bea-2a6f-46cabb019062@arm.com> (raw)
In-Reply-To: <YjhaViFzmEjBgmmu@lahna>
On 2022-03-21 10:58, mika.westerberg@linux.intel.com wrote:
> Hi Mario,
>
> On Fri, Mar 18, 2022 at 10:29:59PM +0000, Limonciello, Mario wrote:
>> [Public]
>>
>>> Between me trying to get rid of iommu_present() and Mario wanting to
>>> support the AMD equivalent of DMAR_PLATFORM_OPT_IN, scrutiny has
>>> shown
>>> that the iommu_dma_protection attribute is being far too optimistic.
>>> Even if an IOMMU might be present for some PCI segment in the system,
>>> that doesn't necessarily mean it provides translation for the device(s)
>>> we care about. Furthermore, all that DMAR_PLATFORM_OPT_IN really does
>>> is tell us that memory was protected before the kernel was loaded, and
>>> prevent the user from disabling the intel-iommu driver entirely. While
>>> that lets us assume kernel integrity, what matters for actual runtime
>>> DMA protection is whether we trust individual devices, based on the
>>> "external facing" property that we expect firmware to describe for
>>> Thunderbolt ports.
>>>
>>> It's proven challenging to determine the appropriate ports accurately
>>> given the variety of possible topologies, so while still not getting a
>>> perfect answer, by putting enough faith in firmware we can at least get
>>> a good bit closer. If we can see that any device near a Thunderbolt NHI
>>> has all the requisites for Kernel DMA Protection, chances are that it
>>> *is* a relevant port, but moreover that implies that firmware is playing
>>> the game overall, so we'll use that to assume that all Thunderbolt ports
>>> should be correctly marked and thus will end up fully protected.
>>>
>>
>> This approach looks generally good to me. I do worry a little bit about older
>> systems that didn't set ExternalFacingPort in the FW but were previously setting
>> iommu_dma_protection, but I think that those could be treated on a quirk
>> basis to set PCI IDs for those root ports as external facing if/when they come
>> up.
>
> There are no such systems out there AFAICT.
And even if there are, as above they've never actually been fully
protected and still won't be, so it's arguably a good thing for them to
stop thinking so.
>> I'll send up a follow up patch that adds the AMD ACPI table check.
>> If it looks good can roll it into your series for v3, or if this series goes
>> as is for v2 it can come on its own.
>>
>>> CC: Mario Limonciello <mario.limonciello@amd.com>
>>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>>> ---
>>>
>>> v2: Give up trying to look for specific devices, just look for evidence
>>> that firmware cares at all.
>>
>> I still do think you could know exactly which devices to use if you're in
>> SW CM mode, but I guess the consensus is to not bifurcate the way this
>> can be checked.
>
> Indeed.
>
> The patch looks good to me now. I will give it a try on a couple of
> systems later today or tomorrow and let you guys know how it went. I
> don't expect any problems but let's see.
>
> Thanks a lot Robin for working on this :)
Heh, let's just hope the other half-dozen or so subsystems I need to
touch for this IOMMU cleanup aren't all quite as involved as this turned
out to be :)
Cheers,
Robin.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-03-21 11:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 17:42 [PATCH v2 0/2] thunderbolt: Make iommu_dma_protection more accurate Robin Murphy
2022-03-18 17:42 ` [PATCH v2 1/2] iommu: Add capability for pre-boot DMA protection Robin Murphy
2022-03-22 9:14 ` Christoph Hellwig
2022-03-22 9:53 ` Robin Murphy
2022-03-18 17:42 ` [PATCH v2 2/2] thunderbolt: Make iommu_dma_protection more accurate Robin Murphy
2022-03-18 22:29 ` Limonciello, Mario via iommu
2022-03-21 10:58 ` mika.westerberg
2022-03-21 11:11 ` Robin Murphy [this message]
2022-03-21 13:21 ` Limonciello, Mario via iommu
2022-03-22 9:16 ` Christoph Hellwig
2022-03-22 11:41 ` Mika Westerberg
2022-03-22 14:40 ` Robin Murphy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd86c2cf-3068-1bea-2a6f-46cabb019062@arm.com \
--to=robin.murphy@arm.com \
--cc=Mario.Limonciello@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox