[Skiboot] [PATCH] powercap: occ: Fix the powercapping range allowed for user

Vaidyanathan Srinivasan svaidy at linux.vnet.ibm.com
Fri Aug 31 17:52:36 AEST 2018


* Shilpa Bhat <shilpa.bhat at linux.vnet.ibm.com> [2018-08-16 11:12:22]:

> OCC provides two levels of minimum powercap which are hard min
> powercap and soft min powercap. Soft min powercap is lower than the
> hard min powercap and users should be allowed to request till this
> limit.
> 
> CC: stable # v5.8+
> Fixes: c6aabe3f2eb5("powercap: occ: Add a generic powercap framework")
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>

Reviewed-by: Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com>

> ---
>  hw/occ.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/occ.c b/hw/occ.c
> index a55bf8e..1140ccd 100644
> --- a/hw/occ.c
> +++ b/hw/occ.c
> @@ -225,9 +225,12 @@ struct occ_response_buffer {
>   *				power to maintain a power cap. Value of 100
>   *				means take all power from CPU.
>   * @pwr_cap_type:		Indicates type of power cap in effect
> - * @min_pwr_cap:		Minimum allowed system power cap in Watts
> + * @hard_min_pwr_cap:		Hard minimum system power cap in Watts.
> + *				Guaranteed unless hardware failure
>   * @max_pwr_cap:		Maximum allowed system power cap in Watts
>   * @cur_pwr_cap:		Current system power cap
> + * @soft_min_pwr_cap:		Soft powercap minimum. OCC may or may not be
> + *				able to maintain this
>   * @spare/reserved:		Unused data
>   * @cmd:			Opal Command Buffer
>   * @rsp:			OCC Response Buffer
> @@ -243,10 +246,11 @@ struct occ_dynamic_data {
>  	u8 quick_pwr_drop;
>  	u8 pwr_shifting_ratio;
>  	u8 pwr_cap_type;
> -	u16 min_pwr_cap;
> +	u16 hard_min_pwr_cap;
>  	u16 max_pwr_cap;
>  	u16 cur_pwr_cap;
> -	u8 pad[112];
> +	u16 soft_min_pwr_cap;
> +	u8 pad[110];
>  	struct opal_command_buffer cmd;
>  	struct occ_response_buffer rsp;
>  } __packed;
> @@ -1362,7 +1366,7 @@ int occ_get_powercap(u32 handle, u32 *pcap)
> 
>  	switch (powercap_get_attr(handle)) {
>  	case POWERCAP_OCC_MIN:
> -		*pcap = ddata->min_pwr_cap;
> +		*pcap = ddata->soft_min_pwr_cap;
>  		break;
>  	case POWERCAP_OCC_MAX:
>  		*pcap = ddata->max_pwr_cap;
> @@ -1410,7 +1414,7 @@ int occ_set_powercap(u32 handle, int token, u32 pcap)
>  		return OPAL_SUCCESS;
> 
>  	if (pcap && (pcap > ddata->max_pwr_cap ||
> -	    pcap < ddata->min_pwr_cap))
> +	    pcap < ddata->soft_min_pwr_cap))
>  		return OPAL_PARAMETER;

This fix allows a larger range of power-cap to get set from Linux inband.

--Vaidy



More information about the Skiboot mailing list