Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de7c75eb authored by Murali Nalajala's avatar Murali Nalajala Committed by Mahesh Sivasubramanian
Browse files

cpu_pm: Add level to the cluster pm notification



Cluster pm notifications without level information increases difficulty
and complexity for the registered drivers to figure out when the last
coherency level is going into power collapse.

Send notifications with level information that allows the registered
drivers to easily determine the cluster level that is going in/out of
power collapse.

There is an issue with this implementation. GIC driver saves and
restores the distributed registers as part of cluster notifications. On
newer platforms there are multiple cluster levels are defined (e.g l2,
cci etc). These cluster level notofications can happen independently.
On MSM platforms GIC is still active while the cluster sleeps in idle,
causing the GIC state to be overwritten with an incorrect
previous state
of the interrupts. This leads to a system hang. Do not save and restore
on any L2 and higher cache coherency level sleep entry and exit.

Change-Id: I31918d6383f19e80fe3b064cfaf0b55e16b97eb6
Signed-off-by: default avatarArchana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: default avatarMurali Nalajala <mnalajal@codeaurora.org>
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: default avatarStepan Moskovchenko <stepanm@codeaurora.org>
parent d8cc9c0c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -36,11 +36,11 @@ static int highbank_suspend_finish(unsigned long val)
static int highbank_pm_enter(suspend_state_t state)
{
	cpu_pm_enter();
	cpu_cluster_pm_enter();
	cpu_cluster_pm_enter(0);

	cpu_suspend(0, highbank_suspend_finish);

	cpu_cluster_pm_exit();
	cpu_cluster_pm_exit(0);
	cpu_pm_exit();

	return 0;
+2 −2
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
		 * to save GIC and wakeupgen context.
		 */
		if (mpuss_can_lose_context)
			cpu_cluster_pm_enter();
			cpu_cluster_pm_enter(0);
	}

	omap4_enter_lowpower(dev->cpu, cx->cpu_state);
@@ -165,7 +165,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
	 * to restore GIC and wakeupgen context.
	 */
	if (dev->cpu == 0 && mpuss_can_lose_context)
		cpu_cluster_pm_exit();
		cpu_cluster_pm_exit(0);

	tick_broadcast_exit();

+2 −2
Original line number Diff line number Diff line
@@ -192,13 +192,13 @@ void tegra_idle_lp2_last(void)
{
	tegra_pm_set(TEGRA_SUSPEND_LP2);

	cpu_cluster_pm_enter();
	cpu_cluster_pm_enter(0);
	suspend_cpu_complex();

	cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);

	restore_cpu_complex();
	cpu_cluster_pm_exit();
	cpu_cluster_pm_exit(0);
}

enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
+13 −3
Original line number Diff line number Diff line
@@ -710,7 +710,8 @@ void gic_cpu_restore(struct gic_chip_data *gic)
	gic_cpu_if_up(gic);
}

static int gic_notifier(struct notifier_block *self, unsigned long cmd,	void *v)
static int gic_notifier(struct notifier_block *self, unsigned long cmd,
			void *aff_level)
{
	int i;

@@ -729,10 +730,19 @@ static int gic_notifier(struct notifier_block *self, unsigned long cmd, void *v)
			gic_cpu_restore(&gic_data[i]);
			break;
		case CPU_CLUSTER_PM_ENTER:
			/*
			 * Affinity level of the node
			 * eg:
			 *    cpu level = 0
			 *    l2 level  = 1
			 *    cci level = 2
			 */
			if (!(unsigned long)aff_level)
				gic_dist_save(&gic_data[i]);
			break;
		case CPU_CLUSTER_PM_ENTER_FAILED:
		case CPU_CLUSTER_PM_EXIT:
			if (!(unsigned long)aff_level)
				gic_dist_restore(&gic_data[i]);
			break;
		}
+4 −4
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ int cpu_pm_register_notifier(struct notifier_block *nb);
int cpu_pm_unregister_notifier(struct notifier_block *nb);
int cpu_pm_enter(void);
int cpu_pm_exit(void);
int cpu_cluster_pm_enter(void);
int cpu_cluster_pm_exit(void);
int cpu_cluster_pm_enter(unsigned long aff_level);
int cpu_cluster_pm_exit(unsigned long aff_level);

#else

@@ -96,12 +96,12 @@ static inline int cpu_pm_exit(void)
	return 0;
}

static inline int cpu_cluster_pm_enter(void)
static inline int cpu_cluster_pm_enter(unsigned long aff_level)
{
	return 0;
}

static inline int cpu_cluster_pm_exit(void)
static inline int cpu_cluster_pm_exit(unsigned long aff_level)
{
	return 0;
}
Loading