Remove kvm_arch_vcpu_init() and kvm_arch_vcpu_uninit() now that all arch specific implementations are nops.
Unified · Split
| @@ -363,7 +363,6 @@ struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr); · 362 unmodified lines | |||
| 363 | static inline bool kvm_arch_requires_vhe(void) { return false; } | 363 | static inline bool kvm_arch_requires_vhe(void) { return false; } |
| 364 | static inline void kvm_arch_hardware_unsetup(void) {} | 364 | static inline void kvm_arch_hardware_unsetup(void) {} |
| 365 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} | 365 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} |
| 366 | static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {} | ||
| 367 | static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} | 366 | static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} |
| 368 | static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} | 367 | static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} |
| 369 | static inline void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu) {} | 368 | static inline void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu) {} |
| @@ -54,7 +54,6 @@ int kvm_arm_init_sve(void); · 53 unmodified lines | |||
| 54 | int __attribute_const__ kvm_target_cpu(void); | 54 | int __attribute_const__ kvm_target_cpu(void); |
| 55 | int kvm_reset_vcpu(struct kvm_vcpu *vcpu); | 55 | int kvm_reset_vcpu(struct kvm_vcpu *vcpu); |
| 56 | void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu); | 56 | void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 57 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); | ||
| 58 | int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext); | 57 | int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext); |
| 59 | void __extended_idmap_trampoline(phys_addr_t boot_pgd, phys_addr_t idmap_start); | 58 | void __extended_idmap_trampoline(phys_addr_t boot_pgd, phys_addr_t idmap_start); |
| 60 | 59 | ||
| @@ -204,11 +204,6 @@ bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu) · 203 unmodified lines | |||
| 204 | return true; | 204 | return true; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) | ||
| 208 | { | ||
| 209 | |||
| 210 | } | ||
| 211 | |||
| 212 | void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu) | 207 | void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu) |
| 213 | { | 208 | { |
| 214 | kfree(vcpu->arch.sve_state); | 209 | kfree(vcpu->arch.sve_state); |
| @@ -1230,16 +1230,6 @@ static enum hrtimer_restart kvm_mips_comparecount_wakeup(struct hrtimer *timer) · 1229 unmodified lines | |||
| 1230 | return kvm_mips_count_timeout(vcpu); | 1230 | return kvm_mips_count_timeout(vcpu); |
| 1231 | } | 1231 | } |
| 1232 | 1232 | ||
| 1233 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | ||
| 1234 | { | ||
| 1235 | return 0; | ||
| 1236 | } | ||
| 1237 | |||
| 1238 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) | ||
| 1239 | { | ||
| 1240 | |||
| 1241 | } | ||
| 1242 | |||
| 1243 | int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, | 1233 | int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, |
| 1244 | struct kvm_translation *tr) | 1234 | struct kvm_translation *tr) |
| 1245 | { | 1235 | { |
| @@ -801,16 +801,6 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) · 800 unmodified lines | |||
| 801 | return kvmppc_core_pending_dec(vcpu); | 801 | return kvmppc_core_pending_dec(vcpu); |
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | ||
| 805 | { | ||
| 806 | return 0; | ||
| 807 | } | ||
| 808 | |||
| 809 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) | ||
| 810 | { | ||
| 811 | |||
| 812 | } | ||
| 813 | |||
| 814 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | 804 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
| 815 | { | 805 | { |
| 816 | #ifdef CONFIG_BOOKE | 806 | #ifdef CONFIG_BOOKE |
| @@ -914,7 +914,6 @@ extern int kvm_s390_gisc_unregister(struct kvm *kvm, u32 gisc); · 913 unmodified lines | |||
| 914 | 914 | ||
| 915 | static inline void kvm_arch_hardware_disable(void) {} | 915 | static inline void kvm_arch_hardware_disable(void) {} |
| 916 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} | 916 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} |
| 917 | static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {} | ||
| 918 | static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} | 917 | static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} |
| 919 | static inline void kvm_arch_free_memslot(struct kvm *kvm, | 918 | static inline void kvm_arch_free_memslot(struct kvm *kvm, |
| 920 | struct kvm_memory_slot *free, struct kvm_memory_slot *dont) {} | 919 | struct kvm_memory_slot *free, struct kvm_memory_slot *dont) {} |
| @@ -2700,11 +2700,6 @@ static int sca_can_add_vcpu(struct kvm *kvm, unsigned int id) · 2699 unmodified lines | |||
| 2700 | return rc == 0 && id < KVM_S390_ESCA_CPU_SLOTS; | 2700 | return rc == 0 && id < KVM_S390_ESCA_CPU_SLOTS; |
| 2701 | } | 2701 | } |
| 2702 | 2702 | ||
| 2703 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | ||
| 2704 | { | ||
| 2705 | return 0; | ||
| 2706 | } | ||
| 2707 | |||
| 2708 | /* needs disabled preemption to protect from TOD sync and vcpu_load/put */ | 2703 | /* needs disabled preemption to protect from TOD sync and vcpu_load/put */ |
| 2709 | static void __start_cpu_timer_accounting(struct kvm_vcpu *vcpu) | 2704 | static void __start_cpu_timer_accounting(struct kvm_vcpu *vcpu) |
| 2710 | { | 2705 | { |
| @@ -9575,16 +9575,6 @@ bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu) · 9574 unmodified lines | |||
| 9575 | struct static_key kvm_no_apic_vcpu __read_mostly; | 9575 | struct static_key kvm_no_apic_vcpu __read_mostly; |
| 9576 | EXPORT_SYMBOL_GPL(kvm_no_apic_vcpu); | 9576 | EXPORT_SYMBOL_GPL(kvm_no_apic_vcpu); |
| 9577 | 9577 | ||
| 9578 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | ||
| 9579 | { | ||
| 9580 | return 0; | ||
| 9581 | } | ||
| 9582 | |||
| 9583 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) | ||
| 9584 | { | ||
| 9585 | |||
| 9586 | } | ||
| 9587 | |||
| 9588 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) | 9578 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) |
| 9589 | { | 9579 | { |
| 9590 | struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); | 9580 | struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); |
| @@ -864,9 +864,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); · 863 unmodified lines | |||
| 864 | int kvm_arch_init(void *opaque); | 864 | int kvm_arch_init(void *opaque); |
| 865 | void kvm_arch_exit(void); | 865 | void kvm_arch_exit(void); |
| 866 | 866 | ||
| 867 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); | ||
| 868 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); | ||
| 869 | |||
| 870 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu); | 867 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu); |
| 871 | 868 | ||
| 872 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); | 869 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); |
| @@ -360,11 +360,6 @@ void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) · 359 unmodified lines | |||
| 360 | preempt_enable(); | 360 | preempt_enable(); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | ||
| 364 | { | ||
| 365 | return 0; | ||
| 366 | } | ||
| 367 | |||
| 368 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | 363 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
| 369 | { | 364 | { |
| 370 | int *last_ran; | 365 | int *last_ran; |
| @@ -324,7 +324,6 @@ void kvm_reload_remote_mmus(struct kvm *kvm) · 323 unmodified lines | |||
| 324 | static int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) | 324 | static int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) |
| 325 | { | 325 | { |
| 326 | struct page *page; | 326 | struct page *page; |
| 327 | int r; | ||
| 328 | 327 | ||
| 329 | mutex_init(&vcpu->mutex); | 328 | mutex_init(&vcpu->mutex); |
| 330 | vcpu->cpu = -1; | 329 | vcpu->cpu = -1; |
| @@ -338,10 +337,8 @@ static int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) · 7 unmodified lines | |||
| 338 | INIT_LIST_HEAD(&vcpu->blocked_vcpu_list); | 337 | INIT_LIST_HEAD(&vcpu->blocked_vcpu_list); |
| 339 | 338 | ||
| 340 | page = alloc_page(GFP_KERNEL | __GFP_ZERO); | 339 | page = alloc_page(GFP_KERNEL | __GFP_ZERO); |
| 341 | if (!page) { | 340 | if (!page) |
| 342 | r = -ENOMEM; | 341 | return -ENOMEM; |
| 343 | goto fail; | ||
| 344 | } | ||
| 345 | vcpu->run = page_address(page); | 342 | vcpu->run = page_address(page); |
| 346 | 343 | ||
| 347 | kvm_vcpu_set_in_spin_loop(vcpu, false); | 344 | kvm_vcpu_set_in_spin_loop(vcpu, false); |
| @@ -350,15 +347,7 @@ static int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) · 2 unmodified lines | |||
| 350 | vcpu->ready = false; | 347 | vcpu->ready = false; |
| 351 | preempt_notifier_init(&vcpu->preempt_notifier, &kvm_preempt_ops); | 348 | preempt_notifier_init(&vcpu->preempt_notifier, &kvm_preempt_ops); |
| 352 | 349 | ||
| 353 | r = kvm_arch_vcpu_init(vcpu); | ||
| 354 | if (r < 0) | ||
| 355 | goto fail_free_run; | ||
| 356 | return 0; | 350 | return 0; |
| 357 | |||
| 358 | fail_free_run: | ||
| 359 | free_page((unsigned long)vcpu->run); | ||
| 360 | fail: | ||
| 361 | return r; | ||
| 362 | } | 351 | } |
| 363 | 352 | ||
| 364 | static void kvm_vcpu_uninit(struct kvm_vcpu *vcpu) | 353 | static void kvm_vcpu_uninit(struct kvm_vcpu *vcpu) |
| @@ -369,7 +358,6 @@ static void kvm_vcpu_uninit(struct kvm_vcpu *vcpu) · 4 unmodified lines | |||
| 369 | * descriptors are already gone. | 358 | * descriptors are already gone. |
| 370 | */ | 359 | */ |
| 371 | put_pid(rcu_dereference_protected(vcpu->pid, 1)); | 360 | put_pid(rcu_dereference_protected(vcpu->pid, 1)); |
| 372 | kvm_arch_vcpu_uninit(vcpu); | ||
| 373 | free_page((unsigned long)vcpu->run); | 361 | free_page((unsigned long)vcpu->run); |
| 374 | } | 362 | } |
| 375 | 363 | ||