diff options
-rw-r--r-- | arch/powerpc/include/asm/epapr_hcalls.h | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/epapr_paravirt.c | 28 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 3 |
4 files changed, 28 insertions, 13 deletions
diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h index d3d634274d2c..86b0ac79990c 100644 --- a/arch/powerpc/include/asm/epapr_hcalls.h +++ b/arch/powerpc/include/asm/epapr_hcalls.h | |||
@@ -105,6 +105,12 @@ | |||
105 | extern bool epapr_paravirt_enabled; | 105 | extern bool epapr_paravirt_enabled; |
106 | extern u32 epapr_hypercall_start[]; | 106 | extern u32 epapr_hypercall_start[]; |
107 | 107 | ||
108 | #ifdef CONFIG_EPAPR_PARAVIRT | ||
109 | int __init epapr_paravirt_early_init(void); | ||
110 | #else | ||
111 | static inline int epapr_paravirt_early_init(void) { return 0; } | ||
112 | #endif | ||
113 | |||
108 | /* | 114 | /* |
109 | * We use "uintptr_t" to define a register because it's guaranteed to be a | 115 | * We use "uintptr_t" to define a register because it's guaranteed to be a |
110 | * 32-bit integer on a 32-bit platform, and a 64-bit integer on a 64-bit | 116 | * 32-bit integer on a 32-bit platform, and a 64-bit integer on a 64-bit |
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c index d44a571e45a7..6300c13bbde4 100644 --- a/arch/powerpc/kernel/epapr_paravirt.c +++ b/arch/powerpc/kernel/epapr_paravirt.c | |||
@@ -30,22 +30,20 @@ extern u32 epapr_ev_idle_start[]; | |||
30 | 30 | ||
31 | bool epapr_paravirt_enabled; | 31 | bool epapr_paravirt_enabled; |
32 | 32 | ||
33 | static int __init epapr_paravirt_init(void) | 33 | static int __init early_init_dt_scan_epapr(unsigned long node, |
34 | const char *uname, | ||
35 | int depth, void *data) | ||
34 | { | 36 | { |
35 | struct device_node *hyper_node; | ||
36 | const u32 *insts; | 37 | const u32 *insts; |
37 | int len, i; | 38 | unsigned long len; |
39 | int i; | ||
38 | 40 | ||
39 | hyper_node = of_find_node_by_path("/hypervisor"); | 41 | insts = of_get_flat_dt_prop(node, "hcall-instructions", &len); |
40 | if (!hyper_node) | ||
41 | return -ENODEV; | ||
42 | |||
43 | insts = of_get_property(hyper_node, "hcall-instructions", &len); | ||
44 | if (!insts) | 42 | if (!insts) |
45 | return -ENODEV; | 43 | return 0; |
46 | 44 | ||
47 | if (len % 4 || len > (4 * 4)) | 45 | if (len % 4 || len > (4 * 4)) |
48 | return -ENODEV; | 46 | return -1; |
49 | 47 | ||
50 | for (i = 0; i < (len / 4); i++) { | 48 | for (i = 0; i < (len / 4); i++) { |
51 | patch_instruction(epapr_hypercall_start + i, insts[i]); | 49 | patch_instruction(epapr_hypercall_start + i, insts[i]); |
@@ -55,13 +53,19 @@ static int __init epapr_paravirt_init(void) | |||
55 | } | 53 | } |
56 | 54 | ||
57 | #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64) | 55 | #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64) |
58 | if (of_get_property(hyper_node, "has-idle", NULL)) | 56 | if (of_get_flat_dt_prop(node, "has-idle", NULL)) |
59 | ppc_md.power_save = epapr_ev_idle; | 57 | ppc_md.power_save = epapr_ev_idle; |
60 | #endif | 58 | #endif |
61 | 59 | ||
62 | epapr_paravirt_enabled = true; | 60 | epapr_paravirt_enabled = true; |
63 | 61 | ||
62 | return 1; | ||
63 | } | ||
64 | |||
65 | int __init epapr_paravirt_early_init(void) | ||
66 | { | ||
67 | of_scan_flat_dt(early_init_dt_scan_epapr, NULL); | ||
68 | |||
64 | return 0; | 69 | return 0; |
65 | } | 70 | } |
66 | 71 | ||
67 | early_initcall(epapr_paravirt_init); | ||
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index a8f54ecb091f..a4bbcae72578 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <asm/serial.h> | 38 | #include <asm/serial.h> |
39 | #include <asm/udbg.h> | 39 | #include <asm/udbg.h> |
40 | #include <asm/mmu_context.h> | 40 | #include <asm/mmu_context.h> |
41 | #include <asm/epapr_hcalls.h> | ||
41 | 42 | ||
42 | #include "setup.h" | 43 | #include "setup.h" |
43 | 44 | ||
@@ -128,6 +129,8 @@ notrace void __init machine_init(u64 dt_ptr) | |||
128 | /* Do some early initialization based on the flat device tree */ | 129 | /* Do some early initialization based on the flat device tree */ |
129 | early_init_devtree(__va(dt_ptr)); | 130 | early_init_devtree(__va(dt_ptr)); |
130 | 131 | ||
132 | epapr_paravirt_early_init(); | ||
133 | |||
131 | early_init_mmu(); | 134 | early_init_mmu(); |
132 | 135 | ||
133 | probe_machine(); | 136 | probe_machine(); |
@@ -326,5 +329,4 @@ void __init setup_arch(char **cmdline_p) | |||
326 | 329 | ||
327 | /* Initialize the MMU context management stuff */ | 330 | /* Initialize the MMU context management stuff */ |
328 | mmu_context_init(); | 331 | mmu_context_init(); |
329 | |||
330 | } | 332 | } |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 389fb8077cc9..f03770e0fc8d 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <asm/code-patching.h> | 66 | #include <asm/code-patching.h> |
67 | #include <asm/kvm_ppc.h> | 67 | #include <asm/kvm_ppc.h> |
68 | #include <asm/hugetlb.h> | 68 | #include <asm/hugetlb.h> |
69 | #include <asm/epapr_hcalls.h> | ||
69 | 70 | ||
70 | #include "setup.h" | 71 | #include "setup.h" |
71 | 72 | ||
@@ -215,6 +216,8 @@ void __init early_setup(unsigned long dt_ptr) | |||
215 | */ | 216 | */ |
216 | early_init_devtree(__va(dt_ptr)); | 217 | early_init_devtree(__va(dt_ptr)); |
217 | 218 | ||
219 | epapr_paravirt_early_init(); | ||
220 | |||
218 | /* Now we know the logical id of our boot cpu, setup the paca. */ | 221 | /* Now we know the logical id of our boot cpu, setup the paca. */ |
219 | setup_paca(&paca[boot_cpuid]); | 222 | setup_paca(&paca[boot_cpuid]); |
220 | fixup_boot_paca(); | 223 | fixup_boot_paca(); |