diff options
Diffstat (limited to 'arch/powerpc/kvm/e500.c')
-rw-r--r-- | arch/powerpc/kvm/e500.c | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c index ce6b73c29612..497b142f651c 100644 --- a/arch/powerpc/kvm/e500.c +++ b/arch/powerpc/kvm/e500.c | |||
@@ -305,7 +305,7 @@ void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu) | |||
305 | { | 305 | { |
306 | } | 306 | } |
307 | 307 | ||
308 | void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | 308 | static void kvmppc_core_vcpu_load_e500(struct kvm_vcpu *vcpu, int cpu) |
309 | { | 309 | { |
310 | kvmppc_booke_vcpu_load(vcpu, cpu); | 310 | kvmppc_booke_vcpu_load(vcpu, cpu); |
311 | 311 | ||
@@ -313,7 +313,7 @@ void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
313 | kvmppc_e500_recalc_shadow_pid(to_e500(vcpu)); | 313 | kvmppc_e500_recalc_shadow_pid(to_e500(vcpu)); |
314 | } | 314 | } |
315 | 315 | ||
316 | void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) | 316 | static void kvmppc_core_vcpu_put_e500(struct kvm_vcpu *vcpu) |
317 | { | 317 | { |
318 | #ifdef CONFIG_SPE | 318 | #ifdef CONFIG_SPE |
319 | if (vcpu->arch.shadow_msr & MSR_SPE) | 319 | if (vcpu->arch.shadow_msr & MSR_SPE) |
@@ -367,7 +367,8 @@ int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu) | |||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | 370 | static int kvmppc_core_get_sregs_e500(struct kvm_vcpu *vcpu, |
371 | struct kvm_sregs *sregs) | ||
371 | { | 372 | { |
372 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); | 373 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); |
373 | 374 | ||
@@ -388,9 +389,11 @@ void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | |||
388 | 389 | ||
389 | kvmppc_get_sregs_ivor(vcpu, sregs); | 390 | kvmppc_get_sregs_ivor(vcpu, sregs); |
390 | kvmppc_get_sregs_e500_tlb(vcpu, sregs); | 391 | kvmppc_get_sregs_e500_tlb(vcpu, sregs); |
392 | return 0; | ||
391 | } | 393 | } |
392 | 394 | ||
393 | int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | 395 | static int kvmppc_core_set_sregs_e500(struct kvm_vcpu *vcpu, |
396 | struct kvm_sregs *sregs) | ||
394 | { | 397 | { |
395 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); | 398 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); |
396 | int ret; | 399 | int ret; |
@@ -425,21 +428,22 @@ int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | |||
425 | return kvmppc_set_sregs_ivor(vcpu, sregs); | 428 | return kvmppc_set_sregs_ivor(vcpu, sregs); |
426 | } | 429 | } |
427 | 430 | ||
428 | int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, | 431 | static int kvmppc_get_one_reg_e500(struct kvm_vcpu *vcpu, u64 id, |
429 | union kvmppc_one_reg *val) | 432 | union kvmppc_one_reg *val) |
430 | { | 433 | { |
431 | int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); | 434 | int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); |
432 | return r; | 435 | return r; |
433 | } | 436 | } |
434 | 437 | ||
435 | int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, | 438 | static int kvmppc_set_one_reg_e500(struct kvm_vcpu *vcpu, u64 id, |
436 | union kvmppc_one_reg *val) | 439 | union kvmppc_one_reg *val) |
437 | { | 440 | { |
438 | int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); | 441 | int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); |
439 | return r; | 442 | return r; |
440 | } | 443 | } |
441 | 444 | ||
442 | struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | 445 | static struct kvm_vcpu *kvmppc_core_vcpu_create_e500(struct kvm *kvm, |
446 | unsigned int id) | ||
443 | { | 447 | { |
444 | struct kvmppc_vcpu_e500 *vcpu_e500; | 448 | struct kvmppc_vcpu_e500 *vcpu_e500; |
445 | struct kvm_vcpu *vcpu; | 449 | struct kvm_vcpu *vcpu; |
@@ -481,7 +485,7 @@ out: | |||
481 | return ERR_PTR(err); | 485 | return ERR_PTR(err); |
482 | } | 486 | } |
483 | 487 | ||
484 | void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) | 488 | static void kvmppc_core_vcpu_free_e500(struct kvm_vcpu *vcpu) |
485 | { | 489 | { |
486 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); | 490 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); |
487 | 491 | ||
@@ -492,15 +496,32 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) | |||
492 | kmem_cache_free(kvm_vcpu_cache, vcpu_e500); | 496 | kmem_cache_free(kvm_vcpu_cache, vcpu_e500); |
493 | } | 497 | } |
494 | 498 | ||
495 | int kvmppc_core_init_vm(struct kvm *kvm) | 499 | static int kvmppc_core_init_vm_e500(struct kvm *kvm) |
496 | { | 500 | { |
497 | return 0; | 501 | return 0; |
498 | } | 502 | } |
499 | 503 | ||
500 | void kvmppc_core_destroy_vm(struct kvm *kvm) | 504 | static void kvmppc_core_destroy_vm_e500(struct kvm *kvm) |
501 | { | 505 | { |
502 | } | 506 | } |
503 | 507 | ||
508 | static struct kvmppc_ops kvm_ops_e500 = { | ||
509 | .get_sregs = kvmppc_core_get_sregs_e500, | ||
510 | .set_sregs = kvmppc_core_set_sregs_e500, | ||
511 | .get_one_reg = kvmppc_get_one_reg_e500, | ||
512 | .set_one_reg = kvmppc_set_one_reg_e500, | ||
513 | .vcpu_load = kvmppc_core_vcpu_load_e500, | ||
514 | .vcpu_put = kvmppc_core_vcpu_put_e500, | ||
515 | .vcpu_create = kvmppc_core_vcpu_create_e500, | ||
516 | .vcpu_free = kvmppc_core_vcpu_free_e500, | ||
517 | .mmu_destroy = kvmppc_mmu_destroy_e500, | ||
518 | .init_vm = kvmppc_core_init_vm_e500, | ||
519 | .destroy_vm = kvmppc_core_destroy_vm_e500, | ||
520 | .emulate_op = kvmppc_core_emulate_op_e500, | ||
521 | .emulate_mtspr = kvmppc_core_emulate_mtspr_e500, | ||
522 | .emulate_mfspr = kvmppc_core_emulate_mfspr_e500, | ||
523 | }; | ||
524 | |||
504 | static int __init kvmppc_e500_init(void) | 525 | static int __init kvmppc_e500_init(void) |
505 | { | 526 | { |
506 | int r, i; | 527 | int r, i; |
@@ -512,11 +533,11 @@ static int __init kvmppc_e500_init(void) | |||
512 | 533 | ||
513 | r = kvmppc_core_check_processor_compat(); | 534 | r = kvmppc_core_check_processor_compat(); |
514 | if (r) | 535 | if (r) |
515 | return r; | 536 | goto err_out; |
516 | 537 | ||
517 | r = kvmppc_booke_init(); | 538 | r = kvmppc_booke_init(); |
518 | if (r) | 539 | if (r) |
519 | return r; | 540 | goto err_out; |
520 | 541 | ||
521 | /* copy extra E500 exception handlers */ | 542 | /* copy extra E500 exception handlers */ |
522 | ivor[0] = mfspr(SPRN_IVOR32); | 543 | ivor[0] = mfspr(SPRN_IVOR32); |
@@ -534,11 +555,19 @@ static int __init kvmppc_e500_init(void) | |||
534 | flush_icache_range(kvmppc_booke_handlers, kvmppc_booke_handlers + | 555 | flush_icache_range(kvmppc_booke_handlers, kvmppc_booke_handlers + |
535 | ivor[max_ivor] + handler_len); | 556 | ivor[max_ivor] + handler_len); |
536 | 557 | ||
537 | return kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); | 558 | r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); |
559 | if (r) | ||
560 | goto err_out; | ||
561 | kvm_ops_e500.owner = THIS_MODULE; | ||
562 | kvmppc_pr_ops = &kvm_ops_e500; | ||
563 | |||
564 | err_out: | ||
565 | return r; | ||
538 | } | 566 | } |
539 | 567 | ||
540 | static void __exit kvmppc_e500_exit(void) | 568 | static void __exit kvmppc_e500_exit(void) |
541 | { | 569 | { |
570 | kvmppc_pr_ops = NULL; | ||
542 | kvmppc_booke_exit(); | 571 | kvmppc_booke_exit(); |
543 | } | 572 | } |
544 | 573 | ||