Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp332091rdb; Tue, 5 Dec 2023 06:46:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ4jaR5FsPkUKqAdgSYe5/UiwERqnTQaOZ6MiCtkrQ9RzofrnQVK/cfz89voLhtiSr4KJI X-Received: by 2002:a05:6a00:1d1a:b0:6c3:3bf9:217e with SMTP id a26-20020a056a001d1a00b006c33bf9217emr1160147pfx.19.1701787601696; Tue, 05 Dec 2023 06:46:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701787601; cv=none; d=google.com; s=arc-20160816; b=ebq6qqKNfSLLnqc9lB8NxJr2zifF0K7jgc7TF7iS5eDthxHoTDxo02Jj1i8EZaLt+0 PrWVv2RtEX1mdymrzd1es+JKjzEkiTS6x2byHtdQrRBaR2GegATmyuD7EJS1AS6TfZi9 CqWTyFtpIWg51LvZgM0M8bIjaxw7Dgpw0oZzTCHK4uEiZCfqI3znMthqHqUHSIC4CVH3 AIcjLH516rd0C/mQVsGwhLFFrLrep9aijnyuzooM5mEgT8x7b03SpOhvAB2Yz8kuM120 WF2OUnYLlJs36jv0uwmAU9TF7c8PWuQLUICNS1pjy3ELOEOn8yzGux1Zh4na8tAUtpbX wOZQ== 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=BJbP9AsQihwVtDIItX/UOvISEkEVBiqOOo4DUb6Mu3Q=; fh=j/FlFT3AFBrfyd4b6/GF0zOfkjD/Y07yr8XvngdfZeM=; b=o5TxwYZbzKZnxQW/GhPGWWAPQ2Zf8422IhT18JOIQD6KESl3tqiRmw0H1ZpIEYg4Ss jPZMuKGv51KEods74huGBOKdbu6AfvwVqhTL/Q2TYC5frUG8C/k85jqf4iEXHfMxr3cI WAl6XbL/Y7LBGaJGy6TIb8j0EPFzXQg3MZKzpsmHDuuFUqyY+SABUyD0nikqrMG1EmTG KSN19PWKC8f1ZGEHL4Ka/LVn53g/DDHHjjP52+ls32Eby0RQ8sk7iCj0ogsJUUPNiytq jGiQ44iTntBFVjnGZcR8juEpdQEQVtGUKjVHJGNOI9WifUBhQ7SemdxgNNeUp6unpuyc 8FFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=EXMmwLlT; 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=alien8.de Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a193-20020a6390ca000000b005c1cc7273bcsi5446428pge.731.2023.12.05.06.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 06:46:41 -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=@alien8.de header.s=alien8 header.b=EXMmwLlT; 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=alien8.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7878980408F1; Tue, 5 Dec 2023 06:46:39 -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 S1345685AbjLEOq3 (ORCPT + 99 others); Tue, 5 Dec 2023 09:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345572AbjLEOq2 (ORCPT ); Tue, 5 Dec 2023 09:46:28 -0500 Received: from mail.alien8.de (mail.alien8.de [IPv6:2a01:4f9:3051:3f93::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B33EAF for ; Tue, 5 Dec 2023 06:46:34 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 0EDAA40E0173; Tue, 5 Dec 2023 14:46:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CPXgmXOtt_gg; Tue, 5 Dec 2023 14:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1701787589; bh=BJbP9AsQihwVtDIItX/UOvISEkEVBiqOOo4DUb6Mu3Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EXMmwLlT/R1Mnw2SWkkaYkB/H8/uwWKJxOchCK1dZk3odSjYfMs6VVlL/CxnFJF9O Rh/EW53DzPtLyJuPGgp7rPHNsIiwg+xKvIB571lvrPGUaFjzDT6xdFFkVkbIva5AQ3 4abzcwSlrHrgjLyz1pCf/2soYpncvltQH6UE1BUohGcS4vqvd6YQ0Fuwtg/rtokFSG oPSCBySqJwXaqqa0UJTuzPzeT7ZEOAH6kmspKIIuFLVG33+yOtzvlA6xZidXC+3PJ9 4c6GjvqecsJpZBrkbrS6TsStYMbsmlbQbVB/QRAlgNsBufL1RxQ5PQDDF4st+RrEgb UNZIrRnjYQONzXPWrESVs0bwS/ZpYrxqmstbVaW+Ds/ltN+ufPSpeOtgR4yPVxE/nE Wjo4E3eBVYP3azBo4F+4b+TduAGWT6uf/aRN4bIIalNfvLCR2B8noWDpzq5dt7WUWj K1mihZRfFU9C8HmGZFRqq1/sa072qvgNoq6Pqc2UowadI7MbgpnEAfqZYS23SmSY+U D5I0h5h4ysrzwehimB44hJR1HPW+l2e8eG87PWTO0tud4IULMik/wkWz99FXm8s2C5 qDBfCD1WiYLijjudt8C5/OisdcRQs2ij+rS2Z39mx9bExVoEkl4O9i+sTJfJnczcwN JI5Ll8aB7UwekKShVumZfeGY= Received: from zn.tnic (pd95304da.dip0.t-ipconnect.de [217.83.4.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 31D9440E014B; Tue, 5 Dec 2023 14:46:20 +0000 (UTC) Date: Tue, 5 Dec 2023 15:46:19 +0100 From: Borislav Petkov To: "Kirill A. Shutemov" Cc: Tom Lendacky , Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/coco, x86/sev: Use cpu_feature_enabled() to detect SEV guest flavor Message-ID: <20231205144619.GCZW83uzAomKmupn7j@fat_crate.local> References: <20231205143738.2875-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231205143738.2875-1-kirill.shutemov@linux.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 05 Dec 2023 06:46:39 -0800 (PST) On Tue, Dec 05, 2023 at 05:37:38PM +0300, Kirill A. Shutemov wrote: > The SEV code uses cc_platform_has() checks to detect the SEV flavor. > However, these checks can sometimes produce false positives depending on > the context. > > For example, sev_map_percpu_data() uses CC_ATTR_GUEST_MEM_ENCRYPT to > detect SEV guest, but this check will also pass for TDX guests. Well, a function prefixed with "sev_" should check cc_vendor first... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette