Skip to content

Commit

Permalink
x86/boot/compressed/64: Introduce sev_status
Browse files Browse the repository at this point in the history
Introduce sev_status and initialize it together with sme_me_mask to have
an indicator which SEV features are enabled.

Signed-off-by: Joerg Roedel <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Reviewed-by: Tom Lendacky <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
joergroedel authored and suryasaimadhu committed Oct 29, 2020
1 parent 3650b22 commit 3ad8424
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion arch/x86/boot/compressed/mem_encrypt.S
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ SYM_FUNC_START(set_sev_encryption_mask)

bts %rax, sme_me_mask(%rip) /* Create the encryption mask */

/*
* Read MSR_AMD64_SEV again and store it to sev_status. Can't do this in
* get_sev_encryption_bit() because this function is 32-bit code and
* shared between 64-bit and 32-bit boot path.
*/
movl $MSR_AMD64_SEV, %ecx /* Read the SEV MSR */
rdmsr

/* Store MSR value in sev_status */
shlq $32, %rdx
orq %rdx, %rax
movq %rax, sev_status(%rip)

.Lno_sev_mask:
movq %rbp, %rsp /* Restore original stack pointer */

Expand All @@ -96,5 +109,6 @@ SYM_FUNC_END(set_sev_encryption_mask)

#ifdef CONFIG_AMD_MEM_ENCRYPT
.balign 8
SYM_DATA(sme_me_mask, .quad 0)
SYM_DATA(sme_me_mask, .quad 0)
SYM_DATA(sev_status, .quad 0)
#endif

0 comments on commit 3ad8424

Please sign in to comment.