Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp653820pxa; Wed, 12 Aug 2020 10:16:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQU4UfvibUbxT4GbSrANiaa8SDMkrFuXwlrfVqGiXBoRpqvZ2iq+14rlLOQUZHxTK9ODRZ X-Received: by 2002:a50:9e4c:: with SMTP id z70mr890616ede.384.1597252566281; Wed, 12 Aug 2020 10:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597252566; cv=none; d=google.com; s=arc-20160816; b=RwdkcMnO99I+PN9XLJBxrudzyzOyHstgRRYIB9QKKbNsK8wxpIqNuWFhvruO528yhJ fjJ70Py01vJn8NcCu63yDZUceIC6PtILzB1Dar41CCutl3MSpjGDgnzm06aU5W7jkAd2 2PbuDBeC+nl4dkp/kzBTRQ7LZjtijE7p9CC/zgkgUF32rdzaFNsnXudgDV60XlpYfuE/ xvSqZblmT7w4U+2COsdvLlGo3z89qVHT8ydqfWymfImppw9wYcyfhaPYd9jwYFQW+hqk iI/zvDsOwUazFW0vh5jYZmN20vipIBdB4160L939YEL+lRZKBnmeLyykz2W+05jOXrRR q2rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=vmit0zvJ/+aQMlekx6GyOUAp2W179eJeRhhRLjR5tzE=; b=EYG910A8pStK3yRE3Xi4ccVLk6kMsXCmMTMGQLucsoG1GbSCOfYaHBFH59ZaILJy1d oHRKMEJUPbz8DyVZbqTI8VqgkcnTO8d/tqkHTC9B6zYXnvKGGL4sbdQ3z+s4g5TgOGGO SIsTD3fEEsq7p+WQn9TeSkYq9SoNtiqKEG0CbJuCSE8mlrW6ZMwre6yAKuRdWPWQcRJN dKcBVTWElEdaOw4cskQK7KhxXOKiAJrf/ME3T0I+u+IPoalyNXCTyNXMAm+tG2D8p+Op 7Rr9V1Y5RtjclVtSnGPOTWQzrpTovvhTaBrbQW6g6i9Jgo4TDRrlDoRXE4nhhyuCpSJI yGxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PrLij+UH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i21si1630580eje.143.2020.08.12.10.15.43; Wed, 12 Aug 2020 10:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PrLij+UH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726523AbgHLROY (ORCPT + 99 others); Wed, 12 Aug 2020 13:14:24 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:46926 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbgHLROW (ORCPT ); Wed, 12 Aug 2020 13:14:22 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597252461; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=vmit0zvJ/+aQMlekx6GyOUAp2W179eJeRhhRLjR5tzE=; b=PrLij+UHLoor7iV0lDhNQRYKc7TyWozV3zDHlqKfI0pCvWBx/Qq1BHbYVo5dVme9VfCgo/vb BSl263/F1t9Adlqeu2YSJ6pVMH05JKJn+s1lmmYfZKw0IFidoHWfGVTFmTC23gUPmLpt4ojE 9TNZjLr6CpxTdji1W2ZuBko0ZT4= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-east-1.postgun.com with SMTP id 5f3420c1f2b697637a23c938 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 12 Aug 2020 17:02:57 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 010A8C433A0; Wed, 12 Aug 2020 17:02:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: sibis) by smtp.codeaurora.org (Postfix) with ESMTPSA id 03288C433C9; Wed, 12 Aug 2020 17:02:54 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 12 Aug 2020 22:32:54 +0530 From: Sibi Sankar To: Ulf Hansson Cc: Bjorn Andersson , "Rafael J. Wysocki" , Andy Gross , Linux Kernel Mailing List , linux-arm-msm , Linux PM , Greg Kroah-Hartman , Pavel Machek , Len Brown , Rajendra Nayak , Doug Anderson , linux-kernel-owner@vger.kernel.org, Kevin Hilman Subject: Re: [PATCH 1/2] PM / Domains: Add GENPD_FLAG_SUSPEND_ON flag In-Reply-To: References: <20200811190252.10559-1-sibis@codeaurora.org> Message-ID: <1ba3e4d703dd0a52547d63fa014451eb@codeaurora.org> X-Sender: sibis@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Uffe, Thanks for taking time to review the series! On 2020-08-12 15:15, Ulf Hansson wrote: > On Tue, 11 Aug 2020 at 21:03, Sibi Sankar wrote: >> >> This is for power domains which needs to stay powered on for suspend >> but can be powered on/off as part of runtime PM. This flag is aimed at >> power domains coupled to remote processors which enter suspend states >> independent to that of the application processor. Such power domains >> are turned off only on remote processor crash/shutdown. > > As Kevin also requested, please elaborate more on the use case. > > Why exactly must the PM domain stay powered on during system suspend? > Is there a wakeup configured that needs to be managed - or is there a > co-processor/FW behaviour that needs to be obeyed to? Yes this is a co-processor behavior that needs to be obeyed. Specifically application processor notifies the Always on Subsystem (AOSS) that a particular co-processor is up using the power domains exposed by AOSS QMP driver. AOSS uses this information to wait for the co-processors to suspend before starting its sleep sequence. The application processor powers off these power domains only if the co-processor has crashed or powered off. > > Kind regards > Uffe > >> >> Signed-off-by: Sibi Sankar >> --- >> drivers/base/power/domain.c | 3 ++- >> include/linux/pm_domain.h | 5 +++++ >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c >> index 2cb5e04cf86cd..ba78ac4a450d4 100644 >> --- a/drivers/base/power/domain.c >> +++ b/drivers/base/power/domain.c >> @@ -129,6 +129,7 @@ static const struct genpd_lock_ops genpd_spin_ops >> = { >> #define genpd_is_active_wakeup(genpd) (genpd->flags & >> GENPD_FLAG_ACTIVE_WAKEUP) >> #define genpd_is_cpu_domain(genpd) (genpd->flags & >> GENPD_FLAG_CPU_DOMAIN) >> #define genpd_is_rpm_always_on(genpd) (genpd->flags & >> GENPD_FLAG_RPM_ALWAYS_ON) >> +#define genpd_is_suspend_on(genpd) (genpd->flags & >> GENPD_FLAG_SUSPEND_ON) >> >> static inline bool irq_safe_dev_in_no_sleep_domain(struct device >> *dev, >> const struct generic_pm_domain *genpd) >> @@ -949,7 +950,7 @@ static void genpd_sync_power_off(struct >> generic_pm_domain *genpd, bool use_lock, >> { >> struct gpd_link *link; >> >> - if (!genpd_status_on(genpd) || genpd_is_always_on(genpd)) >> + if (!genpd_status_on(genpd) || genpd_is_always_on(genpd) || >> genpd_is_suspend_on(genpd)) >> return; >> >> if (genpd->suspended_count != genpd->device_count >> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h >> index ee11502a575b0..3002a2d68936a 100644 >> --- a/include/linux/pm_domain.h >> +++ b/include/linux/pm_domain.h >> @@ -55,6 +55,10 @@ >> * >> * GENPD_FLAG_RPM_ALWAYS_ON: Instructs genpd to always keep the PM >> domain >> * powered on except for system suspend. >> + * >> + * GENPD_FLAG_SUSPEND_ON: Instructs genpd to keep the PM domain >> powered >> + * on during suspend and runtime PM >> controlled >> + * otherwise. >> */ >> #define GENPD_FLAG_PM_CLK (1U << 0) >> #define GENPD_FLAG_IRQ_SAFE (1U << 1) >> @@ -62,6 +66,7 @@ >> #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) >> #define GENPD_FLAG_CPU_DOMAIN (1U << 4) >> #define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5) >> +#define GENPD_FLAG_SUSPEND_ON (1U << 6) >> >> enum gpd_status { >> GPD_STATE_ACTIVE = 0, /* PM domain is active */ >> -- >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora >> Forum, >> a Linux Foundation Collaborative Project >> -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.