[PATCH V4 01/10] xen/arm: introduce domain on Static Allocation

2021-07-28 Thread Penny Zheng
c-mem` feature, and also documents and parses this new attribute at boot time and stores related info in static_mem for later initialization. Signed-off-by: Penny Zheng --- docs/misc/arm/device-tree/booting.txt | 40 + xen/arch/arm/bootfdt.c

[PATCH V4 07/10] xen: re-define assign_pages and introduce assign_page

2021-07-28 Thread Penny Zheng
, such that the compiler would point out that adjustments at call sites are needed. Signed-off-by: Penny Zheng --- v4 change: - in all cases where order-0 pages get passed, prefer using assign_pages to pass literal 1 - reconstruct the order of assign_pages parameters - remove the unnecessary

[PATCH V4 05/10] xen/arm: static memory initialization

2021-07-28 Thread Penny Zheng
new CONFIG_STATIC_MEMORY to avoid bringing dead codes in other archs. Put asynchronous scrubbing for pages of static memory in TODO list. Signed-off-by: Penny Zheng --- v4 change: - move the option CONFIG_STATIC_MEMORY to common code, and with Arm "select"ing it - replace round_

[PATCH V4 09/10] xen/arm: check "xen,static-mem" property during domain construction

2021-07-28 Thread Penny Zheng
the moment. Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 37 - 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 6c86d52781..cdb16f2086 100644 --- a/xen/arch/arm/doma

[PATCH V4 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages

2021-07-28 Thread Penny Zheng
contiguous pages of static memory and assign them to one specific domain. It uses acquire_staticmem_pages to acquire nr_mfns pre-configured pages of static memory, then on success, it will use assign_pages to assign those pages to one specific domain. Signed-off-by: Penny Zheng --- v4 change

[PATCH V4 10/10] xen/arm: introduce allocate_static_memory

2021-07-28 Thread Penny Zheng
shall be firstly mapped to the fixed guest RAM address `GUEST_RAM0_BASE`. And until it exhausts the `GUEST_RAM0_SIZE`, it will seek to `GUEST_RAM1_BASE`, and so on. `GUEST_RAM0` may take up several pre-defined physical RAM regions. Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 137

[PATCH V4 04/10] xen: introduce mark_page_free

2021-07-28 Thread Penny Zheng
This commit defines a new helper mark_page_free to extract common code, like following the same cache/TLB coherency policy, between free_heap_pages and the new function free_staticmem_pages, which will be introduced later. Signed-off-by: Penny Zheng Acked-by: Jan Beulich --- xen/common

RE: [PATCH V4 01/10] xen/arm: introduce domain on Static Allocation

2021-08-15 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Wednesday, August 11, 2021 9:32 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 01/10] xen/arm: in

RE: [PATCH V4 02/10] xen/arm: introduce new helper device_tree_get_meminfo

2021-08-15 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Wednesday, August 11, 2021 9:35 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 02/10] xen/a

RE: [PATCH V4 03/10] xen/arm: handle static memory in dt_unreserved_regions

2021-08-15 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Wednesday, August 11, 2021 9:48 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 03/10] xen/arm:

RE: [PATCH V4 05/10] xen/arm: static memory initialization

2021-08-15 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Friday, August 13, 2021 8:21 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 05/10] xen/arm: static memor

RE: [PATCH V4 06/10] xen/arm: introduce PGC_reserved

2021-08-15 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Friday, August 13, 2021 8:22 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 06/10] xen/arm: introduce PG

RE: [PATCH V4 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages

2021-08-15 Thread Penny Zheng
Hi Julien, > -Original Message- > From: Julien Grall > Sent: Friday, August 13, 2021 9:00 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 08/10] xen/arm: introduce

RE: [PATCH V4 09/10] xen/arm: check "xen,static-mem" property during domain construction

2021-08-15 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Friday, August 13, 2021 9:12 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 09/10] xen/arm: check &

RE: [PATCH V4 10/10] xen/arm: introduce allocate_static_memory

2021-08-16 Thread Penny Zheng
Hi julien > -Original Message- > From: Julien Grall > Sent: Friday, August 13, 2021 9:37 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 10/10] xen/arm: introduc

RE: [PATCH V4 01/10] xen/arm: introduce domain on Static Allocation

2021-08-16 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, August 17, 2021 1:28 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 01/10] xen/arm: in

RE: [PATCH V4 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages

2021-08-16 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Tuesday, August 17, 2021 1:44 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 08/10] xen/arm: introduce acqui

RE: [PATCH V4 10/10] xen/arm: introduce allocate_static_memory

2021-08-16 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Tuesday, August 17, 2021 1:55 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 10/10] xen/arm: introduc

RE: [PATCH V4 07/10] xen: re-define assign_pages and introduce assign_page

2021-08-17 Thread Penny Zheng
Hi Julian and Jan > -Original Message- > From: Julien Grall > Sent: Friday, August 13, 2021 8:27 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH V4 07/10] xen: re

[PATCH v5 2/7] xen/arm: introduce domain on Static Allocation

2021-08-24 Thread Penny Zheng
ole hardware resource, or bind to one specific xen domain node, through "xen,static-mem" Signed-off-by: Penny Zheng --- v5 changes: - check the node using the Xen domain binding whether contains the property "xen,static-mem", not the property itself - add "rc = ..."

[PATCH v5 1/7] xen/arm: introduce new helper device_tree_get_meminfo

2021-08-24 Thread Penny Zheng
A few functions iterate over the device tree property to get memory info, like "reg" or the later "xen,static-mem", so this commit creates a new helper device_tree_get_meminfo to extract the common codes. Signed-off-by: Penny Zheng --- xen/arc

[PATCH v5 0/7] Domain on Static Allocation

2021-08-24 Thread Penny Zheng
2m_insert_mapping() and introduce guest_physmap_add_pages to cope with adding guest RAM p2m mapping with nr_pages. - check both pbase and psize are page aligned - simplify the code in the loops by moving append_static_memory_to_bank() outside of the if/else. --- TODO: - reboot domain on static alloc

[PATCH v5 3/7] xen: introduce mark_page_free

2021-08-24 Thread Penny Zheng
be potentially non-trivial. As the function is internal, pass the MFN and the page. They are both expected to match. Signed-off-by: Penny Zheng Acked-by: Jan Beulich Reviewed-by: Julien Grall --- xen/common/page_alloc.c | 89 ++--- 1 file changed, 48

[PATCH v5 6/7] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages

2021-08-24 Thread Penny Zheng
introduces a new page flag PGC_reserved, then mark pages of static memory PGC_reserved when initializing them. Signed-off-by: Penny Zheng --- v5 changes - bundle all the functions for static allocation in a single place - return an error and revert the changes, when the page is not free and reserved

[PATCH v5 4/7] xen/arm: static memory initialization

2021-08-24 Thread Penny Zheng
new CONFIG_STATIC_MEMORY to wrap all static-allocation-related codes. Put asynchronous scrubbing for pages of static memory in TODO list. Signed-off-by: Penny Zheng --- v5 change: - make CONFIG_STATIC_MEMORY user selectable and gated by UNSUPPORTED. - wrap all static-allocation-related codes

[PATCH v5 5/7] xen: re-define assign_pages and introduce assign_page

2021-08-24 Thread Penny Zheng
In order to deal with the trouble of count-to-order conversion when page number is not in a power-of-two, this commit re-define assign_pages for nr pages and assign_page for original page with a single order. Signed-off-by: Penny Zheng Acked-by: Jan Beulich --- v5 change: - Having both

[PATCH v5 7/7] xen/arm: introduce allocate_static_memory

2021-08-24 Thread Penny Zheng
function guest_physmap_add_pages to cope with adding guest RAM p2m mapping with nr_pages. Signed-off-by: Penny Zheng --- v5 changes: - don't split comment over multi-line (even they are more than 80 characters) - simply use dt_find_property(node, "xen,static-mem", NULL) to tel

RE: [PATCH v1 01/13] xen/arm: re-arrange the static shared memory region

2023-01-08 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Sunday, January 8, 2023 7:44 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v1 01/13] xen/arm: re-a

RE: [PATCH v1 06/13] xen/arm: assign shared memory to owner when host address not provided

2023-01-08 Thread Penny Zheng
Hi Julien Happy new year > -Original Message- > From: Julien Grall > Sent: Sunday, January 8, 2023 8:53 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re:

RE: [PATCH v1 05/13] xen/arm: allocate shared memory from heap when host address not provided

2023-01-08 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Sunday, January 8, 2023 8:23 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v1 05/13] xen/arm: allocate

RE: [PATCH v1 06/13] xen/arm: assign shared memory to owner when host address not provided

2023-01-09 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Monday, January 9, 2023 6:58 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v1 06/13] xen/arm: assig

RE: [PATCH v1 06/13] xen/arm: assign shared memory to owner when host address not provided

2023-01-09 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Tuesday, January 10, 2023 2:23 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v1 06/13] xen/arm: assig

[PATCH v2 02/40] xen/arm: make ARM_EFI selectable for Arm64

2023-01-12 Thread Penny Zheng
From: Wei Chen Currently, ARM_EFI will mandatorily selected by Arm64. Even if the user knows for sure that their images will not start in the EFI environment, they can't disable the EFI support for Arm64. This means there will be about 3K lines unused code in their images. So in this patch, we m

[PATCH v2 01/40] xen/arm: remove xen_phys_start and xenheap_phys_end from config.h

2023-01-12 Thread Penny Zheng
From: Wei Chen These two variables are stale variables, they only have declarations in config.h, they don't have any definition and no any code is using these two variables. So in this patch, we remove them from config.h. Signed-off-by: Wei Chen Acked-by: Julien Grall --- v1 -> v2: 1. Add Ab.

[PATCH v2 03/40] xen/arm: adjust Xen TLB helpers for Armv8-R64 PMSA

2023-01-12 Thread Penny Zheng
From: Wei Chen >From Arm ARM Supplement of Armv8-R AArch64 (DDI 0600A) [1], section D1.6.2 TLB maintenance instructions, we know that Armv8-R AArch64 permits an implementation to cache stage 1 VMSAv8-64 and stage 2 PMSAv8-64 attributes as a common entry for the Secure EL1&0 translation regime. Bu

[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1

2023-01-12 Thread Penny Zheng
ocs.arm.com/en/v5.0/ Penny Zheng (28): xen/mpu: build up start-of-day Xen MPU memory region map xen/mpu: introduce helpers for MPU enablement xen/mpu: introduce unified function setup_early_uart to map early UART xen/arm64: head: Jump to the runtime mapping in enable_mm() xen/

[PATCH v2 04/40] xen/arm: add an option to define Xen start address for Armv8-R

2023-01-12 Thread Penny Zheng
From: Wei Chen On Armv8-A, Xen has a fixed virtual start address (link address too) for all Armv8-A platforms. In an MMU based system, Xen can map its loaded address to this virtual start address. So, on Armv8-A platforms, the Xen start address does not need to be configurable. But on Armv8-R pla

[PATCH v2 05/40] xen/arm64: prepare for moving MMU related code from head.S

2023-01-12 Thread Penny Zheng
From: Wei Chen We want to reuse head.S for MPU systems, but there are some code implemented for MMU systems only. We will move such code to another MMU specific file. But before that, we will do some preparations in this patch to make them easier for reviewing: 1. Fix the indentations of code com

[PATCH v2 06/40] xen/arm64: move MMU related code from head.S to head_mmu.S

2023-01-12 Thread Penny Zheng
From: Wei Chen There are lots of MMU specific code in head.S. This code will not be used in MPU systems. If we use #ifdef to gate them, the code will become messy and hard to maintain. So we move MMU related code to head_mmu.S, and keep common code still in head.S. And some assembly macros that

[PATCH v2 07/40] xen/arm64: add .text.idmap for Xen identity map sections

2023-01-12 Thread Penny Zheng
From: Wei Chen Only the first 4KB of Xen image will be mapped as identity (PA == VA). At the moment, Xen guarantees this by having everything that needs to be used in the identity mapping in head.S before _end_boot and checking at link time if this fits in 4KB. In previous patch, we have moved t

[PATCH v2 08/40] xen/arm: use PA == VA for EARLY_UART_VIRTUAL_ADDRESS on Armv-8R

2023-01-12 Thread Penny Zheng
From: Wei Chen There is no VMSA support on Armv8-R AArch64, so we can not map early UART to FIXMAP_CONSOLE. Instead, we use PA == VA to define EARLY_UART_VIRTUAL_ADDRESS on Armv8-R AArch64. Signed-off-by: Wei Chen --- 1. New patch --- xen/arch/arm/include/asm/early_printk.h | 12

[PATCH v2 09/40] xen/arm: decouple copy_from_paddr with FIXMAP

2023-01-12 Thread Penny Zheng
From: Wei Chen copy_from_paddr will map a page to Xen's FIXMAP_MISC area for temporary access. But for those systems do not support VMSA, they can not implement set_fixmap/clear_fixmap, that means they can't always use the same virtual address for source address. In this case, we introduce to he

[PATCH v2 11/40] xen/mpu: build up start-of-day Xen MPU memory region map

2023-01-12 Thread Penny Zheng
From: Penny Zheng The start-of-day Xen MPU memory region layout shall be like as follows: xen_mpumap[0] : Xen text xen_mpumap[1] : Xen read-only data xen_mpumap[2] : Xen read-only after init data xen_mpumap[3] : Xen read-write data xen_mpumap[4] : Xen BSS .. xen_mpumap[max_xen_mpumap - 2

[PATCH v2 16/40] xen/arm: introduce setup_mm_mappings

2023-01-12 Thread Penny Zheng
generic name, is introduced and act as an empty stub in MPU system. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/mm.h | 2 ++ xen/arch/arm/include/asm/mm_mpu.h | 16 xen/arch/arm/setup.c | 2 +- 3 files changed, 19 insertions

[PATCH v2 36/40] xen/mpu: Use secure hypervisor timer for AArch64v8R

2023-01-12 Thread Penny Zheng
timer code flow unchanged. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/Kconfig | 7 +++ xen/arch/arm/include/asm/arm64/sysregs.h | 21 - xen/arch/arm/include/asm/cpregs.h| 4 ++-- xen/arch/arm/time.c

[PATCH v2 20/40] xen/mpu: plump early_fdt_map in MPU systems

2023-01-12 Thread Penny Zheng
add . = ALIGN(PAGE_SIZE); in the head of dtb section to make it happen. In this commit, we map early FDT with a transient MPU memory region at rear with REGION_HYPERVISOR_BOOT. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/arm64/mpu.h | 5 +++ xen/arch/arm

[PATCH v2 17/40] xen/mpu: plump virt/maddr/mfn convertion in MPU system

2023-01-12 Thread Penny Zheng
address as the output. We should overide virt_to_mfn/mfn_to_virt in source file mm_mpu.c the same way in mm_mmu.c. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/mm.h | 26 -- xen/arch/arm/include/asm/mm_mmu.h | 26

[PATCH v2 40/40] xen/mpu: add Kconfig option to enable Armv8-R AArch64 support

2023-01-12 Thread Penny Zheng
Introduce a Kconfig option to enable Armv8-R64 architecture support. STATIC_MEMORY and HAS_MPU will be selected by ARM_V8R by default, because Armv8-R64 only has PMSAv8-64 on secure-EL2 and only supports statically configured system. Signed-off-by: Wei Chen --- xen/arch/arm/Kconfig | 13

[PATCH v2 15/40] xen/arm: move MMU-specific memory management code to mm_mmu.c/mm_mmu.h

2023-01-12 Thread Penny Zheng
in memory management code and header files. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- xen/arch/arm/Makefile |5 + xen/arch/arm/include/asm/mm.h | 19 +- xen/arch/arm/include/asm/mm_mmu.h | 35 + xen/arch/arm/mm.c | 1352

[PATCH v2 27/40] xen/mpu: map device memory resource in MPU system

2023-01-12 Thread Penny Zheng
, to avoid MPU memory region overlapping. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/arm64/mpu.h | 6 -- xen/arch/arm/include/asm/setup.h | 1 + xen/arch/arm/mm_mpu.c| 14 +- xen/arch/arm/setup_mpu.c | 5

[PATCH v2 22/40] xen/mpu: implement MPU version of setup_mm in setup_mpu.c

2023-01-12 Thread Penny Zheng
the other static memory section mapping will be introduced later. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/Makefile | 2 + xen/arch/arm/include/asm/mm_mpu.h | 5 +++ xen/arch/arm/mm_mpu.c | 41 ++ xen/arch/arm/setup_mpu.c

[PATCH v2 37/40] xen/mpu: move MMU specific P2M code to p2m_mmu.c

2023-01-12 Thread Penny Zheng
also move MMU-specific definitions to p2m_mmu.h, like P2M_ROOT_LEVEL and function p2m_tlb_flush_sync. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/Makefile |5 + xen/arch/arm/include/asm/p2m.h | 17 +- xen/arch/arm/include/asm/p2m_mmu.h | 28 + xen

[PATCH v2 32/40] xen/mpu: implement MPU version of ioremap_xxx

2023-01-12 Thread Penny Zheng
here we only add a check to verify this assumption. But for tolerating a few cases where the function is called to map for temporary copy and paste, like ioremap_wc in kernel image loading, the region attribute mismatch will be treated as warning than error. Signed-off-by: Penny Zheng Signed-off-by

[PATCH v2 10/40] xen/arm: split MMU and MPU config files from config.h

2023-01-12 Thread Penny Zheng
From: Wei Chen Xen defines some global configuration macros for Arm in config.h. We still want to use it for Armv8-R systems, but there are some address related macros that are defined for MMU systems. These macros will not be used by MPU systems, Adding ifdefery with CONFIG_HAS_MPU to gate these

[PATCH v2 34/40] xen/mpu: free init memory in MPU system

2023-01-12 Thread Penny Zheng
modify_xen_mappings is introduced to modify permission of the existing valid MPU memory region. Then we nuke the instruction cache to remove entries related to init text. At last, we destroy these two MPU memory regions referring init text and init data using destroy_xen_mappings. Signed-off-by: Penny Zheng Signed

[PATCH v2 19/40] xen/mpu: populate a new region in Xen MPU mapping table

2023-01-12 Thread Penny Zheng
permission for common combinations. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/arm64/mpu.h | 72 +++ xen/arch/arm/mm_mpu.c| 276 ++- 2 files changed, 340 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm

[PATCH v2 13/40] xen/mpu: introduce unified function setup_early_uart to map early UART

2023-01-12 Thread Penny Zheng
In MMU system, we map the UART in the fixmap (when earlyprintk is used). However in MPU system, we map the UART with a transient MPU memory region. So we introduce a new unified function setup_early_uart to replace the previous setup_fixmap. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen

[PATCH v2 23/40] xen/mpu: initialize frametable in MPU system

2023-01-12 Thread Penny Zheng
ccessfully initialized, the convertion between machine frame number/machine address/"virtual address" and page-info structure is ready too, like mfn_to_page/maddr_to_page/virt_to_page, etc Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/mm.h | 15 -

[PATCH v2 14/40] xen/arm64: head: Jump to the runtime mapping in enable_mm()

2023-01-12 Thread Penny Zheng
also avoid creating empty function for MPU system, trying to keep only one codeflow in arm64/head.S, we move path switch and remove_identity_mapping() in enable_mm() on MMU system. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/arm64/head.S | 28

[PATCH v2 18/40] xen/mpu: introduce helper access_protection_region

2023-01-12 Thread Penny Zheng
configuration is accessible through PRBAR0_EL2 and PRLAR0_EL2 - Region 17 configuration is accessible through PRBAR1_EL2 and PRLAR1_EL2 - Region 18 configuration is accessible through PRBAR2_EL2 and PRLAR2_EL2 - ... - Region 31 configuration is accessible through PRBAR15_EL2 and PRLAR15_EL2 Signed-off

[PATCH v2 26/40] xen/mpu: destroy an existing entry in Xen MPU memory mapping table

2023-01-12 Thread Penny Zheng
on through PRENR_EL2 which provides direct access to the PRLAR_EL2.EN bits of EL2 MPU regions. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/arm64/mpu.h | 20 ++ xen/arch/arm/include/asm/arm64/sysregs.h | 3 + xen/arch/arm/mm_mpu.c

[PATCH v2 31/40] xen/mpu: disable FIXMAP in MPU system

2023-01-12 Thread Penny Zheng
MPU system Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/Kconfig | 3 ++- xen/arch/arm/include/asm/fixmap.h | 28 +--- xen/common/Kconfig| 3 +++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/xen/arch

[PATCH v2 29/40] xen/mpu: introduce mpu_memory_section_contains for address range check

2023-01-12 Thread Penny Zheng
sthrough module(BOOTMOD_GUEST_DTB), and ramdisk module(BOOTMOD_RAMDISK). We also shall check if any guest RAM through "xen,static-mem" is within the guest memory section. Function mpu_memory_section_contains is introduced to do above check. Signed-off-by: Penny Zheng Signed-off-by: We

[PATCH v2 39/40] xen/mpu: re-order xen_mpumap in arch_init_finialize

2023-01-12 Thread Penny Zheng
n the front, and switching ones in the heels of them. We define a MPU memory region mapping table(sw_mpumap) to store all switching regions. After disabling them at its original position, we re-enable them at re-ordering position. Signed-off-by: Penny Zheng --- xen/arch/arm/include/asm/arm64/mpu.h

[PATCH v2 38/40] xen/mpu: implement setup_virt_paging for MPU system

2023-01-12 Thread Penny Zheng
support, which could be checked against MSA_frac bit in Memory Model Feature Register 0( ID_AA64MMFR0_EL1) Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/arm64/sysregs.h | 6 ++ xen/arch/arm/include/asm/cpufeature.h| 7 ++ xen/arch/arm/include/asm/p2m.h

[PATCH v2 33/40] xen/arm: check mapping status and attributes for MPU copy_from_paddr

2023-01-12 Thread Penny Zheng
copy_from_paddr in MPU system, we need to check whether a given paddr is properly mapped. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mm_mpu.c | 21 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/xen/arch

[PATCH v2 21/40] xen/arm: move MMU-specific setup_mm to setup_mmu.c

2023-01-12 Thread Penny Zheng
xenheap, and some components could not be applied in MPU system, like direct-mapping. In the commit, we move setup_mm and its related functions and variables to setup_mmu.c in preparation of implementing MPU version of setup_mm later in future commits Signed-off-by: Penny Zheng Signed-off-by: Wei Chen

[PATCH v2 30/40] xen/mpu: disable VMAP sub-system for MPU systems

2023-01-12 Thread Penny Zheng
patch, we disable VMAP for MPU systems, and some features depending on VMAP also need to be disabled at the same time, Like ALTERNATIVE, CPU ERRATA. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/Kconfig | 3 +- xen/arch/arm/Makefile | 2

[PATCH v2 12/40] xen/mpu: introduce helpers for MPU enablement

2023-01-12 Thread Penny Zheng
the default memory map of the Armv8-R AArch64 architecture is IMPLEMENTATION DEFINED, we always turn off the Background region. In this patch, we also introduce a neutral name enable_mm for Xen to enable MMU/MPU. This can help us to keep one code flow in head.S Signed-off-by: Penny Zheng Signed

[PATCH] xen/mpu: make Xen boot to idle on MPU systems(DNM)

2023-01-12 Thread Penny Zheng
From: Wei Chen As we have not implmented guest support in part#1 series of MPU support, Xen can not create any guest in boot time. So in this patch we make Xen boot to idle on MPU system for reviewer to test part#1 series. THIS PATCH IS ONLY FOR TESTING, NOT FOR REVIEWING. Signed-off-by: Wei Ch

[PATCH v2 25/40] xen/mpu: map MPU guest memory section before static memory initialization

2023-01-12 Thread Penny Zheng
idle vcpu entering. We introduce a bit in region "region.prlar.sw"(struct pr_t region) to indicate this kind of feature. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/include/asm/arm64/mpu.h | 14 ++--- xen/arch/arm/mm_mpu.c| 47 +++

[PATCH v2 28/40] xen/mpu: map boot module section in MPU system

2023-01-12 Thread Penny Zheng
guests' boot mudules. Users shall make sure that any guest boot module defined in Device Tree is within the section, including kernel module(BOOTMOD_KERNEL), device tree passthrough module(BOOTMOD_GUEST_DTB), and ramdisk module(BOOTMOD_RAMDISK). Signed-off-by: Penny Zheng Signed-off-by: Wei

[PATCH v2 35/40] xen/mpu: destroy boot modules and early FDT mapping in MPU system

2023-01-12 Thread Penny Zheng
remove_early_mappings, we destroy MPU memory region of early FDT mapping. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- xen/arch/arm/mm_mpu.c| 4 xen/arch/arm/setup.c | 25 - xen/arch/arm/setup_mmu.c | 25 + xen/arch/arm

[PATCH v2 24/40] xen/mpu: introduce "mpu,xxx-memory-section"

2023-01-12 Thread Penny Zheng
lso introduces "#mpu,guest-memory-section" as an example, for limiting the scattering of static memory as guest RAM. Guest RAM shall be not only statically configured through "xen,static-mem" property in MPU system, but also shall be defined inside outside "mpu,guest-memory-

RE: [PATCH v2 01/40] xen/arm: remove xen_phys_start and xenheap_phys_end from config.h

2023-01-13 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Friday, January 13, 2023 6:07 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk ; Julien Grall > > Subject: Re: [PATC

[PATCH] Xen: Design doc for 1:1 direct-map and static allocation

2021-05-17 Thread Penny Zheng
Create one design doc for 1:1 direct-map and static allocation. It is the first draft and aims to describe why and how we allocate 1:1 direct-map(guest physical == physical) domains, and why and how we let domains on static allocation. Signed-off-by: Penny Zheng --- docs/designs

[PATCH 04/10] xen/arm: static memory initialization

2021-05-17 Thread Penny Zheng
the page in need Signed-off-by: Penny Zheng --- xen/arch/arm/setup.c| 2 ++ xen/common/page_alloc.c | 70 + xen/include/xen/mm.h| 3 ++ 3 files changed, 75 insertions(+) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 444dbbd676

[PATCH 00/10] Domain on Static Allocation

2021-05-17 Thread Penny Zheng
Other features will be delievered through different patch series. Penny Zheng (10): xen/arm: introduce domain on Static Allocation xen/arm: handle static memory in dt_unreserved_regions xen/arm: introduce PGC_reserved xen/arm: static memory initialization xen/arm: introduce alloc_staticmem_

[PATCH 03/10] xen/arm: introduce PGC_reserved

2021-05-17 Thread Penny Zheng
page_get_reserved_owner and page_set_reserved_owner are designated to get/set reserved page's owner. Struct domain is enlarged to more than PAGE_SIZE, due to newly-imported struct reserved in struct page_info. Signed-off-by: Penny Zheng --- xen/include/asm-arm/mm.h | 16 +++- 1 file change

[PATCH 01/10] xen/arm: introduce domain on Static Allocation

2021-05-17 Thread Penny Zheng
c-mem` property to define static memory nodes in device tree file. This patch also documents and parses this new attribute at boot time and stores related info in static_mem for later initialization. Signed-off-by: Penny Zheng --- docs/misc/arm/device-tree/booting.txt | 33 + xen/arc

[PATCH 05/10] xen/arm: introduce alloc_staticmem_pages

2021-05-17 Thread Penny Zheng
free. It shall also do a set of necessary initialization, which are mostly the same ones in alloc_heap_pages, like, following the same cache-coherency policy and turning page status into PGC_state_used, etc. Signed-off-by: Penny Zheng --- xen/common/page_alloc.c | 64

[PATCH 02/10] xen/arm: handle static memory in dt_unreserved_regions

2021-05-17 Thread Penny Zheng
static memory regions overlap with memory nodes. The overlapping memory is reserved-memory and should be handled accordingly: dt_unreserved_regions should skip these regions the same way they are already skipping mem-reserved regions. Signed-off-by: Penny Zheng --- xen/arch/arm/setup.c | 39

[PATCH 06/10] xen: replace order with nr_pfns in assign_pages for better compatibility

2021-05-17 Thread Penny Zheng
Function parameter order in assign_pages is always used as 1ul << order, referring to 2@order pages. Now, for better compatibility with new static memory, order shall be replaced with nr_pfns pointing to page count with no constraint, like 250MB. Signed-off-by: Penny Zheng --- xen/arch/

[PATCH 07/10] xen/arm: intruduce alloc_domstatic_pages

2021-05-17 Thread Penny Zheng
those pages to one specific domain, including using page_set_reserved_owner to set its reserved domain owner. Signed-off-by: Penny Zheng --- xen/common/page_alloc.c | 53 + xen/include/xen/mm.h| 4 2 files changed, 57 insertions(+) diff --git a

[PATCH 08/10] xen/arm: introduce reserved_page_list

2021-05-17 Thread Penny Zheng
st to link pages of static memory. Let page_to_list return reserved_page_list, when flag is PGC_reserved. Later, when domain get destroyed or restarted, those new values will help relinquish memory to proper place, not been given back to heap. Signed-off-by: Penny Zheng --- xen/common/domain

[PATCH 09/10] xen/arm: parse `xen,static-mem` info during domain construction

2021-05-17 Thread Penny Zheng
allocate_static_memory is missing, and will be introduced later. It just BUG() out at the moment. Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 58 xen/include/asm-arm/domain.h | 3 ++ 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm

[PATCH 10/10] xen/arm: introduce allocate_static_memory

2021-05-17 Thread Penny Zheng
GUEST_RAM0_BASE, GUEST_RAM1_BASE. Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 157 +++- 1 file changed, 155 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 30b55588b7..9f662313ad 100644 --- a/xen

RE: [PATCH 08/10] xen/arm: introduce reserved_page_list

2021-05-18 Thread Penny Zheng
Hi Jan > -Original Message- > From: Jan Beulich > Sent: Tuesday, May 18, 2021 3:39 PM > To: Penny Zheng > Cc: Bertrand Marquis ; Wei Chen > ; nd ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org; jul...@xen.org > Subject: Re: [PATCH 08/10] xen/arm: intr

RE: [PATCH 07/10] xen/arm: intruduce alloc_domstatic_pages

2021-05-18 Thread Penny Zheng
Hi Jan > -Original Message- > From: Jan Beulich > Sent: Tuesday, May 18, 2021 3:35 PM > To: Penny Zheng > Cc: Bertrand Marquis ; Wei Chen > ; nd ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org; jul...@xen.org > Subject: Re: [PATCH 0

RE: [PATCH 06/10] xen: replace order with nr_pfns in assign_pages for better compatibility

2021-05-18 Thread Penny Zheng
Hi Jan > -Original Message- > From: Jan Beulich > Sent: Tuesday, May 18, 2021 3:28 PM > To: Penny Zheng > Cc: Bertrand Marquis ; Wei Chen > ; nd ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org; jul...@xen.org > Subject: Re: [PATCH 06/10] xen: repla

RE: [PATCH 05/10] xen/arm: introduce alloc_staticmem_pages

2021-05-18 Thread Penny Zheng
Hi Jan > -Original Message- > From: Jan Beulich > Sent: Tuesday, May 18, 2021 3:24 PM > To: Penny Zheng > Cc: Bertrand Marquis ; Wei Chen > ; nd ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org; jul...@xen.org > Subject: Re: [PATCH 0

RE: [PATCH 04/10] xen/arm: static memory initialization

2021-05-18 Thread Penny Zheng
Hi Jan > -Original Message- > From: Jan Beulich > Sent: Tuesday, May 18, 2021 3:16 PM > To: Penny Zheng > Cc: Bertrand Marquis ; Wei Chen > ; nd ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org; jul...@xen.org > Subject: Re: [PATCH 04/10] xen/arm: stat

RE: [PATCH 01/10] xen/arm: introduce domain on Static Allocation

2021-05-18 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, May 18, 2021 4:58 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH 01/10] xen/arm: introduce dom

RE: [PATCH 03/10] xen/arm: introduce PGC_reserved

2021-05-18 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, May 18, 2021 5:46 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH 03/10] xen/arm: introduce PGC_r

RE: [PATCH 04/10] xen/arm: static memory initialization

2021-05-18 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, May 18, 2021 6:01 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH 04/10] xen/arm: static memor

RE: [PATCH 05/10] xen/arm: introduce alloc_staticmem_pages

2021-05-18 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, May 18, 2021 6:15 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH 05/10] xen/arm: introduce alloc

RE: [PATCH 06/10] xen: replace order with nr_pfns in assign_pages for better compatibility

2021-05-18 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, May 18, 2021 6:21 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH 06/10] xen: replace order with

RE: [PATCH 07/10] xen/arm: intruduce alloc_domstatic_pages

2021-05-18 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, May 18, 2021 6:30 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH 07/10] xen/arm: intruduce alloc

RE: [PATCH 08/10] xen/arm: introduce reserved_page_list

2021-05-18 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, May 18, 2021 7:02 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org > Cc: Bertrand Marquis ; Wei Chen > ; nd > Subject: Re: [PATCH 08/10] xen/arm: introduce re

RE: [PATCH 08/10] xen/arm: introduce reserved_page_list

2021-05-18 Thread Penny Zheng
Hi Jan > -Original Message- > From: Jan Beulich > Sent: Tuesday, May 18, 2021 7:25 PM > To: Penny Zheng > Cc: Bertrand Marquis ; Wei Chen > ; nd ; xen-devel@lists.xenproject.org; > sstabell...@kernel.org; jul...@xen.org > Subject: Re: [PATCH 08/10] xen/arm: intr

<    1   2   3   4   5   6   7   8   9   10   >