Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6506368rdb; Tue, 2 Jan 2024 04:30:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZ+DwszYnQpM7pN77IJnUIO2akiVHwsiBlPOBQKHmUFtApgBTYyoOqjVCOcBr+UgYyReBa X-Received: by 2002:a05:6214:300b:b0:680:b7f3:de39 with SMTP id ke11-20020a056214300b00b00680b7f3de39mr2554224qvb.63.1704198648703; Tue, 02 Jan 2024 04:30:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704198648; cv=none; d=google.com; s=arc-20160816; b=FLiKZQpDyMKnKlnxvr8rU3TBfsafeeQa45lR/dyAZCPuIn06vGvJzh5T27CIkyv7/J Q2cKAurxnZFC1gcSlY/VjGrFnUn2VggisStw/noVXrR09Pi/ISd+AgMbGVsEaqzUOiNn kF/Asgdg+LyRStAn76PoRZ3yd5aCt4ChYNxLgfKRg/tLQ5Rp3bqUhnXZAyb6TqieJ1aw Kls//DE3vQoJcTWi95AVL01iETjVzkBAMwTxe8XRwfGXbB+5jwo1Uj8Eo6t2NOErlgEJ jSienvSgpA/P7VdDWig1k7Hh+QxyGllGwiDf6G4Y+UH20Cl4Ymg1FSHwhQ0GbQnpF724 BbYg== 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=IxuDw30cS9iEm0QSFSWt71QB0CzS/3Wfbj0oTK5OV4Y=; fh=j/FlFT3AFBrfyd4b6/GF0zOfkjD/Y07yr8XvngdfZeM=; b=BwG7gh30995A6IMhYe18zfERaQq4jiGmT3uCyl6476UjJh+ZyD6YlUcSqBAS0vj7TY NlR3FegbyjwiJwSVFsdbuspn/9Mb8z13/UnbqAfQJt3loSCyKctxvaOvyZnoj1qdE/44 +5rJsAuK5xS7hYiSuHwwa+jbXVluK8TEzveydOlROFemsEr5pbDGlUkzPDEif34CHZGt mBu12Y5cIT1ZsUzLV1yCORhgLbnY/yTmJYc/wOKmaE/c3ms/8drORse5ZdSys21MmwwF N+p0f4EhHWTyhApRNuyMQHRTIC4CMDjiLk9rgn64Cnb6A9OBf5zY/NulhH0t8Ne4Jm0j 5Y2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=Rcn669GB; spf=pass (google.com: domain of linux-kernel+bounces-14341-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14341-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u15-20020a0cb40f000000b0067fbb92fe95si21587449qve.377.2024.01.02.04.30.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 04:30:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14341-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=@alien8.de header.s=alien8 header.b=Rcn669GB; spf=pass (google.com: domain of linux-kernel+bounces-14341-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14341-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 75C3A1C21EC6 for ; Tue, 2 Jan 2024 12:30:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 653D6F4F4; Tue, 2 Jan 2024 12:30:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="Rcn669GB" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 CF313EED7 for ; Tue, 2 Jan 2024 12:30:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 08B4040E01FF; Tue, 2 Jan 2024 12:30:35 +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 xm12y3_UOTav; Tue, 2 Jan 2024 12:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1704198632; bh=IxuDw30cS9iEm0QSFSWt71QB0CzS/3Wfbj0oTK5OV4Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rcn669GBfctS/JFjWfVBK/s7XNaUC4VNkYor5MT4uHuL1ujgRNw2ZxwwlcSzZkCV1 WWPhMG4JoAv2UBpsmm59QNg0EZsnOGiJy7jpsHj3c96E8Q3bEluyorZ7DcDfYWB0Hb yLGMJBHZwQbvhJoSFtUiJmxS//mCT1NnclylnoMgIlrCRjNC9KHhudVrfvYDF5oiaK Dw3LOPiyxrCe8GBA5Iq0QaehTtCfslmVB0Nzr9JWqsT7NXwiC6UcN/tcn3NpoE5NeL Sav7G3r2XMWG24uKg7kD5GwK5QAgpqR6vs3oQCIRez7a1dZ+ugTPAHw6U8QGNdWc4G wfEUekJjPAYrdxbr3c2GpgeJ+1W2MFHEdUVoG6vdcyNpqnmjddRap+873ktydmNXga Uq9T7tYc4qaVaxkUv9OJ/j9e4oxn3ra6/KpMChrsFlqL4gqIfCLSpkMy3ohwalqAMB 8yrxQKxB2lJ5X0qpJ0YNmFxMFsxA6XwwB47PwA1jUwmGuXhBpVQlNPQ4CDe2JS3anW lgR5jmkhcDZD8Xz5zjnclbRqpswwdVted36YCnuKiGhJOnjRmfUYx31ABifz8WOqsG TYYbJNGtJllRnXYF7uRzpQ0UlxvtSLfn+AWgPBvYfe1M9sNf73DJCYEVVWEuDo74jx cAHm2ZkB16qbRwyiB8ol32Vw= Received: from zn.tnic (pd9530f8c.dip0.t-ipconnect.de [217.83.15.140]) (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 A43F240E0193; Tue, 2 Jan 2024 12:30:23 +0000 (UTC) Date: Tue, 2 Jan 2024 13:30:18 +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: <20240102123018.GBZZQB2gLjDs9QknQS@fat_crate.local> References: <20231205150012.6lma2wzcellr7pz7@box.shutemov.name> <20231205150648.GDZW88iAjBzYoIJ0+o@fat_crate.local> <20231205151437.aqmuydosfmnq3zr4@box.shutemov.name> <20231205160035.GEZW9JI8eKENXBo6EO@fat_crate.local> <20231205171643.zg7fwxjyccab53kf@box.shutemov.name> <20231205172436.GFZW9c1EaCaguGhglb@fat_crate.local> <20231205180813.phbxg5jdumfovshz@box.shutemov.name> <20231205185241.GGZW9xeTtiG6sORMTr@fat_crate.local> <20231205203337.GKZW+JIe9m2/QVi7Xl@fat_crate.local> <20240102122233.fng76fdmq5xsqkhi@box.shutemov.name> 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=utf-8 Content-Disposition: inline In-Reply-To: <20240102122233.fng76fdmq5xsqkhi@box.shutemov.name> On Tue, Jan 02, 2024 at 03:22:33PM +0300, Kirill A. Shutemov wrote: > On Tue, Dec 05, 2023 at 09:33:37PM +0100, Borislav Petkov wrote: > > On Tue, Dec 05, 2023 at 07:52:41PM +0100, Borislav Petkov wrote: > > > So yes, we will fix your issue, no worries. I'm figuring out the > > > details as we speak. > > > > So you can do for the short term: > > > > --- > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > > index c461c1a4b6af..f8999f6d1b00 100644 > > --- a/arch/x86/kernel/kvm.c > > +++ b/arch/x86/kernel/kvm.c > > @@ -434,7 +434,7 @@ static void __init sev_map_percpu_data(void) > > { > > int cpu; > > > > - if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) > > + if (cc_vendor != CC_VENDOR_AMD || !cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) > > return; > > > > for_each_possible_cpu(cpu) { > > --- > > > > until we've sorted out the bigger picture. > > So, there seems no movement on the issue. > > Borislav, could you share your view on the bigger picture. I can try to > implement it. cc_platform_has() gets used in arch-agnostic code. x86 code can use cc_platform_has() or X86_FEATURE as TDX already does. In the AMD case, cc_platform_has() makes more sense because we need sev_status which is much earlier there than X86_FEATURE. So the only thing to "implement" is to check vendor in sev_map_percpu_data() as mentioned above. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette