]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/arm64/include/asm/efi.h
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / arch / arm64 / include / asm / efi.h
index 771b3f0bc7570bbd05f6a9538935428822dee5d7..e7445281e5342bcd248cd9ab684b2747a52bd080 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_EFI_H
 #define _ASM_EFI_H
 
+#include <asm/cpufeature.h>
 #include <asm/io.h>
 #include <asm/mmu_context.h>
 #include <asm/neon.h>
@@ -49,6 +50,7 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
 
 #define efi_call_early(f, ...)         sys_table_arg->boottime->f(__VA_ARGS__)
 #define __efi_call_early(f, ...)       f(__VA_ARGS__)
+#define efi_call_runtime(f, ...)       sys_table_arg->runtime->f(__VA_ARGS__)
 #define efi_is_64bit()                 (true)
 
 #define efi_call_proto(protocol, f, instance, ...)                     \
@@ -78,7 +80,30 @@ static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
 
 static inline void efi_set_pgd(struct mm_struct *mm)
 {
-       switch_mm(NULL, mm, NULL);
+       __switch_mm(mm);
+
+       if (system_uses_ttbr0_pan()) {
+               if (mm != current->active_mm) {
+                       /*
+                        * Update the current thread's saved ttbr0 since it is
+                        * restored as part of a return from exception. Set
+                        * the hardware TTBR0_EL1 using cpu_switch_mm()
+                        * directly to enable potential errata workarounds.
+                        */
+                       update_saved_ttbr0(current, mm);
+                       cpu_switch_mm(mm->pgd, mm);
+               } else {
+                       /*
+                        * Defer the switch to the current thread's TTBR0_EL1
+                        * until uaccess_enable(). Restore the current
+                        * thread's saved ttbr0 corresponding to its active_mm
+                        * (if different from init_mm).
+                        */
+                       cpu_set_reserved_ttbr0();
+                       if (current->active_mm != &init_mm)
+                               update_saved_ttbr0(current, current->active_mm);
+               }
+       }
 }
 
 void efi_virtmap_load(void);