Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp356069rdh; Thu, 23 Nov 2023 05:59:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVsS+YuH03VwRwSag2ry4CUnTpb2PgueMYx7ld/CqMIvuQ9YzVhh8/rwB7vOMg1OEpnFK5 X-Received: by 2002:a17:902:ecc6:b0:1cf:6675:b313 with SMTP id a6-20020a170902ecc600b001cf6675b313mr3753904plh.22.1700747949711; Thu, 23 Nov 2023 05:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700747949; cv=none; d=google.com; s=arc-20160816; b=nzcrVFhokMQYIx8XUAstA490H6bhUdU7pmYpJXBzKnH0How3LQCll3bKSyJ8WJnHsi PZUBf833p9eIBpaegoYxwZ2HTo9oAFn7DlMbM8KC9NrQeTzOKgG0rFAC3i6idF7grZzh pqKkKHj0Fz1dEB5Rx5w/Z2dyxxbmcMo8OgYTxqrtlrz/MYBN5V4B8ZlZs6C/Iivdhdku FciznO2dE6olz6gzLv0GFS40FK7V34Kc1+Q2Vxqkxj6aVwJEU/3wf/Z+UYx+bqDev631 5q5nfQF44HG6dyra2bmW2SdtCIrSbvRfagw2XSOCvaB2eQwseDZe0BmKV46CvYO+8vN6 WzSg== 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=xxso5SEmfAzdysOYoz1NsSZKPr5Bsx8iQt6iggmGNOM=; fh=1Ie+ok9DLok8LLm5qlbSZiXR/51z9U8R9sgEH7smzlc=; b=BWmXB5b8Cxm0yasi2klz/VIgg1/a6tXKCyEW7gj1i6u6tu2YqWAKuH0zbjhkojG2vn Hfn+t4Rjti7K9Lfc71L+cP/pO6rZTJgWQKBpJH1dtvOHaObho1LrWLfGIulUeaSKZLPx nCqWfmmqMf7DjgTXqRRxIuslhiNeHDUm6DYmw5WEl+OomtEXdIPC/xa9voMVWSRUuA9w XQQ7+ARDzGvr2l/xsh6/Mn8mOv2cIG1UMigTMliyfehcFKmdCCTKDW5K2GS7iy1IkYQY R9ksis05CLtuNjmcPvErREEGTiTR8VLtJnQTrZFPRLnM+Sg2v70AsRtr66MBEstW5c5y 1QFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C8tDDYT1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z9-20020a170903018900b001cf5d073f9dsi273069plg.82.2023.11.23.05.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 05:59:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C8tDDYT1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 860E2829B8B7; Thu, 23 Nov 2023 05:59:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345658AbjKWN6x (ORCPT + 99 others); Thu, 23 Nov 2023 08:58:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345636AbjKWN6v (ORCPT ); Thu, 23 Nov 2023 08:58:51 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BEB5B9; Thu, 23 Nov 2023 05:58:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700747938; x=1732283938; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gsKhARH6M+Qxpmd1HDVzRLZJSN3VSTi/EeytQHXYsVE=; b=C8tDDYT1c1CuwCEi6mkL2+qaFs+n56aSpfAF/wbHgqzJG+yBhF2xCVr8 c+TMoOijxUmPKgX+CZtoBKziwTvsG+qNJVe1U1/fpGr4gUQcqJ9njTF3P kpzjIqnPN+4vTfP1xerFudM6wD5GI+MLOCsb0e1y6rDqLdgwjBD/2UPsR nwkVj7livnGeUlxFii15QmlQ1oDIQUjVTzCIS7nHoD/IV1ekFao1lpO49 K4DN2T06ghp09Q5AgNl8+cKKk+Pasg0IRgCa0w8N2okmsC+vkwYwcnHVB /FAz9fDGP0FVT8wyBe4V39rxYFPj+2ICin2JdRdO5jJWOkAzx77NFAYyX g==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="371622353" X-IronPort-AV: E=Sophos;i="6.04,221,1695711600"; d="scan'208";a="371622353" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 05:58:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="911175812" X-IronPort-AV: E=Sophos;i="6.04,221,1695711600"; d="scan'208";a="911175812" Received: from ckochhof-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.58.117]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 05:58:49 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 9B24C10A38A; Thu, 23 Nov 2023 16:58:46 +0300 (+03) Date: Thu, 23 Nov 2023 16:58:46 +0300 From: "Kirill A. Shutemov" To: Jeremi Piotrowski Cc: linux-kernel@vger.kernel.org, Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Michael Kelley , Nikolay Borisov , Peter Zijlstra , Thomas Gleixner , Tom Lendacky , x86@kernel.org, Dexuan Cui , linux-hyperv@vger.kernel.org, stefan.bader@canonical.com, tim.gardner@canonical.com, roxana.nicolescu@canonical.com, cascardo@canonical.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, sashal@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1 1/3] x86/tdx: Check for TDX partitioning during early TDX init Message-ID: <20231123135846.pakk44rqbbi7njmb@box.shutemov.name> References: <20231122170106.270266-1-jpiotrowski@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231122170106.270266-1-jpiotrowski@linux.microsoft.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 23 Nov 2023 05:59:07 -0800 (PST) On Wed, Nov 22, 2023 at 06:01:04PM +0100, Jeremi Piotrowski wrote: > Check for additional CPUID bits to identify TDX guests running with Trust > Domain (TD) partitioning enabled. TD partitioning is like nested virtualization > inside the Trust Domain so there is a L1 TD VM(M) and there can be L2 TD VM(s). > > In this arrangement we are not guaranteed that the TDX_CPUID_LEAF_ID is visible > to Linux running as an L2 TD VM. This is because a majority of TDX facilities > are controlled by the L1 VMM and the L2 TDX guest needs to use TD partitioning > aware mechanisms for what's left. So currently such guests do not have > X86_FEATURE_TDX_GUEST set. > > We want the kernel to have X86_FEATURE_TDX_GUEST set for all TDX guests so we > need to check these additional CPUID bits, but we skip further initialization > in the function as we aren't guaranteed access to TDX module calls. I don't follow. The idea of partitioning is that L2 OS can be unenlightened and have no idea if it runs indide of TD. But this patch tries to enumerate TDX anyway. Why? -- Kiryl Shutsemau / Kirill A. Shutemov