On 2018-02-03 11:52, Peng Fan wrote:
> Hi Jan,
> On Tue, Jan 30, 2018 at 03:00:34PM +0100, Jan Kiszka wrote:
>> On 2018-01-30 13:04, Peng Fan wrote:
>>>
>>> Hi,
>>> On Tue, Jan 30, 2018 at 09:50:25AM +0100, Claudio Scordino wrote:
>>>> addr2line reported arch/arm64/kernel/smccc-call.S:41
>>>>
>>>> grepping __arm_smccc_smc (then, arm_smccc_smc), we've found the value of x0
>>>> (0xC2000000) to be
>>>>
>>>>
>>>>    #define FSL_SIP_GPC 0xC2000000
>>>>
>>>>
>>>> which is used by drivers/soc/imx/gpc-psci.c (e.g., by 
>>>> imx_gpc_pd_power_off).
>>>> This file gets compiled when the symbol CONFIG_ARCH_FSL_IMX8MQ is defined.
>>>>
>>>> We cannot exclude such file from the kernel build, so I guess we need to 
>>>> make
>>>> Jailhouse aware of this SMC.
>>>> If so, should we add an entry to psci_dispatch() ? How should behave the
>>>> function ?
>>>
>>> If this is SIP issue, you could try the following patch.
>>>
>>> From cd0c701c1b67215e7769e10ad015be0616611465 Mon Sep 17 00:00:00 2001
>>> From: Peng Fan <peng....@nxp.com>
>>> Date: Fri, 27 Oct 2017 13:42:37 +0800
>>> Subject: [PATCH] ignore sip now
>>>
>>> Signed-off-by: Peng Fan <peng....@nxp.com>
>>> ---
>>>  hypervisor/arch/arm-common/include/asm/psci.h |  2 ++
>>>  hypervisor/arch/arm64/traps.c                 | 10 +++++++---
>>>  2 files changed, 9 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hypervisor/arch/arm-common/include/asm/psci.h 
>>> b/hypervisor/arch/arm-common/include/asm/psci.h
>>> index 09712c6e..71e725ce 100644
>>> --- a/hypervisor/arch/arm-common/include/asm/psci.h
>>> +++ b/hypervisor/arch/arm-common/include/asm/psci.h
>>> @@ -35,6 +35,8 @@
>>>  #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 4a35d0d5..65ded596 100644
>>> --- a/hypervisor/arch/arm64/traps.c
>>> +++ b/hypervisor/arch/arm64/traps.c
>>> @@ -35,11 +35,15 @@ 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);
>>> +   } else if (IS_SIP_32(regs[0]) || IS_SIP_64(regs[0])) {
>>> +           /* Nothing */
>>> +           //printk("SIP service\n");
>>> +           //regs[0] = sip_dispatch(ctx);
>>
>> Hmm. What is SIP? Why can we simply ignore the calls? Why no returning
>> of some code in regs[0])? And are these function call ID
>> architecture-wide reserved, just like PSCI?
> 
> See here for SIP.
> https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/arm-sip-service.rst
> 
> on i.MX8MQ, SIP is mainly used for Low Power related controll. The
> previous patch is a hack method. Per my understanding, jailhouse is
> for real time case, low power feature will introduce lots latency,
> so ignore them here no harm for me, the previous patch is a hack.
> 
> Since SIP is silicon provider service, it is better to provide a callback
> function for different SoCs.
> 

Thanks for the pointer! From reading through it and studying the SMC
calling convention again, I guess we should at least return -1 on
ignored calls.

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