sg list elements could cover more than one page of data. Therefore
using plat_map_dma_mem_page() doesn't work for platforms, which have
IOMMU functionality hidden behind plat_map_dma_XXX functions.
Fixes: e36863a550da ("MIPS: HIGHMEM DMA on noncoherent MIPS32 processors")
Signed-off-by: Thomas Bogendoerfer <[email protected]>
---
arch/mips/mm/dma-default.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index f9fef0028ca2..2718185a3d38 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -288,8 +288,8 @@ static int mips_dma_map_sg(struct device *dev, struct scatterlist *sglist,
#ifdef CONFIG_NEED_SG_DMA_LENGTH
sg->dma_length = sg->length;
#endif
- sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) +
- sg->offset;
+ sg->dma_address = plat_map_dma_mem(dev, sg_virt(sg),
+ sg->length);
}
return nents;
--
2.13.7
platform devices for sonic and esp didn't have dma_masks.
Signed-off-by: Thomas Bogendoerfer <[email protected]>
---
arch/mips/jazz/setup.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index 448fd41792e4..1b5e121c3f0d 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -16,6 +16,7 @@
#include <linux/screen_info.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
+#include <linux/dma-mapping.h>
#include <asm/jazz.h>
#include <asm/jazzdma.h>
@@ -136,10 +137,16 @@ static struct resource jazz_esp_rsrc[] = {
}
};
+static u64 jazz_esp_dma_mask = DMA_BIT_MASK(32);
+
static struct platform_device jazz_esp_pdev = {
.name = "jazz_esp",
.num_resources = ARRAY_SIZE(jazz_esp_rsrc),
- .resource = jazz_esp_rsrc
+ .resource = jazz_esp_rsrc,
+ .dev = {
+ .dma_mask = &jazz_esp_dma_mask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ }
};
static struct resource jazz_sonic_rsrc[] = {
@@ -155,10 +162,16 @@ static struct resource jazz_sonic_rsrc[] = {
}
};
+static u64 jazz_sonic_dma_mask = DMA_BIT_MASK(32);
+
static struct platform_device jazz_sonic_pdev = {
.name = "jazzsonic",
.num_resources = ARRAY_SIZE(jazz_sonic_rsrc),
- .resource = jazz_sonic_rsrc
+ .resource = jazz_sonic_rsrc,
+ .dev = {
+ .dma_mask = &jazz_sonic_dma_mask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ }
};
static struct resource jazz_cmos_rsrc[] = {
--
2.13.7
Hi Thomas,
On Wed, Jul 11, 2018 at 01:38:51PM +0200, Thomas Bogendoerfer wrote:
> sg list elements could cover more than one page of data. Therefore
> using plat_map_dma_mem_page() doesn't work for platforms, which have
> IOMMU functionality hidden behind plat_map_dma_XXX functions.
>
> Fixes: e36863a550da ("MIPS: HIGHMEM DMA on noncoherent MIPS32 processors")
> Signed-off-by: Thomas Bogendoerfer <[email protected]>
> ---
> arch/mips/mm/dma-default.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
> index f9fef0028ca2..2718185a3d38 100644
> --- a/arch/mips/mm/dma-default.c
> +++ b/arch/mips/mm/dma-default.c
> @@ -288,8 +288,8 @@ static int mips_dma_map_sg(struct device *dev, struct scatterlist *sglist,
> #ifdef CONFIG_NEED_SG_DMA_LENGTH
> sg->dma_length = sg->length;
> #endif
> - sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) +
> - sg->offset;
> + sg->dma_address = plat_map_dma_mem(dev, sg_virt(sg),
> + sg->length);
> }
>
> return nents;
This doesn't apply after Christoph's massive MIPS DMA cleanup which can
be found in mips-next (or linux-next). After this work we end up using
the generic dma_direct_map_sg() on most systems, and the code above has
been removed.
Thanks,
Paul
Hi Thomas,
On Wed, Jul 11, 2018 at 01:38:52PM +0200, Thomas Bogendoerfer wrote:
> platform devices for sonic and esp didn't have dma_masks.
That's a very brief commit message :)
Could you add a description of why this is a problem & what was broken
as a result of it?
If this is a problem you've encountered it'd also be useful to mention
which functionality you tested on which machine to discover the problem
& verify the fix.
Thanks,
Paul
On Wed, 11 Jul 2018 09:03:42 -0700
Paul Burton <[email protected]> wrote:
> This doesn't apply after Christoph's massive MIPS DMA cleanup which can
> be found in mips-next (or linux-next). After this work we end up using
> the generic dma_direct_map_sg() on most systems, and the code above has
> been removed.
Christoph's cleanup also fixes the issue. I thought sending it as a fix for
4.17 would be appropriate, but no problem with dropping it.
Thomas.
On Wed, 11 Jul 2018 09:15:56 -0700
Paul Burton <[email protected]> wrote:
> On Wed, Jul 11, 2018 at 01:38:52PM +0200, Thomas Bogendoerfer wrote:
> > platform devices for sonic and esp didn't have dma_masks.
>
> That's a very brief commit message :)
I thought it's obvious, that now every dma mapping operation triggers a WARN_ON, if
dma masks are missing. But no problem to respin with a more information added.
Thomas.