From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796008164; b=2n819Ix0t3uFIO+oD4tlnqiEwOVo5KvEpY+WHo+k021GnTFptExR6GZJbygrIz6suaJh i/F86Tr3gBsPMo0xn5D/gqqzRC3Itvx9XybATysNCkzMbP8YXNaACGJRxoUIRHHPJ+BA7 g05i74qcNoPjcfvd9IGR77ig3HcpSI8ikAkVohLk767hVeWq8kHPA6Fqvp6doN5idUbfj NIdiqZeuBxcWvxNfkL061KHlK+alzv+I34c4Ta38nh4BEoYe5tJVt9hN267vEApqa+5hJ aj5lummrU+SxNzb1BNsMogjG/DjPuoBHuQrUwMhbZj6I5/WAaOX89KIrETaEQ2cY0Ug== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796008164; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=tHCsg+pBF3XGhOv/XDn3xpG9PwsZWd3v5dOstsd8teU=; b=xuJ6mxGv3L7lUXwprcidPAEnJWib6AQfhkH2Cbn8dadJZu7iHbKA1MJHatUXpWC1jGcI R1xeMlL/CKl+At/KNnxqEaWlc+ov9NGt1NCVgp+CKi0jVAEaTL8yu3LC++3tyTLX5Qx8U 9KpN9SsWQZKcf07kOmyItm9N0Xr307KPw7n98nLZ/cS7B3bHyXsN5F/ILCI8aTIA2IEdJ 9VAW0ljbxOuhoFqN0Py0cT8GZOQAei8noW5FYmhiDIOhtSiOeBMmsCm9r0XKMOVy9emRd f6z9QeUtZ7P7jZCQmNpvSCMFYLyn1b5gthpVlqfLCKdKF8mVzVpB64cuZFcMNuGb1lQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GGmZmWH2; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F1D6606A335 for ; Mon, 30 Nov 2026 03:09:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GGmZmWH2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A45701F00896; Mon, 30 Nov 2026 03:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796008163; bh=tHCsg+pBF3XGhOv/XDn3xpG9PwsZWd3v5dOstsd8teU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=GGmZmWH2mmIBrnEDXh5ZdyKK6zaCxbDB46X+B+HkhWhKnNraB2eXgAxnl4xgazLwW Hubcow6YSJ/7VBudkcX2D99EOVb+vnlPqD3WCkKFd9ie6cvlIcXMFm1DqXv3hkFxm/ cL29/r70df/jcWWQxkz9V/WdgyO+0jcCErr6tU7M1Y90sPtUhoGmkvX/hGwDhN3Sh0 yfbnPEShKzTKIQSjy5HEiSUIz5elZewCuXCEFImJEoJrtlIZzSThnY90F8p4qvOliG zVNhcl+j33i9gFKmP22QQA2EAjC9Tx/uajhLev7olYhhglP9sn9D0hpoHdcyJ2ms6A MIF2BMpIZ4vSg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 5/5] spi: dw-g2: Add support for memory-mapped XIP Reply-To: sashiko-reviews@lists.linux.dev To: "Prakriti Sharma" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <8845ded246694877df046ab21efbe1ef4bad50e9.1795683279.git.prakriti@synopsys.com> References: <8845ded246694877df046ab21efbe1ef4bad50e9.1795683279.git.prakriti@synopsys.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 03:09:23 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 8 potential issues to consider: - [High] spi: dw-g2: broken non-XIP fallback in dw_spi_g2_dirmap_read() - [High] spi: dw-g2: broken byte-by-byte XIP writes in dw_spi_g2_dirmap_write() - [Medium] spi: dw-g2: unchecked dw_spi_g2_wait_idle() and missing SR_TFE check - [Medium] spi: dw-g2: missing SPI_CPOL and SPI_CPHA in dw_spi_g2_build_ctrlr0() - [Medium] spi: dw-g2: unlocked sysfs XIP state updates and stale flags on disable - [Medium] spi: dw-g2: hidden CS toggling in dw_spi_g2_dirmap_read() breaks NAND cont read - [Low] spi: dw-g2: shadowed ret declaration in dw_spi_g2_dirmap_read() - [Low] spi: dw-g2: false timeout in dw_spi_g2_dirmap_write_nor_xip() WIP poll -- commit 429c9f081b444c98b1718b411f07b7d5c936d4a9 Author: Prakriti Sharma spi: dw-g2: Add support for memory-mapped XIP This commit adds spi-mem direct mapping support for memory-mapped XIP access along with device tree and sysfs controls for XIP, continuous, and prefetch modes. > diff --git a/drivers/spi/spi-dw-g2-core.c b/drivers/spi/spi-dw-g2-core.c > index f50dcfe2d854c..972690cf47b9f 100644 > --- a/drivers/spi/spi-dw-g2-core.c > +++ b/drivers/spi/spi-dw-g2-core.c [ ... ] > @@ -1061,6 +1114,634 @@ static int dw_spi_g2_indirect_write(struct dw_spi= _g2 *dws, > return ret; > } > =20 [ ... ] > +int dw_spi_g2_dirmap_create(struct spi_mem_dirmap_desc *desc) > +{ > + struct spi_device *spi =3D desc->mem->spi; > + struct dw_spi_g2 *dws =3D spi_controller_get_devdata(spi->controller); > + const struct spi_mem_op *op =3D desc->info.op_tmpl; > + u32 ctrlr0; > + int ret; > + > + if (!dws->xip_mem) { > + dev_dbg(dws->dev, "XIP memory region not available\n"); > + return -EOPNOTSUPP; > + } > + > + dws->cs =3D spi_get_chipselect(spi, 0); > + dws->curr_spi =3D spi; > + > + if (dws->cs >=3D DW_SPI_G2_MAX_CS) > + return -EINVAL; > + > + if (!dw_spi_g2_supports_mem_ops(desc->mem, op)) > + return -EOPNOTSUPP; > + > + if (desc->info.offset >=3D dws->xip_len || > + desc->info.length > dws->xip_len - desc->info.offset) > + return -EINVAL; > + > + dev_dbg(dws->dev, "dirmap_create: cmd=3D0x%02x addr_width=3D%u dir=3D%s= dummy=3D%u\n", > + op->cmd.opcode, op->addr.nbytes, > + op->data.dir =3D=3D SPI_MEM_DATA_IN ? "READ" : "WRITE", > + op->dummy.nbytes); > + > + /* > + * Configure CTRLR0 with data frame size and SPI mode settings. > + * XIP mode uses these settings for all memory-mapped accesses. > + */ > + dw_spi_g2_enable(dws, false); > + dw_spi_g2_target_disable(dws, dws->cs); > + > + ctrlr0 =3D dw_spi_g2_build_ctrlr0(dws, DW_SPI_G2_CTRLR0_TMOD_TR, > + DW_SPI_G2_FRF_STANDARD); > + dw_spi_g2_writel(dws->regs, DW_SPI_G2_CTRLR0(dws->cs), ctrlr0); [Severity: Medium] Does dw_spi_g2_build_ctrlr0() omit SPI_CPOL and SPI_CPHA when programming DW_SPI_G2_CTRLR0? dw_spi_g2_init() advertises SPI_CPOL | SPI_CPHA in ctlr->mode_bits, and dw_spi_g2_transfer_one() manually ORs DW_SPI_G2_CTRLR0_SCPOL and DW_SPI_G2_CTRLR0_SCPHA into ctrlr0, but dw_spi_g2_build_ctrlr0() itself only sets DFS, TMOD, and FRF. As a result, dw_spi_g2_dirmap_create(), dw_spi_g2_dirmap_read(), dw_spi_g2_dirmap_write_nor_xip(), dw_spi_g2_dirmap_write(), and the indirect spi-mem setup helpers always configure CTRLR0 for SPI Mode 0, breaking flashes configured for SPI Mode 1, 2, or 3. > + > + /* Configure XIP registers for read/write operations */ > + ret =3D dw_spi_g2_xip_setup(dws, op, > + op->data.dir =3D=3D SPI_MEM_DATA_OUT); > + /* > + * xip_setup enables the target (sets BIT(cs) in > + * DEDICATED_CS_EN) to program per-CS registers. > + * Clean it up so stale bits don't leak into > + * cmd_only / reg_op operations on other CS lines. > + * dirmap_read/write will re-enable when needed. > + */ > + dw_spi_g2_target_disable(dws, dws->cs); > + return ret; > +} > + > +/** > + * dw_spi_g2_dirmap_read - Direct memory-mapped read from flash > + * @desc: Direct mapping descriptor > + * @offs: Offset within the mapped region > + * @len: Number of bytes to read > + * @buf: Destination buffer > + * > + * Performs direct memory-mapped read using XIP mode. The controller > + * automatically sends the configured command and address for each acces= s. > + * Supports 8/16/32-bit data frame sizes for optimal performance. > + * > + * Return: Number of bytes read on success, negative error code on failu= re > + */ > +ssize_t dw_spi_g2_dirmap_read(struct spi_mem_dirmap_desc *desc, > + u64 offs, size_t len, void *buf) > +{ > + struct spi_device *spi =3D desc->mem->spi; > + struct dw_spi_g2 *dws =3D spi_controller_get_devdata(spi->controller); > + u8 __iomem *src; > + u32 ctrlr0; > + int ret; > + > + dws->cs =3D spi_get_chipselect(spi, 0); > + dws->curr_spi =3D spi; > + > + if (dw_spi_g2_dirmap_check_bounds(desc, dws, offs, len)) > + return -EINVAL; > + > + if (!dws->use_xip) { > + struct spi_mem_op op =3D *desc->info.op_tmpl; > + size_t chunk, done =3D 0; > + unsigned int dummy_shift =3D 0; > + int ret; [Severity: Low] This isn't a bug, but the inner declaration of ret shadows the outer ret variable declared at the start of dw_spi_g2_dirmap_read(), which triggers a -Wshadow warning. > + > + /* > + * Fold dummy bytes into the address field when RO mode is used > + * without the XIP engine. Plain RO with WAIT_CYCLES > 0 can > + * leave the RX FIFO empty; XIP uses WAIT_CYCLES normally. > + */ > + if (op.dummy.nbytes) { > + if (op.addr.nbytes + op.dummy.nbytes > 4) > + return -EOPNOTSUPP; > + dummy_shift =3D op.dummy.nbytes * 8; > + op.addr.nbytes +=3D op.dummy.nbytes; > + op.dummy.nbytes =3D 0; > + } [Severity: High] Does returning -EOPNOTSUPP here break flash reads whenever the XIP memory resource is mapped in DT without snps,xip-enabled (or after xip_mode is disabled via sysfs)? dw_spi_g2_dirmap_create() succeeds whenever dws->xip_mem is present, which leaves desc->nodirmap false. When spi_mem_dirmap_read() then calls dw_spi_g2_dirmap_read(), it propagates errors directly without falling back to spi_mem_no_dirmap_read(): drivers/spi/spi-mem.c:spi_mem_dirmap_read() { ... if (desc->nodirmap) { ret =3D spi_mem_no_dirmap_read(desc, offs, len, buf); } else if (ctlr->mem_ops && ctlr->mem_ops->dirmap_read) { ret =3D spi_mem_access_start(desc->mem); if (ret) return ret; ret =3D ctlr->mem_ops->dirmap_read(desc, offs, len, buf); spi_mem_access_end(desc->mem); ... } Because op.addr.nbytes + op.dummy.nbytes exceeds 4 for any 4-byte-addressed read with dummy cycles, as well as 3-byte 1-2-2/1-4-4/1-8-8 reads and 2-byte 1-4-4 SPI-NAND reads, all such reads fail with -EOPNOTSUPP when dws->use_xip is false. Even when op.addr.nbytes + op.dummy.nbytes <=3D 4, folding dummy bytes into op.addr.nbytes actively drives 0x00 on the bus instead of tri-stating via WAIT_CYCLES, miscalculates the dummy clock count whenever op.dummy.buswidth !=3D op.addr.buswidth, and sends 1-1-1 reads through TMOD_RO enhanced framing instead of TMOD_TR. > + > + while (done < len) { > + chunk =3D min_t(size_t, len - done, dws->fifo_len); > + > + op.addr.val =3D (u64)(desc->info.offset + offs + done) > + << dummy_shift; > + op.data.nbytes =3D chunk; > + op.data.buf.in =3D (u8 *)buf + done; > + > + ret =3D dw_spi_g2_indirect_read(dws, &op); > + if (ret) > + return ret; > + > + done +=3D chunk; > + } > + > + return (ssize_t)len; > + } [Severity: Medium] Can this chunking loop corrupt multi-page SPI-NAND continuous reads by toggling CS between FIFO chunks while returning the full len? As noted in dw_spi_g2_adjust_mem_op_size(), SPI-NAND continuous reads forbid toggling CS mid-transfer. In spinand_read_from_cache_op(), the caller detects CS toggling only when spi_mem_dirmap_read() returns a partial byte count (ret < nbytes), at which point it sets cont_read_possible =3D false and retries with -EAGAIN. Because dw_spi_g2_mem_caps does not set .no_cs_assertion =3D true, flashes that enable continuous read via a configuration register without a separate cont_read_cache opcode template (such as Macronix MX35LF2GE4AD) use dirmap for continuous reads. Looping over dw_spi_g2_indirect_read() in FIFO-sized chunks (or toggling CS between AHB bursts in XIP mode when !dws->xip_continuous_mode) deasserts CS mid-page while returning len, bypassing spinand's fallback check. [ ... ] > +static ssize_t dw_spi_g2_dirmap_write_nor_xip(struct dw_spi_g2 *dws, > + struct spi_mem_dirmap_desc *desc, > + u64 offs, size_t len, > + const void *buf) > +{ [ ... ] > + sr1 =3D 0; > + deadline =3D jiffies + > + msecs_to_jiffies(DW_SPI_G2_NOR_WIP_TIMEOUT_MS); > + do { > + ret =3D dw_spi_g2_reg_op(dws, &rdsr_op); > + if (ret) { > + dev_err(dws->dev, > + "XIP NOR write: WIP poll failed at byte %zu: %d\n", > + i, ret); > + result =3D ret; > + goto out_unwind; > + } > + if (!(sr1 & DW_SPI_G2_NOR_SR1_WIP)) > + break; > + if (time_after(jiffies, deadline)) { > + dev_err(dws->dev, > + "XIP NOR write: WIP timeout at byte %zu\n", > + i); > + result =3D -ETIMEDOUT; > + goto out_unwind; > + } > + udelay(1); > + } while (1); > + } [Severity: Low] Can this loop return a false -ETIMEDOUT if the task is preempted between dw_spi_g2_reg_op() and time_after(jiffies, deadline)? If the first status read sees DW_SPI_G2_NOR_SR1_WIP set and the task is then preempted past deadline, time_after() fires without re-reading sr1 after the deadline. [ ... ] > +ssize_t dw_spi_g2_dirmap_write(struct spi_mem_dirmap_desc *desc, > + u64 offs, size_t len, const void *buf) > +{ > + struct spi_device *spi =3D desc->mem->spi; > + struct dw_spi_g2 *dws =3D spi_controller_get_devdata(spi->controller); > + u8 __iomem *dst; > + u32 ctrlr0; > + bool use_indirect =3D false; > + int ret; > + > + dws->cs =3D spi_get_chipselect(spi, 0); > + dws->curr_spi =3D spi; > + > + if (dw_spi_g2_dirmap_check_bounds(desc, dws, offs, len)) > + return -EINVAL; > + > + if (!dws->use_xip || desc->info.op_tmpl->addr.nbytes >=3D 3) > + use_indirect =3D true; > + > + if (use_indirect && dws->use_xip && dws->xip_mem && > + desc->info.op_tmpl->addr.nbytes >=3D 3) { > + dev_dbg(dws->dev, > + "dirmap_write: ROUTE=3DNOR-XIP cmd=3D0x%02x offs=3D0x%llx len=3D%zu\n= ", > + desc->info.op_tmpl->cmd.opcode, > + (unsigned long long)offs, len); > + return dw_spi_g2_dirmap_write_nor_xip(dws, desc, offs, len, buf); > + } > + > + if (use_indirect) { > + struct spi_mem_op op =3D *desc->info.op_tmpl; > + > + dev_dbg(dws->dev, > + "dirmap_write: ROUTE=3DINDIRECT-FIFO cmd=3D0x%02x offs=3D0x%llx len= =3D%zu\n", > + op.cmd.opcode, (unsigned long long)offs, len); > + > + op.addr.val =3D desc->info.offset + offs; > + op.data.nbytes =3D len; > + op.data.buf.out =3D buf; > + > + ret =3D dw_spi_g2_indirect_write(dws, &op); > + return ret ? ret : (ssize_t)len; > + } > + > + /* XIP write path - only reached for NAND Program Load */ > + if (!dws->xip_mem) > + return -EOPNOTSUPP; > + > + dev_dbg(dws->dev, > + "dirmap_write: ROUTE=3DNAND-XIP cmd=3D0x%02x offs=3D0x%llx len=3D%zu\n= ", > + desc->info.op_tmpl->cmd.opcode, > + (unsigned long long)offs, len); > + > + dw_spi_g2_enable(dws, false); > + dw_spi_g2_target_disable(dws, dws->cs); > + ctrlr0 =3D dw_spi_g2_build_ctrlr0(dws, DW_SPI_G2_CTRLR0_TMOD_TR, > + DW_SPI_G2_FRF_STANDARD); > + dw_spi_g2_writel(dws->regs, DW_SPI_G2_CTRLR0(dws->cs), ctrlr0); > + dw_spi_g2_writel(dws->regs, DW_SPI_G2_SPI_CTRLR0(dws->cs), 0); > + dw_spi_g2_writel(dws->regs, DW_SPI_G2_CTRLR1(dws->cs), 0); > + ret =3D dw_spi_g2_xip_setup(dws, desc->info.op_tmpl, true); > + if (ret) > + return ret; > + > + dst =3D (u8 __iomem *)dws->xip_mem + desc->info.offset + offs; > + > + dw_spi_g2_writel(dws->regs, DW_SPI_G2_XIP_WR_SER, BIT(dws->cs)); > + dw_spi_g2_enable(dws, true); > + > + /* > + * PIO write into the XIP window. The XIP engine turns every AHB > + * write into one (cmd + addr + data) SPI transaction, but on > + * this controller only the first byte of each AHB beat is shifted > + * out to the flash -- a multi-byte AHB store (writel/writeq, as > + * memcpy_toio() emits on arm64 with the MMU on) drops every byte > + * past the first. The corruption pattern in flash is unmistakable: > + * buf[0..7] =3D 00 01 02 03 04 05 06 07 > + * flash[0..7] =3D 00 04 ff ff ff ff ff ff <- only +0 and +4 land > + * confirming two 32-bit AHB beats per writeq, each beat emitting > + * only its low byte. We must therefore push the payload as a > + * writeb() loop so every byte is its own AHB beat -> its own SPI > + * Program-Load transaction. The on-die NAND page buffer > + * auto-increments its column counter on each transaction, so the > + * full page lands correctly. > + */ > + { > + const u8 *src =3D buf; > + size_t i; > + > + for (i =3D 0; i < len; i++) > + writeb(src[i], dst + i); > + } [Severity: High] Won't emitting a separate SPI transaction per byte in these two XIP write paths corrupt SPI-NAND page writes and break SPI-NOR flashes? On the SPI-NAND path (addr.nbytes < 3), spinand_create_dirmap() sets up the write descriptor using update_cache, which uses SPINAND_PROG_LOAD (0x02 or 0x32) rather than Random Data Load (0x84 or 0x34). Because each writeb() emits a separate 0x02/0x32 transaction with its own CS assertion, standard SPI-NAND flashes reset the on-die page cache buffer to 0xFF on every byte, wiping out bytes 0..i-1. On the SPI-NOR path (addr.nbytes >=3D 3), dw_spi_g2_dirmap_write_nor_xip() issues hardcoded 1-1-1 SDR WREN (0x06) and RDSR1 (0x05) ops and a 1-byte Page Program per byte inside the controller driver. Aside from turning a single 256-byte page program into 256 separate flash program cycles with udelay(1) busy-polling under ctlr->io_mutex, this breaks SPI-NOR flashes with internal ECC (which forbid multiple partial page programs to the same ECC unit) and flashes in 4-4-4 or 8D-8D-8D modes where 1-1-1 SDR opcodes and 1-byte writes are invalid. Rejecting SPI_MEM_DATA_OUT in dw_spi_g2_dirmap_create() (or always routing writes through dw_spi_g2_indirect_write()) would let spi-nor and spinand use the FIFO write path directly. > + > + dw_spi_g2_wait_idle(dws); > + > + /* Disable XIP WR mode and clean up DEDICATED_CS_EN */ > + dw_spi_g2_writel(dws->regs, DW_SPI_G2_XIP_WR_SER, 0); > + dw_spi_g2_enable(dws, false); > + dw_spi_g2_target_disable(dws, dws->cs); > + > + return (ssize_t)len; > +} [Severity: Medium] Should dw_spi_g2_dirmap_write() check the return value of dw_spi_g2_wait_idle(dws) instead of ignoring timeouts and returning len? Also, dw_spi_g2_wait_idle() in drivers/spi/spi-dw-g2.h only checks !(sr & DW_SPI_G2_SR_BUSY) without requiring (sr & DW_SPI_G2_SR_TFE). As noted in dw_spi_g2_reg_op(), polling only !BUSY after prefilling the TX FIFO and asserting SER (such as in dw_spi_g2_cmd_only() during dw_spi_g2_dirmap_write_nor_xip()) can return before SER propagates into the ssi_clk domain and before the TX FIFO drains. > diff --git a/drivers/spi/spi-dw-g2-mmio.c b/drivers/spi/spi-dw-g2-mmio.c > index 1be68c4250e67..1f776d42ef8a2 100644 > --- a/drivers/spi/spi-dw-g2-mmio.c > +++ b/drivers/spi/spi-dw-g2-mmio.c > @@ -18,6 +18,196 @@ struct dw_spi_g2_mmio { > struct reset_control *rstc; > }; > =20 > +static int dw_spi_g2_xip_mode_set(struct dw_spi_g2 *dws, int val) > +{ > + if (val !=3D 0 && val !=3D 1) > + return -EINVAL; > + > + if (val && !dws->xip_mem) { > + dev_err(dws->dev, > + "Cannot enable XIP: no memory-mapped region available\n"); > + return -EINVAL; > + } > + > + dws->use_xip =3D !!val; > + return 0; > +} [Severity: Medium] When xip_mode is set to 0 via sysfs, does dw_spi_g2_xip_mode_set() leave dws->xip_continuous_mode and dws->xip_prefetch_mode set to true, and can the sysfs store callbacks race with in-flight dirmap transfers? Both dw_spi_g2_xip_continuous_mode_set() and dw_spi_g2_xip_prefetch_mode_set() require dws->use_xip to be active, but disabling dws->use_xip does not clear those flags, leaving sysfs reporting 1 for continuous and prefetch modes while XIP is off and re-arming them if XIP is later re-enabled. In addition, xip_mode_store(), xip_continuous_mode_store(), and xip_prefetch_mode_store() modify these fields without holding ctlr->io_mutex, racing with concurrent dw_spi_g2_dirmap_read() and dw_spi_g2_dirmap_write() calls that read dws->use_xip multiple times across dependent branches. Finally, the new xip_mode, xip_continuous_mode, and xip_prefetch_mode sysfs attributes have no entries under Documentation/ABI/. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1795683279.gi= t.prakriti@synopsys.com?part=3D5