Blame SOURCES/0014-elflink-powerpc64-Use-slices-based-on-MMU-type.patch

fc9b0e
From 5022d5f86d02882a11700825258ecdba8dee683c Mon Sep 17 00:00:00 2001
fc9b0e
Message-Id: <5022d5f86d02882a11700825258ecdba8dee683c.1566225007.git.aquini@redhat.com>
fc9b0e
In-Reply-To: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
fc9b0e
References: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
fc9b0e
From: Sandipan Das <sandipan@linux.ibm.com>
fc9b0e
Date: Wed, 12 Jun 2019 12:34:31 +0530
fc9b0e
Subject: [RHEL7 PATCH 14/31] elflink: powerpc64: Use slices based on MMU type
fc9b0e
fc9b0e
For powerpc64, the concept of slices is not applicable to the
fc9b0e
recently introduced Radix MMU. So, slice boundaries should be
fc9b0e
calculated based on the MMU type.
fc9b0e
fc9b0e
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
fc9b0e
Signed-off-by: Eric B Munson <emunson@mgebm.net>
fc9b0e
Signed-off-by: Rafael Aquini <aquini@redhat.com>
fc9b0e
---
fc9b0e
 elflink.c | 12 ++++++++----
fc9b0e
 1 file changed, 8 insertions(+), 4 deletions(-)
fc9b0e
fc9b0e
diff --git a/elflink.c b/elflink.c
fc9b0e
index 1150bde..a6bd44c 100644
fc9b0e
--- a/elflink.c
fc9b0e
+++ b/elflink.c
fc9b0e
@@ -569,6 +569,10 @@ bail2:
fc9b0e
  */
fc9b0e
 static unsigned long hugetlb_slice_start(unsigned long addr)
fc9b0e
 {
fc9b0e
+	if (!arch_has_slice_support()) {
fc9b0e
+		return ALIGN_DOWN(addr, gethugepagesize());
fc9b0e
+	}
fc9b0e
+
fc9b0e
 #if defined(__powerpc64__)
fc9b0e
 	if (addr < SLICE_LOW_TOP)
fc9b0e
 		return ALIGN_DOWN(addr, SLICE_LOW_SIZE);
fc9b0e
@@ -578,13 +582,15 @@ static unsigned long hugetlb_slice_start(unsigned long addr)
fc9b0e
 		return ALIGN_DOWN(addr, SLICE_HIGH_SIZE);
fc9b0e
 #elif defined(__powerpc__) && !defined(PPC_NO_SEGMENTS)
fc9b0e
 	return ALIGN_DOWN(addr, SLICE_LOW_SIZE);
fc9b0e
-#else
fc9b0e
-	return ALIGN_DOWN(addr, gethugepagesize());
fc9b0e
 #endif
fc9b0e
 }
fc9b0e
 
fc9b0e
 static unsigned long hugetlb_slice_end(unsigned long addr)
fc9b0e
 {
fc9b0e
+	if (!arch_has_slice_support()) {
fc9b0e
+		return ALIGN_UP(addr, gethugepagesize()) - 1;
fc9b0e
+	}
fc9b0e
+
fc9b0e
 #if defined(__powerpc64__)
fc9b0e
 	if (addr < SLICE_LOW_TOP)
fc9b0e
 		return ALIGN_UP(addr, SLICE_LOW_SIZE) - 1;
fc9b0e
@@ -592,8 +598,6 @@ static unsigned long hugetlb_slice_end(unsigned long addr)
fc9b0e
 		return ALIGN_UP(addr, SLICE_HIGH_SIZE) - 1;
fc9b0e
 #elif defined(__powerpc__) && !defined(PPC_NO_SEGMENTS)
fc9b0e
 	return ALIGN_UP(addr, SLICE_LOW_SIZE) - 1;
fc9b0e
-#else
fc9b0e
-	return ALIGN_UP(addr, gethugepagesize()) - 1;
fc9b0e
 #endif
fc9b0e
 }
fc9b0e
 
fc9b0e
-- 
fc9b0e
1.8.3.1
fc9b0e