[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200522083321.GA28750@zn.tnic>
Date: Fri, 22 May 2020 10:33:21 +0200
From: Borislav Petkov <bp@...en8.de>
To: Joerg Roedel <joro@...tes.org>
Cc: x86@...nel.org, hpa@...or.com, Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Hellstrom <thellstrom@...are.com>,
Jiri Slaby <jslaby@...e.cz>,
Dan Williams <dan.j.williams@...el.com>,
Tom Lendacky <thomas.lendacky@....com>,
Juergen Gross <jgross@...e.com>,
Kees Cook <keescook@...omium.org>,
David Rientjes <rientjes@...gle.com>,
Cfir Cohen <cfir@...gle.com>,
Erdem Aktas <erdemaktas@...gle.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mike Stunes <mstunes@...are.com>,
Joerg Roedel <jroedel@...e.de>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v3 43/75] x86/sev-es: Setup per-cpu GHCBs for the runtime
handler
On Tue, Apr 28, 2020 at 05:16:53PM +0200, Joerg Roedel wrote:
> @@ -198,6 +210,48 @@ static bool __init sev_es_setup_ghcb(void)
> return true;
> }
>
> +static void __init sev_es_alloc_runtime_data(int cpu)
> +{
> + struct sev_es_runtime_data *data;
> +
> + data = memblock_alloc(sizeof(*data), PAGE_SIZE);
> + if (!data)
> + panic("Can't allocate SEV-ES runtime data");
> +
> + per_cpu(runtime_data, cpu) = data;
> +}
> +
> +static void __init sev_es_init_ghcb(int cpu)
Since those are static functions, I'd drop the "sev_es_" prefix from the
name for better readability. Because otherwise the whole file is a sea
of "sev_es_"-prefixed identifiers which you need to read until the end
to know what they are.
> +{
> + struct sev_es_runtime_data *data;
> + int err;
> +
> + data = per_cpu(runtime_data, cpu);
> +
> + err = early_set_memory_decrypted((unsigned long)&data->ghcb_page,
> + sizeof(data->ghcb_page));
> + if (err)
> + panic("Can not map GHCBs unencrypted");
"Error mapping ..."
> +
> + memset(&data->ghcb_page, 0, sizeof(data->ghcb_page));
> +}
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists