Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc32057e authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Benjamin Herrenschmidt
Browse files

powerpc/powernv: Use it_page_shift in TCE build



This makes use of iommu_table::it_page_shift instead of TCE_SHIFT and
TCE_RPN_SHIFT hardcoded values.

Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent b0376c9b
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -564,10 +564,11 @@ static int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
		proto_tce |= TCE_PCI_WRITE;
		proto_tce |= TCE_PCI_WRITE;


	tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset;
	tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset;
	rpn = __pa(uaddr) >> TCE_SHIFT;
	rpn = __pa(uaddr) >> tbl->it_page_shift;


	while (npages--)
	while (npages--)
		*(tcep++) = cpu_to_be64(proto_tce | (rpn++ << TCE_RPN_SHIFT));
		*(tcep++) = cpu_to_be64(proto_tce |
				(rpn++ << tbl->it_page_shift));


	/* Some implementations won't cache invalid TCEs and thus may not
	/* Some implementations won't cache invalid TCEs and thus may not
	 * need that flush. We'll probably turn it_type into a bit mask
	 * need that flush. We'll probably turn it_type into a bit mask