Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3610979pxm; Tue, 1 Mar 2022 01:41:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyck4DhEz1TeRGGE+uRihuJGfS/yftKouX5JlFOhZfSQfS0Dxch7CiUcVuE/cg9fmQxQuKR X-Received: by 2002:a05:6a00:139e:b0:4f1:37e5:c350 with SMTP id t30-20020a056a00139e00b004f137e5c350mr26619444pfg.27.1646127675548; Tue, 01 Mar 2022 01:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646127675; cv=none; d=google.com; s=arc-20160816; b=G8qgxEXZeK+gO/+g6p+EEDKymSJehF69x/ngTDAcpbwFYbMk70w71udSXtj9u4IZEH L4Uve17o6NOn1/PylWeNw9v0mrqVXIP8ZvO6lCSDbxYzYM+38rPCcru4ak5VQC8s0W25 cMwIVksta3IgbmCIBIV0Hoc2mNevN4Ifq70slNBFIqwFchCfinJsLZeEinJnc2xlRNWX Y6nTF17m3u5Ys/43UuzfxN/PbsVEnTgNBx2nltFEzBXprXH6sztWZ3b52NvvcFoIiqJK D7fTPZEQLO76DrAQcXE0OIIuXqZF6CdrsfZirBsG/zTmH8ifCrLxceJH+yrM/cmlJGo9 86CA== 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=FCjfOtgvgfx1bfI1FGtd8HJ5YMyq3qRKgZ8DxKzVsm3vu60X3UK2i2pUws03+P8l1Z OzDBdzZmINQg3Ah2BSbFRVnWnqLnTxifny0xRKtIIbudQll/fJRdELk5V22Nob08dJsc N8iSfIAfrvWNybb9cGT1L6SNkOGHiSJt7YH8XkQWWg5YZUhqudZNGQhBebc31g0mVHj7 7SU2MQFN5wMe/pQcAFGEeUXE2qnytHALWS9+UhKiAULEtX1IlZ5/S7oJJFX88fem5IjI Kdg2bi8c2elh6D1wCZr5LYav6V62lo7AD1Iluo62O3gDaRTLfLtxBa+Qmql/MkddVkkx 3yGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=l9W+NGbg; 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 b19-20020a170902d89300b0014cda493104si11966225plz.222.2022.03.01.01.40.57; Tue, 01 Mar 2022 01:41:15 -0800 (PST) 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=l9W+NGbg; 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 S232340AbiCAE3l (ORCPT + 99 others); Mon, 28 Feb 2022 23:29:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232326AbiCAE3i (ORCPT ); Mon, 28 Feb 2022 23:29:38 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 532B34EA0E for ; Mon, 28 Feb 2022 20:28:44 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id ay10so627580wrb.6 for ; Mon, 28 Feb 2022 20:28:44 -0800 (PST) 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=l9W+NGbgxdapkSDh1674O7D8QLnibie0+u3PaStrMsDolQoNXQay/fD6eG7haTMIex 9hjRC1bPjXL+ev46XF0WqEfHSvHTI+AuD2lrFA7vLF1nc+s2uyeXiNlNj2JJec7gGgUn 2JES8wdSB7kl8EW3lDrqR+StUYnr+zca0owdBvyFARzpwItdzw+AfPumhlGKDM3pXQ30 QLa59UPT2zCDE4YnRQ2OACeI3iJFAqeiSAVc6dg9DX2q4W6goTjqVMDCKbvl4mKCSYBH b2givfpcsF2VQPBwZy/zWEwsP0GS9pyXxCiqkO8t7LeOKA2HHjJBnCjucp/WssWGSUI1 dqoA== 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=qe3mVotArASa2sRMLhnTLjU8s/RVydAIX3GpEbWX4uMkh2G5fFJDoss0hKrEG6UUKo jINHubk7Pmo9Q5VwbxIaj+bncHublIhX2LFUy59HYpMfN395E++hdVjvBG1WfLIOGJSY 5IzeqRFLlL38TL5E98jSy5QSHge8mzpkYeGt86EHZPlAMB64nAJ9mH3Ln0ReL6tpl6jC x5qFgE4Q20AGdf4WHOkK7VhyDgboRkNIv6V1GDrs5t2QpAIyySHdqtR0adhI/QP941lL oEZwlO0MmrZIIpoPUKJH7xzNNk1zbdj3XfhZ2PGF7KQqTUiBWlxen5ezRquNA++1vif8 eeVw== X-Gm-Message-State: AOAM532qIOHQYeqTYWZLUrGqAzxbWBUADX3Xx5sl8twWTHKzHiPyUPTA rpfe95OijkgQFUokQT3Ph59FdA== X-Received: by 2002:a5d:4606:0:b0:1ed:d3c0:19f4 with SMTP id t6-20020a5d4606000000b001edd3c019f4mr18570799wrq.555.1646108922741; Mon, 28 Feb 2022 20:28:42 -0800 (PST) Received: from localhost.localdomain ([122.179.35.69]) by smtp.gmail.com with ESMTPSA id 2-20020a1c1902000000b00380d3873d6asm1209107wmz.43.2022.02.28.20.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 20:28:42 -0800 (PST) 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 v4 6/6] RISC-V: Use IPIs for remote icache flush when possible Date: Tue, 1 Mar 2022 09:57:22 +0530 Message-Id: <20220301042722.401113-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220301042722.401113-1-apatel@ventanamicro.com> References: <20220301042722.401113-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.25.1