powerpc/powernv: Treat an empty reboot string as default
PATCH 1/2 powerpc/powernv: Treat an empty reboot string as default
Treat an empty reboot cmd string the same as a NULL string. This squashes a spurious unsupported reboot message that sometimes gets out when using xmon.
--- arch/powerpc/platforms/powernv/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/setup.c +1 -1
@@ -229,7 +229,7 @@ static void __noreturn pnv_restart(char *cmd)pnv_prepare_going_down (); do { - if (!cmd) + if (!cmd || !strlen(cmd)) rc = opal_cec_reboot(); else if (strcmp(cmd, "full") == 0) rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);
Signature · 1 line
2.9.5
PATCH 2/2 powerpc/powernv: Add explicit fast-reboot support
Add a way to manually invoke a fast-reboot rather than setting the NVRAM flag. The idea is to allow userspace to invoke a fast-reboot using the optional string argument to the reboot() system call, or using the xmon zr command so we don't need to leave around a persistent changes on a system to use the feature.
---
Companion skiboot patch:
http://lists.ozlabs.org/pipermail/skiboot/2020-February/016420.html
--- arch/powerpc/include/asm/opal-api.h | 1 + arch/powerpc/platforms/powernv/setup.c | 2 ++ 2 files changed, 3 insertions(+)
arch/powerpc/include/asm/opal-api.h +1 -0
@@ -1067,6 +1067,7 @@ enum {OPAL_REBOOT_PLATFORM_ERROR =1 ,OPAL_REBOOT_FULL_IPL =2 ,OPAL_REBOOT_MPIPL =3 , + OPAL_REBOOT_FAST = 4, };/* Argument to OPAL_PCI_TCE_KILL */
arch/powerpc/platforms/powernv/setup.c +2 -0
@@ -237,6 +237,8 @@ static void __noreturn pnv_restart(char *cmd) rc =opal_cec_reboot2 (OPAL_REBOOT_MPIPL ,NULL ); else if (strcmp(cmd, "error") == 0) rc =opal_cec_reboot2 (OPAL_REBOOT_PLATFORM_ERROR ,NULL ); + else if (strcmp(cmd, "fast") == 0) + rc =opal_cec_reboot2 (OPAL_REBOOT_FAST ,NULL ); else rc =OPAL_UNSUPPORTED ;
Signature · 1 line
2.9.5
Quoted 14 lines · Oliver O'Halloran
Treat an empty reboot cmd string the same as a NULL string. This squashes a spurious unsupported reboot message that sometimes gets out when using xmon.
Signed-off-by Oliver O'Halloran <[email protected]>--- arch/powerpc/platforms/powernv/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/platforms/powernv/setup.c +0
-0
arch/powerpc/platforms/powernv/setup.c static void __noreturn pnv_restart(char *cmd) · line 232
Quoted 5 lines
arch/powerpc/platforms/powernv/setup.c +1
-1@@ -229,7 +229,7 @@ static void __noreturn pnv_restart(char *cmd)pnv_prepare_going_down (); do { - if (!cmd) + if (!cmd || !strlen(cmd))
nit: this does not matter here in practice but
if (!cmd || cmd[0] == '\0')
is faster (you do not care about the length anyway) and safer (@cmd can potentially be endless) ;)
Quoted 4 lines
arch/powerpc/platforms/powernv/setup.c +0
-0rc =opal_cec_reboot (); else if (strcmp(cmd, "full") == 0) rc =opal_cec_reboot2 (OPAL_REBOOT_FULL_IPL ,NULL );
Signature · 1 line
Alexey
Quoted 5 lines · Oliver O'Halloran
Treat an empty reboot cmd string the same as a NULL string. This squashes a spurious unsupported reboot message that sometimes gets out when using xmon.
Signed-off-by Oliver O'Halloran <[email protected]>
Pretty sure I've seen that spurious reboot message a few times and never thought to check why... this makes sense.
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Re: [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support
In reply to Oliver O'HalloranQuoted 7 lines · Oliver O'Halloran
Add a way to manually invoke a fast-reboot rather than setting the NVRAM flag. The idea is to allow userspace to invoke a fast-reboot using the optional string argument to the
reboot()system call, or using the xmon zr command so we don't need to leave around a persistent changes on a system to use the feature.Signed-off-by Oliver O'Halloran <[email protected]>
Both this and the previous patch have passed snowpatch with no warnings, and don't seem to have any obvious issues.
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Quoted 10 lines · Alexey Kardashevskiy
arch/powerpc/platforms/powernv/setup.c static void __noreturn pnv_restart(char *cmd) · line 232
Quoted 6 lines · Oliver O'Halloran
Treat an empty reboot cmd string the same as a NULL string. This squashes a spurious unsupported reboot message that sometimes gets out when using xmon.
arch/powerpc/platforms/powernv/setup.c +1
-1-if (!cmd) +if (!cmd || !strlen (cmd))nit: this does not matter here in practice but
Quoted 4 lines
if (!cmd || cmd[0] == '\0')
is faster (you do not care about the length anyway) and safer (@cmd can potentially be endless) ;)
No it isn't, this compiles to identical machine code. (I tested with GCC 9, and going back until 4.6 -- the generated code becomes progressively worse (unrelated to this code, fwiw), but identical for both cases all the time).
Segher
Quoted 13 lines · Segher Boessenkool
Quoted 12 lines · Alexey Kardashevskiy
arch/powerpc/platforms/powernv/setup.c static void __noreturn pnv_restart(char *cmd) · line 232
Quoted 6 lines · Oliver O'Halloran
Treat an empty reboot cmd string the same as a NULL string. This squashes a spurious unsupported reboot message that sometimes gets out when using xmon.
arch/powerpc/platforms/powernv/setup.c +1
-1-if (!cmd) +if (!cmd || !strlen (cmd))nit: this does not matter here in practice but
if (!cmd || cmd[0] == '\0')
Quoted 7 lines
Quoted 2 lines
is faster (you do not care about the length anyway) and safer (@cmd can potentially be endless) ;)
No it isn't, this compiles to identical machine code. (I tested with GCC 9, and going back until 4.6 -- the generated code becomes progressively worse (unrelated to this code, fwiw), but identical for both cases all the time).
oh cool, I did not think gcc is that smart.
Signature · 1 line
Alexey
Quoted 5 lines · Oliver O'Halloran
Treat an empty reboot cmd string the same as a NULL string. This squashes a spurious unsupported reboot message that sometimes gets out when using xmon.
Signed-off-by Oliver O'Halloran <[email protected]>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/16985f2d25095899685952296f128a71f0aff05c
cheers