Message ID | 70784afc0a42d4dc1b1e743f90d89f7728496add.1689151537.git.kai.huang@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1019081vqm; Wed, 12 Jul 2023 02:20:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlEwdi2Mb5mFvL8W0LlW+ZXXthd+catiIon9qAlraEPX9H13yoF/agt2GD/Qf+0DtutapxrF X-Received: by 2002:a05:6a20:42a4:b0:10c:7676:73af with SMTP id o36-20020a056a2042a400b0010c767673afmr18128510pzj.53.1689153621595; Wed, 12 Jul 2023 02:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689153621; cv=none; d=google.com; s=arc-20160816; b=acvT6KaK3sucd6ZE1YEgyqXM0GwnKHgYgwtMaiXKW+Y8BIpnesJsMrRkQdNzaWzDiH Sib9g0G2PyJJu+cspKq8EQoQV9PM2MGOS8tszavhldZg18MKD+LrPS8s6hjhx8bQnn3r 9zeoIOna0UB1H+zu9bJ3wT3mon8NczaI+8M3dfRkOEI0qYoWc+/rElGvC7i36sHaPpTw Y0bTVJQxoJBRPi5zIpMrxWF2DDLMmKuXwAQ0l2WZLnB4IIDkuMknW4uTsWQKeM73Sdeh kf2LXI+GWYx8vk3DQxV3kgjMPIcsyKffE5Shtn2k0T0B1Kz1RAWN85yohC5ka6xKkR0Y uTTg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020aa78d52000000b00665c24182bcsi2824065pfe.219.2023.07.12.02.20.08; Wed, 12 Jul 2023 02:20:21 -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 S231949AbjGLIzy (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Wed, 12 Jul 2023 04:55:54 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <kai.huang@intel.com> 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: <cover.1689151537.git.kai.huang@intel.com> References: <cover.1689151537.git.kai.huang@intel.com> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771205947839704966 X-GMAIL-MSGID: 1771205947839704966 |
Series |
Unify TDCALL/SEAMCALL and TDVMCALL assembly
|
|
Commit Message
Kai Huang
July 12, 2023, 8:55 a.m. UTC
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 <kirill.shutemov@linux.intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Kai Huang <kai.huang@intel.com>
---
arch/x86/virt/vmx/tdx/tdxcall.S | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Comments
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 <kirill.shutemov@linux.intel.com> > Cc: Dave Hansen <dave.hansen@linux.intel.com> > Cc: Peter Zijlstra <peterz@infradead.org> > Suggested-by: Peter Zijlstra <peterz@infradead.org> > Signed-off-by: Kai Huang <kai.huang@intel.com> > --- > 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
On Wed, 2023-07-12 at 12:27 -0700, Sathyanarayanan Kuppuswamy wrote: > > 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"? Per comments to patch 10 I'll drop this patch, so doesn't matter anymore.
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