diff mbox

[3/7] mmc: au1xmmc: handle highmem pages

Message ID 20180518171847.16419-4-hch@lst.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christoph Hellwig May 18, 2018, 5:18 p.m. UTC
Use kmap_atomic to map the scatterlist entry before using it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/mmc/host/au1xmmc.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Ulf Hansson May 21, 2018, 1:55 p.m. UTC | #1
On 18 May 2018 at 19:18, Christoph Hellwig <hch@lst.de> wrote:
> Use kmap_atomic to map the scatterlist entry before using it.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Christoph,

I needed to drop this one as it caused a compiler error, reported by kernelci.

https://storage.kernelci.org/ulfh/next/sdhci-omap-v4.17-rc3-83-g68ed542f338e/mips/db1xxx_defconfig/build.log

Please re-submit a new version fixing the problem.

Kind regards
Uffe

> ---
>  drivers/mmc/host/au1xmmc.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
> index ed77fbfa4774..ecd0fd427ed6 100644
> --- a/drivers/mmc/host/au1xmmc.c
> +++ b/drivers/mmc/host/au1xmmc.c
> @@ -40,6 +40,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/scatterlist.h>
> +#include <linux/highmem.h>
>  #include <linux/leds.h>
>  #include <linux/mmc/host.h>
>  #include <linux/slab.h>
> @@ -405,7 +406,7 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host)
>
>         /* This is the pointer to the data buffer */
>         sg = &data->sg[host->pio.index];
> -       sg_ptr = sg_virt(sg) + host->pio.offset;
> +       sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset;
>
>         /* This is the space left inside the buffer */
>         sg_len = data->sg[host->pio.index].length - host->pio.offset;
> @@ -421,11 +422,12 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host)
>                 if (!(status & SD_STATUS_TH))
>                         break;
>
> -               val = *sg_ptr++;
> +               val = sg_ptr[count];
>
>                 __raw_writel((unsigned long)val, HOST_TXPORT(host));
>                 wmb(); /* drain writebuffer */
>         }
> +       kunmap(sg_ptr);
>
>         host->pio.len -= count;
>         host->pio.offset += count;
> @@ -462,7 +464,7 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host)
>
>         if (host->pio.index < host->dma.len) {
>                 sg = &data->sg[host->pio.index];
> -               sg_ptr = sg_virt(sg) + host->pio.offset;
> +               sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset;
>
>                 /* This is the space left inside the buffer */
>                 sg_len = sg_dma_len(&data->sg[host->pio.index]) - host->pio.offset;
> @@ -501,8 +503,10 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host)
>                 val = __raw_readl(HOST_RXPORT(host));
>
>                 if (sg_ptr)
> -                       *sg_ptr++ = (unsigned char)(val & 0xFF);
> +                       sg_ptr[count] = (unsigned char)(val & 0xFF);
>         }
> +       if (sg_ptr)
> +               kunmap_atomic(sg_ptr);
>
>         host->pio.len -= count;
>         host->pio.offset += count;
> --
> 2.17.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig May 21, 2018, 3:38 p.m. UTC | #2
On Mon, May 21, 2018 at 03:55:38PM +0200, Ulf Hansson wrote:
> On 18 May 2018 at 19:18, Christoph Hellwig <hch@lst.de> wrote:
> > Use kmap_atomic to map the scatterlist entry before using it.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Christoph,
> 
> I needed to drop this one as it caused a compiler error, reported by kernelci.
> 
> https://storage.kernelci.org/ulfh/next/sdhci-omap-v4.17-rc3-83-g68ed542f338e/mips/db1xxx_defconfig/build.log
> 
> Please re-submit a new version fixing the problem.

Sure, will do.  For some reason I never got a buildbot report for this
one.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index ed77fbfa4774..ecd0fd427ed6 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -40,6 +40,7 @@ 
 #include <linux/interrupt.h>
 #include <linux/dma-mapping.h>
 #include <linux/scatterlist.h>
+#include <linux/highmem.h>
 #include <linux/leds.h>
 #include <linux/mmc/host.h>
 #include <linux/slab.h>
@@ -405,7 +406,7 @@  static void au1xmmc_send_pio(struct au1xmmc_host *host)
 
 	/* This is the pointer to the data buffer */
 	sg = &data->sg[host->pio.index];
-	sg_ptr = sg_virt(sg) + host->pio.offset;
+	sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset;
 
 	/* This is the space left inside the buffer */
 	sg_len = data->sg[host->pio.index].length - host->pio.offset;
@@ -421,11 +422,12 @@  static void au1xmmc_send_pio(struct au1xmmc_host *host)
 		if (!(status & SD_STATUS_TH))
 			break;
 
-		val = *sg_ptr++;
+		val = sg_ptr[count];
 
 		__raw_writel((unsigned long)val, HOST_TXPORT(host));
 		wmb(); /* drain writebuffer */
 	}
+	kunmap(sg_ptr);
 
 	host->pio.len -= count;
 	host->pio.offset += count;
@@ -462,7 +464,7 @@  static void au1xmmc_receive_pio(struct au1xmmc_host *host)
 
 	if (host->pio.index < host->dma.len) {
 		sg = &data->sg[host->pio.index];
-		sg_ptr = sg_virt(sg) + host->pio.offset;
+		sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset;
 
 		/* This is the space left inside the buffer */
 		sg_len = sg_dma_len(&data->sg[host->pio.index]) - host->pio.offset;
@@ -501,8 +503,10 @@  static void au1xmmc_receive_pio(struct au1xmmc_host *host)
 		val = __raw_readl(HOST_RXPORT(host));
 
 		if (sg_ptr)
-			*sg_ptr++ = (unsigned char)(val & 0xFF);
+			sg_ptr[count] = (unsigned char)(val & 0xFF);
 	}
+	if (sg_ptr)
+		kunmap_atomic(sg_ptr);
 
 	host->pio.len -= count;
 	host->pio.offset += count;