diff mbox series

[2/2] powerpc/mm/book3s64: Use 256M as the upper limit with coherent device memory attached

Message ID 20230828074658.59553-2-aneesh.kumar@linux.ibm.com (mailing list archive)
State Accepted
Commit 4c33bf147249ebbf3dded016996a8a24c5737254
Headers show
Series [1/2] powerpc/mm/book3s64: Fix build error with SPARSEMEM disabled | expand

Commit Message

Aneesh Kumar K V Aug. 28, 2023, 7:46 a.m. UTC
commit 4d15721177d5 ("powerpc/mm: Cleanup memory block size probing")
used 256MB as the memory block size when we have
ibm,coherent-device-memory device tree node present. Instead of
returning with 256MB memory block size, continue to check the rest of the memory
regions and make sure we can still map them using a 256MB memory block size.

Fixes: 4d15721177d5 ("powerpc/mm: Cleanup memory block size probing")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/mm/init_64.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index e3d7379ef480..a8557867ece0 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -569,8 +569,12 @@  static int __init probe_memory_block_size(unsigned long node, const char *uname,
 		 */
 		compatible = of_get_flat_dt_prop(node, "compatible", NULL);
 		if (compatible && !strcmp(compatible, "ibm,coherent-device-memory")) {
-			*block_size = SZ_256M;
-			return 1;
+			if (*block_size > SZ_256M)
+				*block_size = SZ_256M;
+			/*
+			 * We keep 256M as the upper limit with GPU present.
+			 */
+			return 0;
 		}
 	}
 	/* continue looking for other memory device types */