History

KVM: remove kvm_arch_has_vcpu_debugfs()

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.

Paolo Bonzini committed 7 years ago

Commit 741cbba1 parent 17e433b8 files · +6 −44Browse files

Unified · Split

8 files
  1. arch/mips/kvm/mips.c +0 −10
  2. arch/powerpc/kvm/powerpc.c +0 −10
  3. arch/s390/kvm/kvm-s390.c +0 −10
  4. arch/x86/include/asm/kvm_host.h +2 −0
  5. arch/x86/kvm/debugfs.c +0 −5
  6. include/linux/kvm_host.h +2 −1
  7. virt/kvm/arm/arm.c +0 −5
  8. virt/kvm/kvm_main.c +2 −3
arch/mips/kvm/mips.c+0−10
@@ -150,16 +150,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 149 unmodified lines
150150 return 0;
151151 }
152152
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−
163153 void kvm_mips_free_vcpus(struct kvm *kvm)
164154 {
165155 unsigned int i;
arch/powerpc/kvm/powerpc.c+0−10
@@ -457,16 +457,6 @@ err_out: · 456 unmodified lines
457457 return -EINVAL;
458458 }
459459
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−
470460 void kvm_arch_destroy_vm(struct kvm *kvm)
471461 {
472462 unsigned int i;
arch/s390/kvm/kvm-s390.c+0−10
@@ -2516,16 +2516,6 @@ out_err: · 2515 unmodified lines
25162516 return rc;
25172517 }
25182518
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−
25292519 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
25302520 {
25312521 VCPU_EVENT(vcpu, 3, "%s", "free cpu");
arch/x86/include/asm/kvm_host.h+2−0
@@ -35,6 +35,8 @@ · 34 unmodified lines
3535 #include <asm/kvm_vcpu_regs.h>
3636 #include <asm/hyperv-tlfs.h>
3737
38+#define __KVM_HAVE_ARCH_VCPU_DEBUGFS
39+
3840 #define KVM_MAX_VCPUS 288
3941 #define KVM_SOFT_MAX_VCPUS 240
4042 #define KVM_MAX_VCPU_ID 1023
arch/x86/kvm/debugfs.c+0−5
@@ -8,11 +8,6 @@ · 7 unmodified lines
88 #include <linux/debugfs.h>
99 #include "lapic.h"
1010
11−bool kvm_arch_has_vcpu_debugfs(void)
12−{
13− return true;
14−}
15−
1611 static int vcpu_get_timer_advance_ns(void *data, u64 *val)
1712 {
1813 struct kvm_vcpu *vcpu = (struct kvm_vcpu *) data;
include/linux/kvm_host.h+2−1
@@ -861,8 +861,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); · 860 unmodified lines
861861 void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
862862 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
863863
864−bool kvm_arch_has_vcpu_debugfs(void);
864+#ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS
865865 int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu);
866+#endif
866867
867868 int kvm_arch_hardware_enable(void);
868869 void kvm_arch_hardware_disable(void);
virt/kvm/arm/arm.c+0−5
@@ -144,11 +144,6 @@ out_fail_alloc: · 143 unmodified lines
144144 return ret;
145145 }
146146
147−bool kvm_arch_has_vcpu_debugfs(void)
148−{
149− return false;
150−}
151−
152147 int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu)
153148 {
154149 return 0;
virt/kvm/kvm_main.c+2−3
@@ -2617,12 +2617,10 @@ static int create_vcpu_fd(struct kvm_vcpu *vcpu) · 2616 unmodified lines
26172617
26182618 static int kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu)
26192619 {
2620+#ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS
26202621 char dir_name[ITOA_MAX_LEN * 2];
26212622 int ret;
26222623
2623− if (!kvm_arch_has_vcpu_debugfs())
2624− return 0;
2625−
26262624 if (!debugfs_initialized())
26272625 return 0;
26282626
@@ -2637,6 +2635,7 @@ static int kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) · 8 unmodified lines
26372635 debugfs_remove_recursive(vcpu->debugfs_dentry);
26382636 return ret;
26392637 }
2638+#endif
26402639
26412640 return 0;
26422641 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t