Re: [PATCH 05/11] mmc: s3cmci: handle highmem pages

2019-01-30 Thread Ulf Hansson
On Wed, 30 Jan 2019 at 09:04, Christoph Hellwig  wrote:
>
> On Wed, Jan 30, 2019 at 08:57:47AM +0100, Ulf Hansson wrote:
> > On Mon, 14 Jan 2019 at 10:58, Christoph Hellwig  wrote:
> > >
> > > Instead of setting up a kernel pointer to track the current PIO address,
> > > track the offset in the current page, and do an atomic kmap for the page
> > > while doing the actual PIO operations.
> > >
> > > Signed-off-by: Christoph Hellwig 
> >
> > Nitpick: This one have some trailing whitespace errors, which git
> > complains about when I apply it.
> >
> > No need to re-spin due to this, I can fix it  up.
>
> I'll need to respin to limit the segment size to a page anyway, so I
> will take this into account as well for v2.

Okay!

FYI, I have no further comment on the series, it looks okay to me!

Kind regards
Uffe
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 05/11] mmc: s3cmci: handle highmem pages

2019-01-30 Thread Christoph Hellwig
On Wed, Jan 30, 2019 at 08:57:47AM +0100, Ulf Hansson wrote:
> On Mon, 14 Jan 2019 at 10:58, Christoph Hellwig  wrote:
> >
> > Instead of setting up a kernel pointer to track the current PIO address,
> > track the offset in the current page, and do an atomic kmap for the page
> > while doing the actual PIO operations.
> >
> > Signed-off-by: Christoph Hellwig 
> 
> Nitpick: This one have some trailing whitespace errors, which git
> complains about when I apply it.
> 
> No need to re-spin due to this, I can fix it  up.

I'll need to respin to limit the segment size to a page anyway, so I
will take this into account as well for v2.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 05/11] mmc: s3cmci: handle highmem pages

2019-01-29 Thread Ulf Hansson
On Mon, 14 Jan 2019 at 10:58, Christoph Hellwig  wrote:
>
> Instead of setting up a kernel pointer to track the current PIO address,
> track the offset in the current page, and do an atomic kmap for the page
> while doing the actual PIO operations.
>
> Signed-off-by: Christoph Hellwig 

Nitpick: This one have some trailing whitespace errors, which git
complains about when I apply it.

No need to re-spin due to this, I can fix it  up.

Kind regards
Uffe

> ---
>  drivers/mmc/host/s3cmci.c | 107 +++---
>  drivers/mmc/host/s3cmci.h |   3 +-
>  2 files changed, 55 insertions(+), 55 deletions(-)
>
> diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
> index 10f5219b3b40..1be84426c817 100644
> --- a/drivers/mmc/host/s3cmci.c
> +++ b/drivers/mmc/host/s3cmci.c
> @@ -15,6 +15,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -317,26 +318,17 @@ static void s3cmci_check_sdio_irq(struct s3cmci_host 
> *host)
> }
>  }
>
> -static inline int get_data_buffer(struct s3cmci_host *host,
> - u32 *bytes, u32 **pointer)
> +static inline int get_data_buffer(struct s3cmci_host *host)
>  {
> -   struct scatterlist *sg;
> -
> -   if (host->pio_active == XFER_NONE)
> -   return -EINVAL;
> -
> -   if ((!host->mrq) || (!host->mrq->data))
> -   return -EINVAL;
> -
> if (host->pio_sgptr >= host->mrq->data->sg_len) {
> dbg(host, dbg_debug, "no more buffers (%i/%i)\n",
>   host->pio_sgptr, host->mrq->data->sg_len);
> return -EBUSY;
> }
> -   sg = >mrq->data->sg[host->pio_sgptr];
> +   host->cur_sg = >mrq->data->sg[host->pio_sgptr];
>
> -   *bytes = sg->length;
> -   *pointer = sg_virt(sg);
> +   host->pio_bytes = host->cur_sg->length;
> +   host->pio_offset = host->cur_sg->offset;
>
> host->pio_sgptr++;
>
> @@ -422,11 +414,16 @@ static void s3cmci_disable_irq(struct s3cmci_host 
> *host, bool transfer)
>
>  static void do_pio_read(struct s3cmci_host *host)
>  {
> -   int res;
> u32 fifo;
> u32 *ptr;
> u32 fifo_words;
> void __iomem *from_ptr;
> +   void *buf;
> +
> +   if (host->pio_active == XFER_NONE)
> +   goto done;
> +   if (!host->mrq || !host->mrq->data)
> +   goto done;
>
> /* write real prescaler to host, it might be set slow to fix */
> writel(host->prescaler, host->base + S3C2410_SDIPRE);
> @@ -435,20 +432,12 @@ static void do_pio_read(struct s3cmci_host *host)
>
> while ((fifo = fifo_count(host))) {
> if (!host->pio_bytes) {
> -   res = get_data_buffer(host, >pio_bytes,
> - >pio_ptr);
> -   if (res) {
> -   host->pio_active = XFER_NONE;
> -   host->complete_what = COMPLETION_FINALIZE;
> -
> -   dbg(host, dbg_pio, "pio_read(): "
> -   "complete (no more data).\n");
> -   return;
> -   }
> +   if (get_data_buffer(host) < 0)
> +   goto done;
>
> dbg(host, dbg_pio,
> -   "pio_read(): new target: [%i]@[%p]\n",
> -   host->pio_bytes, host->pio_ptr);
> +   "pio_read(): new target: [%i]@[%zu]\n",
> +   host->pio_bytes, host->pio_offset);
> }
>
> dbg(host, dbg_pio,
> @@ -470,63 +459,65 @@ static void do_pio_read(struct s3cmci_host *host)
> host->pio_count += fifo;
>
> fifo_words = fifo >> 2;
> -   ptr = host->pio_ptr;
> -   while (fifo_words--)
> +
> +   buf = (kmap_atomic(sg_page(host->cur_sg)) + host->pio_offset);
> +   ptr = buf;
> +   while (fifo_words--) {
> *ptr++ = readl(from_ptr);
> -   host->pio_ptr = ptr;
> +   host->pio_offset += 4;
> +   }
>
> if (fifo & 3) {
> u32 n = fifo & 3;
> u32 data = readl(from_ptr);
> -   u8 *p = (u8 *)host->pio_ptr;
> +   u8 *p = (u8 *)ptr;
>
> while (n--) {
> *p++ = data;
> data >>= 8;
> +   host->pio_offset++;
> }
> }
> +   kunmap_atomic(buf);
> }
>
> if (!host->pio_bytes) {
> -   res = get_data_buffer(host, >pio_bytes, >pio_ptr);
> -   if (res) {
> -   dbg(host, dbg_pio,
> -