[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/6] arm: Use secure hypervisor timer in MPU system


  • To: Harry Ramsey <harry.ramsey@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 15 Dec 2025 14:44:56 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SPLzV0a4mDRe2usJmIZFfJD9N2c/94KRAVWb9iAi4yI=; b=hSilpwngvi8dp+N8hXz+nKG/ex/KxcU/wId9QQyQiAds1SJ2VHQxN9tp/uwHwSG3VGqSX57VMH7024H6aPF0JuYAXziHc2WkG+7milJLleEGYMsT1UmF+M5OGBhpYIMnAoie3hSTDiwv2a1bgDI6NDGO52wOZcxiJAJ69RThB0KFTo3B9+6ffX5sNgVO2eX5RQtfeBzCON7UMX9pvDlVD2Q3GkKGkT1eGcL2BYgPwiYJ42c5qdHdJyImiccKqjw5m33F9CGGkPKJxUIvHgb/kQNk/nmw6/5y5UT3ZZaiEf7CgESdDvEjpBX7SZ911HuZNQbGVuym+yPAlUZYYjedCw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ji/2chMew3h7Y8Vy6FOfcCxoAfDqpHNLYKC+RFEGYIokwi1v1AeWzq5k56XKd87M0xP6BW5lgiwcPt3fVqVY7BB4n+DiMk7KDpLSos+/Jroav7gQ0GXg1LcHzKushSXZFjX0qaDTGdAwOkIEBSmZFyzcWSek2xQqEbqETf1R+TYb+Ng0JS+rkTJZPq8+QjMfc23vYLi7AxmCuKkXd8w6lbQO4qUbpZFV2FNIUOhcyaICJOEE+t+KC8whl7lm6+cXXedn/8bcBeRxvyIUBL9QqvltRyZQ6jZkXjf2NRqK4TSEBpN6uJkML6YfGQV2lzgPNnvY8MPWLER+XYXaIU89IA==
  • Cc: <Luca.Fancellu@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Chen <wei.chen@xxxxxxx>
  • Delivery-date: Mon, 15 Dec 2025 13:45:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 28/11/2025 10:58, Harry Ramsey wrote:
> From: Penny Zheng <Penny.Zheng@xxxxxxx>
> 
> As MPU systems only have one secure state, we have to use secure EL2
> hypervisor timer for Xen in secure EL2.
> 
> In this patch, we introduce a new Kconfig option ARM_SECURE_STATE
> and a set of secure hypervisor timer registers CNTHPS_*_EL2.
> We alias CNTHP_*_EL2 to CNTHPS_*_EL2 to keep the timer code
> flow unchanged.
> 
> Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
> Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
> Signed-off-by: Harry Ramsey <harry.ramsey@xxxxxxx>
> ---
>  xen/arch/arm/Kconfig                     |  5 +++++
>  xen/arch/arm/include/asm/arm64/sysregs.h | 12 ++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index cf6af68299..a5c111e08e 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -91,6 +91,7 @@ config MMU
>  
>  config MPU
>       bool "MPU" if UNSUPPORTED
> +     select ARM_SECURE_STATE if ARM_64
>       select STATIC_MEMORY
>       help
>         Memory Protection Unit (MPU). Select if you plan to run Xen on ARMv8-R
> @@ -223,6 +224,10 @@ config HARDEN_BRANCH_PREDICTOR
>  
>         If unsure, say Y.
>  
> +config ARM_SECURE_STATE
> +     bool "Xen will run in Arm Secure State"
> +     default n
No need, n is a default. I don't think this should be a selectable option.

> +
>  config ARM64_PTR_AUTH
>       def_bool n
>       depends on ARM_64
> diff --git a/xen/arch/arm/include/asm/arm64/sysregs.h 
> b/xen/arch/arm/include/asm/arm64/sysregs.h
> index 7440d495e4..29caad7155 100644
> --- a/xen/arch/arm/include/asm/arm64/sysregs.h
> +++ b/xen/arch/arm/include/asm/arm64/sysregs.h
> @@ -462,6 +462,18 @@
>  #define ZCR_ELx_LEN_SIZE             9
>  #define ZCR_ELx_LEN_MASK             0x1ff
>  
> +#ifdef CONFIG_ARM_SECURE_STATE
> +/*
> + * The Armv8-R AArch64 architecture always executes code in Secure
> + * state with EL2 as the highest Exception.
s/Exception/exception level/

> + *
> + * Hypervisor timer registers for Secure EL2.
> + */
> +#define CNTHP_TVAL_EL2  CNTHPS_TVAL_EL2
TVAL is not used in Xen, so you can drop it

> +#define CNTHP_CTL_EL2   CNTHPS_CTL_EL2
> +#define CNTHP_CVAL_EL2  CNTHPS_CVAL_EL2
EL1 will still use the NS EL1 timer (CNTP)?

> +#endif
> +
>  #define REGION_TEXT_PRBAR       0x38    /* SH=11 AP=10 XN=00 */
>  #define REGION_RO_PRBAR         0x3A    /* SH=11 AP=10 XN=10 */
>  #define REGION_DATA_PRBAR       0x32    /* SH=11 AP=00 XN=10 */

~Michal




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.