mbox series

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

Message ID 20210425141304.32721-1-kernelfans@gmail.com (mailing list archive)
Headers show
Series use __create_pgd_mapping() to implement idmap and unify codes | expand

Message

Pingfan Liu April 25, 2021, 2:12 p.m. UTC
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@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Kristina Martsenko <kristina.martsenko@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Steven Price <steven.price@arm.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Atish Patra <atish.patra@wdc.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Mark Brown <broonie@kernel.org>
To: linux-arm-kernel@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