[RFC] ARM/mem: handle data aborts gracefully for md
Sometimes memory ranges contain inaccessible registers which trigger a data abort when accessed. To handle this gracefully, we extend the data abort exception handler to ignore the exception when configured to do so. This allows detecting inaccessible memory from the md command. It will show XX for unreadable bytes instead. The previous behaviour: barebox@TI AM335x BeagleBone:/ md 0x5000 unable to handle paging request at address 0x50ac pc : [<8fe2e0dc>]lr : [<8fe2e0b9>] sp : 8898 ip : 0024 fp : r10: 8bfa0204 r9 : r8 : 8bfa0204 r7 : 0100 r6 : 5000 r5 : 8bfa0204 r4 : 0004 r3 : 0f00 r2 : 00ac r1 : 0004 r0 : 0014 Flags: nZCv IRQs off FIQs on Mode SVC_32 [<8fe2e0dc>] (memcpy_sz+0x40/0x48) from [<8fe2f337>] (mem_read+0x3b/0x48) [<8fe2f337>] (mem_read+0x3b/0x48) from [<8fe2bb13>] (cdev_read+0x25/0x2e) [<8fe2bb13>] (cdev_read+0x25/0x2e) from [<8fe2c15b>] (devfs_read+0x1b/0x1e) [<8fe2c15b>] (devfs_read+0x1b/0x1e) from [<8fe2df5b>] (__read+0x43/0x5c) [<8fe2df5b>] (__read+0x43/0x5c) from [<8fe2e61f>] (read+0x2b/0x48) [<8fe2e61f>] (read+0x2b/0x48) from [<8fe1e4a5>] (do_mem_md+0xc1/0x144) [<8fe1e4a5>] (do_mem_md+0xc1/0x144) from [<8fe02889>] (execute_command+0x21/0x48) [<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634) [<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05b43>] (parse_stream_outer+0xdb/0x174) [<8fe05b43>] (parse_stream_outer+0xdb/0x174) from [<8fe06435>] (run_shell+0x29/0x54) [<8fe06435>] (run_shell+0x29/0x54) from [<8fe02889>] (execute_command+0x21/0x48) [<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634) [<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05efb>] (run_list_real+0x283/0x634) [<8fe31e1d>] (unwind_backtrace+0x1/0x64) from [<8fe24e61>] (panic+0x1d/0x34) [<8fe24e61>] (panic+0x1d/0x34) from [<8fe322c1>] (do_exception+0xd/0x10) [<8fe322c1>] (do_exception+0xd/0x10) from [<8fe32329>] (do_data_abort+0x21/0x2c) [<8fe32329>] (do_data_abort+0x21/0x2c) from [<8fe31fe8>] (data_abort+0x48/0x60) The new behaviour: barebox@TI AM335x BeagleBone:/ md 0x5000 5000: 0060 `... 5010: 0001 5020: 5030: 5040: 1ff0 40ac 0211 ...@ 5050: 0a00 0001 5060: 00101001 22060514 10057016...".p.. 5070: 010f 8f07 0f40 @... 5080: 5090: 1000 00101001 22060514 10057016...".p.. 50a0: 010f 8f07 0f00 50b0: 50c0: 1000 00101001 22060514 10057016...".p.. 50d0: 010f 8f07 0f00 50e0: 50f0: 1000 00101001 22060514 10057016...".p.. The current implementation breaks everything except ARM and takes several shortcuts which need to be implemented more cleanly. Suggestions are very welcome! Signed-off-by: Jan Luebbe --- arch/arm/cpu/exceptions.S | 19 +++ commands/md.c | 40 -- common/memory_display.c | 44 ++--- fs/fs.c | 84 ++- include/common.h | 1 + include/fcntl.h | 3 ++ 6 files changed, 176 insertions(+), 15 deletions(-) diff --git a/arch/arm/cpu/exceptions.S b/arch/arm/cpu/exceptions.S index 167c8d1..b13e112 100644 --- a/arch/arm/cpu/exceptions.S +++ b/arch/arm/cpu/exceptions.S @@ -88,6 +88,21 @@ movspc, lr .endm + .macro try_data_abort + ldr r13, =abort_conf@ check try mode + ldr r13, [r13] + cmp r13, #0 + bne no_abort_\@ + ldr r13, =abort_conf@ disable try mode + str r13, [r13] + mrs r13, spsr @ read saved CPSR + tst r13, #1<<5 @ check Thumb mode + subeq lr, #4 @ next ARM instr + subne lr, #6 @ next Thumb instr + movspc, lr +no_abort_\@: + .endm + .macro get_irq_stack@ setup IRQ stack ldr sp, IRQ_STACK_START .endm @@ -122,6 +137,7 @@ prefetch_abort: .align 5 data_abort: + try_data_abort get_bad_stack
[PATCH] ARM: AM335x: Beaglebone: enable ethernet
The ethernet mac and mdio nodes must be explicitly enabled to override the disabled setting in am33xx.dtsi. Signed-off-by: Jan Luebbe --- arch/arm/dts/am335x-bone-common.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/am335x-bone-common.dtsi b/arch/arm/dts/am335x-bone-common.dtsi index 4cf7fdb..e1effac 100644 --- a/arch/arm/dts/am335x-bone-common.dtsi +++ b/arch/arm/dts/am335x-bone-common.dtsi @@ -276,13 +276,14 @@ pinctrl-names = "default", "sleep"; pinctrl-0 = <&cpsw_default>; pinctrl-1 = <&cpsw_sleep>; - + status = "okay"; }; &davinci_mdio { pinctrl-names = "default", "sleep"; pinctrl-0 = <&davinci_mdio_default>; pinctrl-1 = <&davinci_mdio_sleep>; + status = "okay"; }; &mmc1 { -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [RFC] gen-dtb-s: make metadata binary fields always little-endian
Hi, On Sat, 2014-08-02 at 09:45 +0400, Antony Pavlov wrote: > > compatlen=$($FDTGET -t s "$dtb" / compatible | wc -c) > - echo ".int 0x640c8005" > - echo ".int " $compatlen > + echo ".byte 0x05, 0x80, 0x0c, 0x64" > + python -c "print(\".byte 0x%02x, 0x%02x, 0x%02x, 0x%02x\\n\" > % ($compatlen & 0xff, ($compatlen >> 8) & 0xff, ($compatlen >> 16) & 0xff, > ($compatlen >> 24) & 0xff))" Rather than adding a build-time dependency on python, maybe we should just handle this in C? Regards, Jan -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [RFC] gen-dtb-s: make metadata binary fields always little-endian
On Sun, 03 Aug 2014 18:17:45 +0200 Jan Lübbe wrote: > Hi, > > On Sat, 2014-08-02 at 09:45 +0400, Antony Pavlov wrote: > > > > compatlen=$($FDTGET -t s "$dtb" / compatible | wc -c) > > - echo ".int 0x640c8005" > > - echo ".int " $compatlen > > + echo ".byte 0x05, 0x80, 0x0c, 0x64" > > + python -c "print(\".byte 0x%02x, 0x%02x, 0x%02x, > > 0x%02x\\n\" % ($compatlen & 0xff, ($compatlen >> 8) & 0xff, ($compatlen >> > > 16) & 0xff, ($compatlen >> 24) & 0xff))" > > Rather than adding a build-time dependency on python, maybe we should > just handle this in C? We use sphinx for documentation generation so we already have dependency on python. Here is an another solution: - echo ".int " $compatlen + echo ".byte " $(printf "%08x" $compatlen | sed "s/\(..\)/0x\1\n/g" | tac | xargs | sed "s/ /, /g") -- Best regards, Antony Pavlov ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [RFC] gen-dtb-s: make metadata binary fields always little-endian
On Sun, Aug 03, 2014 at 09:53:38PM +0400, Antony Pavlov wrote: > On Sun, 03 Aug 2014 18:17:45 +0200 > Jan Lübbe wrote: > > > Hi, > > > > On Sat, 2014-08-02 at 09:45 +0400, Antony Pavlov wrote: > > > > > > compatlen=$($FDTGET -t s "$dtb" / compatible | wc -c) > > > - echo ".int 0x640c8005" > > > - echo ".int " $compatlen > > > + echo ".byte 0x05, 0x80, 0x0c, 0x64" > > > + python -c "print(\".byte 0x%02x, 0x%02x, 0x%02x, > > > 0x%02x\\n\" % ($compatlen & 0xff, ($compatlen >> 8) & 0xff, ($compatlen > > > >> 16) & 0xff, ($compatlen >> 24) & 0xff))" > > > > Rather than adding a build-time dependency on python, maybe we should > > just handle this in C? > > We use sphinx for documentation generation so we already have dependency on > python. > > Here is an another solution: > > - echo ".int " $compatlen > + echo ".byte " $(printf "%08x" $compatlen | sed > "s/\(..\)/0x\1\n/g" | tac | xargs | sed "s/ /, /g") yet another alternative: awk -v var=$compatlen 'BEGIN { for (i = 0; i < 4; ++i) ba[i] = and(rshift(var, 8 * i), 0xff); printf ".byte 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", ba[0], ba[1], ba[2], ba[3]; }' It's not shorter, but maybe a bit more obvious what it does. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König| Industrial Linux Solutions | http://www.pengutronix.de/ | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox