lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <93f9ea0e-acfa-076d-ee39-42b7582675a3@amd.com>
Date: Wed, 16 Jul 2025 11:52:28 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Ard Biesheuvel <ardb+git@...gle.com>, linux-kernel@...r.kernel.org
Cc: linux-efi@...r.kernel.org, x86@...nel.org,
 Ard Biesheuvel <ardb@...nel.org>, Borislav Petkov <bp@...en8.de>,
 Ingo Molnar <mingo@...nel.org>, Kevin Loughlin <kevinloughlin@...gle.com>,
 Josh Poimboeuf <jpoimboe@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
 Nikunj A Dadhania <nikunj@....com>
Subject: Re: [PATCH v5 01/22] x86/sev: Separate MSR and GHCB based snp_cpuid()
 via a callback

On 7/15/25 22:18, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
> 
> There are two distinct callers of snp_cpuid(): one where the MSR
> protocol is always used, and one where the GHCB page based interface is
> always used.
> 
> The snp_cpuid() logic does not care about the distinction, which only
> matters at a lower level. But the fact that it supports both interfaces
> means that the GHCB page based logic is pulled into the early startup
> code where PA to VA conversions are problematic, given that it runs from
> the 1:1 mapping of memory.
> 
> So keep snp_cpuid() itself in the startup code, but factor out the
> hypervisor calls via a callback, so that the GHCB page handling can be
> moved out.
> 
> Code refactoring only - no functional change intended.
> 
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>

Reviewed-by: Tom Lendacky <thomas.lendacky@....com>

Just a minor comment below...

> ---
>  arch/x86/boot/startup/sev-shared.c | 60 ++++----------------
>  arch/x86/coco/sev/vc-shared.c      | 49 +++++++++++++++-
>  arch/x86/include/asm/sev.h         |  3 +-
>  3 files changed, 61 insertions(+), 51 deletions(-)
> 


> diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
> index 89075ff19afa..2cabf617de3c 100644
> --- a/arch/x86/include/asm/sev.h
> +++ b/arch/x86/include/asm/sev.h
> @@ -552,7 +552,8 @@ struct cpuid_leaf {
>  	u32 edx;
>  };
>  
> -int snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf);
> +int snp_cpuid(void (*cpuid_hv)(void *ctx, struct cpuid_leaf *),

You use cpuid_fn elsewhere in the patch. I'm ok with either one, but
they should match name-wise.

Also, you should provide an argument name for the leaf pointer or no
argument name for the void pointer (throughout).

Thanks,
Tom

> +	      void *ctx, struct cpuid_leaf *leaf);
>  
>  void __noreturn sev_es_terminate(unsigned int set, unsigned int reason);
>  enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ