Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1874715ybv; Thu, 6 Feb 2020 11:23:09 -0800 (PST) X-Google-Smtp-Source: APXvYqyrYV5TuxeY+GnoCvcCN3Jpsq0dKc03FY/thmSZhvoI4MPi1TK8GmUtHIJTdAgMd8x2KDom X-Received: by 2002:aca:b1d5:: with SMTP id a204mr7901299oif.82.1581016989273; Thu, 06 Feb 2020 11:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581016989; cv=none; d=google.com; s=arc-20160816; b=1HYBRcFudadKl/6fBULhL+ThyAl6ho7FzCHqLldzW3n5UsNouas4RQF8DQWtK57aPy nxPbAONQL5faxTRS0+MpabKtfVEDI7fMbPSk1niuqC5K5+e5hBn6dqu2BUO08VQ4Z3DB CGd/0f6JQ9DoJBr+OLpwtHqdtonrAP13Wfzo4egIBS6yOOPcHj8dpXamDgSe3pxKQv1K JeJe4PFh16dFid4mM+aGW+fXUQ8Waj5E72Yi959EaRTQxhk28596DMgl4JB9mAilzhg1 tIyxMFJm0AowY75sI1DXYMXeNP7wfdzUgIR7+m3SGsnt9kbs9QjTiAXw3epP1NPZGVM3 Qxdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id :dkim-signature; bh=VG0VhbYQuAfDWPMKE2lgKw3iWBAVfeVCbcPDNU4BlEI=; b=I+E0nlEf+Mt+dzaN2n8t/+M4FV06c7kCuJ3h8rqeoLmTUxmCZ46BGum1sEMIoW6jLJ INaOSn3GIUB6MaofAQO5tA5VYU9BGsxJelKXPWaZiHkCXdR/NuqYSdd8aTBN9uTwf3Dl hb5sAzaJm436dvfVYXB4sGOYTIIS0VGLjMnzaMe8nD8mSINH2/ZrV5vwmH1iDp5tsshF ULdOGr+/4EUw0NTDuVvEfbvJBj/4JB1ZDw4mSICoXPAJ9pYgQM8A2uwKWmwWm+LwTRNC eUCKgs/TR3K1AKI2dzgGbDzeswda4Evp9thwnDORm+H1S0T1BH1PR+dZxD3sxnZgMa54 PjAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=eA4qP6F2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si278132otr.207.2020.02.06.11.22.57; Thu, 06 Feb 2020 11:23:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=eA4qP6F2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727942AbgBFTV5 (ORCPT + 99 others); Thu, 6 Feb 2020 14:21:57 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:59045 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbgBFTV4 (ORCPT ); Thu, 6 Feb 2020 14:21:56 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48D7bQ5yPCz9tx2j; Thu, 6 Feb 2020 20:21:54 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=eA4qP6F2; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id u5YvdLrNcwVZ; Thu, 6 Feb 2020 20:21:54 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48D7bQ4jTfz9tx2C; Thu, 6 Feb 2020 20:21:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1581016914; bh=VG0VhbYQuAfDWPMKE2lgKw3iWBAVfeVCbcPDNU4BlEI=; h=From:Subject:To:Cc:Date:From; b=eA4qP6F2wWlut4SdtEbtcfqFej9EqeeBWdsc72/wVjvWZcKaCmQse844duitNqbUq imPPpXQSb1F9yqThuSQAGXz2jRlKuUgIO+wiukY4NQQop6OyFhXvrm7LbgeryvhSSl 38HKVqhZB/ORZQKZyk4VFlELXDU5waQ+5mGEfj8M= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CEBC38B8A5; Thu, 6 Feb 2020 20:21:54 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id M2OH8G-5PC74; Thu, 6 Feb 2020 20:21:54 +0100 (CET) Received: from pc16570vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 92D238B8A4; Thu, 6 Feb 2020 20:21:54 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 2B7EA652B0; Thu, 6 Feb 2020 19:21:54 +0000 (UTC) Message-Id: <4ad03047ac61bfbdad3edb92542dedc807fc3cf4.1581011735.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH 1/2] powerpc/8xx: Merge 8M hugepage slice and basepage slice To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , aneesh.kumar@linux.ibm.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 6 Feb 2020 19:21:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8xx, slices are used because hugepages (512k or 8M) and small pages (4k or 16k) cannot share the same PGD entry. However, as 8M entirely covers two PGD entries (One PGD entry covers 4M), there will implicitely be no conflict between 8M pages and any other size. So 8M is compatible with the basepage size as well. Remove the struct slice_mask mask_8m from mm_context_t and make vma_mmu_pagesize() rely on vma_kernel_pagesize() as the base slice can now host several sizes. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 7 ++----- arch/powerpc/mm/hugetlbpage.c | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h index 76af5b0cb16e..54f7f3362edb 100644 --- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h +++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h @@ -215,9 +215,8 @@ typedef struct { unsigned char low_slices_psize[SLICE_ARRAY_SIZE]; unsigned char high_slices_psize[0]; unsigned long slb_addr_limit; - struct slice_mask mask_base_psize; /* 4k or 16k */ + struct slice_mask mask_base_psize; /* 4k or 16k or 8M */ struct slice_mask mask_512k; - struct slice_mask mask_8m; #endif void *pte_frag; } mm_context_t; @@ -257,10 +256,8 @@ static inline struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psiz { if (psize == MMU_PAGE_512K) return &ctx->mask_512k; - if (psize == MMU_PAGE_8M) - return &ctx->mask_8m; - BUG_ON(psize != mmu_virtual_psize); + BUG_ON(psize != mmu_virtual_psize && psize != MMU_PAGE_8M); return &ctx->mask_base_psize; } diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index edf511c2a30a..0b4ab741bf09 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -551,7 +551,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) { /* With radix we don't use slice, so derive it from vma*/ - if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) { + if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !IS_ENABLED(CONFIG_PPC_8xx) && + !radix_enabled()) { unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start); return 1UL << mmu_psize_to_shift(psize); -- 2.25.0