Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19758573rwd; Wed, 28 Jun 2023 13:57:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4obpQk8wT0mBj12rz0KaEMo4mW8/57ryfeh7HtBQTRgrB/gMD8J9LUirE3wTSf8lk2bR1B X-Received: by 2002:a17:902:e5c3:b0:1b6:9853:1759 with SMTP id u3-20020a170902e5c300b001b698531759mr12704299plf.18.1687985850700; Wed, 28 Jun 2023 13:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687985850; cv=none; d=google.com; s=arc-20160816; b=rq1S4f/gS8C4wAyTk4B+BVza8vT7CHQNhm2rn9aTRIRQ2Pp96zDU+7AepPL3XKVe9g tKZ9JdVsUhvoVChV+P4TFzTvtmpAhJSwoQum+bg3VXiPrzTPnrvTqMGdFmZ6iiHt5Fva Iu2F2hLS3TZi+6LI8CE0KD34VbxPOe2sKd0He4rm/nRgDsiwOrmxvBmbvaDWdltCEEwi EkINfy821IjPBHjsHM9BKw8iKJA2gV/C6nuaMPmQoJVa2enNBnSpSPyPtAD9vdP85uFM pYFvMOIF52BRAMoYjyNbzLUvkRrQ4ARuRtJV7Lbugfdk43b61ZvhLhgPtFrW3B/xsrPe 9ULA== 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=Q74U9h5cJqAF7kQMrqejEwYKPbZZwynJrbUyaN3UMdk=; fh=J+tAcrUWMfKfAQtqVbrwcZxyy6a1S2hUqiWhIWyDv7Y=; b=AAFcR937e8isKFPfdgk8x3t+7TaQ//XSipASPqrVetnchAYrI+wbwVFJAEoaQ0lc5q 3Q4f3luPMLkjUKMPc+naB7t9HNyJeo7EJxSPPuKmwJnVPrJePEllihCI7KdLYm9XymYe SWluMvjCECLxiPWexrXEWs0eF5UrD9MalTPgy5ZuwSinIxJMlOYuNm7tfPGLeoO25RM5 mhdyg6n7jwPCid4ZXG6PSW6w6iSEtmDmaA5OUPrIiwdE6W0hB1TFC+CFgrfSsKl+1Pmz Rgkrp0COpzKLM5THr+Q5beA1AY0G+/l57QGJp/B89r5o3DatHJF4C+MA6zQY2TIl+bW1 xsPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=U7ven3j1; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o14-20020a170902d4ce00b001a4f005d59dsi6201499plg.389.2023.06.28.13.57.16; Wed, 28 Jun 2023 13:57:30 -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=@infradead.org header.s=casper.20170209 header.b=U7ven3j1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231980AbjF1UlQ (ORCPT + 99 others); Wed, 28 Jun 2023 16:41:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231767AbjF1UlB (ORCPT ); Wed, 28 Jun 2023 16:41:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD501FF7; Wed, 28 Jun 2023 13:39:48 -0700 (PDT) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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.