Commit 7e7a6e2a authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'kvm-x86-vmx-7.1' of https://github.com/kvm-x86/linux into HEAD

KVM VMX changes for 7.1

 - Drop obsolete (largely ignored by hardwre) branch hint prefixes from the
   VMX instruction macros, as saving a byte of code per instruction provides
   more benefits than the (mostly) superfluous prefixes.

 - Use ASM_INPUT_RM() in __vmcs_writel() to coerce clang into using a register
   input when appropriate.

 - Drop unnecessary parentheses in cpu_has_load_cet_ctrl() so as not to suggest
   that "return (x & y);" is KVM's preferred style.
parents aa856775 577da677
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ static inline bool cpu_has_load_perf_global_ctrl(void)

static inline bool cpu_has_load_cet_ctrl(void)
{
	return (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_CET_STATE);
	return vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_CET_STATE;
}

static inline bool cpu_has_save_perf_global_ctrl(void)
+1 −4
Original line number Diff line number Diff line
@@ -119,7 +119,6 @@ static __always_inline unsigned long __vmcs_readl(unsigned long field)
#else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */

	asm volatile("1: vmread %[field], %[output]\n\t"
		     ".byte 0x3e\n\t" /* branch taken hint */
		     "ja 3f\n\t"

		     /*
@@ -191,7 +190,6 @@ static __always_inline unsigned long vmcs_readl(unsigned long field)
#define vmx_asm1(insn, op1, error_args...)				\
do {									\
	asm goto("1: " __stringify(insn) " %0\n\t"			\
			  ".byte 0x2e\n\t" /* branch not taken hint */	\
			  "jna %l[error]\n\t"				\
			  _ASM_EXTABLE(1b, %l[fault])			\
			  : : op1 : "cc" : error, fault);		\
@@ -208,7 +206,6 @@ fault: \
#define vmx_asm2(insn, op1, op2, error_args...)				\
do {									\
	asm goto("1: "  __stringify(insn) " %1, %0\n\t"			\
			  ".byte 0x2e\n\t" /* branch not taken hint */	\
			  "jna %l[error]\n\t"				\
			  _ASM_EXTABLE(1b, %l[fault])			\
			  : : op1, op2 : "cc" : error, fault);		\
@@ -224,7 +221,7 @@ fault: \

static __always_inline void __vmcs_writel(unsigned long field, unsigned long value)
{
	vmx_asm2(vmwrite, "r"(field), "rm"(value), field, value);
	vmx_asm2(vmwrite, "r" (field), ASM_INPUT_RM (value), field, value);
}

static __always_inline void vmcs_write16(unsigned long field, u16 value)