Merge tag 'kvm-4.20-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[platform/kernel/linux-starfive.git] / arch / arm64 / include / asm / cpufeature.h
index 6db48d9..7e2ec64 100644 (file)
@@ -537,6 +537,27 @@ static inline void arm64_set_ssbd_mitigation(bool state) {}
 #endif
 
 extern int do_emulate_mrs(struct pt_regs *regs, u32 sys_reg, u32 rt);
+
+static inline u32 id_aa64mmfr0_parange_to_phys_shift(int parange)
+{
+       switch (parange) {
+       case 0: return 32;
+       case 1: return 36;
+       case 2: return 40;
+       case 3: return 42;
+       case 4: return 44;
+       case 5: return 48;
+       case 6: return 52;
+       /*
+        * A future PE could use a value unknown to the kernel.
+        * However, by the "D10.1.4 Principles of the ID scheme
+        * for fields in ID registers", ARM DDI 0487C.a, any new
+        * value is guaranteed to be higher than what we know already.
+        * As a safe limit, we return the limit supported by the kernel.
+        */
+       default: return CONFIG_ARM64_PA_BITS;
+       }
+}
 #endif /* __ASSEMBLY__ */
 
 #endif