Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp465547rwe; Thu, 1 Sep 2022 02:34:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR6vEFyMjryPsLJ2yv+G+OlA/iJYO4Cj6RDbT11Vw1hBTaQghUYsb/m0TJ1A3JxAqP1EcpLQ X-Received: by 2002:a17:902:7b87:b0:172:8ae9:2015 with SMTP id w7-20020a1709027b8700b001728ae92015mr30577368pll.112.1662024860327; Thu, 01 Sep 2022 02:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662024860; cv=none; d=google.com; s=arc-20160816; b=O8XjLk4zhLhwzrNtz77It2I76usQA19/yHGqg6uZfiHfGLlwkDuFpDKCpgzIfHdtz+ MMxiFDGMHhahdtUZOgwsdUmM9XJy98tu80P4OwgN+XyhIgCMaamQNTHp4AP6Frr4WbWy 9QuDF3CYbx+XyoUmeRw3SzOaKk2XdU4RpJtHhbrIuYcCv6W841jIrWMQfUxfNstEcCaX YVreCvSVu8wARSrPBA0KclF7iTA8ogf7GVcaOnj577qlCkXuWeFypi/YCQNaJ2qZ/I79 v8emP4pVxG9M+sYJ8zeohNPIPU7NCQuxugf9GATS6WlTX7YL5wjZ1r8DOP+U3fFYu1uD H3NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zdKf2GU/029X1i1nZhbauxVm45u7tJ/0ih6Hx+pKrBM=; b=FIGv984zRDkrDOunOyH7XdCAqfed0GIARrp6v4FBmJ11bAu8So5VDGDgS3EjE7FXrm Qk+Cq9auu7vjUL827k6ISg8T+/5ieqmOkI1wEDm98xmF+eD3TXFbPnm9wWLmFsOQEpsi psIgHfRDBj1/yFWTajPoiRBjcgqm8kZ/JEbn8GGeyfQYWP9eExplxFYLh2LIkUmIYBXd oZE9lZepQt7CT0Vpa8vhT7itbIgpC5Sv04Rt7q3dSg5GuLM52dosR3EAZzuQHRlGiPXb xU//N7kLJpkPu2R/0vJoOJshn4RR0W5K8zIzgCFD1CQWaRMOA3nLVpwP0xbNMWqXXNCh 3bpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=iOTyDaA5; 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 y31-20020a056a00181f00b00537e328e742si16191662pfa.1.2022.09.01.02.34.09; Thu, 01 Sep 2022 02:34:20 -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=@sifive.com header.s=google header.b=iOTyDaA5; 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 S233853AbiIAIe6 (ORCPT + 99 others); Thu, 1 Sep 2022 04:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232974AbiIAIex (ORCPT ); Thu, 1 Sep 2022 04:34:53 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E35E128566 for ; Thu, 1 Sep 2022 01:34:43 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id z6so23358167lfu.9 for ; Thu, 01 Sep 2022 01:34:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=zdKf2GU/029X1i1nZhbauxVm45u7tJ/0ih6Hx+pKrBM=; b=iOTyDaA5qBzZnGKmfEPl6ByrywxzC3nZx51SmMXhUfMrmY6jTAN2IP9XaqlTqPAZY5 sGOGDQybEEmjb8cSKMeNvpmp0rPrNdrr+q3NCw0KcSw1CYx6GwEZGl7+w5xQGiX6/UEY Oc+zXTM1XlKZrHiBpe2ZnbvZc5w2EjffeyHUBd+54dUPwHLO6gEp9SzakxCaDSKv0m96 ps0UWCnyKV2P5W8vonTulb0AN5SgHNIL59C/8kwGc7sURgINVqA0sRWHylxw/PRH9/s4 kaUaGihYtSdwyvtFmbEqgwQujsp9Uibh3fCPD5V1DZi7TVnqc4nbE0eXc35AwOURCF+F wPKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=zdKf2GU/029X1i1nZhbauxVm45u7tJ/0ih6Hx+pKrBM=; b=cDSHbaj3InHC5bcSzKkLJwRKhSJymx7j6INyS/OpOhWgj5wZBjhvxUIeC3ThfaATC8 PPf8luPOhJjj3oXcP7gDAjTWnu5ejMIPW3uR1BOBrS13PexONdQSaW3i+ixJWPqzrw7n Cpw47OMb2NtU4+mvgk0UfEOvfN/7ma3UK3O6USsGmErvo53MSNTeMs0moE/Npppj5Jgp +t1rxy2H3YPi8WUA9SKI11yL10udo4IbbVKs3UwgNEzVyDffA6/HimE01hNlqMxa5wZC Qnz6KggqDF11cX2KBD3S/Jq+kGpBS//aH6+QjCFGU4xYkXRwLFuk0z0O6npWbxv4WZFh e4AA== X-Gm-Message-State: ACgBeo14Nt528U/8Sl5GeNVyHJOcFYL09e1hct7cIqZUYpYz8cr22ZMq ca3BbafAYuRFK2/TC4ttap4anFBAL1ThNHfUH7ILr0joQDY= X-Received: by 2002:a05:6512:c0c:b0:48d:1e9d:aa14 with SMTP id z12-20020a0565120c0c00b0048d1e9daa14mr11136553lfu.322.1662021281851; Thu, 01 Sep 2022 01:34:41 -0700 (PDT) MIME-Version: 1.0 References: <20220829062202.3287-1-zong.li@sifive.com> <20220830082620.1680602-1-ben.dooks@sifive.com> In-Reply-To: From: Zong Li Date: Thu, 1 Sep 2022 16:34:30 +0800 Message-ID: Subject: Re: [PATCH] soc: sifive: ccache: reduce printing on init To: Ben Dooks Cc: Zong Li , Ben Dooks , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greentime Hu , "linux-kernel@vger.kernel.org List" , linux-riscv Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Wed, Aug 31, 2022 at 11:55 PM Ben Dooks wrote: > > On 31/08/2022 06:22, Zong Li wrote: > > Ben Dooks =E6=96=BC 2022=E5=B9=B48=E6=9C=88= 31=E6=97=A5 =E9=80=B1=E4=B8=89 =E5=87=8C=E6=99=A81:04=E5=AF=AB=E9=81=93=EF= =BC=9A > >> > >> On 30/08/2022 17:30, Conor.Dooley@microchip.com wrote: > >>> On 30/08/2022 09:26, Ben Dooks wrote: > >>>> EXTERNAL EMAIL: Do not click links or open attachments unless you kn= ow the content is safe > >>>> > >>>> The driver prints out 6 lines on startup, which can easily be redcue= d > >>>> to two lines without losing any information. > >>>> > >>>> Note, to make the types work better, uint64_t has been replaced with > >>>> ULL to make the unsigned long long match the format in the print > >>>> statement. > >>>> > >>>> Signed-off-by: Ben Dooks > >>>> --- > >>>> drivers/soc/sifive/sifive_ccache.c | 25 +++++++++++-------------- > >>>> 1 file changed, 11 insertions(+), 14 deletions(-) > >>>> > >>>> diff --git a/drivers/soc/sifive/sifive_ccache.c b/drivers/soc/sifive= /sifive_ccache.c > >>>> index 46ce33db7d30..65a10a6ee211 100644 > >>>> --- a/drivers/soc/sifive/sifive_ccache.c > >>>> +++ b/drivers/soc/sifive/sifive_ccache.c > >>>> @@ -76,20 +76,17 @@ static void setup_sifive_debug(void) > >>>> > >>>> static void ccache_config_read(void) > >>>> { > >>>> - u32 regval, val; > >>>> - > >>>> - regval =3D readl(ccache_base + SIFIVE_CCACHE_CONFIG); > >>>> - val =3D regval & 0xFF; > >>>> - pr_info("CCACHE: No. of Banks in the cache: %d\n", val); > >>>> - val =3D (regval & 0xFF00) >> 8; > >>>> - pr_info("CCACHE: No. of ways per bank: %d\n", val); > >>>> - val =3D (regval & 0xFF0000) >> 16; > >>>> - pr_info("CCACHE: Sets per bank: %llu\n", (uint64_t)1 << val)= ; > >>>> - val =3D (regval & 0xFF000000) >> 24; > >>>> - pr_info("CCACHE: Bytes per cache block: %llu\n", (uint64_t)1= << val); > >>>> - > >>>> - regval =3D readl(ccache_base + SIFIVE_CCACHE_WAYENABLE); > >>>> - pr_info("CCACHE: Index of the largest way enabled: %d\n", re= gval); > >>>> + u32 cfg; > >>>> + > >>>> + cfg =3D readl(ccache_base + SIFIVE_CCACHE_CONFIG); > >>>> + > >>>> + pr_info("CCACHE: %u banks, %u ways, sets/bank=3D%llu, bytes/= block=3D%llu\n", > >>>> + (cfg & 0xff), (cfg >> 8) & 0xff, > >>>> + 1ULL << ((cfg >> 16) & 0xff), > >>> > >>> This is just BIT_ULL((cfg >> 16) & 0xff), no? > >>> Would be nice too if these were defined, so you'd have something > >>> like BIT_ULL((cfg >> SETS_PER_BANK_SHIFT) & 0xff) > >>> > >>> I do like the cleanup of the uint64_t & cutting down on the prints > >>> though :) Again, it'd be nice if you and Zong could collaborate on > >>> a combined v2. > >> > >> I think even BIT_UL() would do here, if someone is going to make a > >> cache bigger than 2GiB we'll probably be quite old by then, so v2 > >> might have the last two values down as %lu. > >> > > > > Hi Ben, > > Thanks for your suggestion, If you don't mind, I will take this into > > my V2 patchset. > > Thanks. > > I may well post v2 of this tomorrow with the BIT_ULL() suggestions > from Conor, or even down to BIT_UL() and use %lu as noted. > No problem Ben. Could you please also add me in the thread of your v2, then I can take it and send out my v2 patchset. Thanks. > > > >>> Thanks, > >>> Conor. > >>> > >>>> + 1ULL << ((cfg >> 24) & 0xff)); > >>>> + > >>>> + cfg =3D readl(ccache_base + SIFIVE_CCACHE_WAYENABLE); > >>>> + pr_info("CCACHE: Index of the largest way enabled: %d\n", cf= g); > >>>> } > >>>> > >>>> static const struct of_device_id sifive_ccache_ids[] =3D { > >>>> -- > >>>> 2.35.1 > >>>> > >>> > >>> _______________________________________________ > >>> linux-riscv mailing list > >>> linux-riscv@lists.infradead.org > >>> http://lists.infradead.org/mailman/listinfo/linux-riscv > >>> > >> > >> -- > >> Ben Dooks http://www.codethink.co.uk/ > >> Senior Engineer Codethink - Providing Genius > >> > >> https://www.codethink.co.uk/privacy.html > >> > >> > >> _______________________________________________ > >> linux-riscv mailing list > >> linux-riscv@lists.infradead.org > >> http://lists.infradead.org/mailman/listinfo/linux-riscv >