Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp981190lqo; Fri, 17 May 2024 07:25:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV91TiWR6WHDiU0WLoQh+rrcHXtrWgSu8H+1qxcM6c7RAj8CiWbx9tN16G6NqqNHE1dpKEumZ7VCKXTkWsFh44A19/ULDJFrFIGkNfX2Q== X-Google-Smtp-Source: AGHT+IHJs8p2Ag2ZKUHlum+6yU8gWzaf6ljbWfmAcc1C7gvbUY+lOwiCu5cYyeCspkkEaeOH+803 X-Received: by 2002:a05:6e02:18c5:b0:36b:2731:83ce with SMTP id e9e14a558f8ab-36cc148d0e4mr262084045ab.8.1715955910377; Fri, 17 May 2024 07:25:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715955910; cv=pass; d=google.com; s=arc-20160816; b=GsIaJDvtP+t4YQ8OiP4o+2EdH42xGgSbBClXW8WZbbZ0ACUfQ4q0JpzenVFgnRzQ+f ujadmCmmXLzM0NYf1+dCWEACbNcFCYjwvGi93neCuGzmVsK7+Kjl2K9/wHx6ECg9WhpC IzcMsGkgMka8w+U+gCC8NeK9twUPHlqO5nho09195keJloYMABfNAtrwZE1hUxakKrqA lnGXgfF3f00/f3UrBqNp8NRVMwkZCO0fbdAeet7LkhXGPyvs5TGWM51u8nQ7If54rauJ EO0YgPXAwNZHCH5JAxTG08ed8PQiClc15LoyTU9iO3RMqooUh/h12MbPtLOskoeQD4uH eMZw== 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=5dnq9k2KsYs/BVNM5SuI7L5HFk/JJpiV/0VdwiahU4c=; fh=hXU1gnBYTQtxPAarsVIsRjsd20EbUeSZmvMOiujEIyU=; b=aZqrhFH93boBXfy+oV4eb7v+cBIJtN4TgoL7x/Uulff0n2Ceuj0GC2HDix2an41iOs KD4nY2vz7qGmrkl0go5amuiOfCM5cSFfCZ3OKY1TFQz4ER4E+xTmyybWmkwQhYfzVnFE vwcqkEcybmL+Qe16u+RHfvARKRJjIEcQztcEUKRoiuPLGfGM4ywDxRo1MHQbhVZd0Nhg j500Fsib1vH3ZgMFnTaKqCvp3ymphMPgva4EBhhKM2Zen8F9vGjaTg/t6Etn0LAY7BxB AYMfboP4JpESlEqcEoWP77rDm0zBiaGCn114Xhp8bl5KYIK1bsZXvewwgt8GTPHd+kVw wTTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FkT9baaF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182199-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 41be03b00d2f7-658be9f98d0si3852067a12.75.2024.05.17.07.25.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:25:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182199-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=FkT9baaF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182199-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 1ABF1286497 for ; Fri, 17 May 2024 14:23:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28E9376410; Fri, 17 May 2024 14:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FkT9baaF" 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 6E44173514; Fri, 17 May 2024 14:20:07 +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=1715955609; cv=none; b=qCqmY4mE48CJ2ip35NQ2RHZhBcvvyFJn1Kn4xN/T30CtkaSw17uA7rmDDzlPdPL+7Wx2N9w9pAfcSbqrVEinUxMbgCqC5P/VKsZcBsEWDle5Jjyx4vV500RVsjBL8OL+Q/d9/yEa19p3gWjCgUSsNekTN5WzBwZRzdGhhivcnvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715955609; c=relaxed/simple; bh=+tEVi3m8qovNSY+AQYMMcgzTha+KB60hRspc+QX9Oac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q/KLPd4txaThLjarI2npf2Q+UOUcEOVI61oqQXBfFMcaejVvNe4lwA89yg/iiLiA24oRUvCFgmSLAbJbTNWJGAdq7+iOxsf7pYuP8uoYENJrZYacd82uma8iRGIV3bRUuerWnqI8JK+aZ5MXb23Db2tQ0UAdkNLbWtkfez/B3wY= 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=FkT9baaF; 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=1715955608; x=1747491608; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+tEVi3m8qovNSY+AQYMMcgzTha+KB60hRspc+QX9Oac=; b=FkT9baaF1BrrZuHMQw93q8He0AX5jBqQz/DlcZZMVYKCP6e0URtBMTjY DFPyVGafWCRMWbPBuLbq0LL6P/11Ofh+oeGte3CojTMQqbX/LJKqutAOF IqIWkpOki3J7le+579o0cA/WoDeB+zhfTILNk1MpS9CTATKz7AXGX5Pju E4v/trbAlAIMmEEeE/E7xjfsi3DpcAu2hBJd0wnTRt1bBCXmftK0664yC vUdUipf4TmbIl3y0xMLVMCF8Bbzr+sjudbfm7WUmDCZLtHh1Oa+zhkEuZ 9x2J9B74l3v3s/9wkaHA/kX8aQlwX8bAbiohHdrz8QBKbEKRLEVMm+Cb8 g==; X-CSE-ConnectionGUID: ueQn+DTQR82svELmu6qOHg== X-CSE-MsgGUID: wUAaKOE4Tv2qZtfldrttQw== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="22808754" X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="22808754" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 07:20:05 -0700 X-CSE-ConnectionGUID: 0/qU8eDTSq6mSdb2tK0n+Q== X-CSE-MsgGUID: C1NoCwySQLm2a2euxgmfAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="69253427" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa001.jf.intel.com with ESMTP; 17 May 2024 07:20:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 9AADB1146; 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 19/20] x86/tdx: Convert MR_REPORT tdcall to use new TDCALL_0() macro Date: Fri, 17 May 2024 17:19:37 +0300 Message-ID: <20240517141938.4177174-20-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_0() instead of tdcall() to issue MR_REPORT tdcall. It cuts code bloat substantially: Function old new delta tdx_mcall_get_report0 229 111 -118 Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/tdx.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index 42436a43bb49..45be53d5eeb4 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -101,19 +101,15 @@ static inline u64 tdg_vm_wr(u64 field, u64 value, u64 mask) */ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport) { - struct tdx_module_args args = { - .rcx = virt_to_phys(tdreport), - .rdx = virt_to_phys(reportdata), - .r8 = TDREPORT_SUBTYPE_0, - }; u64 ret; - ret = __tdcall(TDG_MR_REPORT, &args); - if (ret) { - if (TDCALL_RETURN_CODE(ret) == TDCALL_INVALID_OPERAND) - return -EINVAL; + ret = TDCALL_0(TDG_MR_REPORT, virt_to_phys(tdreport), + virt_to_phys(reportdata), TDREPORT_SUBTYPE_0, 0); + + if (TDCALL_RETURN_CODE(ret) == TDCALL_INVALID_OPERAND) + return -EINVAL; + else if (ret) return -EIO; - } return 0; } -- 2.43.0