[PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-17 Thread Robin Murphy
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 necessa

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-17 Thread Greg KH
On Thu, Mar 17, 2022 at 04:17:07PM +, Robin Murphy wrote: > 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 mig

RE: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-17 Thread Limonciello, Mario via iommu
gt; iommu@lists.linux-foundation.org; linux-...@vger.kernel.org; Limonciello, > Mario > Subject: [PATCH] thunderbolt: Make iommu_dma_protection more accurate > > Between me trying to get rid of iommu_present() and Mario wanting to > support the AMD equivalent of DMAR_PLATFORM_OPT

RE: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-17 Thread Limonciello, Mario via iommu
kernel.org; linux-ker...@vger.kernel.org; > iommu@lists.linux-foundation.org; linux-...@vger.kernel.org > Subject: RE: [PATCH] thunderbolt: Make iommu_dma_protection more > accurate > > [Public] > > > > > -Original Message- > > From: Robin Murphy > > Sent:

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-17 Thread Mika Westerberg
Hi Robin, Thanks for working on this! On Thu, Mar 17, 2022 at 04:17:07PM +, Robin Murphy wrote: > 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 fa

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread mika.westerb...@linux.intel.com
Hi Mario, On Thu, Mar 17, 2022 at 08:36:13PM +, Limonciello, Mario wrote: > Here is a proposal on top of what you did for this. > The idea being check the ports right when the links are made if they exist > (all the new USB4 stuff) and then check all siblings on TBT3 stuff. > > diff --git

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread Robin Murphy
On 2022-03-18 06:44, Mika Westerberg wrote: Hi Robin, Thanks for working on this! On Thu, Mar 17, 2022 at 04:17:07PM +, Robin Murphy wrote: 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 i

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread Robin Murphy
On 2022-03-18 11:38, mika.westerb...@linux.intel.com wrote: Hi Mario, On Thu, Mar 17, 2022 at 08:36:13PM +, Limonciello, Mario wrote: Here is a proposal on top of what you did for this. The idea being check the ports right when the links are made if they exist (all the new USB4 stuff) and t

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread mika.westerb...@linux.intel.com
Hi Robin, On Fri, Mar 18, 2022 at 12:01:42PM +, Robin Murphy wrote: > > This adds quite a lot code and complexity, and honestly I would like to > > keep it as simple as possible (and this is not enough because we need to > > make sure the DMAR bit is there so that none of the possible connecte

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread Robin Murphy
On 2022-03-18 13:25, mika.westerb...@linux.intel.com wrote: Hi Robin, On Fri, Mar 18, 2022 at 12:01:42PM +, Robin Murphy wrote: This adds quite a lot code and complexity, and honestly I would like to keep it as simple as possible (and this is not enough because we need to make sure the DMAR

RE: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread Limonciello, Mario via iommu
nel.org; linux- > ker...@vger.kernel.org; iommu@lists.linux-foundation.org; linux- > p...@vger.kernel.org > Subject: Re: [PATCH] thunderbolt: Make iommu_dma_protection more > accurate > > On 2022-03-18 13:25, mika.westerb...@linux.intel.com wrote: > > Hi Robin, > > > > On

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread mika.westerb...@linux.intel.com
On Fri, Mar 18, 2022 at 02:08:16PM +, Robin Murphy wrote: > On 2022-03-18 13:25, mika.westerb...@linux.intel.com wrote: > > Hi Robin, > > > > On Fri, Mar 18, 2022 at 12:01:42PM +, Robin Murphy wrote: > > > > This adds quite a lot code and complexity, and honestly I would like to > > > > ke

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread Lukas Wunner
On Fri, Mar 18, 2022 at 02:08:16PM +, Robin Murphy wrote: > OK, so do we have any realistic options for identifying the correct PCI > devices, if USB4 PCIe adapters might be anywhere relative to their > associated NHI? Short of maintaining a list of known IDs, the only thought I > have left is

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread Lukas Wunner
On Fri, Mar 18, 2022 at 03:51:21PM +0100, Lukas Wunner wrote: > On Fri, Mar 18, 2022 at 02:08:16PM +, Robin Murphy wrote: > > OK, so do we have any realistic options for identifying the correct PCI > > devices, if USB4 PCIe adapters might be anywhere relative to their > > associated NHI? Short

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread mika.westerb...@linux.intel.com
Hi Lukas, On Fri, Mar 18, 2022 at 03:51:21PM +0100, Lukas Wunner wrote: > On Fri, Mar 18, 2022 at 02:08:16PM +, Robin Murphy wrote: > > OK, so do we have any realistic options for identifying the correct PCI > > devices, if USB4 PCIe adapters might be anywhere relative to their > > associated

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread Robin Murphy
On 2022-03-18 14:47, mika.westerb...@linux.intel.com wrote: On Fri, Mar 18, 2022 at 02:08:16PM +, Robin Murphy wrote: On 2022-03-18 13:25, mika.westerb...@linux.intel.com wrote: Hi Robin, On Fri, Mar 18, 2022 at 12:01:42PM +, Robin Murphy wrote: This adds quite a lot code and complexi

Re: [PATCH] thunderbolt: Make iommu_dma_protection more accurate

2022-03-18 Thread mika.westerb...@linux.intel.com
Hi Robin, On Fri, Mar 18, 2022 at 03:15:19PM +, Robin Murphy wrote: > > IMHO we should just trust the firmare provided information here > > (otherwise we are screwed anyway as there is no way to tell if the > > devices connected prior the OS can still do DMA), and use the external > > facing p