Re: [PATCH 1/2] powerpc: Introduce POWER10_DD1 feature
From: Ravi Bangoria <hidden>
Date: 2020-10-26 10:00:44
Hi Michael,
quoted
+static void __init fixup_cpu_features(void) +{ + unsigned long version = mfspr(SPRN_PVR); + + if ((version & 0xffffffff) == 0x00800100) + cur_cpu_spec->cpu_features |= CPU_FTR_POWER10_DD1; +} + static int __init early_init_dt_scan_cpus(unsigned long node, const char *uname, int depth, void *data)@@ -378,6 +386,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node, check_cpu_feature_properties(node); check_cpu_pa_features(node); + fixup_cpu_features(); }This is not the way we normally do CPU features. In the past we have always added a raw entry in cputable.c, see eg. the Power9 DD 2.0, 2.1 entries.
True. But that won't work PowerVM guests because kernel overwrites "raw" mode cpu_features with "architected" mode cpu_features.
Doing it here is not really safe, if you're running with an architected PVR (via cpu-version property), you can't set the DD1 feature, because you might be migrated to a future CPU that doesn't have the DD1 quirks.
Okay.. I suppose, that mean kernel need to check real PVR every time when it encounters spurious exception. i.e. instead of using if (cpu_has_feature(CPU_FTR_POWER10_DD1) && ...) it need to use if (mfspr(SPRN_PVR) == 0x800100 && ...) in patch 2. Right? Thanks, Ravi