aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-09-16 08:10:57 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-09-17 09:38:03 -0400
commit83287ea420ced7242a704488aab0fcdcf2ced9ab (patch)
tree47438ac4916ccb0505baf9967092593507dbbd2f /arch/x86
parentecba9a52acdf20530d561b7634b80c35c308943a (diff)
KVM: VMX: Make lto-friendly
LTO (link-time optimization) doesn't like local labels to be referred to from a different function, since the two functions may be built in separate compilation units. Use an external variable instead. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index d62b4139a292..5faf12ace546 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -127,6 +127,8 @@ module_param(ple_gap, int, S_IRUGO);
127static int ple_window = KVM_VMX_DEFAULT_PLE_WINDOW; 127static int ple_window = KVM_VMX_DEFAULT_PLE_WINDOW;
128module_param(ple_window, int, S_IRUGO); 128module_param(ple_window, int, S_IRUGO);
129 129
130extern const ulong vmx_return;
131
130#define NR_AUTOLOAD_MSRS 8 132#define NR_AUTOLOAD_MSRS 8
131#define VMCS02_POOL_SIZE 1 133#define VMCS02_POOL_SIZE 1
132 134
@@ -3724,8 +3726,7 @@ static void vmx_set_constant_host_state(void)
3724 native_store_idt(&dt); 3726 native_store_idt(&dt);
3725 vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */ 3727 vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */
3726 3728
3727 asm("mov $.Lkvm_vmx_return, %0" : "=r"(tmpl)); 3729 vmcs_writel(HOST_RIP, vmx_return); /* 22.2.5 */
3728 vmcs_writel(HOST_RIP, tmpl); /* 22.2.5 */
3729 3730
3730 rdmsr(MSR_IA32_SYSENTER_CS, low32, high32); 3731 rdmsr(MSR_IA32_SYSENTER_CS, low32, high32);
3731 vmcs_write32(HOST_IA32_SYSENTER_CS, low32); 3732 vmcs_write32(HOST_IA32_SYSENTER_CS, low32);
@@ -6276,11 +6277,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
6276 "mov %c[rcx](%0), %%"R"cx \n\t" /* kills %0 (ecx) */ 6277 "mov %c[rcx](%0), %%"R"cx \n\t" /* kills %0 (ecx) */
6277 6278
6278 /* Enter guest mode */ 6279 /* Enter guest mode */
6279 "jne .Llaunched \n\t" 6280 "jne 1f \n\t"
6280 __ex(ASM_VMX_VMLAUNCH) "\n\t" 6281 __ex(ASM_VMX_VMLAUNCH) "\n\t"
6281 "jmp .Lkvm_vmx_return \n\t" 6282 "jmp 2f \n\t"
6282 ".Llaunched: " __ex(ASM_VMX_VMRESUME) "\n\t" 6283 "1: " __ex(ASM_VMX_VMRESUME) "\n\t"
6283 ".Lkvm_vmx_return: " 6284 "2: "
6284 /* Save guest registers, load host registers, keep flags */ 6285 /* Save guest registers, load host registers, keep flags */
6285 "mov %0, %c[wordsize](%%"R"sp) \n\t" 6286 "mov %0, %c[wordsize](%%"R"sp) \n\t"
6286 "pop %0 \n\t" 6287 "pop %0 \n\t"
@@ -6306,6 +6307,10 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
6306 6307
6307 "pop %%"R"bp; pop %%"R"dx \n\t" 6308 "pop %%"R"bp; pop %%"R"dx \n\t"
6308 "setbe %c[fail](%0) \n\t" 6309 "setbe %c[fail](%0) \n\t"
6310 ".pushsection .rodata \n\t"
6311 ".global vmx_return \n\t"
6312 "vmx_return: " _ASM_PTR " 2b \n\t"
6313 ".popsection"
6309 : : "c"(vmx), "d"((unsigned long)HOST_RSP), 6314 : : "c"(vmx), "d"((unsigned long)HOST_RSP),
6310 [launched]"i"(offsetof(struct vcpu_vmx, __launched)), 6315 [launched]"i"(offsetof(struct vcpu_vmx, __launched)),
6311 [fail]"i"(offsetof(struct vcpu_vmx, fail)), 6316 [fail]"i"(offsetof(struct vcpu_vmx, fail)),