Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp952743rwd; Wed, 7 Jun 2023 09:01:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BLrDn3Ew97292Smzs4nF2XdAgiYVgh1LOju6HQX9G7itVAXkrP8jkRAsxhXVs0bAfW0PP X-Received: by 2002:a05:6a20:e610:b0:10b:b6cf:bbb0 with SMTP id my16-20020a056a20e61000b0010bb6cfbbb0mr2209847pzb.42.1686153663774; Wed, 07 Jun 2023 09:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686153663; cv=none; d=google.com; s=arc-20160816; b=XodAP/rDmnG2qJRUFnQHlA7tad5kRuSX2jVaOJbHXterJfPDRKoUhopiN6HLbDqipf xP0Bn9aUDEmIASC1KwNx8dEPs6TMLf31Avm/AVGZm/IMdvapIqzgYpAXQDNqvShJS1XJ A49v+Z7Cswn4vEbDBFcrQ6b2o6+7eIy/Qvdwtd9VVxm6wSmtDH1WUnfXgXJxm1XUEewi 69Dm7wCTtRTnVIA/+Mj2F4RQKyS9GNHmh3bZLiFqwo58YoVItH78tDYZAQnlKLKwmEtC Vbhs5qpwavQWXCIoMbY8r0uOxFUqVVOlWKq03jgl48wwR6AhUxmcFOeoxf+3oRgv9Ga3 FQHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=4S9sDtL41xSXwGNBeZ10GsStbelvnqd5Cx8Nw82Erto=; b=drI47KJhjRAw0sBYzf4haWl6UqLL/4JdCBg5Rg0yM8vULFXWapJ8mHkeEbJ+a7OU/z S91yXKm8mNAIO3FxidLHnPGm0KdMuvYvmQpqRRRd3iO2Y213UcJsxmi0BcgL/yDSZC9+ niGI8q8q+In+5nidhjG30VzDoT48zSAaHOZM7zOWkpmA1W8hpfxqWMj/orhck8gbraso 8gmr3B9ITMnmQlTrvF4ZZxbI/TCyAxrw0A2vJ07+3VyaMF48Li6SjaJ8KEdzqp2HlJAs SbTyjIkpCLTIQYQoILyIaSFoCZqffbcu+sVV52edjrXQ1SvHkpw00jBjoUL+9p8ddv1o aViw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LshhY9PB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a185-20020a6390c2000000b0053467c7b635si3162461pge.85.2023.06.07.09.00.45; Wed, 07 Jun 2023 09:01:03 -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=@intel.com header.s=Intel header.b=LshhY9PB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241001AbjFGP2B (ORCPT + 99 others); Wed, 7 Jun 2023 11:28:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241513AbjFGP1j (ORCPT ); Wed, 7 Jun 2023 11:27:39 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37AEB1FFD; Wed, 7 Jun 2023 08:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686151624; x=1717687624; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=o9s+xCFEIMsJhr2kn88p0xT5DlNmtrw35RZsqUG2rrU=; b=LshhY9PBYfvosCss8yw8CdbEtgefrB0rmy4IanW22T0Occbwnxw+5a70 VLMh2XG/jq6AM629JBkNhJU+yfSGqz8HygygvJB9R7s+Zq5RL7KZ5esfs Xiy+P2vInbfXFyL/AP4I1myBZ5fakqNcBbDghs98y0FOZc6nFrh2snlz9 Oevebxh00RTu79047ltatfT7wpMuNwTXtAtWUSKB+kp/fFBQVNnXhHzJu BOEZHI9RGLVVGfg3zgKg+saJ6vmtqowwyowWhljUIi5RU9ttdevlx/y0a C1Aqeu70PrNpogn8Ybhq07vF/4Sjn6r1AnLmtk4vv8K5Z0TTJZIIDYx4F A==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="422868708" X-IronPort-AV: E=Sophos;i="6.00,224,1681196400"; d="scan'208";a="422868708" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 08:25:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="822207952" X-IronPort-AV: E=Sophos;i="6.00,224,1681196400"; d="scan'208";a="822207952" Received: from vsmyers-mobl2.amr.corp.intel.com (HELO [10.212.146.233]) ([10.212.146.233]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 08:25:36 -0700 Message-ID: <692d2345-914c-595c-1214-84c966f15aa6@intel.com> Date: Wed, 7 Jun 2023 08:25:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v11 08/20] x86/virt/tdx: Get information about TDX module and TDX-capable memory Content-Language: en-US To: Kai Huang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: linux-mm@kvack.org, kirill.shutemov@linux.intel.com, tony.luck@intel.com, peterz@infradead.org, tglx@linutronix.de, seanjc@google.com, pbonzini@redhat.com, david@redhat.com, dan.j.williams@intel.com, rafael.j.wysocki@intel.com, ying.huang@intel.com, reinette.chatre@intel.com, len.brown@intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, chao.gao@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com References: <50386eddbb8046b0b222d385e56e8115ed566526.1685887183.git.kai.huang@intel.com> From: Dave Hansen In-Reply-To: <50386eddbb8046b0b222d385e56e8115ed566526.1685887183.git.kai.huang@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 6/4/23 07:27, Kai Huang wrote: > Start to transit out the "multi-steps" to initialize the TDX module. > > TDX provides increased levels of memory confidentiality and integrity. > This requires special hardware support for features like memory > encryption and storage of memory integrity checksums. Not all memory > satisfies these requirements. > > As a result, TDX introduced the concept of a "Convertible Memory Region" > (CMR). During boot, the firmware builds a list of all of the memory > ranges which can provide the TDX security guarantees. > > CMRs tell the kernel which memory is TDX compatible. The kernel takes > CMRs (plus a little more metadata) and constructs "TD Memory Regions" > (TDMRs). TDMRs let the kernel grant TDX protections to some or all of > the CMR areas. > > The TDX module also reports necessary information to let the kernel > build TDMRs and run TDX guests in structure 'tdsysinfo_struct'. The > list of CMRs, along with the TDX module information, is available to > the kernel by querying the TDX module. > > As a preparation to construct TDMRs, get the TDX module information and > the list of CMRs. Print out CMRs to help user to decode which memory > regions are TDX convertible. > > The 'tdsysinfo_struct' is fairly large (1024 bytes) and contains a lot > of info about the TDX module. Fully define the entire structure, but > only use the fields necessary to build the TDMRs and pr_info() some > basics about the module. The rest of the fields will get used by KVM. > > For now both 'tdsysinfo_struct' and CMRs are only used during the module > initialization. But because they are both relatively big, declare them > inside the module initialization function but as static variables. > > Signed-off-by: Kai Huang > Reviewed-by: Isaku Yamahata Reviewed-by: Dave Hansen