Currently, the efi_thunk macro has some semi-duplicated code in it that
can be replaced with the arch_efi_call_virt_setup/teardown macros. This
commit simply replaces the duplicated code with those macros.

Signed-off-by: Alex Thorlton <[email protected]>
Suggested-by: Matt Fleming <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Dimitri Sivanich <[email protected]>
Cc: Russell King <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Roy Franz <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
 arch/x86/platform/efi/efi_64.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 6e7242b..4cc2b96 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -469,18 +469,13 @@ extern efi_status_t efi64_thunk(u32, ...);
        unsigned long flags;                                            \
        u32 func;                                                       \
                                                                        \
-       efi_sync_low_kernel_mappings();                                 \
        local_irq_save(flags);                                          \
-                                                                       \
-       efi_scratch.prev_cr3 = read_cr3();                              \
-       write_cr3((unsigned long)efi_scratch.efi_pgt);                  \
-       __flush_tlb_all();                                              \
+       arch_efi_call_virt_setup();                                     \
                                                                        \
        func = runtime_service32(f);                                    \
-       __s = efi64_thunk(func, __VA_ARGS__);                   \
+       __s = efi64_thunk(func, __VA_ARGS__);                           \
                                                                        \
-       write_cr3(efi_scratch.prev_cr3);                                \
-       __flush_tlb_all();                                              \
+       arch_efi_call_virt_teardown();                                  \
        local_irq_restore(flags);                                       \
                                                                        \
        __s;                                                            \
-- 
1.8.5.6

Reply via email to