From patchwork Thu Nov 9 16:14:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremi Piotrowski X-Patchwork-Id: 163461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp544510vqs; Thu, 9 Nov 2023 08:15:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfQQ5Wm5+WBR3PKOOoF0J7LaunwTtQ553AxmmtFYJYNbrAXnBRKlt1f1puI1AjpXXG0JhD X-Received: by 2002:a17:902:e752:b0:1c9:ff46:163d with SMTP id p18-20020a170902e75200b001c9ff46163dmr6011250plf.38.1699546554140; Thu, 09 Nov 2023 08:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699546554; cv=none; d=google.com; s=arc-20160816; b=qkosGeK7NAv24UR/sx33K7AUznfzNfCHEpsKG8JgCjx44Mafm2j6j4EC8zGX3dqC5h 68WsQGKT4H3eH9Jy0La8XDgVBUFqXMZINLmXJyDPU/4z1AdxSMXnlzR7hFBmifX9Vb+7 P1l1IFeAGByVp1tUoIo1YegruksqkY8wAzH5LsGnL79unPEONA6k0OR8sBj6NCVuVtGv wf6f53fWXDAZVD2p+NnFIjTkswNB5tsqemVnY/AEjEcoT8vBTk5JqcMoQ8x2Cu+oo4Vs 6hm/TcebPUfvpApcKyMUz/iEF3DwV1n87JGQY4qUcMtkHJ8zNChfGhfzIguCUXfbVcuN Xq/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=TODuuixcRLtErqip8qybtbJ+d9Czo7e1uLIBPHVy8TQ=; fh=xlY4TP4PFLTNnS8QU/XhHrQo7VHPn1XEmWNI9VWYw90=; b=AmFmn5a+FDlRoloDti180L0ssL9JIYjq4uwELsQ6FwVRKAsEZxKcVEEkN+XFfalrTd 1eOSfbK29/4TCgKKQ8FHQV+6wBGATPG5Q28NgpN5uyUfrLg4cREh5MrMoRRGImMvfTmm BuOefBWQgWafk70SVhmZ3WrB+IwXyO3ZPeSHtwI0fZR6f57G6ZeGAN83fJjBQ0QGm0mx WEhH+0qcgdo8vqEq4lFx/aerT8zKOZkbwCKdDV8VOqF8sgyE6/wEuj2WjHk76p/v7tTg obQwjfymIZuxLLU7P7n8LVPx0qOK9bh4arfzZvfIw9w7ROl6AuCFZRXWH+4nZ53BlrSc xsHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=EbH0kTsK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id kf16-20020a17090305d000b001c71e907ee6si5041273plb.124.2023.11.09.08.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 08:15:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=EbH0kTsK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8B0A78376E61; Thu, 9 Nov 2023 08:15:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232511AbjKIQPL (ORCPT + 31 others); Thu, 9 Nov 2023 11:15:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234617AbjKIQPG (ORCPT ); Thu, 9 Nov 2023 11:15:06 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 632583588; Thu, 9 Nov 2023 08:15:03 -0800 (PST) Received: by linux.microsoft.com (Postfix, from userid 1112) id 909A820B74C0; Thu, 9 Nov 2023 08:15:02 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 909A820B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1699546502; bh=TODuuixcRLtErqip8qybtbJ+d9Czo7e1uLIBPHVy8TQ=; h=From:To:Cc:Subject:Date:From; b=EbH0kTsKFErwQ4gtiA3IOIQQBjpes92qMHSU1zZjXoJrLQs45sUfgAoQm8FsVgh31 xzpgR0xXT54AtG9TZrq49fL9GmkSzfFCEi4x0UxNxprEzSpmWgXxlb4WK2lY4ORMDW UH54N3QvpvKuLxTaFSyLI4FohPfV/TRUVoFUAXPQ= From: Jeremi Piotrowski To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Michael Kelley , Dexuan Cui Cc: Jeremi Piotrowski , 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, kirill.shutemov@linux.intel.com, sashal@kernel.org Subject: [PATCH] x86/mm: Check cc_vendor when printing memory encryption info Date: Thu, 9 Nov 2023 08:14:49 -0800 Message-Id: <1699546489-4606-1-git-send-email-jpiotrowski@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 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 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 08:15:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782103727278726886 X-GMAIL-MSGID: 1782103727278726886 Check the value of cc_vendor to see if we're in an Intel TDX protected VM instead of checking for the TDX_GUEST CPU feature. The rest of the function already uses the abstractions available in cc_platform.h to check for confidential computing features. For Intel, cc_vendor is set from tdx_early_init() or hv_vtom_init(), so the new code correctly handles both cases. The previous check relied on the Linux-controlled TDX_GUEST CPU feature which is only set in tdx_early_init(). Signed-off-by: Jeremi Piotrowski --- arch/x86/mm/mem_encrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index c290c55b632b..d3bd39aad8b6 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -44,7 +44,7 @@ static void print_mem_encrypt_feature_info(void) { pr_info("Memory Encryption Features active:"); - if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) { + if (cc_vendor == CC_VENDOR_INTEL) { pr_cont(" Intel TDX\n"); return; }