]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/boot/compressed: Adhere to calling convention in get_sev_encryption_bit()
authorArd Biesheuvel <ardb@kernel.org>
Tue, 22 Nov 2022 16:10:15 +0000 (17:10 +0100)
committerBorislav Petkov <bp@suse.de>
Thu, 24 Nov 2022 07:57:41 +0000 (08:57 +0100)
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 <ardb@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221122161017.2426828-16-ardb@kernel.org
arch/x86/boot/compressed/head_64.S
arch/x86/boot/compressed/mem_encrypt.S

index db577fb26fa323693c20f88b326ca517190d9974..6ba2c2142c33bcda4520c5588cdce193c6933d11 100644 (file)
@@ -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 */
index 14cf04a1ed091655fcb5ba457dfe7b1f79951e76..e69674588a31c81f4ff1f78914e44299250b062f 100644 (file)
        .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
@@ -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)