summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv8
AgeCommit message (Collapse)Author
2026-06-25Kconfig: arm: restyleJohan Jonker
Restyle all Kconfigs for "arm": Menu entries : no space left Menu attributes: 1 TAB Help text : 1 TAB + 2 spaces Replace '---help---' by 'help' Signed-off-by: Johan Jonker <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-06-24treewide: move bi_dram[] from bd to gdIlias Apalodimas
Currently, the bi_dram[] information is stored in the board info structure (bd). Because bd is only valid after reserve_board(), dram_init_banksize() must be called late in the initialization process. This limitation is problematic, as it forces us to rely on a variety of bespoke functions to determine board RAM, bank memory sizes, and other early setup requirements. By moving bi_dram[] into the global data (gd), we can run it earlier. This is particularly convenient since boards define their own dram_init_banksize() routines, which do not always rely on parsing Device Tree (DT) memory nodes. Additionally, U-Boot defaults to relocating to the top of the first memory bank. While boards currently use custom functions to override this behavior, having the DRAM bank information available earlier in gd makes relocating to a different bank trivial and standardizes the process. Reviewed-by: Anshul Dalal <[email protected]> Tested-by: Michal Simek <[email protected]> # Versal Gen 2 Vek385 Tested-by: Anshul Dalal <[email protected]> Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]> Tested-by: Christophe Leroy (CS GROUP) <[email protected]>
2026-06-17Merge patch series "armv8: mmu: fix region unmapping and optimise ↵Tom Rini
set_one_region()" Casey Connolly <[email protected]> says: Currently trying to unmap a region results in slow and largely broken behaviour as we unnecessarily split blocks and manually set thousands of individual 4k pages instead of higher level blocks. This series fixes the behaviour of set_one_region() so that it works properly when called to unmap regions. See patch 4 for details. Patches 1 & 2 improve the existing debug functionality, the pagetable dumper will now print most explicitly unmapped regions (since they still have their PA intact), as well as adding a new function which does a very basic software TLB lookup to help with debugging. Patch 3 de-duplicates some code by moving the loop that always surrounds set_one_region() calls into its own function, this also helps with readability in the calling functions. Link: https://lore.kernel.org/r/[email protected]
2026-06-17armv8: mmu: fix and optimise explicitly unmapping regionsCasey Connolly
As more platforms start ensuring they explicitly unmap reserved-memory regions a few issues have appeared with how the existing dynamic mapping code works. Fix these and get a small optimisation as well. 1. Teach pte_type() to actually respect the PTE_TYPE_VALID bit 2. Don't walk the TLB a second time if we call mmu_change_region_attr() with PTE_TYPE_FAULT (since it would just be a slow nop) 3. Fix how set_one_region() decides to split blocks. Today set_one_region() will always split blocks until it reaches the smallest granule size (4k) and then update all of these pages. This appears to be due to a big in how is_aligned() is implemented, since it only evaluates to true if addr and size are both multiples of the current granule size, so a mapping aligned to 2M which is 4M in size will cleanly result in 2 blocks being set, but a mapping aligned to 2M which is 4M + 8k in size will result in blocks being split and 1026 individual pages being set. While for the address it is correct to enforce that it is aligned to the current granule size, we only need to check if the region size is greater than the current granule size. This allows us to simplify our second example above to only 4 entries being updated (assuming no blocks have to be split) since we only need to update 2 blocks to map the first 4M, drastically improving the best-case performance. In the case where the address is 4k aligned rather than 2M aligned we will still be restricted to mapping 4k pages until we reach 2M alignment where we could then map a larger 2M granule which previously would never happen. Signed-off-by: Casey Connolly <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2026-06-17armv8: mmu: commonize the set_one_region() loopCasey Connolly
This loop is duplicated 3 times, put it into its own function and call it instead. This simplifies the logic in a few functions. Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Casey Connolly <[email protected]>
2026-06-17armv8: mmu: teach the pagetable dumper to show explicit FAULT mapsCasey Connolly
When a region is explicitly unmapped (like with mmu_change_region_attr(.... PTE_TYPE_FAULT)) the address translation still remains but won't be used since the region is marked invalid. Print these regions when we dump the pagetable to help with debugging. Signed-off-by: Casey Connolly <[email protected]>
2026-06-17armv8: mmu: add a function to help debug TLB lookupsCasey Connolly
Implement a super basic software TLB walk which can look up a single address in the TLB and print each stage of the translation. This is helpful for debugging TLB issues and will be compiled out if unused. Example output on QEMU aarch64: Performing software TLB lookup of address 0x50100000 va_bits: 40 PTE: 0x47fe0000. addr[47:39]: 0x000 (offset 0x00000) L0: 0x47fe0000 -> TABLE (0x47fe1000) PTE: 0x47fe1000. addr[38:30]: 0x001 (offset 0x00008) L1: 0x47fe1008 -> BLOCK (0x40000000) [0x40000000 - 0x80000000] Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Casey Connolly <[email protected]>
2026-06-10thermal: imx_tmu: extend with QorIQ/Layerscape TMUVincent Jardin
Add support for the on-die Thermal Monitoring Unit (TMU) of the new QorIQ/Layerscape SoCs (LX2160A, LS1028A, LS1088A, ...): examples on a lx2160: => temperature list | Device | Driver | Parent | tmu@1f80000 | imx_tmu | root_driver | cluster67-thermal | imx_tmu | tmu@1f80000 | ddr1-cluster5-thermal | imx_tmu | tmu@1f80000 | wriop-thermal | imx_tmu | tmu@1f80000 | dce-qbman-hsio2-thermal | imx_tmu | tmu@1f80000 | ccn-dpaa-tbu-thermal | imx_tmu | tmu@1f80000 | cluster4-hsio3-thermal | imx_tmu | tmu@1f80000 | cluster23-thermal | imx_tmu | tmu@1f80000 => temperature get tmu@1f80000 tmu@1f80000: 82000 mC => temperature get wriop-thermal wriop-thermal: 81000 mC The parent tmu@... node owns the MMIO and calibration; one UCLASS_THERMAL device is bound per/thermal-zones site so each shows up by its zone name: => dm tree ... thermal 2 [ + ] imx_tmu |-- tmu@1f80000 thermal 3 [ + ] imx_tmu | |-- cluster67-thermal thermal 4 [ + ] imx_tmu | |-- ddr1-cluster5-thermal thermal 5 [ + ] imx_tmu | |-- wriop-thermal thermal 6 [ + ] imx_tmu | |-- dce-qbman-hsio2-thermal thermal 7 [ + ] imx_tmu | |-- ccn-dpaa-tbu-thermal thermal 8 [ + ] imx_tmu | |-- cluster4-hsio3-thermal thermal 9 [ + ] imx_tmu | `-- cluster23-thermal ... The dtsi additions mirror the existing fsl-ls1028a.dtsi: the LX2160A SoC dtsi gains the tmu@1f80000 node plus a thermal-zones hierarchy with 7 sites: cluster67-thermal site 0 A72 clusters 6 + 7 ddr1-cluster5-thermal site 1 DDR1 + A72 cluster 5 wriop-thermal site 2 WRIOP dce-qbman-hsio2-thermal site 3 DCE + QBMAN + HSIO2 ccn-dpaa-tbu-thermal site 4 CCN508 + DPAA + TBU cluster4-hsio3-thermal site 5 A72 cluster 4 + HSIO3 cluster23-thermal site 6 A72 clusters 2 + 3 Signed-off-by: Vincent Jardin <[email protected]> Suggested-by: Tom Rini <[email protected]> Inspired-by: Peng Fan <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2026-05-25Merge patch series "Fix speculative access to firewalled regions on AM62 SoCs"Tom Rini
Anshul Dalal <[email protected]> says: This patch series fixes firewall exceptions observed on AM62 family of devices due to speculative accesses made by the A53 core to secure DDR regions. Link: https://lore.kernel.org/r/[email protected]
2026-05-25arm: armv8: mmu: move mmu enablement out of mmu_setupAnshul Dalal
Currently mmu_setup for ARMv8 performs two functions, first it sets up the page tables based the memory map provided by the board and then it enables the MMU. However for some platforms runtime fixes to the generated page tables are required before the MMU can be enabled, such as K3 family of SoCs. Therefore this patch moves the enablement of the MMU out of mmu_setup and to a standalone mmu_enable function to give more granular control to the platforms. Note that no functional changes are intended from this patch. Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Anshul Dalal <[email protected]>
2026-05-15board: nxp: lx2160a: without QIXIS, MC-ENET, PCI, LTC3882Vincent Jardin
The shared LX2160A board file calls helpers that only exist when their subsystem is enabled. Gate them on the matching CONFIG_*: - pci_init() under CONFIG_PCI. - fdt_fixup_mc_ddr() and fsl_rgmii_init() under CONFIG_FSL_MC_ENET. - qixis_*() and the QIXIS branch of checkboard() under CONFIG_FSL_QIXIS; cpu_name(buf) moves out so the non-QIXIS path still prints "Board: <name>". - EVENT_SPY_SIMPLE on init_func_vid moves inside the CONFIG_VOL_MONITOR_LTC3882_READ guard (was outside, dangling symbol when LTC3882 off). #if / #ifdef, not IS_ENABLED(), because the helpers are themselves conditionally compiled. While here, lx2160a_common.h: fix BOOT_TARGET_DEVICES_MMC 1 arg vs 2 args and gate the MMC target on CONFIG_CMD_MMC, not CONFIG_MMC. No functional change for NXP boards: LX2160ARDB, LX2160AQDS, or LX2162AQDS, but mainly build clean up in order to support other NXP lx2160a boards without those HW dependencies. Signed-off-by: Vincent Jardin <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2026-05-06arm: layerscape: Check zero size memory bank before lmb_addYe Li
In layerspace's lmb_arch_add_memory implementation, all memory bank are added to lmb, even some is with zero size. This will cause lmb treating it as overlap with available memory by lmb_addrs_overlap and merge with available memory. Finally causing available memory start address changed to 0. For example, on LX2160, before zero memory bank added to lmb, there are two available memory regions: - region 0, start 0x80000000, size 0x7be00000 - region 1, start 0x2080000000, size 0x700000000 After zero size memory bank added, merge to one region: - region 0, start 0, size 0x2780000000 This wrong new region causes efi_memory_init issue when allocating bounce buffer because of conflict address (with uboot reserved) is allocated. Signed-off-by: Ye Li <[email protected]> Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2026-04-27arm: psci: Add API to check for support of specific PSCI functionVaradarajan Narayanan
Add an API to check if a specific PSCI function is supported or not. This is based on the psci_features() function present in Linux kernel (drivers/firmware/psci/psci.c). Reviewed-by: Casey Connolly <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Signed-off-by: Varadarajan Narayanan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-04-07lmb: Rework the LMB_ARCH_MEM_MAP symbolTom Rini
This symbol should not be enabled by the user directly but rather selected when implemented in a given platform. This converts all of the current users of this feature and hides the symbol. Signed-off-by: Tom Rini <[email protected]>
2026-02-24arm: armv8: Flush TLB before enabling MMUMark Kettenis
Commit 9ebdbbc43e5f ("arm: armv8: invalidate dcache entries on dcache_enable") broke Apple Silicon machines in certain scenarios. If the MMU is currently not enabled we need to flush the TLB before we enable it to prevent stale TLB entries from becoming active again. So move the __asm_invalidate_tlb_all() back immediately before the mmu_setup() call. Fixes: 9ebdbbc43e5f ("arm: armv8: invalidate dcache entries on dcache_enable") Signed-off-by: Mark Kettenis <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2026-02-09arm: spl: Ensure 8 byte alignment of appended DTB without separate BSSTom Rini
Historically, when we have an appended device tree and also our resulting binary will contain the BSS section, we have ensured that everything will be where it's expected to be by declaring that the BSS is overlayed with a symbol matches the end of the port of the ELF binary that is objcopy'd to the binary we concatenate with. This in turn means that the logic to generate a "pad" file, which is the size found in the __bss_size symbol, will be correct and then we can concatenate the device tree and it will begin at __bss_size at run time. With commit 5ffc1dcc26d3 ("arm: Remove rel.dyn from SPL linker scripts") we removed this overlay as part of trying to ensure that we met both the requirements of the device tree to be 8 byte aligned as well as that our logic to generate the -pad file would match what ended up in the resulting binary. While it was correct to remove an unused section it did not solve ultimately solve the problem for all cases. To really fix the problem, we need to do two things. First, our final section prior to _image_binary_end must be 8 byte aligned (for the case of having a separate BSS and so our appended DTB exists at this location). This cannot be '.binman_sym_table' as it may be empty, and in turn the ELF type would be NOBITS and so not copied with objcopy. The __u_boot_list section will never be empty, so it is our final section, and ends with a '. = ALIGN(8)' statement. Second, as this is the end of our copied data it is safe to declare that the BSS starts here, so use the OVERLAY keyword to place the BSS here. Fixes: 5ffc1dcc26d3 ("arm: Remove rel.dyn from SPL linker scripts") Reported-by: Brian Sune <[email protected]> Reported-by: Phil Phil Sutter <[email protected]> Tested-by: Brian Sune <[email protected]> Tested-by: Phil Sutter <[email protected]> Tested-by: Greg Malysa <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2026-01-28armv8: u-boot-spl.lds: Place binman symbols at end of binaryJonas Karlman
It can be useful in xPL to access symbols from binman, such as the offset/position and size of a binman entry. Place these binman symbols together at the end of the xPL binary for ARMv8, similar to ARM and RISC-V. Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2026-01-20arm: Update linker scripts to ensure appended device tree is alignedTom Rini
With commit 0535e46d55d7 ("scripts/dtc: Update to upstream version v1.7.2-35-g52f07dcca47c") it is now a fatal error to U-Boot if our device tree is not 8-byte aligned. In commit 85f586035d75 ("ARM: OMAP2+: Pad SPL binary to 8-byte alignment before DTB") Beleswar Padhi explains that we must have ALIGN(x) statements inside of a section to ensure that padding is included and not simply that the linker address counter is incremented. To that end, this patch: - Expands some linker sections to be more readable when adding a second statement to the section. - Aligns the final section before _end (for U-Boot) or _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding '. = ALIGN(8);' to the final section before the symbol. - Ensure that we do have alignment by adding an ASSERT so that when not aligned we fail to link (and explain why). - Remove now-spurious '. = ALIGN(x);' statements that were intended to provide the above alignments. Tested-by: Michal Simek <[email protected]> # Zynq Reviewed-by: Ilias Apalodimas <[email protected]> [trini: Also update arch/arm/cpu/armv8/u-boot.lds as Ilas requested] Signed-off-by: Tom Rini <[email protected]>
2025-12-11armv8/fsl-layerscape: fdt: Remove offline cores from cooling device mapsAnthony Pighin (Nokia)
Some processor families use a generic device tree, and rely on u-boot fixups to massage that for lower core count personalities (i.e. NXP LX2* family). For example, the LX2160A device tree will be used and then modified to offline non-existent cores when running on an 8-core LX2080A. However, the cooling maps still contain references to the non-existent core phandles, resulting in: OF: /thermal-zones/cluster6-7-thermal/cooling-maps/map0: could not find phandle 15 Rebuild the cooling maps as non-existent cores are deleted. Signed-off-by: Anthony Pighin <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2025-11-06armv8: implement workaround for broken CNTFRQ_EL0 valueKaustabh Chakraborty
In devices where the U-Boot is used as a secondary bootloader, we rely on the device's primary bootloader to implement CNTFRQ_EL0. However, this reliance may lead to a non-functional timer in broken firmware. For instance, some versions of Samsung's S-Boot don't implement it. It's also not possible to set it in the U-Boot, because it's booted in a lower exception level. CNTFRQ_EL0 is reported to be 0. Use gd->arch.timer_rate_hz to override the queried value if set. This setting needs to be done in the board file, preferrably in timer_init(). This feature is present only when the CONFIG_ARMV8_CNTFRQ_BROKEN is enabled. Signed-off-by: Kaustabh Chakraborty <[email protected]>
2025-11-04arm: armv8: mmu: fix mem_map_from_dram_banksAnshul Dalal
mem_map_from_dram_banks calls fdtdec_setup_memory_banksize to setup the dram banks though that is expected to be done by dram_init_banksize as part of board_r sequence. This has the side effect of modifying gd->bd->bi_dram as well, therefore this patch removes the call and updates spl_enable_cache for K3 to call dram_init_banksize. Signed-off-by: Anshul Dalal <[email protected]> Reported-by: Francesco Dolcini <[email protected]> Closes: https://lore.kernel.org/u-boot/20251027165225.GA71553@francesco-nb/ Fixes: fe2647f2a0d4 ("arm: armv8: mmu: add mem_map_from_dram_banks") Tested-by: Emanuele Ghidoli <[email protected]>
2025-10-24arm: armv8: Make save_boot_params simplerIlias Apalodimas
The idiom used in save_boot_params is common for armv7. In armv8 is much easier to do the same thing with adr/adrp. So let's simplify the code a bit. Signed-off-by: Ilias Apalodimas <[email protected]>
2025-10-22arm: armv8: mmu: add mmu_unmap_reserved_memAnshul Dalal
For armv8, U-Boot uses a static map defined as 'mem_map' for configuring the MMU's page tables, done by mmu_setup. Though this works well for simpler platforms, it makes creating runtime carveouts by modifying the static array at runtime exceedingly complex like in mach-snapdragon/board.c. Creation of such carveouts are much better handled by APIs such as mmu_change_region_attr once the page tables are configured. Usually such carveouts are configured via the device-tree's reserved-memory node which provides the address and size for the carveout. Therefore this patch adds mmu_unmap_reserved_mem which acts as a wrapper over mmu_change_region_attr, helping unmap a reserved-memory region. Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Anshul Dalal <[email protected]> Tested-by: Wadim Egorov <[email protected]>
2025-10-22arm: armv8: mmu: add mem_map_from_dram_banksAnshul Dalal
For armv8, U-Boot uses a static map defined as 'mem_map' for configuring the MMU as part of mmu_setup. But since the exact configuration of memory banks might not be known at build time, many platforms such as imx9, versal2 etc. utilize gd->bd->bi_dram to configure the static map at runtime. Therefore this patch adds a new API mem_map_from_dram_banks that modifies the static map in a similar way. Allowing the caller to map all dram banks by just passing the index to last entry in their mem_map and it's length. Reviewed-by: Dhruva Gole <[email protected]> Signed-off-by: Anshul Dalal <[email protected]> Tested-by: Wadim Egorov <[email protected]>
2025-10-22arm: armv8: invalidate dcache entries on dcache_enableAnshul Dalal
In dcache_enable, currently the dcache entries are only invalidated when the MMU is not enabled. This causes issues when dcache_enable is called with the MMU already configured, in such cases the existing dcache entries are not flushed which might result in un-expected behavior. This patch invalidates the cache entries on every call of dcache_enable before enabling dcache (by setting CR_C). This makes dcache_enable behave similar to icache_enable as well. Reviewed-by: Dhruva Gole <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Anshul Dalal <[email protected]> Tested-by: Wadim Egorov <[email protected]>
2025-10-03arm: armv8: remove redundant definition of mmu_statusAnshul Dalal
mmu_status is used in io memcpy functions to prevent accesses to non 8-byte aligned addresses when the mmu is disabled. Though there is a redundant definition enabled when icaches is turned off by setting SYS_ICACHE_OFF. This patch removes the redundant definition, allowing mmu_status to properly report the status regardless of config settings. This shouldn't be a problem since access to non 8-byte aligned data can be done irrespective of icache state. Fixes: 268f6ac1f95c ("arm64: Update memcpy_{from, to}io() helpers") Signed-off-by: Anshul Dalal <[email protected]> Reviewed-by: Patrice Chotard <[email protected]> Reviewed-by: Dhruva Gole <[email protected]> Acked-by: Ilias Apalodimas <[email protected]>
2025-09-13arm: armv8: Fix spl recover data section brokenYe Li
SPL recover data section is broken which causes reboot failure on some i.MX platforms (iMX8QM/iMX95). The global variable cold_reboot_flag is assigned to weak reset_flag function which always return 1, so restore never been executed in warm reboot. Fixes: 1c37e59bfbba ("arm: armv8: Improve SPL data save and restore implementation") Signed-off-by: Ye Li <[email protected]> Reviewed-by: Fabio Estevam <[email protected]> Reviewed-by: Peng Fan <[email protected]>
2025-07-27sunxi: add basic A523 supportAndre Przywara
Add the basic Kconfig options, addresses and other values for the existing Kconfig settings for the new Allwinner A523/T527/H728 SoC. Signed-off-by: Andre Przywara <[email protected]>
2025-07-17armv8: ls1043a: make some erratas dependent from USBHolger Brunck
These erratas are only useful if USB is enabled. If it is disabled these erratas might cause issues. Signed-off-by: Holger Brunck <[email protected]>
2025-07-11global: Make ARCH_MISC_INIT a selected symbolTom Rini
This symbol is not something that the user should be enabling or disabling but rather the developer for a particular board should select it when required. This is mostly size neutral, however a few places do have changes. In the case of i.MX6ULL systems, it is always the case that arch_misc_init() could call setup_serial_number() and do useful work, but was not enabled widely, but now is. In the case of i.MX23/28 systems, we should be able to call mx28_fixup_vt() again here, so do so. Finally, some platforms were calling arch_misc_init() and then not doing anything and this results in removing the option. Acked-by: Peng Fan <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2025-06-24sunxi: add support for the Allwinner A100/A133 SoCAndre Przywara
The Allwinner A100 SoC has been around for a while, mostly on cheap tablets, but didn't generate much interest in the community so far. There were some efforts by two Allwinner employees in 2020, which led to basic upstream Linux support for that SoC, although this momentum dried up pretty quickly, leaving a lot of peripherals unsupported. The A100 was silently replaced with the seemingly identical Allwinner A133, which is reportedly a better bin of the A100. So far we assume that both are compatible from a software perspective. There are some more devices with the A133 out there now, so people are working on filling the gaps, and adding U-Boot (and TF-A) support. Based on the just added pinctrl, clock and DRAM support, this adds the missing bits, mostly addresses and values for the SPL. The A133 seems to be an predecessor to the H6, so we can share a lot of code with that (and the H616 code), and just need to adjust some details. Signed-off-by: Andre Przywara <[email protected]>
2025-06-20Merge patch series "Consistent Kconfig environment options CONFIG_ENV_ prefix"Tom Rini
Marek Vasut <[email protected]> says: Rename the environment related variables and add ENV_ prefix, so that all configuration options which are related to environment would have an CONFIG_ENV_ prefix. No functional change. Link: https://lore.kernel.org/r/[email protected]
2025-06-20env: Rename SYS_MMC_ENV_DEV to ENV_MMC_DEVICE_INDEXMarek Vasut
Rename the variable and add ENV_ prefix, so that all configuration options which are related to environment would have an CONFIG_ENV_ prefix. No functional change. Use ENV_MMC_DEVICE_INDEX to clarify this is the SD/MMC device index, a number, as enumerated by U-Boot. Update the help text accordingly. Signed-off-by: Marek Vasut <[email protected]>
2025-06-05armv8: fix Clang warning on writing 32-bit variable to a 64-bit registerRaymond Mao
Clang is stricter than GCC when it comes to inline assembly and expects the register to be written with explicitly same type of variable. Fixes: c0e1775a867c ("armv8: Add arch-specific sysinfo platform driver") Signed-off-by: Raymond Mao <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2025-05-29global: Avoid indirect inclusion of <env.h> from <command.h>Tom Rini
The include file <command.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <command.h> fix all of the places which had relied on this indirect inclusion to instead include <env.h> directly. Reviewed-by: Mattijs Korpershoek <[email protected]> # android, bcb Reviewed-by: Jerome Forissier <[email protected]> # spawn Signed-off-by: Tom Rini <[email protected]>
2025-04-28sunxi: armv8: FEL: save and restore SP_IRQAndre Przywara
Thanks for Jernej's JTAG debugging effort, it turns out that the BROM expects SP_IRQ to be saved and restored, when we want to enter back into FEL after the SPL's AArch64 stint. Save and restore SP_IRQ as part of the FEL state handling. The banked MRS/MSR access to SP_IRQ, without actually being in IRQ mode, was introduced with the ARMv7 virtualisation extensions. The Arm Cortex-A8 cores used in the A10/A13s or older F1C100s SoCs would not support that, but this code here is purely in the ARMv8/AArch64 code path, so it's safe to use unconditionally. Reported-by: Jernej Skrabec <[email protected]> Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]>
2025-04-28sunxi: armv8: FEL: save and restore GICv3 registersAndre Przywara
To be able to return to the BootROM FEL USB debug code, we must restore the core's state as accurately as possible after the SPL has been run. Since the BootROM runs in AArch32, but the SPL uses AArch64, this requires a core reset, which clears the core's state. So far we were saving and restoring the required registers like SCTLR and VBAR, but could ignore the interrupt controller's state (GICC), since that lives in MMIO registers, unaffected by a core reset. Newer Allwinner SoCs now feature a GICv3 interrupt controller, which keeps some GIC state in architected system registers, and those are cleared when we switch back to AArch32. To enable FEL operation on the Allwinner A523 SoC, Add AArch32 assembly code to save and restore the ICC_PMR and ICC_IGRPEN1 system registers. The other GICv3 sysregs are either not relevant for the BROM operation, or haven't been changed from their reset defaults by the BROM anyway. This enables FEL operation on the Allwinner A523 family of SoCs. Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]>
2025-04-15spin_table: add missing header for ENODEV and ENOSPC symbolsyan wang
Add the necessary header as <common.h> is removed Signed-off-by: yan wang <[email protected]>
2025-04-11Merge patch series "Switch to using $(PHASE_) in Makefiles"Tom Rini
Tom Rini <[email protected]> says: This series switches to always using $(PHASE_) in Makefiles when building rather than $(PHASE_) or $(XPL_). It also starts on documenting this part of the build, but as a follow-up we need to rename doc/develop/spl.rst and expand on explaining things a bit. Link: https://lore.kernel.org/r/[email protected]
2025-04-11Kbuild: Always use $(PHASE_)Tom Rini
It is confusing to have both "$(PHASE_)" and "$(XPL_)" be used in our Makefiles as part of the macros to determine when to do something in our Makefiles based on what phase of the build we are in. For consistency, bring this down to a single macro and use "$(PHASE_)" only. Signed-off-by: Tom Rini <[email protected]>
2025-04-10armv8: start.S: Subordinate CPUs psci setup vectorXu Zhang
As current design, only Manager CPU called armv8_setup_psci() before jump to next stage(such as Linux Kernel), Subordinate CPUs also need setup psci vector to handle trap request which comes from higher EL level. Signed-off-by: Xu Zhang <[email protected]> [trini: Guard with !CONFIG_XPL_BUILD check]
2025-04-04arm64: Fix page permissions for platforms running at EL2Ilias Apalodimas
We currently set both and print both PXN and UXN bits when removing execution for pages. This happens even in the existing per platform definitions of 'struct mm_region'. That's not entirely correct though. For stage-1 translations, if a platform runs on a translation regime with a single privilege level or the the translation regime supports two privilege levels and we are not in EL1&0 with HCR_EL2.{NV, NV1} = {1, 1} only BIT54 (XN) is needed and BIT53(PXN) is reserved 0. Currently we support Non-Secure EL2, Non-secure EL2&0 and Non-secure EL1&0. We already have get_effective_el() which returns 1 if we are - Running in EL1 so we assume an EL1 translation regime but without checking HCR_EL2.{NV, NV1} != {1,1} - Running in EL2 with HCR_EL2.E2H = 1 The only problem with the above is that if we are in EL1&0 and HCR_EL2.{NV1, NV} == {1, 1}, then - Bit[54] holds the PXN instead of the UXN - The Effective value of UXN is 0 - Bit[53] is RES0 So let's re-use that function and set PXN only when we are in and EL[2|1]&0 translation regime. Signed-off-by: Ilias Apalodimas <[email protected]>
2025-03-27sunxi: armv8: fel: move fel_stash variable to the frontAndre Przywara
To return a 64-bit Allwinner chip back to the 32-bit BootROM code, we have some embedded AArch32 code that restores the CPU state, before branching back to the BootROM. At the moment the pointer to the buffer with that state is located *after* the code, which makes the PC relative code fragile: adding or removing instructions will change the distance to that pointer variable. The "new" Allwinner A523 SoC requires more state to be restored (GICv3 system registers), but we must do that *only* on that SoC. Conditional compilation sounds like the easiest solution, but would mean that the distance to that pointer would change. Solve this rather easily by moving the pointer to the *front* of the code: we load that pointer in the first instruction, so the distance would always stay the same. Later in the code we won't need PC relative addressing anymore, so this code can grow or shrink easily, for instance due to conditional compilation. Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]>
2025-03-14treewide: Add a function to change page permissionsIlias Apalodimas
For armv8 we are adding proper page permissions for the relocated U-Boot binary. Add a weak function that can be used across architectures to change the page permissions Tested-by: Neil Armstrong <[email protected]> # on AML-S905X-CC Signed-off-by: Ilias Apalodimas <[email protected]>
2025-03-14arm64: mmu_change_region_attr() add an option not to break PTEsIlias Apalodimas
The ARM ARM (Rev L.a) on section 8.17.1 describes the cases where break-before-make is required when changing live page tables. Since we can use a function to tweak block and page permissions, where BBM is not required split the existing mmu_change_region_attr() into two functions and create one that doesn't require BBM. Subsequent patches will use the new function to map the U-Boot binary with proper page permissions. While at it add function descriptions in their header files. Signed-off-by: Ilias Apalodimas <[email protected]>
2025-03-14arm: Prepare linker scripts for memory permissionsIlias Apalodimas
Upcoming patches are switching the memory mappings to RW, RO, RX after the U-Boot binary and its data are relocated. Add annotations in the linker scripts to and mark text, data, rodata sections and align them to a page boundary. It's worth noting that .efi_runtime memory permissions are left untouched for now. There's two problems with EFI currently. The first problem is that we bundle data, rodata and text in a single .efi_runtime section which also must be close to .text for now. As a result we also dont change the permissions for anything contained in CPUDIR/start.o. In order to fix that we have to decoule .text_rest, .text and .efi_runtime and have the runtime services on their own section with proper memory permission annotations (efi_rodata etc). The efi runtime regions (.efi_runtime_rel) can be relocated by the OS when the latter is calling SetVirtualAddressMap. Which means we have to configure those pages as RX for U-Boot but convert them to RWX just before ExitBootServices. It also needs extra code in efi_tuntime relocation code since R_AARCH64_NONE are emitted as well if we page align the section. Due to the above ignore EFI for now and fix it later once we have the rest in place. Acked-by: Jerome Forissier <[email protected]> Tested-by: Neil Armstrong <[email protected]> # on AML-S905X-CC Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2025-03-14meminfo: add memory details for armv8Ilias Apalodimas
Upcoming patches are mapping memory with RO, RW^X etc permsissions. Fix the meminfo command to display them properly Acked-by: Jerome Forissier <[email protected]> Reviewed-by: Caleb Connolly <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2025-03-10arm: use type jmp_buf instead of struct jmp_buf_dataHeinrich Schuchardt
Instead of using the implementation specific struct jmp_buf_data use the standard compliant type jmp_buf when switching exception levels. Reviewed-by: Jerome Forissier <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2025-03-10common: clean up setjmp.hHeinrich Schuchardt
Separate setjmp.h into an architecture independent part and an architecture specific part. This simplifies moving from using struct jmp_buf_data directly to using type jmp_buf in our code which is the C compliant way. Reviewed-by: Jerome Forissier <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2025-02-25arm: armv8: Improve SPL data save and restore implementationAlif Zakuan Yuslaimi
Introduce a new symbol in the beginning of .data section in the common ARMv8 linker script and use that as a reference for data save and restore. Previously, the code would rely on calculating the start of the .data section address via data size, however, we observed that the data size does not really reflect the SPL mapped addresses. In our case, the binman_sym section size was not included in the data size, which will result in a wrong address for the .data start section, which prevents us from properly saving and restoring SPL data. This approach skips the calculation for the starting address of the .data section, and instead just defines the beginning address of the .data section and calling the symbol as needed, in which we think as a simpler and much more robust method. Signed-off-by: Alif Zakuan Yuslaimi <[email protected]> Signed-off-by: Tien Fong Chee <[email protected]> Reviewed-by: Tien Fong Chee <[email protected]>