Skip to content

Commit 2e4a161

Browse files
committed
powerpc/pseries: Use the security flags in pseries_setup_rfi_flush()
Now that we have the security flags we can simplify the code in pseries_setup_rfi_flush() because the security flags have pessimistic defaults. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 37c0bdd commit 2e4a161

File tree

1 file changed

+12
-15
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+12
-15
lines changed

arch/powerpc/platforms/pseries/setup.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -501,30 +501,27 @@ void pseries_setup_rfi_flush(void)
501501
bool enable;
502502
long rc;
503503

504-
/* Enable by default */
505-
enable = true;
506-
types = L1D_FLUSH_FALLBACK;
507-
508504
rc = plpar_get_cpu_characteristics(&result);
509-
if (rc == H_SUCCESS) {
505+
if (rc == H_SUCCESS)
510506
init_cpu_char_feature_flags(&result);
511507

512-
if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
513-
types |= L1D_FLUSH_MTTRIG;
514-
if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30)
515-
types |= L1D_FLUSH_ORI;
516-
517-
if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) ||
518-
(!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
519-
enable = false;
520-
}
521-
522508
/*
523509
* We're the guest so this doesn't apply to us, clear it to simplify
524510
* handling of it elsewhere.
525511
*/
526512
security_ftr_clear(SEC_FTR_L1D_FLUSH_HV);
527513

514+
types = L1D_FLUSH_FALLBACK;
515+
516+
if (security_ftr_enabled(SEC_FTR_L1D_FLUSH_TRIG2))
517+
types |= L1D_FLUSH_MTTRIG;
518+
519+
if (security_ftr_enabled(SEC_FTR_L1D_FLUSH_ORI30))
520+
types |= L1D_FLUSH_ORI;
521+
522+
enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && \
523+
security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR);
524+
528525
setup_rfi_flush(types, enable);
529526
}
530527

0 commit comments

Comments
 (0)