From patchwork Mon Sep 21 16:31:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 309386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 903E2C43466 for ; Mon, 21 Sep 2020 16:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B1E8206DC for ; Mon, 21 Sep 2020 16:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600707124; bh=/P3jFUEuqVpG5Ymt1Q6QhgAE+k9wcbL0fs/M3v0m84g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=oXm8NSduwoVKPjf62EST2VdECM8tytkfU/WIK5LAYxrc/SeDy8aj/MpFmWULw4cYO uuQfzXv/1nI2scQ0GSMcIOVRIfLghztMG4O60fwFsSHZOIWgGXmdMV4nhLWE06iPwh tkLaWsKa7CGg+tzfs8/quJmdX6Wvye7GRNt58Sn0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729753AbgIUQwC (ORCPT ); Mon, 21 Sep 2020 12:52:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:57806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729890AbgIUQtm (ORCPT ); Mon, 21 Sep 2020 12:49:42 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB0FD20874; Mon, 21 Sep 2020 16:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706982; bh=/P3jFUEuqVpG5Ymt1Q6QhgAE+k9wcbL0fs/M3v0m84g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qOamLxmde4MSJ7mR0gErhsLYkBoUMOshh8MCJ22sTFRV4Wx7Lv/5oGQSTQF7MbMS8 Yd4OIO9AzwPqKdHl4PDmqF8P4OnKFzcD3N1/jf35zohVTw+gXwM0uYpYd7yiCh/cfE 403moVvQS+D7GUjmnBLMOQghUI01aEU9jJznf0ms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Syven Wang , Greentime Hu , Anup Patel , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.4 50/72] riscv: Add sfence.vma after early page table changes Date: Mon, 21 Sep 2020 18:31:29 +0200 Message-Id: <20200921163124.258534811@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921163121.870386357@linuxfoundation.org> References: <20200921163121.870386357@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Greentime Hu [ Upstream commit 21190b74bcf3a36ebab9a715088c29f59877e1f3 ] This invalidates local TLB after modifying the page tables during early init as it's too early to handle suprious faults as we otherwise do. Fixes: f2c17aabc917 ("RISC-V: Implement compile-time fixed mappings") Reported-by: Syven Wang Signed-off-by: Syven Wang Signed-off-by: Greentime Hu Reviewed-by: Anup Patel [Palmer: Cleaned up the commit text] Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/mm/init.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index b1eb6a0411183..d49e334071d45 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -167,12 +167,11 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) ptep = &fixmap_pte[pte_index(addr)]; - if (pgprot_val(prot)) { + if (pgprot_val(prot)) set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, prot)); - } else { + else pte_clear(&init_mm, addr, ptep); - local_flush_tlb_page(addr); - } + local_flush_tlb_page(addr); } static pte_t *__init get_pte_virt(phys_addr_t pa)