Skip to content

Commit ad39760

Browse files
aikmpe
authored andcommitted
powerpc/pseries/ddw: Do not try direct mapping with persistent memory and one window
There is a possibility of having just one DMA window available with a limited capacity which the existing code does not handle that well. If the window is big enough for the system RAM but less than MAX_PHYSMEM_BITS (which we want when persistent memory is present), we create 1:1 window and leave persistent memory without DMA. This disables 1:1 mapping entirely if there is persistent memory and either: - the huge DMA window does not cover the entire address space; - the default DMA window is removed. This relies on reverted 54fc3c6 ("powerpc/pseries/ddw: Extend upper limit for huge DMA window for persistent memory") to return the actual amount RAM in ddw_memory_hotplug_max() (posted separately). Signed-off-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fb4ee2b commit ad39760

File tree

1 file changed

+4
-2
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+4
-2
lines changed

arch/powerpc/platforms/pseries/iommu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,10 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
13561356
len = order_base_2(query.largest_available_block << page_shift);
13571357
win_name = DMA64_PROPNAME;
13581358
} else {
1359-
direct_mapping = true;
1360-
win_name = DIRECT64_PROPNAME;
1359+
direct_mapping = !default_win_removed ||
1360+
(len == MAX_PHYSMEM_BITS) ||
1361+
(!pmem_present && (len == max_ram_len));
1362+
win_name = direct_mapping ? DIRECT64_PROPNAME : DMA64_PROPNAME;
13611363
}
13621364

13631365
ret = create_ddw(dev, ddw_avail, &create, page_shift, len);

0 commit comments

Comments
 (0)