Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1583333pxb; Tue, 8 Feb 2022 23:06:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUo/05oog+xYke86deOXYk23Q5acCi4bZj3u8N1+FLgiuZPsdIoZlDTih9Hh+OA2VEoQ8a X-Received: by 2002:a17:902:f203:: with SMTP id m3mr1132895plc.20.1644390404391; Tue, 08 Feb 2022 23:06:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644390404; cv=none; d=google.com; s=arc-20160816; b=DMDelgdlJ0MIOt/Ii8STUwUj70mUO2jpgfmNAdSmCT/fqcYH4yNBGMXw6CgqgKNOrf +f5xZ7N/8mrFke1TLFyEqPj5xb8gsM3A9qqnsnVdy7IyJTuwNceQ4MV9xvema1hRE2Oa rz2tGkHE4ZTYYNxCe+4QDVdBNK3DNhmfue32RQMjY2GqMJAS2W9edzS7aJ0ba1YYCDP/ Oip5L3EjvrHvWUQ/CZ/albqSEbZUoG99h/VB47XdJiXfmRyAXyL3lIZAF+QqaTCL9ZeP 4w7BNOd6DqFHA4JBQtF9D2c6bsrXIW1/jnxGo7KNpYacDOSY82/cgNsSo88gox7j1Ett THeA== 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=PmHLjCv8QPKB/e0+L9sQuWzLs6/HCLu3AQwtoLxemqY=; b=FLH89vkGG5Irub6GAKoMa9i9+Q8P2bT/H/V4QCvUxBL+iv7U1rX+wnJJ8eNIC86S0r LAU1fMsRIi3mCEg6BblEKOLh5/hgokwzWr9NiTD2EWBkhCP/snFHkJ/ngsyoGYZivUx6 LtbaO/+Lgo6qCA8YaFYYZpp6ZNfhOWuqNFRFafrbCdcWP0Mt7/8R/a3CZIZH7XQUmq0W Xs3aioWDsc2c72zxVvLH/IHq6vkod3i6sR/ihAfqUfHZxTq/bUvjGR7ddoR0YqxwbskV t0d6Tli8o6062ixa7oM2d1SBKl8oTDej+xW1UzBXos3YWfBOYSm/bzaDfSFFqWL86HMc 0U/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=cJ+v1YVs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i70si2563632pge.859.2022.02.08.23.06.31; Tue, 08 Feb 2022 23:06:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=cJ+v1YVs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1379200AbiBHPCR (ORCPT + 99 others); Tue, 8 Feb 2022 10:02:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350967AbiBHPCP (ORCPT ); Tue, 8 Feb 2022 10:02:15 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E41B2C061576; Tue, 8 Feb 2022 07:02:13 -0800 (PST) Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (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 DE2981EC053F; Tue, 8 Feb 2022 16:02:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1644332528; 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=PmHLjCv8QPKB/e0+L9sQuWzLs6/HCLu3AQwtoLxemqY=; b=cJ+v1YVsVB5ysTBNNKVmP99U334P0+41QjVaIkHm37ZZu0pzwjEgVIAgukztHCJgE2F/PO hQoUIH1TReaIabKCaPXeoP8tiEZpWM2lFT8soN7USRwTa8yQgE+fdaVrHtV/SUlbm6aVVm K9pkhVbpBPWSCiDhwDpLe4oaZ7nng1U= Date: Tue, 8 Feb 2022 16:02:02 +0100 From: Borislav Petkov To: Michael Roth Cc: Brijesh Singh , 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, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , brijesh.ksingh@gmail.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v9 33/43] x86/compressed: Add SEV-SNP feature detection/setup Message-ID: References: <20220128171804.569796-1-brijesh.singh@amd.com> <20220128171804.569796-34-brijesh.singh@amd.com> <20220208135009.7rfrau33kxivx5h3@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220208135009.7rfrau33kxivx5h3@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Tue, Feb 08, 2022 at 07:50:09AM -0600, Michael Roth wrote: > I'm assuming that would be considered 'non-static' since it would need > to be exported if sev-shared.c was compiled separately instead of > directly #include'd. No, that one can lose the prefix too. We'll cross that bridge when we get to it. > And then there's also these which are static helpers that are only used > within sev-shared.c: > > snp_cpuid_info_get_ptr() So looking at that one - and it felt weird reading that code because it said "cpuid_info" but that's not an "info" - that should be: struct snp_cpuid_table { u32 count; u32 __reserved1; u64 __reserved2; struct snp_cpuid_fn fn[SNP_CPUID_COUNT_MAX]; } __packed; just call it what it is - a SNP CPUID *table*. And then you can have const struct snp_cpuid_table *cpuid_tbl = snp_cpuid_get_table(); and that makes it crystal clear what this does. > snp_cpuid_calc_xsave_size() > snp_cpuid_get_validated_func() > > snp_cpuid_check_range() You can merge that small function into its only call site and put a comment above the code: /* Check function is within the supported CPUID leafs ranges */ > snp_cpuid_hv() > snp_cpuid_postprocess() > snp_cpuid() > > but in those cases it seems useful to keep them grouped under the > snp_cpuid_* prefix since they become ambiguous otherwise, and > just using cpuid_* as a prefix (or suffix/etc) makes it unclear > that they are only used for SNP and not for general CPUID handling. > Should we leave those as-is? Yap, the rest make sense to denote to what functionality they belong to. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette