Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
[muen/linux.git] / arch / arm64 / include / asm / kvm_mmu.h
index 6128992c2ded6b7e1aa4ba835474f6f45f6fdc5e..fb9a7127bb752d6e627e873962cf39d6b1752687 100644 (file)
@@ -72,7 +72,6 @@
 #ifdef __ASSEMBLY__
 
 #include <asm/alternative.h>
-#include <asm/cpufeature.h>
 
 /*
  * Convert a kernel VA into a HYP VA.
@@ -473,6 +472,30 @@ static inline int kvm_map_vectors(void)
 }
 #endif
 
+#ifdef CONFIG_ARM64_SSBD
+DECLARE_PER_CPU_READ_MOSTLY(u64, arm64_ssbd_callback_required);
+
+static inline int hyp_map_aux_data(void)
+{
+       int cpu, err;
+
+       for_each_possible_cpu(cpu) {
+               u64 *ptr;
+
+               ptr = per_cpu_ptr(&arm64_ssbd_callback_required, cpu);
+               err = create_hyp_mappings(ptr, ptr + 1, PAGE_HYP);
+               if (err)
+                       return err;
+       }
+       return 0;
+}
+#else
+static inline int hyp_map_aux_data(void)
+{
+       return 0;
+}
+#endif
+
 #define kvm_phys_to_vttbr(addr)                phys_to_ttbr(addr)
 
 #endif /* __ASSEMBLY__ */