From: Adrian Hunter <adrian.hunter@intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
Ming Lei <ming.lei@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
Nicolas Pitre <nico@fluxnic.net>,
Aaro Koskinen <aaro.koskinen@iki.fi>,
Angelo Dureghello <angelo.dureghello@timesys.com>
Cc: linux-mmc@vger.kernel.org, linux-block@vger.kernel.org,
linux-omap@vger.kernel.org
Subject: Re: [PATCH v2 8/9] mmc: sdhci-esdhc-mcf: Use sg_miter for swapping
Date: Wed, 21 Feb 2024 08:30:50 +0200 [thread overview]
Message-ID: <3aa092fd-177f-453e-abce-a53cd28c11e6@intel.com> (raw)
In-Reply-To: <20240127-mmc-proper-kmap-v2-8-d8e732aa97d1@linaro.org>
On 27/01/24 02:19, Linus Walleij wrote:
> Use sg_miter iterator instead of sg_virt() and custom code
> to loop over the scatterlist. The memory iterator will do
> bounce buffering if the page happens to be located in high memory,
> which the driver may or may not be using.
>
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/linux-mmc/20240122073423.GA25859@lst.de/
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/mmc/host/sdhci-esdhc-mcf.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-mcf.c b/drivers/mmc/host/sdhci-esdhc-mcf.c
> index a07f8333cd6b..1909a11fd065 100644
> --- a/drivers/mmc/host/sdhci-esdhc-mcf.c
> +++ b/drivers/mmc/host/sdhci-esdhc-mcf.c
> @@ -299,9 +299,8 @@ static void esdhc_mcf_pltfm_set_bus_width(struct sdhci_host *host, int width)
> static void esdhc_mcf_request_done(struct sdhci_host *host,
> struct mmc_request *mrq)
> {
> - struct scatterlist *sg;
> + struct sg_mapping_iter sgm;
> u32 *buffer;
> - int i;
>
> if (!mrq->data || !mrq->data->bytes_xfered)
> goto exit_done;
> @@ -313,10 +312,13 @@ static void esdhc_mcf_request_done(struct sdhci_host *host,
> * On mcf5441x there is no hw sdma option/flag to select the dma
> * transfer endiannes. A swap after the transfer is needed.
> */
> - for_each_sg(mrq->data->sg, sg, mrq->data->sg_len, i) {
> - buffer = (u32 *)sg_virt(sg);
> - esdhc_mcf_buffer_swap32(buffer, sg->length);
> + sg_miter_start(&sgm, mrq->data->sg, mrq->data->sg_len,
> + SG_MITER_TO_SG | SG_MITER_FROM_SG);
Could be called from atomic context, so probably needs
SG_MITER_ATOMIC
> + while (sg_miter_next(&sgm)) {
> + buffer = sgm.addr;
> + esdhc_mcf_buffer_swap32(buffer, sgm.length);
> }
> + sg_miter_stop(&sgm);
>
> exit_done:
> mmc_request_done(host->mmc, mrq);
>
next prev parent reply other threads:[~2024-02-21 6:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-27 0:19 [PATCH v2 0/9] mmc: Use proper sg_miter for scatterlists Linus Walleij
2024-01-27 0:19 ` [PATCH v2 1/9] mmc: davinci_mmc: Use sg_miter for PIO Linus Walleij
2024-01-27 0:19 ` [PATCH v2 2/9] mmc: moxart-mmc: Factor out moxart_use_dma() helper Linus Walleij
2024-01-27 0:19 ` [PATCH v2 3/9] mmc: moxart-mmc: Fix accounting in DMA transfer Linus Walleij
2024-01-27 0:19 ` [PATCH v2 4/9] mmc: moxart-mmc: Use sg_miter for PIO Linus Walleij
2024-01-27 0:19 ` [PATCH v2 5/9] mmc: mvsdio: " Linus Walleij
2024-01-27 0:19 ` [PATCH v2 6/9] mmc: mxcmmc: " Linus Walleij
2024-01-27 0:19 ` [PATCH v2 7/9] mmc: omap: " Linus Walleij
2024-01-27 0:19 ` [PATCH v2 8/9] mmc: sdhci-esdhc-mcf: Use sg_miter for swapping Linus Walleij
2024-02-21 6:30 ` Adrian Hunter [this message]
2024-01-27 0:19 ` [PATCH v2 9/9] mmc: sh_mmcif: Use sg_miter for PIO Linus Walleij
2024-02-20 21:03 ` Geert Uytterhoeven
2024-02-20 23:00 ` Linus Walleij
2024-02-21 9:50 ` Geert Uytterhoeven
2024-02-21 21:25 ` Linus Walleij
2024-02-22 9:20 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3aa092fd-177f-453e-abce-a53cd28c11e6@intel.com \
--to=adrian.hunter@intel.com \
--cc=aaro.koskinen@iki.fi \
--cc=angelo.dureghello@timesys.com \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linus.walleij@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=nico@fluxnic.net \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox