Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1250112lqd; Thu, 25 Apr 2024 09:46:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDo7bRAxZLlig/hMLPchhou573QfojNflKAJjIsLK3R21PYQbPskqPLvPlt6AYnjkJFjAUDijSX1yxbDjWXlHpQVY4KhqwrficJCP73g== X-Google-Smtp-Source: AGHT+IHF7nqWkz+dIt7LjfXDtpcGoNEUxJHHv37PBLHmp0fNo8J7+ObLeSa0WvrAkoAVsDwFrC3v X-Received: by 2002:a05:6870:c143:b0:22e:c37c:453d with SMTP id g3-20020a056870c14300b0022ec37c453dmr8336092oad.30.1714063599210; Thu, 25 Apr 2024 09:46:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714063599; cv=pass; d=google.com; s=arc-20160816; b=uyW3DpmlAqBRfZvHWHhbtNQ0lPfd9oM5/ClXz5e8s8IKwikNIYxR3Sly5eZFkGy9+S y67GrRDI31ln95DJ6G+C+RRZJPXDq2UIFyOc88YWZw4B1YY1f5v59X7qkx7ITH9c6DsD ekoTFQ2Ab+1EIcvLmampc8/9CUyAeomWaautCOKsJVuO9Bs7lDQdsx1uaCWHUR+xfUBv cA+E8vZZiTCL7egWhGi8AS6ltPgVqjAFxPVcKpUaq6IHQLuO+jJtFoNn2B6/YsKazRS4 QawfUeOK0P3Sh79Fhu6wbxOHW/+zHXF9ROtvRVofrBT3bFGMAGfGO9ishTdAPSdkFjjE fZLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5rb/RgD+DcCrNza+pLOqDRhY39Zz5/tMxnCk0ruESQI=; fh=0QEZP38QxNfWmYSscAfu9lwWLyQdos4zhMUPDHP/qEM=; b=TnR/2q3JGNzMbErC9fc5714ya8sJ2rnInvDIZ9jMHc2wpxvo0wKsFqeDLt5Pg5APFB FxGxf8EI/5vruuZTFLukxdDplpYt9+lUGc4ixIqkJABII3+AGkj8b0MkTygHyuM46Ycb 0pv0KrTpDg3v7A+Xdg3dPUWMUrQrrbsg9LaUsKnsDLcXJF+SaMVn1NpEu6kC1DzXmgPL 2a8H15mKbw5H/K5NHY/2+94+ZQnSjSOkdl7eAW8hnIV/2Vk/v+0HKPAAXfD3wUobDZUk Xj4VE7dZ/hPzVvb5GUCIxgGHTv8cWk8rfXXfTNx/Hq82T3TAyLSuq/S5A+ypOuayeVbs aKpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Jti/QiDy"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-158925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b7-20020a6567c7000000b005e83b65bc52si13318374pgs.204.2024.04.25.09.46.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 09:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Jti/QiDy"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-158925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1329B2819B1 for ; Thu, 25 Apr 2024 16:46:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDAF814D451; Thu, 25 Apr 2024 16:46:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jti/QiDy" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEE83149E0E; Thu, 25 Apr 2024 16:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714063590; cv=none; b=LdDq0enzlP66UDfkvVSP7ZZ0D6KsE4CdKq41tGGiEmq62fsDdSiTyq6j8jF25io5xpU07Le2Ax7tQBHHqUMA8U8LpaPGwAoou8zzA4d9f0qhlYVaBQoDVYDLLXTeVVbGz7I3DXxiYeq0ZsspAljIO//2rpxAvgjlJHcqVZ/l95k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714063590; c=relaxed/simple; bh=ysF7TXAsd4zm/OuIu16TsdOJ8lw2epFcOFfDOSyjUUs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=j1r6OE3Q97pJ2kw57vShPqVOr4C85rIwE3JUAxQAwYlWuoTlWqq29dlG/G/2iEfSGWs3jfKxirJb8gialo5P8FK/MzB87JbqghmOeSp/7aOH52osBKPsp+V42r03PxNHQhKWHwMGDp+ffV8Sb1wmMcyx1pKoYOcFYisazGC96tc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Jti/QiDy; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714063587; x=1745599587; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ysF7TXAsd4zm/OuIu16TsdOJ8lw2epFcOFfDOSyjUUs=; b=Jti/QiDyH1ceRRyVrlZYBoPVo7Pr++JbhwccBpnPaI5A+AQwhlM3P6T9 CPUmIYzpwqVOpe8rXWxqZ8iGTNaWMVHqcapafKRqzd2PWFyzxX+tXs974 M9PPoEHd5hC3cDK962gqfAvtP4V/E9yPU7iHskQS1dBhVHL5GgJELUjD3 DIbxtlS1oDcQF8Vmzj96AJGSQOUuoEJB/Z4j2GU8dBq+9oVSafryIEdSm sS9+q9DP1Yk8wPn2wRoO+s9thty9oKm9Rk/xDd3qghUUupP/mxYc9ZZmE KYXbiBvq8WK4+LWvwWmumVbyHrSQ/xi+YevcarnP4M13EVgjSA2cklZUg g==; X-CSE-ConnectionGUID: ZIAN8y6uQxWivzKykqrgCw== X-CSE-MsgGUID: 9ceAPrpGQYuLYV1xCytXGA== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="9592438" X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="9592438" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 09:46:26 -0700 X-CSE-ConnectionGUID: rMgnQaGYRO2JqGOTe9UkHw== X-CSE-MsgGUID: hrs+5haTSKW8KY+vWSbgNg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="25226349" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa010.fm.intel.com with ESMTP; 25 Apr 2024 09:46:23 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id D8DAF288; Thu, 25 Apr 2024 19:46:21 +0300 (EEST) Date: Thu, 25 Apr 2024 19:46:21 +0300 From: "kirill.shutemov@linux.intel.com" To: Sean Christopherson Cc: Rick P Edgecombe , Tina Zhang , Dave Hansen , Hang Yuan , "x86@kernel.org" , Kai Huang , Bo2 Chen , "sagis@google.com" , "linux-kernel@vger.kernel.org" , "isaku.yamahata@gmail.com" , Erdem Aktas , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , Isaku Yamahata Subject: Re: [PATCH v19 007/130] x86/virt/tdx: Export SEAMCALL functions Message-ID: References: <54ae3bbb-34dc-4b10-a14e-2af9e9240ef1@intel.com> <39e9c5606b525f1b2e915be08cc95ac3aecc658b.camel@intel.com> <7otbchwoxaaqxoxjfqmifma27dmxxo4wlczyee5pv2ussguwyw@uqr2jbmawg6b> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Apr 19, 2024 at 12:53:19PM -0700, Sean Christopherson wrote: > > But I guess we can make a *few* wrappers that covers all needed cases. > > Yeah. I suspect two will suffice. One for the calls that say at or below four > inputs, and one for the fat ones like ReportFatalError that use everything under > the sun. I ended up with three helpers: - tdvmcall_trampoline() as you proposed. - tdvmcall_report_fatal_error() that does ReportFatalError specificly. Pointer to char array as an input. Never returns: no need to save/restore registers. - hv_tdx_hypercall(). Hyper-V annoyingly uses R8 and RDX as parameters :/ > Not sure, haven't looked at them recently. At a glance, something similar? The > use of high registers instead of RDI and RSI is damn annoying :-/ I defined three helpers: TDCALL_0(), TDCALL_1() and TDCALL_5(). All takes 4 input arguments. I've updated the WIP branch with the new version: https://github.com/intel/tdx/commits/guest-tdx-asm/ Any feedback is welcome. -- Kiryl Shutsemau / Kirill A. Shutemov