Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp980128lqo; Fri, 17 May 2024 07:23:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTMzh5+vxViaADweQcAXUTgEJ7e1wD5gfWHorkEB+NC4ogXZ+1342mk/XiORKz790z9JQfw2ZYoahhusYjCmdyJhQOOZou7+w8pb/qmw== X-Google-Smtp-Source: AGHT+IFNPjbnvxSIeJhddOGm8k1Ik1s3b8djo3KhBKdtie6HTmpVRzku4XyITytnBntTbC6Jb4Os X-Received: by 2002:a17:90a:5d88:b0:2b4:32ae:9a17 with SMTP id 98e67ed59e1d1-2b6cc56a7d2mr20234822a91.11.1715955806985; Fri, 17 May 2024 07:23:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715955806; cv=pass; d=google.com; s=arc-20160816; b=0f1OGzQRmYBba0881hpk4dUXmOHN/FAi8XxVGIE4Ea6u8YpFR5VENHXWlr6TbqBlwk 4i9lnqD75/oDgpoC6kvWXlrK0aTWqmI7OX+qDLqanMdqqBZthNPV5zIyvz72JR5en5s2 5LpiaH85KJptRsJUKFX2W35+3Uh4yyhS5FKwhzKSaVKlrjiu6E0I9DTGly6dTTBYK3LM YFIR7vUYN9/1ZodRQg3nVVWR3kqbO80Rt/PdVW7Sli+GeccH0EVkxtOvxJF80oSmLV2x QAd2khR2mQQ/czMsZk8rHGAOoEhHV/ORm9rAUN2R0OQQdTvPL+VVebiVVc/abIx6/YiN BdOQ== 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=c3pveWliaVBpIJRkTFOCUt+VDqabgnL+FZZBydPaxuw=; fh=hXU1gnBYTQtxPAarsVIsRjsd20EbUeSZmvMOiujEIyU=; b=aHOB8rIWVsN737BpZ/oiYUrXbMIsJzerWUUXWPKhfXkLZKEhQ2pa0TQavetvfgp4ge JqQSf6CmXYHs9Z93NjbsD9p5BYmZnBqqdrU5caPDx4Gu09e8YMcGSYxWDZK1M036cMHc 0Fxtzm4PGWw6nc3ofqQFNT5Th0ocxwK8fm/utGpIpUR0MXrzaV0HArXFX16Xt0FGhSNK xKgASJu2RUkJsBln8pp2Yw1H4SL8le5eVCfUVO1svokPcBhWlHAqcYJjMH8xPCcTl1vK bcTaI4m59tLgtzNj1nqyPm9Ih2DHqTb7BFpFxQH70fP7G8eoXGWkUP5eoT7PkYtI85b2 JarA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GeYX4kLf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182191-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 98e67ed59e1d1-2b628ea7536si3656688a91.95.2024.05.17.07.23.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:23:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182191-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=GeYX4kLf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182191-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 4C68A2860CE for ; Fri, 17 May 2024 14:22:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B79EC6D1BC; Fri, 17 May 2024 14:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GeYX4kLf" 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 425246BB5C; Fri, 17 May 2024 14:20:03 +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=1715955604; cv=none; b=J/CtXoHMPrXyQY5qGCwJ5Bz0GMIIE07T934r6Bf1TQ9/oKnyn7N/lkyaKzIvSzEPP/qDrpqIHs7HtjPnxaRn8K9uYkPPb5d2Np9l2QtWdyLCnorTIfTfi90dPCymLzbYDx3NVHHDeLV+ZPixQnr2aJLpE3W77Sm8VhJSryK+oZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715955604; c=relaxed/simple; bh=/CzwNXVaKGEQ3E9bwjs3O7QSiO6r7/AsWG/VCkB8/H8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a8lJNI2GENWEid1g0bC0FBK3qrY4f239LKOqBMiqHXO+90J8k1V+8+kGwZE2a4EIdjOXECrMKg1zv2TZITBkSV6Ai/NFJh2ZDdUyagaC/gWJQ4Jjj6LCfvW1yN1t1VnM0dcs+TMGwPaYVXOXxpd2yiBMzBYmouVpzadk1MjmoWw= 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=GeYX4kLf; 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=1715955603; x=1747491603; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/CzwNXVaKGEQ3E9bwjs3O7QSiO6r7/AsWG/VCkB8/H8=; b=GeYX4kLfsL0UwjJEYow6qfzUGE11Ss/1A8u0vQijmQ495EDPRFD8Aqj5 kIGxp24XyI/neMdz/oTblSvCwIYtLJJiu54hU6bVbwiZo+xuJTWuQViSo zV2S1YK7HeYz9McVaByO6uvIhfx7mrteGgfDEH3ywFFsshNg68rU1bdMa s3BrIXQBRQiHZRDbFMELcUcw2KF/G5XmeZqrs9POQeBxe8TverPnxi2aL YuznDNSfDg8JsI4SHlpOm+dhgIfxC5Mls4fYUEo96uEcyQv0gX0l0qKTj +Ecu2tYV7jPv41XHgos8at78XtAvtvbD0AqBLTnnyil1Jg/9btjWYT2Dk w==; X-CSE-ConnectionGUID: DweLtl8/S/CHnxpctj+VsA== X-CSE-MsgGUID: +I+bi5KdREiNlwC0CJdCzA== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="22808692" X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="22808692" 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:01 -0700 X-CSE-ConnectionGUID: O4NnF3dCRe+gATw4xDL+bg== X-CSE-MsgGUID: Ps04XFBGQCydR14R0EDIpA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="69253384" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa001.jf.intel.com with ESMTP; 17 May 2024 07:19:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 1B2CED7B; 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 09/20] x86/tdx: Convert MAP_GPA hypercall to use new TDVMCALL macros Date: Fri, 17 May 2024 17:19:27 +0300 Message-ID: <20240517141938.4177174-10-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 TDVMCALL_1() instead of __tdx_hypercall() to issue MAP_GPA hypercall. It cuts code bloat substantially: Function old new delta tdx_enc_status_changed 352 242 -110 tdx_kexec_finish 645 530 -115 tdx_enc_status_change_prepare 326 181 -145 Total: Before=5553, After=5183, chg -6.66% Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/tdx.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index df3e10d899b3..7c874a50a319 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -797,15 +797,10 @@ static bool tdx_map_gpa(phys_addr_t start, phys_addr_t end, bool enc) } while (retry_count < max_retries_per_page) { - struct tdx_module_args args = { - .r10 = TDX_HYPERCALL_STANDARD, - .r11 = TDVMCALL_MAP_GPA, - .r12 = start, - .r13 = end - start }; - - u64 map_fail_paddr; - u64 ret = __tdx_hypercall(&args); + u64 map_fail_paddr, ret; + ret = TDVMCALL_1(TDVMCALL_MAP_GPA, + start, end - start, 0, 0, map_fail_paddr); if (ret != TDVMCALL_STATUS_RETRY) return !ret; /* @@ -813,7 +808,6 @@ static bool tdx_map_gpa(phys_addr_t start, phys_addr_t end, bool enc) * region starting at the GPA specified in R11. R11 comes * from the untrusted VMM. Sanity check it. */ - map_fail_paddr = args.r11; if (map_fail_paddr < start || map_fail_paddr >= end) return false; -- 2.43.0