Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4050350pxb; Sat, 5 Feb 2022 02:26:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzq1zEObmuxgET7UtjHaPdN9nopNTH2dlpOC61yawIc/Ju1MW+4UGrUpYfF+kIYDhd00ze/ X-Received: by 2002:a05:6402:5189:: with SMTP id q9mr3663226edd.314.1644056777370; Sat, 05 Feb 2022 02:26:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644056777; cv=none; d=google.com; s=arc-20160816; b=BbqY3dg5ryvXnMVucO2MWSXszHa5+vka88FRPfpjocTMrHHhEsKh2p8A8YpbU+2vwG g7BoQsVLmUiV5orNmCdZbj1EbkjFM80PGlhpBSzA+v/6olDiL+qMhFItd/kBuRLg0ceG LB+bFdDmkSwjK2J8w6jtAghBylVEBXqz7g2MtK17LlozSAynJqnX/eoA+iz+SiJO6VfU LcCy2NK0vq/i6mXC4qcf8QKpjoECjGhMVxGZCsXbHmPCBJaQuPYjr6aJeIOaoCMt4KZJ jg+Uslv45FyxnNv4xbjy3Q9aGlmcKQWV9MqTpdfXaO7QJo78hUMW9CQQb/GT1T9okqK8 G/wg== 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=CTJhc0zrtUvE+fEWV6dT7uuodziPr/zqgIAILnDeihA=; b=kVPeCEuTe0tvB7qsvBYTeqLfilunLDjYkg1w8619rER79aP/sI3G7KHFwEjz97KUEK xwXpb6DvF4TXZdMkEyDAreElpi7nvo2eyF7jc04Cu5DSggs6FoD0w6AS36tSNMXUKpQb vEHUH6fDYMMGyAAv+t9K+gd8ofVurbpe6NbA5rJIP8jBjRFiRqQL7ol0iE7hM/Ti3Rjv eOoEQvJkIGaNo/m6eZzhl1PrvkF0QG0al7Bt6HD+xG3WNfh4B48BjHioTCldrloYjX04 PUSanBoGvLMyycIDnSDD+krm8TJqB8pr347VstkJo9FvzJyMxqLvd1rx7zg+aegP2Pgc cn+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g2zMfbsW; 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 gb4si2767480ejc.239.2022.02.05.02.25.52; Sat, 05 Feb 2022 02:26:17 -0800 (PST) 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=g2zMfbsW; 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 S1354327AbiBDNUR (ORCPT + 99 others); Fri, 4 Feb 2022 08:20:17 -0500 Received: from mga01.intel.com ([192.55.52.88]:26589 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349762AbiBDNUQ (ORCPT ); Fri, 4 Feb 2022 08:20:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643980816; x=1675516816; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=3lAPxAkmOv3RjR0JSI6de3JMHiVAAKEQq/os+GZL1N4=; b=g2zMfbsWvxYfpFMLIuUUAFfttF0x5lHNUDFNu5+o9CHAFRc3WTULUd+R uvi8drhwiDJpYlAInW9CjyBjk9MwJeKjt8f4ukoVb6dMQlK4fuMW4m+ee 3ENyB+aGJkNpN9NJ1X32lSjsTwuoez92zB+WJdrlPVjJ2XHqUknMqPLWG 8Llr9E50peBIz0vF/Rj9z5yFatuNrYv2T7cXZE8SIy4bLEUW729LSIaVH kAbXQx94O+hekMw9TwpbCnVtrQpNv1o1akU76RQ/E//fVtw/1MU+WhJGT 2XDtR7PAHKdD8T6tsAthmo+AaliZdw6xljGa61q+f55T/HRMZ8RBsHpRH g==; X-IronPort-AV: E=McAfee;i="6200,9189,10247"; a="272866483" X-IronPort-AV: E=Sophos;i="5.88,342,1635231600"; d="scan'208";a="272866483" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 05:20:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,342,1635231600"; d="scan'208";a="480838436" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 04 Feb 2022 05:20:09 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id 17E144BC; Fri, 4 Feb 2022 15:20:24 +0200 (EET) Date: Fri, 4 Feb 2022 16:20:23 +0300 From: "Kirill A. Shutemov" To: Kai Huang Cc: Thomas Gleixner , mingo@redhat.com, bp@alien8.de, dave.hansen@intel.com, luto@kernel.org, peterz@infradead.org, sathyanarayanan.kuppuswamy@linux.intel.com, aarcange@redhat.com, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, jgross@suse.com, jmattson@google.com, joro@8bytes.org, jpoimboe@redhat.com, knsathya@kernel.org, pbonzini@redhat.com, sdeep@vmware.com, seanjc@google.com, tony.luck@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 03/29] x86/tdx: Add __tdx_module_call() and __tdx_hypercall() helper functions Message-ID: <20220204132023.myyom57i7p5hcq6o@black.fi.intel.com> References: <20220124150215.36893-1-kirill.shutemov@linux.intel.com> <20220124150215.36893-4-kirill.shutemov@linux.intel.com> <87a6faz7cs.ffs@tglx> <20220202025519.csymm7r23b3ltpia@black.fi.intel.com> <20220202235910.c512857813ea5b14aa73267f@intel.com> <20220203144403.ytyw5vcv4gshxyhn@black.fi.intel.com> <20220204034312.43rotpihciik2gk6@black.fi.intel.com> <20220204225138.e76f6e98e0208d746606099d@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220204225138.e76f6e98e0208d746606099d@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 04, 2022 at 10:51:38PM +1300, Kai Huang wrote: > > + .if \host > > + seamcall > > + /* > > + * SEAMCALL instruction is essentially a VMExit from VMX root > > + * mode to SEAM VMX root mode. VMfailInvalid (CF=1) indicates > > + * that the targeted SEAM firmware is not loaded or disabled, > > + * or P-SEAMLDR is busy with another SEAMCALL. %rax is not > > + * changed in this case. > > + * > > + * Set %rax to TDX_SEAMCALL_VMFAILINVALID for VMfailInvalid. > > + * This value will never be used as actual SEAMCALL error code. > > + */ > > + jnc .Lno_vmfailinvalid > > + mov $TDX_SEAMCALL_VMFAILINVALID, %rax > > + jmp .Lno_output_struct > > If I read correctly, in case of VMfailInvalid, another "pop %r12" is needed > before jmp to .Lno_output_struct, otherwise it doesn't match the stack (pushed > twice). Oopsie. Thanks for catching it. > However, since "test %rax, %rax" will also catch TDX_SEAMCALL_VMFAILINVALID, it > seems we can just delete above "jmp .Lno_output_struct"? Good point. Will do it this way. -- Kirill A. Shutemov