diff options
author | Brijesh Singh <brijesh.singh@amd.com> | 2022-02-24 19:56:01 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2022-04-06 14:24:53 +0300 |
commit | dc3f3d2474b80eaee8be89f4c5eb344f10648f42 (patch) | |
tree | 2c72a1701916d2288f5703f123a0f83c2761bc8f /arch/x86/include/asm/sev-common.h | |
parent | 9704c07bf9f7682a83aec4e66f2d9154dbd8577f (diff) | |
download | linux-dc3f3d2474b80eaee8be89f4c5eb344f10648f42.tar.xz |
x86/mm: Validate memory when changing the C-bit
Add the needed functionality to change pages state from shared
to private and vice-versa using the Page State Change VMGEXIT as
documented in the GHCB spec.
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220307213356.2797205-22-brijesh.singh@amd.com
Diffstat (limited to 'arch/x86/include/asm/sev-common.h')
-rw-r--r-- | arch/x86/include/asm/sev-common.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h index f077a6c95e67..1aa72b5c2490 100644 --- a/arch/x86/include/asm/sev-common.h +++ b/arch/x86/include/asm/sev-common.h @@ -105,6 +105,28 @@ enum psc_op { #define GHCB_HV_FT_SNP BIT_ULL(0) +/* SNP Page State Change NAE event */ +#define VMGEXIT_PSC_MAX_ENTRY 253 + +struct psc_hdr { + u16 cur_entry; + u16 end_entry; + u32 reserved; +} __packed; + +struct psc_entry { + u64 cur_page : 12, + gfn : 40, + operation : 4, + pagesize : 1, + reserved : 7; +} __packed; + +struct snp_psc_desc { + struct psc_hdr hdr; + struct psc_entry entries[VMGEXIT_PSC_MAX_ENTRY]; +} __packed; + #define GHCB_MSR_TERM_REQ 0x100 #define GHCB_MSR_TERM_REASON_SET_POS 12 #define GHCB_MSR_TERM_REASON_SET_MASK 0xf |