Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp247954rwp; Wed, 12 Jul 2023 12:38:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlHM4dGMzaAu62Rhmy+Zrq67CwLUMZpFcqb3Rm8qDkHrAvqSWyvK33dl3tb7t/i2kOGesuQv X-Received: by 2002:a05:6a20:138d:b0:126:a5e3:3938 with SMTP id hn13-20020a056a20138d00b00126a5e33938mr20305915pzc.19.1689190712994; Wed, 12 Jul 2023 12:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689190712; cv=none; d=google.com; s=arc-20160816; b=W8HJb4SAgO/GwUIga+UMcNqq+5XtgI0EuDau/r0F3/qH7Z0hzIwi6Aa+acm4bT2pau Pg0JH6/5cVrXGHL72LQRXkJgMnvjmqsANLvuvPk13cvEfJRM2coJ815hpwrtmj3nxmXP w5+AcbejNyu2UDbMCCTWxVmrMCDfM+fhXL+H+8J6yUrKRmeW3E1GTPyVyOdJF+NbLKgU mhIqlLhHNZSxUQAKq6DwSNLoGxrhLs0P7/C3eFwNSksrDCmaRUxom8hl9RGStqeRfl65 q60CieCDa2gFAQYHP3sGU1yFQw8qKVMC3J45zsvrWPa7Rt3rDGxvWTfx5ea+WJmqGs9m M67Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=VBwBt45m4nvtMBWLgoPu6tMI0gbsIhDOZFehdNAd628=; fh=z3sojQ+VA0j4nnAY/aSD6nI2005ke+vigvNuc20bliw=; b=bC/ijUHoSFSGy03J6mojnwmBGTaKULz8++1BNe/D77xCfX+9PcolYbs33JAG4UsE3t P6+FKytwvVCETVf1gbjWbrJ01/gELo6ydAbahPtPXZ9yA/LgCyxIvcFlDkZvRWznipQd VXfZAldxj87cEq6fMztIFt0qZYLgjk2zpOoixPGCjgBq65bOPxkf33hRltSHZa+nYTAm uHKMxQ8Wg96+8/6YAWR47KYSb4T25XPO6BxK8BedzSK8nrko41bPHmze29wYXSmX7eR0 Zbm/QU81QorHZg3WEj9/hCnLiER/QyTw56MvZWCOlQ68kRYNGA9ObkXSbGCbTwmp1iEd 87FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Aid4RyFC; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a634603000000b0053fee209655si954259pga.664.2023.07.12.12.38.16; Wed, 12 Jul 2023 12:38:32 -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=@intel.com header.s=Intel header.b=Aid4RyFC; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232428AbjGLT1X (ORCPT + 99 others); Wed, 12 Jul 2023 15:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbjGLT1V (ORCPT ); Wed, 12 Jul 2023 15:27:21 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86EC21FD8; Wed, 12 Jul 2023 12:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689190039; x=1720726039; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=rmWix9xmBsf4l8C7qj1+gB0nzdzmGQbV/inpq2dCZcc=; b=Aid4RyFCzfUZvqXnzgV3ltK01viKtdg8kHF8QlH3s0WeyqTI5wIrJ/8o nJRrvjw0sUF9lgDadt3J69HRzFgevsBoxlvfEmV7yh45FrMIFtwyjlOze QlRXGmXF42eDciV2aiwVZVjxvuIFJ6/jhH+h0oqOlbeo9a5py383m7VG8 s01nN2KxHbpOui4bTapG3E2uSS/XUb7oaxBgFS0pUoyfGMUAA1mYb3ofK dehdI1jUxLdAM1zKdFMOPgcia+7KNheYOiU8N2Kbbbua0Rem/D4ynhpn1 CGB6DcL82qlpfHP1eUN37wAyErQ+tj5A3glkr9S6N/MZnMtWqiUHwo4lc w==; X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="368517455" X-IronPort-AV: E=Sophos;i="6.01,200,1684825200"; d="scan'208";a="368517455" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 12:27:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="845755269" X-IronPort-AV: E=Sophos;i="6.01,200,1684825200"; d="scan'208";a="845755269" Received: from averypay-mobl1.amr.corp.intel.com (HELO [10.212.212.40]) ([10.212.212.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 12:27:18 -0700 Message-ID: <400c0d11-fa14-cb1c-f6ed-02f850753e46@linux.intel.com> Date: Wed, 12 Jul 2023 12:27:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.13.0 Subject: Re: [PATCH 02/10] x86/tdx: Use cmovc to save a label in TDX_MODULE_CALL asm Content-Language: en-US To: Kai Huang , peterz@infradead.org, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org Cc: 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 References: <70784afc0a42d4dc1b1e743f90d89f7728496add.1689151537.git.kai.huang@intel.com> From: Sathyanarayanan Kuppuswamy In-Reply-To: <70784afc0a42d4dc1b1e743f90d89f7728496add.1689151537.git.kai.huang@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 7/12/23 1:55 AM, Kai Huang wrote: > Change 'jnc .Lno_vmfailinvalid' to 'cmovc %rdi, %rax' to save the > .Lno_vmfailinvalid label in the TDX_MODULE_CALL asm macro. You are removing the label, right? What use "save"? > > Note %rdi, which is used as the first argument, has been saved to %rax > as TDCALL leaf ID thus is free to hold the error code for cmovc. > > 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/virt/vmx/tdx/tdxcall.S | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/virt/vmx/tdx/tdxcall.S b/arch/x86/virt/vmx/tdx/tdxcall.S > index 49a54356ae99..3524915d8bd9 100644 > --- a/arch/x86/virt/vmx/tdx/tdxcall.S > +++ b/arch/x86/virt/vmx/tdx/tdxcall.S > @@ -57,10 +57,8 @@ > * This value will never be used as actual SEAMCALL error code as > * it is from the Reserved status code class. > */ > - jnc .Lno_vmfailinvalid > - mov $TDX_SEAMCALL_VMFAILINVALID, %rax > -.Lno_vmfailinvalid: > - > + mov $TDX_SEAMCALL_VMFAILINVALID, %rdi > + cmovc %rdi, %rax > .else > tdcall > .endif -- Sathyanarayanan Kuppuswamy Linux Kernel Developer