]> xenbits.xensource.com Git - xen.git/commit
xen/riscv: introduce setup_initial_pages
authorOleksii Kurochko <oleksii.kurochko@gmail.com>
Wed, 31 May 2023 09:55:58 +0000 (11:55 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 31 May 2023 09:58:31 +0000 (11:58 +0200)
commite66003e7be1996c9dd8daca54ba34ad5bb58d668
treef8da230e93af60716568bee13f3d2da96367dea8
parentefadb18dd58abaa0c6102e04f1c25ac94c273853
xen/riscv: introduce setup_initial_pages

The idea was taken from xvisor but the following changes
were done:
* Use only a minimal part of the code enough to enable MMU
* rename {_}setup_initial_pagetables functions
* add an argument for setup_initial_mapping to have
  an opportunity to make set PTE flags.
* update setup_initial_pagetables function to map sections
  with correct PTE flags.
* Rewrite enable_mmu() to C.
* map linker addresses range to load addresses range without
  1:1 mapping. It will be 1:1 only in case when
  load_start_addr is equal to linker_start_addr.
* add safety checks such as:
  * Xen size is less than page size
  * linker addresses range doesn't overlap load addresses
    range
* Rework macros {THIRD,SECOND,FIRST,ZEROETH}_{SHIFT,MASK}
* change PTE_LEAF_DEFAULT to RW instead of RWX.
* Remove phys_offset as it is not used now
* Remove alignment  of {map, pa}_start &= XEN_PT_LEVEL_MAP_MASK(0);
  in  setup_inital_mapping() as they should be already aligned.
  Make a check that {map_pa}_start are aligned.
* Remove clear_pagetables() as initial pagetables will be
  zeroed during bss initialization
* Remove __attribute__((section(".entry")) for setup_initial_pagetables()
  as there is no such section in xen.lds.S
* Update the argument of pte_is_valid() to "const pte_t *p"
* Add check that Xen's load address is aligned at 4k boundary
* Refactor setup_initial_pagetables() so it is mapping linker
  address range to load address range. After setup needed
  permissions for specific section ( such as .text, .rodata, etc )
  otherwise RW permission will be set by default.
* Add function to check that requested SATP_MODE is supported

Origin: git@github.com:xvisor/xvisor.git 9be2fdd7
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Bobby Eshleman <bobbyeshleman@gmail.com>
xen/arch/riscv/Makefile
xen/arch/riscv/include/asm/config.h
xen/arch/riscv/include/asm/current.h [new file with mode: 0644]
xen/arch/riscv/include/asm/mm.h [new file with mode: 0644]
xen/arch/riscv/include/asm/page-bits.h
xen/arch/riscv/include/asm/page.h [new file with mode: 0644]
xen/arch/riscv/include/asm/processor.h
xen/arch/riscv/mm.c [new file with mode: 0644]
xen/arch/riscv/setup.c
xen/arch/riscv/xen.lds.S