diff options
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index f8ac26599f6d..61ae0faf0d24 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c | |||
@@ -40,6 +40,13 @@ | |||
40 | static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr, | 40 | static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr, |
41 | ulong msr); | 41 | ulong msr); |
42 | 42 | ||
43 | /* Some compatibility defines */ | ||
44 | #ifdef CONFIG_PPC_BOOK3S_32 | ||
45 | #define MSR_USER32 MSR_USER | ||
46 | #define MSR_USER64 MSR_USER | ||
47 | #define HW_PAGE_SIZE PAGE_SIZE | ||
48 | #endif | ||
49 | |||
43 | struct kvm_stats_debugfs_item debugfs_entries[] = { | 50 | struct kvm_stats_debugfs_item debugfs_entries[] = { |
44 | { "exits", VCPU_STAT(sum_exits) }, | 51 | { "exits", VCPU_STAT(sum_exits) }, |
45 | { "mmio", VCPU_STAT(mmio_exits) }, | 52 | { "mmio", VCPU_STAT(mmio_exits) }, |
@@ -348,11 +355,14 @@ void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr) | |||
348 | { | 355 | { |
349 | vcpu->arch.hflags &= ~BOOK3S_HFLAG_SLB; | 356 | vcpu->arch.hflags &= ~BOOK3S_HFLAG_SLB; |
350 | vcpu->arch.pvr = pvr; | 357 | vcpu->arch.pvr = pvr; |
358 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
351 | if ((pvr >= 0x330000) && (pvr < 0x70330000)) { | 359 | if ((pvr >= 0x330000) && (pvr < 0x70330000)) { |
352 | kvmppc_mmu_book3s_64_init(vcpu); | 360 | kvmppc_mmu_book3s_64_init(vcpu); |
353 | to_book3s(vcpu)->hior = 0xfff00000; | 361 | to_book3s(vcpu)->hior = 0xfff00000; |
354 | to_book3s(vcpu)->msr_mask = 0xffffffffffffffffULL; | 362 | to_book3s(vcpu)->msr_mask = 0xffffffffffffffffULL; |
355 | } else { | 363 | } else |
364 | #endif | ||
365 | { | ||
356 | kvmppc_mmu_book3s_32_init(vcpu); | 366 | kvmppc_mmu_book3s_32_init(vcpu); |
357 | to_book3s(vcpu)->hior = 0; | 367 | to_book3s(vcpu)->hior = 0; |
358 | to_book3s(vcpu)->msr_mask = 0xffffffffULL; | 368 | to_book3s(vcpu)->msr_mask = 0xffffffffULL; |
@@ -369,6 +379,11 @@ void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr) | |||
369 | really needs them in a VM on Cell and force disable them. */ | 379 | really needs them in a VM on Cell and force disable them. */ |
370 | if (!strcmp(cur_cpu_spec->platform, "ppc-cell-be")) | 380 | if (!strcmp(cur_cpu_spec->platform, "ppc-cell-be")) |
371 | to_book3s(vcpu)->msr_mask &= ~(MSR_FE0 | MSR_FE1); | 381 | to_book3s(vcpu)->msr_mask &= ~(MSR_FE0 | MSR_FE1); |
382 | |||
383 | #ifdef CONFIG_PPC_BOOK3S_32 | ||
384 | /* 32 bit Book3S always has 32 byte dcbz */ | ||
385 | vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; | ||
386 | #endif | ||
372 | } | 387 | } |
373 | 388 | ||
374 | /* Book3s_32 CPUs always have 32 bytes cache line size, which Linux assumes. To | 389 | /* Book3s_32 CPUs always have 32 bytes cache line size, which Linux assumes. To |
@@ -1212,8 +1227,13 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | |||
1212 | 1227 | ||
1213 | vcpu->arch.host_retip = kvm_return_point; | 1228 | vcpu->arch.host_retip = kvm_return_point; |
1214 | vcpu->arch.host_msr = mfmsr(); | 1229 | vcpu->arch.host_msr = mfmsr(); |
1230 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
1215 | /* default to book3s_64 (970fx) */ | 1231 | /* default to book3s_64 (970fx) */ |
1216 | vcpu->arch.pvr = 0x3C0301; | 1232 | vcpu->arch.pvr = 0x3C0301; |
1233 | #else | ||
1234 | /* default to book3s_32 (750) */ | ||
1235 | vcpu->arch.pvr = 0x84202; | ||
1236 | #endif | ||
1217 | kvmppc_set_pvr(vcpu, vcpu->arch.pvr); | 1237 | kvmppc_set_pvr(vcpu, vcpu->arch.pvr); |
1218 | vcpu_book3s->slb_nr = 64; | 1238 | vcpu_book3s->slb_nr = 64; |
1219 | 1239 | ||
@@ -1221,7 +1241,11 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | |||
1221 | vcpu->arch.trampoline_lowmem = kvmppc_trampoline_lowmem; | 1241 | vcpu->arch.trampoline_lowmem = kvmppc_trampoline_lowmem; |
1222 | vcpu->arch.trampoline_enter = kvmppc_trampoline_enter; | 1242 | vcpu->arch.trampoline_enter = kvmppc_trampoline_enter; |
1223 | vcpu->arch.highmem_handler = (ulong)kvmppc_handler_highmem; | 1243 | vcpu->arch.highmem_handler = (ulong)kvmppc_handler_highmem; |
1244 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
1224 | vcpu->arch.rmcall = *(ulong*)kvmppc_rmcall; | 1245 | vcpu->arch.rmcall = *(ulong*)kvmppc_rmcall; |
1246 | #else | ||
1247 | vcpu->arch.rmcall = (ulong)kvmppc_rmcall; | ||
1248 | #endif | ||
1225 | 1249 | ||
1226 | vcpu->arch.shadow_msr = MSR_USER64; | 1250 | vcpu->arch.shadow_msr = MSR_USER64; |
1227 | 1251 | ||