mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
cpuidle: psci: Enable the hierarchical topology for s2ram on PREEMPT_RT
The hierarchical PM domain topology are currently disabled on a PREEMPT_RT based configuration. As a first step to enable it to be used, let's try to attach the CPU devices to their PM domains on PREEMPT_RT. In this way the syscore ops becomes available, allowing the PM domain topology to be managed during s2ram. For the moment let's leave the support for CPU hotplug outside PREEMPT_RT, as it's depending on using runtime PM. For s2ram, this isn't a problem as all CPUs are managed via the syscore ops. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Raghavendra Kakarla <quic_rkakarla@quicinc.com> # qcm6490 with PREEMPT_RT set Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Link: https://lore.kernel.org/r/20240527142557.321610-7-ulf.hansson@linaro.org
This commit is contained in:
parent
88bf68b766
commit
4517b1c383
@ -37,6 +37,7 @@ struct psci_cpuidle_data {
|
|||||||
|
|
||||||
static DEFINE_PER_CPU_READ_MOSTLY(struct psci_cpuidle_data, psci_cpuidle_data);
|
static DEFINE_PER_CPU_READ_MOSTLY(struct psci_cpuidle_data, psci_cpuidle_data);
|
||||||
static DEFINE_PER_CPU(u32, domain_state);
|
static DEFINE_PER_CPU(u32, domain_state);
|
||||||
|
static bool psci_cpuidle_use_syscore;
|
||||||
static bool psci_cpuidle_use_cpuhp;
|
static bool psci_cpuidle_use_cpuhp;
|
||||||
|
|
||||||
void psci_set_domain_state(u32 state)
|
void psci_set_domain_state(u32 state)
|
||||||
@ -166,6 +167,12 @@ static struct syscore_ops psci_idle_syscore_ops = {
|
|||||||
.resume = psci_idle_syscore_resume,
|
.resume = psci_idle_syscore_resume,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void psci_idle_init_syscore(void)
|
||||||
|
{
|
||||||
|
if (psci_cpuidle_use_syscore)
|
||||||
|
register_syscore_ops(&psci_idle_syscore_ops);
|
||||||
|
}
|
||||||
|
|
||||||
static void psci_idle_init_cpuhp(void)
|
static void psci_idle_init_cpuhp(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -173,8 +180,6 @@ static void psci_idle_init_cpuhp(void)
|
|||||||
if (!psci_cpuidle_use_cpuhp)
|
if (!psci_cpuidle_use_cpuhp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
register_syscore_ops(&psci_idle_syscore_ops);
|
|
||||||
|
|
||||||
err = cpuhp_setup_state_nocalls(CPUHP_AP_CPU_PM_STARTING,
|
err = cpuhp_setup_state_nocalls(CPUHP_AP_CPU_PM_STARTING,
|
||||||
"cpuidle/psci:online",
|
"cpuidle/psci:online",
|
||||||
psci_idle_cpuhp_up,
|
psci_idle_cpuhp_up,
|
||||||
@ -222,13 +227,16 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
|
|||||||
if (!psci_has_osi_support())
|
if (!psci_has_osi_support())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_PREEMPT_RT))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
data->dev = dt_idle_attach_cpu(cpu, "psci");
|
data->dev = dt_idle_attach_cpu(cpu, "psci");
|
||||||
if (IS_ERR_OR_NULL(data->dev))
|
if (IS_ERR_OR_NULL(data->dev))
|
||||||
return PTR_ERR_OR_ZERO(data->dev);
|
return PTR_ERR_OR_ZERO(data->dev);
|
||||||
|
|
||||||
|
psci_cpuidle_use_syscore = true;
|
||||||
|
|
||||||
|
/* The hierarchical topology is limited to s2ram on PREEMPT_RT. */
|
||||||
|
if (IS_ENABLED(CONFIG_PREEMPT_RT))
|
||||||
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Using the deepest state for the CPU to trigger a potential selection
|
* Using the deepest state for the CPU to trigger a potential selection
|
||||||
* of a shared state for the domain, assumes the domain states are all
|
* of a shared state for the domain, assumes the domain states are all
|
||||||
@ -312,6 +320,7 @@ static void psci_cpu_deinit_idle(int cpu)
|
|||||||
struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu);
|
struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu);
|
||||||
|
|
||||||
dt_idle_detach_cpu(data->dev);
|
dt_idle_detach_cpu(data->dev);
|
||||||
|
psci_cpuidle_use_syscore = false;
|
||||||
psci_cpuidle_use_cpuhp = false;
|
psci_cpuidle_use_cpuhp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,6 +417,7 @@ static int psci_cpuidle_probe(struct platform_device *pdev)
|
|||||||
goto out_fail;
|
goto out_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psci_idle_init_syscore();
|
||||||
psci_idle_init_cpuhp();
|
psci_idle_init_cpuhp();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user