ARM: mvebu: fix overlap of Crypto SRAM with PCIe memory window
PATCH 1/1 ARM: mvebu: fix overlap of Crypto SRAM with PCIe memory window
When the Crypto SRAM mappings were added to the Device Tree files describing the Armada XP boards in commit c466d997bb16 ("ARM: mvebu:
define crypto SRAM ranges for all armada-xp boards"), the fact that those mappings were overlaping with the PCIe memory aperture was overlooked. Due to this, we currently have for all Armada XP platforms a situation that looks like this:
Memory mapping on Armada XP boards with internal registers at 0xf1000000:
- 0x00000000 -> 0xf0000000 3.75G RAM
- 0xf0000000 -> 0xf1000000 16M NOR flashes (AXP GP / AXP DB)
- 0xf1000000 -> 0xf1100000 1M internal registers
- 0xf8000000 -> 0xffe0000 126M PCIe memory aperture
- 0xf8100000 -> 0xf8110000 64KB Crypto SRAM #0 => OVERLAPS WITH PCIE !
- 0xf8110000 -> 0xf8120000 64KB Crypto SRAM #1 => OVERLAPS WITH PCIE !
- 0xffe00000 -> 0xfff00000 1M PCIe I/O aperture
- 0xfff0000 -> 0xffffffff 1M BootROM
The overlap means that when PCIe devices are added, depending on their memory window needs, they might or might not be mapped into the physical address space. Indeed, they will not be mapped if the area allocated in the PCIe memory aperture by the PCI core overlaps with one of the Crypto SRAM. Typically, a Intel IGB PCIe NIC that needs 8MB of PCIe memory will see its PCIe memory window allocated from 0xf80000000 for 8MB, which overlaps with the Crypto SRAM windows. Due to this, the PCIe window is not created, and any attempt to access the PCIe window makes the kernel explode:
[ 3.302213] igb: Copyright (c) 2007-2014 Intel Corporation. [ 3.307841] pci 0000:00:09.0: enabling device (0140 -> 0143) [ 3.313539] mvebu_mbus: cannot add window '4:f8', conflicts with another window [ 3.320870] mvebu-pcie soc:pcie-controller: Could not create MBus window at [mem 0xf8000000-0xf87fffff]: -22 [ 3.330811] Unhandled fault: external abort on non-linefetch (0x1008) at 0xf08c0018
This problem does not occur on Armada 370 boards, because we use the following memory mapping (for boards that have internal registers at 0xf1000000):
- 0x00000000 -> 0xf0000000 3.75G RAM
- 0xf0000000 -> 0xf1000000 16M NOR flashes (AXP GP / AXP DB)
- 0xf1000000 -> 0xf1100000 1M internal registers
- 0xf1100000 -> 0xf1110000 64KB Crypto SRAM #0 => OK !
- 0xf8000000 -> 0xffe0000 126M PCIe memory
- 0xffe00000 -> 0xfff00000 1M PCIe I/O
- 0xfff0000 -> 0xffffffff 1M BootROM
Obviously, the solution is to align the location of the Crypto SRAM mappings of Armada XP to be similar with the ones on Armada 370, i.e have them between the "internal registers" area and the beginning of the PCIe aperture.
However, we have a special case with the OpenBlocks AX3-4 platform, which has a 128 MB NOR flash. Currently, this NOR flash is mapped from 0xf0000000 to 0xf8000000. This is possible because on OpenBlocks AX3-4, the internal registers are not at 0xf1000000. And this explains why the Crypto SRAM mappings were not configured at the same place on Armada XP.
Hence, the solution is two-fold:
(1) Move the NOR flash mapping on Armada XP OpenBlocks AX3-4 from
0xe8000000 to 0xf0000000. This frees the 0xf0000000 ->
0xf80000000 space.(2) Move the Crypto SRAM mappings on Armada XP to be similar to Armada 370 (except of course that Armada XP has two Crypto SRAM and not one).
After this patch, the memory mapping on Armada XP boards with registers at 0xf1 is:
- 0x00000000 -> 0xf0000000 3.75G RAM
- 0xf0000000 -> 0xf1000000 16M NOR flashes (AXP GP / AXP DB)
- 0xf1000000 -> 0xf1100000 1M internal registers
- 0xf1100000 -> 0xf1110000 64KB Crypto SRAM #0
- 0xf1110000 -> 0xf1120000 64KB Crypto SRAM #1
- 0xf8000000 -> 0xffe0000 126M PCIe memory
- 0xffe00000 -> 0xfff00000 1M PCIe I/O
- 0xfff0000 -> 0xffffffff 1M BootROM
And the memory mapping for the special case of the OpenBlocks AX3-4 (internal registers at 0xd0000000, NOR of 128 MB):
- 0x00000000 -> 0xc0000000 3G RAM
- 0xd0000000 -> 0xd1000000 1M internal registers
- 0xe800000 -> 0xf0000000 128M NOR flash
- 0xf1100000 -> 0xf1110000 64KB Crypto SRAM #0
- 0xf1110000 -> 0xf1120000 64KB Crypto SRAM #1
- 0xf8000000 -> 0xffe0000 126M PCIe memory
- 0xffe00000 -> 0xfff00000 1M PCIe I/O
- 0xfff0000 -> 0xffffffff 1M BootROM
--- arch/arm/boot/dts/armada-xp-axpwifiap.dts | 4 ++-- arch/arm/boot/dts/armada-xp-db.dts | 4 ++-- arch/arm/boot/dts/armada-xp-gp.dts | 4 ++-- arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts | 4 ++-- arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 4 ++-- arch/arm/boot/dts/armada-xp-matrix.dts | 4 ++-- arch/arm/boot/dts/armada-xp-netgear-rn2120.dts | 4 ++-- arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 6 +++--- arch/arm/boot/dts/armada-xp-synology-ds414.dts | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-)
arch/arm/boot/dts/armada-xp-axpwifiap.dts +2 -2
@@ -70,8 +70,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";
arch/arm/boot/dts/armada-xp-db.dts +2 -2
@@ -76,8 +76,8 @@ ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x1000000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; devbus-bootcs { status = "okay";
arch/arm/boot/dts/armada-xp-gp.dts +2 -2
@@ -95,8 +95,8 @@ ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x1000000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; devbus-bootcs { status = "okay";
arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts +2 -2
@@ -65,8 +65,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";
arch/arm/boot/dts/armada-xp-linksys-mamba.dts +2 -2
@@ -70,8 +70,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";
arch/arm/boot/dts/armada-xp-matrix.dts +2 -2
@@ -68,8 +68,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; internal-regs { serial at 12000 {
arch/arm/boot/dts/armada-xp-netgear-rn2120.dts +2 -2
@@ -64,8 +64,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +3 -3
@@ -65,9 +65,9 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x01, 0x2f) 0 0 0xe8000000 0x8000000 + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; devbus-bootcs { status = "okay";
arch/arm/boot/dts/armada-xp-synology-ds414.dts +2 -2
@@ -78,8 +78,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";
Signature · 1 line
2.6.4
PATCH 1/1 ARM: mvebu: fix overlap of Crypto SRAM with PCIe memory window
Hi Thomas,
Quoted 93 lines · Thomas Petazzoni
When the Crypto SRAM mappings were added to the Device Tree files describing the Armada XP boards in commit
c466d997bb16("ARM: mvebu:
define crypto SRAM ranges for all armada-xp boards"), the fact that those mappings were overlaping with the PCIe memory aperture was overlooked. Due to this, we currently have for all Armada XP platforms a situation that looks like this:Memory mapping on Armada XP boards with internal registers at
0xf1000000:-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf8000000->0xffe0000126M PCIe memory aperture
-0xf8100000->0xf811000064KB Crypto SRAM #0 => OVERLAPS WITH PCIE !
-0xf8110000->0xf812000064KB Crypto SRAM #1 => OVERLAPS WITH PCIE !
-0xffe00000->0xfff000001M PCIe I/O aperture
-0xfff0000->0xffffffff1M BootROMThe overlap means that when PCIe devices are added, depending on their memory window needs, they might or might not be mapped into the physical address space. Indeed, they will not be mapped if the area allocated in the PCIe memory aperture by the PCI core overlaps with one of the Crypto SRAM. Typically, a Intel IGB PCIe NIC that needs 8MB of PCIe memory will see its PCIe memory window allocated from
0xf80000000for 8MB, which overlaps with the Crypto SRAM windows. Due to this, the PCIe window is not created, and any attempt to access the PCIe window makes the kernel explode:[ 3.302213] igb: Copyright (c) 2007-2014 Intel Corporation. [ 3.307841] pci 0000:00:09.0: enabling device (0140 -> 0143) [ 3.313539] mvebu_mbus: cannot add window '4:f8', conflicts with another window [ 3.320870] mvebu-pcie soc:pcie-controller: Could not create MBus window at [mem 0xf8000000-0xf87fffff]: -22 [ 3.330811] Unhandled fault: external abort on non-linefetch (0x1008) at 0xf08c0018This problem does not occur on Armada 370 boards, because we use the following memory mapping (for boards that have internal registers at
0xf1000000):-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf1100000->0xf111000064KB Crypto SRAM #0 => OK !
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROMObviously, the solution is to align the location of the Crypto SRAM mappings of Armada XP to be similar with the ones on Armada 370, i.e have them between the "internal registers" area and the beginning of the PCIe aperture.
However, we have a special case with the OpenBlocks AX3-4 platform, which has a 128 MB NOR flash. Currently, this NOR flash is mapped from
0xf0000000to0xf8000000. This is possible because on OpenBlocks AX3-4, the internal registers are not at0xf1000000. And this explains why the Crypto SRAM mappings were not configured at the same place on Armada XP.Hence, the solution is two-fold:
(1) Move the NOR flash mapping on Armada XP OpenBlocks AX3-4 from
0xe8000000 to 0xf0000000. This frees the 0xf0000000 -> 0xf80000000 space.(2) Move the Crypto SRAM mappings on Armada XP to be similar to Armada 370 (except of course that Armada XP has two Crypto SRAM and not one).
After this patch, the memory mapping on Armada XP boards with registers at
0xf1is:-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf1100000->0xf111000064KB Crypto SRAM #0
-0xf1110000->0xf112000064KB Crypto SRAM #1
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROMAnd the memory mapping for the special case of the OpenBlocks AX3-4 (internal registers at
0xd0000000, NOR of 128 MB):-
0x00000000->0xc00000003G RAM
-0xd0000000->0xd10000001M internal registers
-0xe800000->0xf0000000128M NOR flash
-0xf1100000->0xf111000064KB Crypto SRAM #0
-0xf1110000->0xf112000064KB Crypto SRAM #1
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROM
Quoted 5 lines
Fixes c466d997bb16 ("ARM: mvebu: define crypto SRAM ranges for all armada-xp boards")Reported-by Phil Sutter <[email protected]>Cc Phil Sutter <[email protected]>Cc <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>
Arnd, Olof,
it would be nice having this fix applied on v4.5-rc. Could you applied this patch directly, or do you want pull request for it?
Thanks,
Gregory
Quoted 12 lines
--- arch/arm/boot/dts/armada-xp-axpwifiap.dts | 4 ++-- arch/arm/boot/dts/armada-xp-db.dts | 4 ++-- arch/arm/boot/dts/armada-xp-gp.dts | 4 ++-- arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts | 4 ++-- arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 4 ++-- arch/arm/boot/dts/armada-xp-matrix.dts | 4 ++-- arch/arm/boot/dts/armada-xp-netgear-rn2120.dts | 4 ++-- arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 6 +++--- arch/arm/boot/dts/armada-xp-synology-ds414.dts | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-)
[...]
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Olof Johansson
AppliedPATCH 1/1 ARM: mvebu: fix overlap of Crypto SRAM with PCIe memory window
Quoted 103 lines · Gregory CLEMENT
Hi Thomas,
Quoted 93 lines · Thomas Petazzoni
When the Crypto SRAM mappings were added to the Device Tree files describing the Armada XP boards in commit
c466d997bb16("ARM: mvebu:
define crypto SRAM ranges for all armada-xp boards"), the fact that those mappings were overlaping with the PCIe memory aperture was overlooked. Due to this, we currently have for all Armada XP platforms a situation that looks like this:Memory mapping on Armada XP boards with internal registers at
0xf1000000:-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf8000000->0xffe0000126M PCIe memory aperture
-0xf8100000->0xf811000064KB Crypto SRAM #0 => OVERLAPS WITH PCIE !
-0xf8110000->0xf812000064KB Crypto SRAM #1 => OVERLAPS WITH PCIE !
-0xffe00000->0xfff000001M PCIe I/O aperture
-0xfff0000->0xffffffff1M BootROMThe overlap means that when PCIe devices are added, depending on their memory window needs, they might or might not be mapped into the physical address space. Indeed, they will not be mapped if the area allocated in the PCIe memory aperture by the PCI core overlaps with one of the Crypto SRAM. Typically, a Intel IGB PCIe NIC that needs 8MB of PCIe memory will see its PCIe memory window allocated from
0xf80000000for 8MB, which overlaps with the Crypto SRAM windows. Due to this, the PCIe window is not created, and any attempt to access the PCIe window makes the kernel explode:[ 3.302213] igb: Copyright (c) 2007-2014 Intel Corporation. [ 3.307841] pci 0000:00:09.0: enabling device (0140 -> 0143) [ 3.313539] mvebu_mbus: cannot add window '4:f8', conflicts with another window [ 3.320870] mvebu-pcie soc:pcie-controller: Could not create MBus window at [mem 0xf8000000-0xf87fffff]: -22 [ 3.330811] Unhandled fault: external abort on non-linefetch (0x1008) at 0xf08c0018This problem does not occur on Armada 370 boards, because we use the following memory mapping (for boards that have internal registers at
0xf1000000):-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf1100000->0xf111000064KB Crypto SRAM #0 => OK !
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROMObviously, the solution is to align the location of the Crypto SRAM mappings of Armada XP to be similar with the ones on Armada 370, i.e have them between the "internal registers" area and the beginning of the PCIe aperture.
However, we have a special case with the OpenBlocks AX3-4 platform, which has a 128 MB NOR flash. Currently, this NOR flash is mapped from
0xf0000000to0xf8000000. This is possible because on OpenBlocks AX3-4, the internal registers are not at0xf1000000. And this explains why the Crypto SRAM mappings were not configured at the same place on Armada XP.Hence, the solution is two-fold:
(1) Move the NOR flash mapping on Armada XP OpenBlocks AX3-4 from
0xe8000000 to 0xf0000000. This frees the 0xf0000000 -> 0xf80000000 space.(2) Move the Crypto SRAM mappings on Armada XP to be similar to Armada 370 (except of course that Armada XP has two Crypto SRAM and not one).
After this patch, the memory mapping on Armada XP boards with registers at
0xf1is:-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf1100000->0xf111000064KB Crypto SRAM #0
-0xf1110000->0xf112000064KB Crypto SRAM #1
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROMAnd the memory mapping for the special case of the OpenBlocks AX3-4 (internal registers at
0xd0000000, NOR of 128 MB):-
0x00000000->0xc00000003G RAM
-0xd0000000->0xd10000001M internal registers
-0xe800000->0xf0000000128M NOR flash
-0xf1100000->0xf111000064KB Crypto SRAM #0
-0xf1110000->0xf112000064KB Crypto SRAM #1
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROMQuoted 5 lines
Fixes c466d997bb16 ("ARM: mvebu: define crypto SRAM ranges for all armada-xp boards")Reported-by Phil Sutter <[email protected]>Cc Phil Sutter <[email protected]>Cc <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 6 lines
Acked-by Gregory CLEMENT <[email protected]>Arnd, Olof,
it would be nice having this fix applied on v4.5-rc. Could you applied this patch directly, or do you want pull request for it?
Applied to fixes. Are you 150% sure you don't need some bake time on this patch to avoid surprises?
-Olof
PATCH 1/1 ARM: mvebu: fix overlap of Crypto SRAM with PCIe memory window
In reply to Thomas Petazzoni-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Quoted 6 lines · Thomas Petazzoni
When the Crypto SRAM mappings were added to the Device Tree files describing the Armada XP boards in commit
c466d997bb16("ARM: mvebu:
define crypto SRAM ranges for all armada-xp boards"), the fact that those mappings were overlaping with the PCIe memory aperture was overlooked. Due to this, we currently have for all Armada XP platforms a situation that looks like this:
This patch fixes the issues for me, at least with proprietary U-Boot underneath (I checked, they were still present with upstream kernel). Thanks a lot!
Cheers, Phil
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iEYEARECAAYFAlbibIYACgkQnMPprxY1hCc2GACgmj9bNXnF6QDvCVk2Q5+R/gB2 3e0AoIhosGwE22VnZ1Le8S6X0JRjeVfR
=w853
-----END PGP SIGNATURE-----
PATCH 1/1 ARM: mvebu: fix overlap of Crypto SRAM with PCIe memory window
In reply to Thomas PetazzoniQuoted 93 lines · On Tue, 8 Mar 2016 16:59:57 +0100 Thomas Petazzoni…
When the Crypto SRAM mappings were added to the Device Tree files describing the Armada XP boards in commit
c466d997bb16("ARM: mvebu:
define crypto SRAM ranges for all armada-xp boards"), the fact that those mappings were overlaping with the PCIe memory aperture was overlooked. Due to this, we currently have for all Armada XP platforms a situation that looks like this:Memory mapping on Armada XP boards with internal registers at
0xf1000000:-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf8000000->0xffe0000126M PCIe memory aperture
-0xf8100000->0xf811000064KB Crypto SRAM #0 => OVERLAPS WITH PCIE !
-0xf8110000->0xf812000064KB Crypto SRAM #1 => OVERLAPS WITH PCIE !
-0xffe00000->0xfff000001M PCIe I/O aperture
-0xfff0000->0xffffffff1M BootROMThe overlap means that when PCIe devices are added, depending on their memory window needs, they might or might not be mapped into the physical address space. Indeed, they will not be mapped if the area allocated in the PCIe memory aperture by the PCI core overlaps with one of the Crypto SRAM. Typically, a Intel IGB PCIe NIC that needs 8MB of PCIe memory will see its PCIe memory window allocated from
0xf80000000for 8MB, which overlaps with the Crypto SRAM windows. Due to this, the PCIe window is not created, and any attempt to access the PCIe window makes the kernel explode:[ 3.302213] igb: Copyright (c) 2007-2014 Intel Corporation. [ 3.307841] pci 0000:00:09.0: enabling device (0140 -> 0143) [ 3.313539] mvebu_mbus: cannot add window '4:f8', conflicts with another window [ 3.320870] mvebu-pcie soc:pcie-controller: Could not create MBus window at [mem 0xf8000000-0xf87fffff]: -22 [ 3.330811] Unhandled fault: external abort on non-linefetch (0x1008) at 0xf08c0018This problem does not occur on Armada 370 boards, because we use the following memory mapping (for boards that have internal registers at
0xf1000000):-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf1100000->0xf111000064KB Crypto SRAM #0 => OK !
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROMObviously, the solution is to align the location of the Crypto SRAM mappings of Armada XP to be similar with the ones on Armada 370, i.e have them between the "internal registers" area and the beginning of the PCIe aperture.
However, we have a special case with the OpenBlocks AX3-4 platform, which has a 128 MB NOR flash. Currently, this NOR flash is mapped from
0xf0000000to0xf8000000. This is possible because on OpenBlocks AX3-4, the internal registers are not at0xf1000000. And this explains why the Crypto SRAM mappings were not configured at the same place on Armada XP.Hence, the solution is two-fold:
(1) Move the NOR flash mapping on Armada XP OpenBlocks AX3-4 from
0xe8000000 to 0xf0000000. This frees the 0xf0000000 -> 0xf80000000 space.(2) Move the Crypto SRAM mappings on Armada XP to be similar to Armada 370 (except of course that Armada XP has two Crypto SRAM and not one).
After this patch, the memory mapping on Armada XP boards with registers at
0xf1is:-
0x00000000->0xf00000003.75G RAM
-0xf0000000->0xf100000016M NOR flashes (AXP GP / AXP DB)
-0xf1000000->0xf11000001M internal registers
-0xf1100000->0xf111000064KB Crypto SRAM #0
-0xf1110000->0xf112000064KB Crypto SRAM #1
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROMAnd the memory mapping for the special case of the OpenBlocks AX3-4 (internal registers at
0xd0000000, NOR of 128 MB):-
0x00000000->0xc00000003G RAM
-0xd0000000->0xd10000001M internal registers
-0xe800000->0xf0000000128M NOR flash
-0xf1100000->0xf111000064KB Crypto SRAM #0
-0xf1110000->0xf112000064KB Crypto SRAM #1
-0xf8000000->0xffe0000126M PCIe memory
-0xffe00000->0xfff000001M PCIe I/O
-0xfff0000->0xffffffff1M BootROM
Quoted 5 lines
Fixes c466d997bb16 ("ARM: mvebu: define crypto SRAM ranges for all armada-xp boards")Reported-by Phil Sutter <[email protected]>Cc Phil Sutter <[email protected]>Cc <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 149 lines
--- arch/arm/boot/dts/armada-xp-axpwifiap.dts | 4 ++-- arch/arm/boot/dts/armada-xp-db.dts | 4 ++-- arch/arm/boot/dts/armada-xp-gp.dts | 4 ++-- arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts | 4 ++-- arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 4 ++-- arch/arm/boot/dts/armada-xp-matrix.dts | 4 ++-- arch/arm/boot/dts/armada-xp-netgear-rn2120.dts | 4 ++-- arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 6 +++--- arch/arm/boot/dts/armada-xp-synology-ds414.dts | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-)arch/arm/boot/dts/armada-xp-axpwifiap.dts +2
-2@@ -70,8 +70,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";arch/arm/boot/dts/armada-xp-db.dts +2
-2@@ -76,8 +76,8 @@ ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x1000000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; devbus-bootcs { status = "okay";arch/arm/boot/dts/armada-xp-gp.dts +2
-2@@ -95,8 +95,8 @@ ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x1000000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; devbus-bootcs { status = "okay";arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts +2
-2@@ -65,8 +65,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";arch/arm/boot/dts/armada-xp-linksys-mamba.dts +2
-2@@ -70,8 +70,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";arch/arm/boot/dts/armada-xp-matrix.dts +2
-2@@ -68,8 +68,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; internal-regs { serial at 12000 {arch/arm/boot/dts/armada-xp-netgear-rn2120.dts +2
-2@@ -64,8 +64,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +3
-3@@ -65,9 +65,9 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x01, 0x2f) 0 0 0xe8000000 0x8000000 + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; devbus-bootcs { status = "okay";arch/arm/boot/dts/armada-xp-synology-ds414.dts +2
-2@@ -78,8 +78,8 @@ soc { ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000 - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>; + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000 + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>; pcie-controller { status = "okay";
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com