From 5022d5f86d02882a11700825258ecdba8dee683c Mon Sep 17 00:00:00 2001 Message-Id: <5022d5f86d02882a11700825258ecdba8dee683c.1566225007.git.aquini@redhat.com> In-Reply-To: References: From: Sandipan Das 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 Signed-off-by: Eric B Munson Signed-off-by: Rafael Aquini --- 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