Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Orgad Shaneh" <orgads@gmail.com>,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	tsbogend@alpha.franken.de
Cc: linux-mtd@lists.infradead.org, linusw@kernel.org,
	kaloz@kernel.org, ulli.kroll@googlemail.com, john@phrozen.org,
	nico@fluxnic.net, dwmw2@infradead.org, corbet@lwn.net
Subject: Re: [PATCH v4 4/4] MIPS: Octeon: flash: use the simple map accessors without a shared eMMC
Date: Tue, 17 Nov 2026 22:06:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-219726@kernel.org> (raw)
In-Reply-To: <20261117214141.3826637-5-orgads@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] MIPS: Octeon: flash: simple_map_init() breaks little-endian
  mtd_point()
--

commit 56e2d356f36cb97dd336d231b8f3f9d7b285369c
Author: Orgad Shaneh <orgads@gmail.com>

MIPS: Octeon: flash: use the simple map accessors without a shared eMMC

This commit checks whether the boot bus is shared with a
"cavium,octeon-6130-mmc" device node and calls simple_map_init() when it
is not, while checking map_bankwidth_supported() before mapping the
flash.

> diff --git a/arch/mips/cavium-octeon/flash_setup.c b/arch/mips/cavium-octeon/flash_setup.c
> index 0e5652fc0c2ef..62612cd75d1b0 100644
> --- a/arch/mips/cavium-octeon/flash_setup.c
> +++ b/arch/mips/cavium-octeon/flash_setup.c

[ ... ]

> @@ -107,11 +124,20 @@ static int octeon_flash_probe(struct platform_device *pdev)
>  			return -ENOMEM;
>  		pr_notice("Bootbus flash: Setting flash for %luMB flash at "
>  			  "0x%08llx\n", map->size >> 20, map->phys);
> -		WARN_ON(!map_bankwidth_supported(map->bankwidth));
> -		map->read = octeon_flash_map_read;
> -		map->write = octeon_flash_map_write;
> -		map->copy_from = octeon_flash_map_copy_from;
> -		map->copy_to = octeon_flash_map_copy_to;
> +		/*
> +		 * The boot bus semaphore only serializes the flash against
> +		 * an eMMC host that shares the bus (the CIU3 parts have
> +		 * their own). Without one, use the simple accessors: they
> +		 * let MTD point at the flash, so jffs2 scans it in place.
> +		 */
> +		if (octeon_flash_bus_shared()) {
> +			map->read = octeon_flash_map_read;
> +			map->write = octeon_flash_map_write;
> +			map->copy_from = octeon_flash_map_copy_from;
> +			map->copy_to = octeon_flash_map_copy_to;
> +		} else {
> +			simple_map_init(map);
> +		}

[Severity: Medium]
Does calling simple_map_init(map) break mtd_point() on little-endian
Octeon kernels (CONFIG_CPU_LITTLE_ENDIAN=y)?

On Octeon, the boot bus is wired big-endian into the 64-bit IOB, so
sub-64-bit MMIO accesses under __LITTLE_ENDIAN require address swizzling:

arch/mips/include/asm/mach-cavium-octeon/mangle-port.h:
# define __swizzle_addr_b(port)	\
	(__should_swizzle_addr(port) ? (port) ^ 7 : (port))
# define __swizzle_addr_w(port)	\
	(__should_swizzle_addr(port) ? (port) ^ 6 : (port))
# define __swizzle_addr_l(port)	\
	(__should_swizzle_addr(port) ? (port) ^ 4 : (port))

inline_map_read() and inline_map_write() go through __raw_readb()/w() and
__raw_writeb()/w(), which apply those swizzles.  Marking the map as simple
causes cfi_cmdset_0001 and cfi_cmdset_0002 to wire up mtd->_point, so
callers such as JFFS2 directly dereference map->virt + ofs with normal CPU
loads and read scrambled flash offsets.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117214141.3826637-1-orgads@gmail.com?part=4

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2026-11-17 22:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 21:41 [PATCH v4 0/4] mtd: point() for cfi_cmdset_0002, on simple maps only Orgad Shaneh
2026-11-17 21:41 ` [PATCH v4 1/4] mtd: maps: only point() maps read through the simple accessors Orgad Shaneh
2026-11-17 21:41 ` [PATCH v4 2/4] mtd: cfi_cmdset_0002: implement point() for simple linear maps Orgad Shaneh
2026-11-17 21:57   ` sashiko-bot
2026-11-17 22:06     ` Orgad Shaneh
2026-11-17 21:41 ` [PATCH v4 3/4] MIPS: Octeon: flash: allocate the map per device Orgad Shaneh
2026-11-17 21:50   ` sashiko-bot
2026-11-17 22:06     ` Orgad Shaneh
2026-11-17 21:41 ` [PATCH v4 4/4] MIPS: Octeon: flash: use the simple map accessors without a shared eMMC Orgad Shaneh
2026-11-17 22:06   ` sashiko-bot [this message]

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=sashiko-outbox-219726@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dwmw2@infradead.org \
    --cc=john@phrozen.org \
    --cc=kaloz@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=nico@fluxnic.net \
    --cc=orgads@gmail.com \
    --cc=richard@nod.at \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tsbogend@alpha.franken.de \
    --cc=ulli.kroll@googlemail.com \
    --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