diff options
author | Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> | 2011-03-04 22:40:20 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-03-17 12:08:33 -0400 |
commit | afc20184b7d24693a934f652e135598a497c9448 (patch) | |
tree | ae400e86dd91278c54489de0bb7e82212e11fd42 /arch/x86 | |
parent | c8ce057eafd49da6a7afe7791bd84163f65f6132 (diff) |
KVM: x86: Remove useless regs_page pointer from kvm_lapic
Access to this page is mostly done through the regs member which holds
the address to this page. The exceptions are in vmx_vcpu_reset() and
kvm_free_lapic() and these both can easily be converted to using regs.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/lapic.c | 9 | ||||
-rw-r--r-- | arch/x86/kvm/lapic.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0171e66e999..2b2255b1f04 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -871,8 +871,8 @@ void kvm_free_lapic(struct kvm_vcpu *vcpu) | |||
871 | 871 | ||
872 | hrtimer_cancel(&vcpu->arch.apic->lapic_timer.timer); | 872 | hrtimer_cancel(&vcpu->arch.apic->lapic_timer.timer); |
873 | 873 | ||
874 | if (vcpu->arch.apic->regs_page) | 874 | if (vcpu->arch.apic->regs) |
875 | __free_page(vcpu->arch.apic->regs_page); | 875 | free_page((unsigned long)vcpu->arch.apic->regs); |
876 | 876 | ||
877 | kfree(vcpu->arch.apic); | 877 | kfree(vcpu->arch.apic); |
878 | } | 878 | } |
@@ -1061,13 +1061,12 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) | |||
1061 | 1061 | ||
1062 | vcpu->arch.apic = apic; | 1062 | vcpu->arch.apic = apic; |
1063 | 1063 | ||
1064 | apic->regs_page = alloc_page(GFP_KERNEL|__GFP_ZERO); | 1064 | apic->regs = (void *)get_zeroed_page(GFP_KERNEL); |
1065 | if (apic->regs_page == NULL) { | 1065 | if (!apic->regs) { |
1066 | printk(KERN_ERR "malloc apic regs error for vcpu %x\n", | 1066 | printk(KERN_ERR "malloc apic regs error for vcpu %x\n", |
1067 | vcpu->vcpu_id); | 1067 | vcpu->vcpu_id); |
1068 | goto nomem_free_apic; | 1068 | goto nomem_free_apic; |
1069 | } | 1069 | } |
1070 | apic->regs = page_address(apic->regs_page); | ||
1071 | apic->vcpu = vcpu; | 1070 | apic->vcpu = vcpu; |
1072 | 1071 | ||
1073 | hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, | 1072 | hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, |
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index f5fe32c5eda..52c9e6b9e72 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h | |||
@@ -13,7 +13,6 @@ struct kvm_lapic { | |||
13 | u32 divide_count; | 13 | u32 divide_count; |
14 | struct kvm_vcpu *vcpu; | 14 | struct kvm_vcpu *vcpu; |
15 | bool irr_pending; | 15 | bool irr_pending; |
16 | struct page *regs_page; | ||
17 | void *regs; | 16 | void *regs; |
18 | gpa_t vapic_addr; | 17 | gpa_t vapic_addr; |
19 | struct page *vapic_page; | 18 | struct page *vapic_page; |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e2b8c6b21ff..3febb763cb7 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2821,7 +2821,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
2821 | vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, 0); | 2821 | vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, 0); |
2822 | if (vm_need_tpr_shadow(vmx->vcpu.kvm)) | 2822 | if (vm_need_tpr_shadow(vmx->vcpu.kvm)) |
2823 | vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, | 2823 | vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, |
2824 | page_to_phys(vmx->vcpu.arch.apic->regs_page)); | 2824 | __pa(vmx->vcpu.arch.apic->regs)); |
2825 | vmcs_write32(TPR_THRESHOLD, 0); | 2825 | vmcs_write32(TPR_THRESHOLD, 0); |
2826 | } | 2826 | } |
2827 | 2827 | ||