Skip to contentSkip to conversation

powerpc/powernv/ioda2: Reduce upper limit for DMA window size (retry)

PATCH Applied Alexey Kardashevskiy 2 participants 2 messages Sep 11, 2018 – Sep 21, 2018 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/powernv/ioda2: Reduce upper limit for DMA window size (retry)

We use PHB in mode1 which uses bit 59 to select a correct DMA window. However there is mode2 which uses bits 59:55 and allows up to 32 DMA windows per a PE.

Even though documentation does not clearly specify that, it seems that the actual hardware does not support bits 59:55 even in mode1, in other words we can create a window as big as 1<<58 but DMA simply won't work.

This reduces the upper limit from 59 to 55 bits to let the userspace know about the hardware limits.

Fixes ce57c6610cc2 "Merge branch 'topic/ppc-kvm' into next"

---

The merge commit says d3d4ffaae439 (the original of this one) was propagated but it was not:

[vpl1 kernel]$ git s ce57c6610cc2:arch/powerpc/platforms/powernv/pci-ioda-tce.c | grep 'page_shift >= '

        if ((level_shift - 3) * levels + page_shift >= 60)
---
 arch/powerpc/platforms/powernv/pci-ioda-tce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/pci-ioda-tce.c +1 -1
index 6c5db1a..fe96910 100644
@@ -276,7 +276,7 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset,
 	level_shift = entries_shift + 3;
 	level_shift = max_t(unsigned int, level_shift, PAGE_SHIFT);
 
-	if ((level_shift - 3) * levels + page_shift >= 60)
+	if ((level_shift - 3) * levels + page_shift >= 55)
 		return -EINVAL;
 
 	/* Allocate TCE table */
Signature · 1 line
2.11.0
#1 lore raw
Quoted 8 lines · Alexey Kardashevskiy

We use PHB in mode1 which uses bit 59 to select a correct DMA window. However there is mode2 which uses bits 59:55 and allows up to 32 DMA windows per a PE.

Even though documentation does not clearly specify that, it seems that the actual hardware does not support bits 59:55 even in mode1, in other words we can create a window as big as 1<<58 but DMA simply won't work.

Quoted 5 lines

This reduces the upper limit from 59 to 55 bits to let the userspace know about the hardware limits.

Fixes ce57c6610cc2 "Merge branch 'topic/ppc-kvm' into next"

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/7233b8cab39014620ac9534da11f0f

cheers