summaryrefslogtreecommitdiff
path: root/include/bootdev.h
diff options
context:
space:
mode:
authorCasey Connolly <[email protected]>2026-06-08 19:13:51 +0200
committerTom Rini <[email protected]>2026-06-17 09:55:00 -0600
commit6468ca13ffd6f3ce85edff8f9b0c317c719aa9c6 (patch)
tree7aed3ca971b3e8c2160e0a82b1a0c62f9b285325 /include/bootdev.h
parent76c90926087cd586f151c5ebd557589e1306b45c (diff)
armv8: mmu: fix and optimise explicitly unmapping regions
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]>
Diffstat (limited to 'include/bootdev.h')
0 files changed, 0 insertions, 0 deletions