[PATCH] kvm: x86: Remove useless index and parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The kvm_cpuid_param structure is designed for getting cpu level, with ECX input
is zero. While it is useless and wasteful to use a field in the structure for this.
Just remove the field and use 0 directly.

Also, the parameter in function is_centaur_cpu() is also useless.

Number of a 64 bit build:

          text    data     bss     dec     hex filename
before:   7529     112       0    7641    1dd9 ./arch/x86/kvm/cpuid.o
after:    7428     112       0    7540    1d74 ./arch/x86/kvm/cpuid.o

Signed-off-by: Jing Liu <jing2.liu@xxxxxxxxxxxxxxx>
---
 arch/x86/kvm/cpuid.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index bbffa6c..389aaf7 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -741,12 +741,11 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 func,
 
 struct kvm_cpuid_param {
 	u32 func;
-	u32 idx;
 	bool has_leaf_count;
-	bool (*qualifier)(const struct kvm_cpuid_param *param);
+	bool (*qualifier)(void);
 };
 
-static bool is_centaur_cpu(const struct kvm_cpuid_param *param)
+static bool is_centaur_cpu(void)
 {
 	return boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR;
 }
@@ -811,10 +810,10 @@ int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
 	for (i = 0; i < ARRAY_SIZE(param); i++) {
 		const struct kvm_cpuid_param *ent = &param[i];
 
-		if (ent->qualifier && !ent->qualifier(ent))
+		if (ent->qualifier && !ent->qualifier())
 			continue;
 
-		r = do_cpuid_ent(&cpuid_entries[nent], ent->func, ent->idx,
+		r = do_cpuid_ent(&cpuid_entries[nent], ent->func, 0,
 				&nent, cpuid->nent, type);
 
 		if (r)
@@ -825,7 +824,7 @@ int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
 
 		limit = cpuid_entries[nent - 1].eax;
 		for (func = ent->func + 1; func <= limit && nent < cpuid->nent && r == 0; ++func)
-			r = do_cpuid_ent(&cpuid_entries[nent], func, ent->idx,
+			r = do_cpuid_ent(&cpuid_entries[nent], func, 0,
 				     &nent, cpuid->nent, type);
 
 		if (r)
-- 
1.8.3.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux