Re: [PATCH 4/7] KVM: TDX: Handle TDG.VP.VMCALL<MapGPA>

From: Binbin Wu
Date: Tue Dec 17 2024 - 20:38:24 EST





On 12/16/2024 2:03 PM, Xiaoyao Li wrote:
On 12/16/2024 9:08 AM, Binbin Wu wrote:



On 12/13/2024 5:32 PM, Xiaoyao Li wrote:
On 12/1/2024 11:53 AM, Binbin Wu wrote:

[...]
+
+static int tdx_map_gpa(struct kvm_vcpu *vcpu)
+{
+    struct vcpu_tdx * tdx = to_tdx(vcpu);
+    u64 gpa = tdvmcall_a0_read(vcpu);

We can use kvm_r12_read() directly, which is more intuitive. And we can drop the MACRO for a0/a1/a2/a3 accessors in patch 022.
I am neutral about it.


a0, a1, a2, a3, are the name convention for KVM's hypercall. It makes sense when serving as the parameters to __kvm_emulate_hypercall().

However, now __kvm_emulate_hypercall() is made to a MACRO and we don't need the temp variable like a0 = kvm_xx_read().

For TDVMCALL leafs other than normal KVM hypercalls, they are all TDX specific and defined in TDX GHCI spec, a0/a1/a2/a3 makes no sense for them.
OK, make sense.

Thanks!