The patch titled KVM: Avoid using vmx instruction directly has been added to the -mm tree. Its filename is kvm-avoid-using-vmx-instruction-directly.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: KVM: Avoid using vmx instruction directly From: Avi Kivity <avi@xxxxxxxxxxxx> Some users have an older assembler installed which doesn't grok the vmx instructions. Fix by encoding the instruction opcodes directly. Signed-off-by: Avi Kivity <avi@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/kvm/kvm.h | 10 ++++++++++ drivers/kvm/kvm_main.c | 29 +++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff -puN drivers/kvm/kvm.h~kvm-avoid-using-vmx-instruction-directly drivers/kvm/kvm.h --- a/drivers/kvm/kvm.h~kvm-avoid-using-vmx-instruction-directly +++ a/drivers/kvm/kvm.h @@ -372,6 +372,16 @@ static inline struct kvm_mmu_page *page_ return (struct kvm_mmu_page *)page->private; } +#define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" +#define ASM_VMX_VMLAUNCH ".byte 0x0f, 0x01, 0xc2" +#define ASM_VMX_VMRESUME ".byte 0x0f, 0x01, 0xc3" +#define ASM_VMX_VMPTRLD_RAX ".byte 0x0f, 0xc7, 0x30" +#define ASM_VMX_VMREAD_RDX_RAX ".byte 0x0f, 0x78, 0xd0" +#define ASM_VMX_VMWRITE_RAX_RDX ".byte 0x0f, 0x79, 0xd0" +#define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4" +#define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4" +#define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30" + #ifdef __x86_64__ /* diff -puN drivers/kvm/kvm_main.c~kvm-avoid-using-vmx-instruction-directly drivers/kvm/kvm_main.c --- a/drivers/kvm/kvm_main.c~kvm-avoid-using-vmx-instruction-directly +++ a/drivers/kvm/kvm_main.c @@ -366,8 +366,8 @@ static void vmcs_clear(struct vmcs *vmcs u64 phys_addr = __pa(vmcs); u8 error; - asm volatile ("vmclear %1; setna %0" - : "=m"(error) : "m"(phys_addr) : "cc", "memory" ); + asm volatile (ASM_VMX_VMCLEAR_RAX "; setna %0" + : "=g"(error) : "a"(&phys_addr) : "cc", "memory" ); if (error) printk(KERN_ERR "kvm: vmclear fail: %p/%llx\n", vmcs, phys_addr); @@ -409,8 +409,8 @@ static struct kvm_vcpu *__vcpu_load(stru u8 error; per_cpu(current_vmcs, cpu) = vcpu->vmcs; - asm volatile ("vmptrld %1; setna %0" - : "=m"(error) : "m"(phys_addr) : "cc" ); + asm volatile (ASM_VMX_VMPTRLD_RAX "; setna %0" + : "=g"(error) : "a"(&phys_addr) : "cc" ); if (error) printk(KERN_ERR "kvm: vmptrld %p/%llx fail\n", vcpu->vmcs, phys_addr); @@ -533,12 +533,12 @@ static __init void kvm_enable(void *garb /* enable and lock */ wrmsrl(MSR_IA32_FEATURE_CONTROL, old | 5); write_cr4(read_cr4() | CR4_VMXE); /* FIXME: not cpu hotplug safe */ - asm volatile ("vmxon %0" : : "m"(phys_addr) : "memory", "cc"); + asm volatile (ASM_VMX_VMXON_RAX : : "a"(&phys_addr) : "memory", "cc"); } static void kvm_disable(void *garbage) { - asm volatile ("vmxoff" : : : "cc"); + asm volatile (ASM_VMX_VMXOFF : : : "cc"); } static int kvm_dev_open(struct inode *inode, struct file *filp) @@ -630,7 +630,8 @@ unsigned long vmcs_readl(unsigned long f { unsigned long value; - asm volatile ("vmread %1, %0" : "=g"(value) : "r"(field) : "cc"); + asm volatile (ASM_VMX_VMREAD_RDX_RAX + : "=a"(value) : "d"(field) : "cc"); return value; } @@ -638,8 +639,8 @@ void vmcs_writel(unsigned long field, un { u8 error; - asm volatile ("vmwrite %1, %2; setna %0" - : "=g"(error) : "r"(value), "r"(field) : "cc" ); + asm volatile (ASM_VMX_VMWRITE_RAX_RDX "; setna %0" + : "=q"(error) : "a"(value), "d"(field) : "cc" ); if (error) printk(KERN_ERR "vmwrite error: reg %lx value %lx (err %d)\n", field, value, vmcs_read32(VM_INSTRUCTION_ERROR)); @@ -2631,10 +2632,10 @@ again: "push %%r8; push %%r9; push %%r10; push %%r11;" "push %%r12; push %%r13; push %%r14; push %%r15;" "push %%rcx \n\t" - "vmwrite %%rsp, %2 \n\t" + ASM_VMX_VMWRITE_RSP_RDX "\n\t" #else "pusha; push %%ecx \n\t" - "vmwrite %%esp, %2 \n\t" + ASM_VMX_VMWRITE_RSP_RDX "\n\t" #endif /* Check if vmlaunch of vmresume is needed */ "cmp $0, %1 \n\t" @@ -2670,9 +2671,9 @@ again: #endif /* Enter guest mode */ "jne launched \n\t" - "vmlaunch \n\t" + ASM_VMX_VMLAUNCH "\n\t" "jmp kvm_vmx_return \n\t" - "launched: vmresume \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 */ @@ -2719,7 +2720,7 @@ again: "setbe %0 \n\t" "popf \n\t" : "=g" (fail) - : "r"(vcpu->launched), "r"((unsigned long)HOST_RSP), + : "r"(vcpu->launched), "d"((unsigned long)HOST_RSP), "c"(vcpu), [rax]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RAX])), [rbx]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RBX])), _ Patches currently in -mm which might be from avi@xxxxxxxxxxxx are kvm-userspace-interface.patch kvm-intel-virtual-mode-extensions-definitions.patch kvm-kvm-data-structures.patch kvm-random-accessors-and-constants.patch kvm-virtualization-infrastructure.patch kvm-virtualization-infrastructure-kvm-fix-guest-cr4-corruption.patch kvm-memory-slot-management.patch kvm-vcpu-creation-and-maintenance.patch kvm-workaround-cr0cd-cache-disable-bit-leak-from-guest-to.patch kvm-vcpu-execution-loop.patch kvm-define-exit-handlers.patch kvm-less-common-exit-handlers.patch kvm-mmu.patch kvm-x86-emulator.patch kvm-plumbing.patch kvm-dynamically-determine-which-msrs-to-load-and-save.patch kvm-fix-calculation-of-initial-value-of-rdx-register.patch kvm-avoid-using-vmx-instruction-directly.patch kvm-include-desch.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html