Skip to content

Commit 54fc3c6

Browse files
aikmpe
authored andcommitted
powerpc/pseries/ddw: Extend upper limit for huge DMA window for persistent memory
Unlike normal memory ("memory" compatible type in the FDT), the persistent memory ("ibm,pmemory" in the FDT) can be mapped anywhere in the guest physical space and it can be used for DMA. In order to maintain 1:1 mapping via the huge DMA window, we need to know the maximum physical address at the time of the window setup. So far we've been looking at "memory" nodes but "ibm,pmemory" does not have fixed addresses and the persistent memory may be mapped afterwards. Since the persistent memory is still backed with page structs, use MAX_PHYSMEM_BITS as the upper limit. This effectively disables huge DMA window in LPAR under pHyp if persistent memory is present but this is the best we can do for the moment. Signed-off-by: Alexey Kardashevskiy <[email protected]> Tested-by: Wen Xiong<[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7c0eda1 commit 54fc3c6

File tree

1 file changed

+9
-0
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+9
-0
lines changed

arch/powerpc/platforms/pseries/iommu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,15 @@ static phys_addr_t ddw_memory_hotplug_max(void)
945945
phys_addr_t max_addr = memory_hotplug_max();
946946
struct device_node *memory;
947947

948+
/*
949+
* The "ibm,pmemory" can appear anywhere in the address space.
950+
* Assuming it is still backed by page structs, set the upper limit
951+
* for the huge DMA window as MAX_PHYSMEM_BITS.
952+
*/
953+
if (of_find_node_by_type(NULL, "ibm,pmemory"))
954+
return (sizeof(phys_addr_t) * 8 <= MAX_PHYSMEM_BITS) ?
955+
(phys_addr_t) -1 : (1ULL << MAX_PHYSMEM_BITS);
956+
948957
for_each_node_by_type(memory, "memory") {
949958
unsigned long start, size;
950959
int n_mem_addr_cells, n_mem_size_cells, len;

0 commit comments

Comments
 (0)