[PATCH v2] powerpc/powernv: Make possible for user to force a full ipl cec reboot

Andrew Donnellan andrew.donnellan at au1.ibm.com
Tue Sep 4 11:59:41 AEST 2018


On 03/09/18 20:26, Vaibhav Jain wrote:
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index adddde023622..650484e0940b 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -224,7 +224,22 @@ static void  __noreturn pnv_restart(char *cmd)
>   	pnv_prepare_going_down();
>   
>   	while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
> -		rc = opal_cec_reboot();
> +		/* See if we need to do a full IPL reboot */
> +		if (cmd && strcmp(cmd, "full") == 0)
> +			rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);
> +		else
> +			rc = OPAL_UNSUPPORTED;
> +
> +		if (!(rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT)) {
> +			if (cmd) {
> +				pr_warn("Couldn't do a '%s' reboot. Err=%ld\n",
> +					cmd, rc);
> +				/* reset cmd to force a cec_reboot now */
> +				cmd = NULL;
> +			}
> +			rc = opal_cec_reboot();
> +		}
> +

The logic here is a bit hard to follow, relying on if (cmd && strcmp...) 
failing then setting rc = OPAL_UNSUPPORTED in order to handle the normal 
case seems a bit backwards.

I think I would slightly prefer it if the !cmd case were handled first 
to make it clear that opal_cec_reboot() is the normal case.

But either way:

Acked-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>


-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Linuxppc-dev mailing list