From: Ping Li <leeonion.muyu@gmail.com>
To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Ping Li <leeonion.muyu@gmail.com>
Subject: [PATCH v2 1/3] mtd: rawnand: intel: declare NAND_USES_DMA
Date: Mon, 23 Nov 2026 15:04:38 +0800 [thread overview]
Message-ID: <20261123070440.3060882-2-leeonion.muyu@gmail.com> (raw)
In-Reply-To: <20261123070440.3060882-1-leeonion.muyu@gmail.com>
ebu_nand_read_page_hwecc()/ebu_nand_write_page_hwecc() feed the
page buffers provided by the NAND core straight to the DMA
engine, but the driver never declares NAND_USES_DMA. Because of
this, nand_base cannot know the controller DMAs these buffers and
never bounces non-linear-map ones (see the use_bounce_buf logic
in nand_do_read_ops()/nand_do_write_ops()).
Non-linear-map buffers are not hypothetical here: mtdblock's
write cache is vmalloc'ed and UBIFS passes vmalloc'ed LPT buffers,
so such buffers can reach the controller's DMA engine, for which
they are not a valid dma_map_single() input.
Declare NAND_USES_DMA so that nand_base bounces non-linear-map
buffers through chip->data_buf, as the other DMA-capable
controllers (arasan, denali, meson, mtk, nuvoton...) already do.
Fixes: 0b1039f016e8a ("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
Signed-off-by: Ping Li <leeonion.muyu@gmail.com>
---
drivers/mtd/nand/raw/intel-nand-controller.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c
index cfb4b231e067..1f493fb426d6 100644
--- a/drivers/mtd/nand/raw/intel-nand-controller.c
+++ b/drivers/mtd/nand/raw/intel-nand-controller.c
@@ -688,6 +688,7 @@ static int ebu_nand_probe(struct platform_device *pdev)
nand = &ebu_host->chip;
nand->controller = &ebu_host->controller;
nand->controller->ops = &ebu_nand_controller_ops;
+ nand->options |= NAND_USES_DMA;
/* Scan to find existence of the device */
ret = nand_scan(&ebu_host->chip, 1);
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-11-23 7:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 5:50 [PATCH 0/3] mtd: rawnand: protect DMA engines from vmalloc'd buffers ping.li
2026-11-23 5:50 ` [PATCH 1/3] mtd: rawnand: fsmc: declare NAND_USES_DMA ping.li
2026-11-23 6:01 ` sashiko-bot
2026-11-23 7:04 ` Ping Li
2026-11-23 5:50 ` [PATCH 2/3] mtd: rawnand: intel: " ping.li
2026-11-23 6:01 ` sashiko-bot
2026-11-23 5:50 ` [PATCH 3/3] mtd: rawnand: r852: bounce non-linear-map buffers ping.li
2026-11-23 7:04 ` [PATCH v2 0/3] mtd: rawnand: protect DMA engines from vmalloc'd buffers Ping Li
2026-11-23 7:04 ` Ping Li [this message]
2026-11-23 7:04 ` [PATCH v2 2/3] mtd: rawnand: intel: unmap the DMA buffer in ebu_dma_start() Ping Li
2026-11-23 7:04 ` [PATCH v2 3/3] mtd: rawnand: r852: bounce non-linear-map buffers Ping Li
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=20261123070440.3060882-2-leeonion.muyu@gmail.com \
--to=leeonion.muyu@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/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