Subject: Re: [PATCH v2 1/5] powerpc/powernv: Add OPAL call to save and restore

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 07 Oct 2014 16:22:18 +1100

On Wed, 2014-10-01 at 13:16 +0530, Shreyas B. Prabhu wrote:
> PORE can be programmed to restore hypervisor registers when waking up
> from deep cpu idle states like winkle.

Tell us a bit more about what "PORE" is. IE, explain a tiny engine will
reconfigure the core and its ucode can be patched to provide some
registers with sane values.

> Add call to pass SPR address and value to OPAL, which in turn will
> program PORE to restore the register state.

Otherwise, Acke-by: Benjamin Herrenschmidt <[email-masked]>

> Cc: Paul Mackerras <[email-masked]>
> Cc: Michael Ellerman <[email-masked]>
> Suggested-by: Vaidyanathan Srinivasan <[email-masked]>
> Signed-off-by: Shreyas B. Prabhu <[email-masked]>
> ---
>  arch/powerpc/include/asm/opal.h                | 2 ++
>  arch/powerpc/platforms/powernv/opal-wrappers.S | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
> index 166d572..d376020 100644
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -150,6 +150,7 @@ struct opal_sg_list {
>  #define OPAL_PCI_EEH_FREEZE_SET			97
>  #define OPAL_HANDLE_HMI				98
>  #define OPAL_CONFIG_IDLE_STATE			99
> +#define OPAL_SLW_SET_REG			100
>  #define OPAL_REGISTER_DUMP_REGION		101
>  #define OPAL_UNREGISTER_DUMP_REGION		102
>  
> @@ -978,6 +979,7 @@ extern int opal_handle_hmi_exception(struct pt_regs *regs);
>  extern void opal_shutdown(void);
>  extern int opal_resync_timebase(void);
>  int64_t opal_config_idle_state(uint64_t state, uint64_t enter);
> +int64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val);
>  
>  extern void opal_lpc_init(void);
>  
> diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
> index 8d1e724..12e5d46 100644
> --- a/arch/powerpc/platforms/powernv/opal-wrappers.S
> +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
> @@ -246,5 +246,6 @@ OPAL_CALL(opal_get_param,			OPAL_GET_PARAM);
>  OPAL_CALL(opal_set_param,			OPAL_SET_PARAM);
>  OPAL_CALL(opal_handle_hmi,			OPAL_HANDLE_HMI);
>  OPAL_CALL(opal_config_idle_state,		OPAL_CONFIG_IDLE_STATE);
> +OPAL_CALL(opal_slw_set_reg,			OPAL_SLW_SET_REG);
>  OPAL_CALL(opal_register_dump_region,		OPAL_REGISTER_DUMP_REGION);
>  OPAL_CALL(opal_unregister_dump_region,		OPAL_UNREGISTER_DUMP_REGION);