Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp981584lqo; Fri, 17 May 2024 07:25:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWxgM8URZ85T89in7UIfGx759dVv3TDDOFUAnh5mSLk8yf2AwbYmlbtySjzVd8RI/FdX5+bANl1/YAs35xh0w10OjuCHeURPM/0T9NrOw== X-Google-Smtp-Source: AGHT+IGyB3SmactEGKfDMiKMkvRfyFFDy6AGcA1aRun9iCn73TGKlo18XPS9v9SMdSze5RoqhbxP X-Received: by 2002:a05:6122:1813:b0:4c8:e5a0:4222 with SMTP id 71dfb90a1353d-4df8833c238mr20121701e0c.12.1715955949885; Fri, 17 May 2024 07:25:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715955949; cv=pass; d=google.com; s=arc-20160816; b=rgJT4fjhgp4U8gSQp77uM5NzyYu42zwHjmii43RtjXQY0V4r4vQyYA2WgImpxLOTqX Q6w98Tf/5IO92UfadfMphxb8L+gqdbzh7dgTFU73tb31aZRf8BgXeHEr4Djx9mYIIZ3V LPdK1fg9vc0RerVFOI6BfdpJgMl6MSjnf0KWyvifRY7GZNJj9lDq+HobYZiQkenDE1yd 9+rxG5BslO4cuq/NruFhziwyhnle04VegQUT3G1kjtEZ3QgkEIqtVTcwDrbmwrhU3Pf+ nRhs8yTfMQtsX84IpxzqSUzcucmOBc1SZk1B67Vesxdw6OxEgiRkOQbuUSd2B/uiQ5G0 HvQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UDByX/w7FIj7Cd/WDxtgJLO8R2ryYY7i1clnV889klA=; fh=hXU1gnBYTQtxPAarsVIsRjsd20EbUeSZmvMOiujEIyU=; b=GJWbd5Tu80AKvp0nqxw8dUqjR0KiSGsgP3mDj9Oq6uLDkUFNYkmU7fOLoMZiAxtd+F X6d5jIks0GhvxylCC7L9cgWjXuttvKdvrIA2O18aeF4VNDFnNHd1ZCFkxFOORFw6FYwP Q3DDJj0TMSjOLdq13IgF51t/Mdie0id3/+TYSb8Q+7mHEyI+mwYLxTdXGShgP4jsXT1W 6UybcZ0F398OuM8JPUTYQvVOrHMSdQgm7IbWQdtPEUPm3Vfiq6u0GKX8ZMCkqQlC0DHj AfTrfQ12mbi/f0M9HIJh7MrJIH1r9RZhbS/XBnubLGQgaeY+9CS8GLgFcJCGy4F/03gc j0aQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jRopIITK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182200-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 71dfb90a1353d-4df7c05ad1esi3705187e0c.150.2024.05.17.07.25.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:25:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jRopIITK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182200-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 013811C242D5 for ; Fri, 17 May 2024 14:24:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DBD678C64; Fri, 17 May 2024 14:20:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jRopIITK" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 91F6974C14; Fri, 17 May 2024 14:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715955610; cv=none; b=jc2IhbaknSenjxcrYapFjH7Au44hfz/10fn+du9zYm4CXIIr1rBiLIPS6AkretpeF2+b9zvvd1klwlLDmLNrRYDylCw0+F5/xa/ZTXzBpBwVoKndIj8JnR+FwxbFeIMUTUFMtN5/Ncv1JgoX7qAw1SVAdMhiBnRNVz8GK++OvoA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715955610; c=relaxed/simple; bh=C3SOvLF3a7cbP+wZzmvHsHcoeWpug9aDQsg/WGa80aU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QIIkRhK3e3SJJBYZO49HEzHXJYic6Jw+Ubn5oiogkOd9jApnPtCmcQQUcD4fhbY/v8xOHksHfAiqRY6rxvMiiMn1x/5wahzCtHDzlyypWD2cUP1rY5grVSdJa86c6OZxGEX1riWiD5irCjlqOeLiuwaIeNA9aMRtrAWmk++XIeE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.helo=mgamail.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jRopIITK; arc=none smtp.client-ip=192.198.163.9 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.helo=mgamail.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715955609; x=1747491609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C3SOvLF3a7cbP+wZzmvHsHcoeWpug9aDQsg/WGa80aU=; b=jRopIITKB0S4lvnnH9F1Zp8x0bVm+r29Tl9x+tbEQGU9BbEVJ4kK4aGI HKyisarX4G6YUKLzMoasKO1EQdzYicEYh2vGfTaQKGtOK8zzIsSNoLSNi mvExHr3qro6slp1+DGnMx+iLbTqzb+Lf+7x1stdJD85GUqPXITCe/do9S 1H/efnWYYsZl9Zxdzoi4w67wlokuxNy/EcI+QUUXv3WZdlHO8cl3xlL+n VnhNmX9HjQQWi8Xm20vegd9lJYRjntyVwnhb1XCNBk+EsSDllHMVPzecn iW9yy9o/JSnNCHM1RGbw5DpqAP8TQ0lI80fP/YckwPpCF/SBE43n+TDRh w==; X-CSE-ConnectionGUID: nTMIvi+OSo6mB3yavzPZsg== X-CSE-MsgGUID: OS1miaUbTB23Q/x1TUjsng== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="22808776" X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="22808776" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 07:20:05 -0700 X-CSE-ConnectionGUID: Epx+dGTEQkK5Jo4YWkd2lg== X-CSE-MsgGUID: R+1g+lUET1K9XNzHKwBZqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="31944631" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa009.jf.intel.com with ESMTP; 17 May 2024 07:20:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 84A4010A3; Fri, 17 May 2024 17:19:50 +0300 (EEST) From: "Kirill A. Shutemov" To: Sean Christopherson , Paolo Bonzini , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Josh Poimboeuf , Peter Zijlstra Cc: linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 17/20] x86/tdx: Convert VM_RD/VM_WR tdcalls to use new TDCALL macros Date: Fri, 17 May 2024 17:19:35 +0300 Message-ID: <20240517141938.4177174-18-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517141938.4177174-1-kirill.shutemov@linux.intel.com> References: <20240517141938.4177174-1-kirill.shutemov@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use newly introduced TDCALL instead of tdcall() to issue VM_RD/VM_WR tdcalls It increase code slightly: Function old new delta tdx_early_init 744 776 +32 but combined with VP_INFO changes the total effect on tdx_early_init() is code reduction. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/tdx.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index e1849878f3bc..6559f3842f67 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -76,27 +76,13 @@ static inline void tdcall(u64 fn, struct tdx_module_args *args) /* Read TD-scoped metadata */ static inline u64 tdg_vm_rd(u64 field, u64 *value) { - struct tdx_module_args args = { - .rdx = field, - }; - u64 ret; - - ret = __tdcall_ret(TDG_VM_RD, &args); - *value = args.r8; - - return ret; + return TDCALL_1(TDG_VM_RD, 0, field, 0, 0, value); } /* Write TD-scoped metadata */ static inline u64 tdg_vm_wr(u64 field, u64 value, u64 mask) { - struct tdx_module_args args = { - .rdx = field, - .r8 = value, - .r9 = mask, - }; - - return __tdcall(TDG_VM_WR, &args); + return TDCALL_1(TDG_VM_WR, 0, field, value, mask, value); } /** -- 2.43.0