sched: idle: Add support to print wake irqs during s2idle

syscore ops prints wake irq during "deep" suspend exit however
syscore ops do not execute for "s2idle" suspend.

Add changes to print wakeup irq during "s2idle" mode exit.

The change prints wakeup irq from the first cpu waking up from s2idle
during which local irqs on the cpu is disabled.

Change-Id: Idd05d42f30b97cc5f9d62627339e21731f131673
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This commit is contained in:
Maulik Shah 2021-03-15 19:25:23 +05:30
parent c30dc7b7b1
commit f0cfd2d0dc
4 changed files with 45 additions and 0 deletions

View File

@ -37,6 +37,7 @@ config ARM_GIC_V3
select IRQ_DOMAIN_HIERARCHY
select PARTITION_PERCPU
select GENERIC_IRQ_EFFECTIVE_AFF_MASK
select QGKI_SHOW_S2IDLE_WAKE_IRQ if QGKI
config ARM_GIC_V3_ITS
bool
@ -516,4 +517,11 @@ config SIFIVE_PLIC
If you don't know what to do here, say Y.
config QGKI_SHOW_S2IDLE_WAKE_IRQ
bool "Qualcomm Technologies, Inc. (QTI) SHOW S2IDLE WAKE IRQ"
depends on ARM_GIC_V3
help
When this option is selected, first cpu waking up from s2idle
prints the interrupts pending and enabled at GIC.
endmenu

View File

@ -18,6 +18,7 @@
#include <linux/percpu.h>
#include <linux/refcount.h>
#include <linux/slab.h>
#include <linux/suspend.h>
#include <linux/msm_rtb.h>
#include <linux/wakeup_reason.h>
@ -1244,6 +1245,13 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
#define gic_smp_init() do { } while(0)
#endif
#ifdef CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ
void gic_s2idle_wake(void)
{
gic_resume_one(&gic_data);
}
#endif /* CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ */
#ifdef CONFIG_CPU_PM
static int gic_cpu_pm_notifier(struct notifier_block *self,
unsigned long cmd, void *v)

View File

@ -638,6 +638,10 @@ static inline bool gic_enable_sre(void)
return !!(val & ICC_SRE_EL1_SRE);
}
#ifdef CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ
void gic_s2idle_wake(void);
#endif /* CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ */
#endif
#endif

View File

@ -8,6 +8,9 @@
*/
#include "sched.h"
#ifdef CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ
#include <linux/irqchip/arm-gic-v3.h>
#endif /* CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ */
#include <trace/events/power.h>
/* Linker adds these: start and end of __cpuidle functions */
@ -128,6 +131,11 @@ static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
* set, and it returns with polling set. If it ever stops polling, it
* must clear the polling bit.
*/
#ifdef CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ
static cpumask_t cpu_state;
#endif /* CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ */
static void cpuidle_idle_call(void)
{
struct cpuidle_device *dev = cpuidle_get_device();
@ -169,9 +177,26 @@ static void cpuidle_idle_call(void)
if (idle_should_enter_s2idle() || dev->use_deepest_state) {
if (idle_should_enter_s2idle()) {
#ifdef CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ
bool print_wake_irq;
cpumask_set_cpu(dev->cpu, &cpu_state);
#endif /* CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ */
rcu_idle_enter();
entered_state = cpuidle_enter_s2idle(drv, dev);
#ifdef CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ
print_wake_irq = cpumask_weight(&cpu_state) ==
cpumask_weight(cpu_online_mask) ?
true : false;
cpumask_clear_cpu(dev->cpu, &cpu_state);
if (print_wake_irq)
gic_s2idle_wake();
#endif /* CONFIG_QGKI_SHOW_S2IDLE_WAKE_IRQ */
if (entered_state > 0) {
local_irq_enable();
goto exit_idle;