19235e4727
The recent cpuidle changes started triggering RCU splats on Juno development boards: | ============================= | WARNING: suspicious RCU usage | ----------------------------- | include/trace/events/ipi.h:19 suspicious rcu_dereference_check() usage! Fix cpuidle on ARM64: - ... by introducing a new 'is_rcu' flag to the cpuidle helpers & make ARM64 use it, as ARM64 wants to keep RCU active longer and wants to do the ct_cpuidle_enter()/exit() dance itself. - Also update the PSCI driver accordingly. - This also removes the last known RCU_NONIDLE() user as a bonus. Reported-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Sudeep Holla <sudeep.holla@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Link: https://lore.kernel.org/r/Y8Z31UbzG3LJgAXE@hirez.programming.kicks-ass.net --
77 lines
1.7 KiB
C
77 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* ARM64 CPU idle arch support
|
|
*
|
|
* Copyright (C) 2014 ARM Ltd.
|
|
* Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
|
|
*/
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/cpuidle.h>
|
|
#include <linux/cpu_pm.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_device.h>
|
|
#include <linux/psci.h>
|
|
|
|
#ifdef CONFIG_ACPI
|
|
|
|
#include <acpi/processor.h>
|
|
|
|
#define ARM64_LPI_IS_RETENTION_STATE(arch_flags) (!(arch_flags))
|
|
|
|
static int psci_acpi_cpu_init_idle(unsigned int cpu)
|
|
{
|
|
int i, count;
|
|
struct acpi_lpi_state *lpi;
|
|
struct acpi_processor *pr = per_cpu(processors, cpu);
|
|
|
|
if (unlikely(!pr || !pr->flags.has_lpi))
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* If the PSCI cpu_suspend function hook has not been initialized
|
|
* idle states must not be enabled, so bail out
|
|
*/
|
|
if (!psci_ops.cpu_suspend)
|
|
return -EOPNOTSUPP;
|
|
|
|
count = pr->power.count - 1;
|
|
if (count <= 0)
|
|
return -ENODEV;
|
|
|
|
for (i = 0; i < count; i++) {
|
|
u32 state;
|
|
|
|
lpi = &pr->power.lpi_states[i + 1];
|
|
/*
|
|
* Only bits[31:0] represent a PSCI power_state while
|
|
* bits[63:32] must be 0x0 as per ARM ACPI FFH Specification
|
|
*/
|
|
state = lpi->address;
|
|
if (!psci_power_state_is_valid(state)) {
|
|
pr_warn("Invalid PSCI power state %#x\n", state);
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int acpi_processor_ffh_lpi_probe(unsigned int cpu)
|
|
{
|
|
return psci_acpi_cpu_init_idle(cpu);
|
|
}
|
|
|
|
__cpuidle int acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi)
|
|
{
|
|
u32 state = lpi->address;
|
|
|
|
if (ARM64_LPI_IS_RETENTION_STATE(lpi->arch_flags))
|
|
return CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM_RCU(psci_cpu_suspend_enter,
|
|
lpi->index, state);
|
|
else
|
|
return CPU_PM_CPU_IDLE_ENTER_PARAM_RCU(psci_cpu_suspend_enter,
|
|
lpi->index, state);
|
|
}
|
|
#endif
|