Hi Liang, On Tue, Mar 12, 2019 at 10:05 AM Liang Yang <liang.yang@xxxxxxxxxxx> wrote: > > Hi Martin and Miquel, > > On 2019/3/7 21:09, Miquel Raynal wrote: > > Hello, > > > > Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx> wrote on Tue, > > 5 Mar 2019 23:12:51 +0100: > > > >> Hi Liang, > >> > >> On Mon, Mar 4, 2019 at 5:55 AM Liang Yang <liang.yang@xxxxxxxxxxx> wrote: > >>> > >>> Hello Martin, > >>> > >>> On 2019/3/2 2:29, Martin Blumenstingl wrote: > >>>> Hi Liang, > >>>> > >>>> I am trying to add support for older SoCs to the meson-nand driver. > >>>> Back when the driver was in development I used an early revision (of > >>>> your driver) and did some modifications to make it work on older SoCs. > >>>> > >>>> Now that the driver is upstream I wanted to give it another try and > >>>> make a real patch out of it. Unfortunately it's not working anymore. > >>>> > >>>> As far as I know the NFC IP block revision on GXL is similar (or even > >>>> the same?) as on all older SoCs. As far as I can tell only the clock > >>>> setup is different on the older SoCs (which have a dedicated NAND > >>>> clock): > >>>> - we don't need the "amlogic,mmc-syscon" property on the older SoCs > >>>> because we don't need to setup any muxing (common clock framework > >>>> will do everything for us) > >>>> - "rx" and "tx" clocks don't exist > >>>> - I could not find any other differences between Meson8, Meson8b, > >>>> Meson8m2, GXBB and GXL > >>>> > >>> That is right. the serials NFC is almost the same except: > >>> 1) The clock control and source that M8-serials are not share with EMMC. > >>> 2) The base register address > >>> 3) DMA encryption option which we don't care on NFC driver. > >> great, thank you for confirming this! > >> > >>>> In this series I'm sending two patches which add support for the older > >>>> SoCs. > >>>> > >>>> Unfortunately these patches are currently not working for me (hence the > >>>> "RFC" prefix). I get a (strange) crash which is triggered by the > >>>> kzalloc() in meson_nfc_read_buf() - see below for more details. > >>>> > >>>> Can you please help me on this one? I'd like to know whether: > >>>> - the meson-nand driver works for you on GXL or AXG on linux-next? > >>>> (I was running these patches on top of next-20190301 on my M8S > >>>> board which uses a 32-bit Meson8m2 SoC. I don't have any board using > >>>> a GXL SoC which also has NAND) > >>> Yes, it works on AXG platform using a MXIC slc nand flash(MX30LF4G); but > >>> i an not sure it runs the same flow with yours. because i see the print > >>> "Counld not find a valid ONFI parameter page, ...." in yours. i will try > >>> to reproduce it on AXG(i don't have a M8 platform now). > >> I'm looking forward to hear about the test results on your AXG boards > >> for reference: my board has a SK Hynix H27UCG8T2B (ID bytes: 0xad 0xde > >> 0x94 0xeb 0x74 0x44, 20nm MLC) > >> I have another board (where I haven't tested the NFC driver yet) with > >> a SK Hynix H27UCG8T2E (ID bytes: 0xad 0xde 0x14 0xa7 0x42 0x4a, 1Ynm > >> MLC). if it helps with your analysis I can test on that board as well > > > > Liang, you just have to fake the output of the ONFI page detection and > > you will probably run into this error which will then be easy to > > reproduce. > > > i don't reproduce it by using a SK Hynix nand flash H27UCG8T2E on gxl > platform. it runs well. > [......] > [ 0.977127] loop: module loaded > [ 0.998625] Could not find a valid ONFI parameter page, trying > bit-wise majority to recover it > [ 1.001619] ONFI parameter recovery failed, aborting > [ 1.006684] Could not find valid JEDEC parameter page; aborting > [ 1.012391] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xde > [ 1.018660] nand: Hynix NAND 8GiB 3,3V 8-bit > [ 1.022885] nand: 8192 MiB, MLC, erase size: 4096 KiB, page size: > 16384, OOB size: 1664 > [ 1.047033] Bad block table not found for chip 0 > [ 1.054950] Bad block table not found for chip 0 > [ 1.054970] Scanning device for bad blocks > [ 1.522664] random: fast init done > [ 4.893731] Bad eraseblock 1985 at 0x0001f07fc000 > [ 5.020637] Bad block table written to 0x0001ffc00000, version 0x01 > [ 5.028258] Bad block table written to 0x0001ff800000, version 0x01 > [ 5.029905] 5 fixed-partitions partitions found on MTD device > d0074800.nfc > [ 5.035714] Creating 5 MTD partitions on "d0074800.nfc": > [......] > > Martin, Now i am not sure whether NFC driver leads to kernel panic when > calling kmem_cache_alloc_trace. thank you for confirming that it works for you on GXL I'm not sure that this is a NFC driver problem. after enabling CONFIG_SLAB_FREELIST_HARDENED in my kernel config the crash moves. it's now crashing in slub.c's kfree() at BUG_ON(!PageCompound(page)); maybe this is related to some difference in 32-bit ARM and arm64 or it could even be some memory management issue I'm not sure yet so I'll try to dig deeper Regards Martin
[ 2.080461] Could not find a valid ONFI parameter page, trying bit-wise majority to recover it [ 2.084140] ONFI parameter recovery failed, aborting [ 2.089154] ------------[ cut here ]------------ [ 2.093631] kernel BUG at mm/slub.c:3950! [ 2.097619] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 2.103427] Modules linked in: [ 2.106464] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.0.0-11944-g4479fa4728e9-dirty #4196 [ 2.114781] Hardware name: Amlogic Meson platform [ 2.119470] PC is at kfree+0x298/0x2c4 [ 2.123195] LR is at meson_nfc_exec_op+0x34c/0x3e8 [ 2.127958] pc : [<c048e9b4>] lr : [<c08c2108>] psr: 40000013 [ 2.134199] sp : c02afc60 ip : eafd9000 fp : e9e36e40 [ 2.139400] r10: 00000002 r9 : e9d6c048 r8 : ee36434b [ 2.144601] r7 : eb59fc80 r6 : ee36434b r5 : c08c2108 r4 : c02afd18 [ 2.151102] r3 : eb59fc84 r2 : c12089c0 r1 : ee364340 r0 : ee36434b [ 2.157605] Flags: nZcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 2.164712] Control: 10c5387d Table: 0020404a DAC: 00000051 [ 2.170433] Process swapper/0 (pid: 1, stack limit = 0x(ptrval)) [ 2.176413] Stack: (0xc02afc60 to 0xc02b0000) [ 2.180752] fc60: ee36434b c08c0c74 00000000 c02afd18 00000028 e9e92680 c02afcf0 ee36434b [ 2.188899] fc80: e9d6c048 c08c2108 00000008 00000002 10624dd3 c02afce4 10624dd3 00000005 [ 2.197047] fca0: e9e36e40 c0f67310 00220005 c0f152e8 00000005 e9d6c048 00000005 c02afd57 [ 2.205195] fcc0: c1108c88 e9e36e40 c02afcf0 e9d6c428 e9d6c3b0 c08adb18 00000000 40000000 [ 2.213343] fce0: c02afce8 00000000 c02afcf0 00000003 00000000 00000090 00000000 00000000 [ 2.221491] fd00: 00000000 00000001 00000001 c02afcdf 00000000 00000190 00000002 00000005 [ 2.229639] fd20: c02afd57 00000001 00000000 5b1da8e9 00000000 c1108c88 c11812f0 e9d6c3c0 [ 2.237787] fd40: 00000001 000000de 00000000 c08b89d4 c0f14704 00d6c3c0 00000000 5b1da8e9 [ 2.245936] fd60: 00000015 e9d6c048 c1108c88 c08b8d30 e9d6c048 c08b4174 00000000 60000013 [ 2.254084] fd80: c0ef7604 000000ad c0da27ac 00000000 e9e36e8c c0cf8950 c121b50c 5b1da8e9 [ 2.262232] fda0: e9e36e40 e9e36e40 e9d6c040 c0ef7604 e987f810 eafd6a00 e9d6c048 c1108c88 [ 2.270380] fdc0: e9e36e8c c08c1530 00000000 e9874e80 e9e36e40 c0517fd0 00000000 eafd6774 [ 2.278528] fde0: e9e36f34 00000000 00000000 00000000 00000001 5b1da8e9 00000000 e987f810 [ 2.286676] fe00: 00000000 c11817c8 00000000 00000000 c11817c8 00000000 c1071854 c0828b28 [ 2.294824] fe20: c1216c78 e987f810 c1216c7c 00000000 00000000 c0826bb0 e987f810 c11817c8 [ 2.302973] fe40: c11817c8 c08270b0 00000000 c1071834 c10004a8 c0826dfc c10004a8 c0abf0ac [ 2.311121] fe60: c0da3f14 e987f810 00000000 c11817c8 c08270b0 00000000 c1071834 c10004a8 [ 2.319269] fe80: c1071854 c08270a8 00000000 c11817c8 e987f810 c0827108 e98bafb4 c1108c88 [ 2.327417] fea0: c11817c8 c0824f78 c1176300 c029c958 e98bafb4 5b1da8e9 c029c96c c11817c8 [ 2.335565] fec0: e9e39e80 c1176300 00000000 c0825fe8 c0f155b4 c1108c88 ffffe000 c11817c8 [ 2.343713] fee0: c1108c88 ffffe000 c103b854 c0827c34 c11c3e40 c1108c88 ffffe000 c0302f54 [ 2.351861] ff00: ebfffdc0 c0347218 c0fb6d80 c0f36800 00000000 00000006 00000006 c0ea6330 [ 2.360010] ff20: 00000000 c1108c88 c0eb3dc4 c0ea63a4 c11da500 ebfffdae ebfffdb3 5b1da8e9 [ 2.368158] ff40: c1071838 c11c3e40 c10914a4 5b1da8e9 c11c3e40 c10917f0 00000007 c11da500 [ 2.376306] ff60: c11da500 c1001180 00000006 00000006 00000000 c10004a8 0000013d 00000000 [ 2.384454] ff80: c02c0504 00000000 c0cf12e8 00000000 00000000 00000000 00000000 00000000 [ 2.392602] ffa0: 00000000 c0cf12f0 00000000 c03010e8 00000000 00000000 00000000 00000000 [ 2.400750] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.408898] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ 2.417052] [<c048e9b4>] (kfree) from [<c08c2108>] (meson_nfc_exec_op+0x34c/0x3e8) [ 2.424592] [<c08c2108>] (meson_nfc_exec_op) from [<c08adb18>] (nand_readid_op+0x128/0x1c4) [ 2.432914] [<c08adb18>] (nand_readid_op) from [<c08b89d4>] (hynix_nand_has_valid_jedecid+0x34/0x78) [ 2.442013] [<c08b89d4>] (hynix_nand_has_valid_jedecid) from [<c08b8d30>] (hynix_nand_decode_id+0x64/0x3fc) [ 2.451721] [<c08b8d30>] (hynix_nand_decode_id) from [<c08b4174>] (nand_scan_with_ids+0xa04/0x171c) [ 2.460735] [<c08b4174>] (nand_scan_with_ids) from [<c08c1530>] (meson_nfc_probe+0x460/0x690) [ 2.469232] [<c08c1530>] (meson_nfc_probe) from [<c0828b28>] (platform_drv_probe+0x48/0x98) [ 2.477553] [<c0828b28>] (platform_drv_probe) from [<c0826bb0>] (really_probe+0x1e0/0x2cc) [ 2.485786] [<c0826bb0>] (really_probe) from [<c0826dfc>] (driver_probe_device+0x60/0x16c) [ 2.494021] [<c0826dfc>] (driver_probe_device) from [<c08270a8>] (device_driver_attach+0x58/0x60) [ 2.502862] [<c08270a8>] (device_driver_attach) from [<c0827108>] (__driver_attach+0x58/0xcc) [ 2.511357] [<c0827108>] (__driver_attach) from [<c0824f78>] (bus_for_each_dev+0x74/0xb4) [ 2.519505] [<c0824f78>] (bus_for_each_dev) from [<c0825fe8>] (bus_add_driver+0x1b8/0x1d8) [ 2.527740] [<c0825fe8>] (bus_add_driver) from [<c0827c34>] (driver_register+0x74/0x108) [ 2.535804] [<c0827c34>] (driver_register) from [<c0302f54>] (do_one_initcall+0x54/0x284) [ 2.543956] [<c0302f54>] (do_one_initcall) from [<c1001180>] (kernel_init_freeable+0x2d4/0x36c) [ 2.552621] [<c1001180>] (kernel_init_freeable) from [<c0cf12f0>] (kernel_init+0x8/0x110) [ 2.560768] [<c0cf12f0>] (kernel_init) from [<c03010e8>] (ret_from_fork+0x14/0x2c) [ 2.568304] Exception stack(0xc02affb0 to 0xc02afff8) [ 2.573333] ffa0: 00000000 00000000 00000000 00000000 [ 2.581483] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.589630] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 2.596220] Code: 1a000003 e5973004 e3130001 1a000000 (e7f001f2) [ 2.602295] ---[ end trace 0bdf5d4bfd4b3fb1 ]---