Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1809814pxj; Sat, 5 Jun 2021 03:55:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO2Uk7+h5Wu6cgNoe6NcX397imlSu0q/bwCIe6qw/L7HGomURBmHHpIesLywokzAlgsQ3y X-Received: by 2002:a17:906:26db:: with SMTP id u27mr8860115ejc.532.1622890539540; Sat, 05 Jun 2021 03:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622890539; cv=none; d=google.com; s=arc-20160816; b=k8A1s6x7HvJXirlFxaaHvxt4df/sZTXHwpn7T4aHmcgbToXd8rIbG7vpV5Rx9MYIR+ 8GlK1EnL7WldXg6FTudsH6iqzWrKpFPEeNZv22ms2JWPVsUehIZwKhvx9/T9r4NiUL+w Bc6KMRI7I4YbgQ4waF3v359rh/3QA0tTxJkT7/oWUyGpi8cIqW8p48stm7D0SXH/lpLs DXTqNHHrG97z7n/FThbVgArPEeOqw6gfnJdIIWb0RgaZhY8zcUq80+z4DKU8MexOtGkZ Hdz5zZDUMh5pv6w+RiYlgtI2cvab1oUWXaGgLtocZJXGPlDsE1e2tfE7mFAynncaPGx2 5Lug== 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=m4WFNDMn/F2hBFMtOb5KcbkKEA5fPujaJDdSpXTf3yI=; b=R4bSFQ4ANf/KwmTxEvglr2uvE2B0Pvn6Pvt/hzdngd0xgqkaHPpPaYaOg9+KwNZ73O hvShC/nPeOZASZ2qO3Du1o+DS3fab77L0ubh/RuVOA1p0BxLHKkjoUzwEAiswH/krYTk NSctcn9cCTiDGE6JJw4z+HQrFmZHtfd9L9wXB4WikCYkNmRMox7hWYPo6idF7MHgHXRG HF8vPSIwAqw9qfJhC0PvL0O2VGbr1aZ2ScbmXOUx77g9NRCn9q20QdyyAXmLnf801u60 +hMV5DJ+0qMAJdvD8EONiPxUIGTHmkNzRaxiYN03q+0MHRoFVIN4SqFFb2th5Ct6CHA5 FdfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=b9euwxNW; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si3164510ejj.302.2021.06.05.03.55.04; Sat, 05 Jun 2021 03:55:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=b9euwxNW; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbhFEKy7 (ORCPT + 99 others); Sat, 5 Jun 2021 06:54:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbhFEKy7 (ORCPT ); Sat, 5 Jun 2021 06:54:59 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F69BC061766; Sat, 5 Jun 2021 03:53:11 -0700 (PDT) Received: from zn.tnic (p4fed32f0.dip0.t-ipconnect.de [79.237.50.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C2FC41EC01A2; Sat, 5 Jun 2021 12:53:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1622890389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=m4WFNDMn/F2hBFMtOb5KcbkKEA5fPujaJDdSpXTf3yI=; b=b9euwxNWNDPFTyr/DO+tkH5SKsRbrIAcUy0+u+Jvmj/u6fbpiZz9u3lFXvXcgwIemAcufI NyCxlLalL3M1NPfNHFgQhUWN/nBA/Vh8556EE5bzxFiKvpEO+aa9S/C6oi3V7LKg6VQ6eu Z/KRkDNbfBU2ttfxGH9aWiVrTQ//cn8= Date: Sat, 5 Jun 2021 12:50:53 +0200 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , tony.luck@intel.com, npmccallum@redhat.com Subject: Re: [PATCH Part1 RFC v3 04/22] x86/mm: Add sev_feature_enabled() helper Message-ID: References: <20210602140416.23573-1-brijesh.singh@amd.com> <20210602140416.23573-5-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210602140416.23573-5-brijesh.singh@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Jun 02, 2021 at 09:03:58AM -0500, Brijesh Singh wrote: > @@ -78,6 +85,7 @@ static inline void sev_es_init_vc_handling(void) { } > static inline bool sme_active(void) { return false; } > static inline bool sev_active(void) { return false; } > static inline bool sev_es_active(void) { return false; } > +static inline bool sev_snp_active(void) { return false; } Leftover from the previous version, can go. > +bool sev_feature_enabled(unsigned int type) > +{ > + switch (type) { > + case SEV: return sev_status & MSR_AMD64_SEV_ENABLED; > + case SEV_ES: return sev_status & MSR_AMD64_SEV_ES_ENABLED; > + case SEV_SNP: return sev_status & MSR_AMD64_SEV_SNP_ENABLED; > + default: return false; > + } > +} Yeah, btw, we might even do a generic one, see: https://lkml.kernel.org/r/YLkcIuL2qvo0hviU@zn.tnic and the following mail. But that doesn't matter as sev_feature_enabled()'s body can go into sev_protected_guest_has() or whatever we end up calling it. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette