Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61753C64ED8 for ; Fri, 24 Feb 2023 11:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbjBXLCZ (ORCPT ); Fri, 24 Feb 2023 06:02:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbjBXLCA (ORCPT ); Fri, 24 Feb 2023 06:02:00 -0500 X-Greylist: delayed 1212 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 24 Feb 2023 03:00:33 PST Received: from Atcsqr.andestech.com (60-248-80-70.hinet-ip.hinet.net [60.248.80.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A233425297 for ; Fri, 24 Feb 2023 03:00:33 -0800 (PST) Received: from Atcsqr.andestech.com (localhost [127.0.0.2] (may be forged)) by Atcsqr.andestech.com with ESMTP id 31OAeLfr055962 for ; Fri, 24 Feb 2023 18:40:21 +0800 (+08) (envelope-from dylan@andestech.com) Received: from mail.andestech.com (ATCPCS16.andestech.com [10.0.1.222]) by Atcsqr.andestech.com with ESMTP id 31OAe6bd055911; Fri, 24 Feb 2023 18:40:06 +0800 (+08) (envelope-from dylan@andestech.com) Received: from atctrx.andestech.com (10.0.15.173) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.498.0; Fri, 24 Feb 2023 18:40:05 +0800 From: Dylan Jhong To: , CC: , , , , , , , , , , , , , , Dylan Jhong Subject: [PATCH] RISC-V: mm: Support huge page in vmalloc_fault() Date: Fri, 24 Feb 2023 18:40:01 +0800 Message-ID: <20230224104001.2743135-1-dylan@andestech.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.0.15.173] X-DNSRBL: X-MAIL: Atcsqr.andestech.com 31OAeLfr055962 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RISC-V supports ioremap() with huge page (pud/pmd) mapping, but vmalloc_fault() assumes that the vmalloc range is limited to pte mappings. Add huge page support to complete the vmalloc_fault() function. Fixes: 310f541a027b ("riscv: Enable HAVE_ARCH_HUGE_VMAP for 64BIT") Signed-off-by: Dylan Jhong --- arch/riscv/mm/fault.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index eb0774d9c03b..4b9953b47d81 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -143,6 +143,8 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a no_context(regs, addr); return; } + if (pud_leaf(*pud_k)) + goto flush_tlb; /* * Since the vmalloc area is global, it is unnecessary @@ -153,6 +155,8 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a no_context(regs, addr); return; } + if (pmd_leaf(*pmd_k)) + goto flush_tlb; /* * Make sure the actual PTE exists as well to @@ -172,6 +176,7 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a * ordering constraint, not a cache flush; it is * necessary even after writing invalid entries. */ +flush_tlb: local_flush_tlb_page(addr); } -- 2.34.1