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
150 return 0;150 return 0;
151}151}
152 152
153bool kvm_arch_has_vcpu_debugfs(void)
154{
155 return false;
156}
157
158int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu)
159{
160 return 0;
161}
162
163void kvm_mips_free_vcpus(struct kvm *kvm)153void kvm_mips_free_vcpus(struct kvm *kvm)
164{154{
165 unsigned int i;155 unsigned int i;
arch/powerpc/kvm/powerpc.c+0−10
@@ -457,16 +457,6 @@ err_out: · 456 unmodified lines
457 return -EINVAL;457 return -EINVAL;
458}458}
459 459
460bool kvm_arch_has_vcpu_debugfs(void)
461{
462 return false;
463}
464
465int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu)
466{
467 return 0;
468}
469
470void kvm_arch_destroy_vm(struct kvm *kvm)460void kvm_arch_destroy_vm(struct kvm *kvm)
471{461{
472 unsigned int i;462 unsigned int i;
arch/s390/kvm/kvm-s390.c+0−10
@@ -2516,16 +2516,6 @@ out_err: · 2515 unmodified lines
2516 return rc;2516 return rc;
2517}2517}
2518 2518
2519bool kvm_arch_has_vcpu_debugfs(void)
2520{
2521 return false;
2522}
2523
2524int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu)
2525{
2526 return 0;
2527}
2528
2529void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)2519void 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");
arch/x86/include/asm/kvm_host.h+2−0
@@ -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 28840#define KVM_MAX_VCPUS 288
39#define KVM_SOFT_MAX_VCPUS 24041#define KVM_SOFT_MAX_VCPUS 240
40#define KVM_MAX_VCPU_ID 102342#define KVM_MAX_VCPU_ID 1023
arch/x86/kvm/debugfs.c+0−5
@@ -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
11bool kvm_arch_has_vcpu_debugfs(void)
12{
13 return true;
14}
15
16static int vcpu_get_timer_advance_ns(void *data, u64 *val)11static 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;
include/linux/kvm_host.h+2−1
@@ -861,8 +861,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); · 860 unmodified lines
861void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);861void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
862void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);862void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
863 863
864bool kvm_arch_has_vcpu_debugfs(void);864#ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS
865int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu);865int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu);
866#endif
866 867
867int kvm_arch_hardware_enable(void);868int kvm_arch_hardware_enable(void);
868void kvm_arch_hardware_disable(void);869void kvm_arch_hardware_disable(void);
virt/kvm/arm/arm.c+0−5
@@ -144,11 +144,6 @@ out_fail_alloc: · 143 unmodified lines
144 return ret;144 return ret;
145}145}
146 146
147bool kvm_arch_has_vcpu_debugfs(void)
148{
149 return false;
150}
151
152int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu)147int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu)
153{148{
154 return 0;149 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
2617 2617
2618static int kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu)2618static 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}

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