[Skiboot] [PATCH 2/2] ipmi-sel: Run power action immediately if host not up

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue Sep 15 14:36:28 AEST 2015


On 09/15/2015 08:40 AM, Joel Stanley wrote:
> Our normal sequence for a soft power action (IPMI 'power soft' or
> 'power cycle') involve receiving a SEL from the BMC, sending a message
> to Linux's opal platform support which instructs the host OS to shut
> down, and finally the host will request OPAL to cut power.
> 
> When the host is not yet up we will send the message to /dev/null, and
> no action will be taken. This patches changes that behaviour to perform
> the action immediately if we know how.
> 
> Signed-off-by: Joel Stanley <joel at jms.id.au>
> ---
>  hw/ipmi/ipmi-sel.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
> index 4626d9d..c446dfc 100644
> --- a/hw/ipmi/ipmi-sel.c
> +++ b/hw/ipmi/ipmi-sel.c
> @@ -457,12 +457,24 @@ static void sel_power(uint8_t power)
>  {
>  	switch (power) {
>  	case SOFT_OFF:
> -		prlog(PR_NOTICE, "soft shutdown requested\n");
> -		opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_OFF);
> +		prlog(PR_NOTICE, "Soft shutdown requested\n");
> +		if (!debug_descriptor.opal_boot_complete &&
> +		    platform.cec_power_down) {
> +			prlog(PR_NOTICE, "Host not up, shutting down now\n");
> +			platform.cec_power_down(IPMI_CHASSIS_PWR_DOWN);
> +		} else {
> +			opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_OFF);
> +		}
>  		break;
>  	case SOFT_REBOOT:
> -		prlog(PR_NOTICE, "soft reboot rqeuested\n");
> -		opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_REBOOT);
> +		prlog(PR_NOTICE, "Soft reboot rqeuested\n");

Looks like copy-parse error... s/rqeuested/requested/ ..

> +		if (!debug_descriptor.opal_boot_complete &&
> +		    platform.cec_reboot) {
> +			prlog(PR_NOTICE, "Host not up, rebooting now\n");
> +			platform.cec_reboot();
> +		} else {
> +			opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_REBOOT);
> +		}

So if platform.cec_reboot, then we will endup calling  "opal_queue_msg".. which
is not correct..
But given that cec_reboot will be set well before update opal_boot_complete
flag, probably we are fine.

-Vasant



More information about the Skiboot mailing list