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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 47581C433DF for ; Fri, 10 Jul 2020 12:18:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 0E92C20748 for ; Fri, 10 Jul 2020 12:18:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nYQSfHnO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E92C20748 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TlOVHx7TzRiVHVnf4zKiP1jnZFhJXKhcrcjxj80bYA4=; b=nYQSfHnOYxu3MnUvYNIyurcOH 23mb0K5W/Jms1L/I3D/g1i1WMaa6b/b5Mu1uzuLMvIwkzmbXxTYhkXLWdDvOi2SY8DS9bENU52nHf ZPbPwSyKeGMhFXOWc8XualZZxZuPOtrQPvkR3GAydneA6aTszRbGyMmxWWE4EHlc9fWkaZm7dr5Wv P8G+v48rfvDiUkrheZkusktYqGxbQjmjR7X7+cIKo+TlgxwER5TPIJNPKvjFDqkWrDGVXE80JqPjo bZmP1eJEdaXu3zjQz9uKXofHsBB1wfqXJ4E99InQDGDWklLJONOjC+dF7Og5IwBlrp3GFcrLxGGeo FVSfLCZEA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtrxX-0000WX-Rj; Fri, 10 Jul 2020 12:16:55 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtrxU-0000Va-M7 for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 12:16:53 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BEA19C0A; Fri, 10 Jul 2020 05:16:47 -0700 (PDT) Received: from [10.37.12.58] (unknown [10.37.12.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3FF483F8C6; Fri, 10 Jul 2020 05:16:44 -0700 (PDT) Subject: Re: [PATCH v2 5/5] cpuidle: psci: Prevent domain idlestates until consumers are ready To: Ulf Hansson , Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org References: <20200707125804.13030-1-ulf.hansson@linaro.org> <20200707125804.13030-6-ulf.hansson@linaro.org> From: Lukasz Luba Message-ID: <11a26809-1fb0-c09e-9f74-eddeec9180ff@arm.com> Date: Fri, 10 Jul 2020 13:16:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200707125804.13030-6-ulf.hansson@linaro.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_081652_826443_DE55994F X-CRM114-Status: GOOD ( 27.89 ) 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: Vincent Guittot , Benjamin Gaignard , Saravana Kannan , Stephen Boyd , Daniel Lezcano , "Rafael J . Wysocki" , Lina Iyer , Bjorn Andersson , linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 7/7/20 1:58 PM, Ulf Hansson wrote: > Depending on the SoC/platform, additional devices may be part of the PSCI > PM domain topology. This is the case with 'qcom,rpmh-rsc' device, for > example, even if this is not yet visible in the corresponding DTS-files. I was interested by your description and checked related DT to this device. It's probably the best what we can do in such situation and such requirements. > > Without going into too much details, a device like the 'qcom,rpmh-rsc' may > have HW constraints that needs to be obeyed to, before a domain idlestate > can be picked. > > Therefore, let's implement the ->sync_state() callback to receive a > notification when all consumers of the PSCI PM domain providers have been > attached/probed to it. In this way, we can make sure all constraints from > all relevant devices, are taken into account before allowing a domain > idlestate to be picked. > > Acked-by: Saravana Kannan > Signed-off-by: Ulf Hansson Reviewed-by: Lukasz Luba > --- > drivers/cpuidle/cpuidle-psci-domain.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c > index bf527d2bb4b6..b6e9649ab0da 100644 > --- a/drivers/cpuidle/cpuidle-psci-domain.c > +++ b/drivers/cpuidle/cpuidle-psci-domain.c > @@ -27,6 +27,7 @@ struct psci_pd_provider { > }; > > static LIST_HEAD(psci_pd_providers); > +static bool psci_pd_allow_domain_state; > > static int psci_pd_power_off(struct generic_pm_domain *pd) > { > @@ -36,6 +37,9 @@ static int psci_pd_power_off(struct generic_pm_domain *pd) > if (!state->data) > return 0; > > + if (!psci_pd_allow_domain_state) > + return -EBUSY; > + > /* OSI mode is enabled, set the corresponding domain state. */ > pd_state = state->data; > psci_set_domain_state(*pd_state); > @@ -222,6 +226,15 @@ static void psci_pd_remove_topology(struct device_node *np) > psci_pd_init_topology(np, false); > } > > +static void psci_cpuidle_domain_sync_state(struct device *dev) > +{ > + /* > + * All devices have now been attached/probed to the PM domain topology, > + * hence it's fine to allow domain states to be picked. > + */ > + psci_pd_allow_domain_state = true; > +} > + > static const struct of_device_id psci_of_match[] = { > { .compatible = "arm,psci-1.0" }, > {} > @@ -289,6 +302,7 @@ static struct platform_driver psci_cpuidle_domain_driver = { > .driver = { > .name = "psci-cpuidle-domain", > .of_match_table = psci_of_match, > + .sync_state = psci_cpuidle_domain_sync_state, > }, > }; > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel