aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/vmx.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2006-12-13 03:33:45 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:46 -0500
commit05b3e0c2c791a70bf0735aaec53cdf6d340eef85 (patch)
treecfdc46f216e5a7996972ff88681dd03bed9b0022 /drivers/kvm/vmx.c
parent5aff458e9c90df55d6badabd89a1a063a80d9768 (diff)
[PATCH] KVM: Replace __x86_64__ with CONFIG_X86_64
As per akpm's request. Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r--drivers/kvm/vmx.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index fa8f7290dd4d..ad97014aa6eb 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -34,7 +34,7 @@ MODULE_LICENSE("GPL");
34static DEFINE_PER_CPU(struct vmcs *, vmxarea); 34static DEFINE_PER_CPU(struct vmcs *, vmxarea);
35static DEFINE_PER_CPU(struct vmcs *, current_vmcs); 35static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
36 36
37#ifdef __x86_64__ 37#ifdef CONFIG_X86_64
38#define HOST_IS_64 1 38#define HOST_IS_64 1
39#else 39#else
40#define HOST_IS_64 0 40#define HOST_IS_64 0
@@ -71,7 +71,7 @@ static struct kvm_vmx_segment_field {
71}; 71};
72 72
73static const u32 vmx_msr_index[] = { 73static const u32 vmx_msr_index[] = {
74#ifdef __x86_64__ 74#ifdef CONFIG_X86_64
75 MSR_SYSCALL_MASK, MSR_LSTAR, MSR_CSTAR, MSR_KERNEL_GS_BASE, 75 MSR_SYSCALL_MASK, MSR_LSTAR, MSR_CSTAR, MSR_KERNEL_GS_BASE,
76#endif 76#endif
77 MSR_EFER, MSR_K6_STAR, 77 MSR_EFER, MSR_K6_STAR,
@@ -138,7 +138,7 @@ static u32 vmcs_read32(unsigned long field)
138 138
139static u64 vmcs_read64(unsigned long field) 139static u64 vmcs_read64(unsigned long field)
140{ 140{
141#ifdef __x86_64__ 141#ifdef CONFIG_X86_64
142 return vmcs_readl(field); 142 return vmcs_readl(field);
143#else 143#else
144 return vmcs_readl(field) | ((u64)vmcs_readl(field+1) << 32); 144 return vmcs_readl(field) | ((u64)vmcs_readl(field+1) << 32);
@@ -168,7 +168,7 @@ static void vmcs_write32(unsigned long field, u32 value)
168 168
169static void vmcs_write64(unsigned long field, u64 value) 169static void vmcs_write64(unsigned long field, u64 value)
170{ 170{
171#ifdef __x86_64__ 171#ifdef CONFIG_X86_64
172 vmcs_writel(field, value); 172 vmcs_writel(field, value);
173#else 173#else
174 vmcs_writel(field, value); 174 vmcs_writel(field, value);
@@ -297,7 +297,7 @@ static void guest_write_tsc(u64 guest_tsc)
297 297
298static void reload_tss(void) 298static void reload_tss(void)
299{ 299{
300#ifndef __x86_64__ 300#ifndef CONFIG_X86_64
301 301
302 /* 302 /*
303 * VT restores TR but not its size. Useless. 303 * VT restores TR but not its size. Useless.
@@ -328,7 +328,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
328 } 328 }
329 329
330 switch (msr_index) { 330 switch (msr_index) {
331#ifdef __x86_64__ 331#ifdef CONFIG_X86_64
332 case MSR_FS_BASE: 332 case MSR_FS_BASE:
333 data = vmcs_readl(GUEST_FS_BASE); 333 data = vmcs_readl(GUEST_FS_BASE);
334 break; 334 break;
@@ -391,7 +391,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
391{ 391{
392 struct vmx_msr_entry *msr; 392 struct vmx_msr_entry *msr;
393 switch (msr_index) { 393 switch (msr_index) {
394#ifdef __x86_64__ 394#ifdef CONFIG_X86_64
395 case MSR_FS_BASE: 395 case MSR_FS_BASE:
396 vmcs_writel(GUEST_FS_BASE, data); 396 vmcs_writel(GUEST_FS_BASE, data);
397 break; 397 break;
@@ -726,7 +726,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
726 fix_rmode_seg(VCPU_SREG_FS, &vcpu->rmode.fs); 726 fix_rmode_seg(VCPU_SREG_FS, &vcpu->rmode.fs);
727} 727}
728 728
729#ifdef __x86_64__ 729#ifdef CONFIG_X86_64
730 730
731static void enter_lmode(struct kvm_vcpu *vcpu) 731static void enter_lmode(struct kvm_vcpu *vcpu)
732{ 732{
@@ -768,7 +768,7 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
768 if (!vcpu->rmode.active && !(cr0 & CR0_PE_MASK)) 768 if (!vcpu->rmode.active && !(cr0 & CR0_PE_MASK))
769 enter_rmode(vcpu); 769 enter_rmode(vcpu);
770 770
771#ifdef __x86_64__ 771#ifdef CONFIG_X86_64
772 if (vcpu->shadow_efer & EFER_LME) { 772 if (vcpu->shadow_efer & EFER_LME) {
773 if (!is_paging(vcpu) && (cr0 & CR0_PG_MASK)) 773 if (!is_paging(vcpu) && (cr0 & CR0_PG_MASK))
774 enter_lmode(vcpu); 774 enter_lmode(vcpu);
@@ -809,7 +809,7 @@ static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
809 vcpu->cr4 = cr4; 809 vcpu->cr4 = cr4;
810} 810}
811 811
812#ifdef __x86_64__ 812#ifdef CONFIG_X86_64
813 813
814static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer) 814static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer)
815{ 815{
@@ -1096,7 +1096,7 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1096 vmcs_write16(HOST_FS_SELECTOR, read_fs()); /* 22.2.4 */ 1096 vmcs_write16(HOST_FS_SELECTOR, read_fs()); /* 22.2.4 */
1097 vmcs_write16(HOST_GS_SELECTOR, read_gs()); /* 22.2.4 */ 1097 vmcs_write16(HOST_GS_SELECTOR, read_gs()); /* 22.2.4 */
1098 vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ 1098 vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */
1099#ifdef __x86_64__ 1099#ifdef CONFIG_X86_64
1100 rdmsrl(MSR_FS_BASE, a); 1100 rdmsrl(MSR_FS_BASE, a);
1101 vmcs_writel(HOST_FS_BASE, a); /* 22.2.4 */ 1101 vmcs_writel(HOST_FS_BASE, a); /* 22.2.4 */
1102 rdmsrl(MSR_GS_BASE, a); 1102 rdmsrl(MSR_GS_BASE, a);
@@ -1174,7 +1174,7 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1174 vcpu->cr0 = 0x60000010; 1174 vcpu->cr0 = 0x60000010;
1175 vmx_set_cr0(vcpu, vcpu->cr0); // enter rmode 1175 vmx_set_cr0(vcpu, vcpu->cr0); // enter rmode
1176 vmx_set_cr4(vcpu, 0); 1176 vmx_set_cr4(vcpu, 0);
1177#ifdef __x86_64__ 1177#ifdef CONFIG_X86_64
1178 vmx_set_efer(vcpu, 0); 1178 vmx_set_efer(vcpu, 0);
1179#endif 1179#endif
1180 1180
@@ -1690,7 +1690,7 @@ again:
1690 vmcs_write16(HOST_GS_SELECTOR, 0); 1690 vmcs_write16(HOST_GS_SELECTOR, 0);
1691 } 1691 }
1692 1692
1693#ifdef __x86_64__ 1693#ifdef CONFIG_X86_64
1694 vmcs_writel(HOST_FS_BASE, read_msr(MSR_FS_BASE)); 1694 vmcs_writel(HOST_FS_BASE, read_msr(MSR_FS_BASE));
1695 vmcs_writel(HOST_GS_BASE, read_msr(MSR_GS_BASE)); 1695 vmcs_writel(HOST_GS_BASE, read_msr(MSR_GS_BASE));
1696#else 1696#else
@@ -1714,7 +1714,7 @@ again:
1714 asm ( 1714 asm (
1715 /* Store host registers */ 1715 /* Store host registers */
1716 "pushf \n\t" 1716 "pushf \n\t"
1717#ifdef __x86_64__ 1717#ifdef CONFIG_X86_64
1718 "push %%rax; push %%rbx; push %%rdx;" 1718 "push %%rax; push %%rbx; push %%rdx;"
1719 "push %%rsi; push %%rdi; push %%rbp;" 1719 "push %%rsi; push %%rdi; push %%rbp;"
1720 "push %%r8; push %%r9; push %%r10; push %%r11;" 1720 "push %%r8; push %%r9; push %%r10; push %%r11;"
@@ -1728,7 +1728,7 @@ again:
1728 /* Check if vmlaunch of vmresume is needed */ 1728 /* Check if vmlaunch of vmresume is needed */
1729 "cmp $0, %1 \n\t" 1729 "cmp $0, %1 \n\t"
1730 /* Load guest registers. Don't clobber flags. */ 1730 /* Load guest registers. Don't clobber flags. */
1731#ifdef __x86_64__ 1731#ifdef CONFIG_X86_64
1732 "mov %c[cr2](%3), %%rax \n\t" 1732 "mov %c[cr2](%3), %%rax \n\t"
1733 "mov %%rax, %%cr2 \n\t" 1733 "mov %%rax, %%cr2 \n\t"
1734 "mov %c[rax](%3), %%rax \n\t" 1734 "mov %c[rax](%3), %%rax \n\t"
@@ -1765,7 +1765,7 @@ again:
1765 ".globl kvm_vmx_return \n\t" 1765 ".globl kvm_vmx_return \n\t"
1766 "kvm_vmx_return: " 1766 "kvm_vmx_return: "
1767 /* Save guest registers, load host registers, keep flags */ 1767 /* Save guest registers, load host registers, keep flags */
1768#ifdef __x86_64__ 1768#ifdef CONFIG_X86_64
1769 "xchg %3, 0(%%rsp) \n\t" 1769 "xchg %3, 0(%%rsp) \n\t"
1770 "mov %%rax, %c[rax](%3) \n\t" 1770 "mov %%rax, %c[rax](%3) \n\t"
1771 "mov %%rbx, %c[rbx](%3) \n\t" 1771 "mov %%rbx, %c[rbx](%3) \n\t"
@@ -1817,7 +1817,7 @@ again:
1817 [rsi]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RSI])), 1817 [rsi]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RSI])),
1818 [rdi]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RDI])), 1818 [rdi]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RDI])),
1819 [rbp]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RBP])), 1819 [rbp]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RBP])),
1820#ifdef __x86_64__ 1820#ifdef CONFIG_X86_64
1821 [r8 ]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R8 ])), 1821 [r8 ]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R8 ])),
1822 [r9 ]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R9 ])), 1822 [r9 ]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R9 ])),
1823 [r10]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R10])), 1823 [r10]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R10])),
@@ -1838,7 +1838,7 @@ again:
1838 fx_save(vcpu->guest_fx_image); 1838 fx_save(vcpu->guest_fx_image);
1839 fx_restore(vcpu->host_fx_image); 1839 fx_restore(vcpu->host_fx_image);
1840 1840
1841#ifndef __x86_64__ 1841#ifndef CONFIG_X86_64
1842 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); 1842 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
1843#endif 1843#endif
1844 1844
@@ -1856,7 +1856,7 @@ again:
1856 */ 1856 */
1857 local_irq_disable(); 1857 local_irq_disable();
1858 load_gs(gs_sel); 1858 load_gs(gs_sel);
1859#ifdef __x86_64__ 1859#ifdef CONFIG_X86_64
1860 wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE)); 1860 wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
1861#endif 1861#endif
1862 local_irq_enable(); 1862 local_irq_enable();
@@ -1966,7 +1966,7 @@ static struct kvm_arch_ops vmx_arch_ops = {
1966 .set_cr0_no_modeswitch = vmx_set_cr0_no_modeswitch, 1966 .set_cr0_no_modeswitch = vmx_set_cr0_no_modeswitch,
1967 .set_cr3 = vmx_set_cr3, 1967 .set_cr3 = vmx_set_cr3,
1968 .set_cr4 = vmx_set_cr4, 1968 .set_cr4 = vmx_set_cr4,
1969#ifdef __x86_64__ 1969#ifdef CONFIG_X86_64
1970 .set_efer = vmx_set_efer, 1970 .set_efer = vmx_set_efer,
1971#endif 1971#endif
1972 .get_idt = vmx_get_idt, 1972 .get_idt = vmx_get_idt,