Skip to content

Commit 8989d56

Browse files
mikeympe
authored andcommitted
powerpc/pseries: Query hypervisor for RFI flush settings
A new hypervisor call is available which tells the guest settings related to the RFI flush. Use it to query the appropriate flush instruction(s), and whether the flush is required. Signed-off-by: Michael Neuling <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent bc9c930 commit 8989d56

File tree

1 file changed

+35
-0
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+35
-0
lines changed

arch/powerpc/platforms/pseries/setup.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,39 @@ static void __init find_and_init_phbs(void)
459459
of_pci_check_probe_only();
460460
}
461461

462+
static void pseries_setup_rfi_flush(void)
463+
{
464+
struct h_cpu_char_result result;
465+
enum l1d_flush_type types;
466+
bool enable;
467+
long rc;
468+
469+
/* Enable by default */
470+
enable = true;
471+
472+
rc = plpar_get_cpu_characteristics(&result);
473+
if (rc == H_SUCCESS) {
474+
types = L1D_FLUSH_NONE;
475+
476+
if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
477+
types |= L1D_FLUSH_MTTRIG;
478+
if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30)
479+
types |= L1D_FLUSH_ORI;
480+
481+
/* Use fallback if nothing set in hcall */
482+
if (types == L1D_FLUSH_NONE)
483+
types = L1D_FLUSH_FALLBACK;
484+
485+
if (!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR))
486+
enable = false;
487+
} else {
488+
/* Default to fallback if case hcall is not available */
489+
types = L1D_FLUSH_FALLBACK;
490+
}
491+
492+
setup_rfi_flush(types, enable);
493+
}
494+
462495
static void __init pSeries_setup_arch(void)
463496
{
464497
set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -476,6 +509,8 @@ static void __init pSeries_setup_arch(void)
476509

477510
fwnmi_init();
478511

512+
pseries_setup_rfi_flush();
513+
479514
/* By default, only probe PCI (can be overridden by rtas_pci) */
480515
pci_add_flags(PCI_PROBE_ONLY);
481516

0 commit comments

Comments
 (0)