[PATCHv2 00/10] use __create_pgd_mapping() to implement idmap and unify codes

Pingfan Liu kernelfans at gmail.com
Sun Apr 25 15:12:54 BST 2021


This series aim to share the pgtable manipulation code to head.S and
trans_pgd_idmap_page().

The core of the idea is by redefinition the CONFIG_PGTABLE_LEVEL, two
sets of pgtable manipulation code are generated, one as now is for
swapper_pg_dir, the other one is for idmap. And a dedicated
create_idmap() API is introduced.

The series can be grouped into two
[1~5/10] achieves porting trans_pgd_idmap_page() and introduce
create_idmap() API
[6-10/10] replace head.S pgtable manipulation asm with calling to
__create_pgd_mapping()


This series can success booting with the following configuration on Cavium
ThunderX 88XX cpu :
        PAGE_SIZE  VA  PA  PGTABLE_LEVEL
        4K         48  48  4
        4K         39  48  3
        16K        48  48  4
        16K        47  48  3
        64K        52  52  3
        64K        42  52  2


History

RFC:
https://lore.kernel.org/linux-arm-kernel/20210410095654.24102-1-kernelfans@gmail.com/

Cc: Catalin Marinas <catalin.marinas at arm.com>
Cc: Will Deacon <will at kernel.org>
Cc: Marc Zyngier <maz at kernel.org>
Cc: Kristina Martsenko <kristina.martsenko at arm.com>
Cc: James Morse <james.morse at arm.com>
Cc: Steven Price <steven.price at arm.com>
Cc: Jonathan Cameron <Jonathan.Cameron at huawei.com>
Cc: Pavel Tatashin <pasha.tatashin at soleen.com>
Cc: Anshuman Khandual <anshuman.khandual at arm.com>
Cc: Atish Patra <atish.patra at wdc.com>
Cc: Mike Rapoport <rppt at kernel.org>
Cc: Logan Gunthorpe <logang at deltatee.com>
Cc: Mark Brown <broonie at kernel.org>
To: linux-arm-kernel at lists.infradead.org

Pingfan Liu (10):
  arm64/mm: split out __create_pgd_mapping() routines
  arm64/mm: change __create_pgd_mapping() to accept nr_entries param and
    introduce create_idmap()
  arm64/mm: change __create_pgd_mapping() to accept extra parameter for
    allocator
  arm64/mm: enable __create_pgd_mapping() to run across different
    pgtable
  arm64/mm: port trans_pgd_idmap_page() onto create_idmap()
  arm64/mm: introduce pgtable allocator for idmap_pg_dir and init_pg_dir
  arm64/pgtable-prot.h: reorganize to cope with asm
  arm64/mmu_include.c: disable WARN_ON() and BUG_ON() when booting.
  arm64/mm: make __create_pgd_mapping() coped with pgtable's paddr
  arm64/head: convert idmap_pg_dir and init_pg_dir to
    __create_pgd_mapping()

 arch/arm64/Kconfig                    |   4 +
 arch/arm64/include/asm/pgalloc.h      |  29 +++
 arch/arm64/include/asm/pgtable-prot.h |  34 ++-
 arch/arm64/kernel/head.S              | 196 ++++----------
 arch/arm64/mm/Makefile                |   2 +
 arch/arm64/mm/idmap_mmu.c             |  39 +++
 arch/arm64/mm/mmu.c                   | 362 ++++++--------------------
 arch/arm64/mm/mmu_include.c           | 320 +++++++++++++++++++++++
 arch/arm64/mm/trans_pgd.c             |  62 +++--
 9 files changed, 579 insertions(+), 469 deletions(-)
 create mode 100644 arch/arm64/mm/idmap_mmu.c
 create mode 100644 arch/arm64/mm/mmu_include.c

-- 
2.29.2




More information about the linux-arm-kernel mailing list