@@ -659,7 +659,7 @@ mmc_omap_sg_to_buf(struct mmc_omap_host *host)
sg = host->data->sg + host->sg_idx;
host->buffer_bytes_left = sg->length;
- host->buffer = sg_virt(sg);
+ host->buffer = kmap_local_page(sg_page(sg));
if (host->buffer_bytes_left > host->total_bytes_left)
host->buffer_bytes_left = host->total_bytes_left;
}
@@ -691,6 +691,11 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
nwords = DIV_ROUND_UP(n, 2);
host->buffer_bytes_left -= n;
+ if (host->buffer_bytes_left == 0) {
+ kunmap_local(host->buffer);
+ host->buffer = NULL;
+ }
+
host->total_bytes_left -= n;
host->data->bytes_xfered += n;
Use kmap_local_page() instead of sg_virt() to obtain a page from the scatterlist: sg_virt() will not perform 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/omap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)