Skip to content

Commit acbc87a

Browse files
committed
powerpc/ioda: Set "read" permission when "write" is set
jira LE-1907 Rebuild_History Non-Buildable kernel-3.10.0-514.el7 Rebuild_CHGLOG: - [powerpc] ioda: Set "read" permission when "write" is set (Gustavo Duarte) [1297885] Rebuild_FUZZ: 92.16% commit-author Alexey Kardashevskiy <[email protected]> commit 6ecad91 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]> (cherry picked from commit 6ecad91) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 9d4161e commit acbc87a

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
@@ -610,6 +610,9 @@ int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
610610
u64 rpn = __pa(uaddr) >> tbl->it_page_shift;
611611
long i;
612612

613+
if (proto_tce & TCE_PCI_WRITE)
614+
proto_tce |= TCE_PCI_READ;
615+
613616
for (i = 0; i < npages; i++) {
614617
unsigned long newtce = proto_tce |
615618
((rpn + i) << tbl->it_page_shift);
@@ -631,6 +634,9 @@ int pnv_tce_xchg(struct iommu_table *tbl, long index,
631634

632635
BUG_ON(*hpa & ~IOMMU_PAGE_MASK(tbl));
633636

637+
if (newtce & TCE_PCI_WRITE)
638+
newtce |= TCE_PCI_READ;
639+
634640
oldtce = xchg(pnv_tce(tbl, idx), cpu_to_be64(newtce));
635641
*hpa = be64_to_cpu(oldtce) & ~(TCE_PCI_READ | TCE_PCI_WRITE);
636642
*direction = iommu_tce_direction(oldtce);

0 commit comments

Comments
 (0)