qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v9 11/11] hvf: arm: Adhere to SMCCC 1.3 section 5.2


From: Peter Maydell
Subject: Re: [PATCH v9 11/11] hvf: arm: Adhere to SMCCC 1.3 section 5.2
Date: Mon, 13 Sep 2021 09:52:20 +0100

On Mon, 13 Sept 2021 at 00:08, Alexander Graf <agraf@csgraf.de> wrote:
>
> The SMCCC 1.3 spec section 5.2 says
>
>   The Unknown SMC Function Identifier is a sign-extended value of (-1)
>   that is returned in the R0, W0 or X0 registers. An implementation must
>   return this error code when it receives:
>
>     * An SMC or HVC call with an unknown Function Identifier
>     * An SMC or HVC call for a removed Function Identifier
>     * An SMC64/HVC64 call from AArch32 state
>
> To comply with these statements, let's always return -1 when we encounter
> an unknown HVC or SMC call.
>
> Signed-off-by: Alexander Graf <agraf@csgraf.de>
>
> ---
>
> v7 -> v8:
>
>   - fix checkpatch
>
> v8 -> v9:
>
>   - Remove Windows specifics and just comply with SMCCC spec
> ---
>  target/arm/hvf/hvf.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index b62cfa3976..6a7ccfa91e 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -1177,7 +1177,8 @@ int hvf_vcpu_exec(CPUState *cpu)
>          cpu_synchronize_state(cpu);
>          if (hvf_handle_psci_call(cpu)) {
>              trace_hvf_unknown_hvf(env->xregs[0]);
> -            hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized());
> +            /* SMCCC 1.3 section 5.2 says every unknown HVC call returns -1 
> */
> +            env->xregs[0] = -1;
>          }
>          break;
>      case EC_AA64_SMC:
> @@ -1186,7 +1187,9 @@ int hvf_vcpu_exec(CPUState *cpu)
>              advance_pc = true;
>          } else {
>              trace_hvf_unknown_smc(env->xregs[0]);
> -            hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized());
> +            /* SMCCC 1.3 section 5.2 says every unknown SMC call returns -1 
> */
> +            env->xregs[0] = -1;
> +            advance_pc = true;
>          }
>          break;
>      default:

This should be squashed into whatever earlier patch added this code.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]