From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9273FEB64D7 for ; Wed, 28 Jun 2023 20:38:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B465E8D0002; Wed, 28 Jun 2023 16:38:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF6C38D0001; Wed, 28 Jun 2023 16:38:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BDDC8D0002; Wed, 28 Jun 2023 16:38:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8D0F18D0001 for ; Wed, 28 Jun 2023 16:38:43 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 22606120784 for ; Wed, 28 Jun 2023 20:38:43 +0000 (UTC) X-FDA: 80953320126.12.6384DFF Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id B0462A0016 for ; Wed, 28 Jun 2023 20:38:39 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=U7ven3j1; dmarc=none; spf=none (imf25.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687984720; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Q74U9h5cJqAF7kQMrqejEwYKPbZZwynJrbUyaN3UMdk=; b=mrZu89Uz/Ae/wGudG6+kh7xNMAdTQvf2HPe7cxAK2TXZWxpGORazEuAPaf8tiA6sratEcb wPiH7OanqHeiE9xfyfaLFNNKcVQ5cWtkZ/uVogek+LPedOv6fSnafnJtMZz+OgI3XAkbjq u610JWDYJXVuvrOjO0IGYGbkdA1r4cE= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=U7ven3j1; dmarc=none; spf=none (imf25.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687984720; a=rsa-sha256; cv=none; b=T4OtTQ3IrNxCr0wYIny3KqB5x+aE+eNva6/56PyWD8JdSLIBY5AqbSB+KplwLwVgz3X2Mk 45sBpVllQgf4C9e4N1zYcDcUZDpJmn7Vb3wO6vVNxT4vhYHsVSih4XnXujOoK7Nvwuj4h9 s4EAE0WqU44udOs5ACg+IW99zSGb50I= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Q74U9h5cJqAF7kQMrqejEwYKPbZZwynJrbUyaN3UMdk=; b=U7ven3j1n/AGEZHnBs70CiAm3c IFp7vZgZH+yI7tHPmRDhAxOv2CZ4gCjKF9xF4GFFql17CQMcuZsdavKL+gcE2vidJElANCkN/8Nlp 2Wi1Mxv7uQu7+LMDHIpCxsmPRFaciMupyA2OtLGyMmPZK3R+wiSQCLj3z19/8StnPgL1++XOAQOS8 Zm4KNBKwkc32cbwqyYjVZpp4wAMQtDJfxRPhUH2DlnwKFk6ZmIYyfJj7mDbnGRbWIgDUIo8M72um9 gTIhGZf2TIGG6gfoSjXoe3/DZawyJWKyubvPt63WJDlpJBmXc+ZlzlbsSKsW657uHq2vLD9F7d0vU ffz4ertQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qEbvl-004CII-F8; Wed, 28 Jun 2023 20:38:25 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 317E33002C5; Wed, 28 Jun 2023 22:38:23 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 18B8C214D80C3; Wed, 28 Jun 2023 22:38:23 +0200 (CEST) Date: Wed, 28 Jun 2023 22:38:23 +0200 From: Peter Zijlstra To: Kai Huang Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, dave.hansen@intel.com, kirill.shutemov@linux.intel.com, tony.luck@intel.com, tglx@linutronix.de, bp@alien8.de, mingo@redhat.com, hpa@zytor.com, seanjc@google.com, pbonzini@redhat.com, david@redhat.com, dan.j.williams@intel.com, rafael.j.wysocki@intel.com, ashok.raj@intel.com, reinette.chatre@intel.com, len.brown@intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, ying.huang@intel.com, chao.gao@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, nik.borisov@suse.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com Subject: Re: [PATCH v12 20/22] x86/virt/tdx: Allow SEAMCALL to handle #UD and #GP Message-ID: <20230628203823.GR38236@hirez.programming.kicks-ass.net> References: <20230628152900.GI2438817@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230628152900.GI2438817@hirez.programming.kicks-ass.net> X-Rspamd-Queue-Id: B0462A0016 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 4uwf9nri88ifrkzt5qug89p1b8qgpo7o X-HE-Tag: 1687984719-818901 X-HE-Meta: U2FsdGVkX1+SdvC0Fx/OeQBF9wV4IVPjIt5MYDkEGJhmgP2jqmiqvjK1YpG5qzI+2wHJSXggcHMBUqQVNRy6/27NDueP5tp3SgM5Irwz03C9dDbavUPlSaLjH0GUzGTiIs/5KRLnfh7l+UH2UOA0l2KfT+5Fwwsszbo69lv9lEJRR82ZmgT9KjTrSqtCrckhVkoN/Tc5H0YNIhfYehRNcXyA3vIqfF7Y6xSw4hCu7xMoxuTcTonTXhZGGfpe2b8jRFp+zaFhpKXNpHHnSNg/AaLbc1tBJpQEQbOKXIbfCD2wUmSSMCp4ww++RzhZI/VhLnwIyH8cvC8rM43oq0tlegJLv05P8Dha2wuY6E1KT/Qot71wp0S4Dj6tnLWZZLc4guzFTdClTftqUgOdTwIL2zoOeExGvYNdbuED/ABVjYiMblGiYD9usJ/FGLexCzORcGdcCZ/KTTtMn6HvYQToEeHihRnDVjjlSjrf6HkBagjONWirHGpDGL3U3W8a26vG45EnQaCXplaobyeM/3F2x2clUsE6pWZrBuB6BKNmsK5Lii3D3cqAk69DKdQxNqMPvf5PFo5TWSX/dm8u2n3NZ85KLzfuUNz7dledRUKmLO5vXJZGOFbESrdFGWrnvlPEZr4FCSqW/NZPUCKZSZxiskeosXIUmnXRIH6NBtgLkNr6JRPy+b1MvibOBs/ebTE9uot+Hic9DenrbiJAgT5DvkjwmhJ0eNhV2GBGqqlSQMPRszyoHJVXAILAgvnmlw5YXy10OUh2cBPifLv2qJth7L/PFCWBVyIZaHfsN7MLief6qDJqLL2nQjR6TyLAoxH1qxYZv8/xJw0yOMFqNyJvuKtTMCmogxIP8tvCpj92nd1zmpKG9o8yMfV/zP0Zxl4evbLraroHaE2wc7CuboFXobdAXqz5cqHFhlqVxq/TB2wqPjS6l6hoWnKvUGPu5I1XrizSWWLATfGNgMWsUHC jGmxtWhF GkrOb6soigpbQU6JEfwGNmYFkffNCxBD0jk46lRZkD55DAVxzhVve4Z7rXB2kdz2xmGxJVCvBlEmMiv0czV7Y6urQnqNB93bjZttbnaE223F8vPe1iPu9A7dJpSRD/6odz2rj62Ogg9H0e0o= X-Bogosity: Ham, tests=bogofilter, spamicity=0.009743, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 28, 2023 at 05:29:01PM +0200, Peter Zijlstra wrote: > On Tue, Jun 27, 2023 at 02:12:50AM +1200, Kai Huang wrote: > > diff --git a/arch/x86/virt/vmx/tdx/tdxcall.S b/arch/x86/virt/vmx/tdx/tdxcall.S > > index 49a54356ae99..757b0c34be10 100644 > > --- a/arch/x86/virt/vmx/tdx/tdxcall.S > > +++ b/arch/x86/virt/vmx/tdx/tdxcall.S > > @@ -1,6 +1,7 @@ > > /* SPDX-License-Identifier: GPL-2.0 */ > > #include > > #include > > +#include > > > > /* > > * TDCALL and SEAMCALL are supported in Binutils >= 2.36. > > @@ -45,6 +46,7 @@ > > /* Leave input param 2 in RDX */ > > > > .if \host > > +1: > > seamcall > > So what registers are actually clobbered by SEAMCALL ? There's a > distinct lack of it in SDM Vol.2 instruction list :-( With the exception of the abomination that is TDH.VP.ENTER all SEAMCALLs seem to be limited to the set presented here (c,d,8,9,10,11) and all other registers should be available. Can we please make that a hard requirement, SEAMCALL must not use registers outside this? We can hardly program to random future extentions; we need hard ABI guarantees here. That also means we should be able to use si,di for the cmovc below. Kirill, back when we did __tdx_hypercall() we got bp removed as a valid register, the 1.0 spec still lists that, and it is also listed in TDH.VP.ENTER, I'm assuming it will be removed there too? bp must not be used -- it violates the pre-existing calling convention.