Re: [PATCH v5 09/12] x86/tdx: Wire up KVM hypercalls

From: Kuppuswamy, Sathyanarayanan
Date: Tue Aug 24 2021 - 15:12:03 EST




On 8/24/21 11:29 AM, Borislav Petkov wrote:
On Tue, Aug 24, 2021 at 11:11:43AM -0700, Kuppuswamy, Sathyanarayanan wrote:
Since TDX code can be used by other hypervisor (non KVM case) we
want to have a config to differentiate the KVM related calls.

You need to start explaining yourself better. WTH does "to differentiate
the KVM related calls" even mean? Differentiate for what?!

tdx_kvm_hypercall() function and its usage in arch/x86/include/asm/kvm_para.h
is only required for KVM hypervisor.

static inline long kvm_hypercall0(unsigned int nr)
{
long ret;
+
+ if (prot_guest_has(PATTR_GUEST_TDX))
+ return tdx_kvm_hypercall(nr, 0, 0, 0, 0);

If the TDX code is complied for another hypervior, we need some config to
disable above the above code. CONFIG_INTEL_TDX_GUEST_KVM is added
for this purpose. If you think there is no sufficient reason, I can
use defined(CONFIG_KVM_GUEST) && defined(CONFIG_INTEL_TDX_GUEST) to protect
the implementation of tdx_kvm_hypercall()



Our CONFIG space is a huuge mess. Adding another option better be
properly justified.

Compiler raised version generation issue for __tdx_hypercall

-ENOTENOUGHINFO.

Following is the error info.

WARNING: modpost: EXPORT symbol "__tdx_hypercall" [vmlinux] version generation failed, symbol will not be versioned.

So to fix the above issue, added tdx.h in arch/x86/include/asm/asm-prototypes.h


Try again.

Yes. I will fix this in next version.

And here audit all your patchsets. All exports better be _GPL.

Ok. I will check it before my next submission.



--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer