diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-10 19:19:06 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-10 19:19:06 -0800 |
| commit | ca8f421ea0d3f1d39f773e14f68f93c978e470ef (patch) | |
| tree | ec294b32aa1dc3787decfb649697f8ff484dda31 /arch/x86/include | |
| parent | 57cb845067e0bf5d42af6bc570190bba3238660e (diff) | |
| parent | 8c89d3ad3095808ac130c535ad7ed3d1344d5986 (diff) | |
Merge tag 'x86_sev_for_v7.0_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 SEV updates from Borislav Petkov:
- Make the SEV internal header really internal and carve out the
SVSM-specific code into a separate compilation unit, along with other
cleanups and fixups
[ TLA translation service: 'SEV' is AMD's 'Secure Encrypted
Virtualization' and SVSM is an ETLA ('Enhanced TLA') for 'Secure
VM Service Module'.
Some of us have trouble keeping track of this all and need all the
help we can get ]
* tag 'x86_sev_for_v7.0_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/sev: Don't emit BSS_DECRYPTED section unless it is in use
x86/sev: Use kfree_sensitive() when freeing a SNP message descriptor
x86/sev: Rename sev_es_ghcb_handle_msr() to __vc_handle_msr()
x86/sev: Carve out the SVSM code into a separate compilation unit
x86/sev: Add internal header guards
x86/sev: Move the internal header
Diffstat (limited to 'arch/x86/include')
| -rw-r--r-- | arch/x86/include/asm/sev-internal.h | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/arch/x86/include/asm/sev-internal.h b/arch/x86/include/asm/sev-internal.h deleted file mode 100644 index c58c47c68ab6..000000000000 --- a/arch/x86/include/asm/sev-internal.h +++ /dev/null @@ -1,87 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#define DR7_RESET_VALUE 0x400 - -extern u64 sev_hv_features; -extern u64 sev_secrets_pa; - -/* #VC handler runtime per-CPU data */ -struct sev_es_runtime_data { - struct ghcb ghcb_page; - - /* - * Reserve one page per CPU as backup storage for the unencrypted GHCB. - * It is needed when an NMI happens while the #VC handler uses the real - * GHCB, and the NMI handler itself is causing another #VC exception. In - * that case the GHCB content of the first handler needs to be backed up - * and restored. - */ - struct ghcb backup_ghcb; - - /* - * Mark the per-cpu GHCBs as in-use to detect nested #VC exceptions. - * There is no need for it to be atomic, because nothing is written to - * the GHCB between the read and the write of ghcb_active. So it is safe - * to use it when a nested #VC exception happens before the write. - * - * This is necessary for example in the #VC->NMI->#VC case when the NMI - * happens while the first #VC handler uses the GHCB. When the NMI code - * raises a second #VC handler it might overwrite the contents of the - * GHCB written by the first handler. To avoid this the content of the - * GHCB is saved and restored when the GHCB is detected to be in use - * already. - */ - bool ghcb_active; - bool backup_ghcb_active; - - /* - * Cached DR7 value - write it on DR7 writes and return it on reads. - * That value will never make it to the real hardware DR7 as debugging - * is currently unsupported in SEV-ES guests. - */ - unsigned long dr7; -}; - -struct ghcb_state { - struct ghcb *ghcb; -}; - -extern struct svsm_ca boot_svsm_ca_page; - -struct ghcb *__sev_get_ghcb(struct ghcb_state *state); -void __sev_put_ghcb(struct ghcb_state *state); - -DECLARE_PER_CPU(struct sev_es_runtime_data*, runtime_data); -DECLARE_PER_CPU(struct sev_es_save_area *, sev_vmsa); - -void early_set_pages_state(unsigned long vaddr, unsigned long paddr, - unsigned long npages, const struct psc_desc *desc); - -DECLARE_PER_CPU(struct svsm_ca *, svsm_caa); -DECLARE_PER_CPU(u64, svsm_caa_pa); - -extern u64 boot_svsm_caa_pa; - -enum es_result verify_exception_info(struct ghcb *ghcb, struct es_em_ctxt *ctxt); -void vc_forward_exception(struct es_em_ctxt *ctxt); - -static inline u64 sev_es_rd_ghcb_msr(void) -{ - return native_rdmsrq(MSR_AMD64_SEV_ES_GHCB); -} - -static __always_inline void sev_es_wr_ghcb_msr(u64 val) -{ - u32 low, high; - - low = (u32)(val); - high = (u32)(val >> 32); - - native_wrmsr(MSR_AMD64_SEV_ES_GHCB, low, high); -} - -enum es_result sev_es_ghcb_handle_msr(struct ghcb *ghcb, struct es_em_ctxt *ctxt, bool write); - -u64 get_hv_features(void); - -const struct snp_cpuid_table *snp_cpuid_get_table(void); |
