History

firmware: psci: Export functions to manage the OSI mode

To allow subsequent changes to implement support for OSI mode through the cpuidle-psci driver, export the existing psci_has_osi_support(). Export also a new function, psci_set_osi_mode(), that allows its caller to enable the OS-initiated CPU-suspend mode in the PSCI FW. To deal with backwards compatibility for a kernel started through a kexec call, default to set the CPU-suspend mode to the Platform Coordinated mode during boot.

Ulf Hansson committed 7 years ago

Commit 49fdcd71 parent a3f048b2 files · +18 −2Browse files

Unified · Split

2 files
  1. drivers/firmware/psci/psci.c +16 −2
  2. include/linux/psci.h +2 −0
drivers/firmware/psci/psci.c+16−2
@@ -97,7 +97,7 @@ static inline bool psci_has_ext_power_state(void) · 96 unmodified lines
97 PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK;97 PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK;
98}98}
99 99
100static inline bool psci_has_osi_support(void)100bool psci_has_osi_support(void)
101{101{
102 return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED;102 return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED;
103}103}
@@ -162,6 +162,15 @@ static u32 psci_get_version(void) · 58 unmodified lines
162 return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);162 return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
163}163}
164 164
165int psci_set_osi_mode(void)
166{
167 int err;
168
169 err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE,
170 PSCI_1_0_SUSPEND_MODE_OSI, 0, 0);
171 return psci_to_linux_errno(err);
172}
173
165static int psci_cpu_suspend(u32 state, unsigned long entry_point)174static int psci_cpu_suspend(u32 state, unsigned long entry_point)
166{175{
167 int err;176 int err;
@@ -544,9 +553,14 @@ static int __init psci_1_0_init(struct device_node *np) · 376 unmodified lines
544 if (err)553 if (err)
545 return err;554 return err;
546 555
547 if (psci_has_osi_support())556 if (psci_has_osi_support()) {
548 pr_info("OSI mode supported.\n");557 pr_info("OSI mode supported.\n");
549 558
559 /* Default to PC mode. */
560 invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE,
561 PSCI_1_0_SUSPEND_MODE_PC, 0, 0);
562 }
563
550 return 0;564 return 0;
551}565}
552 566
include/linux/psci.h+2−0
@@ -18,6 +18,8 @@ bool psci_tos_resident_on(int cpu); · 17 unmodified lines
18 18
19int psci_cpu_suspend_enter(u32 state);19int psci_cpu_suspend_enter(u32 state);
20bool psci_power_state_is_valid(u32 state);20bool psci_power_state_is_valid(u32 state);
21int psci_set_osi_mode(void);
22bool psci_has_osi_support(void);
21 23
22enum smccc_version {24enum smccc_version {
23 SMCCC_VERSION_1_0,25 SMCCC_VERSION_1_0,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t