KVM: PPC: Replace SPAPR_TCE_SHIFT with IOMMU_PAGE_SHIFT_4K
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 15 Feb 2016 01:55:07 +0000 (12:55 +1100)
committerPaul Mackerras <paulus@samba.org>
Tue, 16 Feb 2016 02:44:26 +0000 (13:44 +1100)
SPAPR_TCE_SHIFT is used in few places only and since IOMMU_PAGE_SHIFT_4K
can be easily used instead, remove SPAPR_TCE_SHIFT.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/include/asm/kvm_book3s_64.h
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/kvm/book3s_64_vio_hv.c

index 2aa79c864e91520ed563efd312c657f89696adc1..7529aab068f5968a8a093ba2ddb5f42e9ab5b61c 100644 (file)
@@ -33,8 +33,6 @@ static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
 }
 #endif
 
-#define SPAPR_TCE_SHIFT                12
-
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
 #define KVM_DEFAULT_HPT_ORDER  24      /* 16MB HPT by default */
 #endif
index 1a1e14f8572f98c8dcfb45ba75f6a1e63c5ea3c9..84993d151db3ed55fca174b37dfbdaeef16394c1 100644 (file)
 #include <asm/ppc-opcode.h>
 #include <asm/kvm_host.h>
 #include <asm/udbg.h>
+#include <asm/iommu.h>
 
 #define TCES_PER_PAGE  (PAGE_SIZE / sizeof(u64))
 
 static unsigned long kvmppc_tce_pages(unsigned long window_size)
 {
-       return ALIGN((window_size >> SPAPR_TCE_SHIFT)
+       return ALIGN((window_size >> IOMMU_PAGE_SHIFT_4K)
                     * sizeof(u64), PAGE_SIZE) / PAGE_SIZE;
 }
 
index 124d69246e1184a6dc6f2932bc84f30051f25515..0ce4ffb2df1236635686a455044523b3723aaa6d 100644 (file)
@@ -99,7 +99,7 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
        if (ret != H_SUCCESS)
                return ret;
 
-       idx = ioba >> SPAPR_TCE_SHIFT;
+       idx = ioba >> IOMMU_PAGE_SHIFT_4K;
        page = stt->pages[idx / TCES_PER_PAGE];
        tbl = (u64 *)page_address(page);
 
@@ -127,7 +127,7 @@ long kvmppc_h_get_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
        if (ret != H_SUCCESS)
                return ret;
 
-       idx = ioba >> SPAPR_TCE_SHIFT;
+       idx = ioba >> IOMMU_PAGE_SHIFT_4K;
        page = stt->pages[idx / TCES_PER_PAGE];
        tbl = (u64 *)page_address(page);