Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38056596rwd; Wed, 12 Jul 2023 02:18:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlHMTUG4jryxEO9N19loQKw9ZwZbEhJDqin7q7BvifxTr8fS3W66a41DbO43TXby18vCHps1 X-Received: by 2002:a92:da8f:0:b0:346:7c9e:d981 with SMTP id u15-20020a92da8f000000b003467c9ed981mr1827272iln.1.1689153500185; Wed, 12 Jul 2023 02:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689153500; cv=none; d=google.com; s=arc-20160816; b=EX7o9kDbIkDuI08R1VbDEUUX1ZakeoVOZi9W/efdRh2/yLviTlNfusTaSsTaHTO8J1 r5WOFlqYfOIku2+fuedRFD/7sAcVxS4JcilmfCYfUQRjGqlBag+Z7dBjcMdnVgcyBQjy NOCh8AF92TaRs9/q3JaCastu2TgMjruurGOYRXmNCDEwSfRbyqYpacVq2XZAs4UdC6VZ +nAJND4m6ep33UtJo0FIHeOLYlgd9Q45zcEh02pOsa9UjUiD368EdfJgOBbPQehgbRHe hMLfrt2Bz+bAJG2EAQ7VHC+FAJv5lhbsbIyR5UPCAqp64XVv/zhSno0QiMpnzR5XW58K /H7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6lHjRDUTIpytXJzN7195s80LfCpVDsosWBGlgbcrcW4=; fh=edBx5P/zffK2H8fHqIB7+dmlz60K6YmM7EnWiorgzxE=; b=ZHuEJPfMdykr4rdV6il8AZxL9sX/DsFBq7agixc9TGb/svNENWREGmVaP9N4X/L4CD 19bejWrxqQyb9KnVfIEnV7QyqF5HzK0XEA6D19hHopvG0QxIdmg5pnPZS3SpUGrf01/O +NL2eOguU+RQd0vMFrfnNV51WsWfBGQrQD9Gvb0YZGjC3rsNNPpiFmytj6V5xS7hb/2A ZcmsLurUtf2bk7optABpwsWeerB1Ybnjg2y7oXDaFKhPrBeypkhvlH4cHebACFrUxX1E Q5vLQwSwu4xTn1bqF4rpqfT9svI8f0JHD+AZL6npZWg91WV/KZ36vbBCXvx12Wh8l4Yn M8mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UhkSvy85; 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 c38-20020a631c26000000b0053fb7968569si2741086pgc.429.2023.07.12.02.18.07; Wed, 12 Jul 2023 02:18:20 -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=UhkSvy85; 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 S230048AbjGLIzx (ORCPT + 99 others); Wed, 12 Jul 2023 04:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232489AbjGLIzo (ORCPT ); Wed, 12 Jul 2023 04:55:44 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42520B1; Wed, 12 Jul 2023 01:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689152144; x=1720688144; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k3I0ORgDv7n4jQxYaErafMWEg2wJhkOsTjkTRct7qWE=; b=UhkSvy85kcv/1y3AjLRHQ9m6UuUXG3PfF4pjT/9+acde8I8U2WUeYYM8 6C6NUZZp5Isu9JtVb8SSLT+51yntMT3eTGEZKiSPeBflcrHeIhUZP0HP8 9aQnlulYseDGNlIM9RbEkmjznbp/5MJICr/FPvNOepVXFHTvAbIsjTpaS kiCQIgZFuCyMeq8zWgXhBx/oEcc6aom0P4F4ksBPVuaBuFlZUSzBIUlfi wykWT4EOVJy8nlsJvTwIJ3ygB2uEFkifXlgz2ZrvhJB0KWfQWEq95Dx2H kNdfvq7rX0vXjkMcIRTCc/0y8rOS2ZLSECaS6Sww+GXnvdI40NxGZO5Zy g==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="344439139" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="344439139" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 01:55:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="845573360" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="845573360" Received: from mjamatan-mobl2.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.209.168.102]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 01:55:40 -0700 From: Kai Huang To: 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, sathyanarayanan.kuppuswamy@linux.intel.com, kai.huang@intel.com Subject: [PATCH 02/10] x86/tdx: Use cmovc to save a label in TDX_MODULE_CALL asm Date: Wed, 12 Jul 2023 20:55:16 +1200 Message-ID: <70784afc0a42d4dc1b1e743f90d89f7728496add.1689151537.git.kai.huang@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,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 Change 'jnc .Lno_vmfailinvalid' to 'cmovc %rdi, %rax' to save the .Lno_vmfailinvalid label in the TDX_MODULE_CALL asm macro. 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 -- 2.41.0