Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp133613rwa; Sat, 20 Aug 2022 00:16:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4qzooiN4iYpIuXRsRhYxep1PWVm+Dyj8p3746ShHuImYYCPGXko0XWz1DVKnB78PdFQrEx X-Received: by 2002:a05:6402:524a:b0:43d:aa71:33d8 with SMTP id t10-20020a056402524a00b0043daa7133d8mr8770884edd.33.1660979786772; Sat, 20 Aug 2022 00:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660979786; cv=none; d=google.com; s=arc-20160816; b=N7Rth7elNzA+Q7f3/mEwYZIsgZH2yiCicGxW/Il6goxU67pWI/VdPoCroIEJcCfC9z RDkEj5XoarUg3yvwB7bXcIWcXvmUx+1RHG5BkbGy0A1k3US01auEygkImcQA88RdbuDc zqquXGUarhC+Z9EZo0r9nyAhKcj36Ddd2smiU7RVKPwmRTDpvIePT3lQvKhnNXVC68pq vu+SGQ0Pe30CpBG+LhNv1irjB0goQfU5elqPpLl9bRj4vka+z0LbCpmfO/4H0bG8BYi1 I6ppkqICdgms8GAwZjvnTl1u04JTikFG9uqaMCjbW7FQVPSYsF3ziVDlcYzdw4frJSGJ KnIw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=paOW2t9hSvLN0qsX4domrqdnSMll+/S/rhUQM1pkWRg=; b=slEMmSnNX7cz8//IwFA4vUBVAWGiQE/buHvc5uYR4S0AexAJcEefQh+hanG/FZ7pTf ZnRz0cXjSCA2RL6T++Gb77Y+J9Mq6uR7LIlluoQ7bv/0/W9NiSgVTvUUcwSroqQD83Ig jLJvA4+1DuJXEmi1+LdGAGUsNuE+FUtcBVXHSFKq8K65UxSM0rMyRnZ2D+ZdQSw12OJ9 AWLfYQks3Hu2jMYT7lbgc/DlFgNqgDpRyXk12IwgdyYfv52ManL+BGpmfiDraEOXXVvy 52TghpurdEgdvjHb3oHmv/QUNXeixHlS/Pl9NUjegQPxizsusrv34gR8YcTswpuiP17g F4qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=NtxPW9Wr; 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 hc7-20020a170907168700b00726e142a88esi4382604ejc.983.2022.08.20.00.16.01; Sat, 20 Aug 2022 00:16:26 -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=@ventanamicro.com header.s=google header.b=NtxPW9Wr; 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 S1343510AbiHTG4i (ORCPT + 99 others); Sat, 20 Aug 2022 02:56:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245716AbiHTG4V (ORCPT ); Sat, 20 Aug 2022 02:56:21 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BAEAC0E5A for ; Fri, 19 Aug 2022 23:56:20 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id w197so6984693oie.5 for ; Fri, 19 Aug 2022 23:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=paOW2t9hSvLN0qsX4domrqdnSMll+/S/rhUQM1pkWRg=; b=NtxPW9Wr4McSKA91GxGeGJjkDktm/3QZ21ZNmP6uUQWklp9s9rzEpNYYZdruz79fDb am2bA0uDb2zVe4SXlgweKT3NlDH2dL4zgQV3KJtOdZRtoTnjusouB4y1TJTmrPqyfr/n y8VI4e5/HkOQHzrH0xqC8bvIyX12XlWJTXxPjVAAtEuLZTeLTfrpPfT1qGgl1Wi+J/FN k2vTJPJ4Va4f6PJAQKY4afDh0uJX7WEz0TG50Vfc/OiT0+owjwFKzCJKSPMacJ36UVIf RQ4t85x9+WBAI7mKoakonnRudaR41Mn/TplPY1y5Oo/h9v4MMowWruWTam/0zgKiHZeg JPBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=paOW2t9hSvLN0qsX4domrqdnSMll+/S/rhUQM1pkWRg=; b=oR2/fWHbH3LEwuYC0A7NcfJ9xgdA4wxiBr8boPeiYkpZdQTLmxSRTi7oTlPXS0SfI9 pZrlQ2kmU85y7OJY4U5t5d2yBV/LVd7XWGt2C2xIb5Dq4Y88RR35diPDuTp9aLCJvPl1 4h217gPBwFkKEtO2xjQpvP7dFFGK2bWRr7DaZ3fHM5+tI4nFbeq3rpoWm8yIfqIs+TF2 eORGbEKNOo+ZxbPRTAruXIqSncTh1HuefmSB1P5cMgJch31zgZa/+rl355Pg8Myzz3SR Q8GCCsUwshr9vdINxdIqf3Fhv+O4zByYu9/lYelFfbKNMKObcBb30JpBCmM3CH7TMP44 I6mA== X-Gm-Message-State: ACgBeo3UdCO8Oc/2QrB4qPT/ZwDrig6BlVnEWgCISN53Z7gLmwQYMOXo 5s4U+JR5nn+mGWK2PxQvPvVobw== X-Received: by 2002:a05:6808:10d5:b0:342:f7d9:e8a8 with SMTP id s21-20020a05680810d500b00342f7d9e8a8mr7337081ois.164.1660978579661; Fri, 19 Aug 2022 23:56:19 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([171.76.82.68]) by smtp.gmail.com with ESMTPSA id h26-20020a9d641a000000b00636faf5e2d9sm1661098otl.39.2022.08.19.23.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 23:56:18 -0700 (PDT) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Daniel Lezcano Cc: Atish Patra , Alistair Francis , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v8 7/7] RISC-V: Use IPIs for remote icache flush when possible Date: Sat, 20 Aug 2022 12:24:46 +0530 Message-Id: <20220820065446.389788-8-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220820065446.389788-1-apatel@ventanamicro.com> References: <20220820065446.389788-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 If we have specialized interrupt controller (such as AIA IMSIC) which allows supervisor mode to directly inject IPIs without any assistance from M-mode or HS-mode then using such specialized interrupt controller, we can do remote icache flushe directly from supervisor mode instead of using the SBI RFENCE calls. This patch extends remote icache flush functions to use supervisor mode IPIs whenever direct supervisor mode IPIs.are supported by interrupt controller. Signed-off-by: Anup Patel --- arch/riscv/mm/cacheflush.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c index 6cb7d96ad9c7..7c7e44aaf791 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -18,7 +18,7 @@ void flush_icache_all(void) { local_flush_icache_all(); - if (IS_ENABLED(CONFIG_RISCV_SBI)) + if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence()) sbi_remote_fence_i(NULL); else on_each_cpu(ipi_remote_fence_i, NULL, 1); @@ -66,7 +66,8 @@ void flush_icache_mm(struct mm_struct *mm, bool local) * with flush_icache_deferred(). */ smp_mb(); - } else if (IS_ENABLED(CONFIG_RISCV_SBI)) { + } else if (IS_ENABLED(CONFIG_RISCV_SBI) && + !riscv_use_ipi_for_rfence()) { sbi_remote_fence_i(&others); } else { on_each_cpu_mask(&others, ipi_remote_fence_i, NULL, 1); -- 2.34.1