Skip to content

Commit 6ecad91

Browse files
aikmpe
authored andcommitted
powerpc/ioda: Set "read" permission when "write" is set
Quite often drivers set only "write" permission assuming that this includes "read" permission as well and this works on plenty of platforms. However IODA2 is strict about this and produces an EEH when "read" permission is not set and reading happens. This adds a workaround in the IODA code to always add the "read" bit when the "write" bit is set. Fixes: 10b35b2 ("powerpc/powernv: Do not set "read" flag if direction==DMA_NONE") Cc: [email protected] # 4.2+ Cc: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Alexey Kardashevskiy <[email protected]> Tested-by: Douglas Miller <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent c777e2a commit 6ecad91

File tree

1 file changed

+6
-0
lines changed
  • arch/powerpc/platforms/powernv

1 file changed

+6
-0
lines changed

arch/powerpc/platforms/powernv/pci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,9 @@ int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
599599
u64 rpn = __pa(uaddr) >> tbl->it_page_shift;
600600
long i;
601601

602+
if (proto_tce & TCE_PCI_WRITE)
603+
proto_tce |= TCE_PCI_READ;
604+
602605
for (i = 0; i < npages; i++) {
603606
unsigned long newtce = proto_tce |
604607
((rpn + i) << tbl->it_page_shift);
@@ -620,6 +623,9 @@ int pnv_tce_xchg(struct iommu_table *tbl, long index,
620623

621624
BUG_ON(*hpa & ~IOMMU_PAGE_MASK(tbl));
622625

626+
if (newtce & TCE_PCI_WRITE)
627+
newtce |= TCE_PCI_READ;
628+
623629
oldtce = xchg(pnv_tce(tbl, idx), cpu_to_be64(newtce));
624630
*hpa = be64_to_cpu(oldtce) & ~(TCE_PCI_READ | TCE_PCI_WRITE);
625631
*direction = iommu_tce_direction(oldtce);

0 commit comments

Comments
 (0)