[PATCH v2 0/3] arm64: simplify fixmap code

Mark Rutland mark.rutland at arm.com
Thu Apr 6 08:27:56 PDT 2023


Currently arm64's fixmap code tries to use 2M blocks to map the FDT when
4K pages are in use. We do so for a number of historical reasons largely
boiling down to "it was simpler at the time", but there's no functional
or performance reason why we must use 2M block mappings for the FDT, and
using 2M blocks complicates the code and causes some potential issues
(e.g. mismatched aliases with memory surrounding the FDT).

These patches change the fixmap code to always map the FDT at page
granularity. This makes the code simpler, and gets rid of potential
issues. 

The first patch fixes a latent (but functionally benign) confusion
between the bounds of the entire fixmap region and the bounds of the
runtime portion of the fixmap. The second factors the fixmap code into a
separate file, adding a few lines due to includes and function
prototypes. The final patch makes the structural changes to simplify the
code.

I've boot-tested this atop v6.3-rc3 in a number of 4K/16K/64K
configurations to exercise the initialization and copy code.

Since v1 [1]:
* Add FIXADDR_TOT_{START,SIZE}
* Correct DTB mapping to be 2M + 1 page
* Fix typos

[1] https://lore.kernel.org/linux-arm-kernel/20230314142125.502043-1-mark.rutland@arm.com/

Thanks,
Mark.

Mark Rutland (3):
  arm64: add FIXADDR_TOT_{START,SIZE}
  arm64: mm: move fixmap code to its own file
  arm64: mm: always map fixmap at page granularity

 arch/arm64/include/asm/fixmap.h         |  22 +--
 arch/arm64/include/asm/kernel-pgtable.h |   5 +-
 arch/arm64/include/asm/mmu.h            |   2 +
 arch/arm64/mm/Makefile                  |   2 +-
 arch/arm64/mm/fixmap.c                  | 203 ++++++++++++++++++++++++
 arch/arm64/mm/mmu.c                     | 197 +----------------------
 arch/arm64/mm/ptdump.c                  |   2 +-
 7 files changed, 225 insertions(+), 208 deletions(-)
 create mode 100644 arch/arm64/mm/fixmap.c

-- 
2.30.2




More information about the linux-arm-kernel mailing list