configs: am571x_hs_evm_defconfig: Reserve EMIF memory used by PPA
PATCH v2 1/1 configs: am571x_hs_evm_defconfig: Reserve EMIF memory used by PPA
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set CONFIG_SYS_MEM_TOP_HIDE to reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.
---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry in MAINTAINERS for new config.
3. Update commit message to use memory size in MB than raw hex bytes
Link to v1:
https://lore.kernel.org/all/[email protected]/
Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66
MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +1 -0
@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfig
configs/am571x_hs_evm_defconfig new file +3 -0
@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Signature · 1 line
2.34.1
Quoted 48 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +0
-0
configs/am571x_hs_evm_defconfig line 3
Quoted 3 lines
configs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.
This "SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..
As CFG_PRAM is set based on TI_SECURE_EMIF_TOTAL_REGION_SIZE which is 32MB for all other AM57x, why is this needed only for AM571? We build for all the AM57x with one defconfig, so this new defconfig will go unused. Just set the default CFG_PRAM size to 64MB (same as AM43x), should be enough for all and doesn't hurt to have more than needed reserved to be safe.
Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.
Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAM is only set if TI_SECURE_EMIF_REGION_START is not set, but we have it set it to 0xbdb00000 in the am57xx_hs_evm_defconfig.
https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.
Quoted 3 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),
I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set CFG_PRAM to 38MB by default, won't we lose out that memory on other devices which do not face this limitation?
Thanks,
Beleswar
Quoted 50 lines
should be enough for all
and doesn't hurt to have more than needed reserved to be safe.Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 +
configs/am571x_hs_evm_defconfig | 3 +++2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +0
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfigF: configs/am335x_hs_evm_uart_defconfig
F: configs/am43xx_hs_evm_defconfig
F: configs/am43xx_hs_evm_qspi_defconfig
+F: configs/am571x_hs_evm_defconfig
F: configs/am57xx_hs_evm_defconfig
F: configs/am57xx_hs_evm_usb_defconfig
F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 25 lines · Beleswar Prasad Padhi
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 8 lines
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Quoted 9 lines
Quoted 3 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?
We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
Andrew
Quoted 53 lines
Thanks,
BeleswarQuoted 50 lines
should be enough for all
and doesn't hurt to have more than needed reserved to be safe.Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 35 lines · Andrew Davis
Quoted 25 lines · Beleswar Prasad Padhi
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 8 lines
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.
Quoted 5 lines
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Well, actually not...
It's the AM62 SIP platform. From DT, it would look like OPTEE is at the top of the DDR[1], but we do a FDT fixup here in u-boot to replace the OPTEE to the start of DDR[2]
[1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi#L71
[2]: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-k3/am62x/am625_fdt.c#L84
I am not sure if we can do such a thing here for mem used by PPA/firmware as it could assume it has that memory hardcoded.
Quoted 17 lines
Quoted 10 lines
Quoted 4 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
Quoted 3 lines
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
TL;DR
I think adding that dynamic support would be tied up only for TI usecase?
Hmm yes, I get your point. But to be able to do this dynamically, we would want to see if gd->relocaddr intersects with CFG_PRAM:
Case 1:gd->relocaddr > (SECURE_REGION_START + SECURE_REGION_SIZE)
= Best case. U-Boot relocates to an address higher than firewalled addr
Case 2:gd->relocaddr <= (SECURE_REGION_START + SECURE_REGION_SIZE) = Fixup needed. U-Boot relocates to an address which could overlap with secure region. Update the gd->relocaddr to a lower address range which won't overlap with secure region:
reloc_text_size = (RAM_TOP - gd->relocaddr); gd->relocaddr = SECURE_REGION_START - reloc_text_size;
And ofcourse, we can't put this logic in the existing 'reserve_pram'[3] INITCALL because gd->relocaddr gets modified in the subsequent initcalls like 'reserve_trace'. We would want to introduce a new INITCALL which would be invoked after all reserve_* initcalls and before the reloc_* initcalls; where we can put this logic.
Let me know if you think this is worth adding, or is an overkill and we can live happily with CFG_PRAM = 38 MB for all AM57x devices :)
[3]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L990
Thanks,
Beleswar
Quoted 57 lines
Andrew
Quoted 53 lines
Thanks,
BeleswarQuoted 50 lines
should be enough for all
and doesn't hurt to have more than needed reserved to be safe.Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 +
configs/am571x_hs_evm_defconfig | 3 +++2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +0
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfigF: configs/am335x_hs_evm_uart_defconfig
F: configs/am43xx_hs_evm_defconfig
F: configs/am43xx_hs_evm_qspi_defconfig
+F: configs/am571x_hs_evm_defconfig
F: configs/am57xx_hs_evm_defconfig
F: configs/am57xx_hs_evm_usb_defconfig
F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 96 lines · Beleswar Prasad Padhi
Quoted 35 lines · Andrew Davis
Quoted 25 lines · Beleswar Prasad Padhi
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 8 lines
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.Quoted 5 lines
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Well, actually not...
It's the AM62 SIP platform. From DT, it would look like OPTEE is at the top of the DDR[1], but we do a FDT fixup here in u-boot to replace the OPTEE to the start of DDR[2][1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi#L71
[2]: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-k3/am62x/am625_fdt.c#L84I am not sure if we can do such a thing here for mem used by PPA/firmware as it could assume it has that memory hardcoded.
Quoted 17 lines
Quoted 10 lines
Quoted 4 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
Quoted 3 lines
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
TL;DR
I think adding that dynamic support would be tied up only for TI usecase?Hmm yes, I get your point. But to be able to do this dynamically, we would want to see if
gd->relocaddrintersects withCFG_PRAM:Case 1:
gd->relocaddr> (SECURE_REGION_START+SECURE_REGION_SIZE)
= Best case. U-Boot relocates to an address higher than firewalled addrCase 2:
gd->relocaddr<= (SECURE_REGION_START+SECURE_REGION_SIZE) = Fixup needed. U-Boot relocates to an address which could overlap with secure region. Update thegd->relocaddrto a lower address range which won't overlap with secure region:
reloc_text_size= (RAM_TOP-gd->relocaddr);gd->relocaddr=SECURE_REGION_START-reloc_text_size;
Quoted 8 lines
And ofcourse, we can't put this logic in the existing 'reserve_pram'[3] INITCALL because
gd->relocaddrgets modified in the subsequent initcalls like 'reserve_trace'. We would want to introduce a new INITCALL which would be invoked after all reserve_* initcalls and before the reloc_* initcalls; where we can put this logic.Let me know if you think this is worth adding, or is an overkill and we can live happily with
CFG_PRAM= 38 MB for all AM57x devices :)
Thanks for doing all this evaluation. I don't think this will be the last time we run into this issue, but for now let's just make CFG_PRAM = 64 MB for all AM57x devices and create the perfect solution later.
Andrew
Quoted 63 lines
[3]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L990
Thanks,
BeleswarQuoted 57 lines
Andrew
Quoted 53 lines
Thanks,
BeleswarQuoted 50 lines
should be enough for all
and doesn't hurt to have more than needed reserved to be safe.Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 105 lines · Andrew Davis
Quoted 102 lines · Beleswar Prasad Padhi
Quoted 35 lines · Andrew Davis
Quoted 25 lines · Beleswar Prasad Padhi
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 8 lines
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.Quoted 5 lines
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Well, actually not...
It's the AM62 SIP platform. From DT, it would look like OPTEE is at the top of the DDR[1], but we do a FDT fixup here in u-boot to replace the OPTEE to the start of DDR[2][1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi#L71
[2]: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-k3/am62x/am625_fdt.c#L84I am not sure if we can do such a thing here for mem used by PPA/firmware as it could assume it has that memory hardcoded.
Quoted 17 lines
Quoted 10 lines
Quoted 4 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
Quoted 3 lines
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
TL;DR
I think adding that dynamic support would be tied up only for TI usecase?Hmm yes, I get your point. But to be able to do this dynamically, we would want to see if
gd->relocaddrintersects withCFG_PRAM:Case 1:
gd->relocaddr> (SECURE_REGION_START+SECURE_REGION_SIZE)
= Best case. U-Boot relocates to an address higher than firewalled addrCase 2:
gd->relocaddr<= (SECURE_REGION_START+SECURE_REGION_SIZE) = Fixup needed. U-Boot relocates to an address which could overlap with secure region. Update thegd->relocaddrto a lower address range which won't overlap with secure region:
reloc_text_size= (RAM_TOP-gd->relocaddr);gd->relocaddr=SECURE_REGION_START-reloc_text_size;And ofcourse, we can't put this logic in the existing 'reserve_pram'[3] INITCALL because
gd->relocaddrgets modified in the subsequent initcalls like 'reserve_trace'. We would want to introduce a new INITCALL which would be invoked after all reserve_* initcalls and before the reloc_* initcalls; where we can put this logic.
Quoted 7 lines
Quoted 2 lines
Let me know if you think this is worth adding, or is an overkill and we can live happily with
CFG_PRAM= 38 MB for all AM57x devices :)Thanks for doing all this evaluation. I don't think this will be the last time we run into this issue, but for now let's just make
CFG_PRAM= 64 MB for all AM57x devices and create the perfect solution later.
Thanks, I tried setting CFG_PRAM but it still ended up in a firewall exception. I guess this is because CFG_PRAM only ensures U-Boot doesn't relocate to that protected address[4], however that memory is still open for access by anything else if needed. Whereas, SYS_MEM_TOP_HIDE reduces the ram size itself[5], which ensures that memory is not visible to U-Boot at all (either for reloc, or general usage).
[4]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L391
[5]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L371
Thanks,
Beleswar
Quoted 67 lines
Andrew
Quoted 63 lines
[3]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L990
Thanks,
BeleswarQuoted 57 lines
Andrew
Quoted 53 lines
Thanks,
BeleswarQuoted 50 lines
should be enough for all
and doesn't hurt to have more than needed reserved to be safe.Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 +
configs/am571x_hs_evm_defconfig | 3 +++2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +0
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfigF: configs/am335x_hs_evm_uart_defconfig
F: configs/am43xx_hs_evm_defconfig
F: configs/am43xx_hs_evm_qspi_defconfig
+F: configs/am571x_hs_evm_defconfig
F: configs/am57xx_hs_evm_defconfig
F: configs/am57xx_hs_evm_usb_defconfig
F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 116 lines · Beleswar Prasad Padhi
Quoted 105 lines · Andrew Davis
Quoted 102 lines · Beleswar Prasad Padhi
Quoted 35 lines · Andrew Davis
Quoted 25 lines · Beleswar Prasad Padhi
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 8 lines
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.Quoted 5 lines
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Well, actually not...
It's the AM62 SIP platform. From DT, it would look like OPTEE is at the top of the DDR[1], but we do a FDT fixup here in u-boot to replace the OPTEE to the start of DDR[2][1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi#L71
[2]: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-k3/am62x/am625_fdt.c#L84I am not sure if we can do such a thing here for mem used by PPA/firmware as it could assume it has that memory hardcoded.
Quoted 17 lines
Quoted 10 lines
Quoted 4 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
Quoted 3 lines
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
TL;DR
I think adding that dynamic support would be tied up only for TI usecase?Hmm yes, I get your point. But to be able to do this dynamically, we would want to see if
gd->relocaddrintersects withCFG_PRAM:Case 1:
gd->relocaddr> (SECURE_REGION_START+SECURE_REGION_SIZE)
= Best case. U-Boot relocates to an address higher than firewalled addrCase 2:
gd->relocaddr<= (SECURE_REGION_START+SECURE_REGION_SIZE) = Fixup needed. U-Boot relocates to an address which could overlap with secure region. Update thegd->relocaddrto a lower address range which won't overlap with secure region:
reloc_text_size= (RAM_TOP-gd->relocaddr);gd->relocaddr=SECURE_REGION_START-reloc_text_size;And ofcourse, we can't put this logic in the existing 'reserve_pram'[3] INITCALL because
gd->relocaddrgets modified in the subsequent initcalls like 'reserve_trace'. We would want to introduce a new INITCALL which would be invoked after all reserve_* initcalls and before the reloc_* initcalls; where we can put this logic.Quoted 7 lines
Quoted 2 lines
Let me know if you think this is worth adding, or is an overkill and we can live happily with
CFG_PRAM= 38 MB for all AM57x devices :)Thanks for doing all this evaluation. I don't think this will be the last time we run into this issue, but for now let's just make
CFG_PRAM= 64 MB for all AM57x devices and create the perfect solution later.
Quoted 6 lines
Thanks, I tried setting
CFG_PRAMbut it still ended up in a firewall exception. I guess this is becauseCFG_PRAMonly ensures U-Boot doesn't relocate to that protected address[4], however that memory is still open for access by anything else if needed. Whereas,SYS_MEM_TOP_HIDEreduces the ram size itself[5], which ensures that memory is not visible to U-Boot at all (either for reloc, or general usage).
Seem PRAM ("Protected" RAM) isn't all it claims to be, better route then is to convert our existing uses of PRAM to SYS_MEM_TOP_HIDE, which seems more modern and uses KConfig.
Andrew
Quoted 74 lines
[4]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L391
[5]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L371Thanks,
BeleswarQuoted 67 lines
Andrew
Quoted 63 lines
[3]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L990
Thanks,
BeleswarQuoted 57 lines
Andrew
Quoted 53 lines
Thanks,
BeleswarQuoted 50 lines
should be enough for all
and doesn't hurt to have more than needed reserved to be safe.Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 124 lines · Andrew Davis
Quoted 116 lines · Beleswar Prasad Padhi
Quoted 105 lines · Andrew Davis
Quoted 102 lines · Beleswar Prasad Padhi
Quoted 35 lines · Andrew Davis
Quoted 25 lines · Beleswar Prasad Padhi
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 8 lines
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.Quoted 5 lines
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Well, actually not...
It's the AM62 SIP platform. From DT, it would look like OPTEE is at the top of the DDR[1], but we do a FDT fixup here in u-boot to replace the OPTEE to the start of DDR[2][1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi#L71
[2]: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-k3/am62x/am625_fdt.c#L84I am not sure if we can do such a thing here for mem used by PPA/firmware as it could assume it has that memory hardcoded.
Quoted 17 lines
Quoted 10 lines
Quoted 4 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
Quoted 3 lines
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
TL;DR
I think adding that dynamic support would be tied up only for TI usecase?Hmm yes, I get your point. But to be able to do this dynamically, we would want to see if
gd->relocaddrintersects withCFG_PRAM:Case 1:
gd->relocaddr> (SECURE_REGION_START+SECURE_REGION_SIZE)
= Best case. U-Boot relocates to an address higher than firewalled addrCase 2:
gd->relocaddr<= (SECURE_REGION_START+SECURE_REGION_SIZE) = Fixup needed. U-Boot relocates to an address which could overlap with secure region. Update thegd->relocaddrto a lower address range which won't overlap with secure region:
reloc_text_size= (RAM_TOP-gd->relocaddr);gd->relocaddr=SECURE_REGION_START-reloc_text_size;And ofcourse, we can't put this logic in the existing 'reserve_pram'[3] INITCALL because
gd->relocaddrgets modified in the subsequent initcalls like 'reserve_trace'. We would want to introduce a new INITCALL which would be invoked after all reserve_* initcalls and before the reloc_* initcalls; where we can put this logic.Quoted 7 lines
Quoted 2 lines
Let me know if you think this is worth adding, or is an overkill and we can live happily with
CFG_PRAM= 38 MB for all AM57x devices :)Thanks for doing all this evaluation. I don't think this will be the last time we run into this issue, but for now let's just make
CFG_PRAM= 64 MB for all AM57x devices and create the perfect solution later.Quoted 6 lines
Thanks, I tried setting
CFG_PRAMbut it still ended up in a firewall exception. I guess this is becauseCFG_PRAMonly ensures U-Boot doesn't relocate to that protected address[4], however that memory is still open for access by anything else if needed. Whereas,SYS_MEM_TOP_HIDEreduces the ram size itself[5], which ensures that memory is not visible to U-Boot at all (either for reloc, or general usage).
Quoted 3 lines
Seem PRAM ("Protected" RAM) isn't all it claims to be, better route then is to convert our existing uses of PRAM to
SYS_MEM_TOP_HIDE, which seems more modern and uses KConfig.
I don't think it's any more or less modern, but to be clear, there's no way (or no reason?) to describe these memory areas in DT? Or is it that we also need to do some game to remove it from U-Boot's view early on because how of little memory there is / where this area is? Thanks!
Signature · 1 line
Tom
Quoted 109 lines · Tom Rini
Quoted 108 lines · Andrew Davis
Quoted 107 lines · Beleswar Prasad Padhi
Quoted 93 lines · Andrew Davis
Quoted 91 lines · Beleswar Prasad Padhi
Quoted 30 lines · Andrew Davis
Quoted 20 lines · Beleswar Prasad Padhi
Quoted 10 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.Quoted 9 lines
https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.Quoted 5 lines
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Well, actually not...
It's the AM62 SIP platform. From DT, it would look like OPTEE is at the top of the DDR[1], but we do a FDT fixup here in u-boot to replace the OPTEE to the start of DDR[2][1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi#L71
[2]: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-k3/am62x/am625_fdt.c#L84I am not sure if we can do such a thing here for mem used by PPA/firmware as it could assume it has that memory hardcoded.
Quoted 14 lines
Quoted 8 lines
Quoted 3 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
Quoted 3 lines
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
TL;DR
I think adding that dynamic support would be tied up only for TI usecase?Hmm yes, I get your point. But to be able to do this dynamically, we would want to see if
gd->relocaddrintersects withCFG_PRAM:Case 1:
gd->relocaddr> (SECURE_REGION_START+SECURE_REGION_SIZE)
= Best case. U-Boot relocates to an address higher than firewalled addrCase 2:
gd->relocaddr<= (SECURE_REGION_START+SECURE_REGION_SIZE) = Fixup needed. U-Boot relocates to an address which could overlap with secure region. Update thegd->relocaddrto a lower address range which won't overlap with secure region:
reloc_text_size= (RAM_TOP-gd->relocaddr);gd->relocaddr=SECURE_REGION_START-reloc_text_size;And ofcourse, we can't put this logic in the existing 'reserve_pram'[3] INITCALL because
gd->relocaddrgets modified in the subsequent initcalls like 'reserve_trace'. We would want to introduce a new INITCALL which would be invoked after all reserve_* initcalls and before the reloc_* initcalls; where we can put this logic.Quoted 6 lines
Quoted 2 lines
Let me know if you think this is worth adding, or is an overkill and we can live happily with
CFG_PRAM= 38 MB for all AM57x devices :)Thanks for doing all this evaluation. I don't think this will be the last time we run into this issue, but for now let's just make
CFG_PRAM= 64 MB for all AM57x devices and create the perfect solution later.Thanks, I tried setting
CFG_PRAMbut it still ended up in a firewall exception. I guess this is becauseCFG_PRAMonly ensures U-Boot doesn't relocate to that protected address[4], however that memory is still open for access by anything else if needed. Whereas,SYS_MEM_TOP_HIDEreduces the ram size itself[5], which ensures that memory is not visible to U-Boot at all (either for reloc, or general usage).
Quoted 7 lines
Quoted 3 lines
Seem PRAM ("Protected" RAM) isn't all it claims to be, better route then is to convert our existing uses of PRAM to
SYS_MEM_TOP_HIDE, which seems more modern and uses KConfig.I don't think it's any more or less modern, but to be clear, there's no way (or no reason?) to describe these memory areas in DT? Or is it that we also need to do some game to remove it from U-Boot's view early on because how of little memory there is / where this area is? Thanks!
Yes.. We need to remove that memory from U-Boot's view early on because this area is in top of DDR where U-Boot would relocate to if not hidden.
Thanks,
Beleswar
Quoted 124 lines · Andrew Davis
Quoted 116 lines · Beleswar Prasad Padhi
Quoted 105 lines · Andrew Davis
Quoted 102 lines · Beleswar Prasad Padhi
Quoted 35 lines · Andrew Davis
Quoted 25 lines · Beleswar Prasad Padhi
Quoted 11 lines · Andrew Davis
Quoted 9 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Quoted 5 lines
This "
SYS_MEM_TOP_HIDE" looks new, for other OMAP-class HS devices we use "CFG_PRAM"[0], seems these two configs do the same thing, could probably combine them in some way..As
CFG_PRAMis set based onTI_SECURE_EMIF_TOTAL_REGION_SIZEwhich is 32MB
CFG_PRAMis only set ifTI_SECURE_EMIF_REGION_STARTis not set, but we have it set it to0xbdb00000in theam57xx_hs_evm_defconfig.https://github.com/u-boot/u-boot/blob/master/include/configs/ti_omap5_common.h#L75-L81
Quoted 8 lines
Quoted 1 line
for all other AM57x, why is this needed only for AM571?
Other AM57x boards have >1 GiB DDR. So, the top of DDR space does not intersect with the firewalled EMIF region (
0xbdb00000). Only in case of AM571x, the top of DDR collides with firewalled region, so boot fails while doing reloc.Quoted 5 lines
Is there some way to detect this at runtime? Nothing prevents any of the AM57x SoCs being used on boards with 1GB DDR (although they also might use a different defconfig). How do we deal with this for K3 devices? Some use an OP-TEE address aligned at 512MB and I'm sure one of them have that amount of DDR.
Well, actually not...
It's the AM62 SIP platform. From DT, it would look like OPTEE is at the top of the DDR[1], but we do a FDT fixup here in u-boot to replace the OPTEE to the start of DDR[2][1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi#L71
[2]: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-k3/am62x/am625_fdt.c#L84I am not sure if we can do such a thing here for mem used by PPA/firmware as it could assume it has that memory hardcoded.
Quoted 17 lines
Quoted 10 lines
Quoted 4 lines
We build for all
the AM57x with one defconfig, so this new defconfig will go unused. Just set the defaultCFG_PRAMsize to 64MB (same as AM43x),I am guessing all AM43x devices have the same amount of memory unlike AM57x devices? If we set
CFG_PRAMto 38MB by default, won't we lose out that memory on other devices which do not face this limitation?We only really supported "officially" the AM437x-EVM. But our over-focus on just our EVMs caused us to make assumptions that would later make it difficult to add support for customer boards. Assuming DDR size was one such assumption, and should a customer board have the "wrong" DDR size things like this would break.
Quoted 3 lines
So instead of making another one-off fix to get one of our EVMs working, I'm trying to think of a way we can make this work automatically for any combination of DDR size and firewalled region.
TL;DR
I think adding that dynamic support would be tied up only for TI usecase?Hmm yes, I get your point. But to be able to do this dynamically, we would want to see if
gd->relocaddrintersects withCFG_PRAM:Case 1:
gd->relocaddr> (SECURE_REGION_START+SECURE_REGION_SIZE)
= Best case. U-Boot relocates to an address higher than firewalled addrCase 2:
gd->relocaddr<= (SECURE_REGION_START+SECURE_REGION_SIZE) = Fixup needed. U-Boot relocates to an address which could overlap with secure region. Update thegd->relocaddrto a lower address range which won't overlap with secure region:
reloc_text_size= (RAM_TOP-gd->relocaddr);gd->relocaddr=SECURE_REGION_START-reloc_text_size;And ofcourse, we can't put this logic in the existing 'reserve_pram'[3] INITCALL because
gd->relocaddrgets modified in the subsequent initcalls like 'reserve_trace'. We would want to introduce a new INITCALL which would be invoked after all reserve_* initcalls and before the reloc_* initcalls; where we can put this logic.Quoted 7 lines
Quoted 2 lines
Let me know if you think this is worth adding, or is an overkill and we can live happily with
CFG_PRAM= 38 MB for all AM57x devices :)Thanks for doing all this evaluation. I don't think this will be the last time we run into this issue, but for now let's just make
CFG_PRAM= 64 MB for all AM57x devices and create the perfect solution later.Quoted 6 lines
Thanks, I tried setting
CFG_PRAMbut it still ended up in a firewall exception. I guess this is becauseCFG_PRAMonly ensures U-Boot doesn't relocate to that protected address[4], however that memory is still open for access by anything else if needed. Whereas,SYS_MEM_TOP_HIDEreduces the ram size itself[5], which ensures that memory is not visible to U-Boot at all (either for reloc, or general usage).
Quoted 3 lines
Seem PRAM ("Protected" RAM) isn't all it claims to be, better route then is to convert our existing uses of PRAM to
SYS_MEM_TOP_HIDE, which seems more modern and uses KConfig.
Posted patch for the same:
https://lore.kernel.org/all/[email protected]/
Thanks,
Beleswar
Quoted 78 lines
Andrew
Quoted 74 lines
[4]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L391
[5]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L371Thanks,
BeleswarQuoted 67 lines
Andrew
Quoted 63 lines
[3]: https://github.com/u-boot/u-boot/blob/master/common/board_f.c#L990
Thanks,
BeleswarQuoted 57 lines
Andrew
Quoted 53 lines
Thanks,
BeleswarQuoted 50 lines
should be enough for all
and doesn't hurt to have more than needed reserved to be safe.Andrew
[0] https://github.com/u-boot/u-boot/blob/master/include/configs/am43xx_evm.h#L153
Quoted 42 lines
Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 +
configs/am571x_hs_evm_defconfig | 3 +++2 files changed, 4 insertions(+)create mode 100644 configs/am571x_hs_evm_defconfig
MAINTAINERS +0
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfigF: configs/am335x_hs_evm_uart_defconfig
F: configs/am43xx_hs_evm_defconfig
F: configs/am43xx_hs_evm_qspi_defconfig
+F: configs/am571x_hs_evm_defconfig
F: configs/am57xx_hs_evm_defconfig
F: configs/am57xx_hs_evm_usb_defconfig
F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Quoted 48 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 configs/am571x_hs_evm_defconfigMAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +0
-0
configs/am571x_hs_evm_defconfig line 3
Quoted 3 lines
configs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000
Sorry I missed this specific part before. Why isn't this just being changed in am57xx_hs_evm_defconfig ? Do we *need* a new config here? Or, and this gets on to a different topic I've been having with Bryan, is there upstream value in this specific config being added? Thanks!
Signature · 1 line
Tom
Hi Tom,
Quoted 47 lines · Tom Rini
Quoted 45 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 configs/am571x_hs_evm_defconfigMAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +0
-0
Quoted 8 lines
configs/am571x_hs_evm_defconfig line 3
Quoted 6 lines
configs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000Sorry I missed this specific part before. Why isn't this just being changed in
am57xx_hs_evm_defconfig?
The firewalled DDR region and the top of DDR (for U-Boot reloc) intersects only for AM571x HS device as it has 1 GiB DDR. This does not happen for other AM57xx HS devices.
Quoted 1 line
Do we *need* a new config here?
We can have it reserved in am57xx_hs_evm_defconfig, but that would hide that RAM from other AM57xx devices which do not face this limitation. Anyways its just 38MB, so let me know if you prefer to have it in am57xx_hs_evm_defconfig and I will send out a revision for the same.
Thanks,
Beleswar
Quoted 4 lines
Or,
and this gets on to a different topic I've been having with Bryan, is there upstream value in this specific config being added? Thanks!
Quoted 64 lines · Beleswar Prasad Padhi
Hi Tom,
Quoted 47 lines · Tom Rini
Quoted 45 lines · Beleswar Padhi
The AM571x SoC has 1 GB DDR space. As part of normal re-location process U-Boot copies itself to the top of DDR bank. However, on HS devices, the top 37 MB is used by PPA and is firewalled. This results in an exception and the boot fails.
Introduce a new defconfig for AM571x HS platforms and set
CONFIG_SYS_MEM_TOP_HIDEto reserve the top 38 MB memory (aligned to 2MB as per page size for ARM32) for the same.Signed-off-by Beleswar Padhi <[email protected]>---
Fix boot for TI AM571x HS EVM board
v2: Changelog:
1. Drop [PATCH v1 2/2] in v2 series. There is no need to add reserved memory node in DT as it is done by U-Boot as part of FDT fixups
https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-omap2/fdt-common.c#L72-L107
2. Add entry inMAINTAINERSfor new config.
3. Update commit message to use memory size in MB than raw hex bytesLink to v1:
https://lore.kernel.org/all/[email protected]/Test logs:
https://gist.github.com/3V3RYONE/e86b3f4551986b0400d0e0f66d6ecc66MAINTAINERS | 1 + configs/am571x_hs_evm_defconfig | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 configs/am571x_hs_evm_defconfigMAINTAINERS +1
-0@@ -1780,6 +1780,7 @@ F: configs/am335x_hs_evm_spi_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am43xx_hs_evm_qspi_defconfig +F: configs/am571x_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/am57xx_hs_evm_usb_defconfig F: configs/dra7xx_hs_evm_defconfigconfigs/am571x_hs_evm_defconfig new file +0
-0Quoted 8 lines
configs/am571x_hs_evm_defconfig line 3
Quoted 6 lines
configs/am571x_hs_evm_defconfig new file +3
-0@@ -0,0 +1,3 @@ +#include <configs/am57xx_hs_evm_defconfig> + +CONFIG_SYS_MEM_TOP_HIDE=0x2600000Sorry I missed this specific part before. Why isn't this just being changed in
am57xx_hs_evm_defconfig?The firewalled DDR region and the top of DDR (for U-Boot reloc) intersects only for AM571x HS device as it has 1 GiB DDR. This does not happen for other AM57xx HS devices.
Quoted 8 lines
Quoted 1 line
Do we *need* a new config here?
We can have it reserved in
am57xx_hs_evm_defconfig, but that would hide that RAM from other AM57xx devices which do not face this limitation. Anyways its just 38MB, so let me know if you prefer to have it inam57xx_hs_evm_defconfigand I will send out a revision for the same.
I assume that for Linux, the hole does or does not exist correctly, depending on the platform. And if so, yes, I'd rather one defconfig for U-Boot. Thanks!
Signature · 1 line
Tom