On 2018-03-07 10:13, Claudio Scordino wrote:
> From: Peng Fang <peng....@nxp.com>
> 
> On i.MX8MQ, SIP is mainly used for low-power mode, so it can be ignored.
> See the following reference:
> https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/arm-sip-service.rst
> 
> Signed-off-by: Peng Fang <peng....@nxp.com>
> Signed-off-by: Claudio Scordino <clau...@evidence.eu.com>
> ---
>  hypervisor/arch/arm-common/include/asm/psci.h |  3 +++
>  hypervisor/arch/arm64/traps.c                 | 12 +++++++++---
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/hypervisor/arch/arm-common/include/asm/psci.h 
> b/hypervisor/arch/arm-common/include/asm/psci.h
> index e635aec..76684db 100644
> --- a/hypervisor/arch/arm-common/include/asm/psci.h
> +++ b/hypervisor/arch/arm-common/include/asm/psci.h
> @@ -32,6 +32,9 @@
>  #define PSCI_CPU_IS_ON                       0
>  #define PSCI_CPU_IS_OFF                      1
>  
> +#define IS_SIP_32(hvc)                       (((hvc) >> 24) == 0x82)
> +#define IS_SIP_64(hvc)                       (((hvc) >> 24) == 0xc2)
> +
>  #define IS_PSCI_32(hvc)                      (((hvc) >> 24) == 0x84)
>  #define IS_PSCI_64(hvc)                      (((hvc) >> 24) == 0xc4)
>  #define IS_PSCI_UBOOT(hvc)           (((hvc) >> 8) == 0x95c1ba)
> diff --git a/hypervisor/arch/arm64/traps.c b/hypervisor/arch/arm64/traps.c
> index cd30923..d0a2737 100644
> --- a/hypervisor/arch/arm64/traps.c
> +++ b/hypervisor/arch/arm64/traps.c
> @@ -36,10 +36,16 @@ static int handle_smc(struct trap_context *ctx)
>  {
>       unsigned long *regs = ctx->regs;
>  
> -     if (!IS_PSCI_32(regs[0]) && !IS_PSCI_64(regs[0]))
> +     if (IS_PSCI_32(regs[0]) || IS_PSCI_64(regs[0])) {
> +             regs[0] = psci_dispatch(ctx);
> +#ifdef CONFIG_MACH_IMX8MQ

I think this is generic, at least to my reading of the SMC calling
convention. As we otherwise panic and the guest /should/ be able to
handle this rejection, I would suggest to do this unconditionally.

> +     } else if (IS_SIP_32(regs[0]) || IS_SIP_64(regs[0])) {
> +             /* This can be ignored */
> +             regs[0] = PSCI_NOT_SUPPORTED;

Naming is not beautiful (this is no PSCI call). Maybe define
SIP_NOT_SUPPORTED?

> +#endif
> +     } else {
>               return TRAP_UNHANDLED;
> -
> -     regs[0] = psci_dispatch(ctx);
> +     }
>  
>       arch_skip_instruction(ctx);
>  
> 

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to