Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp852252rwp; Thu, 13 Jul 2023 02:01:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlGXN8iODGgLVhKD3lLRgqLgl0UAx6ERQ0DrkBHe88VUFZz9yrlBtDFEQFXeDZiH05QKqja1 X-Received: by 2002:a17:906:fd43:b0:987:7e6a:d239 with SMTP id wi3-20020a170906fd4300b009877e6ad239mr768432ejb.35.1689238869361; Thu, 13 Jul 2023 02:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689238869; cv=none; d=google.com; s=arc-20160816; b=ckDPVWgFLyHr/GGM3LD5hijGFRGuK8ZQylhx+ytiNNbI3tY+/t3XAA381c84kqIo9R qXs/OnhWESU3hnT/b2A89t7y5tzbPv8X8SUOcgfXDttA+cKYrgj3VTsf85SIp5tU98BN 8Mei9AkAuRHGhYIjnkqvLNvLrucDDu5aQDNgNiYs6pHgnuYfeMjpGPR+T9YEwObz+98E nGtEUNsFUXbnEYnAtOWMQyQr2RSLTgNI//M1EQzSD0tvgUJIkv/OkB/9cbqOlMlY7CIx 7GKqMuT9kML0Fmis9hRmyivBgTpeDEds1w77Rtv+Bzrc4SeCoewsD9zIBIKEN68oGspE bnWg== 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=nKk50Eg8ji6xzjaMJJdtqWsCaeey4iaTT9Uk5E6Yuzw=; fh=N+OK3Z4UlsoYtYFjfiw+LF5DCixo9u8YyFGQpJCZL3w=; b=l7K7RVZ/xdKHZhCIH3az/pwmqpxiuQzTpnnQQ7HFQwR78r9WEEF0RdUuD88QSobNze kZFPLXkJMmuZTG29k2xQNhn6ZMrd6kc/B6Tp9B7dY3+BcsQSmUIW+F9pm2rOBUgC/hH9 ylefPGvUUymhf4q0zM8bY0S5iehg5FaYol3ZCLONmb7IRHA3JclYP7rWr3dn0Gw2N5vE BnQpmbKimHrfpxfmi/kOPkQQR8qasmwZUCDqBUbn5cnmihpDFnSAYaPQWoRYfEPfgFXK 1K7y1b6z0Xg7d4gbnmeaLeyefX0dVQLTmgCOuqjROLTFVwkI9NAHYLH5reJAMf/dLKkw 5dYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=eh21mBJI; 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 k13-20020a170906680d00b00992a0966793si6388274ejr.814.2023.07.13.02.00.44; Thu, 13 Jul 2023 02:01:09 -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=desiato.20200630 header.b=eh21mBJI; 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 S234585AbjGMIpD (ORCPT + 99 others); Thu, 13 Jul 2023 04:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233833AbjGMIop (ORCPT ); Thu, 13 Jul 2023 04:44:45 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E225412D; Thu, 13 Jul 2023 01:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=nKk50Eg8ji6xzjaMJJdtqWsCaeey4iaTT9Uk5E6Yuzw=; b=eh21mBJIOEi1u1XWYpbOc5SQKr pys+TeaqH+dlml9x6rcC3QvCg0Vv3t852n5F4Uk7Y0IxC7AtH9BhS8mNdH571LwRzXUnDgtxFkOsr r2vJ7aYKiQ3KxMZFMeesGTiqlykZ8gLNtDgF0riIBj12hIbSckcD6OZ00VSRR6L31aMX5WLvxZ09d UDwW6uGmlybYBKk9WcKt8chESv8MFkbo00qeLsQ7hnRNk2X3B5JOgephOTGbHop2n3psKz4U9l2Zk XFOr9ethtD3IQGy0n27i/LwbqTwSpeMR2G1EfcEBzD/3euxJzES97S6/kuQt6uZCdUF0y22gwK3ga nwuyu2qw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qJrv4-004ZTn-1T; Thu, 13 Jul 2023 08:43:28 +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 D0CEF300362; Thu, 13 Jul 2023 10:43:24 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B82BC245CA116; Thu, 13 Jul 2023 10:43:24 +0200 (CEST) Date: Thu, 13 Jul 2023 10:43:24 +0200 From: Peter Zijlstra To: "Huang, Kai" Cc: "Hansen, Dave" , "Christopherson,, Sean" , "bp@alien8.de" , "x86@kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "kirill.shutemov@linux.intel.com" , "tglx@linutronix.de" , "linux-kernel@vger.kernel.org" , "pbonzini@redhat.com" , "Yamahata, Isaku" , "kvm@vger.kernel.org" , "sathyanarayanan.kuppuswamy@linux.intel.com" Subject: Re: [PATCH 07/10] x86/tdx: Extend TDX_MODULE_CALL to support more TDCALL/SEAMCALL leafs Message-ID: <20230713084324.GA3138667@hirez.programming.kicks-ass.net> References: <20230712165336.GA3115257@hirez.programming.kicks-ass.net> <20230712165912.GA3100142@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 Thu, Jul 13, 2023 at 08:02:54AM +0000, Huang, Kai wrote: > Sorry I am ignorant here. Won't "clearing ECX only" leave high bits of > registers still containing guest's value? architecture zero-extends 32bit stores > I see KVM code uses: > > xor %eax, %eax > xor %ecx, %ecx > xor %edx, %edx > xor %ebp, %ebp > xor %esi, %esi > xor %edi, %edi > #ifdef CONFIG_X86_64 > xor %r8d, %r8d > xor %r9d, %r9d > xor %r10d, %r10d > xor %r11d, %r11d > xor %r12d, %r12d > xor %r13d, %r13d > xor %r14d, %r14d > xor %r15d, %r15d > #endif > > Which makes sense because KVM wants to support 32-bit too. Encoding for the first lot is shorter, the 64bit regs obviously need the RAX byte anyway. > However for TDX is 64-bit only. > > And I also see the current TDVMCALL code has: > > xor %r8d, %r8d > xor %r9d, %r9d > xor %r10d, %r10d > xor %r11d, %r11d > xor %rdi, %rdi > xor %rdx, %rdx > > Why does it need to use "d" postfix for all r* registers? That's the name of the 32bit subword, r#[bwd] for byte, word, double-word. SDM v1 3.7.2.1 has the whole list, I couldn't quicky find one for the zero-extention thing. > Sorry for those questions but I struggled when I wrote those assembly and am > hoping to get my mind cleared on this. :-) No problem.