Re: [RFC Part1 PATCH 09/13] x86/kernel: add support to validate memory in early enc attribute change

2021-04-08 Thread Brijesh Singh
On 4/8/21 6:40 AM, Borislav Petkov wrote: > On Wed, Mar 24, 2021 at 11:44:20AM -0500, Brijesh Singh wrote: >> @@ -63,6 +63,10 @@ struct __packed snp_page_state_change { >> #define GHCB_REGISTER_GPA_RESP 0x013UL >> #define GHCB_REGISTER_GPA_RESP_VAL(val) ((val) >> 12) >>

Re: [RFC Part1 PATCH 09/13] x86/kernel: add support to validate memory in early enc attribute change

2021-04-08 Thread Borislav Petkov
On Wed, Mar 24, 2021 at 11:44:20AM -0500, Brijesh Singh wrote: > @@ -63,6 +63,10 @@ struct __packed snp_page_state_change { > #define GHCB_REGISTER_GPA_RESP 0x013UL > #define GHCB_REGISTER_GPA_RESP_VAL(val) ((val) >> 12) > > +/* Macro to convert the x86 page level to

[RFC Part1 PATCH 09/13] x86/kernel: add support to validate memory in early enc attribute change

2021-03-24 Thread Brijesh Singh
The early_set_memory_{encrypt,decrypt}() are used for changing the page from decrypted (shared) to encrypted (private) and vice versa. When SEV-SNP is active, the page state transition needs to go through additional steps. If the page is transitioned from shared to private, then perform the follow