Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3568094ybv; Sun, 16 Feb 2020 00:20:26 -0800 (PST) X-Google-Smtp-Source: APXvYqz7XT0VCcyqjxbFGFO2IM++/5UFHg3Hl5b4R40s7MNgluIOT6lByzggLT8jV/F2ZaBFGJvj X-Received: by 2002:aca:ebcb:: with SMTP id j194mr6844285oih.154.1581841226143; Sun, 16 Feb 2020 00:20:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581841226; cv=none; d=google.com; s=arc-20160816; b=zCuQhcQYORKin0cYEKJjE3vW1sASkokSu/AyFN1xnRASTxVP586+Ighnpmw5oTICUU sTYFWLb8YyHyyqVIWUTumkMYhnoFleWt5lqWjfn/pioz3F5+9naVOpGxGHrV7elDYmuF oPioZbgM6hU0gSMpAbAF/ciX6EY73ZiAdQo4ZHzp+SaSRC4kd142xZb8FKeyYXub/IRE InmgF/L/RVTDRgu5NKKe5E7kRcHwOc8+lPWbn2Ox8+KmatXLTT8OPNs+dyzpZc60hwb4 tqFlEVDxpChL2rOdJsremPVEfBtJRWwnaz0lxHbW560fD3FTUVnDCAJ6AWw19WQjhBH6 AtlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YbEdhBU72xHzaKQm+oN7kSNc9VC8GFJp89ECQa4uX+c=; b=Lj7fSKqCymBeogqyAmVZkRsCocTw1TxAB1qkFqGiDbnY1ucqetiPWvhW8u0o9biwY2 EGnCuygFz5zOizS20zaLUJxBfesvodtEjsLbPtfEJWLlaz9UwcpqkibTtrTud/rXNqtL PytRbQ0fdUChJYBWSPLTdBiNbRcNwwRIoMEdYCXPB7x/u9IQT764QLSMw125pbuINazr i4eMKDv2hplihZlHBedJnZDwQ4ogmBiWbuCNxUi5a4HwEYp0oLsoDxEaV3Bj12U8p+SE vNBRxtiBXPC9e2MQ8oNYWZ+OdRVQqm7Ioym++c9zpIezR06qxT8EZ1fLsx7cegJs+9an Pq9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZW4VBNCk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si5304418otk.290.2020.02.16.00.20.14; Sun, 16 Feb 2020 00:20:26 -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=@kernel.org header.s=default header.b=ZW4VBNCk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727842AbgBPITx (ORCPT + 99 others); Sun, 16 Feb 2020 03:19:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:56978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbgBPITw (ORCPT ); Sun, 16 Feb 2020 03:19:52 -0500 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2DC6206E2; Sun, 16 Feb 2020 08:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581841191; bh=W4eq3oKBNtn5njtCQFUl0E8W7deUmxpRXFBznDlnmPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZW4VBNCkaoeTqfv8sTX1/JA8FwMzRGvSPyjOOB+V+fxY1YptlldBGOLd2Cbcf5PlL k5Z73fTRJK2WfZLlr3eKT4GuRi5a5RBnP93VbGx7/YWzeUy3n1j+GU6QoLA3FxROSH bD5ylFMTenbbiiBJW6nSbNNzX5HtNff7YFBd7qmY= From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , Brian Cain , Catalin Marinas , Christophe Leroy , Fenghua Yu , Geert Uytterhoeven , Guan Xuetao , James Morse , Jonas Bonn , Julien Thierry , Ley Foon Tan , Marc Zyngier , Michael Ellerman , Paul Mackerras , Rich Felker , Russell King , Stafford Horne , Stefan Kristiansson , Suzuki K Poulose , Tony Luck , Will Deacon , Yoshinori Sato , kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, uclinux-h8-devel@lists.sourceforge.jp, Mike Rapoport , Mike Rapoport Subject: [PATCH v2 06/13] openrisc: add support for folded p4d page tables Date: Sun, 16 Feb 2020 10:18:36 +0200 Message-Id: <20200216081843.28670-7-rppt@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200216081843.28670-1-rppt@kernel.org> References: <20200216081843.28670-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport Implement primitives necessary for the 4th level folding, add walks of p4d level where appropriate and remove usage of __ARCH_USE_5LEVEL_HACK. Signed-off-by: Mike Rapoport --- arch/openrisc/include/asm/pgtable.h | 1 - arch/openrisc/mm/fault.c | 10 ++++++++-- arch/openrisc/mm/init.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h index 248d22d8faa7..c072943fc721 100644 --- a/arch/openrisc/include/asm/pgtable.h +++ b/arch/openrisc/include/asm/pgtable.h @@ -21,7 +21,6 @@ #ifndef __ASM_OPENRISC_PGTABLE_H #define __ASM_OPENRISC_PGTABLE_H -#define __ARCH_USE_5LEVEL_HACK #include #ifndef __ASSEMBLY__ diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c index 5d4d3a9691d0..44aa04545de3 100644 --- a/arch/openrisc/mm/fault.c +++ b/arch/openrisc/mm/fault.c @@ -296,6 +296,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, int offset = pgd_index(address); pgd_t *pgd, *pgd_k; + p4d_t *p4d, *p4d_k; pud_t *pud, *pud_k; pmd_t *pmd, *pmd_k; pte_t *pte_k; @@ -322,8 +323,13 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, * it exists. */ - pud = pud_offset(pgd, address); - pud_k = pud_offset(pgd_k, address); + p4d = p4d_offset(pgd, address); + p4d_k = p4d_offset(pgd_k, address); + if (!p4d_present(*p4d_k)) + goto no_context; + + pud = pud_offset(p4d, address); + pud_k = pud_offset(p4d_k, address); if (!pud_present(*pud_k)) goto no_context; diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c index 1f87b524db78..2536aeae0975 100644 --- a/arch/openrisc/mm/init.c +++ b/arch/openrisc/mm/init.c @@ -71,6 +71,7 @@ static void __init map_ram(void) unsigned long v, p, e; pgprot_t prot; pgd_t *pge; + p4d_t *p4e; pud_t *pue; pmd_t *pme; pte_t *pte; @@ -90,7 +91,8 @@ static void __init map_ram(void) while (p < e) { int j; - pue = pud_offset(pge, v); + p4e = p4d_offset(pge, v); + pue = pud_offset(p4e, v); pme = pmd_offset(pue, v); if ((u32) pue != (u32) pge || (u32) pme != (u32) pge) { -- 2.24.0