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

RE: [PATCH v5 1/9] xen/arm: smccc: add support for SMCCCv1.2 extended input/output registers


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiamei Xie <Jiamei.Xie@xxxxxxx>
  • Date: Tue, 23 Aug 2022 06:31:03 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=CkK6IIE3vSv9kfEftV9adnMM4d1GttRXHN0gg6N69KM=; b=FSBN0sFM9HkfK6FD6vWQtIQUk0Y4muAIfVhevYliNUU4bqifeV/d4exAlOr2N0sS+yIX2ZRkRASXUVBswVPkfgc+uZAum5AOPNxRmJcNxSg2nO1YbHeoI+8A30r7RKtYOq5UwDN8VxTjZjOXkLBjNYIf9VcGXOUW37GYJmTHhT0IQp3/pZUbEtFGFdo0/6g/9VprU4YXVOaijkibmWp1nwdNYd2anJxdKRBnniPt7TQPWoEwSWz3GsVWCdHURzkcd25HyKEV9j6YyJoykFKAJ26uB+fG0QUknl2GHP6pVC7lAQaw9yKdcuCycP/BrR27Ir305e7u1qAY0LLmJepzWQ==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=CkK6IIE3vSv9kfEftV9adnMM4d1GttRXHN0gg6N69KM=; b=O2hf5E4FIq9EWN7A9ewZxFy2WPFU1zdE9kJtPwJnpVMtWiJK0aljuZpHj89/NYQTfmCNeZuBIO9oMNugdqz86opM+d+lKsqL9uWVWuzVJi/nH5pvsMR5R+7yytTMb6+eF+PTtFwJyhSl2EVuf2paSagmwdSR3oQzd4Dju8bzOP2WKRkajvSC+/uzZLJN0SNuX4hBTOQr+7w+LCPNCl59vhVwFnPXJ/neSQLO907WOG3A0Oxdnumj5z6P+2gpe0DyJTTRCitmkOcZ01jrP+4Ghcij2e7LrRmaJbHDFgaH4yFF8rbGYwiMl7vtNcTQRhUlfbemKpCAg6swXBPv79Ty/g==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=O4o390VE/hB7xqYh0xgi9j3Ix/MzMtOboOK4JLDeJaP0LHAm/PeqZYrMdhPppuSW37BA9JElfujwfuojHnletQJutrNniZcbE/B459Fi6T2ErXm06mSB0nKionJR/l7KCtVwvFBW8CXM0FTAfm0EuoZLTwkfhB8yQLWOlJ1vfqGfYFauyIMftacgyoYNnPQNtPZj1tGGGMNC9ObSwUFUJhRvRmq9E4lPS5jP/5SGs2VXLg6yeOdXA7IDnlPX1zAA+4/xGMYkYFH1ndPymMxgI76/cBfBDbd1h5VVVBsFkcSHv/5T7SyYDkVgboRIIQFue33Wqm7tOQgVU5OUmm55GQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=go5+VR9YQQbrbfSQpUmla3icoQeAo7V01a097zv20s9miCjlXF4YpR1Emrle9mUFyUeTxQyNonTJEVupAyg5VkI4nFlEk2LyngF4QplNh2Hwq7La6zgMU7cSRoSL8I1cQz32Nlq44MO3mtYFlLagPeapTM1Sg98U7vAPve0hxI0iJhzdFmCbRp5TRXSZNKajrtmx52WUlkl+mqNFeos1v1oRmuAPKrRPzc1Zxu9ZMWYUzOuTCBwVMSObF35orLLue3nuNIjzeF8HO2m+m/N2h6EhfvjMbJVGSk5X8nQqqisBjIHiFP8i0jia3jtCnhm+KcynlFn6Ix5/MoiuHxmH6Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Delivery-date: Tue, 23 Aug 2022 06:31:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYsvEzozgpQMYVfkmR/IQ18gBgzq28CS1Q
  • Thread-topic: [PATCH v5 1/9] xen/arm: smccc: add support for SMCCCv1.2 extended input/output registers

Hi
I build and run it on armv8a, and start dom0 with two cpus. Cpu off and on 
tests passed. It seems it don't break current cpu basic functions.

Best wishes
Jiamei Xie


> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Jens Wiklander
> Sent: Thursday, August 18, 2022 6:56 PM
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>; Julien Grall 
> <julien@xxxxxxx>;
> Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>; Bertrand Marquis
> <Bertrand.Marquis@xxxxxxx>; Anthony PERARD
> <anthony.perard@xxxxxxxxxx>; Juergen Gross <jgross@xxxxxxxx>; Wei Liu
> <wl@xxxxxxx>; Jens Wiklander <jens.wiklander@xxxxxxxxxx>; Luca Fancellu
> <Luca.Fancellu@xxxxxxx>
> Subject: [PATCH v5 1/9] xen/arm: smccc: add support for SMCCCv1.2
> extended input/output registers
> 
> SMCCC v1.2 [1] AArch64 allows x0-x17 to be used as both parameter
> registers and result registers for the SMC and HVC instructions.
> 
> Arm Firmware Framework for Armv8-A specification makes use of x0-x7 as
> parameter and result registers.
> 
> Let us add new interface to support this extended set of input/output
> registers.
> 
> This is based on 3fdc0cb59d97 ("arm64: smccc: Add support for SMCCCv1.2
> extended input/output registers") by Sudeep Holla from the Linux kernel
> 
> The SMCCC version reported to the VM is bumped to 1.2 in order to support
> handling FF-A messages.
> 
> [1] https://developer.arm.com/documentation/den0028/c/?lang=en
> 
> Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
> Signed-off-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
> ---
>  xen/arch/arm/arm64/asm-offsets.c |  9 +++++++
>  xen/arch/arm/arm64/smc.S         | 43
> ++++++++++++++++++++++++++++++++
>  xen/arch/arm/include/asm/smccc.h | 40
> +++++++++++++++++++++++++++++
>  xen/arch/arm/vsmc.c              |  2 +-
>  4 files changed, 93 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/arm64/asm-offsets.c b/xen/arch/arm/arm64/asm-
> offsets.c
> index 280ddb55bfd4..1721e1ed26e1 100644
> --- a/xen/arch/arm/arm64/asm-offsets.c
> +++ b/xen/arch/arm/arm64/asm-offsets.c
> @@ -56,6 +56,15 @@ void __dummy__(void)
>     BLANK();
>     OFFSET(SMCCC_RES_a0, struct arm_smccc_res, a0);
>     OFFSET(SMCCC_RES_a2, struct arm_smccc_res, a2);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X0_OFFS, struct arm_smccc_1_2_regs,
> a0);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X2_OFFS, struct arm_smccc_1_2_regs,
> a2);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X4_OFFS, struct arm_smccc_1_2_regs,
> a4);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X6_OFFS, struct arm_smccc_1_2_regs,
> a6);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X8_OFFS, struct arm_smccc_1_2_regs,
> a8);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X10_OFFS, struct arm_smccc_1_2_regs,
> a10);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X12_OFFS, struct arm_smccc_1_2_regs,
> a12);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X14_OFFS, struct arm_smccc_1_2_regs,
> a14);
> +   OFFSET(ARM_SMCCC_1_2_REGS_X16_OFFS, struct arm_smccc_1_2_regs,
> a16);
>  }
> 
>  /*
> diff --git a/xen/arch/arm/arm64/smc.S b/xen/arch/arm/arm64/smc.S
> index 91bae62dd4d2..c546192e7f2d 100644
> --- a/xen/arch/arm/arm64/smc.S
> +++ b/xen/arch/arm/arm64/smc.S
> @@ -27,3 +27,46 @@ ENTRY(__arm_smccc_1_0_smc)
>          stp     x2, x3, [x4, #SMCCC_RES_a2]
>  1:
>          ret
> +
> +
> +/*
> + * void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args,
> + *                        struct arm_smccc_1_2_regs *res)
> + */
> +ENTRY(arm_smccc_1_2_smc)
> +    /* Save `res` and free a GPR that won't be clobbered */
> +    stp     x1, x19, [sp, #-16]!
> +
> +    /* Ensure `args` won't be clobbered while loading regs in next step */
> +    mov      x19, x0
> +
> +    /* Load the registers x0 - x17 from the struct arm_smccc_1_2_regs */
> +    ldp      x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]
> +    ldp      x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]
> +    ldp      x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]
> +    ldp      x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]
> +    ldp      x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]
> +    ldp      x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]
> +    ldp      x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]
> +    ldp      x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]
> +    ldp      x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]
> +
> +    smc #0
> +
> +    /* Load the `res` from the stack */
> +    ldr      x19, [sp]
> +
> +    /* Store the registers x0 - x17 into the result structure */
> +    stp      x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]
> +    stp      x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]
> +    stp      x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]
> +    stp      x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]
> +    stp      x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]
> +    stp      x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]
> +    stp      x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]
> +    stp      x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]
> +    stp      x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]
> +
> +    /* Restore original x19 */
> +    ldp     xzr, x19, [sp], #16
> +    ret
> diff --git a/xen/arch/arm/include/asm/smccc.h
> b/xen/arch/arm/include/asm/smccc.h
> index b3dbeecc90ad..b5e3f67eb34e 100644
> --- a/xen/arch/arm/include/asm/smccc.h
> +++ b/xen/arch/arm/include/asm/smccc.h
> @@ -33,6 +33,7 @@
> 
>  #define ARM_SMCCC_VERSION_1_0   SMCCC_VERSION(1, 0)
>  #define ARM_SMCCC_VERSION_1_1   SMCCC_VERSION(1, 1)
> +#define ARM_SMCCC_VERSION_1_2   SMCCC_VERSION(1, 2)
> 
>  /*
>   * This file provides common defines for ARM SMC Calling Convention as
> @@ -265,6 +266,45 @@ void __arm_smccc_1_0_smc(register_t a0,
> register_t a1, register_t a2,
>          else                                                    \
>              arm_smccc_1_0_smc(__VA_ARGS__);                     \
>      } while ( 0 )
> +
> +/**
> + * struct arm_smccc_1_2_regs - Arguments for or Results from SMC call
> + * @a0-a17 argument values from registers 0 to 17
> + */
> +struct arm_smccc_1_2_regs {
> +    unsigned long a0;
> +    unsigned long a1;
> +    unsigned long a2;
> +    unsigned long a3;
> +    unsigned long a4;
> +    unsigned long a5;
> +    unsigned long a6;
> +    unsigned long a7;
> +    unsigned long a8;
> +    unsigned long a9;
> +    unsigned long a10;
> +    unsigned long a11;
> +    unsigned long a12;
> +    unsigned long a13;
> +    unsigned long a14;
> +    unsigned long a15;
> +    unsigned long a16;
> +    unsigned long a17;
> +};
> +
> +/**
> + * arm_smccc_1_2_smc() - make SMC calls
> + * @args: arguments passed via struct arm_smccc_1_2_regs
> + * @res: result values via struct arm_smccc_1_2_regs
> + *
> + * This function is used to make SMC calls following SMC Calling Convention
> + * v1.2 or above. The content of the supplied param are copied from the
> + * structure to registers prior to the SMC instruction. The return values
> + * are updated with the content from registers on return from the SMC
> + * instruction.
> + */
> +void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args,
> +                       struct arm_smccc_1_2_regs *res);
>  #endif /* CONFIG_ARM_64 */
> 
>  #endif /* __ASSEMBLY__ */
> diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
> index 676740ef1520..6f90c08a6304 100644
> --- a/xen/arch/arm/vsmc.c
> +++ b/xen/arch/arm/vsmc.c
> @@ -93,7 +93,7 @@ static bool handle_arch(struct cpu_user_regs *regs)
>      switch ( fid )
>      {
>      case ARM_SMCCC_VERSION_FID:
> -        set_user_reg(regs, 0, ARM_SMCCC_VERSION_1_1);
> +        set_user_reg(regs, 0, ARM_SMCCC_VERSION_1_2);
>          return true;
> 
>      case ARM_SMCCC_ARCH_FEATURES_FID:
> --
> 2.31.1
> 




 


Rackspace

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