enable MMU for RISC-V
PATCH v7 3/5 xen/riscv: align __bss_start
In reply to Oleksii Kurochkobss clear cycle requires proper alignment of __bss_start.
---
Changes in V7:
* the patch was introduced in the current patch series.
--- xen/arch/riscv/xen.lds.S | 1 + 1 file changed, 1 insertion(+)
xen/arch/riscv/xen.lds.S +1 -0
@@ -137,6 +137,7 @@ SECTIONS __init_end = .; .bss : { /* BSS */ + . = ALIGN(POINTER_ALIGN); __bss_start = .; *(.bss.stack_aligned) . = ALIGN(PAGE_SIZE);
Signature · 1 line
2.40.1
v7 cover enable MMU for RISC-V
The patch series introduces the following things:
1. Functionality to build the page tables for Xen that map link-time to physical-time location.
2. Check that Xen is less then page size.
3. Check that load addresses don't overlap with linker addresses.
4. Prepare things for proper switch to virtual memory world.
5. Load the built page table into the SATP
6. Enable MMU.
---
Changes in V7:
- Fix range of frametable range in RV64 layout.
- Add ifdef SV39 to the RV64 layout comment to make it explicit that
description if for SV39 mode.
- Add missed row in the RV64 layout table.
- define CONFIG_PAGING_LEVELS=2 for SATP_MODE_SV32.
- update switch_stack_and_jump macros(): add constraint 'X' for fn,
memory clobber and wrap into do {} while ( false ).
- add noreturn to definition of enable_mmu().
- update pt_index() to "(pt_linear_offset(lvl, (va)) & VPN_MASK)".
- expand macros pte_to_addr()/addr_to_pte() in paddr_to_pte() and
pte_to_paddr() functions and after drop them.
- remove inclusion of <asm/config.h>.
- update commit message around definition of PGTBL_INITIAL_COUNT.
- remove PGTBL_ENTRY_AMOUNT and use PAGETABLE_ENTRIES instead.
- code style fixes
- remove permission argument of setup_initial_mapping() function
- remove calc_pgtbl_lvls_num() as it's not needed anymore after definition
of CONFIG_PAGING_LEVELS
- introduce sfence_vma()
- remove satp_mode argument from check_pgtbl_mode_support() and use
RV_STAGE1_MODE directly instead.
- change .align to .p2align
- drop inclusion of <asm/asm-offsets.h> from head.S. This change isn't
necessary for the current patch series.
- create a separate patch for xen.lds.S.
---
Changes in V6:
- update RV VM layout and related to it things
- move PAGE_SHIFT, PADDR_BITS to the top of page-bits.h
- cast argument x of pte_to_addr() macros to paddr_t to avoid risk of overflow for RV32
- update type of num_levels from 'unsigned long' to 'unsigned int'
- define PGTBL_INITIAL_COUNT as ((CONFIG_PAGING_LEVELS - 1) + 1)
- update type of permission arguments. changed it from 'unsgined long' to 'unsigned int'
- fix code style
- switch while 'loop' to 'for' loop
- undef HANDLE_PGTBL
- clean root page table after MMU is disabled in check_pgtbl_mode_support() function
- align __bss_start properly
- remove unnecesssary const for paddr_to_pte, pte_to_paddr, pte_is_valid functions
- add switch_stack_and_jump macros and use it inside enable_mmu() before jump to cont_after_mmu_is_enabled() function
---
Changes in V5:
* rebase the patch series on top of current staging
* Update cover letter: it was removed the info about the patches on which
MMU patch series is based as they were merged to staging
* add new patch with description of VM layout for RISC-V2
* Indent fields of pte_t struct
* Rename addr_to_pte() and ppn_to_paddr() to match their content
---
Changes in V4:
* use GB() macros instead of defining SZ_1G
* hardcode XEN_VIRT_START and add comment (ADDRESS_SPACE_END + 1 - GB(1))
* remove unnecessary 'asm' word at the end of #error
* encapsulate pte_t definition in a struct
* rename addr_to_ppn() to ppn_to_paddr().
* change type of paddr argument from const unsigned long to paddr_t
* pte_to_paddr() update prototype.
* calculate size of Xen binary based on an amount of page tables
* use unsgined int instead of 'uint32_t' instead of uint32_t as
their use isn't warranted.
* remove extern of bss_{start,end} as they aren't used in mm.c anymore
* fix code style
* add argument for HANDLE_PGTBL macros instead of curr_lvl_num variable
* make enable_mmu() as noinline to prevent under link-time optimization
because of the nature of enable_mmu()
* add function to check that SATP_MODE is supported.
* update the commit message
* update setup_initial_pagetables to set correct PTE flags in one pass
instead of calling setup_pte_permissions after setup_initial_pagetables()
as setup_initial_pagetables() isn't used to change permission flags.
---
Changes in V3:
* Update the cover letter message: the patch series isn't depend on
[ RISC-V basic exception handling implementation ] as it was decied
to enable MMU before implementation of exception handling. Also MMU
patch series is based on two other patches which weren't merged [1]
and [2]
- Update the commit message for [ [PATCH v3 1/3]
xen/riscv: introduce setup_initial_pages ].
- update definition of pte_t structure to have a proper size of pte_t in case of RV32.
- update asm/mm.h with new functions and remove unnecessary 'extern'.
- remove LEVEL_* macros as only XEN_PT_LEVEL_* are enough.
- update paddr_to_pte() to receive permissions as an argument.
- add check that map_start & pa_start is properly aligned.
- move defines PAGETABLE_ORDER, PAGETABLE_ENTRIES, PTE_PPN_SHIFT to <asm/page-bits.h>
- Rename PTE_SHIFT to PTE_PPN_SHIFT
- refactor setup_initial_pagetables: map all LINK addresses to LOAD addresses and after setup PTEs permission for sections; update check that linker and load addresses don't overlap.
- refactor setup_initial_mapping: allocate pagetable 'dynamically' if it is necessary.
- rewrite enable_mmu in C; add the check that map_start and pa_start are aligned on 4k boundary.
- update the comment for setup_initial_pagetable funcion
- Add RV_STAGE1_MODE to support different MMU modes.
- update the commit message that MMU is also enabled here
- set XEN_VIRT_START very high to not overlap with load address range
- align bss section
---
Changes in V2:
* Remove {ZEROETH,FIRST,...}_{SHIFT,MASK, SIZE,...} and
introduce instead of them XEN_PT_LEVEL_*() and LEVEL_*
* Rework pt_linear_offset() and pt_index based on XEN_PT_LEVEL_*()
* Remove clear_pagetables() functions as pagetables were zeroed during
.bss initialization
* Rename _setup_initial_pagetables() to setup_initial_mapping()
* Make PTE_DEFAULT equal to RX.
* Update prototype of setup_initial_mapping(..., bool writable) -> setup_initial_mapping(..., UL flags)
* Update calls of setup_initial_mapping according to new prototype
* Remove unnecessary call of:
_setup_initial_pagetables(..., load_addr_start, load_addr_end, load_addr_start, ...)
* Define index* in the loop of setup_initial_mapping
* Remove attribute "__attribute__((section(".entry")))" for setup_initial_pagetables() as we don't have such section
* make arguments of paddr_to_pte() and pte_is_valid() as const.
* use <xen/kernel.h> instead of declaring extern unsigned long _stext, 0etext, _srodata, _erodata
* update 'extern unsigned long __init_begin' to 'extern unsigned long __init_begin[]'
* use aligned() instead of "__attribute__((__aligned__(PAGE_SIZE)))"
* set __section(".bss.page_aligned") for page tables arrays
* fix identatations
* Change '__attribute__((section(".entry")))' to '__init'
* Remove alignment of {map, pa}_start &= XEN_PT_LEVEL_MAP_MASK(0); in setup_inital_mapping() as they should be already 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"
* Remove patch "[PATCH v1 3/3] automation: update RISC-V smoke test" from the patch series as it was introduced simplified approach for RISC-V smoke test by Andrew Cooper
* Add patch [[xen/riscv: remove dummy_bss variable] as there is no any sense in dummy_bss variable after introduction of inittial page tables.
---
Oleksii Kurochko (5):
xen/riscv: add VM space layout
xen/riscv: introduce setup_initial_pages
xen/riscv: align __bss_start
xen/riscv: setup initial pagetables
xen/riscv: remove dummy_bss variable
xen/arch/riscv/Makefile | 1 + xen/arch/riscv/include/asm/config.h | 50 ++++- xen/arch/riscv/include/asm/current.h | 11 + xen/arch/riscv/include/asm/mm.h | 9 + xen/arch/riscv/include/asm/page-bits.h | 10 + xen/arch/riscv/include/asm/page.h | 58 ++++++ xen/arch/riscv/include/asm/processor.h | 5 + xen/arch/riscv/mm.c | 277 +++++++++++++++++++++++++ xen/arch/riscv/setup.c | 22 +- xen/arch/riscv/xen.lds.S | 4 + 10 files changed, 438 insertions(+), 9 deletions(-) create mode 100644 xen/arch/riscv/include/asm/current.h create mode 100644 xen/arch/riscv/include/asm/mm.h create mode 100644 xen/arch/riscv/include/asm/page.h create mode 100644 xen/arch/riscv/mm.c
Signature · 1 line
2.40.1
PATCH v7 1/5 xen/riscv: add VM space layout
Also it was added explanation about ignoring of top VA bits
---
Changes in V7:
- Fix range of frametable range in RV64 layout.
- Add ifdef SV39 to the RV64 layout comment to make it explicit that description if for SV39 mode.
- Add missed row in the RV64 layout table.
---
Changes in V6:
- update comment above the RISCV-64 layout table
- add Slot column to the table with RISCV-64 Layout
- update RV-64 layout table.
---
Changes in V5:
* the patch was introduced in the current patch series.
--- xen/arch/riscv/include/asm/config.h | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
xen/arch/riscv/include/asm/config.h +36 -0
@@ -4,6 +4,42 @@#include <xen/const.h> #include <xen/page-size.h> +/* +* RISC-V64 Layout: +* +* #ifdef SV39 +* +* From the riscv-privileged doc: +* When mapping between narrower and wider addresses, +* RISC-V zero-extends a narrower physical address to a wider size. +* The mapping between 64-bit virtual addresses and the 39-bit usable +* address space of Sv39 is not based on zero-extension but instead +* follows an entrenched convention that allows an OS to use one or +* a few of the most-significant bits of a full-size (64-bit) virtual +* address to quickly distinguish user and supervisor address regions. +* +* It means that: +* top VA bits are simply ignored for the purpose of translating to PA. +* +* ============================================================================ +* Start addr | End addr | Size | Slot |area description +* ============================================================================ +* FFFFFFFFC0800000 | FFFFFFFFFFFFFFFF |1016 MB | L2 511 | Unused +* FFFFFFFFC0600000 | FFFFFFFFC0800000 | 2 MB | L2 511 | Fixmap +* FFFFFFFFC0200000 | FFFFFFFFC0600000 | 4 MB | L2 511 | FDT +* FFFFFFFFC0000000 | FFFFFFFFC0200000 | 2 MB | L2 511 | Xen +* ... | 1 GB | L2 510 | Unused +* 0000003200000000 | 0000007f40000000 | 309 GB | L2 200-509 | Direct map +* ... | 1 GB | L2 199 | Unused +* 0000003100000000 | 00000031C0000000 | 3 GB | L2 196-198 | Frametable +* ... | 1 GB | L2 195 | Unused +* 0000003080000000 | 00000030C0000000 | 1 GB | L2 194 | VMAP +* ... | 194 GB | L2 0 - 193 | Unused +* ============================================================================ +* +* #endif +*/ +#if defined(CONFIG_RISCV_64 )# define LONG_BYTEORDER 3# define ELFSIZE 64
Signature · 1 line
2.40.1
PATCH v7 4/5 xen/riscv: setup initial pagetables
In reply to Oleksii KurochkoThe patch does two thing:
1. Setup initial pagetables.
2. Enable MMU which end up with code in
cont_after_mmu_is_enabled()
---
Changes in V7:
- Nothing changed. Only rebase
---
Changes in V6:
- Nothing changed. Only rebase
---
Changes in V5:
- Nothing changed. Only rebase
---
Changes in V4:
- Nothing changed. Only rebase
---
Changes in V3:
- update the commit message that MMU is also enabled here
- remove early_printk("All set up\n") as it was moved to cont_after_mmu_is_enabled() function after MMU is enabled.
---
Changes in V2:
* Update the commit message
--- xen/arch/riscv/setup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
xen/arch/riscv/setup.c +4 -1
@@ -21,7 +21,10 @@ void __init noreturn start_xen(unsigned long bootcpu_id, {early_printk ("Hello from C env\n" ); -early_printk ("All set up\n" ); +setup_initial_pagetables (); + +enable_mmu (); +for ( ;; ) asmvolatile ("wfi" );
Signature · 1 line
2.40.1
PATCH v7 2/5 xen/riscv: introduce setup_initial_pages
In reply to Oleksii KurochkoThe 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: [email protected]:xvisor/xvisor.git 9be2fdd7
---
Changes in V7:
- define CONFIG_PAGING_LEVELS=2 for SATP_MODE_SV32.
- update switch_stack_and_jump macros(): add constraint 'X' for fn,
memory clobber and wrap into do {} while ( false ).
- add noreturn to definition of enable_mmu().
- update pt_index() to "(pt_linear_offset(lvl, (va)) & VPN_MASK)".
- expand macros pte_to_addr()/addr_to_pte() in paddr_to_pte() and
pte_to_paddr() functions and after drop them.
- remove inclusion of <asm/config.h>.
- update commit message around definition of PGTBL_INITIAL_COUNT.
- remove PGTBL_ENTRY_AMOUNT and use PAGETABLE_ENTRIES instead.
- code style fixes
- remove permission argument of setup_initial_mapping() function
- remove calc_pgtbl_lvls_num() as it's not needed anymore after definition
of CONFIG_PAGING_LEVELS.
- introduce sfence_vma().
- remove satp_mode argument from check_pgtbl_mode_support() and use
RV_STAGE1_MODE directly instead.
- change .align to .p2align.
- drop inclusion of <asm/asm-offsets.h> from head.S. This change isn't
necessary for the current patch series.
---
Changes in V6:
- move PAGE_SHIFT, PADDR_BITS to the top of page-bits.h
- cast argument x of pte_to_addr() macros to paddr_t to avoid risk of overflow for RV32
- update type of num_levels from 'unsigned long' to 'unsigned int'
- define PGTBL_INITIAL_COUNT as ((CONFIG_PAGING_LEVELS - 1) + 1)
- update type of permission arguments. changed it from 'unsgined long' to 'unsigned int'
- fix code style
- switch while 'loop' to 'for' loop
- undef HANDLE_PGTBL
- clean root page table after MMU is disabled in check_pgtbl_mode_support() function
- align __bss_start properly
- remove unnecesssary const for paddr_to_pte, pte_to_paddr, pte_is_valid functions
- add switch_stack_and_jump macros and use it inside enable_mmu() before jump to cont_after_mmu_is_enabled() function
---
Changes in V5:
* Indent fields of pte_t struct
* Rename addr_to_pte() and ppn_to_paddr() to match their content
---
Changes in V4:
* use GB() macros instead of defining SZ_1G
* hardcode XEN_VIRT_START and add comment (ADDRESS_SPACE_END + 1 - GB(1))
* remove unnecessary 'asm' word at the end of #error
* encapsulate pte_t definition in a struct
* rename addr_to_ppn() to ppn_to_paddr().
* change type of paddr argument from const unsigned long to paddr_t
* pte_to_paddr() update prototype.
* calculate size of Xen binary based on an amount of page tables
* use unsgined int instead of 'uint32_t' instead of uint32_t as
their use isn't warranted.
* remove extern of bss_{start,end} as they aren't used in mm.c anymore
* fix code style
* add argument for HANDLE_PGTBL macros instead of curr_lvl_num variable
* make enable_mmu() as noinline to prevent under link-time optimization
because of the nature of enable_mmu()
* add function to check that SATP_MODE is supported.
* update the commit message
* update setup_initial_pagetables to set correct PTE flags in one pass
instead of calling setup_pte_permissions after setup_initial_pagetables()
as setup_initial_pagetables() isn't used to change permission flags.
---
Changes in V3:
- update definition of pte_t structure to have a proper size of pte_t
in case of RV32.
- update asm/mm.h with new functions and remove unnecessary 'extern'.
- remove LEVEL_* macros as only XEN_PT_LEVEL_* are enough.
- update paddr_to_pte() to receive permissions as an argument.
- add check that map_start & pa_start is properly aligned.
- move defines PAGETABLE_ORDER, PAGETABLE_ENTRIES, PTE_PPN_SHIFT to <asm/page-bits.h>
- Rename PTE_SHIFT to PTE_PPN_SHIFT
- refactor setup_initial_pagetables: map all LINK addresses to LOAD addresses
and after setup PTEs permission for sections; update check that linker
and load addresses don't overlap.
- refactor setup_initial_mapping: allocate pagetable 'dynamically' if it is necessary.
- rewrite enable_mmu in C; add the check that map_start and pa_start are
aligned on 4k boundary.
- update the comment for setup_initial_pagetable funcion
- Add RV_STAGE1_MODE to support different MMU modes
- set XEN_VIRT_START very high to not overlap with load address range
- align bss section
---
Changes in V2:
* update the commit message:
* Remove {ZEROETH,FIRST,...}_{SHIFT,MASK, SIZE,...} and
introduce instead of them XEN_PT_LEVEL_*() and LEVEL_*
* Rework pt_linear_offset() and pt_index based on XEN_PT_LEVEL_*()
* Remove clear_pagetables() functions as pagetables were zeroed during
.bss initialization
* Rename _setup_initial_pagetables() to setup_initial_mapping()
* Make PTE_DEFAULT equal to RX.
* Update prototype of setup_initial_mapping(..., bool writable) -> setup_initial_mapping(..., UL flags)
* Update calls of setup_initial_mapping according to new prototype
* Remove unnecessary call of:
_setup_initial_pagetables(..., load_addr_start, load_addr_end, load_addr_start, ...)
* Define index* in the loop of setup_initial_mapping
* Remove attribute "__attribute__((section(".entry")))" for setup_initial_pagetables() as we don't have such section
* make arguments of paddr_to_pte() and pte_is_valid() as const.
* make xen_second_pagetable static.
* use <xen/kernel.h> instead of declaring extern unsigned long _stext, 0etext, _srodata, _erodata
* update 'extern unsigned long __init_begin' to 'extern unsigned long __init_begin[]'
* use aligned() instead of "__attribute__((__aligned__(PAGE_SIZE)))"
* set __section(".bss.page_aligned") for page tables arrays
* fix identatations
* Change '__attribute__((section(".entry")))' to '__init'
* Remove phys_offset as it isn't used now.
* Remove alignment of {map, pa}_start &= XEN_PT_LEVEL_MAP_MASK(0); in setup_inital_mapping() as they should be already 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"
--- xen/arch/riscv/Makefile | 1 + xen/arch/riscv/include/asm/config.h | 14 +- xen/arch/riscv/include/asm/current.h | 11 + xen/arch/riscv/include/asm/mm.h | 9 + xen/arch/riscv/include/asm/page-bits.h | 10 + xen/arch/riscv/include/asm/page.h | 58 ++++++ xen/arch/riscv/include/asm/processor.h | 5 + xen/arch/riscv/mm.c | 277 +++++++++++++++++++++++++ xen/arch/riscv/setup.c | 11 + xen/arch/riscv/xen.lds.S | 3 + 10 files changed, 398 insertions(+), 1 deletion(-) create mode 100644 xen/arch/riscv/include/asm/current.h create mode 100644 xen/arch/riscv/include/asm/mm.h create mode 100644 xen/arch/riscv/include/asm/page.h create mode 100644 xen/arch/riscv/mm.c
xen/arch/riscv/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-y += entry.o +obj-y += mm.o obj-$(CONFIG_RISCV_64) += riscv64/ obj-y += sbi.o obj-y += setup.o
xen/arch/riscv/include/asm/config.h +13 -1
@@ -75,12 +75,24 @@ name:#endif -#define XEN_VIRT_START _AT(UL, 0x80200000) +#ifdef CONFIG_RISCV_64 +#define XEN_VIRT_START 0xFFFFFFFFC0000000/* (_AC(-1, UL) + 1 - GB(1)) */ +#else +#error "RV32 isn't supported" +#endif #define SMP_CACHE_BYTES (1 << 6)#define STACK_SIZE PAGE_SIZE +#ifdef CONFIG_RISCV_64 +#define CONFIG_PAGING_LEVELS 3 +#define RV_STAGE1_MODE SATP_MODE_SV39 +#else +#define CONFIG_PAGING_LEVELS 2 +#define RV_STAGE1_MODE SATP_MODE_SV32 +#endif +#endif /* __RISCV_CONFIG_H__ */ /* * Local variables:
xen/arch/riscv/include/asm/current.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __ASM_CURRENT_H +#define __ASM_CURRENT_H + +#define switch_stack_and_jump (stack, fn) do { \ + asm volatile ( \ + "mv sp, %0\n" \ + "j " #fn :: "r" (stack), "X" (fn) : "memory" ); \ + unreachable(); \ +} while ( false ) + +#endif /* __ASM_CURRENT_H */
xen/arch/riscv/include/asm/mm.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _ASM_RISCV_MM_H +#define _ASM_RISCV_MM_H + +void setup_initial_pagetables (void ); + +void enable_mmu (void ); +void cont_after_mmu_is_enabled (void ); + +#endif /* _ASM_RISCV_MM_H */
xen/arch/riscv/include/asm/page-bits.h +10 -0
@@ -4,4 +4,14 @@#define PAGE_SHIFT 12/* 4 KiB Pages */ #define PADDR_BITS 56/* 44-bit PPN */ +#ifdef CONFIG_RISCV_64 +#define PAGETABLE_ORDER (9) +#else /* CONFIG_RISCV_32 */ +#define PAGETABLE_ORDER (10) +#endif + +#define PAGETABLE_ENTRIES (1 << PAGETABLE_ORDER) + +#define PTE_PPN_SHIFT 10 +#endif /* __RISCV_PAGE_BITS_H__ */
xen/arch/riscv/include/asm/page.h new file +58 -0
58 lines not on this page · raw message
xen/arch/riscv/include/asm/processor.h +5 -0
@@ -69,6 +69,11 @@ static inline void die(void)wfi (); } +static inline void sfence_vma (void ) +{ + __asm__ __volatile__ ("sfence.vma" :::"memory" ); +} +#endif /* __ASSEMBLY__ */ #endif /* _ASM_RISCV_PROCESSOR_H */
xen/arch/riscv/mm.c new file +277 -0
277 lines not on this page · raw message
xen/arch/riscv/setup.c +11 -0
@@ -2,6 +2,7 @@#include <xen/init.h> #include <asm/early_printk.h> +#include <asm/mm.h> /* Xen stack for bringing up the first CPU. */ unsigned char __initdata cpu0_boot_stack[STACK_SIZE ]
@@ -26,3 +27,13 @@ void __init noreturn start_xen(unsigned long bootcpu_id,unreachable (); } + +void __init noreturncont_after_mmu_is_enabled (void ) +{ +early_printk ("All set up\n" ); + +for ( ;; ) + asmvolatile ("wfi" ); + +unreachable (); +}
xen/arch/riscv/xen.lds.S +3 -0
@@ -172,3 +172,6 @@ ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned") ASSERT(!SIZEOF(.got), ".got non-empty") ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty") + +ASSERT(_end - _start <= MB(2), "Xen too large for early-boot assumptions") +
Signature · 1 line
2.40.1
PATCH v7 5/5 xen/riscv: remove dummy_bss variable
In reply to Oleksii KurochkoAfter introduction of initial pagetables there is no any sense in dummy_bss variable as bss section will not be empty anymore.
---
Changes in V6:
- Nothing changed. Only rebase
---
Changes in V5:
- Nothing changed. Only rebase
---
Changes in V4:
- Nothing changed. Only rebase
---
Changes in V3:
* patch was introduced in the current one patch series (v3).
---
Changes in V2:
* patch was introduced in the current one patch series (v2).
--- xen/arch/riscv/setup.c | 8 -------- 1 file changed, 8 deletions(-)
xen/arch/riscv/setup.c +0 -8
@@ -8,14 +8,6 @@unsigned char __initdata cpu0_boot_stack[STACK_SIZE ]__aligned(STACK_SIZE) ; -/* -* To be sure that .bss isn't zero. It will simplify code of -* .bss initialization. -* TODO: -* To be deleted when the first real .bss user appears -*/ -int dummy_bss __attribute__((unused)); -void __init noreturnstart_xen (unsigned long bootcpu_id,paddr_t dtb_addr) {
Signature · 1 line
2.40.1
Re: [PATCH v7 3/5] xen/riscv: align __bss_start
In reply to Oleksii KurochkoQuoted 3 lines · Oleksii Kurochko
bss clear cycle requires proper alignment of
__bss_start.Signed-off-by Oleksii Kurochko <[email protected]>
with two remarks, though:
While probably not very important yet for RISC-V (until there is at least enough functionality to, say, boot Dom0), you may want to get used to add Fixes: tags in cases like this one.
xen/arch/riscv/xen.lds.S SECTIONS · line 143
Quoted 10 lines
xen/arch/riscv/xen.lds.S +1
-0@@ -137,6 +137,7 @@ SECTIONS __init_end = .; .bss : { /* BSS */ + . = ALIGN(POINTER_ALIGN); __bss_start = .; *(.bss.stack_aligned) . = ALIGN(PAGE_SIZE);
While independent of the change here, this ALIGN() visible in context is unnecessary, afaict. ALIGN() generally only makes sense when there's a linker-script-defined symbol right afterwards. Taking the case here, any contributions to .bss.page_aligned have to specify proper alignment themselves anyway (or else they'd be dependent upon linking order). Just like there's (correctly) no ALIGN(STACK_SIZE) ahead of *(.bss.stack_aligned).
The change here might be a good opportunity to drop that ALIGN() at the same time. So long as you (and the maintainers) agree, I guess the adjustment could easily be made while committing.
Jan
Re: [PATCH v7 3/5] xen/riscv: align __bss_start
Quoted 11 lines · Jan Beulich
Quoted 3 lines · Oleksii Kurochko
bss clear cycle requires proper alignment of
__bss_start.Signed-off-by Oleksii Kurochko <[email protected]>Reviewed-by Jan Beulich <[email protected]>with two remarks, though:
While probably not very important yet for RISC-V (until there is at least enough functionality to, say, boot Dom0), you may want to get used to add Fixes: tags in cases like this one.
Got it.
Quoted 12 lines
Quoted 11 lines
xen/arch/riscv/xen.lds.S +0
-0@@ -137,6 +137,7 @@ SECTIONS __init_end = .;
.bss : { /* BSS */
+ . =ALIGN(POINTER_ALIGN);
__bss_start= .;
*(.bss.stack_aligned)
. =ALIGN(PAGE_SIZE);
Quoted 7 lines
While independent of the change here, this
ALIGN()visible in context is unnecessary, afaict.ALIGN()generally only makes sense when there's a linker-script-defined symbol right afterwards. Taking the case here, any contributions to .bss.page_aligned have to specify proper alignment themselves anyway (or else they'd be dependent upon linking order). Just like there's (correctly) noALIGN(STACK_SIZE)ahead of *(.bss.stack_aligned).
It make sense.
Quoted 4 lines
The change here might be a good opportunity to drop that
ALIGN()at the same time. So long as you (and the maintainers) agree, I guess the adjustment could easily be made while committing.
I would agree with this. Thanks.
~ Oleksii
Re: [PATCH v7 1/5] xen/riscv: add VM space layout
In reply to Oleksii Kurochkoxen/arch/riscv/include/asm/config.h line 10
Quoted 10 lines · Oleksii Kurochko
xen/arch/riscv/include/asm/config.h +4
-0@@ -4,6 +4,42 @@#include <xen/const.h> #include <xen/page-size.h> +/* +* RISC-V64 Layout: +* +* #ifdef SV39
I did point you at x86'es similar #ifdef. Unlike here, there we use a symbol which actually has a meaning, allowing to spot this comment in e.g. grep output when looking for uses of that symbol. Hence here e.g.
#ifdef RV_STAGE1_MODE == SATP_MODE_SV39
? (I would also recommend to use the same style as x86 does, such that the #ifdef and #endif look like normal directives [e.g. again in grep output], leaving aside that they're inside a comment.)
Quoted 11 lines
xen/arch/riscv/include/asm/config.h +11
-0+* From the riscv-privileged doc: +* When mapping between narrower and wider addresses, +* RISC-V zero-extends a narrower physical address to a wider size. +* The mapping between 64-bit virtual addresses and the 39-bit usable +* address space of Sv39 is not based on zero-extension but instead +* follows an entrenched convention that allows an OS to use one or +* a few of the most-significant bits of a full-size (64-bit) virtual +* address to quickly distinguish user and supervisor address regions. +* +* It means that: +* top VA bits are simply ignored for the purpose of translating to PA.
xen/arch/riscv/include/asm/config.h line 32
Quoted 10 lines
xen/arch/riscv/include/asm/config.h +10
-0+* +* ============================================================================ +* Start addr | End addr | Size | Slot |area description +* ============================================================================ +* FFFFFFFFC0800000 | FFFFFFFFFFFFFFFF |1016 MB | L2 511 | Unused +* FFFFFFFFC0600000 | FFFFFFFFC0800000 | 2 MB | L2 511 | Fixmap +* FFFFFFFFC0200000 | FFFFFFFFC0600000 | 4 MB | L2 511 | FDT +* FFFFFFFFC0000000 | FFFFFFFFC0200000 | 2 MB | L2 511 | Xen +* ... | 1 GB | L2 510 | Unused +* 0000003200000000 | 0000007f40000000 | 309 GB | L2 200-509 | Direct map
The upper bound here is 0000007f80000000 afaict, which then also makes the earlier gap 1Gb in size.
Jan
Re: [PATCH v7 2/5] xen/riscv: introduce setup_initial_pages
In reply to Oleksii KurochkoQuoted 24 lines · Oleksii Kurochko
xen/arch/riscv/include/asm/page.h new file +21
-0@@ -0,0 +1,58 @@ +#ifndef _ASM_RISCV_PAGE_H +#define _ASM_RISCV_PAGE_H + +#include <xen/const.h> +#include <xen/types.h> + +#define VPN_MASK ((unsigned long)(PAGETABLE_ENTRIES - 1)) + +#define XEN_PT_LEVEL_ORDER (lvl) ((lvl) * PAGETABLE_ORDER) +#define XEN_PT_LEVEL_SHIFT (lvl) (XEN_PT_LEVEL_ORDER(lvl) + PAGE_SHIFT) +#define XEN_PT_LEVEL_SIZE (lvl) (_AT(paddr_t, 1) << XEN_PT_LEVEL_SHIFT(lvl)) +#define XEN_PT_LEVEL_MAP_MASK (lvl) (~(XEN_PT_LEVEL_SIZE(lvl) - 1)) +#define XEN_PT_LEVEL_MASK (lvl) (VPN_MASK << XEN_PT_LEVEL_SHIFT(lvl)) + +#define PTE_VALID BIT(0, UL) +#define PTE_READABLE BIT(1, UL) +#define PTE_WRITABLE BIT(2, UL) +#define PTE_EXECUTABLE BIT(3, UL) +#define PTE_USER BIT(4, UL) +#define PTE_GLOBAL BIT(5, UL) +#define PTE_ACCESSED BIT(6, UL)
xen/arch/riscv/include/asm/page.h line 31
Quoted 10 lines
xen/arch/riscv/include/asm/page.h new file +10
-0+#define PTE_DIRTY BIT(7, UL) +#define PTE_RSW (BIT(8, UL) | BIT(9, UL)) + +#define PTE_LEAF_DEFAULT (PTE_VALID | PTE_READABLE | PTE_WRITABLE) +#define PTE_TABLE (PTE_VALID) + +/* Calculate the offsets into the pagetables for a given VA */ +#define pt_linear_offset (lvl, va) ((va) >> XEN_PT_LEVEL_SHIFT(lvl)) + +#define pt_index (lvl, va) (pt_linear_offset(lvl, (va)) & VPN_MASK)
Nit: Please be consistent with parentheses. Here va doesn't need any, but if you added / kept them, then lvl should also gain them.
xen/arch/riscv/include/asm/page.h line 45
Quoted 13 lines
xen/arch/riscv/include/asm/page.h new file +13
-0+/* Page Table entry */ +typedef struct { +#ifdef CONFIG_RISCV_64 +uint64_t pte; +#else +uint32_t pte; +#endif +}pte_t ; + +static inline pte_t paddr_to_pte (paddr_t paddr, +unsigned int permissions) +{ +return (pte_t ) { .pte = (paddr >>PAGE_SHIFT ) <<PTE_PPN_SHIFT | permissions };
Please parenthesize the << against the |. I have also previously recommended to avoid open-coding of things like PFN_DOWN() (or paddr_to_pfn(), if you like that better) or ...
xen/arch/riscv/include/asm/page.h line 50
Quoted 5 lines
xen/arch/riscv/include/asm/page.h new file +5
-0+} + +static inline paddr_t pte_to_paddr (pte_t pte) +{ +return ((paddr_t )pte.pte >>PTE_PPN_SHIFT ) <<PAGE_SHIFT ;
... or pfn_to_paddr() (which here would avoid the misplaced cast).
xen/arch/riscv/include/asm/processor.h static inline void die(void) · line 75
Quoted 10 lines
xen/arch/riscv/include/asm/processor.h +4
-0@@ -69,6 +69,11 @@ static inline void die(void)wfi (); } +static inline void sfence_vma (void ) +{ + __asm__ __volatile__ ("sfence.vma" :::"memory" ); +}
Hmm, in switch_stack_and_jump() you use "asm volatile()" (no underscores). This is another thing which would nice if it was consistent (possibly among headers as one group, and .c files as another - there may be reasons why one wants the underscore variants in headers, but the "easier" ones in .c files).
Also nit: Style (missing blanks inside the parentheses).
Quoted 7 lines
xen/arch/riscv/include/asm/processor.h +7
-0+static void __init setup_initial_mapping (struct mmu_desc *mmu_desc, +unsigned long map_start, +unsigned long map_end, +unsigned long pa_start) +{ +unsigned int index; +pte_t *pgtbl;
xen/arch/riscv/include/asm/processor.h static inline void die(void)
Quoted 10 lines
xen/arch/riscv/include/asm/processor.h +10
-0+unsigned long page_addr; + +if ( (unsigned long )_start %XEN_PT_LEVEL_SIZE (0 ) ) + { +early_printk ("(XEN) Xen should be loaded at 4k boundary\n" ); +die (); + } + +if ( map_start & ~XEN_PT_LEVEL_MAP_MASK (0 ) || + pa_start & ~XEN_PT_LEVEL_MAP_MASK (0 ) )
Nit: Please parenthesize the two & against the ||.
Quoted 34 lines
xen/arch/riscv/include/asm/processor.h +34
-0+ { +early_printk ("(XEN) map and pa start addresses should be aligned\n" ); +/* panic(), BUG() or ASSERT() aren't ready now. */ +die (); + } + +for ( page_addr = map_start; + page_addr < map_end; + page_addr +=XEN_PT_LEVEL_SIZE (0 ) ) + { + pgtbl = mmu_desc->pgtbl_base; + +switch ( mmu_desc->num_levels ) + { +case 4 :/* Level 3 */ +HANDLE_PGTBL (3 ); +case 3 :/* Level 2 */ +HANDLE_PGTBL (2 ); +case 2 :/* Level 1 */ +HANDLE_PGTBL (1 ); +case 1 :/* Level 0 */ + { +unsigned long paddr = (page_addr - map_start) + pa_start; +unsigned int permissions =PTE_LEAF_DEFAULT ; +pte_t pte_to_be_written; + + index =pt_index (0 , page_addr); + +if (is_kernel_text (LINK_TO_LOAD (page_addr)) || +is_kernel_inittext (LINK_TO_LOAD (page_addr)) ) + permissions = +PTE_EXECUTABLE |PTE_READABLE |PTE_VALID ; + +if (is_kernel_rodata (LINK_TO_LOAD (page_addr)) )
xen/arch/riscv/include/asm/processor.h
Quoted 10 lines
xen/arch/riscv/include/asm/processor.h +10
-0+ permissions =PTE_READABLE |PTE_VALID ; + + pte_to_be_written =paddr_to_pte (paddr, permissions); + +if ( !pte_is_valid (pgtbl[index]) ) + pgtbl[index] = pte_to_be_written; +else + { +if ( (pgtbl[index].pte ^ pte_to_be_written.pte) & + ~(PTE_DIRTY |PTE_ACCESSED ) )
Nit: Style (indentation).
Jan
Re: [PATCH v7 1/5] xen/riscv: add VM space layout
In reply to Jan BeulichQuoted 17 lines · Jan Beulich
Quoted 10 lines · Oleksii Kurochko
xen/arch/riscv/include/asm/config.h +0
-0@@ -4,6 +4,42 @@ #include <xen/const.h> #include <xen/page-size.h>
+/*
+ * RISC-V64 Layout:
+ *
+ * #ifdef SV39I did point you at x86'es similar #ifdef. Unlike here, there we use a symbol which actually has a meaning, allowing to spot this comment in e.g. grep output when looking for uses of that symbol. Hence here e.g.
Quoted 6 lines
#ifdef
RV_STAGE1_MODE==SATP_MODE_SV39? (I would also recommend to use the same style as x86 does, such that
the #ifdef and #endif look like normal directives [e.g. again in grep output], leaving aside that they're inside a comment.)
It would be better. Thanks.
Quoted 41 lines
Quoted 32 lines
+ * From the riscv-privileged doc:
+ * When mapping between narrower and wider addresses,
+ * RISC-V zero-extends a narrower physical address to a wider size.
+ * The mapping between 64-bit virtual addresses and the 39-bit usable
+ * address space of Sv39 is not based on zero-extension but instead
+ * follows an entrenched convention that allows an OS to use one or
+ * a few of the most-significant bits of a full-size (64-bit) virtual
+ * address to quickly distinguish user and supervisor address regions.
+ *
+ * It means that:
+ * top VA bits are simply ignored for the purpose of translating to PA.
+ *
+ *
===================================================================
=========
+ * Start addr | End addr | Size | Slot |area description
+ *
===================================================================
=========
+ * FFFFFFFFC0800000 | FFFFFFFFFFFFFFFF |1016 MB | L2 511 | Unused
+ * FFFFFFFFC0600000 | FFFFFFFFC0800000 | 2 MB | L2 511 | FixmapQuoted 8 lines
+ * FFFFFFFFC0200000 | FFFFFFFFC0600000 | 4 MB | L2 511 | FDT
+ * FFFFFFFFC0000000 | FFFFFFFFC0200000 | 2 MB | L2 511 | Xen
+ * ... | 1 GB | L2 510 | Unused
+ * 0000003200000000 |0000007f40000000| 309 GB | L2 200-509 | Direct map
Quoted 1 line
The upper bound here is
0000007f80000000afaict,
It should be 0000007f80000000. 0000007f40000000 is start address of 509 slot.
Quoted 2 lines
which then also makes
the earlier gap 1Gb in size.
do you mean that it is better to write start and end address ( 0000007f80000000 - 7FC0000000 ) of L2 510 slot explicitly?
~ Oleksii
Re: [PATCH v7 2/5] xen/riscv: introduce setup_initial_pages
In reply to Jan BeulichQuoted 37 lines · Jan Beulich
Quoted 36 lines · Oleksii Kurochko
xen/arch/riscv/include/asm/page.h new file +7
-0@@ -0,0 +1,58 @@ +#ifndef _ASM_RISCV_PAGE_H +#define _ASM_RISCV_PAGE_H + +#include <xen/const.h> +#include <xen/types.h> + +#define VPN_MASK ((unsignedlong)(PAGETABLE_ENTRIES - 1))
xen/arch/riscv/include/asm/page.h new file +3
-0+ +#define XEN_PT_LEVEL_ORDER (lvl) ((lvl) * PAGETABLE_ORDER) +#define XEN_PT_LEVEL_SHIFT (lvl) (XEN_PT_LEVEL_ORDER(lvl) +
PAGE_SHIFT)
+#define XEN_PT_LEVEL_SIZE(lvl) (_AT(paddr_t, 1)<<XEN_PT_LEVEL_SHIFT(lvl))
+#define XEN_PT_LEVEL_MAP_MASK(lvl) (~(XEN_PT_LEVEL_SIZE(lvl) - 1))
+#define XEN_PT_LEVEL_MASK(lvl) (VPN_MASK<<XEN_PT_LEVEL_SHIFT(lvl))xen/arch/riscv/include/asm/page.h new file +12
-0+ +#define PTE_VALID BIT(0, UL) +#define PTE_READABLE BIT(1, UL) +#define PTE_WRITABLE BIT(2, UL) +#define PTE_EXECUTABLE BIT(3, UL) +#define PTE_USER BIT(4, UL) +#define PTE_GLOBAL BIT(5, UL) +#define PTE_ACCESSED BIT(6, UL) +#define PTE_DIRTY BIT(7, UL) +#define PTE_RSW (BIT(8, UL) | BIT(9, UL)) + +#define PTE_LEAF_DEFAULT (PTE_VALID | PTE_READABLE |
PTE_WRITABLE)xen/arch/riscv/include/asm/page.h new file +2
-0+#define PTE_TABLE (PTE_VALID) +
Quoted 8 lines
xen/arch/riscv/include/asm/page.h
Quoted 5 lines
xen/arch/riscv/include/asm/page.h new file +2
-0+/* Calculate the offsets into the pagetables for a given VA */ +#define pt_linear_offset (lvl, va) ((va) >>
XEN_PT_LEVEL_SHIFT(lvl))xen/arch/riscv/include/asm/page.h new file +2
-0+ +#define pt_index (lvl, va) (pt_linear_offset(lvl, (va)) & VPN_MASK)Nit: Please be consistent with parentheses. Here va doesn't need any, but if you added / kept them, then lvl should also gain them.
Sure. I'll fix that.
Quoted 11 lines
Quoted 11 lines
xen/arch/riscv/include/asm/page.h new file +10
-0+/* Page Table entry */ +typedef struct { +#ifdef CONFIG_RISCV_64 + uint64_t pte; +#else + uint32_t pte; +#endif +}pte_t ; + +static inline pte_t paddr_to_pte(paddr_t paddr,
Quoted 8 lines
Quoted 4 lines
+ unsigned int permissions) +{
+ return (pte_t) { .pte = (paddr >>PAGE_SHIFT) <<PTE_PPN_SHIFT| permissions };Please parenthesize the << against the |. I have also previously recommended to avoid open-coding of things like
PFN_DOWN()(orpaddr_to_pfn(), if you like that better) or ...
I'll change it to paddr_to_pfn. It sounds more clear than PFN_DOWN() in this context.
Thanks for reminder.
Quoted 8 lines
xen/arch/riscv/include/asm/page.h line 50
Quoted 6 lines
xen/arch/riscv/include/asm/page.h new file +5
-0+} + +static inline paddr_t pte_to_paddr (pte_t pte) +{ + return ((paddr_t)pte.pte >> PTE_PPN_SHIFT) << PAGE_SHIFT;... or
pfn_to_paddr()(which here would avoid the misplaced cast).
pfn_to_paddr() would be better here so I'll update it.
Quoted 17 lines
xen/arch/riscv/include/asm/processor.h static inline void die(void) · line 75
Quoted 11 lines
xen/arch/riscv/include/asm/processor.h +0
-0@@ -69,6 +69,11 @@ static inline void die(void) wfi(); }xen/arch/riscv/include/asm/processor.h +4
-0+static inline void sfence_vma (void ) +{ + __asm__ __volatile__ ("sfence.vma" ::: "memory"); +}Hmm, in
switch_stack_and_jump()you use "asmvolatile()" (no underscores). This is another thing which would nice if it was consistent (possibly among headers as one group, and .c files as another - there may be reasons why one wants the underscore variants in headers, but the "easier" ones in .c files).
I will remove "__" to be consistent here and in future.
Quoted 2 lines
Also nit: Style (missing blanks inside the parentheses).
THanks. Missed that.
Quoted 14 lines
Quoted 14 lines
+static void
__initsetup_initial_mapping(structmmu_desc*mmu_desc,
+ unsigned longmap_start, + unsigned longmap_end, + unsigned longpa_start)xen/arch/riscv/include/asm/processor.h +8
-0+{ + unsigned int index; + pte_t *pgtbl; + unsigned long page_addr; + + if ( (unsigned long)_start % XEN_PT_LEVEL_SIZE(0) ) + { + early_printk("(XEN) Xen should be loaded at 4k
Quoted 8 lines
Quoted 6 lines
boundary\n");
+die();
+ }
+
+ if (map_start& ~XEN_PT_LEVEL_MAP_MASK(0) || +pa_start& ~XEN_PT_LEVEL_MAP_MASK(0) )Nit: Please parenthesize the two & against the ||.
Sure. THanks.
Quoted 43 lines
Quoted 43 lines
+ {
+early_printk("(XEN) map and pa start addresses should be aligned\n");
+ /*panic(),BUG()orASSERT()aren't ready now. */ +die();
+ }xen/arch/riscv/include/asm/processor.h +18
-0+ + for ( page_addr = map_start; + page_addr < map_end; + page_addr += XEN_PT_LEVEL_SIZE(0) ) + { + pgtbl = mmu_desc->pgtbl_base; + + switch ( mmu_desc->num_levels ) + { + case 4: /* Level 3 */ + HANDLE_PGTBL(3); + case 3: /* Level 2 */ + HANDLE_PGTBL(2); + case 2: /* Level 1 */ + HANDLE_PGTBL(1); + case 1: /* Level 0 */ + { + unsigned long paddr = (page_addr - map_start) +
pa_start;
+ unsigned int permissions =PTE_LEAF_DEFAULT; +pte_tpte_to_be_written;xen/arch/riscv/include/asm/processor.h +12
-0+ + index = pt_index(0, page_addr); + + if ( is_kernel_text(LINK_TO_LOAD(page_addr)) || + is_kernel_inittext(LINK_TO_LOAD(page_addr)) ) + permissions = + PTE_EXECUTABLE | PTE_READABLE | PTE_VALID; + + if ( is_kernel_rodata(LINK_TO_LOAD(page_addr)) ) + permissions = PTE_READABLE | PTE_VALID; + + pte_to_be_written = paddr_to_pte(paddr,permissions);
+
+ if ( !pte_is_valid(pgtbl[index]) )
Quoted 8 lines
Quoted 6 lines
+ pgtbl[index] =
pte_to_be_written; + else
+ {
+ if ( (pgtbl[index].pte ^ pte_to_be_written.pte) &
+ ~(PTE_DIRTY |PTE_ACCESSED) )Nit: Style (indentation).
I'll add missed space. Thanks.
~ Oleksii
Re: [PATCH v7 1/5] xen/riscv: add VM space layout
In reply to OleksiiQuoted 22 lines · Oleksii
Quoted 21 lines · Jan Beulich
Quoted 19 lines · Oleksii Kurochko
===================================================================
=========
+ * Start addr | End addr | Size | Slot |area description
+ *
===================================================================
=========
+ * FFFFFFFFC0800000 | FFFFFFFFFFFFFFFF |1016 MB | L2 511 | Unused
+ * FFFFFFFFC0600000 | FFFFFFFFC0800000 | 2 MB | L2 511 | Fixmap
+ * FFFFFFFFC0200000 | FFFFFFFFC0600000 | 4 MB | L2 511 | FDT
+ * FFFFFFFFC0000000 | FFFFFFFFC0200000 | 2 MB | L2 511 | Xen
+ * ... | 1 GB | L2 510 | Unused
+ * 0000003200000000 |0000007f40000000| 309 GB | L2 200-509 | Direct map
Quoted 8 lines
Quoted 1 line
The upper bound here is
0000007f80000000afaict,It should be
0000007f80000000.0000007f40000000is start address of 509 slot.Quoted 2 lines
which then also makes
the earlier gap 1Gb in size.do you mean that it is better to write start and end address (
0000007f80000000- 7FC0000000 ) of L2 510 slot explicitly?
No, not really. The ... there is quite okay imo, because of the differing upper bits. I was merely pointing out that as you had it the gap was 2Gb (from 0000007f40000000 till FFFFFFFFC0000000, leaving aside the ignored upper bits).
Jan