Subject: Re: [PATCH][v2] powerpc/85xx: Move ePAPR paravirt initialization earlier

From: Tudor Laurentiu <[email-masked]>
Date: Wed, 3 Jul 2013 15:29:43 +0300

On 07/02/2013 08:55 PM, Scott Wood wrote:
> On 07/02/2013 07:46:29 AM, Laurentiu Tudor wrote:
>> diff --git a/arch/powerpc/kernel/epapr_paravirt.c
>> b/arch/powerpc/kernel/epapr_paravirt.c
>> index d44a571..d05f9da 100644
>> --- a/arch/powerpc/kernel/epapr_paravirt.c
>> +++ b/arch/powerpc/kernel/epapr_paravirt.c
>> @@ -30,38 +30,45 @@ extern u32 epapr_ev_idle_start[];
>>
>> bool epapr_paravirt_enabled;
>>
>> -static int __init epapr_paravirt_init(void)
>> +static int __init early_init_dt_scan_epapr(unsigned long node,
>> + const char *uname,
>> + int depth, void *data)
>> {
>> - struct device_node *hyper_node;
>> - const u32 *insts;
>> - int len, i;
>> + const u32 *instrs;
>> + unsigned long len;
>> + int i;
>>
>> - hyper_node = of_find_node_by_path("/hypervisor");
>> - if (!hyper_node)
>> - return -ENODEV;
>> + if (!of_flat_dt_is_compatible(node, "epapr,hypervisor-1"))
>> + return 0;
>
> QEMU doesn't set "epapr,hypervisor-1" but it still uses the same hcall
> mechanism. The compatible that QEMU sets is "linux,kvm". Perhaps QEMU
> should change, but we'd still like to be compatible with older QEMUs.
>
> How is this change related to moving initialization earlier?

Just a (extra-)check to see that i'm on the right node.
But considering your mention on qemu/kvm using a different compatible 
i'm thinking of dropping it and only try reading the 
"hcall-instructions" property.

>> - insts = of_get_property(hyper_node, "hcall-instructions", &len);
>> - if (!insts)
>> - return -ENODEV;
>> +#if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)
>> + if (of_get_flat_dt_prop(node, "has-idle", NULL))
>> + ppc_md.power_save = epapr_ev_idle;
>> +#endif
>
> Why are you doing this before processing hcall-instructions?
>

Nothing of importance. The code seemed more clear to me.

---
Best Regards, Laurentiu