Boot fails after "mtd: rawnand: Support for sequential cache reads"

Emil Lenngren emil.lenngren at gmail.com
Thu Aug 3 08:25:05 PDT 2023


After trying to upgrade the kernel to version 6.3, my system no longer
boots. I tracked down the issue to the commit "mtd: rawnand: Support
for sequential cache reads"
https://lore.kernel.org/linux-mtd/20230112093637.987838-4-miquel.raynal@bootlin.com.

The system is running UBIFS as root partition, and it is when mounting
the root partition the boot process fails.

The system is based on NextThing's GR8 (Allwinner R8 inside) and has
the Toshiba flash TC58NVG2S0HTA00. It should be more or less
equivalent to NextThing's "CHIP Pro".

It appears like UBI itself manages to get initialized, but mounting
the UBIFS partition fails.

After inserting "#define DEBUG" into nand_base.c and sunxi_nand.c,
this is the kernel log:

...
[   89.750000] nand: executing subop (CS0):
[   89.760000] nand:     ->CMD      [0x00]
[   89.760000] nand:     ->ADDR     [5 cyc: 00 00 40 fe 01]
[   89.770000] nand:     ->CMD      [0x30]
[   89.770000] nand:     ->WAITRDY  [max 1 ms]
[   89.770000] nand: executing subop (CS0):
[   89.780000] nand:     ->CMD      [0x00]
[   89.780000] nand:     ->ADDR     [5 cyc: 00 00 80 fe 01]
[   89.790000] nand:     ->CMD      [0x30]
[   89.790000] nand:     ->WAITRDY  [max 1 ms]
[   89.800000] nand: executing subop (CS0):
[   89.800000] nand:     ->CMD      [0x00]
[   89.800000] nand:     ->ADDR     [5 cyc: 00 00 80 fe 01]
[   89.810000] nand:     ->CMD      [0x30]
[   89.810000] nand:     ->WAITRDY  [max 1 ms]
[   89.820000] nand: executing subop (CS0):
[   89.820000] nand:     ->CMD      [0x00]
[   89.820000] nand:     ->ADDR     [5 cyc: 00 00 c0 fe 01]
[   89.830000] nand:     ->CMD      [0x30]
[   89.830000] nand:     ->WAITRDY  [max 1 ms]
[   89.840000] nand: executing subop (CS0):
[   89.840000] nand:     ->CMD      [0x00]
[   89.850000] nand:     ->ADDR     [5 cyc: 00 00 c0 fe 01]
[   89.850000] nand:     ->CMD      [0x30]
[   89.860000] nand:     ->WAITRDY  [max 1 ms]
[   89.860000] ubi0: scanning is finished
[   89.860000] nand: nand_do_read_ops: using read bounce buffer for buf at 273e236b
[   89.870000] nand: executing subop (CS0):
[   89.880000] nand:     ->CMD      [0x00]
[   89.880000] nand:     ->ADDR     [5 cyc: 00 00 81 02 01]
[   89.880000] nand:     ->CMD      [0x30]
[   89.890000] nand:     ->WAITRDY  [max 1 ms]
[   89.890000] nand:       CMD      [0x31]
[   89.900000] nand:       WAITRDY  [max 1 ms]
[   89.900000] nand: executing subop (CS0):
[   89.910000] nand:       CMD      [0x00]
[   89.910000] nand:       ADDR     [5 cyc: 00 00 81 02 01]
[   89.910000] nand:       CMD      [0x30]
[   89.920000] nand:       WAITRDY  [max 1 ms]
[   89.920000] nand:     ->CMD      [0x31]
[   89.930000] nand:     ->WAITRDY  [max 1 ms]
[   89.930000] nand: nand_do_read_ops: using read bounce buffer for buf at 3ce995ec
[   89.940000] nand: executing subop (CS0):
[   89.940000] nand:     ->CMD      [0x31]
[   89.950000] nand:     ->WAITRDY  [max 1 ms]
[   89.950000] nand: nand_do_read_ops: using read bounce buffer for buf at 6bb80c75
[   89.960000] nand: executing subop (CS0):
[   89.960000] nand:     ->CMD      [0x31]
[   89.970000] nand:     ->WAITRDY  [max 1 ms]
[   89.970000] nand: nand_do_read_ops: using read bounce buffer for buf at a6f19d8d
[   89.980000] nand: executing subop (CS0):
[   89.980000] nand:     ->CMD      [0x31]
[   89.990000] nand:     ->WAITRDY  [max 1 ms]
[   89.990000] nand: nand_do_read_ops: using read bounce buffer for buf at 7b81d074
[   90.000000] nand: executing subop (CS0):
[   90.000000] nand:     ->CMD      [0x31]
[   90.010000] nand:     ->WAITRDY  [max 1 ms]
[   90.010000] nand: nand_do_read_ops: using read bounce buffer for buf at 9896eb14
[   90.020000] nand: executing subop (CS0):
[   90.020000] nand:     ->CMD      [0x31]
[   90.030000] nand:     ->WAITRDY  [max 1 ms]
[   90.030000] nand: nand_do_read_ops: using read bounce buffer for buf at 4bfef574
[   90.040000] nand: executing subop (CS0):
[   90.040000] nand:     ->CMD      [0x00]
[   90.050000] nand:     ->ADDR     [5 cyc: 00 00 c1 02 01]
[   90.050000] nand:     ->CMD      [0x30]
[   90.060000] nand:     ->WAITRDY  [max 1 ms]
[   90.060000] nand:       CMD      [0x31]
[   90.060000] nand:       WAITRDY  [max 1 ms]
[   90.070000] nand: executing subop (CS0):
[   90.070000] nand:       CMD      [0x00]
[   90.080000] nand:       ADDR     [5 cyc: 00 00 c1 02 01]
[   90.080000] nand:       CMD      [0x30]
[   90.080000] nand:       WAITRDY  [max 1 ms]
[   90.090000] nand:     ->CMD      [0x31]
[   90.090000] nand:     ->WAITRDY  [max 1 ms]
[   90.100000] nand: nand_do_read_ops: using read bounce buffer for buf at 4081acc0
[   90.110000] nand: executing subop (CS0):
[   90.110000] nand:     ->CMD      [0x31]
[   90.110000] nand:     ->WAITRDY  [max 1 ms]
[   90.120000] nand: nand_do_read_ops: using read bounce buffer for buf at 9b009736
[   90.130000] nand: executing subop (CS0):
[   90.130000] nand:     ->CMD      [0x31]
[   90.130000] nand:     ->WAITRDY  [max 1 ms]
[   90.140000] nand: nand_do_read_ops: using read bounce buffer for buf at a4f94df0
[   90.150000] nand: executing subop (CS0):
[   90.150000] nand:     ->CMD      [0x31]
[   90.150000] nand:     ->WAITRDY  [max 1 ms]
[   90.160000] nand: nand_do_read_ops: using read bounce buffer for buf at 3430763c
[   90.170000] nand: executing subop (CS0):
[   90.170000] nand:     ->CMD      [0x31]
[   90.170000] nand:     ->WAITRDY  [max 1 ms]
[   90.180000] nand: nand_do_read_ops: using read bounce buffer for buf at 5e8b5aa8
[   90.190000] nand: executing subop (CS0):
[   90.190000] nand:     ->CMD      [0x31]
[   90.190000] nand:     ->WAITRDY  [max 1 ms]
[   90.200000] ubi0: attached mtd2 (name "UBI", size 509 MiB)
[   90.210000] ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 258048 bytes
[   90.220000] ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 1024
[   90.220000] ubi0: VID header offset: 1024 (aligned 1024), data offset: 4096
[   90.230000] ubi0: good PEBs: 2030, bad PEBs: 6, corrupted PEBs: 0
[   90.240000] ubi0: user volume: 8, internal volumes: 1, max. volumes
count: 128
[   90.240000] ubi0: max/mean erase counter: 5/1, WL threshold: 4096,
image sequence number: 862042766
[   90.250000] ubi0: available PEBs: 734, total reserved PEBs: 1296,
PEBs reserved for bad PEB handling: 34
[   90.260000] ubi0: background thread "ubi_bgt0d" started, PID 30
[   90.270000] cfg80211: Loading compiled-in X.509 certificates for
regulatory database
[   90.290000] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[   90.290000] ALSA device list:
[   90.300000]   #0: sun4i-codec
[   90.300000] platform regulatory.0: Direct firmware load for
regulatory.db failed with error -2
[   90.310000] cfg80211: failed to load regulatory.db
[   90.310000] nand: executing subop (CS0):
[   90.320000] nand:     ->CMD      [0x00]
[   90.320000] nand:     ->ADDR     [5 cyc: 00 00 c1 70 01]
[   90.330000] nand:     ->CMD      [0x30]
[   90.330000] nand:     ->WAITRDY  [max 1 ms]
[   90.340000] List of all partitions:
[   90.340000] No filesystem could mount root, tried:
[   90.340000]  ubifs
[   90.340000]
[   90.350000] Kernel panic - not syncing: VFS: Unable to mount root
fs on unknown-block(0,0)

I initially suspected the "return 0" error code in nand_check_op
should be "-ENOTSUPP" instead, as the commit message hints for
https://github.com/torvalds/linux/commit/930370253ec51fccebb743409428ac2f364b3559,
but the sunxi nand driver supports the exec op operation, so that code
path is not triggered.

As I'm not really familiar with this part of the kernel, I don't know
how to debug this further. Let me know if I can assist debugging
somehow.

I saw other people having issues related to this commit in the mailing
list archive as well as at
https://society.oftrolls.com/@mansr/110576568140109154, but not sure
if anyone has had problems on Allwinner systems.

Returning immediately in rawnand_check_cont_read_support seems to
workaround the issue, completely bypassing this new feature.

/Emil



More information about the linux-mtd mailing list