linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
@ 2020-11-25  1:41 Lu Baolu
  2020-11-25 14:05 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Lu Baolu @ 2020-11-25  1:41 UTC (permalink / raw)
  To: Ning Sun, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Will Deacon, Joerg Roedel
  Cc: Ashok Raj, x86, tboot-devel, iommu, linux-kernel, Lu Baolu, Adrian Huang

After commit 327d5b2fee91c ("iommu/vt-d: Allow 32bit devices to uses DMA
domain"), swiotbl could also be used for direct memory access if IOMMU
is enabled but a device is configured to pass through the DMA translation.
Keep swiotlb when IOMMU is forced on, otherwise, some devices won't work
if "iommu=pt" kernel parameter is used.

Fixes: 327d5b2fee91c ("iommu/vt-d: Allow 32bit devices to uses DMA domain")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=210237
Reported-and-tested-by: Adrian Huang <ahuang12@lenovo.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 arch/x86/kernel/tboot.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index 420be871d9d4..ae64f98ec2ab 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -514,13 +514,10 @@ int tboot_force_iommu(void)
 	if (!tboot_enabled())
 		return 0;
 
-	if (no_iommu || swiotlb || dmar_disabled)
+	if (no_iommu || dmar_disabled)
 		pr_warn("Forcing Intel-IOMMU to enabled\n");
 
 	dmar_disabled = 0;
-#ifdef CONFIG_SWIOTLB
-	swiotlb = 0;
-#endif
 	no_iommu = 0;
 
 	return 1;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
  2020-11-25  1:41 [PATCH 1/1] x86/tboot: Don't disable swiotlb when iommu is forced on Lu Baolu
@ 2020-11-25 14:05 ` Will Deacon
  2020-11-25 15:41   ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2020-11-25 14:05 UTC (permalink / raw)
  To: Lu Baolu, Thomas Gleixner, Ingo Molnar, Ning Sun, Joerg Roedel,
	Borislav Petkov
  Cc: catalin.marinas, kernel-team, Will Deacon, x86, tboot-devel,
	Adrian Huang, iommu, Ashok Raj, linux-kernel

On Wed, 25 Nov 2020 09:41:24 +0800, Lu Baolu wrote:
> After commit 327d5b2fee91c ("iommu/vt-d: Allow 32bit devices to uses DMA
> domain"), swiotbl could also be used for direct memory access if IOMMU
> is enabled but a device is configured to pass through the DMA translation.
> Keep swiotlb when IOMMU is forced on, otherwise, some devices won't work
> if "iommu=pt" kernel parameter is used.

Applied to arm64 (for-next/iommu/fixes), thanks!

[1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
      https://git.kernel.org/arm64/c/e2be2a833ab5

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
  2020-11-25 14:05 ` Will Deacon
@ 2020-11-25 15:41   ` Konrad Rzeszutek Wilk
  2020-11-25 15:51     ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2020-11-25 15:41 UTC (permalink / raw)
  To: Will Deacon
  Cc: Lu Baolu, Thomas Gleixner, Ingo Molnar, Ning Sun, Joerg Roedel,
	Borislav Petkov, catalin.marinas, kernel-team, x86, tboot-devel,
	Adrian Huang, iommu, Ashok Raj, linux-kernel

On Wed, Nov 25, 2020 at 02:05:15PM +0000, Will Deacon wrote:
> On Wed, 25 Nov 2020 09:41:24 +0800, Lu Baolu wrote:
> > After commit 327d5b2fee91c ("iommu/vt-d: Allow 32bit devices to uses DMA
> > domain"), swiotbl could also be used for direct memory access if IOMMU
> > is enabled but a device is configured to pass through the DMA translation.
> > Keep swiotlb when IOMMU is forced on, otherwise, some devices won't work
> > if "iommu=pt" kernel parameter is used.
> 
> Applied to arm64 (for-next/iommu/fixes), thanks!
> 
> [1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
>       https://git.kernel.org/arm64/c/e2be2a833ab5

But tboot never ran on ARM. It is a Intel specifc.

I think either me or Thomas should take this patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
  2020-11-25 15:41   ` Konrad Rzeszutek Wilk
@ 2020-11-25 15:51     ` Will Deacon
  2020-11-25 16:25       ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2020-11-25 15:51 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Lu Baolu, Thomas Gleixner, Ingo Molnar, Ning Sun, Joerg Roedel,
	Borislav Petkov, catalin.marinas, kernel-team, x86, tboot-devel,
	Adrian Huang, iommu, Ashok Raj, linux-kernel

Hi Konrad,

On Wed, Nov 25, 2020 at 10:41:53AM -0500, Konrad Rzeszutek Wilk wrote:
> On Wed, Nov 25, 2020 at 02:05:15PM +0000, Will Deacon wrote:
> > On Wed, 25 Nov 2020 09:41:24 +0800, Lu Baolu wrote:
> > > After commit 327d5b2fee91c ("iommu/vt-d: Allow 32bit devices to uses DMA
> > > domain"), swiotbl could also be used for direct memory access if IOMMU
> > > is enabled but a device is configured to pass through the DMA translation.
> > > Keep swiotlb when IOMMU is forced on, otherwise, some devices won't work
> > > if "iommu=pt" kernel parameter is used.
> > 
> > Applied to arm64 (for-next/iommu/fixes), thanks!
> > 
> > [1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
> >       https://git.kernel.org/arm64/c/e2be2a833ab5
> 
> But tboot never ran on ARM. It is a Intel specifc.
> 
> I think either me or Thomas should take this patch.

FWIW, I did check with Thomas before I picked it up. I know it looks weird
going via arm64, but that's only because I'm temporarily handling the IOMMU
tree there (including vt-d changes) while Joerg is away. Since this fixes a
vt-d regression, I thought I'd pick it up along with the other IOMMU fixes I
have queued for -rc6.

That said, if you insist, then I can revert it. I'm really only trying to
help here.

Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
  2020-11-25 15:51     ` Will Deacon
@ 2020-11-25 16:25       ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2020-11-25 16:25 UTC (permalink / raw)
  To: Will Deacon
  Cc: Lu Baolu, Thomas Gleixner, Ingo Molnar, Ning Sun, Joerg Roedel,
	Borislav Petkov, catalin.marinas, kernel-team, x86, tboot-devel,
	Adrian Huang, iommu, Ashok Raj, linux-kernel

On Wed, Nov 25, 2020 at 03:51:30PM +0000, Will Deacon wrote:
> Hi Konrad,
> 
> On Wed, Nov 25, 2020 at 10:41:53AM -0500, Konrad Rzeszutek Wilk wrote:
> > On Wed, Nov 25, 2020 at 02:05:15PM +0000, Will Deacon wrote:
> > > On Wed, 25 Nov 2020 09:41:24 +0800, Lu Baolu wrote:
> > > > After commit 327d5b2fee91c ("iommu/vt-d: Allow 32bit devices to uses DMA
> > > > domain"), swiotbl could also be used for direct memory access if IOMMU
> > > > is enabled but a device is configured to pass through the DMA translation.
> > > > Keep swiotlb when IOMMU is forced on, otherwise, some devices won't work
> > > > if "iommu=pt" kernel parameter is used.
> > > 
> > > Applied to arm64 (for-next/iommu/fixes), thanks!
> > > 
> > > [1/1] x86/tboot: Don't disable swiotlb when iommu is forced on
> > >       https://git.kernel.org/arm64/c/e2be2a833ab5
> > 
> > But tboot never ran on ARM. It is a Intel specifc.
> > 
> > I think either me or Thomas should take this patch.
> 
> FWIW, I did check with Thomas before I picked it up. I know it looks weird
> going via arm64, but that's only because I'm temporarily handling the IOMMU
> tree there (including vt-d changes) while Joerg is away. Since this fixes a
> vt-d regression, I thought I'd pick it up along with the other IOMMU fixes I
> have queued for -rc6.
> 

Aah, I missed the memo :-)

> That said, if you insist, then I can revert it. I'm really only trying to
> help here.

Nah. Enjoy picking up patches!

Thanks!
> 
> Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-25 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25  1:41 [PATCH 1/1] x86/tboot: Don't disable swiotlb when iommu is forced on Lu Baolu
2020-11-25 14:05 ` Will Deacon
2020-11-25 15:41   ` Konrad Rzeszutek Wilk
2020-11-25 15:51     ` Will Deacon
2020-11-25 16:25       ` Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).