Merge tag 'kvm-ppc-next-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / powerpc / kvm / book3s_64_mmu_hv.c
index a670fa5fbe5056ca7e8cd20e0973fc4c56e0e07f..7f3a8cf5d66f338197e84446f8a6685855fff9e2 100644 (file)
@@ -108,7 +108,7 @@ int kvmppc_allocate_hpt(struct kvm_hpt_info *info, u32 order)
        npte = 1ul << (order - 4);
 
        /* Allocate reverse map array */
-       rev = vmalloc(sizeof(struct revmap_entry) * npte);
+       rev = vmalloc(array_size(npte, sizeof(struct revmap_entry)));
        if (!rev) {
                if (cma)
                        kvm_free_hpt_cma(page, 1 << (order - PAGE_SHIFT));
@@ -272,6 +272,9 @@ int kvmppc_mmu_hv_init(void)
        if (!cpu_has_feature(CPU_FTR_HVMODE))
                return -EINVAL;
 
+       if (!mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE))
+               return -EINVAL;
+
        /* POWER7 has 10-bit LPIDs (12-bit in POWER8) */
        host_lpid = mfspr(SPRN_LPID);
        rsvd_lpid = LPID_RSVD;