Skip to content

Commit 6e032b3

Browse files
oohalmpe
authored andcommitted
powerpc/powernv: Check device-tree for RFI flush settings
New device-tree properties are available which tell the hypervisor settings related to the RFI flush. Use them to determine the appropriate flush instruction to use, and whether the flush is required. Signed-off-by: Oliver O'Halloran <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 8989d56 commit 6e032b3

File tree

1 file changed

+49
-0
lines changed
  • arch/powerpc/platforms/powernv

1 file changed

+49
-0
lines changed

arch/powerpc/platforms/powernv/setup.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,62 @@
3737
#include <asm/kexec.h>
3838
#include <asm/smp.h>
3939
#include <asm/tm.h>
40+
#include <asm/setup.h>
4041

4142
#include "powernv.h"
4243

44+
static void pnv_setup_rfi_flush(void)
45+
{
46+
struct device_node *np, *fw_features;
47+
enum l1d_flush_type type;
48+
int enable;
49+
50+
/* Default to fallback in case fw-features are not available */
51+
type = L1D_FLUSH_FALLBACK;
52+
enable = 1;
53+
54+
np = of_find_node_by_name(NULL, "ibm,opal");
55+
fw_features = of_get_child_by_name(np, "fw-features");
56+
of_node_put(np);
57+
58+
if (fw_features) {
59+
np = of_get_child_by_name(fw_features, "inst-l1d-flush-trig2");
60+
if (np && of_property_read_bool(np, "enabled"))
61+
type = L1D_FLUSH_MTTRIG;
62+
63+
of_node_put(np);
64+
65+
np = of_get_child_by_name(fw_features, "inst-l1d-flush-ori30,30,0");
66+
if (np && of_property_read_bool(np, "enabled"))
67+
type = L1D_FLUSH_ORI;
68+
69+
of_node_put(np);
70+
71+
/* Enable unless firmware says NOT to */
72+
enable = 2;
73+
np = of_get_child_by_name(fw_features, "needs-l1d-flush-msr-hv-1-to-0");
74+
if (np && of_property_read_bool(np, "disabled"))
75+
enable--;
76+
77+
of_node_put(np);
78+
79+
np = of_get_child_by_name(fw_features, "needs-l1d-flush-msr-pr-0-to-1");
80+
if (np && of_property_read_bool(np, "disabled"))
81+
enable--;
82+
83+
of_node_put(np);
84+
of_node_put(fw_features);
85+
}
86+
87+
setup_rfi_flush(type, enable > 0);
88+
}
89+
4390
static void __init pnv_setup_arch(void)
4491
{
4592
set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
4693

94+
pnv_setup_rfi_flush();
95+
4796
/* Initialize SMP */
4897
pnv_smp_init();
4998

0 commit comments

Comments
 (0)