From patchwork Fri Mar 10 07:50:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Jhong X-Patchwork-Id: 67261 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp743205wrd; Fri, 10 Mar 2023 00:07:27 -0800 (PST) X-Google-Smtp-Source: AK7set9S35BymqUx/kY0Ec8rUOsgUvFunY/XPtiUQLmHHgS7rvYu9cx/sIT+cOHU5DXfp/vRnN/U X-Received: by 2002:a17:903:24f:b0:19e:bad3:4c6 with SMTP id j15-20020a170903024f00b0019ebad304c6mr19121892plh.58.1678435647442; Fri, 10 Mar 2023 00:07:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678435647; cv=none; d=google.com; s=arc-20160816; b=Ma4G0oCM3lgjQmZCNSyN9pInRUJgU8dllXggks1fQ5bOThBXfO6aBnqBFI/TBG1Bln w4Hzv7e8jPTR3XpvYk5eJcPCBXFoa4gNuaW1lpOpx/FDUrhKSyutsgMUQ8E6APWUCewJ DnylBfWan0G5xXEE9iCGWGHLEl0hEuF40K+vWHH+Mnz0eva5HjHJUNFfItVw1pAAhg0X zrW1Rv76P/ph72gWPX3JFPv9rpkDqi1tUNImkbWtKuguSUP5Ayyc4YB+Dtf2dKrZqt9p hKLutFYXDIng3ZNRaED7x4VoSJJTS5nKJCOtIIbvYlO5BEdN7oTYDhAAtljeHwFzU4pr nrYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=AX3AZ/vU93H+o1gmmNfsnYD6VA6lqLTkvrzgxftHm5k=; b=08pL20xFApWAVxAxZ06yvEv1CfIdAMlGLeBrNvR/sDKCQqnn/hOY6La+aVEOTYYSjk Klxr6Qj8XrueaV1j9BLY5AdOh+SNF9ss+KMFoQCXiOHBQyiLRwsYtH/QtRRwS0QNLOic r7TpZVtPkvlDjJijw/NzKsrxpYkSnL1rCEm18Ju9g9tWEINvLL8KPPzpJ6Vniy8lJRE4 4w+LMssPScCGiZbrrwlQQ9uDHKJpWqpKCoRizo7rsTVlG9sGdhqGlnXbHEvhQ/CszMrE xF5QCBq7OT+SX8PjKnrhC/YKKSjfsZ225Qs3D+ogzlXicERGx3/emgoupcCNxrtlbqlG YgAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ke11-20020a170903340b00b0019caa0b9701si1445331plb.170.2023.03.10.00.07.12; Fri, 10 Mar 2023 00:07:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbjCJHum (ORCPT + 99 others); Fri, 10 Mar 2023 02:50:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjCJHug (ORCPT ); Fri, 10 Mar 2023 02:50:36 -0500 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 C4D814C6E3 for ; Thu, 9 Mar 2023 23:50:33 -0800 (PST) Received: from mail.andestech.com (ATCPCS16.andestech.com [10.0.1.222]) by Atcsqr.andestech.com with ESMTP id 32A7oTCu050264; Fri, 10 Mar 2023 15:50:29 +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, 10 Mar 2023 15:50:26 +0800 From: Dylan Jhong To: , CC: , , , , , , , , , , , , , , Dylan Jhong , Alexandre Ghiti Subject: [RESEND PATCH v2] RISC-V: mm: Support huge page in vmalloc_fault() Date: Fri, 10 Mar 2023 15:50:21 +0800 Message-ID: <20230310075021.3919290-1-dylan@andestech.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.0.15.173] X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 32A7oTCu050264 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759967258833449689?= X-GMAIL-MSGID: =?utf-8?q?1759967337421887990?= Since RISC-V supports ioremap() with huge page (pud/pmd) mapping, However, vmalloc_fault() assumes that the vmalloc range is limited to pte mappings. To complete the vmalloc_fault() function by adding huge page support. Fixes: 310f541a027b ("riscv: Enable HAVE_ARCH_HUGE_VMAP for 64BIT") Signed-off-by: Dylan Jhong Reviewed-by: Alexandre Ghiti --- Changes in v2: - Fix format of commit message --- 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); }