|
37 | 37 | #include <asm/kexec.h>
|
38 | 38 | #include <asm/smp.h>
|
39 | 39 | #include <asm/tm.h>
|
| 40 | +#include <asm/setup.h> |
40 | 41 |
|
41 | 42 | #include "powernv.h"
|
42 | 43 |
|
| 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 | + |
43 | 90 | static void __init pnv_setup_arch(void)
|
44 | 91 | {
|
45 | 92 | set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
|
46 | 93 |
|
| 94 | + pnv_setup_rfi_flush(); |
| 95 | + |
47 | 96 | /* Initialize SMP */
|
48 | 97 | pnv_smp_init();
|
49 | 98 |
|
|
0 commit comments