[PATCH v3 37/52] xen/mpu: implement MPU version of copy_from_paddr

2023-06-25 Thread Penny Zheng
When implementing MPU version of copy_from_paddr, if source physical address is not accessible, we shall map it temporarily with a transient MPU memory region for copying and pasting. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new patch --- xen/arch/arm/include/asm/mpu/mm.h

[PATCH v3 13/52] xen/mmu: extract mmu-specific codes from mm.c/mm.h

2023-06-25 Thread Penny Zheng
void lots of #ifdef in memory management code and header files. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- v2: - new patch --- v3: - introduce new directories: mmu/ which includes MMU-specific codes - rename init_ttbr to init_mm, mmu_init_secondary_cpu() to mm_init_seco

[PATCH v3 34/52] xen/mpu: destroy an existing entry in Xen MPU memory mapping table

2023-06-25 Thread Penny Zheng
on through PRENR_EL2 which provides direct access to the PRLAR_EL2.EN bits of EL2 MPU regions. Rignt now, we only support destroying a *WHOLE* MPU memory region, part-region removing is not supported, as in worst case, it will leave two fragments behind. Signed-off-by: Penny Zheng Signed-off-by: Wei Ch

[PATCH v3 26/52] xen/mpu: map early uart when earlyprintk on

2023-06-25 Thread Penny Zheng
to PAGE_SIZE, or we may map more than necessary in MPU system. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - map the early UART with a hardcoded MPU memory region - error when uart size doesn't align with PAGE_SIZE --- xen/arch/arm/Kconfig.debug | 7 +++ xen/arch

[PATCH v3 21/52] xen: introduce CONFIG_HAS_PAGING_MEMPOOL

2023-06-25 Thread Penny Zheng
with new Kconfig CONFIG_HAS_PAGING_MEMPOOL in common codes. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new patch --- xen/arch/arm/Kconfig| 1 + xen/arch/arm/domain.c | 2 ++ xen/arch/arm/domain_build.c | 2 ++ xen/arch/arm/p2m.c | 2 ++ xen/arch/x86

[PATCH v3 12/52] xen/mmu: extract early uart mapping from setup_fixmap

2023-06-25 Thread Penny Zheng
and new setup_fixmap. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new patch --- xen/arch/arm/arm64/head.S | 3 +++ xen/arch/arm/arm64/mmu/head.S | 24 +--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch

[PATCH v3 44/52] xen/mpu: P2M initialization in MPU system

2023-06-25 Thread Penny Zheng
hich determines VMID for the EL1-Guest-OS. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new commit --- xen/arch/arm/include/asm/mpu/mm.h | 3 ++ xen/arch/arm/include/asm/p2m.h| 5 +++ xen/arch/arm/mpu/mm.c | 22 ++ xen/arch/arm/mpu/p2m.c

[PATCH v3 41/52] xen/mpu: Use secure hypervisor timer in MPU system

2023-06-25 Thread Penny Zheng
flow unchanged. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - alias CNTHP_*_EL2 to CNTHPS_*_EL2 to avoid renaming --- xen/arch/arm/Kconfig | 4 xen/arch/arm/include/asm/arm64/sysregs.h | 15 +++ 2 files changed, 19 insertions(+) diff --git a/xen

[PATCH v3 39/52] xen/mpu: support free_init_memory in MPU system

2023-06-25 Thread Penny Zheng
modification is not supported, as in worst case, it will leave three fragments behind. In MPU system, we map init text and init data section, each with a MPU memory region. So we shall destroy it seperately in free_init_memory(). Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3

[PATCH v3 52/52] xen/arm: add Kconfig option CONFIG_HAS_MPU to enable MPU system support

2023-06-25 Thread Penny Zheng
. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - select ARCH_MAP_DOMAIN_PAGE and ARM_SECURE_STATE - remove platform-specific config: CONFIG_ARM_V8R --- xen/arch/arm/Kconfig | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/Kconfig b/xen

[PATCH v3 22/52] xen/mmu: enable SMMU subsystem only in MMU

2023-06-25 Thread Penny Zheng
SMMU subsystem is only supported in MMU system, so we make it dependent on CONFIG_HAS_MMU. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new patch --- xen/drivers/passthrough/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough

[PATCH v3 51/52] xen/mpu: create stubs of function/variables for UNSUPPORTED features

2023-06-25 Thread Penny Zheng
As we are not introduing features like SMP, SET/WAY emulation, etc, in MPU system, so we create empty stubs of function/variables and warnings for these UNSUPPORTED features. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new commit --- xen/arch/arm/arm64/mpu/head.S | 6

[PATCH v3 40/52] xen/mpu: implement remove_early_mappings in MPU system

2023-06-25 Thread Penny Zheng
virtual address to remove the mapping. As it is not workable for MPU, we pass the FDT physical address in remove_early_mappings() for MPU to destroy the mapping. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - adapt to the change of mapping FDT in two 2MB chunks if needed --- xen/arch

[PATCH v3 46/52] xen/mpu: look up entry in p2m table

2023-06-25 Thread Penny Zheng
Function p2m_lookup() is responsible for looking up an entry in p2m table. In MPU system, We check whether mapping exists. If it does, we get the details of the guest MPU memory region in domain P2M table(p2m->root) through p2m_get_mpu_region() Signed-off-by: Penny Zheng Signed-off-by: Wei C

[PATCH v3 48/52] xen/mpu: enable MMIO region trap in MPU system

2023-06-25 Thread Penny Zheng
do_mmio_trap_stage2_abort_guest(). Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new commit --- xen/arch/arm/traps.c | 81 +--- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index ef5c6a8195..bffa147c36

[PATCH v3 42/52] xen/mpu: implement setup_virt_paging for MPU system

2023-06-25 Thread Penny Zheng
EL1/EL0 and EL2 - VMSAv8-64 at EL1/EL0 and PMSAv8-64 at EL2 The default option will be the second, unless the platform could not 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 --- v3

[PATCH v3 36/52] xen/mpu: implememt ioremap_xxx in MPU

2023-06-25 Thread Penny Zheng
follow the rule of "map in demand" in MPU, we implement MPU version of ioremap_xxx, through mapping the memory with a transient MPU memory region. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - adapt to the new rule of "map in demand" --- xen/arch/arm/include/a

[PATCH v3 33/52] xen/mpu: initialize frametable in MPU system

2023-06-25 Thread Penny Zheng
frametable is successfully 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 --- v3: - add ASSERT() to conf

[PATCH v3 18/52] xen/arm: only map the init text section RW in free_init_memory

2023-06-25 Thread Penny Zheng
In free_init_memory, we do not need to map the whole init section RW, as only init text section is mapped RO in boot time. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new commit --- xen/arch/arm/mm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git

[PATCH v3 10/52] xen/arm: Move MMU related definitions from config.h to mmu/layout.h

2023-06-25 Thread Penny Zheng
with CONFIG_HAS_MPU to gate these definitions will result in a messy and hard-to-read/maintain code. So we keep some common definitions still in config.h, but move MMU related definitions to a new file - mmu/layout.h to avoid spreading "#ifdef" everywhere. Signed-off-by: Wei Chen Signed-off

[PATCH v3 07/52] xen/arm64: prepare for moving MMU related code from head.S

2023-06-25 Thread Penny Zheng
of code comments. 2. Fix the indentations for .text.header section. 3. Rename puts() to asm_puts() for global export Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- v1 -> v2: 1. New patch. --- v3: 1. fix commit message 2. Rename puts() to asm_puts() for global export --- xen/arch/

[PATCH v3 08/52] xen/arm64: move MMU related code from head.S to mmu/head.S

2023-06-25 Thread Penny Zheng
red by MMU and MPU later, we move them to macros.h. Rename enable_boot_mmu()/enable_runtime_mmu() to a more generic name enable_boot_mm()/enable_runtime_mm(), in order to make them common interfaces to be used for both MMU and later MPU system. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- v

[PATCH v3 04/52] xen/arm: add .text.idmap in ld script for Xen identity map sections

2023-06-25 Thread Penny Zheng
script, we force the .text.idmap contents to linked after .text.header. This will ensure code of head.S always be at the top of Xen binary. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- v1 -> v2: 1. New patch. --- v3: 1. adapt to changes to "_end_boot" --- xen/arch/arm/xen.l

[PATCH v3 03/52] xen/arm: add an option to define Xen start address for Armv8-R

2023-06-25 Thread Penny Zheng
we add !HAS_MPU dependency for these platforms. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- v1 -> v2: 1. Remove the platform header fvp_baser.h. 2. Remove the default start address for fvp_baser64. 3. Remove the description of default address from commit log. 4. Change HAS_

[PATCH v3 05/52] xen/arm64: head: Introduce enable_boot_mmu and enable_runtime_mmu

2023-06-25 Thread Penny Zheng
enable_boot_mmu for boot CPU and enable_runtime_mmu for secondary CPUs in this patch. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- v3: - new patch --- xen/arch/arm/arm64/head.S | 87 +++ 1 file changed, 70 insertions(+), 17 deletions(-) diff --git

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

2023-06-25 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 Signed-off-by: Penny Zheng Acked-by: Julien

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

2023-06-25 Thread Penny Zheng
-platforms/arm-ecosystem-models [4] https://lists.xenproject.org/archives/html/xen-devel/2022-11/msg00289.html [5] https://gitlab.com/xen-project/people/weic/xen/-/tree/integration/mpu_v3 [6] https://armv8r64-refstack.docs.arm.com/en/v5.0/ Penny Zheng (41): xen/arm: introduce CONFIG_HAS_MMU xen/arm: mm

[PATCH v3 02/52] xen/arm: make ARM_EFI selectable for Arm64

2023-06-25 Thread Penny Zheng
make ARM_EFI selectable for Arm64, and based on that, we can use CONFIG_ARM_EFI to gate the EFI specific code in head.S for those images that will not be booted in EFI environment. Signed-off-by: Wei Chen Signed-off-by: Penny Zheng --- v1 -> v2: 1. New patch --- v3: 1. doc fix --- xen/arch/

[PATCH v1] xen/docs: design doc for GICv4.0 vLPI support

2023-06-24 Thread Penny Zheng
This is a design doc for GICv4.0 vLPI support. Signed-off-by: Penny Zheng --- docs/designs/gicv4_vlpi.md | 333 + 1 file changed, 333 insertions(+) create mode 100644 docs/designs/gicv4_vlpi.md diff --git a/docs/designs/gicv4_vlpi.md b/docs/designs

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

2023-06-04 Thread Penny Zheng
Hi, Sorry for the late reply. Got sidetracked by other tasks... On 2023/1/19 22:20, Julien Grall wrote: Hi, On 13/01/2023 05:28, Penny Zheng wrote: From: Wei Chen Xen defines some global configuration macros for Arm in config.h. We still want to use it for Armv8-R systems

[PATCH v2 7/8] xen/p2m: put reference for superpage

2023-02-22 Thread Penny Zheng
references for foreign superpages. Signed-off-by: Penny Zheng --- v1 -> v2: - new commit --- xen/arch/arm/p2m.c | 60 +- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 948f199d84..e8fa61f

[PATCH v2 8/8] xen/docs: refine docs about static shared memory

2023-02-22 Thread Penny Zheng
em-1", not "0x1". Signed-off-by: Penny Zheng --- v1 -> v2: - no new changes --- docs/misc/arm/device-tree/booting.txt | 52 --- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-

[PATCH v2 5/8] xen/arm: support static shared memory when host address not provided

2023-02-22 Thread Penny Zheng
;shm_memnode" as function parameter to replace them all, to make codes more clear and tidy. Signed-off-by: Penny Zheng --- v1 -> v2: - combine commits 4 - 6 in Serie 1 - Adapt to changes of introducing "struct shm_memnode" --- xen/arch/arm/domain_build.c | 222 ++

[PATCH v2 6/8] xen/arm: remove shm holes for extended regions

2023-02-22 Thread Penny Zheng
use "remove_shm_from_rangeset" to remove static shm. For direct-map domain with iommu off, as static shm has already been taken care of through reserved memory banks, we do nothing. Signed-off-by: Penny Zheng --- v1 -> v2: - new commit --- xen/arch/arm/domain_build.c | 94 +++

[PATCH v2 4/8] xen/arm: use paddr_assigned to indicate whether host address is provided

2023-02-22 Thread Penny Zheng
nd clear, we extract codes about parsing "xen,shared-mem" property from function "process_shm" and move them into a new helper "parse_shm_property". Signed-off-by: Penny Zheng --- v1 -> v2 - In order to get allocated banked host memory info during domain

[PATCH v2 3/8] xen/arm: introduce allocate_domheap_memory and guest_physmap_memory

2023-02-22 Thread Penny Zheng
rs. This commit defines callback "retrieve_meminfo" for data structure "struct meminfo". Signed-off-by: Penny Zheng --- v1 -> v2: - define a set of MACRO helpers to access common fields in data structure of "meminfo" type. "struct meminfo" is one of them, and

[PATCH v2 2/8] xen/arm: re-define a set of data structures for static shared memory region

2023-02-22 Thread Penny Zheng
tructure that contains SHMID and a "struct membank membank" describing shared memory regions in guest address space, is created in "kinfo" when dealing with domain information. Signed-off-by: Penny Zheng --- v1 -> v2: - As the original "struct shm_membank" was m

[PATCH V2 0/8] Follow-up static shared memory PART I

2023-02-22 Thread Penny Zheng
/lore.kernel.org/all/20220908135513.1800511-1-penny.zh...@arm.com/ [2] https://www.kernel.org/doc/Documentation/devicetree/bindings/reserved-memory/xen%2Cshared-memory.txt Penny Zheng (8): xen/arm: remove stale addr_cells/size_cells in assign_shared_memory xen/arm: re-define a set of data s

[PATCH v2 1/8] xen/arm: remove stale addr_cells/size_cells in assign_shared_memory

2023-02-22 Thread Penny Zheng
Function parameters {addr_cells,size_cells} are stale parameters in assign_shared_memory, so we shall remove them. Signed-off-by: Penny Zheng --- v1 -> v2: - new commit --- xen/arch/arm/domain_build.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/a

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

2023-02-14 Thread Penny Zheng
> -Original Message- > From: Stewart Hildebrand > Sent: Wednesday, February 8, 2023 4:55 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Julien Grall ; Bertrand Marquis > ; Volodymyr Babchuk > > Subject: Re: [

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

2023-02-06 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Monday, February 6, 2023 6:11 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 20/40] xen/

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

2023-02-06 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Monday, February 6, 2023 5:46 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 19/40] xen/mp

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

2023-02-06 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Monday, February 6, 2023 5:32 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 1

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

2023-02-06 Thread Penny Zheng
Hi, > -Original Message- > From: Julien Grall > Sent: Monday, February 6, 2023 5:30 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 15/40] xen/arm:

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

2023-02-02 Thread Penny Zheng
Hi, Julien > -Original Message- > From: Julien Grall > Sent: Thursday, February 2, 2023 6:58 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > ayan.kumar.hal...@xilinx.com > Cc: Volodymyr Babchuk >

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

2023-02-02 Thread Penny Zheng
Hi Julien, > -Original Message- > From: Julien Grall > Sent: Thursday, February 2, 2023 2:57 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > ayan.kumar.hal...@xilinx.com > Cc: Volodymyr Babchuk >

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

2023-02-02 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Thursday, February 2, 2023 3:27 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 13/40] xen/mpu: in

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

2023-01-31 Thread Penny Zheng
Hi Julien, > -Original Message- > From: Julien Grall > Sent: Tuesday, January 31, 2023 5:28 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org; > Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > ayan.kumar.hal...@xilinx.com > Cc: Volodymyr Babchuk > S

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

2023-01-31 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Tuesday, January 31, 2023 5:42 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 13/40] xe

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

2023-01-30 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Monday, January 30, 2023 6:00 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 13/40] xe

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

2023-01-30 Thread Penny Zheng
Hi Julien > -Original Message- > From: Julien Grall > Sent: Monday, January 30, 2023 5:40 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 11/40] xen/mp

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

2023-01-29 Thread Penny Zheng
Hi, Julien > -Original Message- > From: Julien Grall > Sent: Sunday, January 29, 2023 3:43 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 13/40] xe

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

2023-01-29 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Sunday, January 29, 2023 3:37 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 11/40] xen/mpu: build

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

2023-01-28 Thread Penny Zheng
Hi Ayan > -Original Message- > From: Ayan Kumar Halder > Sent: Thursday, January 19, 2023 6:19 PM > To: xen-devel@lists.xenproject.org > Cc: Wei Chen ; Penny Zheng > ; Stefano Stabellini ; Julien > Grall ; Bertrand Marquis ; > volodymyr_babc...@epam.com > S

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

2023-01-28 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Wednesday, January 25, 2023 3:09 AM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 13/40] xen/mpu: in

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

2023-01-28 Thread Penny Zheng
> -Original Message- > From: Julien Grall > Sent: Thursday, January 19, 2023 11:04 PM > To: Penny Zheng ; xen-devel@lists.xenproject.org > Cc: Wei Chen ; Stefano Stabellini > ; Bertrand Marquis ; > Volodymyr Babchuk > Subject: Re: [PATCH v2 11/40] xen/mpu: build

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

2023-01-17 Thread Penny Zheng
Hi Julien > -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/a

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 v2 35/40] xen/mpu: destroy boot modules and early FDT mapping in MPU system

2023-01-12 Thread Penny Zheng
of 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-

[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 Chen

[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] 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

[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 v2 30/40] xen/mpu: disable VMAP sub-system for MPU systems

2023-01-12 Thread Penny Zheng
in this 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 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 33/40] xen/arm: check mapping status and attributes for MPU copy_from_paddr

2023-01-12 Thread Penny Zheng
for 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 39/40] xen/mpu: re-order xen_mpumap in arch_init_finialize

2023-01-12 Thread Penny Zheng
in 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 | 5

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

2023-01-12 Thread Penny Zheng
not 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 29/40] xen/mpu: introduce mpu_memory_section_contains for address range check

2023-01-12 Thread Penny Zheng
ugh 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: Wei Che

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

2023-01-12 Thread Penny Zheng
for 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 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 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
ration 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-by: Penny

[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 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
and 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 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

[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

[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 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 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 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 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 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 36/40] xen/mpu: Use secure hypervisor timer for AArch64v8R

2023-01-12 Thread Penny Zheng
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 | 14

[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 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 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 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

[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 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

[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

[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

[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.

[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 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 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

<    1   2   3   4   5   6   7   8   >