Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2814953pxb; Mon, 18 Apr 2022 08:47:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVuvR3Zvo5Q9pmKuSMtt5i0hh3P7rqkpz8pT0vbYDJkrwLpX0tHsXmtJg3nk/Z9/YEWXtj X-Received: by 2002:a17:906:7304:b0:6e0:6918:ef6f with SMTP id di4-20020a170906730400b006e06918ef6fmr9605814ejc.370.1650296870664; Mon, 18 Apr 2022 08:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650296870; cv=none; d=google.com; s=arc-20160816; b=0duJxe3ytj1JPPTN3N8q3uMZ38XNkVfWpI5hStGZGUefImZZegKIw0WkVFjlDFQaYV YZMcCMV5Q0RdupVaialZ0+6qvE+xRolJDBZO3T4koeIEefkd8bnEgSPgs7Mx05jOjDAI zQgvS7Y3Y9d5Lp0GeDvcNaiJ+JOs/wyrLKj5pQm8CDpgUBWSzavF8/L099yFZlxw3iMt kofxO2v/LDSutdffM1HSY9AupNHW5FF5IdZvJ8eaofHCAEMuvS7CPeTQF/PLAAgC2NbA QvUv4FcjLP+aCtxT7VckF/Onlsr8vlA+a1aP40GEDIrpqxWbe9ORkkOYRr1j2kp4WS2W Hrug== 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=sX9W0jJI3V+TTQxrILZfbGus1iz/Yao2DvXh0KaNAVk=; b=NZXpCb4ADd+ikeaZ7RZ5Yr6CoL9TMiIY9hfkA/Un97jdJR207JbW3u9W2RPRpAUF0l GPI7J6m7tiwZeBkXjMzZ0hC3Xp2Tu/UzWxA+uJvj8mILFsnF+8TtD+w73x5nsGbUCewm k2XCpx6S1i/yILEPHkHlcBCPvPJWdwSS80CFN1+5jEskzlgRc5rXF80kUjT/h2pyYFLQ TIHBkUxkwhujh8rO8IAxvKBfFfG3opaXmtuE1EHmASQqXRO4uaWB+joc/5NVZ4VQOoQd Z4FWvVOvbD5p5bmqj9rHtNOeGfs4YpCToHuXtYIFW6gsKQAcrx8MZL598ojZvoxnrIXF qWTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=dfq5nxRH; 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 v8-20020aa7d9c8000000b00418c2b5be07si6366318eds.233.2022.04.18.08.47.26; Mon, 18 Apr 2022 08:47:50 -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=dfq5nxRH; 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 S237733AbiDRK5G (ORCPT + 99 others); Mon, 18 Apr 2022 06:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237362AbiDRK45 (ORCPT ); Mon, 18 Apr 2022 06:56:57 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2816519C2E for ; Mon, 18 Apr 2022 03:54:16 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id k62so12158976pgd.2 for ; Mon, 18 Apr 2022 03:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sX9W0jJI3V+TTQxrILZfbGus1iz/Yao2DvXh0KaNAVk=; b=dfq5nxRHRr6Vx5qEgX57IF65zgE2vVmhCiwB5zffgAqsMWTu6wr1CGxCNlu8DTUa0t DTvlRdOymlFXFt06/SzX29Vm8lZvm8Pyu8QrvBgX56wA4ds/WDOAaihVGK5qGPG2dxvb nGv2r6YjuIsulVRF2Q6Og5Ftk5FeuGQOMDjWH08IexikHcBNlJ1gdPuUMuJnka7VRbek mmYv5dNZCLa0qClq4I3MTTY/MOP2gRYD6vVe7Or1sjkxeOGGw3bMtD1mH6Pj5F+EDtwG mVFSMv/wt7jILCuDfg/yqBLjcL8UTqcNejXS4SbEFzmMni5ubNGpfLvQVDXVxjNaq1AI QjRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sX9W0jJI3V+TTQxrILZfbGus1iz/Yao2DvXh0KaNAVk=; b=cZBg/nlsNx4Y2lG2HL0NR7otaa/YPHUoMiBbCjrVTcKMLfanf3IMUrn807k6l4ycpM slD3JLksiCDLfa6iHqk1IHPzAqj+PmGi4lbUVFR8T89ylP3vDiv0w8pVKXGjx6E6YK3d 56NGt8LhxxRCKGNRfIN5XQ0iliFENiESqa5LDT+L6lxiTX+gzM97lZBQdSfajmzHSbrU 1AqppTtdndMcL+gdyLXW/vqEBNnN7LiuFwt11jffD/5EdhHNS5ugbaYHm6px/EsoM9pd OZf7CrcMfHTWoCcjXwtRpoFED3IFB7ePPpNiIKohYTSixmaVVABQrZ1KSCbbSqliy01w Y7IQ== X-Gm-Message-State: AOAM530faDSZr79eTLvFb8R5BgCo91oRJvqewTrNpGY5fSvgkvJkyhbw b9hFry94QYeECkc5RS0Qa5hYwA== X-Received: by 2002:a05:6a00:1ad2:b0:50a:8181:fed4 with SMTP id f18-20020a056a001ad200b0050a8181fed4mr1628046pfv.16.1650279255667; Mon, 18 Apr 2022 03:54:15 -0700 (PDT) Received: from localhost.localdomain ([122.172.241.223]) by smtp.gmail.com with ESMTPSA id j13-20020a056a00130d00b004f1025a4361sm12986278pfu.202.2022.04.18.03.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 03:54:15 -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 v6 7/7] RISC-V: Use IPIs for remote icache flush when possible Date: Mon, 18 Apr 2022 16:23:05 +0530 Message-Id: <20220418105305.1196665-8-apatel@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418105305.1196665-1-apatel@ventanamicro.com> References: <20220418105305.1196665-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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.25.1