Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
[GitHub/exynos8895/android_kernel_samsung_universal8895.git] / arch / arm64 / include / asm / proc-fns.h
index 4d9ede7b6361cffb359f09fcdf5a456d44834341..220633b791b819b3346d36d0ff0a959c4dfbef02 100644 (file)
@@ -39,7 +39,11 @@ extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr);
 
 #include <asm/memory.h>
 
-#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
+#define cpu_switch_mm(pgd,mm)                          \
+do {                                                   \
+       BUG_ON(pgd == swapper_pg_dir);                  \
+       cpu_do_switch_mm(virt_to_phys(pgd),mm);         \
+} while (0)
 
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */