KVM: PPC: e500: Add support for TLBnPS registers
[firefly-linux-kernel-4.4.55.git] / arch / powerpc / kvm / e500.h
index b73ca7a1c09f40be27c95920503ec63783e7b0f6..c2e5e98453a67e4609cf17007a74d20ed11fee2c 100644 (file)
 #include <asm/mmu-book3e.h>
 #include <asm/tlb.h>
 
+enum vcpu_ftr {
+       VCPU_FTR_MMU_V2
+};
+
 #define E500_PID_NUM   3
 #define E500_TLB_NUM   2
 
@@ -299,4 +303,18 @@ static inline unsigned int get_tlbmiss_tid(struct kvm_vcpu *vcpu)
 #define get_tlb_sts(gtlbe)              (MAS1_TS)
 #endif /* !BOOKE_HV */
 
+static inline bool has_feature(const struct kvm_vcpu *vcpu,
+                              enum vcpu_ftr ftr)
+{
+       bool has_ftr;
+       switch (ftr) {
+       case VCPU_FTR_MMU_V2:
+               has_ftr = ((vcpu->arch.mmucfg & MMUCFG_MAVN) == MMUCFG_MAVN_V2);
+               break;
+       default:
+               return false;
+       }
+       return has_ftr;
+}
+
 #endif /* KVM_E500_H */