]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: TDX: Allow userspace to return errors to guest for MAPGPA
authorVishal Annapurve <vannapurve@google.com>
Thu, 5 Mar 2026 22:26:26 +0000 (22:26 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 28 May 2026 00:15:56 +0000 (17:15 -0700)
commit3e2dec1ede0a772c4d7cebd4130a7c4a12de2789
tree570cb06f6809276abbed181630fbee7bdc1cc961
parentb16c2aca369d180dc94275343b34966194317528
KVM: TDX: Allow userspace to return errors to guest for MAPGPA

MAPGPA request from TDX VMs gets split into chunks by KVM using a loop
of userspace exits until the complete range is handled.

In some cases userspace VMM might decide to break the MAPGPA operation
and continue it later. For example: in the case of intrahost migration
userspace might decide to continue the MAPGPA operation after the
migration is completed.

Allow userspace to signal to TDX guests that the MAPGPA operation should
be retried the next time the guest is scheduled.

This is potentially a breaking change since if userspace sets
hypercall.ret to a value other than EBUSY or EINVAL an EINVAL error code
will be returned to userspace. As of now QEMU never sets hypercall.ret
to a non-zero value after handling KVM_EXIT_HYPERCALL so this change
should be safe.

Reviewed-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Vishal Annapurve <vannapurve@google.com>
Co-developed-by: Sagi Shahar <sagis@google.com>
Signed-off-by: Sagi Shahar <sagis@google.com>
Link: https://patch.msgid.link/20260305222627.4193305-2-sagis@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Documentation/virt/kvm/api.rst
arch/x86/kvm/vmx/tdx.c
arch/x86/kvm/x86.h