Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp663506rwb; Fri, 7 Oct 2022 02:26:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Eii9+HlqrjdHwv79fqC2eCC1yR8n71jHr5E+TNhdnMdX3ZaxvznvhQh0MbfLQNoa4TnRh X-Received: by 2002:a50:fb0f:0:b0:458:df03:c3aa with SMTP id d15-20020a50fb0f000000b00458df03c3aamr3576683edq.83.1665134782029; Fri, 07 Oct 2022 02:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665134782; cv=none; d=google.com; s=arc-20160816; b=JRA1KdPqACV6gTE1ZcHXwbIvjW3M7zHgLvJXILgtfWc7jyr5sMigUvlmJGWFn41hse RP1KbqsgJGMezY7QbtcKxt6Do2hRmDm/csRd1pNICDIcibG+dEvbOZVJBSij9E7uTVtc FYGby53HPFInlIdJWQ3CAUyhYo8T3p7hl9KcgSalmt2RQOvQmsTVJnhmbHR/1s39GioR Y4dggHSJGpUk+mNI+jvdjSyba/LcLl4mYPlbwChIgKQwzzToHoK81LlFMCz/t3ZFVARI HvncehRue/hsWANcEIHFWE7JTRqBp9jWHtg+rkQRVrGp6KCev6rSRCgtMRsHChwjDekr FXow== 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; bh=PHV7f2tYn6hz3oHRZQox+EaP2gWnq4zRxCWQiI3ScnU=; b=niiUYmDndYZH4Eq8ebB98SzDvvBJiRy8WGRZEBUcgGD78zX7eUa0I5ZPZKt5GEee9W a4Mh3wFH7vQ8YiQA/mk+nOE7YTA9P7iCy2CornY2hdn9bcKmSasJ7sdpUAasyfg/Hqti vBxFdxmvz3jp4B/7MXztrsFnjQLmDE7fZPtjPwXWNXtraddLlMdC1aeZwrtDQmchs0Hr JTFTXGrqQoKU7LxQalkQFX/gXJwWom5p8jHpju1LCRZ5yQ7xh5E67PgVnupC7bMDzP6b THY8OKwdjTRgzpRUP8ojgl97kfdAVNquQ6OwBFWMaLdyEexah/7aSc3MI2geVENfrqQC jBsw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw8-20020a1709066a0800b0077cecf89064si1973581ejc.512.2022.10.07.02.25.55; Fri, 07 Oct 2022 02:26:22 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbiJGJSx (ORCPT + 99 others); Fri, 7 Oct 2022 05:18:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbiJGJSw (ORCPT ); Fri, 7 Oct 2022 05:18:52 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7796C972 for ; Fri, 7 Oct 2022 02:18:49 -0700 (PDT) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ogjVF-000618-UU; Fri, 07 Oct 2022 11:18:45 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Jisheng Zhang Subject: Re: [PATCH 1/8] riscv: move riscv_noncoherent_supported() out of ZICBOM probe Date: Fri, 07 Oct 2022 11:18:45 +0200 Message-ID: <4842439.0VBMTVartN@diego> In-Reply-To: <20221006070818.3616-2-jszhang@kernel.org> References: <20221006070818.3616-1-jszhang@kernel.org> <20221006070818.3616-2-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SPF_HELO_TEMPERROR 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 Hi, Am Donnerstag, 6. Oktober 2022, 09:08:11 CEST schrieb Jisheng Zhang: > It's a bit wired to call riscv_noncoherent_supported() once when > insmod a module. Move the calling out of feature patch func. > > Signed-off-by: Jisheng Zhang > --- > arch/riscv/kernel/cpufeature.c | 7 +------ > arch/riscv/kernel/setup.c | 4 ++++ > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > index 3b5583db9d80..03611b3ef45e 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -272,12 +272,7 @@ static bool __init_or_module cpufeature_probe_zicbom(unsigned int stage) > case RISCV_ALTERNATIVES_EARLY_BOOT: > return false; > default: > - if (riscv_isa_extension_available(NULL, ZICBOM)) { > - riscv_noncoherent_supported(); > - return true; > - } else { > - return false; > - } > + return riscv_isa_extension_available(NULL, ZICBOM); > } > #endif > > diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c > index 2dfc463b86bb..1a055c3f5d9d 100644 > --- a/arch/riscv/kernel/setup.c > +++ b/arch/riscv/kernel/setup.c > @@ -299,6 +299,10 @@ void __init setup_arch(char **cmdline_p) > riscv_init_cbom_blocksize(); > riscv_fill_hwcap(); > apply_boot_alternatives(); > +#ifdef CONFIG_RISCV_DMA_NONCOHERENT > + if (riscv_isa_extension_available(NULL, ZICBOM)) > + riscv_noncoherent_supported(); > +#endif The nice thing about doing this in cpufeature_probe_zicbom is that you keep all the "ifs" in one place, where now you have 2 places that check the existence of the extension. The overhead is one "x = true" setting on each call to _probe() and with this change things are now also handled differently between the main implementation and the deviants. Though I guess, I'll let others do the judgement call on what is the desired way to go ;-) . Heiko