All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ayan Kumar Halder <ayankuma@amd.com>
To: Penny Zheng <Penny.Zheng@arm.com>, xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Wei Chen <wei.chen@arm.com>
Subject: Re: [PATCH v3 43/52] xen/mpu: configure VSTCR_EL2 in MPU system
Date: Wed, 5 Jul 2023 15:21:09 +0100	[thread overview]
Message-ID: <040d7ea3-aeaf-62ea-5561-81e283f2185c@amd.com> (raw)
In-Reply-To: <20230626033443.2943270-44-Penny.Zheng@arm.com>


On 26/06/2023 04:34, Penny Zheng wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
>
>
> VSTCR_EL2, Virtualization Secure Translation Control Register,is
> the control register for stage 2 of the Secure EL1&0 translation regime.
>
> VSTCR_EL2.SA defines secure stage 2 translation output address space.
> To make sure that all stage 2 translations for the Secure PA space
> access the Secure PA space, we keep SA bit as 0.
> VSTCR_EL2.SC is NS check enable bit.
> To make sure that Stage 2 NS configuration is checked against stage 1
> NS configuration in EL1&0 translation regime for the given address, and
> generates a fault if they are different, we set SC bit 1.
>
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
> Signed-off-by: Wei Chen <wei.chen@arm.com>
> ---
> v3:
> - new commit
> ---
>   xen/arch/arm/include/asm/arm64/sysregs.h |  6 ++++++
>   xen/arch/arm/mpu/p2m.c                   | 17 ++++++++++++++++-
>   2 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/include/asm/arm64/sysregs.h b/xen/arch/arm/include/asm/arm64/sysregs.h
> index ab0e6a97d3..35d7da411d 100644
> --- a/xen/arch/arm/include/asm/arm64/sysregs.h
> +++ b/xen/arch/arm/include/asm/arm64/sysregs.h
> @@ -512,6 +512,12 @@
>   /* MPU Protection Region Enable Register encode */
>   #define PRENR_EL2   S3_4_C6_C1_1
>
> +/* Virtualization Secure Translation Control Register */
> +#define VSTCR_EL2            S3_4_C2_C6_2
> +#define VSTCR_EL2_RES1_SHIFT 31
> +#define VSTCR_EL2_SA         ~(_AC(0x1,UL)<<30)
> +#define VSTCR_EL2_SC         (_AC(0x1,UL)<<20)
> +
>   #endif
>
>   #ifdef CONFIG_ARM_SECURE_STATE
> diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c
> index 04c44825cb..a7a3912a9a 100644
> --- a/xen/arch/arm/mpu/p2m.c
> +++ b/xen/arch/arm/mpu/p2m.c
> @@ -10,7 +10,7 @@
>
>   void __init setup_virt_paging(void)
>   {
> -    uint64_t val = 0;
> +    uint64_t val = 0, val2 = 0;
>       bool p2m_vmsa = true;
>
>       /* PA size */
> @@ -76,6 +76,21 @@ void __init setup_virt_paging(void)
>
>       WRITE_SYSREG(val, VTCR_EL2);
#ifdef CONFIG_ARM_64
>
> +    /*
> +     * VSTCR_EL2.SA defines secure stage 2 translation output address space.
> +     * To make sure that all stage 2 translations for the Secure PA space
> +     * access the Secure PA space, we keep SA bit as 0.
> +     *
> +     * VSTCR_EL2.SC is NS check enable bit.
> +     * To make sure that Stage 2 NS configuration is checked against stage 1
> +     * NS configuration in EL1&0 translation regime for the given address, and
> +     * generates a fault if they are different, we set SC bit 1.
> +     */
> +    val2 = 1 << VSTCR_EL2_RES1_SHIFT;
> +    val2 &= VSTCR_EL2_SA;
> +    val2 |= VSTCR_EL2_SC;
> +    WRITE_SYSREG(val2, VSTCR_EL2);
#endif
> +
>       return;
>
>   fault:
> --
> 2.25.1
>
>


  reply	other threads:[~2023-07-05 14:21 UTC|newest]

Thread overview: 160+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  3:33 [PATCH v3 00/52] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1 Penny Zheng
2023-06-26  3:33 ` [PATCH v3 01/52] xen/arm: remove xen_phys_start and xenheap_phys_end from config.h Penny Zheng
2023-06-26  3:33 ` [PATCH v3 02/52] xen/arm: make ARM_EFI selectable for Arm64 Penny Zheng
2023-06-28  8:05   ` Julien Grall
2023-07-05 11:20   ` [RANDCONFIG failure] " Andrew Cooper
2023-07-05 11:46     ` Julien Grall
2023-07-05 11:58       ` Julien Grall
2023-06-26  3:33 ` [PATCH v3 03/52] xen/arm: add an option to define Xen start address for Armv8-R Penny Zheng
2023-07-04 10:36   ` Ayan Kumar Halder
2023-07-04 11:47     ` Julien Grall
2023-07-04 12:02       ` Ayan Kumar Halder
2023-07-04 12:10         ` Julien Grall
2023-07-06  6:36       ` Penny Zheng
2023-07-04 19:21   ` Julien Grall
2023-07-06  6:38     ` Penny Zheng
2023-06-26  3:33 ` [PATCH v3 04/52] xen/arm: add .text.idmap in ld script for Xen identity map sections Penny Zheng
2023-07-04 19:24   ` Julien Grall
2023-06-26  3:33 ` [PATCH v3 05/52] xen/arm64: head: Introduce enable_boot_mmu and enable_runtime_mmu Penny Zheng
2023-07-04 11:07   ` Ayan Kumar Halder
2023-07-04 21:24   ` Julien Grall
2023-07-05  3:41     ` Penny Zheng
2023-06-26  3:33 ` [PATCH v3 06/52] xen/arm: introduce CONFIG_HAS_MMU Penny Zheng
2023-07-04 11:14   ` Ayan Kumar Halder
2023-07-04 11:44     ` Julien Grall
2023-07-04 12:04       ` Ayan Kumar Halder
2023-07-05  3:55         ` Penny Zheng
2023-06-26  3:33 ` [PATCH v3 07/52] xen/arm64: prepare for moving MMU related code from head.S Penny Zheng
2023-07-04 21:35   ` Julien Grall
2023-07-05  4:07     ` Penny Zheng
2023-06-26  3:33 ` [PATCH v3 08/52] xen/arm64: move MMU related code from head.S to mmu/head.S Penny Zheng
2023-07-04 11:51   ` Ayan Kumar Halder
2023-07-04 21:46   ` Julien Grall
2023-07-05  4:49     ` Penny Zheng
2023-07-05 10:11       ` Julien Grall
2023-07-05 10:43   ` Julien Grall
2023-07-06  6:47     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 09/52] xen/arm: use PA == VA for EARLY_UART_VIRTUAL_ADDRESS on MPU systems Penny Zheng
2023-07-04 19:25   ` Julien Grall
2023-07-06  7:05     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 10/52] xen/arm: Move MMU related definitions from config.h to mmu/layout.h Penny Zheng
2023-07-04 21:54   ` Julien Grall
2023-07-05  6:51     ` Penny Zheng
2023-07-05 10:30       ` Julien Grall
2023-07-06  7:36         ` Penny Zheng
2023-07-06  8:08           ` Julien Grall
2023-06-26  3:34 ` [PATCH v3 11/52] xen/arm: mmu: fold FIXMAP into MMU system Penny Zheng
2023-07-04 22:12   ` Julien Grall
2023-07-05  8:19     ` Penny Zheng
2023-07-05 10:31       ` Julien Grall
2023-07-06  8:00         ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 12/52] xen/mmu: extract early uart mapping from setup_fixmap Penny Zheng
2023-07-04 22:25   ` Julien Grall
2023-07-05  9:03     ` Penny Zheng
2023-07-05 10:35       ` Julien Grall
2023-07-06  8:01         ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 13/52] xen/mmu: extract mmu-specific codes from mm.c/mm.h Penny Zheng
2023-06-26  3:34 ` [PATCH v3 14/52] xen/mmu: move MMU-specific setup_mm to mmu/setup.c Penny Zheng
2023-06-26  3:34 ` [PATCH v3 15/52] xen: make VMAP only support in MMU system Penny Zheng
2023-06-26  6:00   ` Jan Beulich
2023-06-28  5:38     ` Penny Zheng
2023-06-28  7:59       ` Julien Grall
2023-06-28  8:41         ` Penny Zheng
2023-06-28  8:53           ` Julien Grall
2023-07-04 12:21       ` Jan Beulich
2023-06-26  3:34 ` [PATCH v3 16/52] xen/mmu: relocate copy_from_paddr into setup.c Penny Zheng
2023-06-26  3:34 ` [PATCH v3 17/52] xen/arm: do not give memory back to static heap Penny Zheng
2023-06-26  3:34 ` [PATCH v3 18/52] xen/arm: only map the init text section RW in free_init_memory Penny Zheng
2023-06-26  3:34 ` [PATCH v3 19/52] xen/arm: switch to use ioremap_xxx in common file Penny Zheng
2023-06-26  3:34 ` [PATCH v3 20/52] xen/mmu: move MMU specific P2M code to mmu/p2m.c and mmu/p2m.h Penny Zheng
2023-06-26  3:34 ` [PATCH v3 21/52] xen: introduce CONFIG_HAS_PAGING_MEMPOOL Penny Zheng
2023-06-26  7:01   ` Jan Beulich
2023-06-28  5:40     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 22/52] xen/mmu: enable SMMU subsystem only in MMU Penny Zheng
2023-06-26  3:34 ` [PATCH v3 23/52] xen/arm: create mpu/layout.h for MPU related address definitions Penny Zheng
2023-06-26  3:34 ` [PATCH v3 24/52] xen/mpu: build up start-of-day Xen MPU memory region map Penny Zheng
2023-06-28 10:55   ` Ayan Kumar Halder
2023-06-28 11:17     ` Julien Grall
2023-06-28 13:22       ` Ayan Kumar Halder
2023-06-28 13:42         ` Julien Grall
2023-06-29 11:21           ` Ayan Kumar Halder
2023-06-29 11:55             ` Julien Grall
2023-06-30  9:26               ` Ayan Kumar Halder
2023-06-30  9:43                 ` Julien Grall
2023-06-30 10:09                   ` Andrew Cooper
2023-06-26  3:34 ` [PATCH v3 25/52] xen/mpu: introduce helpers for MPU enablement Penny Zheng
2023-06-26  3:34 ` [PATCH v3 26/52] xen/mpu: map early uart when earlyprintk on Penny Zheng
2023-06-26  3:34 ` [PATCH v3 27/52] xen/mpu: introduce setup_mm_mappings Penny Zheng
2023-06-29 14:05   ` Ayan Kumar Halder
2023-06-29 14:29     ` Julien Grall
2023-06-29 14:50       ` Ayan Kumar Halder
2023-06-30  2:41         ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 28/52] xen/mpu: plump virt/maddr conversion in MPU system Penny Zheng
2023-06-29 14:20   ` Ayan Kumar Halder
2023-06-29 14:23     ` Andrew Cooper
2023-06-29 14:44       ` Ayan Kumar Halder
2023-06-29 15:14         ` Julien Grall
2023-06-30  2:40           ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 29/52] xen/mpu: introduce a pair helper read_protection_region()/write_protection_region() Penny Zheng
2023-06-26  3:34 ` [PATCH v3 30/52] xen/mpu: populate a new region in Xen MPU mapping table Penny Zheng
2023-06-28 10:05   ` Ayan Kumar Halder
2023-06-28 10:08     ` Ayan Kumar Halder
2023-06-28 10:13       ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 31/52] xen/mpu: make early_fdt_map support in MPU systems Penny Zheng
2023-06-29 17:22   ` Ayan Kumar Halder
2023-06-30  4:07     ` Penny Zheng
2023-06-30 10:49       ` Ayan Kumar Halder
2023-06-30 11:22         ` Julien Grall
2023-06-30 14:42           ` Ayan Kumar Halder
2023-06-30 15:02             ` Julien Grall
2023-07-03  5:12               ` Penny Zheng
2023-07-03  9:20                 ` Julien Grall
2023-07-13  3:12                   ` Penny Zheng
2023-07-14 16:44                     ` Julien Grall
2023-06-26  3:34 ` [PATCH v3 32/52] xen/mpu: implement MPU version of setup_mm in mpu/setup.c Penny Zheng
2023-06-26  3:34 ` [PATCH v3 33/52] xen/mpu: initialize frametable in MPU system Penny Zheng
2023-06-30 15:19   ` Ayan Kumar Halder
2023-07-03  6:10     ` Penny Zheng
2023-07-03  9:31       ` Julien Grall
2023-07-05  9:53         ` Penny Zheng
2023-07-05 13:52           ` Julien Grall
2023-07-13  7:16             ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 34/52] xen/mpu: destroy an existing entry in Xen MPU memory mapping table Penny Zheng
2023-06-30 16:17   ` Ayan Kumar Halder
2023-07-03  7:08     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 35/52] xen/arm: map static memory on demand Penny Zheng
2023-07-04 15:10   ` Ayan Kumar Halder
2023-07-05 10:16     ` Penny Zheng
2023-07-05 13:33       ` Ayan Kumar Halder
2023-07-13  5:59         ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 36/52] xen/mpu: implememt ioremap_xxx in MPU Penny Zheng
2023-07-05 14:01   ` Ayan Kumar Halder
2023-07-13  7:09     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 37/52] xen/mpu: implement MPU version of copy_from_paddr Penny Zheng
2023-06-26  3:34 ` [PATCH v3 38/52] xen/mpu: map domain page in MPU system Penny Zheng
2023-06-26  3:34 ` [PATCH v3 39/52] xen/mpu: support free_init_memory " Penny Zheng
2023-06-26  3:34 ` [PATCH v3 40/52] xen/mpu: implement remove_early_mappings " Penny Zheng
2023-06-26  3:34 ` [PATCH v3 41/52] xen/mpu: Use secure hypervisor timer " Penny Zheng
2023-06-26  3:34 ` [PATCH v3 42/52] xen/mpu: implement setup_virt_paging for " Penny Zheng
2023-07-04 17:49   ` Ayan Kumar Halder
2023-07-05 10:20     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 43/52] xen/mpu: configure VSTCR_EL2 in " Penny Zheng
2023-07-05 14:21   ` Ayan Kumar Halder [this message]
2023-07-13  7:12     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 44/52] xen/mpu: P2M initialization " Penny Zheng
2023-07-05 15:35   ` Ayan Kumar Halder
2023-07-13  7:22     ` Penny Zheng
2023-06-26  3:34 ` [PATCH v3 45/52] xen/mpu: insert an new entry into guest physmap " Penny Zheng
2023-07-05 16:27   ` Ayan Kumar Halder
2023-06-26  3:34 ` [PATCH v3 46/52] xen/mpu: look up entry in p2m table Penny Zheng
2023-06-26  3:34 ` [PATCH v3 47/52] xen/mpu: support vcpu context switch in MPU system Penny Zheng
2023-06-26  3:34 ` [PATCH v3 48/52] xen/mpu: enable MMIO region trap " Penny Zheng
2023-06-26  3:34 ` [PATCH v3 49/52] xen/mpu: enable device passthrough " Penny Zheng
2023-06-26  3:34 ` [PATCH v3 50/52] xen/mpu: dump debug message " Penny Zheng
2023-06-26  3:34 ` [PATCH v3 51/52] xen/mpu: create stubs of function/variables for UNSUPPORTED features Penny Zheng
2023-06-26  3:34 ` [PATCH v3 52/52] xen/arm: add Kconfig option CONFIG_HAS_MPU to enable MPU system support Penny Zheng
2023-07-05 17:20   ` Ayan Kumar Halder
2023-07-05 19:51     ` Julien Grall
2023-07-04 14:17 ` [PATCH v3 00/52] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1 Ayan Kumar Halder
2023-07-04 19:19 ` Julien Grall
2023-07-05 10:40 ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=040d7ea3-aeaf-62ea-5561-81e283f2185c@amd.com \
    --to=ayankuma@amd.com \
    --cc=Penny.Zheng@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.chen@arm.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.