Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM/x86: Use SVM assembly instruction mnemonics instead of .byte streams

Recently the minimum required version of binutils was changed to 2.20,
which supports all SVM instruction mnemonics. The patch removes
all .byte #defines and uses real instruction mnemonics instead.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Uros Bizjak and committed by
Paolo Bonzini
ac5ffda2 71883a62

+6 -13
-7
arch/x86/include/asm/svm.h
··· 290 290 291 291 #define SVM_CR0_SELECTIVE_MASK (X86_CR0_TS | X86_CR0_MP) 292 292 293 - #define SVM_VMLOAD ".byte 0x0f, 0x01, 0xda" 294 - #define SVM_VMRUN ".byte 0x0f, 0x01, 0xd8" 295 - #define SVM_VMSAVE ".byte 0x0f, 0x01, 0xdb" 296 - #define SVM_CLGI ".byte 0x0f, 0x01, 0xdd" 297 - #define SVM_STGI ".byte 0x0f, 0x01, 0xdc" 298 - #define SVM_INVLPGA ".byte 0x0f, 0x01, 0xdf" 299 - 300 293 #endif
+6 -6
arch/x86/kvm/svm.c
··· 706 706 707 707 static inline void clgi(void) 708 708 { 709 - asm volatile (__ex(SVM_CLGI)); 709 + asm volatile (__ex("clgi")); 710 710 } 711 711 712 712 static inline void stgi(void) 713 713 { 714 - asm volatile (__ex(SVM_STGI)); 714 + asm volatile (__ex("stgi")); 715 715 } 716 716 717 717 static inline void invlpga(unsigned long addr, u32 asid) 718 718 { 719 - asm volatile (__ex(SVM_INVLPGA) : : "a"(addr), "c"(asid)); 719 + asm volatile (__ex("invlpga %1, %0") : : "c"(asid), "a"(addr)); 720 720 } 721 721 722 722 static int get_npt_level(struct kvm_vcpu *vcpu) ··· 5652 5652 /* Enter guest mode */ 5653 5653 "push %%" _ASM_AX " \n\t" 5654 5654 "mov %c[vmcb](%[svm]), %%" _ASM_AX " \n\t" 5655 - __ex(SVM_VMLOAD) "\n\t" 5656 - __ex(SVM_VMRUN) "\n\t" 5657 - __ex(SVM_VMSAVE) "\n\t" 5655 + __ex("vmload %%" _ASM_AX) "\n\t" 5656 + __ex("vmrun %%" _ASM_AX) "\n\t" 5657 + __ex("vmsave %%" _ASM_AX) "\n\t" 5658 5658 "pop %%" _ASM_AX " \n\t" 5659 5659 5660 5660 /* Save guest registers, load host registers */