Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4637598imm; Wed, 30 May 2018 09:07:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ3lV3ZISD3iy3NrkRMNM3d1hCP/uQTiPXu6pvfrNNZRKyCFbR+vumNq8DTDoZlBLyF0GJL X-Received: by 2002:a17:902:748b:: with SMTP id h11-v6mr3492123pll.12.1527696449224; Wed, 30 May 2018 09:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527696449; cv=none; d=google.com; s=arc-20160816; b=YAwnQT+CZ6AivozbO90J9OUtTJCeMIpKA+VPQwKjw542p4OyyU+IkYlusxWwCyKHo4 UYMToKFc8oFW6stDTFU88rsx98eVeHFIilE8X1ySM+5PVBzl5rsfOaRA6/836VlRoJG0 pU8h7JjlXeBERqpCsPsC7WqAyobZtOShyIgndeM99MERjY0aYE+dd57uJu+bKkMzZTSb m8osIt9QNgp1yrY96qRimHneOmU+89UhJMQoE3bNQOB7dAtxrggouIF+fy9JZw7QBfK+ xQPCbYuUDYcXcfPxbg1qdIoP10DnXU9JOqEDITFZV+9NjOlX3Vw98TEvw+3WzFCviVhN uxZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=tT/B8ill7Qbx/RiYloVxw+KVl0Z95mJFkaUpASINlq4=; b=jJxg/bjRMIKgqHQG8AjuGRI6Chs+HmBuZ++d5xavzOg89LxWxirXXB9haCa1Qo10kw ihDNIt47R2q152//pHEmwJidKHN+oU9c8DYV9mOA/Oc4ZMNNOlkAhohz3t2qeMchTUQq tzh6BaVASUpGtxdMRfKf9KgUq/nONZsK7kWj7OT3J6KXQvJJMv72/C+uctSeFvSmSPy4 PIRuBO7la9sgTQ7mZVIu5tQRgh36BHqdXBg37BggtM/rAclIndAD49uFDntAKibxlU3J tU6tqDV4KS/EY+vRB1+TgF+lnCutSSXP8qcWVznpVo3ON19CT3JoD8UnA4g7VC87E22A CKBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si34359314pld.116.2018.05.30.09.07.15; Wed, 30 May 2018 09:07:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753611AbeE3QG3 (ORCPT + 99 others); Wed, 30 May 2018 12:06:29 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:5653 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751300AbeE3QGZ (ORCPT ); Wed, 30 May 2018 12:06:25 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Wed, 30 May 2018 09:06:22 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 30 May 2018 09:06:24 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 30 May 2018 09:06:24 -0700 Received: from [10.21.132.148] (172.20.13.39) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 30 May 2018 16:06:12 +0000 Subject: Re: [PATCH v2 6/9] PM / Domains: Don't attach devices in genpd with multi PM domains To: Ulf Hansson , "Rafael J . Wysocki" , CC: Greg Kroah-Hartman , Geert Uytterhoeven , Todor Tomov , "Rajendra Nayak" , Viresh Kumar , Vincent Guittot , Kevin Hilman , , , , "Rob Herring" , References: <20180529100421.31022-1-ulf.hansson@linaro.org> <20180529100421.31022-7-ulf.hansson@linaro.org> From: Jon Hunter Message-ID: <3b5072bb-f4bb-3f71-9575-5263cdf0b09f@nvidia.com> Date: Wed, 30 May 2018 17:06:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180529100421.31022-7-ulf.hansson@linaro.org> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL103.nvidia.com (172.20.187.11) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/05/18 11:04, Ulf Hansson wrote: > The power-domain DT property may now contain a list of PM domain > specifiers, which represents that a device are partitioned across multiple > PM domains. This leads to a new situation in genpd_dev_pm_attach(), as only > one PM domain can be attached per device. > > To remain things simple for the most common configuration, when a single PM > domain is used, let's treat the multiple PM domain case as being specific. > > In other words, let's change genpd_dev_pm_attach() to check for multiple PM > domains and prevent it from attach any PM domain for this case. Instead, > leave this to be managed separately, from following changes to genpd. > > Cc: Rob Herring > Cc: devicetree@vger.kernel.org > Suggested-by: Jon Hunter > Signed-off-by: Ulf Hansson > --- > > Changes in v2: > - Minor update to changelog to mention "PM domain specifiers" rather > than a "list of phandles". > > --- > drivers/base/power/domain.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 7ebf7993273a..12a20f21974d 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2229,10 +2229,10 @@ static void genpd_dev_pm_sync(struct device *dev) > * attaches the device to retrieved pm_domain ops. > * > * Returns 1 on successfully attached PM domain, 0 when the device don't need a > - * PM domain or a negative error code in case of failures. Note that if a > - * power-domain exists for the device, but it cannot be found or turned on, > - * then return -EPROBE_DEFER to ensure that the device is not probed and to > - * re-try again later. > + * PM domain or when multiple power-domains exists for it, else a negative error > + * code. Note that if a power-domain exists for the device, but it cannot be > + * found or turned on, then return -EPROBE_DEFER to ensure that the device is > + * not probed and to re-try again later. > */ > int genpd_dev_pm_attach(struct device *dev) > { > @@ -2243,10 +2243,18 @@ int genpd_dev_pm_attach(struct device *dev) > if (!dev->of_node) > return 0; > > + /* > + * Devices with multiple PM domains must be attached separately, as we > + * can only attach one PM domain per device. > + */ > + if (of_count_phandle_with_args(dev->of_node, "power-domains", > + "#power-domain-cells") != 1) > + return 0; > + > ret = of_parse_phandle_with_args(dev->of_node, "power-domains", > "#power-domain-cells", 0, &pd_args); > if (ret < 0) > - return 0; > + return ret; > > mutex_lock(&gpd_list_lock); > pd = genpd_get_from_provider(&pd_args); > Acked-by: Jon Hunter Tested-by: Jon Hunter Cheers Jon -- nvpublic