Re: [PATCH v2 1/2] KVM: VMX: Add a wrapper to read index of GPR for INVPCID, INVVPID, and INVEPT

From: Sean Christopherson
Date: Wed Nov 03 2021 - 19:05:04 EST


On Wed, Nov 03, 2021, Vipin Sharma wrote:
> handle_invept(), handle_invvpid(), handle_invpcid() read the same reg2

"same reg2" doesn't provide any context as to what "reg2" is, or what it's used
for.

> on VM exit. Move them to a common wrapper function.

"Move them to a common helper function" reads as if the patch is moving the
whole handle_*() code :-)

handle_invept(), handle_invvpid(), handle_invpcid() read the same reg2
field in vmcs.VMX_INSTRUCTION_INFO to get the index of the GPR that holds
the invalidation type. Add a helper to retrieve reg2 from VMX instr info
to consolidate and document the shift+mask magic.

> Signed-off-by: Vipin Sharma <vipinsh@xxxxxxxxxx>

Changelog nits aside,

Reviewed-by: Sean Christopherson <seanjc@xxxxxxxxxx>