On Tue, Dec 19, 2023 at 04:27:51PM -0800, Alexey Makhalov wrote: > > > On 12/19/23 3:23 PM, kirill.shutemov@xxxxxxxxxxxxxxx wrote: > > On Tue, Dec 19, 2023 at 01:57:51PM -0800, Alexey Makhalov wrote: > > > diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c > > > index 3aa1adaed18f..ef07ab7a07e1 100644 > > > --- a/arch/x86/kernel/cpu/vmware.c > > > +++ b/arch/x86/kernel/cpu/vmware.c > > > @@ -428,6 +428,30 @@ static bool __init vmware_legacy_x2apic_available(void) > > > (eax & BIT(VCPU_LEGACY_X2APIC)); > > > } > > > +#ifdef CONFIG_INTEL_TDX_GUEST > > > +unsigned long vmware_tdx_hypercall(unsigned long cmd, > > > + struct tdx_module_args *args) > > > +{ > > > + if (!hypervisor_is_type(X86_HYPER_VMWARE)) > > > + return 0; BTW, don't you want to warn here to? We don't expect vmware hypercalls to be called by non-vmware guest, do we? > > > + > > > + if (cmd & ~VMWARE_CMD_MASK) { > > > + pr_warn("Out of range command %x\n", cmd); > > > + return 0; > > > > Is zero success? Shouldn't it be an error? > > VMware hypercalls do not have a standard way of signalling an error. > To generalize expectations from the caller perspective of any existing > hypercalls: error (including hypercall is not supported or disabled) is when > return value is 0 and out1/2 are unchanged or equal to in1/in2. You are talking about signaling errors over hypercall transport. But if kernel can see that something is wrong why cannot it signal the issue clearly to caller. It is going to be in-kernel convention. And to very least, it has to be pr_warn_once(). -- Kiryl Shutsemau / Kirill A. Shutemov