Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3296127pxk; Mon, 21 Sep 2020 09:57:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/AATf6YzwI0sHNn2OWogJa2hPFbcGyTvD6PGES+D/6iqC7By9DJee7eDCvSUSInl2xeSz X-Received: by 2002:a17:906:8143:: with SMTP id z3mr339337ejw.323.1600707464240; Mon, 21 Sep 2020 09:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707464; cv=none; d=google.com; s=arc-20160816; b=nxsFYZA01eL9g2CJQycRnZ9Zl09hhm1ZMQ6yLJXJ/R9DeHRXUI00eFXZUy20BpXt9r h5R13OiTVZp1iO4O2U4AIv80dCvxBcE36sc9UOYUhTjP25Yg89FMpJkCWBhHM5ufUX/S eWekvJ3oTuaxgeEobc++O33xPzPOsxPO/sNjAJF7enrxIZCpRNoLJgVr+Xyb25B/EpEr 5f289TpZpMFJyictVMPzU4PAdlxS2yq1rij42v1j8WtQ274IHrZK4Qkr0iH3sbb4NhzN i/ubdhx1BZSZ6M9ALhgqRzZp9PWTy5GCi9ahgNx1Sz+FDvFkqVXCpV51ChXw7b8pSGGm 7F5w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tBWQN1ERS2DrLh+7ceG4aB4tTq8LuBYofy7Yv9evwQ0=; b=TUVi9kZUHzXfsNDufvDZq697giIdBL2giHJqpSycKLfHZ5wJN/b2o7EiJJxpipZQTE zEHs9Ykimoqyw+L8sV9BEC/jQ7iQK9lE2ri1PYscPkSamGG0pRHLzfO3k2MCvX3Nnh3g 0UAgF1/hWL9ujPGnYfvX2+Ob3KG8ktxyZaGdICVQUIJIBZJ4TDg1yzhYrlJS4bzUOKmv iFrCp47d8Fzl/NWfMsuAwgZGzeAharXrpcWCXU/72U7YnBX/BzRzslQdeOwQ6QYNAV0l X5hxp+KGaZ7fI9BCc5WModXFpYFH6Ac7LwepWuzyr7/orkcfiEtyqZO4GfHix9fMWJGl vjBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cUmneElj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si8600397eds.17.2020.09.21.09.57.20; Mon, 21 Sep 2020 09:57:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cUmneElj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729854AbgIUQzV (ORCPT + 99 others); Mon, 21 Sep 2020 12:55:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:51876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729503AbgIUQps (ORCPT ); Mon, 21 Sep 2020 12:45:48 -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 624DF20874; Mon, 21 Sep 2020 16:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706747; bh=4BJVieK2MQpsQrM3gMlFxZYQf6Qf6grauSn0niykwFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUmneEljdTisIMjpLOD1znhj/Q00B/+FXmlySKXMO2uoh9gWbSGPPbzm7Y7RLNW0B 46WxiKMLMc3MRehtQV14+5tv1DWPg5NfZ4PG4k2bSUExfrVumxg+IxZYzat4Hr4YHL +sB1iCWgtORHrDEUSDzFm7McD+NRNVOaWLqOZFK4= 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.8 078/118] riscv: Add sfence.vma after early page table changes Date: Mon, 21 Sep 2020 18:28:10 +0200 Message-Id: <20200921162039.961172891@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 79e9d55bdf1ac..e229d95f470b8 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -226,12 +226,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) -- 2.25.1