All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc: exit if compat mode is unknown
@ 2016-07-13  9:10 Greg Kurz
  2016-07-13 12:34 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kurz @ 2016-07-13  9:10 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel, Bharata B Rao

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 <groug@kaod.org>
---
 target-ppc/translate_init.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 8f257fb74aa7..55688db9c9db 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: exit if compat mode is unknown
  2016-07-13  9:10 [Qemu-devel] [PATCH] ppc: exit if compat mode is unknown Greg Kurz
@ 2016-07-13 12:34 ` Greg Kurz
  2016-07-14  2:05   ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kurz @ 2016-07-13 12:34 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel, Bharata B Rao

On Wed, 13 Jul 2016 11:10:21 +0200
Greg Kurz <groug@kaod.org> 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 <groug@kaod.org>
> ---

Of course this causes qom-set to exit as well... not sure this is what we want.

>  target-ppc/translate_init.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 8f257fb74aa7..55688db9c9db 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -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);
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: exit if compat mode is unknown
  2016-07-13 12:34 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
@ 2016-07-14  2:05   ` David Gibson
  2016-07-14  5:09     ` Greg Kurz
  0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2016-07-14  2:05 UTC (permalink / raw)
  To: Greg Kurz; +Cc: qemu-ppc, qemu-devel, Bharata B Rao

[-- Attachment #1: Type: text/plain, Size: 1967 bytes --]

On Wed, Jul 13, 2016 at 02:34:32PM +0200, Greg Kurz wrote:
> On Wed, 13 Jul 2016 11:10:21 +0200
> Greg Kurz <groug@kaod.org> 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 <groug@kaod.org>
> > ---
> 
> 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?

> 
> >  target-ppc/translate_init.c |    6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> > index 8f257fb74aa7..55688db9c9db 100644
> > --- a/target-ppc/translate_init.c
> > +++ b/target-ppc/translate_init.c
> > @@ -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);
> > 
> > 
> 

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: exit if compat mode is unknown
  2016-07-14  2:05   ` David Gibson
@ 2016-07-14  5:09     ` Greg Kurz
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kurz @ 2016-07-14  5:09 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel, Bharata B Rao

[-- Attachment #1: Type: text/plain, Size: 1991 bytes --]

On Thu, 14 Jul 2016 12:05:42 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Wed, Jul 13, 2016 at 02:34:32PM +0200, Greg Kurz wrote:
> > On Wed, 13 Jul 2016 11:10:21 +0200
> > Greg Kurz <groug@kaod.org> 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 <groug@kaod.org>
> > > ---  
> > 
> > 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?
> 

Yes it is indeed.

> >   
> > >  target-ppc/translate_init.c |    6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> > > index 8f257fb74aa7..55688db9c9db 100644
> > > --- a/target-ppc/translate_init.c
> > > +++ b/target-ppc/translate_init.c
> > > @@ -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);
> > > 
> > >   
> >   
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-14  5:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-13  9:10 [Qemu-devel] [PATCH] ppc: exit if compat mode is unknown Greg Kurz
2016-07-13 12:34 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-07-14  2:05   ` David Gibson
2016-07-14  5:09     ` Greg Kurz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.