ppc: exit if compat mode is unknown
PATCH 1/1 ppc: exit if compat mode is unknown
Now that properties are set with -global, if we pass a bogus value for compat mode, a warning is printed and the property is simply ignored. For example, if the host is POWER8 and we pass compat=POWER7 instead of compat=power7 the guest will see a POWER8 cpu.
While here, this patch also changes the error message to be more explicit.
--- target-ppc/translate_init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
target-ppc/translate_init.c +5 -1
@@ -8475,7 +8475,11 @@ static void powerpc_set_compat(Object *obj, Visitor *v, const char *name, }else if (strcmp (value,"power8" ) ==0 ) { *max_compat =CPU_POWERPC_LOGICAL_2_07 ; }else { -error_setg (errp,"Invalid compatibility mode \"%s\"" , value); +/* This is called from -global, which does not exit on error. Since we +* don't want to start with a wrong compat mode, we exit now. +*/ +error_report ("PPC does not support compatibility mode \"%s\"" , value); +exit (1 ); }g_free (value);
Quoted 9 lines · On Wed, 13 Jul 2016 11:10:21 +0200 Greg Kurz <[email protected]> wrote:
Now that properties are set with -global, if we pass a bogus value for compat mode, a warning is printed and the property is simply ignored. For example, if the host is POWER8 and we pass compat=POWER7 instead of compat=power7 the guest will see a POWER8 cpu.
While here, this patch also changes the error message to be more explicit.
Signed-off-by Greg Kurz <[email protected]>---
Of course this causes qom-set to exit as well... not sure this is what we want.
Quoted 22 lines
target-ppc/translate_init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)target-ppc/translate_init.c +5
-1@@ -8475,7 +8475,11 @@ static void powerpc_set_compat(Object *obj, Visitor *v, const char *name, }else if (strcmp (value,"power8" ) ==0 ) { *max_compat =CPU_POWERPC_LOGICAL_2_07 ; }else { -error_setg (errp,"Invalid compatibility mode \"%s\"" , value); +/* This is called from -global, which does not exit on error. Since we +* don't want to start with a wrong compat mode, we exit now. +*/ +error_report ("PPC does not support compatibility mode \"%s\"" , value); +exit (1 ); }g_free (value);
Quoted 8 lines · Greg Kurz
Quoted 5 lines · On Wed, 13 Jul 2016 11:10:21 +0200 Greg Kurz <[email protected]> wrote:
Now that properties are set with -global, if we pass a bogus value for compat mode, a warning is printed and the property is simply ignored. For example, if the host is POWER8 and we pass compat=POWER7 instead of compat=power7 the guest will see a POWER8 cpu.
Quoted 7 lines
Quoted 4 lines
While here, this patch also changes the error message to be more explicit.
Signed-off-by Greg Kurz <[email protected]>---
Of course this causes qom-set to exit as well... not sure this is what we want.
Yeah, that seems wrong. If I'm reading this right this is obsoleted by your later generic patch adding an &error_fatal to the generic code, yes?
Quoted 24 lines
Quoted 23 lines
target-ppc/translate_init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)target-ppc/translate_init.c +5
-1@@ -8475,7 +8475,11 @@ static void powerpc_set_compat(Object *obj, Visitor *v, const char *name, }else if (strcmp (value,"power8" ) ==0 ) { *max_compat =CPU_POWERPC_LOGICAL_2_07 ; }else { -error_setg (errp,"Invalid compatibility mode \"%s\"" , value); +/* This is called from -global, which does not exit on error. Since we +* don't want to start with a wrong compat mode, we exit now. +*/ +error_report ("PPC does not support compatibility mode \"%s\"" , value); +exit (1 ); }g_free (value);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 14 lines · On Thu, 14 Jul 2016 12:05:42 +1000 David Gibson <[email protected]>…
Quoted 13 lines · Greg Kurz
Quoted 9 lines · On Wed, 13 Jul 2016 11:10:21 +0200 Greg Kurz <[email protected]> wrote:
Now that properties are set with -global, if we pass a bogus value for compat mode, a warning is printed and the property is simply ignored. For example, if the host is POWER8 and we pass compat=POWER7 instead of compat=power7 the guest will see a POWER8 cpu.
While here, this patch also changes the error message to be more explicit.
Signed-off-by Greg Kurz <[email protected]>---
Quoted 7 lines
Quoted 2 lines
Of course this causes qom-set to exit as well... not sure this is what we want.
Yeah, that seems wrong. If I'm reading this right this is obsoleted by your later generic patch adding an
&error_fatalto the generic code, yes?
Yes it is indeed.
Quoted 25 lines
Quoted 24 lines
Quoted 23 lines
target-ppc/translate_init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)target-ppc/translate_init.c +5
-1@@ -8475,7 +8475,11 @@ static void powerpc_set_compat(Object *obj, Visitor *v, const char *name, }else if (strcmp (value,"power8" ) ==0 ) { *max_compat =CPU_POWERPC_LOGICAL_2_07 ; }else { -error_setg (errp,"Invalid compatibility mode \"%s\"" , value); +/* This is called from -global, which does not exit on error. Since we +* don't want to start with a wrong compat mode, we exit now. +*/ +error_report ("PPC does not support compatibility mode \"%s\"" , value); +exit (1 ); }g_free (value);