Skip to content

Commit 462ee11

Browse files
aikpaulusmack
authored andcommitted
KVM: PPC: Replace SPAPR_TCE_SHIFT with IOMMU_PAGE_SHIFT_4K
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>
1 parent f862698 commit 462ee11

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎arch/powerpc/include/asm/kvm_book3s_64.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
3333
}
3434
#endif
3535

36-
#define SPAPR_TCE_SHIFT 12
37-
3836
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
3937
#define KVM_DEFAULT_HPT_ORDER 24 /* 16MB HPT by default */
4038
#endif

‎arch/powerpc/kvm/book3s_64_vio.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@
3636
#include <asm/ppc-opcode.h>
3737
#include <asm/kvm_host.h>
3838
#include <asm/udbg.h>
39+
#include <asm/iommu.h>
3940

4041
#define TCES_PER_PAGE (PAGE_SIZE / sizeof(u64))
4142

4243
static unsigned long kvmppc_tce_pages(unsigned long window_size)
4344
{
44-
return ALIGN((window_size >> SPAPR_TCE_SHIFT)
45+
return ALIGN((window_size >> IOMMU_PAGE_SHIFT_4K)
4546
* sizeof(u64), PAGE_SIZE) / PAGE_SIZE;
4647
}
4748

‎arch/powerpc/kvm/book3s_64_vio_hv.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
9999
if (ret != H_SUCCESS)
100100
return ret;
101101

102-
idx = ioba >> SPAPR_TCE_SHIFT;
102+
idx = ioba >> IOMMU_PAGE_SHIFT_4K;
103103
page = stt->pages[idx / TCES_PER_PAGE];
104104
tbl = (u64 *)page_address(page);
105105

@@ -127,7 +127,7 @@ long kvmppc_h_get_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
127127
if (ret != H_SUCCESS)
128128
return ret;
129129

130-
idx = ioba >> SPAPR_TCE_SHIFT;
130+
idx = ioba >> IOMMU_PAGE_SHIFT_4K;
131131
page = stt->pages[idx / TCES_PER_PAGE];
132132
tbl = (u64 *)page_address(page);
133133

0 commit comments

Comments
 (0)