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 07EF8EB64D7 for ; Wed, 28 Jun 2023 14:11:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 377E88D0002; Wed, 28 Jun 2023 10:11:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3011A8D0001; Wed, 28 Jun 2023 10:11:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A2008D0002; Wed, 28 Jun 2023 10:11:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 066788D0001 for ; Wed, 28 Jun 2023 10:11:35 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B0CF71406E7 for ; Wed, 28 Jun 2023 14:11:34 +0000 (UTC) X-FDA: 80952344508.07.F297102 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf09.hostedemail.com (Postfix) with ESMTP id 897741401F9 for ; Wed, 28 Jun 2023 14:10:25 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=KN9eHtrU; spf=none (imf09.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687961426; 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=t1UE1YcEx/3OUicSr8z/BxwdM98H5NewX/wXJaCdFrk=; b=ddMZS66DuTtYJT8Ke7eg2h8V+nddXjNYnOWrgxVdMEm1zcaph3R68L7DZ2qRuNGeGmjCUb z625VxMgWyy1uz5leNi7bTBIYhj7HKCd0mWzFs/Ik1veH5XgVo9XEPQSF79i3NJHzWOmdp MKKXgpH5RMoHXYCuxjDSF7XQzbI0gi8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687961426; a=rsa-sha256; cv=none; b=5eGCm5PCR8hUnsgqa9pkKuTmIMuRK9NK1HfKR4vWtZ6zj3gZYtFRUF41qLMv0ux+huhJju mYE89e2ZFzLtFIC1qFjUchBnRjld50RNPcaZW97SAvnBqx7TcAcM7CgvA+P8fwe9YOv6x5 +HwMTaxDGf6dwab0aVJljAhuEFj9F2g= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=KN9eHtrU; spf=none (imf09.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none 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-Rspamd-Queue-Id: 897741401F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2 vjiXxcAK i8qMSN3nQLRlzXeVH8vfE5t1H3MNTtitNCkgbzFkptpKFTUdu7Gx3RoV/g8i4ZmgJcPxzl/MyX9qCZYuiEgOn3ajIdLcwiGZpIiVL80/1Jpsn0XbOJXS8A/eiIVoXhBvLgQoCS2++4JBxLhs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000012, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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; > +}