Re: [RFC PATCH 03/12] powerpc/prom_init: Add the ESM call to prom_init

Alexey Kardashevskiy
2019-07-01T03:13:38Z

On 29/06/2019 08:33, Thiago Jung Bauermann wrote:
>
> Hello Alexey,
>
> Thanks for reviewing this patch!
>
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
>> On 21/05/2019 14:49, Thiago Jung Bauermann wrote:
>>> @@ -1707,6 +1723,43 @@ static void __init prom_close_stdin(void)
>>> }
>>> }
>>>
>>> +#ifdef CONFIG_PPC_SVM
>>> +static int prom_rtas_os_term_hcall(uint64_t args)
>>
>>
>> This is just an rtas hcall, nothing special about "os-term".
>
> Sorry, unfortunately I don't understand how we're treating os-term
> especially. Do you mean that we should inline this function directly
> into prom_rtas_os_term()?

I meant the function name - prom_rtas_os_term_hcall - should rather be
prom_rtas_hcall.

>
>>> +{
>>> + register uint64_t arg1 asm("r3") = 0xf000;
>>> + register uint64_t arg2 asm("r4") = args;
>>> +
>>> + asm volatile("sc 1\n" : "=r" (arg1) :
>>> + "r" (arg1),
>>> + "r" (arg2) :);
>>> + return arg1;
>>> +}
>>> +
>>> +static struct rtas_args __prombss os_term_args;
>>> +
>>> +static void __init prom_rtas_os_term(char *str)
>>> +{
>>> + phandle rtas_node;
>>> + __be32 val;
>>> + u32 token;
>>> +
>>> + prom_printf("%s: start...\n", __func__);
>>> + rtas_node = call_prom("finddevice", 1, 1, ADDR("/rtas"));
>>> + prom_printf("rtas_node: %x\n", rtas_node);
>>> + if (!PHANDLE_VALID(rtas_node))
>>> + return;
>>> +
>>> + val = 0;
>>> + prom_getprop(rtas_node, "ibm,os-term", &val, sizeof(val));
>>> + token = be32_to_cpu(val);
>>> + prom_printf("ibm,os-term: %x\n", token);
>>> + if (token == 0)
>>> + prom_panic("Could not get token for ibm,os-term\n");
>>> + os_term_args.token = cpu_to_be32(token);
>>> + prom_rtas_os_term_hcall((uint64_t)&os_term_args);
>>> +}
>>> +#endif /* CONFIG_PPC_SVM */
>>> +
>>> /*
>>> * Allocate room for and instantiate RTAS
>>> */
>

--
Alexey