Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp980918lqo; Fri, 17 May 2024 07:24:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVOAeVF6CWIB0lMreai+NxypxI/4RpjmyMa7NKNlagPjvvEk+oH8scH7LCzxhb0HKeqi6D5EYavqE8QqLIqurSVO/45PBWyrPsP3UHtug== X-Google-Smtp-Source: AGHT+IEGAnoKGwQYyxgLTAzS65f33aU0RG5gTTL5kiDhYcLbWQnlwNjQWxw98ap3wUUrQHLzxyK8 X-Received: by 2002:a05:6122:2a51:b0:4d8:75ca:8cbe with SMTP id 71dfb90a1353d-4df8839a7cemr19011410e0c.16.1715955881948; Fri, 17 May 2024 07:24:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715955881; cv=pass; d=google.com; s=arc-20160816; b=sqicFxoqFJJa5ZTgmr10/EASkickXQNB60jOyfZGMysshc3xfuMqORdW9nITUnYZHl W+TizfWaQsfIQjKbhOjSd7B30VwUTduIkN/N4roIawTBl6J7IfLgYbX7OUkqgoLtc5Z0 eaho+qUjKaixN6F7sDCkhITl+FMO5PSlFWV0103TXuTUCr56DM/lSOAl2D8b8lonUO0E h1xf6f+sal0nVmC3WGjkmSUrXDMHS9SGVp3Sdaej3gtzMejH5y2QYzTTafqtJtZCW1cC 6WxFrerNiuItxMKLfF+PHPmVVz9WI6L8BM/QdS2dltLD+AmR13S9rIAXnzgQQeFMRs/E jgIA== 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=lytHEbhUKPlF7Rd5a0KtQjI06lJrE+x/QqDyqeAeBXo=; fh=hXU1gnBYTQtxPAarsVIsRjsd20EbUeSZmvMOiujEIyU=; b=lqfQIQsgNi27twgvlic2GPwGEFVJux9CdtJO0ZZGXwat4QJ5Ut/R+YIZPbR87tuwHc P387l9tnmIuqX6lO4Z5BD/105WCINt7GZiBYSOQwj6HrATvnJWY1vyEtNpvnrUWROgYy bWQ9x9hqUgVlPNZZ7xf/g0BzqDdbomb7rN0p/TAAkuZ2yLX5ESdd+ED2h0sgSOPYHZkB pDZ0ZKN6UjEBc2bQeOCWIF8Hs11W9/3586YGOSb/zVE7NjAozQRZI3nGr9jwFxpOOvXX ARDm8cNXKKFflZO6QVJ6ZEvQldB+B2EVqoJGb0PYXkoO0IqElCz7UdG7jOSVOP8FxgYi 5iDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fa+jE+S9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182196-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182196-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 ada2fe7eead31-4806cc91063si3312473137.644.2024.05.17.07.24.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182196-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=fa+jE+S9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-182196-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182196-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 78EFD1C23A76 for ; Fri, 17 May 2024 14:23:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8290A74C04; Fri, 17 May 2024 14:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fa+jE+S9" 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 17D0271750; Fri, 17 May 2024 14:20:06 +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=1715955607; cv=none; b=eXq7euzZohIjYNG3hlpiNgglVW3sNLYQzPW/rqjwRsDfo9+JR6bWWOfME0W4I9SD8O4jvdhQJmyq+SYcEagr3lETy4vOTS4nCKfFUVp7R1yCHVxsyPJa5R9e+sI0b0ngHJkh0IvpqGxGxue0bImXBI5maw4YfYrZrbwHM5Fq2qc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715955607; c=relaxed/simple; bh=0sOCyuIE9yUNs9m+zPMFvR+dpm6EUDIzGSm4n+Yw9H8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AN+Z1/MQxsNjmcpqmmKzWMKsSLBZzDG6FtCLucxB2Z2tnffszyZpE1IXB5EuEQHXVKkn3ROvNAT7GW6FNwcFVgDL9ghahPZ4mxOcJF7vkxHC0Sz7Q/q/wr9wGynG2CG+Zjb5yy13gwo98QzowNdO7CHeRqJZ/OdWcBsb3SjBGpU= 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=fa+jE+S9; 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=1715955606; x=1747491606; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0sOCyuIE9yUNs9m+zPMFvR+dpm6EUDIzGSm4n+Yw9H8=; b=fa+jE+S9VKRCFbxq+aimz5+aVgZPokraQl8xD9uVOcQjnXVfoeIj/2hY iTtD3w+ImUWYJz8xUHMWdCuUHF/83IlKteBtUWji2uWjMnjAm5XUQZluS E2Cc71KsDFM/a/cdd+0QqBbzU/cTs/x9UN+eHC3iCITBafCIBf0iLH03/ vltlmwdOpr55EkHH1ETNK6XxeDXDj4CRq4IcTxtYT5qXv0Sc0IQwugqRA XI+92kINmdGIRtedwQlVWX7Xl7W9gpkWlNsZnuJUQynkvglwyLHLkVcax Sh/4ZEwZpYXMaYBzpNNcmQvgI3YcnXIJkrFdJ31skuWmCwwRT1vj2Q7fh A==; X-CSE-ConnectionGUID: +boyJUc8T2OD97z34jwl4w== X-CSE-MsgGUID: 4xCxoDkkSsmfXGbgmuhBQA== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="22808729" X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="22808729" 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:04 -0700 X-CSE-ConnectionGUID: Yq5WDUTCRuOlXKKW2AH2Qw== X-CSE-MsgGUID: KD9wOimsS0GmnoCnwUgOkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="69253422" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa001.jf.intel.com with ESMTP; 17 May 2024 07:20:00 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 69760F21; 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 15/20] x86/tdx: Convert PAGE_ACCEPT tdcall to use new TDCALL_0() macro Date: Fri, 17 May 2024 17:19:33 +0300 Message-ID: <20240517141938.4177174-16-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 PAGE_ACCEPT tdcall. It cuts code bloat substantially: Function old new delta tdx_accept_memory 592 233 -359 Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/tdx-shared.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/coco/tdx/tdx-shared.c b/arch/x86/coco/tdx/tdx-shared.c index 1655aa56a0a5..9104e96eeefd 100644 --- a/arch/x86/coco/tdx/tdx-shared.c +++ b/arch/x86/coco/tdx/tdx-shared.c @@ -5,8 +5,8 @@ static unsigned long try_accept_one(phys_addr_t start, unsigned long len, enum pg_level pg_level) { unsigned long accept_size = page_level_size(pg_level); - struct tdx_module_args args = {}; u8 page_size; + u64 ret; if (!IS_ALIGNED(start, accept_size)) return 0; @@ -34,8 +34,8 @@ static unsigned long try_accept_one(phys_addr_t start, unsigned long len, return 0; } - args.rcx = start | page_size; - if (__tdcall(TDG_MEM_PAGE_ACCEPT, &args)) + ret = TDCALL_0(TDG_MEM_PAGE_ACCEPT, start | page_size, 0, 0, 0); + if (ret) return 0; return accept_size; -- 2.43.0