From: Paolo Bonzini Date: Wed, 3 Jun 2026 15:00:06 +0000 (+0200) Subject: Merge branch 'kvm-ghcb-for-7.2' into HEAD X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9fb628b4cd3488a36e3fc9b22bb840048aa1a9d2;p=thirdparty%2Fkernel%2Flinux.git Merge branch 'kvm-ghcb-for-7.2' into HEAD Merge the final part of the GHCB 7.2 fixes at https://lore.kernel.org/kvm/20260529183549.1104619-1-pbonzini@redhat.com/. Patches 1-17 have already been included in Linux 7.1; these are minor cleanups, and fixes for behaviors that are suboptimal or contradicting the specification. Signed-off-by: Paolo Bonzini --- 9fb628b4cd3488a36e3fc9b22bb840048aa1a9d2 diff --cc arch/x86/kvm/vmx/capabilities.h index 07469d1cfe746,31568274d8bb0..810119167f798 --- a/arch/x86/kvm/vmx/capabilities.h +++ b/arch/x86/kvm/vmx/capabilities.h @@@ -14,8 -14,8 +14,9 @@@ extern bool __read_mostly flexpriority_ extern bool __read_mostly enable_ept; extern bool __read_mostly enable_unrestricted_guest; extern bool __read_mostly enable_ept_ad_bits; + extern bool __read_mostly enable_cet; extern bool __read_mostly enable_pml; +extern bool __read_mostly enable_mbec; extern int __read_mostly pt_mode; #define PT_MODE_SYSTEM 0 diff --cc arch/x86/kvm/vmx/vmenter.S index 4b7aaa7430fb0,ff1f254a0ef4e..00d807505fc88 --- a/arch/x86/kvm/vmx/vmenter.S +++ b/arch/x86/kvm/vmx/vmenter.S @@@ -6,40 -7,30 +6,8 @@@ #include #include #include "kvm-asm-offsets.h" -#include "run_flags.h" - -#define WORD_SIZE (BITS_PER_LONG / 8) - -#define VCPU_RAX __VCPU_REGS_RAX * WORD_SIZE -#define VCPU_RCX __VCPU_REGS_RCX * WORD_SIZE -#define VCPU_RDX __VCPU_REGS_RDX * WORD_SIZE -#define VCPU_RBX __VCPU_REGS_RBX * WORD_SIZE -/* Intentionally omit RSP as it's context switched by hardware */ -#define VCPU_RBP __VCPU_REGS_RBP * WORD_SIZE -#define VCPU_RSI __VCPU_REGS_RSI * WORD_SIZE -#define VCPU_RDI __VCPU_REGS_RDI * WORD_SIZE - -#ifdef CONFIG_X86_64 -#define VCPU_R8 __VCPU_REGS_R8 * WORD_SIZE -#define VCPU_R9 __VCPU_REGS_R9 * WORD_SIZE -#define VCPU_R10 __VCPU_REGS_R10 * WORD_SIZE -#define VCPU_R11 __VCPU_REGS_R11 * WORD_SIZE -#define VCPU_R12 __VCPU_REGS_R12 * WORD_SIZE -#define VCPU_R13 __VCPU_REGS_R13 * WORD_SIZE -#define VCPU_R14 __VCPU_REGS_R14 * WORD_SIZE -#define VCPU_R15 __VCPU_REGS_R15 * WORD_SIZE -#endif +#include "vmenter.h" - .macro VMX_DO_EVENT_IRQOFF call_insn call_target - /* - * Unconditionally create a stack frame, getting the correct RSP on the - * stack (for x86-64) would take two instructions anyways, and RBP can - * be used to restore RSP to make objtool happy (see below). - */ - push %_ASM_BP - mov %_ASM_SP, %_ASM_BP - - #ifdef CONFIG_X86_64 - /* - * Align RSP to a 16-byte boundary (to emulate CPU behavior) before - * creating the synthetic interrupt stack frame for the IRQ/NMI. - */ - and $-16, %rsp - push $__KERNEL_DS - push %rbp - #endif - pushf - push $__KERNEL_CS - \call_insn \call_target - - /* - * "Restore" RSP from RBP, even though IRET has already unwound RSP to - * the correct value. objtool doesn't know the callee will IRET and, - * without the explicit restore, thinks the stack is getting walloped. - * Using an unwind hint is problematic due to x86-64's dynamic alignment. - */ - leave - RET - .endm - .section .noinstr.text, "ax" /** diff --cc arch/x86/kvm/x86.c index 48f259015ce44,0550359ed798f..a5e09bf431cee --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@@ -14309,7 -14330,7 +14316,7 @@@ int kvm_handle_invpcid(struct kvm_vcpu * the RAP (Return Address Predicator). */ if (guest_cpu_cap_has(vcpu, X86_FEATURE_ERAPS)) - kvm_register_is_dirty(vcpu, VCPU_REG_ERAPS); - kvm_register_mark_dirty(vcpu, VCPU_EXREG_ERAPS); ++ kvm_register_mark_dirty(vcpu, VCPU_REG_ERAPS); kvm_invalidate_pcid(vcpu, operand.pcid); return kvm_skip_emulated_instruction(vcpu);