lkml.org 
[lkml]   [2022]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 33/43] x86/compressed: Add SEV-SNP feature detection/setup
On Sun, Feb 06, 2022 at 05:41:26PM +0100, Borislav Petkov wrote:
> On Fri, Jan 28, 2022 at 11:17:54AM -0600, Brijesh Singh wrote:
> > +static struct cc_setup_data *get_cc_setup_data(struct boot_params *bp)
> > +{
> > + struct setup_data *hdr = (struct setup_data *)bp->hdr.setup_data;
> > +
> > + while (hdr) {
> > + if (hdr->type == SETUP_CC_BLOB)
> > + return (struct cc_setup_data *)hdr;
> > + hdr = (struct setup_data *)hdr->next;
> > + }
> > +
> > + return NULL;
> > +}
>
> Merge that function into its only caller.
>
> ...
>
> > +static struct cc_blob_sev_info *snp_find_cc_blob(struct boot_params *bp)
>
> static function, no need for the "snp_" prefix. Please audit all your
> patches for that and remove that prefix from all static functions.
>

I'm a little unsure how to handle some of these others cases:

We have this which is defined in sev-shared.c and used "externally"
by kernel/sev.c or boot/compressed/sev.c:

snp_setup_cpuid_table()

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.

And then there's also these which are static helpers that are only used
within sev-shared.c:

snp_cpuid_info_get_ptr()
snp_cpuid_calc_xsave_size()
snp_cpuid_get_validated_func()
snp_cpuid_check_range()
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?

\
 
 \ /
  Last update: 2022-02-08 14:51    [W:0.160 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site