ARM: Kirkwood: Add support for Excito Bubba B3
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
The Excito Bubba B3 is a home server, single driver NAS box, Wifi access point, etc.
--- arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/kirkwood-b3.dts | 199 +++++++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/kirkwood-b3.dts
arch/arm/boot/dts/Makefile +2 -1
@@ -71,7 +71,8 @@ dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ integratorcp.dtb dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb -dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \ +dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-b3.dtb \ + kirkwood-cloudbox.dtb \ kirkwood-db-88f6281.dtb \ kirkwood-db-88f6282.dtb \ kirkwood-dns320.dtb \
arch/arm/boot/dts/kirkwood-b3.dts new file +199 -0
199 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Hi Andrew,
Quoted 1 line · Andrew Lunn
The Excito Bubba B3 is a home server, single driver NAS box, Wifi
nit, s/driver/drive/
Quoted 34 lines
access point, etc.
Signed-off-by Andrew Lunn <[email protected]>--- arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/kirkwood-b3.dts | 199 +++++++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/kirkwood-b3.dtsarch/arm/boot/dts/Makefile +2
-1@@ -71,7 +71,8 @@ dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ integratorcp.dtb dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb -dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \ +dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-b3.dtb \ + kirkwood-cloudbox.dtb \ kirkwood-db-88f6281.dtb \ kirkwood-db-88f6282.dtb \ kirkwood-dns320.dtb \arch/arm/boot/dts/kirkwood-b3.dts new file +5
-0@@ -0,0 +1,199 @@ +/* + * Device Tree file for Excito Bubba B3 + * + * Copyright (C) 2013, Andrew Lunn <[email protected]> + *
arch/arm/boot/dts/kirkwood-b3.dts line 15
Quoted 10 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +10
-0+ * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Note: This requires a new'ish version of u-boot, which disables the + * L2 cache. If your B3 silently fails to boot, u-boot is probably too + * old. Either upgrade, or consider the following email: + * + * http://lists.debian.org/debian-arm/2012/08/msg00128.html
Nice, thanks for adding this.
Quoted 21 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +21
-0+ */ + +/dts-v1/; + +#include "kirkwood.dtsi" +#include "kirkwood-6281.dtsi" + +/ { + model = "Excito B3"; + compatible = "excito,b3", "marvell,kirkwood-88f6281", "marvell,kirkwood"; + memory { /* 512 MB */ + device_type = "memory"; + reg = <0x00000000 0x20000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + }; + + mbus { + pcie-controller {
arch/arm/boot/dts/kirkwood-b3.dts line 46
Quoted 10 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +10
-0+ status = "okay"; + + /* Wifi model has Atheros chipset on pcie port */ + pcie at 1,0 { + status = "okay"; + }; + }; + }; + + ocp at f1000000 {
I plan on going though and sorting the nodes under the ocp bus for all the dts files during the next cycle. Would you mind sorting these so we have one less to worry about?
Quoted 20 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +20
-0+ pinctrl: pinctrl at 10000 { + pmx_button_power: pmx-button-power { + marvell,pins = "mpp39"; + marvell,function = "gpio"; + }; + pmx_led_green: pmx-led-green { + marvell,pins = "mpp38"; + marvell,function = "gpio"; + }; + pmx_led_red: pmx-led-red { + marvell,pins = "mpp41"; + marvell,function = "gpio"; + }; + pmx_led_blue: pmx-led-blue { + marvell,pins = "mpp42"; + marvell,function = "gpio"; + }; + pmx_beeper: pmx-beeper { + marvell,pins = "mpp40"; + marvell,function = "gpio";
arch/arm/boot/dts/kirkwood-b3.dts line 76
Quoted 10 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +10
-0+ }; + }; + + i2c at 11000 { + status = "okay"; + /* + * There is something on the bus at address 0x64. + * Not yet identified what it is, maybe the eeprom + * for the Atheros WiFi chip? + */
Not related to accepting this patch, have you found anything in the stock kernel?
arch/arm/boot/dts/kirkwood-b3.dts line 80
Quoted 4 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +4
-0+ }; + + serial at 12000 { + /* Internal on test pins, 3.3v TTL */
Do you have a pointer to a pin layout?
Quoted 46 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +46
-0+ pinctrl-0 = <&pmx_uart0>; + pinctrl-names = "default"; + status = "okay"; + }; + + spi at 10600 { + status = "okay"; + pinctrl-0 = <&pmx_spi>; + pinctrl-names = "default"; + + m25p16 at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "m25p16"; + reg = <0>; + spi-max-frequency = <40000000>; + mode = <0>; + + partition at 0 { + reg = <0x0 0xc0000>; + label = "u-boot"; + }; + + partition at c0000 { + reg = <0xc0000 0x20000>; + label = "u-boot env"; + }; + + partition at e0000 { + reg = <0xe0000 0x120000>; + label = "data"; + }; + }; + }; + + sata at 80000 { + /* One internal, the second as eSATA */ + status = "okay"; + nr-ports = <2>; + }; + }; + + gpio-leds { + /* + * There is one LED "port" on the front and the colours + * mix together giving some interesting combinations.
arch/arm/boot/dts/kirkwood-b3.dts line 136
Quoted 10 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +10
-0+ */ + compatible = "gpio-leds"; + pinctrl-0 = < &pmx_led_green &pmx_led_red + &pmx_led_blue >; + pinctrl-names = "default"; + + programming_led { + label = "bubba3:green:programming"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-off";
Perhaps we can use 'default-state = "off";' here to avoid the linux-specific property?
thx,
Jason.
Quoted 66 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +63
-0+ }; + + error_led { + label = "bubba3:red:error"; + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; + }; + + active_led { + label = "bubba3:blue:active"; + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + pinctrl-0 = <&pmx_button_power>; + pinctrl-names = "default"; + + power-button { + /* On the back */ + label = "Power Button"; + linux,code = <KEY_POWER>; + gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + }; + }; + + beeper: beeper { + /* 4KHz Piezoelectric buzzer */ + compatible = "gpio-beeper"; + pinctrl-0 = <&pmx_beeper>; + pinctrl-names = "default"; + gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; + }; +}; + +&mdio { + status = "okay"; + + ethphy0: ethernet-phy at 8 { + device_type = "ethernet-phy"; + reg = <8>; + }; + + ethphy1: ethernet-phy at 24 { + device_type = "ethernet-phy"; + reg = <24>; + }; +}; + +ð0 { + status = "okay"; + ethernet0-port at 0 { + phy-handle = <ðphy0>; + }; +}; + +ð1 { + status = "okay"; + ethernet1-port at 0 { + phy-handle = <ðphy1>; + }; +}; +Signature · 1 line
1.7.10.4
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 6 lines · Jason Cooper
Hi Andrew,
Quoted 1 line · Andrew Lunn
The Excito Bubba B3 is a home server, single driver NAS box, Wifi
nit, s/driver/drive/
Upps. Thanks
Quoted 8 lines
Quoted 6 lines
+ * Note: This requires a new'ish version of u-boot, which disables the
+ * L2 cache. If your B3 silently fails to boot, u-boot is probably too
+ * old. Either upgrade, or consider the following email:
+ *
+ * http://lists.debian.org/debian-arm/2012/08/msg00128.htmlNice, thanks for adding this.
Yes, i was bashing my head against a brick wall before i went googling and found this.
Quoted 5 lines
arch/arm/boot/dts/kirkwood-b3.dts line 46
Quoted 1 line
arch/arm/boot/dts/kirkwood-b3.dts new file +1
-0+ ocp at f1000000 {I plan on going though and sorting the nodes under the ocp bus for all the dts files during the next cycle. Would you mind sorting these so we have one less to worry about?
Sure. Sort on what? Address, alphabetic on node name?
Quoted 10 lines
arch/arm/boot/dts/kirkwood-b3.dts line 76
Quoted 7 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +7
-0+ i2c at 11000 { + status = "okay"; + /* + * There is something on the bus at address 0x64. + * Not yet identified what it is, maybe the eeprom + * for the Atheros WiFi chip? + */Not related to accepting this patch, have you found anything in the stock kernel?
There is noting in the vendor kernel. I asked Excito about this maybe two years ago. The guy who answered said there is no i2c device on the base board, but i2c does go to the wifi module, hence the assumption given above.
Quoted 7 lines
arch/arm/boot/dts/kirkwood-b3.dts line 80
Quoted 5 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +4
-0+ }; + + serial at 12000 { + /* Internal on test pins, 3.3v TTL */Do you have a pointer to a pin layout?
Yes, i can add a URL to an Excito forum page. They are friendly about this, document it themselves.
Quoted 7 lines
arch/arm/boot/dts/kirkwood-b3.dts line 136
Quoted 4 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +4
-0+ programming_led { + label = "bubba3:green:programming"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-off";Perhaps we can use 'default-state = "off";' here to avoid the linux-specific property?
Sure.
v2 in the next day or two.
Andrew
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Andrew,
Quoted 2 lines · Andrew Lunn
Quoted 1 line · Jason Cooper
On Sat, Dec 28, 2013 at 05:12:11PM +0100, Andrew Lunn wrote:
...
Quoted 7 lines
Quoted 5 lines
arch/arm/boot/dts/kirkwood-b3.dts line 46
Quoted 1 line
arch/arm/boot/dts/kirkwood-b3.dts new file +1
-0+ ocp at f1000000 {I plan on going though and sorting the nodes under the ocp bus for all the dts files during the next cycle. Would you mind sorting these so we have one less to worry about?
Sure. Sort on what? Address, alphabetic on node name?
address please.
...
Quoted 9 lines
Quoted 6 lines
arch/arm/boot/dts/kirkwood-b3.dts line 80
Quoted 4 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +4
-0+ }; + + serial at 12000 { + /* Internal on test pins, 3.3v TTL */Do you have a pointer to a pin layout?
Yes, i can add a URL to an Excito forum page. They are friendly about this, document it themselves.
ok, considering the transience of web pages, perhaps a little ascii art? Not a show stopper, just if you're inclined.
Quoted 11 lines
Quoted 7 lines
arch/arm/boot/dts/kirkwood-b3.dts line 136
Quoted 4 lines
arch/arm/boot/dts/kirkwood-b3.dts new file +4
-0+ programming_led { + label = "bubba3:green:programming"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-off";Perhaps we can use 'default-state = "off";' here to avoid the linux-specific property?
Sure.
v2 in the next day or two.
thx,
Jason.
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
In reply to Jason CooperQuoted 7 lines · Jason Cooper
Quoted 5 lines
+ * Note: This requires a new'ish version of u-boot, which disables the
+ * L2 cache. If your B3 silently fails to boot, u-boot is probably too
+ * old. Either upgrade, or consider the following email:
+ *
+ * http://lists.debian.org/debian-arm/2012/08/msg00128.htmlNice, thanks for adding this.
Nifty.. But what is the root cause for the above?
I'm guessing that at some point the the L1 icache has been enabled, the L1 dcache disabled, and the L2 cache enabled?
If the pv_fixup runs with both L1 caches off and an empty L2 then it shouldn't cause a problem.
If it runs with the icache on lines will be pulled into the L2 by icache fetching and won't be updated by uncached L1 dcache writes.
Is uboot running the kernel with the icache turned on but dcache turned off?
Quoted 1 line
From a kernel side, a possible way to address this might be to move
the pv fixup (__fixup_a_pv_table?) after the mmu and caches are switched on.
But really, any memory writes done prior to enabling the dcache would risk getting lost...
Jason
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 10 lines · Jason Gunthorpe
Quoted 7 lines · Jason Cooper
Quoted 5 lines
+ * Note: This requires a new'ish version of u-boot, which disables the
+ * L2 cache. If your B3 silently fails to boot, u-boot is probably too
+ * old. Either upgrade, or consider the following email:
+ *
+ * http://lists.debian.org/debian-arm/2012/08/msg00128.htmlNice, thanks for adding this.
Quoted 7 lines
Nifty.. But what is the root cause for the above?
I'm guessing that at some point the the L1 icache has been enabled, the L1 dcache disabled, and the L2 cache enabled?
If the
pv_fixupruns with both L1 caches off and an empty L2 then it shouldn't cause a problem.
I'm not 100% sure but I think the issue is that the kernel expects to be running with all of the caches off, but u-boot incorrectly left the l2 on. The L2 is probably not empty (because u-boot was using it).
There is some code modifications done at startup (relating to setting paddr offset?) and since the kernel expects caches to be off it doesn't do any cache maintenance. Which means that things don't work as expected, because stuff is cached in L2 dcache and therefore not seen in the instruction stream (Either icached or uncached).
Anyway, regardless of the specifics running with caches on when the kernel thinks they are off is going to cause all sorts of oddness...
Ian.
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 16 lines · Ian Campbell
Quoted 15 lines · Jason Gunthorpe
Quoted 7 lines · Jason Cooper
Quoted 5 lines
+ * Note: This requires a new'ish version of u-boot, which disables the
+ * L2 cache. If your B3 silently fails to boot, u-boot is probably too
+ * old. Either upgrade, or consider the following email:
+ *
+ * http://lists.debian.org/debian-arm/2012/08/msg00128.htmlNice, thanks for adding this.
Nifty.. But what is the root cause for the above?
I'm guessing that at some point the the L1 icache has been enabled, the L1 dcache disabled, and the L2 cache enabled?
Quoted 6 lines
Quoted 2 lines
If the
pv_fixupruns with both L1 caches off and an empty L2 then it shouldn't cause a problem.I'm not 100% sure but I think the issue is that the kernel expects to be running with all of the caches off, but u-boot incorrectly left the l2 on. The L2 is probably not empty (because u-boot was using it).
I think I see the problem now.. The decompressor turns on the L1 dcache, which populates the enabled L2 with write through data. When the decompressor turns the dcache off again the L2 retains some of the kernel image and any data writes done in head.S while the dcache is off could be corrupted if they overlap the L2's retention, specifically the pv_fixup stuff, but other elements could potentially be mangled too.
So all Marvell platforms with their L2 cache controller must boot into the decompressor with the L2 cache completely off, or the kernel needs additional Marvell L2 specific flushing code prior to enabling the MMU :(
.. and since the problem only shows obviously with multiplatform kernels that have been relocated it could be a broader, subtler issue than just your one board ...
Jason C: What do you think about applying this [untested]?
Or do you think the kernel should support booting with L2 on (this is just two instructions, but they need to be conditional on the CPU type :( :( )?
-----
arm: Kirkwood: Log a FW_BUG if the L2 cache is turned on at boot
Linux can't cope if the the L2 cache is enabled at boot. It works sometimes, if the data writes head.S does during the L1 cache-off period do not overlap with lines in the L2.
This is unlikely if CONFIG_ARM_PATCH_PHYS_VIRT is used, as the decompressor will pull a chunk of the kernel code into L2 cache.
arch/arm/mm/cache-feroceon-l2.c +2 -1
@@ -331,7 +331,8 @@ static void __init enable_l2(void)enable_icache ();if (d)enable_dcache (); - } + }else +pr_err (FW_BUG "Feroceon L2: bootloader left the L2 cache on!\n" ); }void __init feroceon_l2_init (int __l2_wt_override)
Jason
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 3 lines
.. and since the problem only shows obviously with multiplatform kernels that have been relocated it could be a broader, subtler issue than just your one board ...
It is not just this board. It is any board using an old mainline u-boot. Any such system will not boot with a kernel after 3.1. It was at that point that the issue was found and fixed in u-boot. My Bubba3 has a u-boot before that point...
Quoted 1 line
Jason C: What do you think about applying this [untested]?
I'm away for the weekend, so cannot test it.
Quoted 3 lines
Or do you think the kernel should support booting with L2 on (this is just two instructions, but they need to be conditional on the CPU type :( :( )?
It would be good to at least put the fix into the impedance matcher, so there is no need to mess with the kernel.
Andrew
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
In reply to Jason GunthorpeQuoted 37 lines · Jason Gunthorpe
Quoted 16 lines · Ian Campbell
Quoted 15 lines · Jason Gunthorpe
Quoted 7 lines · Jason Cooper
Quoted 5 lines
+ * Note: This requires a new'ish version of u-boot, which disables the
+ * L2 cache. If your B3 silently fails to boot, u-boot is probably too
+ * old. Either upgrade, or consider the following email:
+ *
+ * http://lists.debian.org/debian-arm/2012/08/msg00128.htmlNice, thanks for adding this.
Nifty.. But what is the root cause for the above?
I'm guessing that at some point the the L1 icache has been enabled, the L1 dcache disabled, and the L2 cache enabled?
Quoted 6 lines
Quoted 2 lines
If the
pv_fixupruns with both L1 caches off and an empty L2 then it shouldn't cause a problem.I'm not 100% sure but I think the issue is that the kernel expects to be running with all of the caches off, but u-boot incorrectly left the l2 on. The L2 is probably not empty (because u-boot was using it).
I think I see the problem now.. The decompressor turns on the L1 dcache, which populates the enabled L2 with write through data. When the decompressor turns the dcache off again the L2 retains some of the kernel image and any data writes done in
head.Swhile the dcache is off could be corrupted if they overlap the L2's retention, specifically thepv_fixupstuff, but other elements could potentially be mangled too.So all Marvell platforms with their L2 cache controller must boot into the decompressor with the L2 cache completely off, or the kernel needs additional Marvell L2 specific flushing code prior to enabling the MMU :(
Quoted 5 lines
.. and since the problem only shows obviously with multiplatform kernels that have been relocated it could be a broader, subtler issue than just your one board ...
Jason C: What do you think about applying this [untested]?
I'm of the opinion that the kernel shouldn't assume the state of the system when it begins execution. Sure it's nice to point fingers at the bootloader (especially since it's obviously wrong in this situation), but we need Linux to boot on systems with non-upgradeable bootloaders which may be broken. I'm specifically thinking about hobbyists modifying boxes they bought at $bigbox stores.
So, I'd prefer to handle this more gracefully. I don't have much experience at the low-level init of the caches, couldn't we enable and flush rather than throwing the error?
thx,
Jason (C).
Quoted 33 lines
Or do you think the kernel should support booting with L2 on (this is just two instructions, but they need to be conditional on the CPU type :( :( )?
-----
arm: Kirkwood: Log aFW_BUGif the L2 cache is turned on at bootLinux can't cope if the the L2 cache is enabled at boot. It works sometimes, if the data writes
head.Sdoes during the L1 cache-off period do not overlap with lines in the L2.This is unlikely if
CONFIG_ARM_PATCH_PHYS_VIRTis used, as the decompressor will pull a chunk of the kernel code into L2 cache.Signed-off-by Jason Gunthorpe <[email protected]>arch/arm/mm/cache-feroceon-l2.c +2
-1@@ -331,7 +331,8 @@ static void __init enable_l2(void)enable_icache ();if (d)enable_dcache (); - } + }else +pr_err (FW_BUG "Feroceon L2: bootloader left the L2 cache on!\n" ); }void __init feroceon_l2_init (int __l2_wt_override)Jason
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 8 lines · Jason Cooper
Quoted 1 line
Jason C: What do you think about applying this [untested]?
I'm of the opinion that the kernel shouldn't assume the state of the system when it begins execution. Sure it's nice to point fingers at the bootloader (especially since it's obviously wrong in this situation), but we need Linux to boot on systems with non-upgradeable bootloaders which may be broken. I'm specifically thinking about hobbyists modifying boxes they bought at $bigbox stores.
I liked the idea of your impedance matcher fixing up bootloader problems. It would be pretty easy to have a feroceon specific path in the impedance matcher to disable the L2.
Quoted 3 lines
So, I'd prefer to handle this more gracefully. I don't have much experience at the low-level init of the caches, couldn't we enable and flush rather than throwing the error?
It cannot be solved in cache-feroceon-l2.c.
In many cases you won't even get that far:
- It will blow up in head.S when the cache is off: decompressor wrote writeback data to into the L2 and uncached fetches see memory content prior to decompression
- It will blow up after head.S enables the L1: decompressor wrote data into the L2 but the relocation writes done with the L1 off made changes to memory that were not captured in the L2.
So to solve it gracefully it has to be done before the decompressor enables the L1. Which leaves the bootloader, impedance matcher or decompressor startup code as possible places.
The code required is a flush invalidate and then disable of the L2 cache, which is only about 5 instructions, but they must be conditionalized somehow on the CPU type :(
The purpose of my patch is to highlight the problem to the bootloader people. If you luck out and successfully boot with the L2 cache enabled you can at least see the message that the bootloader is wrong.
Jason
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 10 lines · Jason Gunthorpe
Quoted 8 lines · Jason Cooper
Quoted 1 line
Jason C: What do you think about applying this [untested]?
I'm of the opinion that the kernel shouldn't assume the state of the system when it begins execution. Sure it's nice to point fingers at the bootloader (especially since it's obviously wrong in this situation), but we need Linux to boot on systems with non-upgradeable bootloaders which may be broken. I'm specifically thinking about hobbyists modifying boxes they bought at $bigbox stores.
Quoted 3 lines
I liked the idea of your impedance matcher fixing up bootloader problems. It would be pretty easy to have a feroceon specific path in the impedance matcher to disable the L2.
Agreed.
Quoted 14 lines
Quoted 3 lines
So, I'd prefer to handle this more gracefully. I don't have much experience at the low-level init of the caches, couldn't we enable and flush rather than throwing the error?
It cannot be solved in
cache-feroceon-l2.c.In many cases you won't even get that far:
- It will blow up inhead.Swhen the cache is off: decompressor wrote writeback data to into the L2 and uncached fetches see memory content prior to decompression
- It will blow up afterhead.Senables the L1: decompressor wrote data into the L2 but the relocation writes done with the L1 off made changes to memory that were not captured in the L2.
Quoted 7 lines
So to solve it gracefully it has to be done before the decompressor enables the L1. Which leaves the bootloader, impedance matcher or decompressor startup code as possible places.
The code required is a flush invalidate and then disable of the L2 cache, which is only about 5 instructions, but they must be conditionalized somehow on the CPU type :(
And there's the problem. Even at my young LKML age, I know that's a non-starter. :)
Quoted 3 lines
The purpose of my patch is to highlight the problem to the bootloader people. If you luck out and successfully boot with the L2 cache enabled you can at least see the message that the bootloader is wrong.
Sounds sane to me, feel free to add my Acked-by and put it in Russell's patch tracker. I'd also ask that you add the above summary to the commit message. I'm sure Russell doesn't need it, but it'll help someone doing a 'git blame ...' down the road.
thx,
Jason.
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
In reply to Jason GunthorpeQuoted 6 lines
Quoted 3 lines
So, I'd prefer to handle this more gracefully. I don't have much experience at the low-level init of the caches, couldn't we enable and flush rather than throwing the error?
It cannot be solved in
cache-feroceon-l2.c.
Quoted 7 lines
In many cases you won't even get that far:
- It will blow up inhead.Swhen the cache is off: decompressor wrote writeback data to into the L2 and uncached fetches see memory content prior to decompression
- It will blow up afterhead.Senables the L1: decompressor wrote data into the L2 but the relocation writes done with the L1 off made changes to memory that were not captured in the L2.
My impression with booting a lot of times while doing i bisect, was that it got as far as:
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.13.0-rc1-dirty (lunn at laptop) (gcc version 4.4.5 (Debian 4.4.5-8) ) #7 PREEMPT Fri Jan 3 09:25:07 CST 2014
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Marvell Kirkwood (Flattened Device Tree), model: QNAP TS219 family
Memory policy: ECC disabled, Data cache writeback
every time.
It frequently got as far as
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
Kernel command line: root=/dev/sda2 console=ttyS0,115200 earlyprintk
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512704K/524288K available (4693K kernel code, 247K rwdata, 1264K rodata, 154K init, 616K bss, 11584K reserved) Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc05d9678 (5958 kB)
.init : 0xc05da000 - 0xc0600ab0 ( 155 kB)
.data : 0xc0602000 - 0xc063fcc0 ( 248 kB)
.bss : 0xc063fccc - 0xc06d9ef0 ( 617 kB)SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 Preemptible hierarchical RCU implementation.
NR_IRQS:114sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 21474ms
And never made it past
Console: colour dummy device 80x30
Calibrating delay loop... 1587.60 BogoMIPS (lpj=7938048)
with L2 enabled.
Now clearly there is a difference between how far it got before everything stops, and the point where corruption has occurred and unavoidable death is going to happen sometime in the future.
It does however seem possible to insert platform specific code soon after it prints:
Machine: Marvell Kirkwood (Flattened Device Tree), model: QNAP TS219 family
but i never got around to trying to disable and flush L2 at that point. And the hardware is now also on the other side of the pond, and i have no way to remotely power cycle it.
Andrew
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 25 lines · Andrew Lunn
Quoted 6 lines
Quoted 3 lines
So, I'd prefer to handle this more gracefully. I don't have much experience at the low-level init of the caches, couldn't we enable and flush rather than throwing the error?
It cannot be solved in
cache-feroceon-l2.c.Quoted 7 lines
In many cases you won't even get that far:
- It will blow up inhead.Swhen the cache is off: decompressor wrote writeback data to into the L2 and uncached fetches see memory content prior to decompression
- It will blow up afterhead.Senables the L1: decompressor wrote data into the L2 but the relocation writes done with the L1 off made changes to memory that were not captured in the L2.My impression with booting a lot of times while doing i bisect, was that it got as far as:
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU0x0
Linux version 3.13.0-rc1-dirty (lunn at laptop) (gcc version 4.4.5 (Debian 4.4.5-8) ) #7 PREEMPT Fri Jan 3 09:25:07 CST 2014
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Marvell Kirkwood (Flattened Device Tree), model: QNAP TS219 family
Memory policy: ECC disabled, Data cache writeback
Quoted 1 line
every time.
It should be deterministic, but 'random' in the sense it is sensitive to exactly the data pattern generated by the decompressor and exactly the data pattern generated by the relocation writes - so the corruption will vary depending on the kernel image content (position of the relocations) and also the size of the L2.
You are likely seeing the 2nd failure I predicted, which is a failure when a cache line containing a relocation is used, and happened to be in the L2.
The first failure would require the kernel image to be smaller than the cache or the cache eviction policy to be such that the initial part of the decompressed image remains dirty and unevicted in the L2.
Quoted 4 lines
It does however seem possible to insert platform specific code soon after it prints:
Machine: Marvell Kirkwood (Flattened Device Tree), model: QNAP TS219 family
So if you attempt to do the flush/disable at this point you are relying on the L2 containing no dirty lines that overlap with lines that were changed by the relocator while the cache was off.
This is *probably* true in many cases, but it is sktechy, and creates a hidden hard to find pitfall. This is basically the same 'probably' that enables non-relocated kernels to boot.
Basically, you might get a bootable system, but it is technically wrong and has a theoretical hole.
Jason
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
In reply to Jason CooperQuoted 2 lines · Jason Cooper
I'm of the opinion that the kernel shouldn't assume the state of the system when it begins execution.
Rubbish. The kernel's requirements are well documented, and have been for years. The reason we've documented it is because it _matters_, and it's hard to sort out this crap before the kernel starts.
Think about it - think about how many different L2 caches there are out there.
Think about how difficult it is to locate the L2 cache controller when you don't know what platform you're running on.
Think about how difficult it is to disable the L2 cache.
Think about how difficult it is to flush the L2 cache, when you don't know what sort it is, where it's located, or what instructions to use to do that.
The kernel cares about its boot environment beacuse of these issues.
Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad. Estimate before purchase was "up to 13.2Mbit".
PATCH 1/1 ARM: Kirkwood: Add support for Excito Bubba B3
Quoted 14 lines · Russell King - ARM Linux
Quoted 2 lines · Jason Cooper
I'm of the opinion that the kernel shouldn't assume the state of the system when it begins execution.
Rubbish. The kernel's requirements are well documented, and have been for years. The reason we've documented it is because it _matters_, and it's hard to sort out this crap before the kernel starts.
Think about it - think about how many different L2 caches there are out there.
Think about how difficult it is to locate the L2 cache controller when you don't know what platform you're running on.
Quoted 7 lines
Think about how difficult it is to disable the L2 cache.
Think about how difficult it is to flush the L2 cache, when you don't know what sort it is, where it's located, or what instructions to use to do that.
The kernel cares about its boot environment beacuse of these issues.
Agreed. My failure was applying the thought process for drivers (eg mv643xx_eth) to the core kernel code. With a network driver we are often in a situation where sometimes the clocks are gated, sometimes they aren't.
For example, doing tftp boot during development, and nandboot in production. In that case, sometimes the bootloader sets things up and sometimes it doesn't depending on the bootloader environment. The mv643xx_eth driver can't assume the state that's handed to it.
But as you and JasonG have clearly explained, that doesn't carry weight so early in the boot process for all the reasons you mentioned.
thx,
Jason.