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 | 363 | static inline bool kvm_arch_requires_vhe(void) { return false; } |
| 364 | 364 | static inline void kvm_arch_hardware_unsetup(void) {} |
| 365 | 365 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} |
| 366 | −static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {} | |
| 367 | 366 | static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} |
| 368 | 367 | static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} |
| 369 | 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 | 54 | int __attribute_const__ kvm_target_cpu(void); |
| 55 | 55 | int kvm_reset_vcpu(struct kvm_vcpu *vcpu); |
| 56 | 56 | void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 57 | −void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); | |
| 58 | 57 | int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext); |
| 59 | 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 | 204 | return true; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | −void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) | |
| 208 | −{ | |
| 209 | − | |
| 210 | −} | |
| 211 | − | |
| 212 | 207 | void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu) |
| 213 | 208 | { |
| 214 | 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 | 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 | 1233 | int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, |
| 1244 | 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 | 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 | 804 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
| 815 | 805 | { |
| 816 | 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 | 915 | static inline void kvm_arch_hardware_disable(void) {} |
| 916 | 916 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} |
| 917 | −static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {} | |
| 918 | 917 | static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} |
| 919 | 918 | static inline void kvm_arch_free_memslot(struct kvm *kvm, |
| 920 | 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 | 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 | 2703 | /* needs disabled preemption to protect from TOD sync and vcpu_load/put */ |
| 2709 | 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 | 9575 | struct static_key kvm_no_apic_vcpu __read_mostly; |
| 9576 | 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 | 9578 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) |
| 9589 | 9579 | { |
| 9590 | 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 | 864 | int kvm_arch_init(void *opaque); |
| 865 | 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 | 867 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu); |
| 871 | 868 | |
| 872 | 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 | 360 | preempt_enable(); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | −int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |
| 364 | −{ | |
| 365 | − return 0; | |
| 366 | −} | |
| 367 | − | |
| 368 | 363 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
| 369 | 364 | { |
| 370 | 365 | int *last_ran; |
| @@ -324,7 +324,6 @@ void kvm_reload_remote_mmus(struct kvm *kvm) · 323 unmodified lines | ||
| 324 | 324 | static int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) |
| 325 | 325 | { |
| 326 | 326 | struct page *page; |
| 327 | − int r; | |
| 328 | 327 | |
| 329 | 328 | mutex_init(&vcpu->mutex); |
| 330 | 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 | 337 | INIT_LIST_HEAD(&vcpu->blocked_vcpu_list); |
| 339 | 338 | |
| 340 | 339 | page = alloc_page(GFP_KERNEL | __GFP_ZERO); |
| 341 | − if (!page) { | |
| 342 | − r = -ENOMEM; | |
| 343 | − goto fail; | |
| 344 | − } | |
| 340 | + if (!page) | |
| 341 | + return -ENOMEM; | |
| 345 | 342 | vcpu->run = page_address(page); |
| 346 | 343 | |
| 347 | 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 | 347 | vcpu->ready = false; |
| 351 | 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 | 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 | 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 | 358 | * descriptors are already gone. |
| 370 | 359 | */ |
| 371 | 360 | put_pid(rcu_dereference_protected(vcpu->pid, 1)); |
| 372 | − kvm_arch_vcpu_uninit(vcpu); | |
| 373 | 361 | free_page((unsigned long)vcpu->run); |
| 374 | 362 | } |
| 375 | 363 | |