[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250520113849.GKaCxpyVy-7N6bih-r@fat_crate.local>
Date: Tue, 20 May 2025 13:38:49 +0200
From: Borislav Petkov <bp@...en8.de>
To: Ard Biesheuvel <ardb+git@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org, x86@...nel.org,
Ard Biesheuvel <ardb@...nel.org>, Ingo Molnar <mingo@...nel.org>,
Dionna Amalie Glaze <dionnaglaze@...gle.com>,
Kevin Loughlin <kevinloughlin@...gle.com>,
Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [RFT PATCH v3 05/21] x86/sev: Move GHCB page based HV
communication out of startup code
On Mon, May 12, 2025 at 09:08:40PM +0200, Ard Biesheuvel wrote:
> diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
> index f50a606be4f1..07081bb85331 100644
> --- a/arch/x86/include/asm/sev.h
> +++ b/arch/x86/include/asm/sev.h
> @@ -485,6 +485,7 @@ static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate)
> struct snp_guest_request_ioctl;
>
> void setup_ghcb(void);
> +void snp_register_ghcb_early(unsigned long paddr);
> void early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
> unsigned long npages);
> void early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr,
> @@ -521,8 +522,6 @@ static __always_inline void vc_ghcb_invalidate(struct ghcb *ghcb)
> __builtin_memset(ghcb->save.valid_bitmap, 0, sizeof(ghcb->save.valid_bitmap));
> }
>
> -void vc_forward_exception(struct es_em_ctxt *ctxt);
> -
> /* I/O parameters for CPUID-related helpers */
> struct cpuid_leaf {
> u32 fn;
> @@ -533,15 +532,71 @@ struct cpuid_leaf {
> u32 edx;
> };
>
> +int svsm_perform_msr_protocol(struct svsm_call *call);
> int snp_cpuid(void (*cpuid_hv)(void *ctx, struct cpuid_leaf *),
> void *ctx, struct cpuid_leaf *leaf);
>
> +/*
> + * Issue a VMGEXIT to call the SVSM:
> + * - Load the SVSM register state (RAX, RCX, RDX, R8 and R9)
> + * - Set the CA call pending field to 1
> + * - Issue VMGEXIT
> + * - Save the SVSM return register state (RAX, RCX, RDX, R8 and R9)
> + * - Perform atomic exchange of the CA call pending field
> + *
> + * - See the "Secure VM Service Module for SEV-SNP Guests" specification for
> + * details on the calling convention.
> + * - The calling convention loosely follows the Microsoft X64 calling
> + * convention by putting arguments in RCX, RDX, R8 and R9.
> + * - RAX specifies the SVSM protocol/callid as input and the return code
> + * as output.
> + */
> +static __always_inline void svsm_issue_call(struct svsm_call *call, u8 *pending)
Why in a header?
At least in sev-internal.h or so.
I'd prefer for this to be in a .c file, though.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists