Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4515296rwo; Tue, 25 Jul 2023 07:13:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlFw0nXrE48RNiN/wIIsQcGaWG+AB31iNlQXRJDvLORgAlCruTpi4Z/MfjkcRzo4Fjns/RWG X-Received: by 2002:a17:906:328f:b0:96a:63d4:24c5 with SMTP id 15-20020a170906328f00b0096a63d424c5mr11749865ejw.77.1690294420268; Tue, 25 Jul 2023 07:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690294420; cv=none; d=google.com; s=arc-20160816; b=TmLyy3P3eMlB3ZJ0TInSoCP9N9U6CwrSQXsn3vnroowEthsEhvdfZIBBryh8twnvyF qgDxBE4FrY7aSxaTIthXyUEDWpUN3PiX8wHjL9x9XJrDPFzqTjJVEiLplN1lLpatFooS eDvRWuniZD2pJlt2Vnt9Napi7rk1HQ1mQciMC3RQ2JJ5VXezjlROp4PJW85CZcyd9PhL dyfbyk5kEki/jRhiT8cTbIZpCynyN3g4OLTm/Gads0UHtkggUtni7ri1g/BWGM42oVEo N4fUjLf2tKIn0RAmYmUPBX0HAdusRcTvSImEXKdFfo7UrTOGI4Ogwh4kKuZh5wy/xRbt cIJQ== 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:to:from:dkim-signature; bh=SwtTaSSywQCK+6eOzMzkFHCbywbdbCbQr7TZ7zLckhk=; fh=ZYFfVv8G5HvrgNKvbPYxDe/e2HXoaHO/CCsxamTKkuA=; b=X+JMxduddf900Rt0f/um2elzfWBsGKvXv3GcfTz94Q7x7hv0V7FJnbuf4rsZoAxslM UaFpYM0qztv7G5G899//CSxTp85LcV9eVbA8+XvGIGdCgDwuCr+UEwby2sJKWJlqS33j fXY65Gt6xMr4FKpom76Mq2GWxX8LsQEP0BfaaeCFxewjEzsl7oIuWEKHxVaxOd7ktmII ixoCitU6XP9YF/PC+dXQSPA5Y130UMeM82AUtU14C/lHFhRfuqUWM+wW9W2Y2DYh7xCI Y+D+Nf7PkdjdDbhesASfQw854uK9vB/CcLj02h8f+D/InHjjpX++L6RNkw5tSC/J7Zo4 WkzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=aq8K6g1k; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a17090613cc00b00991f1e4b03dsi7527391ejc.406.2023.07.25.07.13.15; Tue, 25 Jul 2023 07:13:40 -0700 (PDT) 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; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=aq8K6g1k; 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 S230197AbjGYNYy (ORCPT + 99 others); Tue, 25 Jul 2023 09:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230185AbjGYNWx (ORCPT ); Tue, 25 Jul 2023 09:22:53 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 480A91FEC for ; Tue, 25 Jul 2023 06:22:50 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31751d7d96eso2216257f8f.1 for ; Tue, 25 Jul 2023 06:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1690291369; x=1690896169; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=SwtTaSSywQCK+6eOzMzkFHCbywbdbCbQr7TZ7zLckhk=; b=aq8K6g1kNKVAXaB8qnVBVyLtEJCw6IO9Lv2x7L+0ECjGDne7M5Bm9519ngrBxeqQOv P59gcWCHJNnmhX7F0a3wa7Ho1ZNxKBoJaw+CysLoZCTpXK2QdmTNZzDeXjLmLW0ppoZy pPCkH29ysNp0p00fnqjBum/pmRXmF9UAN2eP3AEBVngA4SBk71IAmXTemgIbgN1WI91w eLn3KC73YZHADqy4+YlpcAYcgU11lgBS9erwG4oQt8lZ7vSlV9gTmQvVQdaEp93sCAxY MDbTSjFY6VdjH+Q/03QJQNo38iSo6siDDgds2H/QPrAIM2Sc8XuAow5pPL7nxy9Sq2bc RTIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690291369; x=1690896169; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SwtTaSSywQCK+6eOzMzkFHCbywbdbCbQr7TZ7zLckhk=; b=QyEUDWiRiE3lhkAhGxzPQdGzOcmOex3iu+ExuLEUqNDO2qJ/R0Wi3KLpdXOnRi42Hh IfCAo9lZdmYaNTaJ0AKmbUHJcXyKyqDpW2GVtaqlObZeKtjczhRA7A4rb0x/mxEQakxk l0gZ/D/xLXGnX4f+rjZLYZr6obql1VWImEfKsmP5Ej7h8zVOizUE3DXkm8zjXffyVzry FiNpIGgN8TPn6CrMPqo5QL1OpBU+9DIsmqTV4K2EEE5r0Dw82JZl/1HSvAcgbHfAHO00 qK+8rX/EWSHWF7sXvhX81UyhMB9zBCekB3H5T+XvIv4kon/Tda5TEChan8MHxNuuBEJa qdCA== X-Gm-Message-State: ABy/qLYTyqiricZImMRQpZJUn0Qi1dSzDGMPoZw2I7cqWy65vrUWs+en Qt90MWWi43d/8D2n29x54hJzdQ== X-Received: by 2002:a5d:53c3:0:b0:317:568d:d69a with SMTP id a3-20020a5d53c3000000b00317568dd69amr6197749wrw.11.1690291368309; Tue, 25 Jul 2023 06:22:48 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id q7-20020adffec7000000b003143c532431sm16175035wrs.27.2023.07.25.06.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 06:22:47 -0700 (PDT) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Alexandre Ghiti , Guo Ren , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH -fixes] riscv: Implement flush_cache_vmap() Date: Tue, 25 Jul 2023 15:22:46 +0200 Message-Id: <20230725132246.817726-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 The RISC-V kernel needs a sfence.vma after a page table modification: we used to rely on the vmalloc fault handling to emit an sfence.vma, but commit 7d3332be011e ("riscv: mm: Pre-allocate PGD entries for vmalloc/modules area") got rid of this path for 64-bit kernels, so now we need to explicitly emit a sfence.vma in flush_cache_vmap(). Note that we don't need to implement flush_cache_vunmap() as the generic code should emit a flush tlb after unmapping a vmalloc region. Fixes: 7d3332be011e ("riscv: mm: Pre-allocate PGD entries for vmalloc/modules area") Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/cacheflush.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h index 8091b8bf4883..b93ffddf8a61 100644 --- a/arch/riscv/include/asm/cacheflush.h +++ b/arch/riscv/include/asm/cacheflush.h @@ -37,6 +37,10 @@ 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) +#ifdef CONFIG_64BIT +#define flush_cache_vmap(start, end) flush_tlb_kernel_range(start, end) +#endif + #ifndef CONFIG_SMP #define flush_icache_all() local_flush_icache_all() -- 2.39.2