From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB6CCC74A35 for ; Thu, 11 Jul 2019 15:15:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0E9821019 for ; Thu, 11 Jul 2019 15:15:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="t8ayNJ+h"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VFbVfXvY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0E9821019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=stxYMR07/NQvOpeZhav3u9iQ9wbFPJjmyF2wyOGszns=; b=t8ayNJ+haxGbwO zQyuUmcdUezkuEpIaiMp9lQ2bK3dd4/3NQyRAH7szuYp8cK4EoDwo1sjgUuFlhbygNy0AJDaInsWj A6DTzoCfWe7BiBeVVEe2AnpDKtsIug/onjbVdAIH16oxXhjUuCtWtGOj0/XnXf5oszJHJTmFIzfEA fOcPDHMep+HlQH6XBpcuTQvaP/i2ShY18prz8jvkDkeTpEKk8/B7toiRaq9Rv1zOuvFlZkBVVgTch OOYOUhI/ATexVRr5pzsNrGfB69US2L+htaV4jBmzV7hh8AIhNIU9n4RF3xPIpZQ3WvHfy+sVSPs4V Zms3vQg+o9GXcXnh9otA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hlan9-0002bN-5u; Thu, 11 Jul 2019 15:15:27 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hlan5-0002aq-BV for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2019 15:15:24 +0000 Received: by mail-pf1-x443.google.com with SMTP id q10so2897112pff.9 for ; Thu, 11 Jul 2019 08:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xSAfzihkBVubvwbGX9ZrlE6NTtzUO3EOukswRzxGahk=; b=VFbVfXvYNAmrk8fEvvRWt5qmnjJGk0vBhLfcOJ5/cL7y3yFfU4LztkHnr7wHWcZ/Jv VSNlf6h+TrpDM0KLVXdxI1373NscxYlyHtnQd7wW0W8Y3rbtGCo3w8guIQdXVhdB8Ts1 JOzHxHgsiXG6VcEN4oQkiWDLb7QnlGTmPBCzY8cMs0mfQzu3qwPhM2eM/GU9d7r/6AKl yAMETZcXypWr0loYBlDTq4K336w8Y6ELlf8B38wdd3glvHhnUBX7LfJaB1tUosr0s+i8 GXzOju3i50puudzMmvEq/oGHcU3QBG4TSThxvls3piC9D/nG6E8V4iZmWXkb34ToNURI 2TjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xSAfzihkBVubvwbGX9ZrlE6NTtzUO3EOukswRzxGahk=; b=rSilxoL/u3swMRtsaWcZ7fKQxOnyuudTXPDzlrmnborpa/+xWNEUhZQcXCJVYwu47D LkXsyTk131XmrH7ukUWChvcImu3AliItbH5nWc0PgHuJkGVvNfMzlvXWENobaYBxjqZJ VO+2DWvPRrdyZGkizScW4Wt7pNcYRLHfdhnTziyCObSx6L3YrKJfm9EVQzEKfu9R8fe/ 6RPSoXmGaqsbrf443DnwZmVx6zolRzU8ImAgn/1aqI+S2AwLeiUbJmFx2RWoC5o7LsC+ NGmPY0H0CcsaQPIS0CCgeBX62XqDosstzpCJnnfuGaC1wM8sHwzslzppWn4yjh68knai PI0g== X-Gm-Message-State: APjAAAUoN9A0dqaHvpVBF68K+hs1U/DfX1tbZHCu6GNH+0/uAIgt6YtF z2AXyc1qqC1YLmLvWafRA6LmBQ== X-Google-Smtp-Source: APXvYqzmMtkuBfKjFvauyK+dpeSUQ1cBgUt9Vc22gTwPWrIDaxvy+lhE4EouscliQ8F41wdlpdEGrQ== X-Received: by 2002:a17:90a:7d04:: with SMTP id g4mr5476744pjl.41.1562858122182; Thu, 11 Jul 2019 08:15:22 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id 64sm6083195pfe.128.2019.07.11.08.15.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 08:15:21 -0700 (PDT) Date: Thu, 11 Jul 2019 08:16:31 -0700 From: Bjorn Andersson To: Jorge Ramirez-Ortiz Subject: Re: [PATCH v3 08/14] clk: qcom: hfpll: CLK_IGNORE_UNUSED Message-ID: <20190711151631.GI7234@tuxbook-pro> References: <20190625164733.11091-1-jorge.ramirez-ortiz@linaro.org> <20190625164733.11091-9-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190625164733.11091-9-jorge.ramirez-ortiz@linaro.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190711_081523_408506_D0EB6799 X-CRM114-Status: GOOD ( 23.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, heiko@sntech.de, mturquette@baylibre.com, will.deacon@arm.com, david.brown@linaro.org, linux-clk@vger.kernel.org, jassisinghbrar@gmail.com, sibis@codeaurora.org, jagan@amarulasolutions.com, devicetree@vger.kernel.org, niklas.cassel@linaro.org, arnd@arndb.de, linux-arm-msm@vger.kernel.org, olof@lixom.net, robh+dt@kernel.org, horms+renesas@verge.net.au, linux-arm-kernel@lists.infradead.org, sboyd@kernel.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org, vkoul@kernel.org, khasim.mohammed@linaro.org, enric.balletbo@collabora.com, georgi.djakov@linaro.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue 25 Jun 09:47 PDT 2019, Jorge Ramirez-Ortiz wrote: > When COMMON_CLK_DISABLED_UNUSED is set, in an effort to save power and > to keep the software model of the clock in line with reality, the > framework transverses the clock tree and disables those clocks that > were enabled by the firmware but have not been enabled by any device > driver. > > If CPUFREQ is enabled, early during the system boot, it might attempt > to change the CPU frequency ("set_rate"). If the HFPLL is selected as > a provider, it will then change the rate for this clock. > > As boot continues, clk_disable_unused_subtree will run. Since it wont > find a valid counter (enable_count) for a clock that is actually > enabled it will attempt to disable it which will cause the CPU to > stop. But if CPUfreq has acquired the CPU clock and the hfpll is the currently selected input, why does the clock framework not know about this clock being used? > Notice that in this driver, calls to check whether the clock is > enabled are routed via the is_enabled callback which queries the > hardware. > > The following commit, rather than marking the clock critical and > forcing the clock to be always enabled, addresses the above scenario > making sure the clock is not disabled but it continues to rely on the > firmware to enable the clock. > > Co-developed-by: Niklas Cassel > Signed-off-by: Niklas Cassel > Signed-off-by: Jorge Ramirez-Ortiz I can see that we have a real issue in the case where CPUfreq is not enabled and hence there are no clients, according to Linux. And that I don't know another way to guard against. Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/clk/qcom/hfpll.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c > index 0ffed0d41c50..d5fd27938e7b 100644 > --- a/drivers/clk/qcom/hfpll.c > +++ b/drivers/clk/qcom/hfpll.c > @@ -58,6 +58,13 @@ static int qcom_hfpll_probe(struct platform_device *pdev) > .parent_names = (const char *[]){ "xo" }, > .num_parents = 1, > .ops = &clk_ops_hfpll, > + /* > + * rather than marking the clock critical and forcing the clock > + * to be always enabled, we make sure that the clock is not > + * disabled: the firmware remains responsible of enabling this > + * clock (for more info check the commit log) > + */ > + .flags = CLK_IGNORE_UNUSED, > }; > > h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); > -- > 2.21.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel