Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp492914rwb; Thu, 1 Dec 2022 05:01:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf4FYsJpWE42wR5188Y1dpY6K73lVbvLQDJ7hi4ZNd2T3f9MMysOJo3KZM/sVkNl3YohTQsq X-Received: by 2002:a63:121f:0:b0:477:8227:dffb with SMTP id h31-20020a63121f000000b004778227dffbmr42028840pgl.608.1669899660628; Thu, 01 Dec 2022 05:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669899660; cv=none; d=google.com; s=arc-20160816; b=ObTzlihBdqmllcEU2VXGAHSSfRHJByF81BInLpVf7KZnTgcPakhD4vqHoyDLQP2qA/ 9LF70nm4CyMdrZQFVn94+jsO07uSbsz19rJS5h13PN4AGhHtgmOVCqAuvlA0QjKcwRpx A6jVXRIyHsnZFvjsyBeGJdy6ovxS7qiMlpCovbJcewTSyhpatk8+NEJJryWFYEYKYYq6 cP3RvK1ERgSEVgfKqaZYaHt3Lc8T0vuAul4dc/vGpnzcjR9ffYae7VjwiSxQ28S+U36a 6lwoeSZWt3h4RLI20dFHGBDcXn68JR4IqZA4W7TPgYnVmE3uYBvb9crg5vcOA6GA3erj iRjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hy0z9fn6yutvc+dvThk/Y1SdzeHn9pxlN9/eh5uO3cs=; b=D7v0vEjimj6YIWZhVdZhaI+cvC+WI9M5OkG5QV2rEtKWIan/krdpKFb9w5m4eT8oZF Vn6XnYsQgCumCCT248LYwQM7ibE+bXD4plFEdV9w92ZQHIUzQvkweeyoeH+MCvHi1ofp 4PKioow+ZAYZW8zty0qa8D66RYUHT804JpOwNp5yMCZTwBRsSNbuRT1mEMsBAKAehfph RQ+DG0x0vS3Vmi/3EA3x3uPyDfcZVu7YKadmPZPPkLBGFOXeooAQcO5f/E3qclXKb82R Tr4cHVXljYB8PKoKRcQaKa/6Tr7LMxNG8SUPr9hvBY30wS3Wy8UUCY0tFA7lowyWqpHN QeNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YkIRhmkv; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a17090270c400b001897a8ae7b3si4009380plt.296.2022.12.01.05.00.48; Thu, 01 Dec 2022 05:01:00 -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=@gmail.com header.s=20210112 header.b=YkIRhmkv; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbiLALal (ORCPT + 82 others); Thu, 1 Dec 2022 06:30:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbiLALai (ORCPT ); Thu, 1 Dec 2022 06:30:38 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E2225436A; Thu, 1 Dec 2022 03:30:37 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id ud5so3492357ejc.4; Thu, 01 Dec 2022 03:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hy0z9fn6yutvc+dvThk/Y1SdzeHn9pxlN9/eh5uO3cs=; b=YkIRhmkvgKI5VeByBYmm1jWJDDZCuPl51QhLM+LBFmLqimdlWo+pj+K+fPMT+zPB0F AMa8LRhqkrmuqzMZRiLjbwdeseLHv66UO7WSVX6vd9Tnttvwc9+vd9GREUtc8R3Y1kaM j/a84exSdT20BTPXJRti561tqcGWWyMI7oQxb/xrq++ienrgX3hoF1tsCa+fRtElpg5G a3F0Qu2FLENR/gzMY0IQyTfBWdD7Fl439e4rIMO+X9WvViIIDIRVcpyISqZJ2GBRs6GA Ns+gcbiqFopKXHlwt3rW8MXX1HwtL0dQ5byHH+v3+zD2nhNGRMGcvrBJ4rOPWOyUQjbm xlyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hy0z9fn6yutvc+dvThk/Y1SdzeHn9pxlN9/eh5uO3cs=; b=Ozpa+/kV4xOsOtQGMFeVHTqy8XPqvf1cyo2FUoDXEfEBjSMteXEHje60cyUpfoI/0q r+02mifOAuQpz5c7XJW3SahAc/1nJrnTy0EtRiyF0FEk2simt2t/6H1rv/iMnRB5YZbC 8AbOIFQaOHS/LJwdNydZ0gi990A42VPpoDjPtxJG7PREG5q4TIL9t2zAH2Uz0o20jvDP 7+qmFeGSh27ll+SDVvo9/SbrMI7s6SYYvhlmmPuZ/WmyPuB7bkhwrFLf8BFSxEhuqYel IaHMqMHryGF06JMgEfo5ioZWxsXG9hONsigdeG2jeq62zIhu7PNup21qBQa3dP/cQrzc taVA== X-Gm-Message-State: ANoB5plG/lz+DLvf4GfqNuqFTdfb8eD4TyfhC4SBSfs8cGhPUQdUovRz Sm9H5IKfztpI83hwwLTu+8n2sUoiYroXZpPO6V0= X-Received: by 2002:a17:906:79c4:b0:778:e3e2:8311 with SMTP id m4-20020a17090679c400b00778e3e28311mr42171491ejo.342.1669894234898; Thu, 01 Dec 2022 03:30:34 -0800 (PST) MIME-Version: 1.0 References: <20221124172207.153718-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221124172207.153718-8-prabhakar.mahadev-lad.rj@bp.renesas.com> <565e1861-7052-9bd3-e7ba-e590bd91cf20@sholland.org> In-Reply-To: <565e1861-7052-9bd3-e7ba-e590bd91cf20@sholland.org> From: "Lad, Prabhakar" Date: Thu, 1 Dec 2022 11:30:08 +0000 Message-ID: Subject: Re: [PATCH v4 7/7] soc: renesas: Add L2 cache management for RZ/Five SoC To: Samuel Holland Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Geert Uytterhoeven , Magnus Damm , Heiko Stuebner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Guo Ren , Jisheng Zhang , Atish Patra , Anup Patel , Andrew Jones , Nathan Chancellor , Philipp Tomsich , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Biju Das , Lad Prabhakar Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 Hi Samuel, On Tue, Nov 29, 2022 at 5:58 AM Samuel Holland wrote: > > On 11/26/22 15:09, Lad, Prabhakar wrote: > >>> + if (!ax45mp_priv->l2c_base) { > >>> + ret = -ENOMEM; > >>> + goto l2c_err; > >>> + } > >>> + > >>> + ret = ax45mp_configure_l2_cache(np); > >>> + if (ret) > >>> + goto l2c_err; > >>> + > >>> + ret = ax45mp_configure_pma_regions(np); > >>> + if (ret) > >>> + goto l2c_err; > >>> + > >>> + static_branch_disable(&ax45mp_l2c_configured); > >> > >> Instead of enabling this before the probe function, and disabling it > >> afterward, just enable it once here, in the success case. Then you can > >> drop the !ax45mp_priv check in the functions above. > >> > > I think I had tried it but static_branch_unlikely() was always returning true. > > You use DEFINE_STATIC_KEY_FALSE above, so static_branch_unlikely() > should return false until you call static_branch_enable(). > OK, got that. > >> And none of the functions would get called anyway if the alternative is > >> not applied. I suppose it's not possible to do some of this probe logic > >> in the alternative check function? > >> > > you mean to check in the vendor errata patch function to see if this > > driver has probed? > > I meant to do the equivalent of: > > + ax45mp_priv->ucctl_ok = ax45mp_cpu_cache_controlable(); > + ax45mp_priv->l2cache_enabled = ax45mp_cpu_l2c_ctl_status() & > AX45MP_L2_CACHE_CTL_CEN_MASK; > > in the errata function, since that decides if the cache maintenance > functions actually do anything. But ax45mp_cpu_l2c_ctl_status() gets the > MMIO address from the DT, and trying to do that from the errata function > could get ugly, so maybe it is not a good suggestion. > Actually I did think about this and the best approach is to do it in errata only as you suggested. So here's my approach for dropping the above checks is to introduce vendor specific SBI EXT (RZFIVE_SBI_EXT_IOCP_SW_WORKAROUND) which will check both the above conditions and only apply the errata on success and hence avoid the "if" checks every time in the sync operation. Cheers, Prabhakar