summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/armv8
AgeCommit message (Collapse)Author
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: mmu: export mmu_setupAnshul Dalal
The mmu_setup function configures the page tables based on the board supplied mem_map struct array. It is called implicitly as part of dcache_enable but this limits us to only be able to use APIs such as mmu_change_region_attr only after caches are enabled. This might lead to speculative accesses before we can unmap a region that is marked as cacheable in the static memory map. Therefore this patch exports the mmu_setup function in mmu.h allowing users to have more control over when the mmu is configured. For K3 specifically this allows for the following configuration sequence as part of enable_caches: static mem_map fixups (TODO) -> mmu_setup -> carveouts using mmu_change_region_attr (TODO) -> icache/dcache enable 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-09-26arm64: Add MIDR entry for Cortex-A720Marek Vasut
Add MIDR entry for Cortex-A720 core. Signed-off-by: Marek Vasut <[email protected]>
2025-04-02arm64: Add MIDR entries for Cortex-A55, A73 and A75Peter Robinson
Add MIDR entries for Cortex-A55, Cortex-A73 and Cortex-A75 cores and update the is_coretex_a entries. Signed-off-by: Peter Robinson <[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-01-12arm64: Add MIDR entries for Cortex-A57 and Cortex-A76Marek Vasut
Add MIDR entries for Cortex-A57 and Cortex-A76 cores. Those are used on R-Car Gen3 and Gen4 SoCs respectively. Reviewed-by: Paul Barker <[email protected]> Reviewed-by: Peter Robinson <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
2025-01-12arm64: Convert core type check macros into inline functionsMarek Vasut
Turn the core type check macros into inline functions to perform better type checking on them. The inline functions get optimized out in case they are not used. Indent the MIDR_PARTNUM_CORTEX_An macros in preparation for addition of future three-digit cores and use MIDR_PARTNUM_SHIFT in MIDR_PARTNUM_MASK to be consistent. Reviewed-by: Paul Barker <[email protected]> Reviewed-by: Peter Robinson <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
2024-06-26Merge patch series "arm64: add a software pagetable walker"Tom Rini
Caleb Connolly <[email protected]> says: MMU issues are some of the most frustrating to debug. To make this slightly less unbearable, introduce a software pagetable walker for ARMv8. This can be called to dump a pagetable with the default formatter, or a custom callback can be provided to implement more complicated parsing. This can also be useful to dump the pagetable used by a previous bootloader stage (by reading out the ttbr register). Here is an example of the output when walking U-Boot's own memory map on a Qualcomm RB3 board: Walking pagetable at 000000017df90000, va_bits: 36. Using 3 levels [0x17df91000] | Table | | [0x17df92000] | Table | | [0x000001000 - 0x000200000] | Pages | Device-nGnRnE | Non-shareable [0x000200000 - 0x040000000] | Block | Device-nGnRnE | Non-shareable [0x040000000 - 0x080000000] | Block | Device-nGnRnE | Non-shareable [0x080000000 - 0x140000000] | Block | Normal | Inner-shareable [0x17df93000] | Table | | [0x140000000 - 0x17de00000] | Block | Normal | Inner-shareable [0x17df94000] | Table | | [0x17de00000 - 0x17dfa0000] | Pages | Normal | Inner-shareable
2024-06-25arm64: add software pagetable walkerCaleb Connolly
Add a basic software implementation of the ARM64 pagetable walker. This can be used for debugging U-Boot's pagetable, as well as dumping the pagetable from the previous bootloader stage if it used one (by reading out the ttbr address). One can either call dump_pagetable() to print the pagetable to the console with the default formatter, or implement their own pagetable handler using walke_pagetable() with a custom pte_walker_cb_t callback. All of the added code is discarded when unused, hence there is no need to add an additional Kconfig option for this. Signed-off-by: Caleb Connolly <[email protected]>
2024-06-25arm64: mmu.h: fix PTE_TABLE_APCaleb Connolly
The APTable attribute is two bits wide according to the ARMv8-A architecture reference manual. Fix the macro accordingly. Signed-off-by: Caleb Connolly <[email protected]>
2023-11-17Revert "arm64: Use FEAT_HAFDBS to track dirty pages when available"Chris Packham
This reverts commit 6cdf6b7a340db4ddd008516181de7e08e3f8c213. This is part of a series trying to make use of the arm64 hardware features for tracking dirty pages. Unfortunately this series causes problems for the AC5/AC5X SoCs. Having exhausted other options the consensus seems to be reverting this series is the best course of action. Signed-off-by: Chris Packham <[email protected]>
2023-11-17Revert "armv8: enable HAFDBS for other ELx when FEAT_HAFDBS is present"Chris Packham
This reverts commit c1da6fdb5c239b432440721772d993e63cfdeb20. This is part of a series trying to make use of the arm64 hardware features for tracking dirty pages. Unfortunately this series causes problems for the AC5/AC5X SoCs. Having exhausted other options the consensus seems to be reverting this series is the best course of action. Signed-off-by: Chris Packham <[email protected]>
2023-11-02arm: armv8: mmu: Prepare for common.h removalPaul Barker
If <common.h> won't be included before <asm/armv8/mmu.h>, we need to ensure that we have the required type definitions. Signed-off-by: Paul Barker <[email protected]>
2023-04-25armv8: enable HAFDBS for other ELx when FEAT_HAFDBS is presentmeitao
u-boot could be run at EL1/EL2/EL3. so we set it as same as EL1 does. otherwise it will hang when enable mmu, that is what we encounter in our SOC. Signed-off-by: meitao <[email protected]> [ Paul: pick from the Android tree. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) <[email protected]> Cc: Tom Rini <[email protected]> Link: https://android.googlesource.com/platform/external/u-boot/+/3bf38943aeab4700c2319bff2a1477d99c6afd2f
2023-04-25arm64: Use FEAT_HAFDBS to track dirty pages when availableMarc Zyngier
Some recent arm64 cores have a facility that allows the page table walker to track the dirty state of a page. This makes it really efficient to perform CMOs by VA as we only need to look at dirty pages. Signed-off-by: Marc Zyngier <[email protected]> [ Paul: pick from the Android tree. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) <[email protected]> Cc: Tom Rini <[email protected]> Link: https://android.googlesource.com/platform/external/u-boot/+/3c433724e6f830a6b2edd5ec3d4a504794887263
2022-06-16armv8: always use current exception level for TCR_ELx accessAndre Przywara
Currently get_tcr() takes an "el" parameter, to select the proper version of the TCR_ELx system register. This is problematic in case of the Apple M1, since it runs with HCR_EL2.E2H fixed to 1, so TCR_EL2 is actually using the TCR_EL1 layout, and we get the wrong version. For U-Boot's purposes the only sensible choice here is the current exception level, and indeed most callers treat it like that, so let's remove that parameter and read the current EL inside the function. This allows us to check for the E2H bit, and pretend it's EL1 in this case. There are two callers which don't care about the EL, and they pass 0, which looks wrong, but is irrelevant in these two cases, since we don't use the return value there. So the change cannot affect those two. Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Mark Kettenis <[email protected]> Tested-by: Mark Kettenis <[email protected]>
2022-06-03armv8: Fix TCR 64-bit writesAndre Przywara
The AArch64 TCR_ELx register is a 64-bit register, and many newer architecture features use bits in the upper half. So far U-Boot was igorant of those bits, trying to leave them alone. However, in an effort to set bit 31 to 1, it failed doing so, because the compiler sign-extended "1 << 31", so that all bits[63:31] got set. Older ARMv8.0 cores don't define anything dangerous up there, but newer architecture revisions do, and setting all those bits will end badly: ================= $ qemu-system-aarch64 -cpu max .... U-Boot 2022.07-rc1 (May 09 2022 - 15:21:00 +0100) DRAM: 1.5 GiB ================= (hangs here) Defining TCR_ELx_RSVD to "1U << 31" avoids the sign-extension, so all upper bits stay at a safe 0 value. This means no more surprises when U-Boot runs on a more capable CPU core. Reported-by: Balaji Anandapadmanaban <[email protected]> Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Peng Fan <[email protected]> Tested-by: Peter Collingbourne <[email protected]> Reviewed-by: Peter Collingbourne <[email protected]>
2020-01-17common: Move hang() to the same header as panic()Simon Glass
At present panic() is in the vsprintf.h header file. That does not seem like an obvious choice for hang(), even though it relates to panic(). So let's put hang() in its own header. Signed-off-by: Simon Glass <[email protected]> [trini: Migrate a few more files] Signed-off-by: Tom Rini <[email protected]>
2018-11-20Use _AC and UL macros from linux/const.hBaruch Siach
Drop the _AC and UL macros from common.h. Linux headers is the original source of this macro, so keep its definition in the same header. Update existing users of these macros to include const.h directly. Cc: Daniel Schwierzeck <[email protected]> Cc: Rick Chen <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Rick Chen <[email protected]> Signed-off-by: Baruch Siach <[email protected]> Reviewed-by: Daniel Schwierzeck <[email protected]> Signed-off-by: Stefan Roese <[email protected]>
2018-10-22armv8: add cpu core helper functionsPeng Fan
Add helper functions to identify different armv8 variants. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Anatolij Gustschin <[email protected]> Cc: Stefano Babic <[email protected]>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <[email protected]>
2017-12-04armv8: mmu: fix page table mappingPeng Fan
To page mapping the lowest 2 bits needs to be 0x3. If not fix this, the final lowest 3 bits for page mapping is 0x1 which is marked as reserved. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: York Sun <[email protected]>
2017-10-27armv8: sec_firmware: Add support for loadables in FITSumit Garg
Enable support for loadables in SEC firmware FIT image. Currently support is added for single loadable image. Brief description of implementation: Add two more address pointers (loadable_h, loadable_l) as arguments to sec_firmware_init() api. Create new api: sec_firmware_checks_copy_loadable() to check if loadables node is present in SEC firmware FIT image. If present, verify loadable image and copies it to secure DDR memory. Populate address pointers with secure DDR memory addresses where loadable is copied. Example use-case could be trusted OS (tee.bin) as loadables node in SEC firmware FIT image. Signed-off-by: Sumit Garg <[email protected]> Reviewed-by: York Sun <[email protected]>
2017-09-12armv8: mmu: add space around operatorAndy Yan
Add space around operator "+", make it match the coding style. Signed-off-by: Andy Yan <[email protected]> Reviewed-by: Philipp Tomsich <[email protected]> Reviewed-by: York Sun <[email protected]>
2017-09-12armv8: mmu: remove unused macro definitionAndy Yan
Macro VA_BITS and PTE_BLOCK_BITS are not used in the code, so remove them. Signed-off-by: Andy Yan <[email protected]> Reviewed-by: Philipp Tomsich <[email protected]> Reviewed-by: York Sun <[email protected]>
2017-08-26ARMv8/sec_firmware : Update chosen/kaslr-seed with random numberRuchika Gupta
kASLR support in kernel requires a random number to be passed via chosen/kaslr-seed propert. sec_firmware generates this random seed which can then be passed in the device tree node. sec_firmware reserves JR3 for it's own usage. Node for JR3 is removed from device-tree. Signed-off-by: Ruchika Gupta <[email protected]>
2017-04-24arm: psci: make psci usable on single core socsYuantian Tang
PSCI can be used on both multiple and single core socs. Current implementation only allows PSCI to work on multiple core socs. This patch removes this restriction so that PSCI can work on single core socs as well. Signed-off-by: Chenhui Zhao <[email protected]> Signed-off-by: Tang Yuantian <[email protected]> Reviewed-by: York Sun <[email protected]>
2017-03-28fsl-layerscape/ppa: cleanup ppa.hHou Zhiqiang
Moved the ifdef into ppa.h and removed the duplicated macros. Signed-off-by: Hou Zhiqiang <[email protected]> Reviewed-by: York Sun <[email protected]>
2017-03-14armv8: mmu: Add a function to change mapping attributesYork Sun
Function mmu_change_region_attr() is added to change existing mapping with updated PXN, UXN and memory type. This is a break-before-make process during which the mapping becomes fault (invalid) before final attributres are set. Signed-off-by: York Sun <[email protected]>
2017-01-19Merge git://git.denx.de/u-boot-fsl-qoriqTom Rini
2017-01-18ARMv8/sec_firmware: relocated and renamed the config FSL_PPA_ARMV8_PSCIHou Zhiqiang
Moved the config FSL_PPA_ARMV8_PSCI from fsl-layerscape's Kconfig to Kconfig under armv8 and renamed it to SEC_FIRMWARE_ARMV8_PSCI. Signed-off-by: Hou Zhiqiang <[email protected]> Reviewed-by: York Sun <[email protected]>
2017-01-04move UL() macro from armv8/mmu.h into common.hAndre Przywara
The UL() macro is pretty useful in sharing constants between assembly and C files while still being able to specify a type for C. Move the macro from an armv8 specific header into a common header file to be able to use it by arm code (for instance) as well. Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Alexander Graf <[email protected]> Reviewed-by: Jagan Teki <[email protected]>
2016-12-15ARMv8: LS1043A: change macro CONFIG_ARMV8_PSCI definition[email protected]
NXP/Freescale uses macro CONFIG_ARMV8_PSCI to enable their private PSCI implementation in PPA firmware, but this macro naming too generic, so this patch replaces it with a specic one CONFIG_FSL_PPA_ARMV8_PSCI. And this macro CONFIG_ARMV8_PSCI will be used for a generic PSCI for ARMv8 which will be added in following patchs. Signed-off-by: Hongbo Zhang <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: York Sun <[email protected]>
2016-07-19ARMv8/layerscape: Add FSL PPA supportHou Zhiqiang
The FSL Primary Protected Application (PPA) is a software component loaded during boot which runs in TrustZone and remains resident after boot. Use the secure firmware framework to integrate FSL PPA into U-Boot. Signed-off-by: Hou Zhiqiang <[email protected]> Reviewed-by: York Sun <[email protected]>
2016-07-19ARMv8: add the secure monitor firmware frameworkHou Zhiqiang
This framework is introduced for ARMv8 secure monitor mode firmware. The main functions of the framework are, on EL3, verify the firmware, load it to the secure memory and jump into it, and while it returned to U-Boot, do some necessary setups at the 'target exception level' that is determined by the respective secure firmware. So far, the framework support only FIT format image, and need to define the name of which config node should be used in 'configurations' and the name of property for the raw secure firmware image in that config. The FIT image should be stored in Byte accessing memory, such as NOR Flash, or else it should be copied to main memory to use this framework. Signed-off-by: Hou Zhiqiang <[email protected]> Reviewed-by: York Sun <[email protected]>
2016-07-15armv8: mmu: Add support of non-identical mappingYork Sun
Introduce virtual and physical addresses in the mapping table. This change have no impact on existing boards because they all use idential mapping. Signed-off-by: York Sun <[email protected]>
2016-07-15armv8: mmu: house cleaningYork Sun
Make setup_pgtages() and get_tcr() available for platform code to customize MMU tables. Remove unintentional call of create_table(). Signed-off-by: York Sun <[email protected]>
2016-03-15arm64: Remove non-full-va map codeAlexander Graf
By now the code to only have a single page table level with 64k page size and 42 bit address space is no longer used by any board in tree, so we can safely remove it. To clean up code, move the layerscape mmu code to the new defines, removing redundant field definitions. Signed-off-by: Alexander Graf <[email protected]>
2016-03-15thunderx: Move mmu table into board fileAlexander Graf
The MMU range table can vary depending on things we may only find out at runtime. While the very simple ThunderX variant does not change, other boards will, so move the definition from a static entry in a header file to the board file. Signed-off-by: Alexander Graf <[email protected]>
2016-03-15arm64: Make full va map code more dynamicAlexander Graf
The idea to generate our pages tables from an array of memory ranges is very sound. However, instead of hard coding the code to create up to 2 levels of 64k granule page tables, we really should just create normal 4k page tables that allow us to set caching attributes on 2M or 4k level later on. So this patch moves the full_va mapping code to 4k page size and makes it fully flexible to dynamically create as many levels as necessary for a map (including dynamic 1G/2M pages). It also adds support to dynamically split a large map into smaller ones when some code wants to set dcache attributes. With all this in place, there is very little reason to create your own page tables in board specific files. Signed-off-by: Alexander Graf <[email protected]>
2016-03-15arm64: Disable TTBR1 maps in EL1Alexander Graf
When running in EL1, AArch64 knows two page table maps. One with addresses that start with all zeros (TTBR0) and one with addresses that start with all ones (TTBR1). In U-Boot we don't care about the high up maps, so just disable them to ensure we don't walk an invalid page table by accident. Reported-by: Mark Rutland <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2016-03-15thunderx: Calculate TCR dynamicallyAlexander Graf
Based on the memory map we can determine a lot of hard coded fields of TCR, like the maximum VA and max PA we want to support. Calculate those dynamically to reduce the chance for pit falls. Signed-off-by: Alexander Graf <[email protected]>
2016-01-19armv8: New MMU setup code allowing to use 48+ bits PA/VASergey Temerkhanov
This patch adds code which sets up 2-level page tables on ARM64 thus extending available VA space. CPUs implementing 64k translation granule are able to use direct PA-VA mapping of the whole 48 bit address space. It also adds the ability to reset the SCTRL register at the very beginning of execution to avoid interference from stale mappings set up by early firmware/loaders/etc. Signed-off-by: Sergey Temerkhanov <[email protected]> Signed-off-by: Radha Mohan Chintakuntla <[email protected]>
2015-11-30armv8/layerscape: Update MMU table with execute-never bitsAlison Wang
For most device addresses excution shouldn't be allowed. Revise the MMU table to enforce execute-never bits. OCRAM, DDR and IFC are allowed for excution. Signed-off-by: York Sun <[email protected]> Signed-off-by: Alison Wang <[email protected]> Reported-by: Zhichun Hua <[email protected]>
2015-10-29armv8/fsl_lsch2: Add fsl_lsch2 SoCMingkai Hu
Freescale LayerScape with Chassis Generation 2 is a set of SoCs with ARMv8 cores and 2rd generation of Chassis. Signed-off-by: Li Yang <[email protected]> Signed-off-by: Hou Zhiqiang <[email protected]> Signed-off-by: Mingkai Hu <[email protected]> Signed-off-by: Gong Qianyu <[email protected]> Reviewed-by: York Sun <[email protected]>
2015-10-15armv8/mmu: Set bits marked RES1 in TCRThierry Reding
For EL3 and EL2, the documentation says that bits 31 and 23 are reserved but should be written as 1. For EL1, only bit 23 is not reserved, so only write bit 31 as 1. Cc: Albert Aribaud <[email protected]> Cc: Marc Zyngier <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2015-10-15armv8/mmu: Clean up TCR programmingThierry Reding
Use the inner shareable attribute for memory, which makes more sense considering that this code is called when caches are being enabled. Cc: Albert Aribaud <[email protected]> Cc: Marc Zyngier <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2015-09-01armv8: fsl-lsch3: Rewrite MMU translation table entriesAlison Wang
This patch rewrites MMU translation table entries. To start, all table entries are written as "invalid", then "device-ngnrnr" and "normal" are written to the entries to enable access to specific addresses. Signed-off-by: Alison Wang <[email protected]> Signed-off-by: York Sun <[email protected]>
2015-07-20armv8: Fix TCR macros for shareability attributeZhichun Hua
For ARMv8, outer shareable is 0b10, inner shareable is 0b11 at bit position [13:12] of TCR_ELx register. Signed-off-by: Zhichun Hua <[email protected]> Signed-off-by: York Sun <[email protected]>