[PATCH v2] powerpc: setup_64: set up PACA earlier to avoid kcov problems

Andrew Donnellan ajd at linux.ibm.com
Fri Mar 6 15:45:41 AEDT 2020


On 6/3/20 3:40 pm, Daniel Axtens wrote:
>> There's some special handling for CPU_FTR_HVMODE in
>> cpufeatures_setup_cpu() in kernel/dt_cpu_ftrs.c:
>>
>>           /* Initialize the base environment -- clear FSCR/HFSCR.  */
>>           hv_mode = !!(mfmsr() & MSR_HV);
>>           if (hv_mode) {
>>                   /* CPU_FTR_HVMODE is used early in PACA setup */
>>                   cur_cpu_spec->cpu_features |= CPU_FTR_HVMODE;
>>                   mtspr(SPRN_HFSCR, 0);
>>           }
>>
>> With this patch, the comment about PACA setup I assume is no longer
>> true. It looks like we still rely on hv_mode being set to deal with
>> discrepancies between the device tree and the MSR.
> 
> This code confuses me. IIUC it sets the CPU feature if we're in HV mode,
> which will catch the case where the HV bit is set in the MSR but for
> some reason it's not listed in the DT. With my patch, we'll directly
> test the MSR so we don't need the cpu feature set for that.
> 
> However, the CPU feature is tested elsewhere, so I think the correct
> behaviour is to keep the code but drop the comment. Having said that
> bootstrapping is hard so lmk if I've misunderstood.

That was my thinking too.

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd at linux.ibm.com             IBM Australia Limited



More information about the Linuxppc-dev mailing list