aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2013-10-07 12:47:59 -0400
committerAlexander Graf <agraf@suse.de>2013-10-17 09:45:35 -0400
commit2ba9f0d8875073a2ed802fca0c25c9bfc4338439 (patch)
treeffe49a40ff604985c5f3f159ba336bdd90cb98cd /arch/powerpc
parentdba291f2ceacb833063179530eeb83a317a6cc95 (diff)
kvm: powerpc: book3s: Support building HV and PR KVM as module
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> [agraf: squash in compile fix] Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kvm/Kconfig6
-rw-r--r--arch/powerpc/kvm/Makefile11
-rw-r--r--arch/powerpc/kvm/book3s.c12
-rw-r--r--arch/powerpc/kvm/book3s_emulate.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv.c2
-rw-r--r--arch/powerpc/kvm/book3s_pr.c5
-rw-r--r--arch/powerpc/kvm/book3s_rtas.c1
-rw-r--r--arch/powerpc/kvm/book3s_xics.c1
-rw-r--r--arch/powerpc/kvm/emulate.c1
-rw-r--r--arch/powerpc/kvm/powerpc.c10
10 files changed, 42 insertions, 9 deletions
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index a96d7c32f785..8aeeda1ff42a 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -73,7 +73,7 @@ config KVM_BOOK3S_64
73 If unsure, say N. 73 If unsure, say N.
74 74
75config KVM_BOOK3S_64_HV 75config KVM_BOOK3S_64_HV
76 bool "KVM support for POWER7 and PPC970 using hypervisor mode in host" 76 tristate "KVM support for POWER7 and PPC970 using hypervisor mode in host"
77 depends on KVM_BOOK3S_64 77 depends on KVM_BOOK3S_64
78 select KVM_BOOK3S_HV_POSSIBLE 78 select KVM_BOOK3S_HV_POSSIBLE
79 select MMU_NOTIFIER 79 select MMU_NOTIFIER
@@ -94,8 +94,8 @@ config KVM_BOOK3S_64_HV
94 If unsure, say N. 94 If unsure, say N.
95 95
96config KVM_BOOK3S_64_PR 96config KVM_BOOK3S_64_PR
97 bool "KVM support without using hypervisor mode in host" 97 tristate "KVM support without using hypervisor mode in host"
98 depends on KVM_BOOK3S_64 && !KVM_BOOK3S_64_HV 98 depends on KVM_BOOK3S_64
99 select KVM_BOOK3S_PR_POSSIBLE 99 select KVM_BOOK3S_PR_POSSIBLE
100 ---help--- 100 ---help---
101 Support running guest kernels in virtual machines on processors 101 Support running guest kernels in virtual machines on processors
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index fa17b337bb96..ce569b6bf4d8 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -56,7 +56,7 @@ kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs)
56kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) := \ 56kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) := \
57 book3s_64_vio_hv.o 57 book3s_64_vio_hv.o
58 58
59kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_PR) := \ 59kvm-pr-y := \
60 fpu.o \ 60 fpu.o \
61 book3s_paired_singles.o \ 61 book3s_paired_singles.o \
62 book3s_pr.o \ 62 book3s_pr.o \
@@ -76,7 +76,7 @@ kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
76 book3s_rmhandlers.o 76 book3s_rmhandlers.o
77endif 77endif
78 78
79kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_HV) += \ 79kvm-hv-y += \
80 book3s_hv.o \ 80 book3s_hv.o \
81 book3s_hv_interrupts.o \ 81 book3s_hv_interrupts.o \
82 book3s_64_mmu_hv.o 82 book3s_64_mmu_hv.o
@@ -84,13 +84,15 @@ kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_HV) += \
84kvm-book3s_64-builtin-xics-objs-$(CONFIG_KVM_XICS) := \ 84kvm-book3s_64-builtin-xics-objs-$(CONFIG_KVM_XICS) := \
85 book3s_hv_rm_xics.o 85 book3s_hv_rm_xics.o
86 86
87kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HV) += \ 87ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
88kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
88 book3s_hv_rmhandlers.o \ 89 book3s_hv_rmhandlers.o \
89 book3s_hv_rm_mmu.o \ 90 book3s_hv_rm_mmu.o \
90 book3s_hv_ras.o \ 91 book3s_hv_ras.o \
91 book3s_hv_builtin.o \ 92 book3s_hv_builtin.o \
92 book3s_hv_cma.o \ 93 book3s_hv_cma.o \
93 $(kvm-book3s_64-builtin-xics-objs-y) 94 $(kvm-book3s_64-builtin-xics-objs-y)
95endif
94 96
95kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \ 97kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
96 book3s_xics.o 98 book3s_xics.o
@@ -131,4 +133,7 @@ obj-$(CONFIG_KVM_E500MC) += kvm.o
131obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o 133obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o
132obj-$(CONFIG_KVM_BOOK3S_32) += kvm.o 134obj-$(CONFIG_KVM_BOOK3S_32) += kvm.o
133 135
136obj-$(CONFIG_KVM_BOOK3S_64_PR) += kvm-pr.o
137obj-$(CONFIG_KVM_BOOK3S_64_HV) += kvm-hv.o
138
134obj-y += $(kvm-book3s_64-builtin-objs-y) 139obj-y += $(kvm-book3s_64-builtin-objs-y)
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 493aff77f84e..39d2994f9d27 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -170,28 +170,32 @@ void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
170 printk(KERN_INFO "Queueing interrupt %x\n", vec); 170 printk(KERN_INFO "Queueing interrupt %x\n", vec);
171#endif 171#endif
172} 172}
173 173EXPORT_SYMBOL_GPL(kvmppc_book3s_queue_irqprio);
174 174
175void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong flags) 175void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong flags)
176{ 176{
177 /* might as well deliver this straight away */ 177 /* might as well deliver this straight away */
178 kvmppc_inject_interrupt(vcpu, BOOK3S_INTERRUPT_PROGRAM, flags); 178 kvmppc_inject_interrupt(vcpu, BOOK3S_INTERRUPT_PROGRAM, flags);
179} 179}
180EXPORT_SYMBOL_GPL(kvmppc_core_queue_program);
180 181
181void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu) 182void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu)
182{ 183{
183 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER); 184 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER);
184} 185}
186EXPORT_SYMBOL_GPL(kvmppc_core_queue_dec);
185 187
186int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu) 188int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu)
187{ 189{
188 return test_bit(BOOK3S_IRQPRIO_DECREMENTER, &vcpu->arch.pending_exceptions); 190 return test_bit(BOOK3S_IRQPRIO_DECREMENTER, &vcpu->arch.pending_exceptions);
189} 191}
192EXPORT_SYMBOL_GPL(kvmppc_core_pending_dec);
190 193
191void kvmppc_core_dequeue_dec(struct kvm_vcpu *vcpu) 194void kvmppc_core_dequeue_dec(struct kvm_vcpu *vcpu)
192{ 195{
193 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER); 196 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER);
194} 197}
198EXPORT_SYMBOL_GPL(kvmppc_core_dequeue_dec);
195 199
196void kvmppc_core_queue_external(struct kvm_vcpu *vcpu, 200void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
197 struct kvm_interrupt *irq) 201 struct kvm_interrupt *irq)
@@ -329,6 +333,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
329 333
330 return 0; 334 return 0;
331} 335}
336EXPORT_SYMBOL_GPL(kvmppc_core_prepare_to_enter);
332 337
333pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing, 338pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing,
334 bool *writable) 339 bool *writable)
@@ -354,6 +359,7 @@ pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing,
354 359
355 return gfn_to_pfn_prot(vcpu->kvm, gfn, writing, writable); 360 return gfn_to_pfn_prot(vcpu->kvm, gfn, writing, writable);
356} 361}
362EXPORT_SYMBOL_GPL(kvmppc_gfn_to_pfn);
357 363
358static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data, 364static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data,
359 bool iswrite, struct kvmppc_pte *pte) 365 bool iswrite, struct kvmppc_pte *pte)
@@ -421,6 +427,7 @@ int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
421 427
422 return EMULATE_DONE; 428 return EMULATE_DONE;
423} 429}
430EXPORT_SYMBOL_GPL(kvmppc_st);
424 431
425int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, 432int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
426 bool data) 433 bool data)
@@ -451,6 +458,7 @@ nopte:
451mmio: 458mmio:
452 return EMULATE_DO_MMIO; 459 return EMULATE_DO_MMIO;
453} 460}
461EXPORT_SYMBOL_GPL(kvmppc_ld);
454 462
455int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) 463int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
456{ 464{
@@ -706,6 +714,7 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr)
706{ 714{
707 kvmppc_ops->set_msr(vcpu, msr); 715 kvmppc_ops->set_msr(vcpu, msr);
708} 716}
717EXPORT_SYMBOL_GPL(kvmppc_set_msr);
709 718
710int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 719int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
711{ 720{
@@ -787,6 +796,7 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
787{ 796{
788 return kvmppc_ops->unmap_hva(kvm, hva); 797 return kvmppc_ops->unmap_hva(kvm, hva);
789} 798}
799EXPORT_SYMBOL_GPL(kvm_unmap_hva);
790 800
791int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) 801int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
792{ 802{
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index b9841ad844fb..99d40f8977e8 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -172,7 +172,7 @@ int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
172 vcpu->arch.mmu.tlbie(vcpu, addr, large); 172 vcpu->arch.mmu.tlbie(vcpu, addr, large);
173 break; 173 break;
174 } 174 }
175#ifdef CONFIG_KVM_BOOK3S_64_PR 175#ifdef CONFIG_PPC_BOOK3S_64
176 case OP_31_XOP_FAKE_SC1: 176 case OP_31_XOP_FAKE_SC1:
177 { 177 {
178 /* SC 1 papr hypercalls */ 178 /* SC 1 papr hypercalls */
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 0782c8688c8b..9e954a81c078 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -52,6 +52,7 @@
52#include <linux/vmalloc.h> 52#include <linux/vmalloc.h>
53#include <linux/highmem.h> 53#include <linux/highmem.h>
54#include <linux/hugetlb.h> 54#include <linux/hugetlb.h>
55#include <linux/module.h>
55 56
56#include "book3s.h" 57#include "book3s.h"
57 58
@@ -2215,3 +2216,4 @@ static void kvmppc_book3s_exit_hv(void)
2215 2216
2216module_init(kvmppc_book3s_init_hv); 2217module_init(kvmppc_book3s_init_hv);
2217module_exit(kvmppc_book3s_exit_hv); 2218module_exit(kvmppc_book3s_exit_hv);
2219MODULE_LICENSE("GPL");
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index ca6c73d2ee77..7f583a482161 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -40,6 +40,7 @@
40#include <linux/sched.h> 40#include <linux/sched.h>
41#include <linux/vmalloc.h> 41#include <linux/vmalloc.h>
42#include <linux/highmem.h> 42#include <linux/highmem.h>
43#include <linux/module.h>
43 44
44#include "book3s.h" 45#include "book3s.h"
45 46
@@ -918,7 +919,7 @@ program_interrupt:
918 ulong cmd = kvmppc_get_gpr(vcpu, 3); 919 ulong cmd = kvmppc_get_gpr(vcpu, 3);
919 int i; 920 int i;
920 921
921#ifdef CONFIG_KVM_BOOK3S_64_PR 922#ifdef CONFIG_PPC_BOOK3S_64
922 if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) { 923 if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) {
923 r = RESUME_GUEST; 924 r = RESUME_GUEST;
924 break; 925 break;
@@ -1582,3 +1583,5 @@ static void kvmppc_book3s_exit_pr(void)
1582 1583
1583module_init(kvmppc_book3s_init_pr); 1584module_init(kvmppc_book3s_init_pr);
1584module_exit(kvmppc_book3s_exit_pr); 1585module_exit(kvmppc_book3s_exit_pr);
1586
1587MODULE_LICENSE("GPL");
diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c
index 3219ba895246..cf95cdef73c9 100644
--- a/arch/powerpc/kvm/book3s_rtas.c
+++ b/arch/powerpc/kvm/book3s_rtas.c
@@ -260,6 +260,7 @@ fail:
260 */ 260 */
261 return rc; 261 return rc;
262} 262}
263EXPORT_SYMBOL_GPL(kvmppc_rtas_hcall);
263 264
264void kvmppc_rtas_tokens_free(struct kvm *kvm) 265void kvmppc_rtas_tokens_free(struct kvm *kvm)
265{ 266{
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index cef3de96ff6c..c3c832b27ee5 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -840,6 +840,7 @@ int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 req)
840 840
841 return rc; 841 return rc;
842} 842}
843EXPORT_SYMBOL_GPL(kvmppc_xics_hcall);
843 844
844 845
845/* -- Initialisation code etc. -- */ 846/* -- Initialisation code etc. -- */
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 81762eb7957e..de9a340d22ed 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -483,3 +483,4 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
483 483
484 return emulated; 484 return emulated;
485} 485}
486EXPORT_SYMBOL_GPL(kvmppc_emulate_instruction);
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 874a2a5e6cec..9aaa07efa4b6 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -126,6 +126,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
126 126
127 return r; 127 return r;
128} 128}
129EXPORT_SYMBOL_GPL(kvmppc_prepare_to_enter);
129 130
130int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) 131int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
131{ 132{
@@ -179,6 +180,7 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
179 180
180 return r; 181 return r;
181} 182}
183EXPORT_SYMBOL_GPL(kvmppc_kvm_pv);
182 184
183int kvmppc_sanity_check(struct kvm_vcpu *vcpu) 185int kvmppc_sanity_check(struct kvm_vcpu *vcpu)
184{ 186{
@@ -207,6 +209,7 @@ out:
207 vcpu->arch.sane = r; 209 vcpu->arch.sane = r;
208 return r ? 0 : -EINVAL; 210 return r ? 0 : -EINVAL;
209} 211}
212EXPORT_SYMBOL_GPL(kvmppc_sanity_check);
210 213
211int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu) 214int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
212{ 215{
@@ -241,6 +244,7 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
241 244
242 return r; 245 return r;
243} 246}
247EXPORT_SYMBOL_GPL(kvmppc_emulate_mmio);
244 248
245int kvm_arch_hardware_enable(void *garbage) 249int kvm_arch_hardware_enable(void *garbage)
246{ 250{
@@ -665,6 +669,7 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
665 669
666 return EMULATE_DO_MMIO; 670 return EMULATE_DO_MMIO;
667} 671}
672EXPORT_SYMBOL_GPL(kvmppc_handle_load);
668 673
669/* Same as above, but sign extends */ 674/* Same as above, but sign extends */
670int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu, 675int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
@@ -726,6 +731,7 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
726 731
727 return EMULATE_DO_MMIO; 732 return EMULATE_DO_MMIO;
728} 733}
734EXPORT_SYMBOL_GPL(kvmppc_handle_store);
729 735
730int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) 736int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
731{ 737{
@@ -1074,22 +1080,26 @@ long kvmppc_alloc_lpid(void)
1074 1080
1075 return lpid; 1081 return lpid;
1076} 1082}
1083EXPORT_SYMBOL_GPL(kvmppc_alloc_lpid);
1077 1084
1078void kvmppc_claim_lpid(long lpid) 1085void kvmppc_claim_lpid(long lpid)
1079{ 1086{
1080 set_bit(lpid, lpid_inuse); 1087 set_bit(lpid, lpid_inuse);
1081} 1088}
1089EXPORT_SYMBOL_GPL(kvmppc_claim_lpid);
1082 1090
1083void kvmppc_free_lpid(long lpid) 1091void kvmppc_free_lpid(long lpid)
1084{ 1092{
1085 clear_bit(lpid, lpid_inuse); 1093 clear_bit(lpid, lpid_inuse);
1086} 1094}
1095EXPORT_SYMBOL_GPL(kvmppc_free_lpid);
1087 1096
1088void kvmppc_init_lpid(unsigned long nr_lpids_param) 1097void kvmppc_init_lpid(unsigned long nr_lpids_param)
1089{ 1098{
1090 nr_lpids = min_t(unsigned long, KVMPPC_NR_LPIDS, nr_lpids_param); 1099 nr_lpids = min_t(unsigned long, KVMPPC_NR_LPIDS, nr_lpids_param);
1091 memset(lpid_inuse, 0, sizeof(lpid_inuse)); 1100 memset(lpid_inuse, 0, sizeof(lpid_inuse));
1092} 1101}
1102EXPORT_SYMBOL_GPL(kvmppc_init_lpid);
1093 1103
1094int kvm_arch_init(void *opaque) 1104int kvm_arch_init(void *opaque)
1095{ 1105{