Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19281543rwd; Wed, 28 Jun 2023 07:24:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47cAhxVd3iZC9Y+Dxil1pwgQVoIzlkBzs/Ahjr0JOPuHjlpJ5P5FIFynPwHjzoHpiNuUq2 X-Received: by 2002:a17:907:724a:b0:987:16f5:692f with SMTP id ds10-20020a170907724a00b0098716f5692fmr28533871ejc.44.1687962242904; Wed, 28 Jun 2023 07:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687962242; cv=none; d=google.com; s=arc-20160816; b=ISgbhTMLpkhLGnQs9C0RYH9m+Bpjpzey4PZPPjQAfL5C5yKiANNlDr3SkVSdixnZXm ZbCyUZpWPSVPWADL/4LojRQiQmX9GVPdA2GRDf1kfvfdFT+ibblJgIYeAKJ11PLOP0Hz i6Q5vf9tZ3eQCtk0esXrljPkstI52X3IjV5Nd+2mXeUNUXTKSqYTbhTWedWyJBMbFK0T nEiqbaHOaoTu5P2143DHgpS0YxGM02Go9+2RsPwB3XxTPcF7rUst2oxLj0DRY7HecJD9 obEDHxdeY/czhT6eQr+h6jfMAYqvRHrK2asX8f5hdXdAw2LNmN/bpXFcT7YhmB2ESGVO PExw== 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=t1UE1YcEx/3OUicSr8z/BxwdM98H5NewX/wXJaCdFrk=; fh=J+tAcrUWMfKfAQtqVbrwcZxyy6a1S2hUqiWhIWyDv7Y=; b=n0YCDfuCW+gLHNPrfd2LHSZVgG1nHPdqlG9JPTBYR59TBSqi3q1G8mb3Sdt3in0NDE iC/BcNJwN9s5IVJJVDCG36ljr2gOpypUuK67nXqqg244qLLCFiTtYFiWsOZE415Kcc7l YJzhWI1+CI0dxkb9qTXAuFX7eESjd9zfyh3GKbg4A6iZ9kSYaVg8R56Zbv1gaMa+XLTg dS06f2O5UI9MNv7n862ATh60g3Lb+DA6KPIG3GQVJ7Jt0pVXb6flZvgQspqcasau6UD8 SjnXv2iBjOjUg5GhY49u9yXejdMOQe74O7Yf+V54DvATvmGcXs9o4Njh6FfSLgB2xVqH /GVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KN9eHtrU; 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 a20-20020a17090682d400b0098cee0f8cfesi5642143ejy.969.2023.06.28.07.23.35; Wed, 28 Jun 2023 07:24:02 -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=KN9eHtrU; 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 S230119AbjF1OLF (ORCPT + 99 others); Wed, 28 Jun 2023 10:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbjF1OLD (ORCPT ); Wed, 28 Jun 2023 10:11:03 -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 10122FB; Wed, 28 Jun 2023 07:11:01 -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=t1UE1YcEx/3OUicSr8z/BxwdM98H5NewX/wXJaCdFrk=; b=KN9eHtrUeD8K5uBlduYTWdmVU0 BnoJhC4+EfIzFNgShMK+lgnKmk5ySokNqM4QQV2xRysgEDs2tfLnZVA2I9EeWgUH1cQ9eUSnOUvwJ lsuJ5n4bDOA0ktg7bN+lJKhMKJyTKHCWZut/VURu+Th7hIvRZut9CPXuLJv4CAZboTJzIq5ub3OBG +J1vzhZalUaW+f4qY5EhbZawLqYzk8ruZJSxspunCw53CuW+bIkPAitD4kpY6NHBbpJ5zZYMZKc5h kgudLe2y3bI36Qsw9nHv53G3UldK+aajeE4zDbsslFbv//oqf7Gf6eZZPd/UoDqgx3ddnIYprUMy/ 6JSD5CtQ==; 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 1qEVs5-005fcL-0g; Wed, 28 Jun 2023 14:10:13 +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 690B5300023; Wed, 28 Jun 2023 16:10:11 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 521712458D611; Wed, 28 Jun 2023 16:10:11 +0200 (CEST) Date: Wed, 28 Jun 2023 16:10:11 +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 08/22] x86/virt/tdx: Get information about TDX module and TDX-capable memory Message-ID: <20230628141011.GG2438817@hirez.programming.kicks-ass.net> References: 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,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 Tue, Jun 27, 2023 at 02:12:38AM +1200, Kai Huang wrote: > +static int tdx_get_sysinfo(struct tdsysinfo_struct *sysinfo, > + struct cmr_info *cmr_array) > +{ > + struct tdx_module_output out; > + u64 sysinfo_pa, cmr_array_pa; > + int ret; > + > + sysinfo_pa = __pa(sysinfo); > + cmr_array_pa = __pa(cmr_array); > + ret = seamcall(TDH_SYS_INFO, sysinfo_pa, TDSYSINFO_STRUCT_SIZE, > + cmr_array_pa, MAX_CMRS, NULL, &out); > + if (ret) > + return ret; > + > + pr_info("TDX module: attributes 0x%x, vendor_id 0x%x, major_version %u, minor_version %u, build_date %u, build_num %u", > + sysinfo->attributes, sysinfo->vendor_id, > + sysinfo->major_version, sysinfo->minor_version, > + sysinfo->build_date, sysinfo->build_num); > + > + /* R9 contains the actual entries written to the CMR array. */ So I'm vexed by this comment; it's either not enough or too much. I mean, as given you assume we all know about the magic parameters to TDH_SYS_INFO but then somehow need an explanation for how %r9 is changed from the array size to the number of used entries. Either describe the whole thing or none of it. Me, I would prefer all of it, because I've no idea where to begin looking for any of this, SDM doesn't seem to be the place. That doesn't even list TDCALL/SEAMCALL in Volume 2 :-( Let alone describe the magic values. > + print_cmrs(cmr_array, out.r9); > + > + return 0; > +}