[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgKF6kzR87WuXj/a@zn.tnic>
Date: Tue, 8 Feb 2022 16:02:02 +0100
From: Borislav Petkov <bp@...en8.de>
To: Michael Roth <michael.roth@....com>
Cc: Brijesh Singh <brijesh.singh@....com>, x86@...nel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-efi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
linux-coco@...ts.linux.dev, linux-mm@...ck.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Joerg Roedel <jroedel@...e.de>,
Tom Lendacky <thomas.lendacky@....com>,
"H. Peter Anvin" <hpa@...or.com>, Ard Biesheuvel <ardb@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Jim Mattson <jmattson@...gle.com>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Sergio Lopez <slp@...hat.com>, Peter Gonda <pgonda@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
David Rientjes <rientjes@...gle.com>,
Dov Murik <dovmurik@...ux.ibm.com>,
Tobin Feldman-Fitzthum <tobin@....com>,
Vlastimil Babka <vbabka@...e.cz>,
"Kirill A . Shutemov" <kirill@...temov.name>,
Andi Kleen <ak@...ux.intel.com>,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
brijesh.ksingh@...il.com, tony.luck@...el.com, marcorr@...gle.com,
sathyanarayanan.kuppuswamy@...ux.intel.com
Subject: Re: [PATCH v9 33/43] x86/compressed: Add SEV-SNP feature
detection/setup
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
Powered by blists - more mailing lists