Skip to contentSkip to conversation

PM / Domains: Add GENPD_FLAG_NO_SUSPEND/RESUME flags

PATCH In review Sibi Sankar 5 participants 15 messages Aug 21, 2020 – Sep 22, 2020 1 message not in the archive

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 PM / Domains: Add GENPD_FLAG_NO_SUSPEND/RESUME flags

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

---

V2:
* Add more info in commit msg and description [Uffe/Kevin/Stephen]
* Rename and split functionality into two flags [Uffe]
* Drop R-b/T-b

 drivers/base/power/domain.c |  6 ++++--
 include/linux/pm_domain.h   | 10 ++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/base/power/domain.c +4 -2
index 2cb5e04cf86cd..a5df5916f30f8 100644
@@ -129,6 +129,8 @@ 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_no_suspend(genpd)	(genpd->flags & GENPD_FLAG_NO_SUSPEND)
+#define genpd_is_no_resume(genpd)	(genpd->flags & GENPD_FLAG_NO_RESUME)
 
 static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev,
 		const struct generic_pm_domain *genpd)
@@ -949,7 +951,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_no_suspend(genpd))
 		return;
 
 	if (genpd->suspended_count != genpd->device_count
@@ -991,7 +993,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
 {
 	struct gpd_link *link;
 
-	if (genpd_status_on(genpd))
+	if (genpd_status_on(genpd) || genpd_is_no_resume(genpd))
 		return;
 
 	list_for_each_entry(link, &genpd->child_links, child_node) {
include/linux/pm_domain.h +10 -0
index ee11502a575b0..568abdf2e89cf 100644
@@ -55,6 +55,14 @@
  *
  * GENPD_FLAG_RPM_ALWAYS_ON:	Instructs genpd to always keep the PM domain
  *				powered on except for system suspend.
+ *
+ * GENPD_FLAG_NO_SUSPEND:	Instructs genpd to keep the PM domain powered
+ *				on during suspend (if it's already powered on)
+ *				and runtime PM controlled otherwise.
+ *
+ * GENPD_FLAG_NO_RESUME:	Instructs genpd to keep the PM domain powered
+ *				off during resume (if it's already powered off)
+ *				and runtime PM controlled otherwise.
  */
 #define GENPD_FLAG_PM_CLK	 (1U << 0)
 #define GENPD_FLAG_IRQ_SAFE	 (1U << 1)
@@ -62,6 +70,8 @@
 #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_NO_SUSPEND	 (1U << 6)
+#define GENPD_FLAG_NO_RESUME	 (1U << 7)
 
 enum gpd_status {
 	GPD_STATE_ACTIVE = 0,	/* PM domain is active */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH v2 2/2 soc: qcom: aoss: Use both GENPD_FLAG_NO_SUSPEND/RESUME flags

All the power domains exposed as part of the AOSS QMP driver require to stay unaltered during suspend/resume. They are powered on when the remote processors boots up and powered off on remote processor crash/shutdown. Mark the power domains with GENPD_FLAG_NO_SUSPEND and GENPD_FLAG_NO_RESUME to model this behavior.

---

V2:
* Use the renamed flags
* Drop R-b/T-b

 drivers/soc/qcom/qcom_aoss.c | 1 +
 1 file changed, 1 insertion(+)
drivers/soc/qcom/qcom_aoss.c +1 -0
index ed2c687c16b31..da763ac6bca2f 100644
@@ -366,6 +366,7 @@ static int qmp_pd_add(struct qmp *qmp)
 		res[i].pd.name = sdm845_resources[i];
 		res[i].pd.power_on = qmp_pd_power_on;
 		res[i].pd.power_off = qmp_pd_power_off;
+		res[i].pd.flags = GENPD_FLAG_NO_SUSPEND | GENPD_FLAG_NO_RESUME;
 
 		ret = pm_genpd_init(&res[i].pd, NULL, true);
 		if (ret < 0) {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
In reply to Sibi Sankar

Quoting Sibi Sankar (2020-08-21 13:49:20)

Quoted 5 lines

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Quoted 8 lines

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Why are these power domains instead of some QMP message sent during remote proc power up? If this has been discussed before feel free to disregard and please link to prior mailing list discussions.

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

#3 lore raw
Quoted 15 lines · Stephen Boyd

Quoting Sibi Sankar (2020-08-21 13:49:20)

Quoted 5 lines

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Quoted 8 lines

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 2 lines

Why are these power domains instead of some QMP message sent during remote proc power up?

The understanding I gained as I researched this, was that with this property enabled resources related to the particular subsystem will be kept enabled when the apss enters some power save mode. So my interpretation was that it does "keep something powered".

Quoted 3 lines

If this has been discussed before feel free to disregard and please link to prior mailing list discussions.

There where some discussions related to the "QDSS clk" in that series, but I don't remember getting any feedback on modelling these things as power-domains.

Quoted 4 lines

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

We need to send "up" and "down" notifications and this needs to happen at the same time as other standard resources are enabled/disabled.

Further more, at the time the all resources handled by the downstream driver was either power-domains (per above understanding) or clocks, so it made sense to me not to spin up a custom API.

Regards,
Bjorn

#4 lore raw

Quoting Bjorn Andersson (2020-08-24 09:42:12)

Quoted 17 lines · Stephen Boyd
Quoted 16 lines

Quoting Sibi Sankar (2020-08-21 13:49:20)

Quoted 13 lines

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 7 lines
Quoted 2 lines

Why are these power domains instead of some QMP message sent during remote proc power up?

The understanding I gained as I researched this, was that with this property enabled resources related to the particular subsystem will be kept enabled when the apss enters some power save mode. So my interpretation was that it does "keep something powered".

It looks like it tells AOSS that the processor is booted and to start considering these processors in the SoC wide system suspend sequence. Otherwise I guess the RPMh buckets associated with these remoteprocs don't count in the aggregation and sleep/wake sequences that AOSS runs through when putting the SoC into low power mode. I'm not sure it actually "keeps something powered" so much as it lets something be powered off. Sibi?

Another question, why can't the processors tell AOSS themselves about their boot state? I guess because they may crash or be powered down and then AOSS wouldn't know? Fair enough I guess, but I don't think this is mentioned anywhere.

Quoted 14 lines
Quoted 4 lines

If this has been discussed before feel free to disregard and please link to prior mailing list discussions.

There where some discussions related to the "QDSS clk" in that series, but I don't remember getting any feedback on modelling these things as power-domains.

Quoted 4 lines

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

Quoted 7 lines

We need to send "up" and "down" notifications and this needs to happen at the same time as other standard resources are enabled/disabled.

Further more, at the time the all resources handled by the downstream driver was either power-domains (per above understanding) or clocks, so it made sense to me not to spin up a custom API.

So the benefit is not spinning up a custom API? I'm not Ulf, but it looks like this is hard to rationalize about as a power domain. It doesn't have any benefit to model it this way besides to make it possible to turn on with other power domains.

This modem remoteproc drivers isn't SoC agnostic anyway, it relies on SMEM APIs, so standing up another small qmp_remoteproc_booted() and qmp_remoteproc_shutdown() API would avoid adding a genpd flag here that probably will never be used outside of this corner-case. There is also some get/put EPROBE_DEFER sort of logic to implement, but otherwise it would be possible to do this outside of power domains, and that seems better given that this isn't really a power domain to start with.

#5 lore raw
Quoted 26 lines · Stephen Boyd

Quoting Bjorn Andersson (2020-08-24 09:42:12)

Quoted 17 lines · Stephen Boyd
Quoted 16 lines

Quoting Sibi Sankar (2020-08-21 13:49:20)

Quoted 13 lines

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 7 lines
Quoted 2 lines

Why are these power domains instead of some QMP message sent during remote proc power up?

The understanding I gained as I researched this, was that with this property enabled resources related to the particular subsystem will be kept enabled when the apss enters some power save mode. So my interpretation was that it does "keep something powered".

Quoted 7 lines

It looks like it tells AOSS that the processor is booted and to start considering these processors in the SoC wide system suspend sequence. Otherwise I guess the RPMh buckets associated with these remoteprocs don't count in the aggregation and sleep/wake sequences that AOSS runs through when putting the SoC into low power mode. I'm not sure it actually "keeps something powered" so much as it lets something be powered off. Sibi?

That is just a part of equation i.e AOSS doesn't enter sleep until the remote processors enter RPMh assisted sleep. This also implies that if the respective remote processor has to come out of low power states it will need to wait for AOSS to come out of sleep. So clearly remote processors are dependent on certain resources to be enabled by the AOSS but the resources may not be restricted to just corners.

Quoted 40 lines

Another question, why can't the processors tell AOSS themselves about their boot state? I guess because they may crash or be powered down and then AOSS wouldn't know? Fair enough I guess, but I don't think this is mentioned anywhere.

Quoted 14 lines
Quoted 4 lines

If this has been discussed before feel free to disregard and please link to prior mailing list discussions.

There where some discussions related to the "QDSS clk" in that series, but I don't remember getting any feedback on modelling these things as power-domains.

Quoted 4 lines

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

Quoted 7 lines

We need to send "up" and "down" notifications and this needs to happen at the same time as other standard resources are enabled/disabled.

Further more, at the time the all resources handled by the downstream driver was either power-domains (per above understanding) or clocks, so it made sense to me not to spin up a custom API.

So the benefit is not spinning up a custom API? I'm not Ulf, but it looks like this is hard to rationalize about as a power domain. It doesn't have any benefit to model it this way besides to make it possible to turn on with other power domains.

This modem remoteproc drivers isn't SoC agnostic anyway, it relies on SMEM APIs, so standing up another small qmp_remoteproc_booted() and qmp_remoteproc_shutdown() API would avoid adding a genpd flag here that probably will never be used outside of this corner-case. There is also some get/put EPROBE_DEFER sort of logic to implement, but otherwise it would be possible to do this outside of power domains, and that seems better given that this isn't really a power domain to start with.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
#6 lore raw
In reply to Stephen Boyd
Quoted 2 lines · Stephen Boyd

Quoting Bjorn Andersson (2020-08-24 09:42:12)

Quoted 1 line · Stephen Boyd

[..]

Quoted 18 lines
Quoted 5 lines
Quoted 4 lines

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

Quoted 7 lines

We need to send "up" and "down" notifications and this needs to happen at the same time as other standard resources are enabled/disabled.

Further more, at the time the all resources handled by the downstream driver was either power-domains (per above understanding) or clocks, so it made sense to me not to spin up a custom API.

So the benefit is not spinning up a custom API? I'm not Ulf, but it looks like this is hard to rationalize about as a power domain. It doesn't have any benefit to model it this way besides to make it possible to turn on with other power domains.

Quoted 7 lines

This modem remoteproc drivers isn't SoC agnostic anyway, it relies on SMEM APIs, so standing up another small qmp_remoteproc_booted() and qmp_remoteproc_shutdown() API would avoid adding a genpd flag here that probably will never be used outside of this corner-case. There is also some get/put EPROBE_DEFER sort of logic to implement, but otherwise it would be possible to do this outside of power domains, and that seems better given that this isn't really a power domain to start with.

In later platforms a few new users of the AOSS communication interface is introduced that certainly doesn't fit any existing API/framework in the kernel. So the plan was to pretty much expose qmp_send() to these drivers.

My worry with using this interface is that we'll probably have to come up with some DT binding pieces and probably we'll end up adding yet another piece of hard coded information in the remoteproc drivers.

But I'm not against us doing this work in favor of not having to introduce a one-off for this corner case.

Regards,
Bjorn

#7 lore raw
Quoted 35 lines · Bjorn Andersson
Quoted 2 lines · Stephen Boyd

Quoting Bjorn Andersson (2020-08-24 09:42:12)

Quoted 1 line · Stephen Boyd

[..]

Quoted 18 lines
Quoted 5 lines
Quoted 4 lines

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

Quoted 7 lines

We need to send "up" and "down" notifications and this needs to happen at the same time as other standard resources are enabled/disabled.

Further more, at the time the all resources handled by the downstream driver was either power-domains (per above understanding) or clocks, so it made sense to me not to spin up a custom API.

So the benefit is not spinning up a custom API? I'm not Ulf, but it looks like this is hard to rationalize about as a power domain. It doesn't have any benefit to model it this way besides to make it possible to turn on with other power domains.

Quoted 7 lines

This modem remoteproc drivers isn't SoC agnostic anyway, it relies on SMEM APIs, so standing up another small qmp_remoteproc_booted() and qmp_remoteproc_shutdown() API would avoid adding a genpd flag here that probably will never be used outside of this corner-case. There is also some get/put EPROBE_DEFER sort of logic to implement, but otherwise it would be possible to do this outside of power domains, and that seems better given that this isn't really a power domain to start with.

In later platforms a few new users of the AOSS communication interface is introduced that certainly doesn't fit any existing API/framework in the kernel. So the plan was to pretty much expose qmp_send() to these drivers.

Quoted 6 lines

My worry with using this interface is that we'll probably have to come up with some DT binding pieces and probably we'll end up adding yet another piece of hard coded information in the remoteproc drivers.

But I'm not against us doing this work in favor of not having to introduce a one-off for this corner case.

Bjorn/Stephen,

So the consensus is to stop modelling
aoss load_state as pds and expose qmp_send
to drivers?

Quoted 3 lines

Regards,
Bjorn

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
#8 lore raw
Quoted 42 lines · Sibi Sankar
Quoted 40 lines · Bjorn Andersson
Quoted 2 lines · Stephen Boyd

Quoting Bjorn Andersson (2020-08-24 09:42:12)

Quoted 1 line · Stephen Boyd

[..]

Quoted 18 lines
Quoted 5 lines
Quoted 4 lines

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

Quoted 7 lines

We need to send "up" and "down" notifications and this needs to happen at the same time as other standard resources are enabled/disabled.

Further more, at the time the all resources handled by the downstream driver was either power-domains (per above understanding) or clocks, so it made sense to me not to spin up a custom API.

So the benefit is not spinning up a custom API? I'm not Ulf, but it looks like this is hard to rationalize about as a power domain. It doesn't have any benefit to model it this way besides to make it possible to turn on with other power domains.

Quoted 8 lines

This modem remoteproc drivers isn't SoC agnostic anyway, it relies on SMEM APIs, so standing up another small qmp_remoteproc_booted() and qmp_remoteproc_shutdown() API would avoid adding a genpd flag here that
probably will never be used outside of this corner-case. There is also some get/put EPROBE_DEFER sort of logic to implement, but otherwise it would be possible to do this outside of power domains, and that seems better given that this isn't really a power domain to start with.

In later platforms a few new users of the AOSS communication interface is introduced that certainly doesn't fit any existing API/framework in the kernel. So the plan was to pretty much expose qmp_send() to these drivers.

My worry with using this interface is that we'll probably have to come up with some DT binding pieces and probably we'll end up adding yet another piece of hard coded information in the remoteproc drivers.

Quoted 8 lines
Quoted 2 lines

But I'm not against us doing this work in favor of not having to introduce a one-off for this corner case.

Bjorn/Stephen,

So the consensus is to stop modelling
aoss load_state as pds and expose qmp_send
to drivers?

Would that mean qmp_send would have to be called from generic drivers? Then, please no. We want to keep drivers portable.

Kind regards
Uffe

#9 lore raw
Quoted 46 lines · Ulf Hansson
Quoted 45 lines · Sibi Sankar
Quoted 42 lines · Bjorn Andersson
Quoted 2 lines · Stephen Boyd

Quoting Bjorn Andersson (2020-08-24 09:42:12)

Quoted 1 line · Stephen Boyd

[..]

Quoted 18 lines
Quoted 5 lines
Quoted 4 lines

I find it odd that this is modeled as a power domain instead of some Qualcomm specific message that the remoteproc driver sends to AOSS. Is there some sort of benefit the driver gets from using the power domain APIs for this vs. using a custom API?

Quoted 7 lines

We need to send "up" and "down" notifications and this needs to happen at the same time as other standard resources are enabled/disabled.

Further more, at the time the all resources handled by the downstream driver was either power-domains (per above understanding) or clocks, so it made sense to me not to spin up a custom API.

So the benefit is not spinning up a custom API? I'm not Ulf, but it looks like this is hard to rationalize about as a power domain. It doesn't have any benefit to model it this way besides to make it possible to turn on with other power domains.

Quoted 8 lines

This modem remoteproc drivers isn't SoC agnostic anyway, it relies on SMEM APIs, so standing up another small qmp_remoteproc_booted() and qmp_remoteproc_shutdown() API would avoid adding a genpd flag here that
probably will never be used outside of this corner-case. There is also some get/put EPROBE_DEFER sort of logic to implement, but otherwise it would be possible to do this outside of power domains, and that seems better given that this isn't really a power domain to start with.

In later platforms a few new users of the AOSS communication interface is introduced that certainly doesn't fit any existing API/framework in the kernel. So the plan was to pretty much expose qmp_send() to these drivers.

My worry with using this interface is that we'll probably have to come up with some DT binding pieces and probably we'll end up adding yet another piece of hard coded information in the remoteproc drivers.

But I'm not against us doing this work in favor of not having to introduce a one-off for this corner case.

Quoted 9 lines
Quoted 5 lines

Bjorn/Stephen,

So the consensus is to stop modelling
aoss load_state as pds and expose qmp_send
to drivers?

Would that mean qmp_send would have to be called from generic drivers? Then, please no. We want to keep drivers portable.

No, this is only called from Qualcomm specific drivers. So I'm okay with that approach.

Regards,
Bjorn

Reviewed-by on v2 1/2
#10 lore raw
In reply to Sibi Sankar
Quoted 15 lines · Sibi Sankar

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 1 line

Although, I would like Stephen's question to get an answer in the other thread, before this gets applied.

Kind regards
Uffe

Quoted 74 lines

---

V2:
* Add more info in commit msg and description [Uffe/Kevin/Stephen]
* Rename and split functionality into two flags [Uffe]
* Drop R-b/T-b

 drivers/base/power/domain.c |  6 ++++--
 include/linux/pm_domain.h   | 10 ++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/base/power/domain.c +4 -2
index 2cb5e04cf86cd..a5df5916f30f8 100644
@@ -129,6 +129,8 @@ 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_no_suspend(genpd)     (genpd->flags & GENPD_FLAG_NO_SUSPEND)
+#define genpd_is_no_resume(genpd)      (genpd->flags & GENPD_FLAG_NO_RESUME)
 
 static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev,
                const struct generic_pm_domain *genpd)
@@ -949,7 +951,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_no_suspend(genpd))
                return;
 
        if (genpd->suspended_count != genpd->device_count
@@ -991,7 +993,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
 {
        struct gpd_link *link;
 
-       if (genpd_status_on(genpd))
+       if (genpd_status_on(genpd) || genpd_is_no_resume(genpd))
                return;
 
        list_for_each_entry(link, &genpd->child_links, child_node) {
include/linux/pm_domain.h +10 -1
index ee11502a575b0..568abdf2e89cf 100644
@@ -55,6 +55,14 @@
  *
  * GENPD_FLAG_RPM_ALWAYS_ON:   Instructs genpd to always keep the PM domain
  *                             powered on except for system suspend.
+ *
+ * GENPD_FLAG_NO_SUSPEND:      Instructs genpd to keep the PM domain powered
+ *                             on during suspend (if it's already powered on)
+ *                             and runtime PM controlled otherwise.
+ *
+ * GENPD_FLAG_NO_RESUME:       Instructs genpd to keep the PM domain powered
+ *                             off during resume (if it's already powered off)
+ *                             and runtime PM controlled otherwise.
  */
 #define GENPD_FLAG_PM_CLK       (1U << 0)
 #define GENPD_FLAG_IRQ_SAFE     (1U << 1)
@@ -62,6 +70,8 @@
 #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_NO_SUSPEND   (1U << 6)
+#define GENPD_FLAG_NO_RESUME    (1U << 7)
 
 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

#11 lore raw
In reply to Sibi Sankar
Quoted 15 lines · Sibi Sankar

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 1 line

Applied with the Ulf's R-by along with the [2/2] as 5.10 material, thanks!

Quoted 74 lines

---

V2:
* Add more info in commit msg and description [Uffe/Kevin/Stephen]
* Rename and split functionality into two flags [Uffe]
* Drop R-b/T-b

 drivers/base/power/domain.c |  6 ++++--
 include/linux/pm_domain.h   | 10 ++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/base/power/domain.c +4 -2
index 2cb5e04cf86cd..a5df5916f30f8 100644
@@ -129,6 +129,8 @@ 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_no_suspend(genpd)     (genpd->flags & GENPD_FLAG_NO_SUSPEND)
+#define genpd_is_no_resume(genpd)      (genpd->flags & GENPD_FLAG_NO_RESUME)
 
 static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev,
                const struct generic_pm_domain *genpd)
@@ -949,7 +951,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_no_suspend(genpd))
                return;
 
        if (genpd->suspended_count != genpd->device_count
@@ -991,7 +993,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
 {
        struct gpd_link *link;
 
-       if (genpd_status_on(genpd))
+       if (genpd_status_on(genpd) || genpd_is_no_resume(genpd))
                return;
 
        list_for_each_entry(link, &genpd->child_links, child_node) {
include/linux/pm_domain.h +10 -1
index ee11502a575b0..568abdf2e89cf 100644
@@ -55,6 +55,14 @@
  *
  * GENPD_FLAG_RPM_ALWAYS_ON:   Instructs genpd to always keep the PM domain
  *                             powered on except for system suspend.
+ *
+ * GENPD_FLAG_NO_SUSPEND:      Instructs genpd to keep the PM domain powered
+ *                             on during suspend (if it's already powered on)
+ *                             and runtime PM controlled otherwise.
+ *
+ * GENPD_FLAG_NO_RESUME:       Instructs genpd to keep the PM domain powered
+ *                             off during resume (if it's already powered off)
+ *                             and runtime PM controlled otherwise.
  */
 #define GENPD_FLAG_PM_CLK       (1U << 0)
 #define GENPD_FLAG_IRQ_SAFE     (1U << 1)
@@ -62,6 +70,8 @@
 #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_NO_SUSPEND   (1U << 6)
+#define GENPD_FLAG_NO_RESUME    (1U << 7)
 
 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

A message that is not in the archive (sent off-list or not yet received): 160071818317.4188128.15658877054019388462@swboyd.mtv.corp.google.com

#13 lore raw
Quoted 17 lines · Stephen Boyd

Quoting Rafael J. Wysocki (2020-09-21 09:18:17)

Quoted 16 lines · Sibi Sankar
Quoted 15 lines

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Applied with the Ulf's R-by along with the [2/2] as 5.10 material, thanks!

There was a bunch of discussion on this patch series and I thought the consensus was to not apply these patches and instead implement a custom qcom specific API that does this instead.

https://lore.kernel.org/lkml/20200913034603.GV3715@yoga/

The power domains which were targeted
to use the flags will be replaced by
custom qcom specific API. So let's not
pick up the patch series.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
#14 lore raw
Quoted 30 lines · Sibi Sankar
Quoted 20 lines · Stephen Boyd

Quoting Rafael J. Wysocki (2020-09-21 09:18:17)

Quoted 19 lines
Quoted 16 lines · Sibi Sankar

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 7 lines
Quoted 3 lines

Applied with the Ulf's R-by along with the [2/2] as 5.10 material, thanks!

There was a bunch of discussion on this patch series and I thought the consensus was to not apply these patches and instead implement a custom qcom specific API that does this instead.

Quoted 6 lines

https://lore.kernel.org/lkml/20200913034603.GV3715@yoga/

The power domains which were targeted to use the flags will be replaced by custom qcom specific API. So let's not pick up the patch series.

I am fine with either option. However, please keep me posted, as I am a bit curious how this will look like in the qcom specific drivers.

Kind regards
Uffe

#15 lore raw
In reply to Sibi Sankar
Quoted 30 lines · Sibi Sankar
Quoted 20 lines · Stephen Boyd

Quoting Rafael J. Wysocki (2020-09-21 09:18:17)

Quoted 19 lines
Quoted 16 lines · Sibi Sankar

Add GENPD_FLAG_NO_SUSPEND/RESUME flags to instruct genpd to keep the status of the PM domain unaltered during suspend/resume respectively. The flags are aimed at power domains coupled to co-processors which enter low-power modes independent to that of the application processor.

Specifically the flags are to be used by the power domains exposed by the AOSS QMP driver linked to modem, adsp, cdsp remoteprocs. These power domains are used to notify the Always on Subsystem (AOSS) that a particular co-processor is up. 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 and remains unaltered during system suspend/resume.

Quoted 7 lines
Quoted 3 lines

Applied with the Ulf's R-by along with the [2/2] as 5.10 material, thanks!

There was a bunch of discussion on this patch series and I thought the consensus was to not apply these patches and instead implement a custom qcom specific API that does this instead.

Quoted 6 lines

https://lore.kernel.org/lkml/20200913034603.GV3715@yoga/

The power domains which were targeted to use the flags will be replaced by custom qcom specific API. So let's not pick up the patch series.

OK, I'm dropping it then, thanks!