Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp368127rdb; Tue, 16 Jan 2024 02:59:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFK2xhGtOcP+vNZDZshHjetKm3oPsxyhiQzWQTYbaVikPKo6p1NU6/yZQKCPutQl1QXSlYR X-Received: by 2002:ac8:7d85:0:b0:429:f53d:a18a with SMTP id c5-20020ac87d85000000b00429f53da18amr3676380qtd.74.1705402746800; Tue, 16 Jan 2024 02:59:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705402746; cv=none; d=google.com; s=arc-20160816; b=eHVYI2VQLJVshmYG5SA1fX3t0EPQJDKIW8fp6SDa2m4+bkGTkgwYDruRzFu0t4+c76 4a1mFJgv2fKG74YLo9KkQzaGiWSUvaixmAX9RM4S5NLaeRXTFlwFJ9bi60rMVyEz/Xek aJYN6dNjgV3/qZ6EhjB18SJvNMkSpVL6Uii3szVJhrkPJv8NGE+Rb5TAEM23qxGvqn+t UV7NOgOnXGsq5XcuUULlVoJrv5BWbMAAKALaqywWQtEUnTWpAL6Cm9ONfSI473ZPaTK+ lYn5gfwfpuTbTEZFl6tJcpWpG4yLguODG842ksbLRLi5/gy7BaHDygjwFFy7GixTZ7U/ fd/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xyJ4zv7O/uNDA/3RfyVdlWTB7gpi4biBjOQHfkKWtPo=; fh=vnoH6nka2Il5EYXFj9VavmIwO0mB6I+EAC37XHv1+YY=; b=MvC6ymXNzqmFXAfW8kKlDxfYvGaTqUAC3pdnpycEtReHnWcQiEeagaN5thsA13TUri kqvdqQokYxwNbVSQezsMeyqCZgi4juakiqKMWhCc6t1JjjqrWj7YMiCeYhWfHinrt400 eW+k8gaqBj8xCidWHxD92m0Mn1Jn+wt5p+qRAUZkgdYHJg4wS5GiY/HpPJnHOz0CGd1v aWhP33ah+cPmqx+OMQ/e6/7anOCPggVzW/261BRpCqhwZ1NimhZfVf+dn95hAhAUoKwF donJ6uDgrsqhX+yGwbZAseuBSH0ieevcJ4Utvwz332H2mI3hhMeYczzv+4WzhLG7Ahfy zeOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hf3wWH2s; spf=pass (google.com: domain of linux-kernel+bounces-27281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27281-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s15-20020a05622a178f00b00429b937f977si9310671qtk.498.2024.01.16.02.59.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 02:59:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hf3wWH2s; spf=pass (google.com: domain of linux-kernel+bounces-27281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27281-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8DB6D1C231AC for ; Tue, 16 Jan 2024 10:59:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1121C1A593; Tue, 16 Jan 2024 10:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hf3wWH2s" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC8D018EB3 for ; Tue, 16 Jan 2024 10:58:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705402731; x=1736938731; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=fVFzolAaNMqJShGWKu8kQmZjsqjN+EpSt9vDF82e8oo=; b=hf3wWH2sdtxbiZ4puwlEzC4I8O/OrB/YpIkEcS6/Q/AZ19GSYiLRP7Gw R19SwvCfjBzM2+Hmnqsi62GdhsCqQz/INZF/a3174HdkXTNZfYyIrLMVg O2m9eK3RuSAYQxe1v9Yh3I+v/OlWqZkFefak39MEFsku5714IiX0d7V97 V9snWISWFl/5osiNnISBE0Zov3V3M3jDIKYxSiOQO+gvKYHUS8yQ3xg3k 1PVKjVfGyxLyOU4xiQOyWts/LwJu+WhjqbQ0TeW1padzsxCHt4hHncOvy aXN0KOnEzlkdskQPIvRiJM2jbveQ1p44NON2JkI+hldN+0AfNY20BVyus g==; X-IronPort-AV: E=McAfee;i="6600,9927,10954"; a="399496629" X-IronPort-AV: E=Sophos;i="6.04,198,1695711600"; d="scan'208";a="399496629" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 02:58:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10954"; a="1115252763" X-IronPort-AV: E=Sophos;i="6.04,198,1695711600"; d="scan'208";a="1115252763" Received: from uschumac-mobl2.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.213.254]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 02:58:47 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 8EDF310A17B; Tue, 16 Jan 2024 13:58:44 +0300 (+03) Date: Tue, 16 Jan 2024 13:58:44 +0300 From: "kirill.shutemov@linux.intel.com" To: "Huang, Kai" Cc: "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , "thomas.lendacky@amd.com" , "linux-coco@lists.linux.dev" , "jpiotrowski@linux.microsoft.com" , "linux-kernel@vger.kernel.org" , "Cui, Dexuan" , "x86@kernel.org" Subject: Re: [PATCHv2] x86/mm: Fix memory encryption features advertisement Message-ID: <20240116105844.cjnwpzuywukfv5rs@box.shutemov.name> References: <20240111111224.25289-1-kirill.shutemov@linux.intel.com> <2b171c78e3dbc33f6fcf015c14c9e84825776798.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b171c78e3dbc33f6fcf015c14c9e84825776798.camel@intel.com> On Tue, Jan 16, 2024 at 10:36:10AM +0000, Huang, Kai wrote: > On Thu, 2024-01-11 at 14:12 +0300, Kirill A. Shutemov wrote: > > When memory encryption is enabled, the kernel prints the encryption > > flavor that the system supports. > > > > The check assumes that everything is AMD SME/SEV if it doesn't have > > the TDX CPU feature set. > > > > Hyper-V vTOM sets cc_vendor to CC_VENDOR_INTEL when it runs as L2 guest > > on top of TDX, but not X86_FEATURE_TDX_GUEST. Hyper-V only needs memory > > encryption enabled for I/O without the rest of CoCo enabling. > > > > To avoid confusion, check the cc_vendor directly. > > > > Possible alternative is to completely removing the print statement. > > For a regular TDX guest, the kernel already prints a message indicating > > that it is booting on TDX. Similarly, AMD and Hyper-V can also display > > a message during their enumeration process. > > > > Signed-off-by: Kirill A. Shutemov > > Cc: Dexuan Cui > > Cc: Jeremi Piotrowski > > Seems this fix is for userspace running in hyperv environment being able to use > some easy grep to get which coco vendor it is running on? Making decision in userspace by grepping dmesg is bad idea and nobody should do this. It can easily give false result: dmesg is not ABI, format can change and ring buffer has finite size, the message can be overridden. If we need a way for userspace to discover which CoCo environment it runs on, we need proper ABI for that. Maybe sysfs file or something. > If so I think it would be nice to mention it too. > > Acked-by: Kai Huang Thanks. -- Kiryl Shutsemau / Kirill A. Shutemov