There is no need for this function as all arches have to implement kvm_arch_create_vcpu_debugfs() no matter what. A #define symbol let us actually simplify the code.
Unified · Split
| @@ -150,16 +150,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 149 unmodified lines | |||
| 150 | return 0; | 150 | return 0; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | bool kvm_arch_has_vcpu_debugfs(void) | ||
| 154 | { | ||
| 155 | return false; | ||
| 156 | } | ||
| 157 | |||
| 158 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | ||
| 159 | { | ||
| 160 | return 0; | ||
| 161 | } | ||
| 162 | |||
| 163 | void kvm_mips_free_vcpus(struct kvm *kvm) | 153 | void kvm_mips_free_vcpus(struct kvm *kvm) |
| 164 | { | 154 | { |
| 165 | unsigned int i; | 155 | unsigned int i; |
| @@ -457,16 +457,6 @@ err_out: · 456 unmodified lines | |||
| 457 | return -EINVAL; | 457 | return -EINVAL; |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | bool kvm_arch_has_vcpu_debugfs(void) | ||
| 461 | { | ||
| 462 | return false; | ||
| 463 | } | ||
| 464 | |||
| 465 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | ||
| 466 | { | ||
| 467 | return 0; | ||
| 468 | } | ||
| 469 | |||
| 470 | void kvm_arch_destroy_vm(struct kvm *kvm) | 460 | void kvm_arch_destroy_vm(struct kvm *kvm) |
| 471 | { | 461 | { |
| 472 | unsigned int i; | 462 | unsigned int i; |
| @@ -2516,16 +2516,6 @@ out_err: · 2515 unmodified lines | |||
| 2516 | return rc; | 2516 | return rc; |
| 2517 | } | 2517 | } |
| 2518 | 2518 | ||
| 2519 | bool kvm_arch_has_vcpu_debugfs(void) | ||
| 2520 | { | ||
| 2521 | return false; | ||
| 2522 | } | ||
| 2523 | |||
| 2524 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | ||
| 2525 | { | ||
| 2526 | return 0; | ||
| 2527 | } | ||
| 2528 | |||
| 2529 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) | 2519 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) |
| 2530 | { | 2520 | { |
| 2531 | VCPU_EVENT(vcpu, 3, "%s", "free cpu"); | 2521 | VCPU_EVENT(vcpu, 3, "%s", "free cpu"); |
| @@ -35,6 +35,8 @@ · 34 unmodified lines | |||
| 35 | #include <asm/kvm_vcpu_regs.h> | 35 | #include <asm/kvm_vcpu_regs.h> |
| 36 | #include <asm/hyperv-tlfs.h> | 36 | #include <asm/hyperv-tlfs.h> |
| 37 | 37 | ||
| 38 | #define __KVM_HAVE_ARCH_VCPU_DEBUGFS | ||
| 39 | |||
| 38 | #define KVM_MAX_VCPUS 288 | 40 | #define KVM_MAX_VCPUS 288 |
| 39 | #define KVM_SOFT_MAX_VCPUS 240 | 41 | #define KVM_SOFT_MAX_VCPUS 240 |
| 40 | #define KVM_MAX_VCPU_ID 1023 | 42 | #define KVM_MAX_VCPU_ID 1023 |
| @@ -8,11 +8,6 @@ · 7 unmodified lines | |||
| 8 | #include <linux/debugfs.h> | 8 | #include <linux/debugfs.h> |
| 9 | #include "lapic.h" | 9 | #include "lapic.h" |
| 10 | 10 | ||
| 11 | bool kvm_arch_has_vcpu_debugfs(void) | ||
| 12 | { | ||
| 13 | return true; | ||
| 14 | } | ||
| 15 | |||
| 16 | static int vcpu_get_timer_advance_ns(void *data, u64 *val) | 11 | static int vcpu_get_timer_advance_ns(void *data, u64 *val) |
| 17 | { | 12 | { |
| 18 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *) data; | 13 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *) data; |
| @@ -861,8 +861,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); · 860 unmodified lines | |||
| 861 | void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu); | 861 | void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu); |
| 862 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); | 862 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 863 | 863 | ||
| 864 | bool kvm_arch_has_vcpu_debugfs(void); | 864 | #ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS |
| 865 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu); | 865 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu); |
| 866 | #endif | ||
| 866 | 867 | ||
| 867 | int kvm_arch_hardware_enable(void); | 868 | int kvm_arch_hardware_enable(void); |
| 868 | void kvm_arch_hardware_disable(void); | 869 | void kvm_arch_hardware_disable(void); |
| @@ -144,11 +144,6 @@ out_fail_alloc: · 143 unmodified lines | |||
| 144 | return ret; | 144 | return ret; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | bool kvm_arch_has_vcpu_debugfs(void) | ||
| 148 | { | ||
| 149 | return false; | ||
| 150 | } | ||
| 151 | |||
| 152 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | 147 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) |
| 153 | { | 148 | { |
| 154 | return 0; | 149 | return 0; |
| @@ -2617,12 +2617,10 @@ static int create_vcpu_fd(struct kvm_vcpu *vcpu) · 2616 unmodified lines | |||
| 2617 | 2617 | ||
| 2618 | static int kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | 2618 | static int kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) |
| 2619 | { | 2619 | { |
| 2620 | #ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS | ||
| 2620 | char dir_name[ITOA_MAX_LEN * 2]; | 2621 | char dir_name[ITOA_MAX_LEN * 2]; |
| 2621 | int ret; | 2622 | int ret; |
| 2622 | 2623 | ||
| 2623 | if (!kvm_arch_has_vcpu_debugfs()) | ||
| 2624 | return 0; | ||
| 2625 | |||
| 2626 | if (!debugfs_initialized()) | 2624 | if (!debugfs_initialized()) |
| 2627 | return 0; | 2625 | return 0; |
| 2628 | 2626 | ||
| @@ -2637,6 +2635,7 @@ static int kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) · 8 unmodified lines | |||
| 2637 | debugfs_remove_recursive(vcpu->debugfs_dentry); | 2635 | debugfs_remove_recursive(vcpu->debugfs_dentry); |
| 2638 | return ret; | 2636 | return ret; |
| 2639 | } | 2637 | } |
| 2638 | #endif | ||
| 2640 | 2639 | ||
| 2641 | return 0; | 2640 | return 0; |
| 2642 | } | 2641 | } |