drivers/kvm/: possible cleanups
PATCH 1/1 drivers/kvm/: possible cleanups
This patch contains the following possible cleanups:
- make needlessly global code static
- proper prototype for kvm_main.c:find_msr_entry()
- #if 0 the unused svm.c:inject_db()
---
drivers/kvm/kvm.h | 3 ++- drivers/kvm/kvm_main.c | 2 +- drivers/kvm/mmu.c | 16 ++++++++-------- drivers/kvm/svm.c | 6 ++++-- drivers/kvm/vmx.c | 3 --- drivers/kvm/x86_emulate.c | 9 +++++++-- drivers/kvm/x86_emulate.h | 8 --------
drivers/kvm/kvm.h renamed from drivers/kvm/kvm.h.old +2 -1
@@ -325,7 +325,6 @@int kvm_mmu_reset_context (struct kvm_vcpu *vcpu);void kvm_mmu_slot_remove_write_access (struct kvm *kvm,int slot); -hpa_t gpa_to_hpa (struct kvm_vcpu *vcpu,gpa_t gpa);#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)static inline int is_error_hpa (hpa_t hpa) {return hpa >>HPA_MSB ; }
@@ -397,6 +396,8 @@unsigned long segment_base (u16 selector); +struct vmx_msr_entry *find_msr_entry (struct kvm_vcpu *vcpu,u32 msr); +static inline struct page *_gfn_to_page (struct kvm *kvm,gfn_t gfn) {struct kvm_memory_slot *slot =gfn_to_memslot (kvm, gfn);
drivers/kvm/kvm_main.c renamed from drivers/kvm/kvm_main.c.old +1 -1
@@ -973,7 +973,7 @@ reported =1 ; } -struct x86_emulate_ops emulate_ops = { +static struct x86_emulate_ops emulate_ops = { .read_std = emulator_read_std, .write_std = emulator_write_std, .read_emulated = emulator_read_emulated,
drivers/kvm/mmu.c renamed from drivers/kvm/mmu.c.old +8 -8
@@ -208,14 +208,7 @@__set_bit (slot, &page_head->slot_bitmap); } -hpa_t safe_gpa_to_hpa (struct kvm_vcpu *vcpu,gpa_t gpa) -{ -hpa_t hpa =gpa_to_hpa (vcpu, gpa); - -return is_error_hpa (hpa) ? bad_page_address | (gpa & ~PAGE_MASK ): hpa; -} - -hpa_t gpa_to_hpa (struct kvm_vcpu *vcpu,gpa_t gpa) +static hpa_t gpa_to_hpa (struct kvm_vcpu *vcpu,gpa_t gpa) {struct kvm_memory_slot *slot;struct page *page;
@@ -229,6 +222,13 @@ | (gpa & (PAGE_SIZE-1)); } +static hpa_t safe_gpa_to_hpa (struct kvm_vcpu *vcpu,gpa_t gpa) +{ +hpa_t hpa =gpa_to_hpa (vcpu, gpa); + +return is_error_hpa (hpa) ? bad_page_address | (gpa & ~PAGE_MASK ): hpa; +} +hpa_t gva_to_hpa (struct kvm_vcpu *vcpu,gva_t gva) {gpa_t gpa = vcpu->mmu.gva_to_gpa (vcpu, gva);
drivers/kvm/svm.c renamed from drivers/kvm/svm.c.old +4 -2
@@ -42,8 +42,8 @@#define KVM_EFER_LMA (1 << 10)#define KVM_EFER_LME (1 << 8) -unsigned long iopm_base; -unsigned long msrpm_base; +static unsigned long iopm_base; +static unsigned long msrpm_base;struct kvm_ldttss_desc {u16 limit0;
@@ -206,12 +206,14 @@UD_VECTOR ; } +#if 0 static void inject_db (struct kvm_vcpu *vcpu) { vcpu->svm->vmcb->control.event_inj =SVM_EVTINJ_VALID |SVM_EVTINJ_TYPE_EXEPT |DB_VECTOR ; } +#endif /* 0 */ static int is_page_fault (uint32_t info) {
drivers/kvm/vmx.c renamed from drivers/kvm/vmx.c.old +0 -3
@@ -78,8 +78,6 @@ };#define NR_VMX_MSR (sizeof(vmx_msr_index) / sizeof(*vmx_msr_index)) -struct vmx_msr_entry *find_msr_entry (struct kvm_vcpu *vcpu,u32 msr); -static inline int is_page_fault (u32 intr_info) { return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
@@ -1762,7 +1760,6 @@ASM_VMX_VMLAUNCH "\n\t" "jmp kvm_vmx_return \n\t" "launched: " ASM_VMX_VMRESUME "\n\t" -".globl kvm_vmx_return \n\t" "kvm_vmx_return: " /* Save guest registers, load host registers, keep flags */ #ifdef CONFIG_X86_64
drivers/kvm/x86_emulate.h renamed from drivers/kvm/x86_emulate.h.old +0 -8
@@ -174,12 +174,4 @@int x86_emulate_memop (struct x86_emulate_ctxt *ctxt,struct x86_emulate_ops *ops); -/* -* Given the 'reg' portion of a ModRM byte, and a register block, return a -* pointer into the block that addresses the relevant register. -* @highbyte_regs specifies whether to decode AH,CH,DH,BH. -*/ -void *decode_register (u8 modrm_reg,unsigned long *regs, -int highbyte_regs); -#endif /* __X86_EMULATE_H__ */
drivers/kvm/x86_emulate.c renamed from drivers/kvm/x86_emulate.c.old +7 -2
@@ -438,8 +438,13 @@ (((reg) + _inc) & ((1UL << (ad_bytes <<3 )) -1 )); \ }while (0 ) -void *decode_register(u8 modrm_reg, unsigned long *regs, - int highbyte_regs) +/* +* Given the 'reg' portion of a ModRM byte, and a register block, return a +* pointer into the block that addresses the relevant register. +* @highbyte_regs specifies whether to decode AH,CH,DH,BH. +*/ +static void *decode_register(u8 modrm_reg, unsigned long *regs, +int highbyte_regs) {void *p;
Quoted 6 lines · Adrian Bunk
This patch contains the following possible cleanups:
- make needlessly global code static
- proper prototype for kvm_main.c:find_msr_entry()
- #if 0 the unused svm.c:inject_db()
Please copy kvm patches to [email protected] in the future.
find_msr_entry() has been moved to vmx.c by another patch (now queued in -mm), so this patch does not apply. The rest of the cleanups do look good though.
While I'll accept cleanup patches for kvm, there are other sources of churn right now, so it might be more efficient to wait with the cleanups for a few weeks.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 9 lines · Avi Kivity
Quoted 6 lines · Adrian Bunk
This patch contains the following possible cleanups:
- make needlessly global code static
- proper prototype for kvm_main.c:find_msr_entry()
- #if 0 the unused svm.c:inject_db()Please copy kvm patches to [email protected] in the future.
-ENOMAINTAINERSENTRY ;-)
Quoted 7 lines
find_msr_entry()has been moved tovmx.cby another patch (now queued in -mm), so this patch does not apply. The rest of the cleanups do look good though.While I'll accept cleanup patches for kvm, there are other sources of churn right now, so it might be more efficient to wait with the cleanups for a few weeks.
OK
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 11 lines · Adrian Bunk
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Adrian Bunk
This patch contains the following possible cleanups:
- make needlessly global code static
- proper prototype for kvm_main.c:find_msr_entry()
- #if 0 the unused svm.c:inject_db()
Quoted 5 lines
Quoted 2 lines
Please copy kvm patches to [email protected] in the future.
-ENOMAINTAINERSENTRY;-)
That patch is in the same queue :)
Signature · 1 line
error compiling committee.c: too many arguments to function