Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp403796rwp; Wed, 12 Jul 2023 15:31:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlGTkCT8tYSzERrNGeSx1Xa2WDIBeF3Z0qLOoLoeDtS6VLyt28TORce48n3dQ8fneOd4Xa/w X-Received: by 2002:a05:6808:f06:b0:398:2c03:45fc with SMTP id m6-20020a0568080f0600b003982c0345fcmr24287274oiw.15.1689201076426; Wed, 12 Jul 2023 15:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689201076; cv=none; d=google.com; s=arc-20160816; b=TPlHoqiNjI5frHkT8DVbCEhxLf3wzFwzltnrwVrbKxRyuHBY0RHVO4PVlTbcj3z1XL JB5GjKQqv5PMy2syIDYUOe+vTNuFhulSW8t1xScO2OkpLHDGXFy+q664v4paGck8l4g3 LI9F+Ze7V1WpXdv55/+O/4fDAypNtvGl5+iCx4l7KYaeJYk4q9hRYEhjVFxXEoS+rEKZ n0VHaHS0Bl7enpGAGf06n/16QaASQaL+qtchYg4kmfTvFnuW0mV6dpPC09jVZjQyyThS OzJtKcg3R2FJ1zcthsVhN8bt55jwPLtaSYBdCXozBc3sEKMDLId8fbAjnpfAOK9D7j7U XbBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=J75VE/da93k8vRDY9HQXjesLCZCbpKtjsT8bbmwy48o=; fh=/tXhG+n9KmBzXfhMNmSxxId4/FvFtNzetm9ngJbFdLA=; b=rAffL6z/o1pG6UksEdzHSvZCukXWKYJLK+2lbMlkU4UZJ5cYy0RBYcK0Ti/4oM5qse CNLa4KLBugXGnZcwZRGVIlCb0Q+sU2N1BREiAf/x326pqDXmGYwPxlklD7OVrYUtw+XV Vv1wWoaecmL2S8Fb37Ej14fCQBiRPAHyVAXT5OvrFETt3HRJROLN7Vav0BzGTp2deBmk g2yP2qMDLWy1uPS3DQsPFiFmEyaBK9n1Fl0nQ1dBpDYcxNcH+tpmV21KIRTXKbQ+84J3 zFHtKLpfnYE/BuU3TcqhWYvFSq6gccpLWnMhrUpDY5PL9hSmtKQWKt/VQjpV7WmsW33a 8AWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HJl148y2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a056a001a0900b0068035bb7a40si4056831pfv.366.2023.07.12.15.31.03; Wed, 12 Jul 2023 15:31:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HJl148y2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231602AbjGLWFz (ORCPT + 99 others); Wed, 12 Jul 2023 18:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbjGLWFy (ORCPT ); Wed, 12 Jul 2023 18:05:54 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0E59B; Wed, 12 Jul 2023 15:05:54 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-666eef03ebdso54789b3a.1; Wed, 12 Jul 2023 15:05:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689199553; x=1691791553; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=J75VE/da93k8vRDY9HQXjesLCZCbpKtjsT8bbmwy48o=; b=HJl148y2GoIyq7PncvM7QOJx+P0aj4UJ3mAaRAKEE5W/9T0Q8wezhU6vrZNT0/nKiy rG7Z4mJHxVEmqtvK5sq2YkZQhieDBpXAXjkeuz1ct9fVgq3vNjUFOLBr+Spe5Y29Qx1C OL1V7q2+oDsFGIetFEE1OUZK92E3ujhmdLs5HIRvwnBMrVWpCrLxw2nXQN+FAHm6by6F CvGLEzRPd56RJoQvpnZg8qNSDnAQCKwKTvLsLYya/q4OeiqmuxULOKvbh/C+sKhHuZSq bYgREzUU5RkL40Q5KHpJPG3Fr7KM9EC/W9sczyvukfATHCMYm8ueofAAN3UtWlyinTJz EzEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689199553; x=1691791553; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=J75VE/da93k8vRDY9HQXjesLCZCbpKtjsT8bbmwy48o=; b=R06uj/3zA544xDZMXpGWAih2U6dlrIkt7AZFLvIk//kWm0LraHO3Ly2FiAl1XW98E5 8LC4xFGTkBOiCjM8M7rTL2uKBicPsrBUWN6LcSkVjFcqvtFjXM5vn0gvOAFVLfarLDVZ Y3swP74Hp//9YNWPcLGI9VybqveDosAWmGIUEsx93BNEORWX+LIBrJIbzrpqQbIPUseE w2REjNEr6HE6dw5a6wugnCxNU88dOoOdSASo0JkZE+NP63FwqjcerI9SYrUW6qNKEj1U 3kz7Ir3VoviRighECC40Tx9Ab7u6dhT65cUmpoaCFyk6OigNhBSAh0VzPH1DVbPlclNd aYXA== X-Gm-Message-State: ABy/qLZ5JklgHBQhOciMigD5DACGFtqq0hsjekaLbZWEpl59hH8rIx6H hzZhB+TY95rKMl9yV/3XrY4= X-Received: by 2002:a05:6a00:2e92:b0:682:2152:45df with SMTP id fd18-20020a056a002e9200b00682215245dfmr16450241pfb.9.1689199553291; Wed, 12 Jul 2023 15:05:53 -0700 (PDT) Received: from localhost ([192.55.54.50]) by smtp.gmail.com with ESMTPSA id g8-20020aa78188000000b006783ee5df8asm4035983pfi.189.2023.07.12.15.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 15:05:52 -0700 (PDT) Date: Wed, 12 Jul 2023 15:05:51 -0700 From: Isaku Yamahata To: Kai Huang Cc: peterz@infradead.org, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, dave.hansen@intel.com, tglx@linutronix.de, bp@alien8.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, seanjc@google.com, pbonzini@redhat.com, kvm@vger.kernel.org, isaku.yamahata@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, isaku.yamahata@gmail.com Subject: Re: [PATCH 03/10] x86/tdx: Move FRAME_BEGIN/END to TDX_MODULE_CALL asm macro Message-ID: <20230712220551.GF3894444@ls.amr.corp.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 12, 2023 at 08:55:17PM +1200, Kai Huang wrote: > Currently, the TDX_MODULE_CALL asm macro and the __tdx_module_call() > take registers directly as input and a 'struct tdx_module_output' as > optional output. This is different from the __tdx_hypercall(), which > simply uses a structure to carry all input/output. There's no point to > leave __tdx_module_call() complicated as it is. > > As a preparation to simplify the __tdx_module_call() to make it look > like __tdx_hypercall(), move FRAME_BEGIN/END and RET from the > __tdx_module_call() to the TDX_MODULE_CALL assembly macro. This also > allows more implementation flexibility of the assembly inside the > TDX_MODULE_CALL macro, e.g., allowing putting an _ASM_EXTABLE() after > the main body of the assembly. > > This is basically based on Peter's code. > > Cc: Kirill A. Shutemov > Cc: Dave Hansen > Cc: Peter Zijlstra > Suggested-by: Peter Zijlstra > Signed-off-by: Kai Huang > --- > arch/x86/coco/tdx/tdcall.S | 3 --- > arch/x86/virt/vmx/tdx/tdxcall.S | 5 +++++ > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/coco/tdx/tdcall.S b/arch/x86/coco/tdx/tdcall.S > index 2eca5f43734f..e5d4b7d8ecd4 100644 > --- a/arch/x86/coco/tdx/tdcall.S > +++ b/arch/x86/coco/tdx/tdcall.S > @@ -78,10 +78,7 @@ > * Return status of TDCALL via RAX. > */ > SYM_FUNC_START(__tdx_module_call) > - FRAME_BEGIN > TDX_MODULE_CALL host=0 > - FRAME_END > - RET > SYM_FUNC_END(__tdx_module_call) > > /* > diff --git a/arch/x86/virt/vmx/tdx/tdxcall.S b/arch/x86/virt/vmx/tdx/tdxcall.S > index 3524915d8bd9..b5ab919c7fa8 100644 > --- a/arch/x86/virt/vmx/tdx/tdxcall.S > +++ b/arch/x86/virt/vmx/tdx/tdxcall.S > @@ -1,5 +1,6 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #include > +#include > #include > > /* > @@ -18,6 +19,7 @@ > * TDX module. > */ > .macro TDX_MODULE_CALL host:req > + FRAME_BEGIN > /* > * R12 will be used as temporary storage for struct tdx_module_output > * pointer. Since R12-R15 registers are not used by TDCALL/SEAMCALL > @@ -91,4 +93,7 @@ > .Lno_output_struct: > /* Restore the state of R12 register */ > pop %r12 > + > + FRAME_END > + RET > .endm > -- > 2.41.0 > Reviewed-by: Isaku Yamahata -- Isaku Yamahata