powerpc.c (7c973a2ebb8fb9c8ee2ae9647f9ad7b0ad58a3e6) powerpc.c (f61c94bb99ca4253ac5dd57750e1af209a4beb7a)
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

--- 286 unchanged lines hidden (view full) ---

295
296int kvm_dev_ioctl_check_extension(long ext)
297{
298 int r;
299
300 switch (ext) {
301#ifdef CONFIG_BOOKE
302 case KVM_CAP_PPC_BOOKE_SREGS:
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

--- 286 unchanged lines hidden (view full) ---

295
296int kvm_dev_ioctl_check_extension(long ext)
297{
298 int r;
299
300 switch (ext) {
301#ifdef CONFIG_BOOKE
302 case KVM_CAP_PPC_BOOKE_SREGS:
303 case KVM_CAP_PPC_BOOKE_WATCHDOG:
303#else
304 case KVM_CAP_PPC_SEGSTATE:
305 case KVM_CAP_PPC_HIOR:
306 case KVM_CAP_PPC_PAPR:
307#endif
308 case KVM_CAP_PPC_UNSET_IRQ:
309 case KVM_CAP_PPC_IRQ_LEVEL:
310 case KVM_CAP_ENABLE_CAP:

--- 160 unchanged lines hidden (view full) ---

471 vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer);
472 tasklet_schedule(&vcpu->arch.tasklet);
473
474 return HRTIMER_NORESTART;
475}
476
477int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
478{
304#else
305 case KVM_CAP_PPC_SEGSTATE:
306 case KVM_CAP_PPC_HIOR:
307 case KVM_CAP_PPC_PAPR:
308#endif
309 case KVM_CAP_PPC_UNSET_IRQ:
310 case KVM_CAP_PPC_IRQ_LEVEL:
311 case KVM_CAP_ENABLE_CAP:

--- 160 unchanged lines hidden (view full) ---

472 vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer);
473 tasklet_schedule(&vcpu->arch.tasklet);
474
475 return HRTIMER_NORESTART;
476}
477
478int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
479{
480 int ret;
481
479 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
480 tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
481 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
482 vcpu->arch.dec_expires = ~(u64)0;
483
484#ifdef CONFIG_KVM_EXIT_TIMING
485 mutex_init(&vcpu->arch.exit_timing_lock);
486#endif
482 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
483 tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
484 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
485 vcpu->arch.dec_expires = ~(u64)0;
486
487#ifdef CONFIG_KVM_EXIT_TIMING
488 mutex_init(&vcpu->arch.exit_timing_lock);
489#endif
487
488 return 0;
490 ret = kvmppc_subarch_vcpu_init(vcpu);
491 return ret;
489}
490
491void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
492{
493 kvmppc_mmu_destroy(vcpu);
492}
493
494void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
495{
496 kvmppc_mmu_destroy(vcpu);
497 kvmppc_subarch_vcpu_uninit(vcpu);
494}
495
496void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
497{
498#ifdef CONFIG_BOOKE
499 /*
500 * vrsave (formerly usprg0) isn't used by Linux, but may
501 * be used by the guest.

--- 228 unchanged lines hidden (view full) ---

730 case KVM_CAP_PPC_OSI:
731 r = 0;
732 vcpu->arch.osi_enabled = true;
733 break;
734 case KVM_CAP_PPC_PAPR:
735 r = 0;
736 vcpu->arch.papr_enabled = true;
737 break;
498}
499
500void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
501{
502#ifdef CONFIG_BOOKE
503 /*
504 * vrsave (formerly usprg0) isn't used by Linux, but may
505 * be used by the guest.

--- 228 unchanged lines hidden (view full) ---

734 case KVM_CAP_PPC_OSI:
735 r = 0;
736 vcpu->arch.osi_enabled = true;
737 break;
738 case KVM_CAP_PPC_PAPR:
739 r = 0;
740 vcpu->arch.papr_enabled = true;
741 break;
742#ifdef CONFIG_BOOKE
743 case KVM_CAP_PPC_BOOKE_WATCHDOG:
744 r = 0;
745 vcpu->arch.watchdog_enabled = true;
746 break;
747#endif
738#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
739 case KVM_CAP_SW_TLB: {
740 struct kvm_config_tlb cfg;
741 void __user *user_ptr = (void __user *)(uintptr_t)cap->args[0];
742
743 r = -EFAULT;
744 if (copy_from_user(&cfg, user_ptr, sizeof(cfg)))
745 break;

--- 249 unchanged lines hidden ---
748#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
749 case KVM_CAP_SW_TLB: {
750 struct kvm_config_tlb cfg;
751 void __user *user_ptr = (void __user *)(uintptr_t)cap->args[0];
752
753 r = -EFAULT;
754 if (copy_from_user(&cfg, user_ptr, sizeof(cfg)))
755 break;

--- 249 unchanged lines hidden ---