Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1361512pxb; Sun, 11 Apr 2021 17:10:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfUoPKpGKCf8hzR9RX2d1z3wAQRAm4TgsmMamGepcGVhczApNn63SZhayUyoQ3asZ/JJib X-Received: by 2002:a17:90a:1056:: with SMTP id y22mr24506885pjd.153.1618186258004; Sun, 11 Apr 2021 17:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618186257; cv=none; d=google.com; s=arc-20160816; b=JN4mWucjPUZbk5XXsBNS+7DJmVpw3ppGE66FLicslHF9Lfs4xKT2DLHRkX1wpzpfCK J+mWY43bGgouv33OcP3zNW3aT6hH2iNtR61VZoSbfLSmmbdN08xKFjP+hT9bnx/y82aJ Ga3UNtxrqWcu5+oZwzTIePJtp0DllmFox/lqiawicuRkYjIk119w916wRBPAkg1roJZz C6k+pi/xf5PwUaboK9TiFy48+KgA/8UV0uIuBaagmbGWxaxhmlxiOdQiorK4wCj535E4 LUOpVMbPTjTBq7U44LxDcEawnMMC3dM9OkYCqZeXnsxMFJgc9pLFhLOZZXDRG7Z6Pd4f oHvQ== 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:dkim-signature; bh=YnVs6iXJw2PnHXM+FTaBmQjNfh0kVz1yzJWe9NsSwR0=; b=alkkZgb0chVvLivi8UWHdl3LSU9KTBaTxZmD6wVwspaU32NAS1tYOEid2sUBA23b2o PoIjrjNmwdLfXOnbBw564OGNknrq40kgwtl1KSo1FT/Qrw6IJu6W3qSxau1FzBgMH9xk Y0w+cdTev+nnwR48T5GGTqvfg0ZjKfA1ll1pRcnI2j9JlTTYerYUkpC/kGBMGvl7M+vQ xhUEk1NZd2y22gLukP7x9t+ZHEkCRvcLKxrFD8Rs+nCyjFpQ28BG29nBEYttCyYMOaW5 ovMWbkgp418rut2gDq80D4nMUuiItzaBwTMgjuJLts+eYGHb+vWoGE9eiJtk45n/aHsw EtpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jiuyang-me.20150623.gappssmtp.com header.s=20150623 header.b=2FCp0QcA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si10788038plh.131.2021.04.11.17.10.44; Sun, 11 Apr 2021 17:10:57 -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=@jiuyang-me.20150623.gappssmtp.com header.s=20150623 header.b=2FCp0QcA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235506AbhDLAHo (ORCPT + 99 others); Sun, 11 Apr 2021 20:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235095AbhDLAHn (ORCPT ); Sun, 11 Apr 2021 20:07:43 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60236C061574 for ; Sun, 11 Apr 2021 17:07:25 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id h25so8029484pgm.3 for ; Sun, 11 Apr 2021 17:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jiuyang-me.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YnVs6iXJw2PnHXM+FTaBmQjNfh0kVz1yzJWe9NsSwR0=; b=2FCp0QcA9KMN1+FvWg1Rjg8sWToiad0gBkN3N2EJetKRzsEwU0L4kPzDEai8bniM5Y 1NVCO/N1/LVjMevSq5/++QC2mWE13WL+cstlo1xdFy5yI9PjlFw6lKtmpDJE5UnX07du LU9HykuIrJlfQluE876DA+/3BBY7T4Rk0fAAVCxOEXK/zjS/l/iQacIilwGNYBWWKZfh H/c1KZbbV68QbSvvQUSRZ4X9R6eLrRxDdNo1mpaiUlPBa+f0QqLRbX0ytoZsusftsxWG f9hbkOaUPzMDQ6PDCOanlBwjxxopQJgn8K/hCnoRMVQq7/944pDsE+rTJXjWdZ3LhBQI lPxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YnVs6iXJw2PnHXM+FTaBmQjNfh0kVz1yzJWe9NsSwR0=; b=N9ZGE0dqtmAeu+60Q+7oJZ50ha0UAVYrqmpuhVooQtfLyloIJiW++qy0MMkmoy7sgE c8vnXIc6UdGXAcsT2FmZIyC95g011l4hGWguMaL7oIevuIDC9NFY1n5dSgZpCk/sDGcY YmkK/DMbccNUvxekTrg2xrfR8mNK1611WsCDjw2vWMPV6+qfDYhcE42QnFj6QjhZsg60 SUIk1Sl0CWEFnj4neq7Axapa7C2ymQkJ1eyavfvhMmpQs5AIXWlvGUYYOTQe1iC7+DCU BX368jYetIFUfVHPZxDS2c1aNYtCxlLk8KYNs4Ev1tDIV3h614Ca7WdyvEnCIA/1xRSK iicg== X-Gm-Message-State: AOAM530z+TPjlNQgU2uJayFhBaZIkSU2w5rtqVPKGbi76OXcquAj71nJ J/ETGxadUEQMBdYEeSIUtPjqXA== X-Received: by 2002:a63:30b:: with SMTP id 11mr24078481pgd.245.1618186044990; Sun, 11 Apr 2021 17:07:24 -0700 (PDT) Received: from nuc.. ([193.110.201.196]) by smtp.gmail.com with ESMTPSA id 14sm8544872pgz.48.2021.04.11.17.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Apr 2021 17:07:24 -0700 (PDT) From: Jiuyang Liu To: Alex Ghiti , Palmer Dabbelt Cc: Jiuyang Liu , Andrew Waterman , Paul Walmsley , Albert Ou , Andrew Morton , Geert Uytterhoeven , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] implement flush_cache_vmap for RISC-V Date: Mon, 12 Apr 2021 00:05:30 +0000 Message-Id: <20210412000531.12249-1-liu@jiuyang.me> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch implements flush_cache_vmap for RISC-V, since it modifies PTE. Without this patch, SFENCE.VMA won't be added to related codes, which might introduce a bug in the out-of-order micro-architecture implementations. Signed-off-by: Jiuyang Liu Reviewed-by: Alexandre Ghiti Reviewed-by: Palmer Dabbelt --- arch/riscv/include/asm/cacheflush.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h index 23ff70350992..3fd528badc35 100644 --- a/arch/riscv/include/asm/cacheflush.h +++ b/arch/riscv/include/asm/cacheflush.h @@ -30,6 +30,12 @@ static inline void flush_dcache_page(struct page *page) #define flush_icache_user_page(vma, pg, addr, len) \ flush_icache_mm(vma->vm_mm, 0) +/* + * flush_cache_vmap is invoked after map_kernel_range() has installed the page + * table entries, which modifies PTE, SFENCE.VMA should be inserted. + */ +#define flush_cache_vmap(start, end) flush_tlb_all() + #ifndef CONFIG_SMP #define flush_icache_all() local_flush_icache_all() -- 2.31.1