From: Larisa Grigore <larisa.grigore@nxp.com>
DSPI registers are NOT continuous, some registers are reserved and
accessing them from userspace will trigger external abort, add regmap
register access table to avoid below abort:
Internal error: synchronous external abort: 96000210 1 PREEMPT SMP
Modules linked in: fuse dummy tun hse sch_fq_codel openvswitch nsh
nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4
CPU: 2 PID: 18231 Comm: read_all Not tainted 5.2.33-yocto-standard #1
Hardware name: Freescale S32G275 (DT)
pstate: 20000085 (nzCv daIf -PAN -UAO)
pc : regmap_mmio_read32le+0x24/0x48
lr : regmap_mmio_read+0x48/0x70
sp : ffffff801123bb70
x29: ffffff801123bb70 x28: ffffffc873b5c000
x27: ffffff8010b408f0 x26: 0000000000000001
x25: 000000000000013c x24: ffffff801123be40
x23: 00000000000003ff x22: ffffff801123bcfc
x21: ffffff801123bcfc x20: ffffffc873a9e500
x19: 0000000000000024 x18: 0000000000000020
x17: 0000000000000000 x16: 0000000000000000
x15: ffffffc876189160 x14: 0000000000000003
x13: ffffffc873bf73ff x12: ffffffc873bf707e
x11: 0000000000000000 x10: 0000000000000000
x9 : 0000000000000000 x8 : ffffffc83fca4e00
x7 : 000000000000000f x6 : ffffffc873bf7083
x5 : 00000000fffffff9 x4 : 0000000000000002
x3 : ffffff801061f058 x2 : ffffff801061ee18
x1 : 0000000000000024 x0 : ffffff8011490024
Call trace:
regmap_mmio_read32le+0x24/0x48
regmap_mmio_read+0x48/0x70
_regmap_bus_reg_read+0x38/0x48
_regmap_read+0x68/0x1b0
regmap_read+0x50/0x78
regmap_read_debugfs+0x120/0x338
regmap_map_read_file+0x44/0x58
full_proxy_read+0x68/0x98
__vfs_read+0x48/0x90
vfs_read+0xb0/0x130
ksys_read+0x7c/0x108
__arm64_sys_read+0x24/0x30
el0_svc_common.constprop.0+0x74/0x168
el0_svc_handler+0x70/0x90
el0_svc+0x8/0xc
Co-developed-by: Xulin Sun <xulin.sun@windriver.com>
Signed-off-by: Xulin Sun <xulin.sun@windriver.com>
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
---
drivers/spi/spi-fsl-dspi.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index cb0e55a49eea..701cf56d28e7 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
//
// Copyright 2013 Freescale Semiconductor, Inc.
-// Copyright 2020 NXP
+// Copyright 2020-2025 NXP
//
// Freescale DSPI driver
// This file contains a driver for the Freescale DSPI
@@ -137,6 +137,20 @@ enum {
VF610,
};
+static const struct regmap_range dspi_yes_ranges[] = {
+ regmap_reg_range(SPI_MCR, SPI_MCR),
+ regmap_reg_range(SPI_TCR, SPI_CTAR(3)),
+ regmap_reg_range(SPI_SR, SPI_TXFR3),
+ regmap_reg_range(SPI_RXFR0, SPI_RXFR3),
+ regmap_reg_range(SPI_CTARE(0), SPI_CTARE(3)),
+ regmap_reg_range(SPI_SREX, SPI_SREX),
+};
+
+static const struct regmap_access_table dspi_access_table = {
+ .yes_ranges = dspi_yes_ranges,
+ .n_yes_ranges = ARRAY_SIZE(dspi_yes_ranges),
+};
+
static const struct regmap_range dspi_volatile_ranges[] = {
regmap_reg_range(SPI_MCR, SPI_TCR),
regmap_reg_range(SPI_SR, SPI_SR),
@@ -161,14 +175,18 @@ static const struct regmap_config dspi_regmap_config[] = {
.val_bits = 32,
.reg_stride = 4,
.max_register = 0x88,
- .volatile_table = &dspi_volatile_table
+ .volatile_table = &dspi_volatile_table,
+ .wr_table = &dspi_access_table,
+ .rd_table = &dspi_access_table
},
[DSPI_XSPI_REGMAP] = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
.max_register = 0x13c,
- .volatile_table = &dspi_volatile_table
+ .volatile_table = &dspi_volatile_table,
+ .wr_table = &dspi_access_table,
+ .rd_table = &dspi_access_table
},
[DSPI_PUSHR] = {
.name = "pushr",
--
2.34.1
On Fri, May 09, 2025 at 12:05:50PM +0100, James Clark wrote: > From: Larisa Grigore <larisa.grigore@nxp.com> > > DSPI registers are NOT continuous, some registers are reserved and > accessing them from userspace will trigger external abort, add regmap > register access table to avoid below abort: Fixes should go at the start of the series so they can be applied as such without spurious dependencies on non-fix patches. > Internal error: synchronous external abort: 96000210 1 PREEMPT SMP > Modules linked in: fuse dummy tun hse sch_fq_codel openvswitch nsh > nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 > CPU: 2 PID: 18231 Comm: read_all Not tainted 5.2.33-yocto-standard #1 > Hardware name: Freescale S32G275 (DT) > pstate: 20000085 (nzCv daIf -PAN -UAO) Please think hard before including complete backtraces in upstream reports, they are very large and contain almost no useful information relative to their size so often obscure the relevant content in your message. If part of the backtrace is usefully illustrative (it often is for search engines if nothing else) then it's usually better to pull out the relevant sections.
On Fri, May 09, 2025 at 12:05:50PM +0100, James Clark wrote: > From: Larisa Grigore <larisa.grigore@nxp.com> > > DSPI registers are NOT continuous, some registers are reserved and > accessing them from userspace will trigger external abort, add regmap > register access table to avoid below abort: > > Internal error: synchronous external abort: 96000210 1 PREEMPT SMP > Modules linked in: fuse dummy tun hse sch_fq_codel openvswitch nsh > nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 > CPU: 2 PID: 18231 Comm: read_all Not tainted 5.2.33-yocto-standard #1 > Hardware name: Freescale S32G275 (DT) > pstate: 20000085 (nzCv daIf -PAN -UAO) > pc : regmap_mmio_read32le+0x24/0x48 > lr : regmap_mmio_read+0x48/0x70 > sp : ffffff801123bb70 > x29: ffffff801123bb70 x28: ffffffc873b5c000 > x27: ffffff8010b408f0 x26: 0000000000000001 > x25: 000000000000013c x24: ffffff801123be40 > x23: 00000000000003ff x22: ffffff801123bcfc > x21: ffffff801123bcfc x20: ffffffc873a9e500 > x19: 0000000000000024 x18: 0000000000000020 > x17: 0000000000000000 x16: 0000000000000000 > x15: ffffffc876189160 x14: 0000000000000003 > x13: ffffffc873bf73ff x12: ffffffc873bf707e > x11: 0000000000000000 x10: 0000000000000000 > x9 : 0000000000000000 x8 : ffffffc83fca4e00 > x7 : 000000000000000f x6 : ffffffc873bf7083 > x5 : 00000000fffffff9 x4 : 0000000000000002 > x3 : ffffff801061f058 x2 : ffffff801061ee18 > x1 : 0000000000000024 x0 : ffffff8011490024 I think you can leave the register dump out, it doesn't seem of much use. > Call trace: > regmap_mmio_read32le+0x24/0x48 > regmap_mmio_read+0x48/0x70 > _regmap_bus_reg_read+0x38/0x48 > _regmap_read+0x68/0x1b0 > regmap_read+0x50/0x78 > regmap_read_debugfs+0x120/0x338 > regmap_map_read_file+0x44/0x58 > full_proxy_read+0x68/0x98 > __vfs_read+0x48/0x90 > vfs_read+0xb0/0x130 > ksys_read+0x7c/0x108 > __arm64_sys_read+0x24/0x30 > el0_svc_common.constprop.0+0x74/0x168 > el0_svc_handler+0x70/0x90 > el0_svc+0x8/0xc > > Co-developed-by: Xulin Sun <xulin.sun@windriver.com> > Signed-off-by: Xulin Sun <xulin.sun@windriver.com> > Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> > Signed-off-by: James Clark <james.clark@linaro.org> > --- Do you have a reproducer for any of the supported SoCs? On LS1028A, "cat /sys/kernel/debug/regmap/2120000.spi/registers" runs fine and does not crash.
On 09/05/2025 3:06 pm, Vladimir Oltean wrote: > On Fri, May 09, 2025 at 12:05:50PM +0100, James Clark wrote: >> From: Larisa Grigore <larisa.grigore@nxp.com> >> >> DSPI registers are NOT continuous, some registers are reserved and >> accessing them from userspace will trigger external abort, add regmap >> register access table to avoid below abort: >> >> Internal error: synchronous external abort: 96000210 1 PREEMPT SMP >> Modules linked in: fuse dummy tun hse sch_fq_codel openvswitch nsh >> nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 >> CPU: 2 PID: 18231 Comm: read_all Not tainted 5.2.33-yocto-standard #1 >> Hardware name: Freescale S32G275 (DT) >> pstate: 20000085 (nzCv daIf -PAN -UAO) >> pc : regmap_mmio_read32le+0x24/0x48 >> lr : regmap_mmio_read+0x48/0x70 >> sp : ffffff801123bb70 >> x29: ffffff801123bb70 x28: ffffffc873b5c000 >> x27: ffffff8010b408f0 x26: 0000000000000001 >> x25: 000000000000013c x24: ffffff801123be40 >> x23: 00000000000003ff x22: ffffff801123bcfc >> x21: ffffff801123bcfc x20: ffffffc873a9e500 >> x19: 0000000000000024 x18: 0000000000000020 >> x17: 0000000000000000 x16: 0000000000000000 >> x15: ffffffc876189160 x14: 0000000000000003 >> x13: ffffffc873bf73ff x12: ffffffc873bf707e >> x11: 0000000000000000 x10: 0000000000000000 >> x9 : 0000000000000000 x8 : ffffffc83fca4e00 >> x7 : 000000000000000f x6 : ffffffc873bf7083 >> x5 : 00000000fffffff9 x4 : 0000000000000002 >> x3 : ffffff801061f058 x2 : ffffff801061ee18 >> x1 : 0000000000000024 x0 : ffffff8011490024 > > I think you can leave the register dump out, it doesn't seem of much use. > Will reduce the output and add a reproducer and fixes: tag. >> Call trace: >> regmap_mmio_read32le+0x24/0x48 >> regmap_mmio_read+0x48/0x70 >> _regmap_bus_reg_read+0x38/0x48 >> _regmap_read+0x68/0x1b0 >> regmap_read+0x50/0x78 >> regmap_read_debugfs+0x120/0x338 >> regmap_map_read_file+0x44/0x58 >> full_proxy_read+0x68/0x98 >> __vfs_read+0x48/0x90 >> vfs_read+0xb0/0x130 >> ksys_read+0x7c/0x108 >> __arm64_sys_read+0x24/0x30 >> el0_svc_common.constprop.0+0x74/0x168 >> el0_svc_handler+0x70/0x90 >> el0_svc+0x8/0xc >> >> Co-developed-by: Xulin Sun <xulin.sun@windriver.com> >> Signed-off-by: Xulin Sun <xulin.sun@windriver.com> >> Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> >> Signed-off-by: James Clark <james.clark@linaro.org> >> --- > > Do you have a reproducer for any of the supported SoCs? On LS1028A, "cat > /sys/kernel/debug/regmap/2120000.spi/registers" runs fine and does not > crash. On S32G3: # cat /sys/kernel/debug/regmap/401d8000.spi/registers Internal error: synchronous external abort: 0000000096000210 [#1] SMP regmap_mmio_read32le+0x14/0x38 (P) _regmap_bus_reg_read+0x104/0x140 _regmap_read+0x19c/0x2d0 regmap_read+0x60/0x90 regmap_read_debugfs+0x15c/0x330 ... Not sure why it wouldn't be the same on LS1028A because the register layout is basically the same. Maybe it just ignores the read instead? Either way I think the fix is still worthwhile to backport because we won't be able to test every device.
© 2016 - 2025 Red Hat, Inc.