Skip to contentSkip to conversation

fix x86 swiotlb regression

PATCH In review Christoph Hellwig 3 participants 4 messages Apr 9, 2018 – Apr 15, 2018 Library code

lore
Share & tools
lore
#0 lore raw

Hi all,

this patch fixes a regression in the x86 swiotlb conversion. This mostly happend because swiotlb_dma_support does the wrong thing (and did so for a long time) and we switched x86 to use it.

There are a few others users of swiotlb_dma_supported that also look rather broken, but I'll take care of those for the next merge window.

#1 lore raw

PATCH 1/1 swiotlb: use dma_direct_supported for swiotlb_ops

swiotlb_alloc calls dma_direct_alloc, which can satisfy lower than 32-bit dma mask requests using GFP_DMA if the architecture supports it. Various x86 drivers rely on that, so we need to support that. At the same time the whole kernel expects 32-bit dma mask to just work, so the other magic in swiotlb_dma_support isn't actually needed either.

Fixes 6e4bf5867783 ("x86/dma: Use generic swiotlb_ops")
---
 lib/swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/swiotlb.c +1 -1
index 47aeb04c1997..32aacd0d56a8 100644
@@ -1087,6 +1087,6 @@ const struct dma_map_ops swiotlb_dma_ops = {
 	.unmap_sg		= swiotlb_unmap_sg_attrs,
 	.map_page		= swiotlb_map_page,
 	.unmap_page		= swiotlb_unmap_page,
-	.dma_supported		= swiotlb_dma_supported,
+	.dma_supported		= dma_direct_supported,
 };
 #endif /* CONFIG_DMA_DIRECT_OPS */
Signature · 1 line
2.16.3
#2 lore raw

[tip:x86/urgent] swiotlb: Use dma_direct_supported() for swiotlb_ops

swiotlb: Use dma_direct_supported() for swiotlb_ops
Commit-ID:  66bdb1478fd1a66d5b8b81e4e28e0ed3df63ed37
Gitweb:     https://git.kernel.org/tip/66bdb1478fd1a66d5b8b81e4e28e0ed3df63ed37
Author:     Christoph Hellwig <[email protected]>
AuthorDate: Mon, 9 Apr 2018 11:15:17 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 9 Apr 2018 18:20:09 +0200

swiotlb: Use dma_direct_supported() for swiotlb_ops

swiotlb_alloc() calls dma_direct_alloc(), which can satisfy lower than 32-bit DMA mask requests using GFP_DMA if the architecture supports it. Various x86 drivers rely on that, so we need to support that. At the same time the whole kernel expects a 32-bit DMA mask to just work, so the other magic in swiotlb_dma_supported() isn't actually needed either.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 6e4bf5867783 ("x86/dma: Use generic swiotlb_ops")
---
 lib/swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/swiotlb.c +1 -1
index c43ec2271469..c67b06261160 100644
@@ -1130,6 +1130,6 @@ const struct dma_map_ops swiotlb_dma_ops = {
 	.unmap_sg		= swiotlb_unmap_sg_attrs,
 	.map_page		= swiotlb_map_page,
 	.unmap_page		= swiotlb_unmap_page,
-	.dma_supported		= swiotlb_dma_supported,
+	.dma_supported		= dma_direct_supported,
 };
 #endif /* CONFIG_DMA_DIRECT_OPS */
#3 lore raw

Re: [tip:x86/urgent] swiotlb: Use dma_direct_supported() for swiotlb_ops

Do you plan to send this on to Linus? Would be great to have this in for rc1..