diff options
author | Avi Kivity <avi@redhat.com> | 2010-07-26 11:32:39 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:50:01 -0400 |
commit | d359192feaf02861327339a9dda6b2b2d765c2bc (patch) | |
tree | 54bb185e3b7c19469bc7fd86c4404dfcd1657481 | |
parent | e071edd5ba8dd7a493eef229d495cf6232b09534 (diff) |
KVM: VMX: Use host_gdt variable wherever we need the host gdt
Now that we have the host gdt conveniently stored in a variable, make use
of it instead of querying the cpu.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r-- | arch/x86/kvm/vmx.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7bddfab12013..751a2d29f4ce 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -706,11 +706,10 @@ static void reload_tss(void) | |||
706 | /* | 706 | /* |
707 | * VT restores TR but not its size. Useless. | 707 | * VT restores TR but not its size. Useless. |
708 | */ | 708 | */ |
709 | struct desc_ptr gdt; | 709 | struct desc_ptr *gdt = &__get_cpu_var(host_gdt); |
710 | struct desc_struct *descs; | 710 | struct desc_struct *descs; |
711 | 711 | ||
712 | native_store_gdt(&gdt); | 712 | descs = (void *)gdt->address; |
713 | descs = (void *)gdt.address; | ||
714 | descs[GDT_ENTRY_TSS].type = 9; /* available TSS */ | 713 | descs[GDT_ENTRY_TSS].type = 9; /* available TSS */ |
715 | load_TR_desc(); | 714 | load_TR_desc(); |
716 | } | 715 | } |
@@ -753,7 +752,7 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset) | |||
753 | 752 | ||
754 | static unsigned long segment_base(u16 selector) | 753 | static unsigned long segment_base(u16 selector) |
755 | { | 754 | { |
756 | struct desc_ptr gdt; | 755 | struct desc_ptr *gdt = &__get_cpu_var(host_gdt); |
757 | struct desc_struct *d; | 756 | struct desc_struct *d; |
758 | unsigned long table_base; | 757 | unsigned long table_base; |
759 | unsigned long v; | 758 | unsigned long v; |
@@ -761,8 +760,7 @@ static unsigned long segment_base(u16 selector) | |||
761 | if (!(selector & ~3)) | 760 | if (!(selector & ~3)) |
762 | return 0; | 761 | return 0; |
763 | 762 | ||
764 | native_store_gdt(&gdt); | 763 | table_base = gdt->address; |
765 | table_base = gdt.address; | ||
766 | 764 | ||
767 | if (selector & 4) { /* from ldt */ | 765 | if (selector & 4) { /* from ldt */ |
768 | u16 ldt_selector = kvm_read_ldt(); | 766 | u16 ldt_selector = kvm_read_ldt(); |
@@ -897,7 +895,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
897 | } | 895 | } |
898 | 896 | ||
899 | if (vcpu->cpu != cpu) { | 897 | if (vcpu->cpu != cpu) { |
900 | struct desc_ptr dt; | 898 | struct desc_ptr *gdt = &__get_cpu_var(host_gdt); |
901 | unsigned long sysenter_esp; | 899 | unsigned long sysenter_esp; |
902 | 900 | ||
903 | kvm_migrate_timers(vcpu); | 901 | kvm_migrate_timers(vcpu); |
@@ -913,8 +911,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
913 | * processors. | 911 | * processors. |
914 | */ | 912 | */ |
915 | vmcs_writel(HOST_TR_BASE, kvm_read_tr_base()); /* 22.2.4 */ | 913 | vmcs_writel(HOST_TR_BASE, kvm_read_tr_base()); /* 22.2.4 */ |
916 | native_store_gdt(&dt); | 914 | vmcs_writel(HOST_GDTR_BASE, gdt->address); /* 22.2.4 */ |
917 | vmcs_writel(HOST_GDTR_BASE, dt.address); /* 22.2.4 */ | ||
918 | 915 | ||
919 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); | 916 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); |
920 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ | 917 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ |