Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2432170rwi; Tue, 1 Nov 2022 07:39:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JRZQ27d44l/sXM9BeY74TrXtL8OXlAGEUFy2tBzEzyLGpJ0ZRRBWN5Fkq7Vy43W7czOoG X-Received: by 2002:a17:907:6d29:b0:78d:d12d:15af with SMTP id sa41-20020a1709076d2900b0078dd12d15afmr18887031ejc.53.1667313554744; Tue, 01 Nov 2022 07:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667313554; cv=none; d=google.com; s=arc-20160816; b=L8UEQmbOm3ueNVJG8tGAFOwkupNpx/6KkmUQvPRUxuVboCwGfhzjMf9HjOeLHe6cjY JhJSHVsTd3zUNUC2vCWAYP7WbiUHBne9+JF82jbt5KdrluUXPciWmpnAyrdtSSqMqJp0 obHe1M/Ma94uQYhB9U4LaQ7/raDKsQ3jn4Nv2qpn5KBoI9G8KKwF7rQIBwUL5zZgimPn 9PJzdGpS/5gHhfYbOoRxpbKgVSmne4isx1miw+3lXZ0Eh8xc9ZTfcm4CWLuulhHd0AIv dkiKVqGmZ1+EbdLRydc38gzlk3LbEAWMWvb7668voZcXlrWFdWS4O2JIeWygrgVCjtyh 4gyQ== 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=NR0zkcTR64wHAjX9AnDry5ZpqjNrgt1ho9rCOwWk1u4=; b=gotpu3jCuM2P+IlkgNsP4Gz65H6TJAcLi1jzKqjMyzDq+ukaRDawpqtxUQos2yI0G6 w3bWibdrdxqpCBYZ0scAOI9H+lBsJUuuwxoAas8OiiPZ3+EjaNmrHlEN9yi9srGJZG1A V4HMaP7CzTN03uS+2/33G6yysz9p2iZE2z6NsB37JH+VQ0kj5roQC9/OKpvTa7fM0dyV JC68YU6dE1q0tEnl4Qq9OW3lNWTe+ZvhFiiU8WrTrmD+DW4hYOGbf5H3Zi7P++TzYpxy yr/3BfcNJePKvShzUJtmUyoeLku3qDE6E6OOS/UmT25o9I+LRETPXbfgyq0GZm0mJ/PM 3t1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=PrmfwbdE; 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 t13-20020a056402240d00b00463c13a9ab7si1504363eda.32.2022.11.01.07.38.50; Tue, 01 Nov 2022 07:39:14 -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=PrmfwbdE; 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 S230372AbiKAOfY (ORCPT + 96 others); Tue, 1 Nov 2022 10:35:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbiKAOfB (ORCPT ); Tue, 1 Nov 2022 10:35:01 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 786211B9E3 for ; Tue, 1 Nov 2022 07:35:00 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d10so13623437pfh.6 for ; Tue, 01 Nov 2022 07:35:00 -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:subject:date :message-id:reply-to; bh=NR0zkcTR64wHAjX9AnDry5ZpqjNrgt1ho9rCOwWk1u4=; b=PrmfwbdEoaA+/aYLn6KyPDuRPIrF4ku2zpK97abpZpsznZm3urteLLw9eV0BBgWNwM Bjo54YGJEsSxkGd4Trm8DnISuPbfN4cRiqrZXElAhSWk+T6LuEebogO1ylpJrCtLrLk+ 0HPxBa8a25+1p1YfDdYLr+uXUeXNpKLHGnoZ0+m1i7AV4BqdVpHtxlzeKv1CJukCveEJ I0CQ57IhbBLeODYGchxZnqqbt6rH9n5Vi8m9aV7H3xN/mZrk0pS5BLi0G7odfFT8KJ8D 5HERjnKGl3waiShgzUrwLCgmZERsHYutExRuYTM6/kmqaliV9H/tva8mc3Hz8j2kJhhH eI6w== 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 :subject:date:message-id:reply-to; bh=NR0zkcTR64wHAjX9AnDry5ZpqjNrgt1ho9rCOwWk1u4=; b=ZRz011ETLo9iG2WCiTkiQFEplM7gExEA23Yi8xQnmuQ97YzzbrKG+p02u1eIL8TMIh uzw4HmvPd2b5xkrn+g+krC9XrX/zXvIY1bBpvbhipxJMiczU15aK8b4kIb/GJB2XJYaa QdrZ/TnmcN/NfrC2RoeYQHTvp9M9qdn5CSlYUSrCSp4Ju03CbElFOfhpbNJ5650iTBlf lzxAf2c4o4qk/ti/CQqL/xwzfIvUkF+V9e5eyFYnyKnf50LCCnQQxp+Iq73b32PVcDXo LU4URRH/ZDhSKIHgMajrVCY8cPz6tf+vi5J6nivFqb0DrLCNTxugWOxU6/H6U58W223c u68Q== X-Gm-Message-State: ACrzQf2QQvT+VqKtdXgZQt2UMvhWTV6oLl8bM0A2sYl86WJhq9ml1dFC lYuvIgped8BKKfJHPcEgoj/SXhEMUJzFuQ== X-Received: by 2002:a63:eb03:0:b0:46f:80a3:737d with SMTP id t3-20020a63eb03000000b0046f80a3737dmr141167pgh.447.1667313299873; Tue, 01 Nov 2022 07:34:59 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([171.76.80.52]) by smtp.gmail.com with ESMTPSA id o20-20020a170903009400b0018685aaf41dsm6449055pld.18.2022.11.01.07.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 07:34:59 -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 v10 7/7] RISC-V: Use IPIs for remote icache flush when possible Date: Tue, 1 Nov 2022 20:04:00 +0530 Message-Id: <20221101143400.690000-8-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221101143400.690000-1-apatel@ventanamicro.com> References: <20221101143400.690000-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 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 57b40a350420..f10cb47eac3a 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -19,7 +19,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); @@ -67,7 +67,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