Message ID | 20201104183630.27513-3-dbrazdil@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RFC,01/26] psci: Export configured PSCI version | expand |
On 2020-11-04 18:36, David Brazdil wrote: > Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the > host is using PSCI v0.1, KVM's PSCI proxy needs to use the same IDs. > Expose the array holding the information. > > Signed-off-by: David Brazdil <dbrazdil@google.com> > --- > drivers/firmware/psci/psci.c | 10 +--------- > include/linux/psci.h | 10 ++++++++++ > 2 files changed, 11 insertions(+), 9 deletions(-) > > diff --git a/drivers/firmware/psci/psci.c > b/drivers/firmware/psci/psci.c > index ff523bdbfe3f..ffcb88f60e21 100644 > --- a/drivers/firmware/psci/psci.c > +++ b/drivers/firmware/psci/psci.c > @@ -60,15 +60,7 @@ typedef unsigned long (psci_fn)(unsigned long, > unsigned long, > unsigned long, unsigned long); > static psci_fn *invoke_psci_fn; > > -enum psci_function { > - PSCI_FN_CPU_SUSPEND, > - PSCI_FN_CPU_ON, > - PSCI_FN_CPU_OFF, > - PSCI_FN_MIGRATE, > - PSCI_FN_MAX, > -}; > - > -static u32 psci_function_id[PSCI_FN_MAX]; > +u32 psci_function_id[PSCI_FN_MAX]; > > #define PSCI_0_2_POWER_STATE_MASK \ > (PSCI_0_2_POWER_STATE_ID_MASK | \ > diff --git a/include/linux/psci.h b/include/linux/psci.h > index cb35b90d1746..877d844ee6d9 100644 > --- a/include/linux/psci.h > +++ b/include/linux/psci.h > @@ -29,6 +29,16 @@ bool psci_has_osi_support(void); > */ > extern int psci_driver_version; > > +enum psci_function { > + PSCI_FN_CPU_SUSPEND, > + PSCI_FN_CPU_ON, > + PSCI_FN_CPU_OFF, > + PSCI_FN_MIGRATE, > + PSCI_FN_MAX, > +}; > + > +extern u32 psci_function_id[PSCI_FN_MAX]; I am very reluctant to expose this array to the rest of the kernel. The temptation becomes huge for people to start writing to it from random drivers in order to route PSCI calls somewhere else. Consider exporting an accessor instead. Same thing for the following patch (there already are a couple of accessors for psci_cpu_suspend_feature, which you could make visible). Thanks, M.
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index ff523bdbfe3f..ffcb88f60e21 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -60,15 +60,7 @@ typedef unsigned long (psci_fn)(unsigned long, unsigned long, unsigned long, unsigned long); static psci_fn *invoke_psci_fn; -enum psci_function { - PSCI_FN_CPU_SUSPEND, - PSCI_FN_CPU_ON, - PSCI_FN_CPU_OFF, - PSCI_FN_MIGRATE, - PSCI_FN_MAX, -}; - -static u32 psci_function_id[PSCI_FN_MAX]; +u32 psci_function_id[PSCI_FN_MAX]; #define PSCI_0_2_POWER_STATE_MASK \ (PSCI_0_2_POWER_STATE_ID_MASK | \ diff --git a/include/linux/psci.h b/include/linux/psci.h index cb35b90d1746..877d844ee6d9 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -29,6 +29,16 @@ bool psci_has_osi_support(void); */ extern int psci_driver_version; +enum psci_function { + PSCI_FN_CPU_SUSPEND, + PSCI_FN_CPU_ON, + PSCI_FN_CPU_OFF, + PSCI_FN_MIGRATE, + PSCI_FN_MAX, +}; + +extern u32 psci_function_id[PSCI_FN_MAX]; + struct psci_operations { u32 (*get_version)(void); int (*cpu_suspend)(u32 state, unsigned long entry_point);
Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the host is using PSCI v0.1, KVM's PSCI proxy needs to use the same IDs. Expose the array holding the information. Signed-off-by: David Brazdil <dbrazdil@google.com> --- drivers/firmware/psci/psci.c | 10 +--------- include/linux/psci.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-)