selftests/powerpc/spectre_v2: Return skip code when miss_percent is high

A mis-match between reported and actual mitigation is not restricted to the
Vulnerable case. The guest might also report the mitigation as "Software
count cache flush" and the host will still mitigate with branch cache
disabled.

So, instead of skipping depending on the detected mitigation, simply skip
whenever the detected miss_percent is the expected one for a fully
mitigated system, that is, above 95%.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211207130557.40566-1-cascardo@canonical.com
This commit is contained in:
Thadeu Lima de Souza Cascardo 2021-12-07 10:05:57 -03:00 committed by Michael Ellerman
parent e89257e28e
commit 3c42e95420

View File

@ -193,7 +193,7 @@ int spectre_v2_test(void)
* We are not vulnerable and reporting otherwise, so
* missing such a mismatch is safe.
*/
if (state == VULNERABLE)
if (miss_percent > 95)
return 4;
return 1;