mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 23:38:21 +07:00
9ffeb6d08c
Current PSCI code handles idle state entry through the psci_cpu_suspend_enter() API, that takes an idle state index as a parameter and convert the index into a previously initialized power_state parameter before calling the PSCI.CPU_SUSPEND() with it. This is unwieldly, since it forces the PSCI firmware layer to keep track of power_state parameter for every idle state so that the index->power_state conversion can be made in the PSCI firmware layer instead of the CPUidle driver implementations. Move the power_state handling out of drivers/firmware/psci into the respective ACPI/DT PSCI CPUidle backends and convert the psci_cpu_suspend_enter() API to get the power_state parameter as input, which makes it closer to its firmware interface PSCI.CPU_SUSPEND() API. A notable side effect is that the PSCI ACPI/DT CPUidle backends now can directly handle (and if needed update) power_state parameters before handing them over to the PSCI firmware interface to trigger PSCI.CPU_SUSPEND() calls. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Ulf Hansson <ulf.hansson@linaro.org> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Signed-off-by: Will Deacon <will@kernel.org>
64 lines
1.5 KiB
C
64 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
*
|
|
* Copyright (C) 2015 ARM Limited
|
|
*/
|
|
|
|
#ifndef __LINUX_PSCI_H
|
|
#define __LINUX_PSCI_H
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/types.h>
|
|
|
|
#define PSCI_POWER_STATE_TYPE_STANDBY 0
|
|
#define PSCI_POWER_STATE_TYPE_POWER_DOWN 1
|
|
|
|
bool psci_tos_resident_on(int cpu);
|
|
|
|
int psci_cpu_suspend_enter(u32 state);
|
|
bool psci_power_state_is_valid(u32 state);
|
|
|
|
enum psci_conduit {
|
|
PSCI_CONDUIT_NONE,
|
|
PSCI_CONDUIT_SMC,
|
|
PSCI_CONDUIT_HVC,
|
|
};
|
|
|
|
enum smccc_version {
|
|
SMCCC_VERSION_1_0,
|
|
SMCCC_VERSION_1_1,
|
|
};
|
|
|
|
struct psci_operations {
|
|
u32 (*get_version)(void);
|
|
int (*cpu_suspend)(u32 state, unsigned long entry_point);
|
|
int (*cpu_off)(u32 state);
|
|
int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
|
|
int (*migrate)(unsigned long cpuid);
|
|
int (*affinity_info)(unsigned long target_affinity,
|
|
unsigned long lowest_affinity_level);
|
|
int (*migrate_info_type)(void);
|
|
enum psci_conduit conduit;
|
|
enum smccc_version smccc_version;
|
|
};
|
|
|
|
extern struct psci_operations psci_ops;
|
|
|
|
#if defined(CONFIG_ARM_PSCI_FW)
|
|
int __init psci_dt_init(void);
|
|
#else
|
|
static inline int psci_dt_init(void) { return 0; }
|
|
#endif
|
|
|
|
#if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
|
|
int __init psci_acpi_init(void);
|
|
bool __init acpi_psci_present(void);
|
|
bool acpi_psci_use_hvc(void);
|
|
#else
|
|
static inline int psci_acpi_init(void) { return 0; }
|
|
static inline bool acpi_psci_present(void) { return false; }
|
|
static inline bool acpi_psci_use_hvc(void) {return false; }
|
|
#endif
|
|
|
|
#endif /* __LINUX_PSCI_H */
|