Skip to content

Commit bc17fcc

Browse files
yanzhao56sean-jc
authored andcommitted
KVM: VMX: Remove the unused variable "gpa" in __invept()
Remove the unused variable "gpa" in __invept(). The INVEPT instruction only supports two types: VMX_EPT_EXTENT_CONTEXT (1) and VMX_EPT_EXTENT_GLOBAL (2). Neither of these types requires a third variable "gpa". The "gpa" variable for __invept() is always set to 0 and was originally introduced for the old non-existent type VMX_EPT_EXTENT_INDIVIDUAL_ADDR (0). This type was removed by commit 2b3c5cb ("kvm: don't use bit24 for detecting address-specific invalidation capability") and commit 63f3ac4 ("KVM: VMX: clean up declaration of VPID/EPT invalidation types"). Since this variable is not useful for error handling either, remove it to avoid confusion. No functional changes expected. Cc: Yuan Yao <yuan.yao@intel.com> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> Link: https://lore.kernel.org/r/20241014045931.1061-1-yan.y.zhao@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 5cb1659 commit bc17fcc

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,9 @@ noinline void invvpid_error(unsigned long ext, u16 vpid, gva_t gva)
481481
ext, vpid, gva);
482482
}
483483

484-
noinline void invept_error(unsigned long ext, u64 eptp, gpa_t gpa)
484+
noinline void invept_error(unsigned long ext, u64 eptp)
485485
{
486-
vmx_insn_failed("invept failed: ext=0x%lx eptp=%llx gpa=0x%llx\n",
487-
ext, eptp, gpa);
486+
vmx_insn_failed("invept failed: ext=0x%lx eptp=%llx\n", ext, eptp);
488487
}
489488

490489
static DEFINE_PER_CPU(struct vmcs *, vmxarea);

arch/x86/kvm/vmx/vmx_ops.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void vmwrite_error(unsigned long field, unsigned long value);
1515
void vmclear_error(struct vmcs *vmcs, u64 phys_addr);
1616
void vmptrld_error(struct vmcs *vmcs, u64 phys_addr);
1717
void invvpid_error(unsigned long ext, u16 vpid, gva_t gva);
18-
void invept_error(unsigned long ext, u64 eptp, gpa_t gpa);
18+
void invept_error(unsigned long ext, u64 eptp);
1919

2020
#ifndef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
2121
/*
@@ -312,13 +312,13 @@ static inline void __invvpid(unsigned long ext, u16 vpid, gva_t gva)
312312
vmx_asm2(invvpid, "r"(ext), "m"(operand), ext, vpid, gva);
313313
}
314314

315-
static inline void __invept(unsigned long ext, u64 eptp, gpa_t gpa)
315+
static inline void __invept(unsigned long ext, u64 eptp)
316316
{
317317
struct {
318-
u64 eptp, gpa;
319-
} operand = {eptp, gpa};
320-
321-
vmx_asm2(invept, "r"(ext), "m"(operand), ext, eptp, gpa);
318+
u64 eptp;
319+
u64 reserved_0;
320+
} operand = { eptp, 0 };
321+
vmx_asm2(invept, "r"(ext), "m"(operand), ext, eptp);
322322
}
323323

324324
static inline void vpid_sync_vcpu_single(int vpid)
@@ -355,13 +355,13 @@ static inline void vpid_sync_vcpu_addr(int vpid, gva_t addr)
355355

356356
static inline void ept_sync_global(void)
357357
{
358-
__invept(VMX_EPT_EXTENT_GLOBAL, 0, 0);
358+
__invept(VMX_EPT_EXTENT_GLOBAL, 0);
359359
}
360360

361361
static inline void ept_sync_context(u64 eptp)
362362
{
363363
if (cpu_has_vmx_invept_context())
364-
__invept(VMX_EPT_EXTENT_CONTEXT, eptp, 0);
364+
__invept(VMX_EPT_EXTENT_CONTEXT, eptp);
365365
else
366366
ept_sync_global();
367367
}

0 commit comments

Comments
 (0)