Skip to content

Commit

Permalink
x86/boot/compressed: Adhere to calling convention in get_sev_encrypti…
Browse files Browse the repository at this point in the history
…on_bit()

Make get_sev_encryption_bit() follow the ordinary i386 calling
convention, and only call it if CONFIG_AMD_MEM_ENCRYPT is actually
enabled. This clarifies the calling code, and makes it more
maintainable.

Signed-off-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
ardbiesheuvel authored and suryasaimadhu committed Nov 24, 2022
1 parent 9d7eaae commit 30c9ca1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
5 changes: 3 additions & 2 deletions arch/x86/boot/compressed/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,13 @@ SYM_FUNC_START(startup_32)
*/
/*
* If SEV is active then set the encryption mask in the page tables.
* This will insure that when the kernel is copied and decompressed
* This will ensure that when the kernel is copied and decompressed
* it will be done so encrypted.
*/
call get_sev_encryption_bit
xorl %edx, %edx
#ifdef CONFIG_AMD_MEM_ENCRYPT
call get_sev_encryption_bit
xorl %edx, %edx
testl %eax, %eax
jz 1f
subl $32, %eax /* Encryption bit is always above bit 31 */
Expand Down
10 changes: 0 additions & 10 deletions arch/x86/boot/compressed/mem_encrypt.S
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
.text
.code32
SYM_FUNC_START(get_sev_encryption_bit)
xor %eax, %eax

#ifdef CONFIG_AMD_MEM_ENCRYPT
push %ebx
push %ecx
push %edx

movl $0x80000000, %eax /* CPUID to check the highest leaf */
cpuid
Expand Down Expand Up @@ -54,12 +49,7 @@ SYM_FUNC_START(get_sev_encryption_bit)
xor %eax, %eax

.Lsev_exit:
pop %edx
pop %ecx
pop %ebx

#endif /* CONFIG_AMD_MEM_ENCRYPT */

RET
SYM_FUNC_END(get_sev_encryption_bit)

Expand Down

0 comments on commit 30c9ca1

Please sign in to comment.