Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1184737pxb; Thu, 7 Oct 2021 02:35:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN4DpPQWuFIhnURnP6Dlo0mS55P6EsxBU9Dg0wwJ80yv/mWzR2tQ7wZW5tCVfVOzGUvryO X-Received: by 2002:a17:902:7d89:b0:13c:a5e1:f0f1 with SMTP id a9-20020a1709027d8900b0013ca5e1f0f1mr2806167plm.24.1633599311408; Thu, 07 Oct 2021 02:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633599311; cv=none; d=google.com; s=arc-20160816; b=F3VmxZsMZE/qs/Im49i7tqnfdjOG+k+MzAiwuD9dtN9tdCfCwDxV20EGhXtrPh3X2j yCs00rodCjShP+TCJM+2RIpJCwX75VpNhgjZ1KXgBPp93FiCB8Guqj6ZBV3dcCS5L5cZ nGsEg/9c2+/EhKiOpOTNyg8VWn5FBV7WFp1UCyc4kb/glX0knCpkuNZKqY3sd0ZjENnN W5q3qPc0LpTmSCBRKd81O5oXrPB3daVvTvJWUgXDfOKQF9ImJNoezpro1k8NK3623aBO hxfaugRdwJTRahCjnlZz7RsgaxUIzr3PJdWUHr8gXj6W3J0GJjTx5eXsWf00TCWdtQw5 Rohg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RW40Hv5VFmiMJlybhaNrdjyvzkHSsnIr8Xa3EbVzVdU=; b=euIXKVUFQ1phCjq2ib2C2DgVC9NGP6vnpkNUH9jTWCZiNNgq6MannEn0HF1jjhPM2I qtdXXGmPCVZN4LquFSnsRCtYcTePX47yZC2nunjmYGTevs5YXWCPHao4Fwtxf8nq3Iqu uMoVNrAIcOpr8PaWFlAnt3YcDx8mgU1IF4by79KBcZTFRTQMymF/Wl3AEuTWgHehuQVY uRhFo2bs1spkzvo63Ma/7j+0zbOB0jDbnPapX2jxROKUNs8wnpun4RhLU6RtoRVqxrLm RGYFr2tCcPQS7wQOOvTqALZAGaaC+ECU5h0VUpuZc1ebP6q7vvY/BQFLOZy5SWTbYOW6 EgKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=OwRD+DYB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si8064809pfb.259.2021.10.07.02.34.57; Thu, 07 Oct 2021 02:35:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=OwRD+DYB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240600AbhJGJgA (ORCPT + 99 others); Thu, 7 Oct 2021 05:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232700AbhJGJf6 (ORCPT ); Thu, 7 Oct 2021 05:35:58 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E068C061746 for ; Thu, 7 Oct 2021 02:34:05 -0700 (PDT) Received: from zn.tnic (p200300ec2f0cc9002e15c3e32d435b8a.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:c900:2e15:c3e3:2d43:5b8a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 408E71EC04B9; Thu, 7 Oct 2021 11:34:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1633599243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=RW40Hv5VFmiMJlybhaNrdjyvzkHSsnIr8Xa3EbVzVdU=; b=OwRD+DYBlSMHPjmDFTh3jXE8N0/sHV/AC2hVhqWqfylbRPOpIbPkQzNoMLXw3he50/Sp7v rLZ5FAEADcYQHxzIyrbEPqbBvPqddq9UFgtyZ1q6qXu7d5IQmyBk9U7hf3bRAqxYGZ27e6 5RTo1z1VzZSGSGG500uHqASRgJV0nKM= Date: Thu, 7 Oct 2021 11:33:58 +0200 From: Borislav Petkov To: Kuppuswamy Sathyanarayanan Cc: Thomas Gleixner , Ingo Molnar , x86@kernel.org, Paolo Bonzini , David Hildenbrand , Andrea Arcangeli , Josh Poimboeuf , Juergen Gross , Deep Shah , VMware Inc , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 05/11] x86/tdx: Add __tdx_module_call() and __tdx_hypercall() helper functions Message-ID: References: <20211005025205.1784480-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211005025205.1784480-6-sathyanarayanan.kuppuswamy@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211005025205.1784480-6-sathyanarayanan.kuppuswamy@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 04, 2021 at 07:51:59PM -0700, Kuppuswamy Sathyanarayanan wrote: > diff --git a/arch/x86/kernel/tdx.c b/arch/x86/kernel/tdx.c > index ad3ff5925153..d5fc2904facf 100644 > --- a/arch/x86/kernel/tdx.c > +++ b/arch/x86/kernel/tdx.c > @@ -27,6 +27,29 @@ static void __init is_tdx_guest_init(void) > is_tdx_guest = !memcmp("IntelTDX ", sig, 12); > } > > +/* > + * Wrapper for standard use of __tdx_hypercall with BUG_ON() check > + * for TDCALL error. > + */ > +static inline u64 _tdx_hypercall(u64 fn, u64 r12, u64 r13, u64 r14, > + u64 r15, struct tdx_hypercall_output *out) > +{ > + struct tdx_hypercall_output outl = {0}; Why do you need to clear this when, if used, it will get completely overwritten in __tdx_hypercall()? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette