libhugetlbfs/SOURCES/0014-elflink-powerpc64-Use-slices-based-on-MMU-type.patch
2021-09-09 20:20:27 +00:00

65 lines
2.1 KiB
Diff

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