Skip to content

Commit e0ff302

Browse files
committed
KVM: SEV: Rename kvm_ghcb_get_sw_exit_code() to kvm_get_cached_sw_exit_code()
Rename kvm_ghcb_get_sw_exit_code() to kvm_get_cached_sw_exit_code() to make it clear that KVM is getting the cached value, not reading directly from the guest-controlled GHCB. More importantly, vacating kvm_ghcb_get_sw_exit_code() will allow adding a KVM-specific macro-built kvm_ghcb_get_##field() helper to read values from the GHCB. No functional change intended. Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Link: https://lore.kernel.org/r/20250919223258.1604852-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent fc55b4c commit e0ff302

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

arch/x86/kvm/svm/sev.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,7 +3220,7 @@ void sev_free_vcpu(struct kvm_vcpu *vcpu)
32203220
kvfree(svm->sev_es.ghcb_sa);
32213221
}
32223222

3223-
static u64 kvm_ghcb_get_sw_exit_code(struct vmcb_control_area *control)
3223+
static u64 kvm_get_cached_sw_exit_code(struct vmcb_control_area *control)
32243224
{
32253225
return (((u64)control->exit_code_hi) << 32) | control->exit_code;
32263226
}
@@ -3246,7 +3246,7 @@ static void dump_ghcb(struct vcpu_svm *svm)
32463246
*/
32473247
pr_err("GHCB (GPA=%016llx) snapshot:\n", svm->vmcb->control.ghcb_gpa);
32483248
pr_err("%-20s%016llx is_valid: %u\n", "sw_exit_code",
3249-
kvm_ghcb_get_sw_exit_code(control), kvm_ghcb_sw_exit_code_is_valid(svm));
3249+
kvm_get_cached_sw_exit_code(control), kvm_ghcb_sw_exit_code_is_valid(svm));
32503250
pr_err("%-20s%016llx is_valid: %u\n", "sw_exit_info_1",
32513251
control->exit_info_1, kvm_ghcb_sw_exit_info_1_is_valid(svm));
32523252
pr_err("%-20s%016llx is_valid: %u\n", "sw_exit_info_2",
@@ -3335,7 +3335,7 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm)
33353335
* Retrieve the exit code now even though it may not be marked valid
33363336
* as it could help with debugging.
33373337
*/
3338-
exit_code = kvm_ghcb_get_sw_exit_code(control);
3338+
exit_code = kvm_get_cached_sw_exit_code(control);
33393339

33403340
/* Only GHCB Usage code 0 is supported */
33413341
if (svm->sev_es.ghcb->ghcb_usage) {
@@ -4340,7 +4340,7 @@ int sev_handle_vmgexit(struct kvm_vcpu *vcpu)
43404340

43414341
svm_vmgexit_success(svm, 0);
43424342

4343-
exit_code = kvm_ghcb_get_sw_exit_code(control);
4343+
exit_code = kvm_get_cached_sw_exit_code(control);
43444344
switch (exit_code) {
43454345
case SVM_VMGEXIT_MMIO_READ:
43464346
ret = setup_vmgexit_scratch(svm, true, control->exit_info_2);

0 commit comments

Comments
 (0)