Re: [PATCH] KVM/x86: Use SVM assembly instruction mnemonics instead of .byte streams

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/11/18 17:00, Uros Bizjak wrote:
> 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@xxxxxxxxx>
> ---
>  arch/x86/include/asm/svm.h |  7 -------
>  arch/x86/kvm/svm.c         | 12 ++++++------
>  2 files changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
> index 93b462e48067..dec9c1e84c78 100644
> --- a/arch/x86/include/asm/svm.h
> +++ b/arch/x86/include/asm/svm.h
> @@ -290,11 +290,4 @@ struct __attribute__ ((__packed__)) vmcb {
>  
>  #define SVM_CR0_SELECTIVE_MASK (X86_CR0_TS | X86_CR0_MP)
>  
> -#define SVM_VMLOAD ".byte 0x0f, 0x01, 0xda"
> -#define SVM_VMRUN  ".byte 0x0f, 0x01, 0xd8"
> -#define SVM_VMSAVE ".byte 0x0f, 0x01, 0xdb"
> -#define SVM_CLGI   ".byte 0x0f, 0x01, 0xdd"
> -#define SVM_STGI   ".byte 0x0f, 0x01, 0xdc"
> -#define SVM_INVLPGA ".byte 0x0f, 0x01, 0xdf"
> -
>  #endif
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 0d1a74069a9e..33ff4da0457c 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -711,17 +711,17 @@ static u32 svm_msrpm_offset(u32 msr)
>  
>  static inline void clgi(void)
>  {
> -	asm volatile (__ex(SVM_CLGI));
> +	asm volatile (__ex("clgi"));
>  }
>  
>  static inline void stgi(void)
>  {
> -	asm volatile (__ex(SVM_STGI));
> +	asm volatile (__ex("stgi"));
>  }
>  
>  static inline void invlpga(unsigned long addr, u32 asid)
>  {
> -	asm volatile (__ex(SVM_INVLPGA) : : "a"(addr), "c"(asid));
> +	asm volatile (__ex("invlpga %1, %0") : : "c"(asid), "a"(addr));
>  }
>  
>  static int get_npt_level(struct kvm_vcpu *vcpu)
> @@ -5625,9 +5625,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
>  		/* Enter guest mode */
>  		"push %%" _ASM_AX " \n\t"
>  		"mov %c[vmcb](%[svm]), %%" _ASM_AX " \n\t"
> -		__ex(SVM_VMLOAD) "\n\t"
> -		__ex(SVM_VMRUN) "\n\t"
> -		__ex(SVM_VMSAVE) "\n\t"
> +		__ex("vmload %%" _ASM_AX) "\n\t"
> +		__ex("vmrun %%" _ASM_AX) "\n\t"
> +		__ex("vmsave %%" _ASM_AX) "\n\t"
>  		"pop %%" _ASM_AX " \n\t"
>  
>  		/* Save guest registers, load host registers */
> 

Queued, thanks.

Paolo



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux