From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
david@gibson.dropbear.id.au, imammedo@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH v0 1/1] spapr: Support setting of compat CPU type for CPU cores
Date: Wed, 22 Jun 2016 08:01:44 +0530 [thread overview]
Message-ID: <20160622023144.GC5613@in.ibm.com> (raw)
In-Reply-To: <5768D8DC.4060304@redhat.com>
On Tue, Jun 21, 2016 at 08:04:12AM +0200, Thomas Huth wrote:
> On 18.06.2016 10:34, Bharata B Rao wrote:
> > Compat CPU type is typically specified on -cpu cmdline option like:
> > -cpu host,compat=power7 or -cpu POWER8E,compat=power7 etc.
> > With the introduction of sPAPR CPU core devices, we need to support
> > the same for core devices too.
> >
> > Support the specification of CPU compat type on device_add command for
> > sPAPRCPUCore devices like:
> > (qemu) device_add POWER8E-spapr-cpu-core,id=core3,compat=power7,core-id=24
> >
> > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > ---
> > Applies on ppc-for-2.7 branch of David Gibson's tree.
> >
> > hw/ppc/spapr.c | 8 +++++
> > hw/ppc/spapr_cpu_core.c | 73 +++++++++++++++++++++++++++++++++++++++++
> > include/hw/ppc/spapr_cpu_core.h | 2 ++
> > 3 files changed, 83 insertions(+)
> [...]
> > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> > index 3a5da09..9eb63cc 100644
> > --- a/hw/ppc/spapr_cpu_core.c
> > +++ b/hw/ppc/spapr_cpu_core.c
> > @@ -96,6 +96,24 @@ char *spapr_get_cpu_core_type(const char *model)
> > return core_type;
> > }
> >
> > +/*
> > + * Returns the CPU compat type specified in -cpu @model.
> > + */
> > +char *spapr_get_cpu_compat_type(const char *model)
> > +{
> > + char *compat_type = NULL;
> > + gchar **model_pieces = g_strsplit(model, ",", 2);
> > +
> > + if (model_pieces[1]) {
> > + gchar **compat_pieces = g_strsplit(model_pieces[1], "=", 2);
> > +
> > + compat_type = g_strdup_printf("%s", compat_pieces[1]);
> > + }
> > +
> > + g_strfreev(model_pieces);
> > + return compat_type;
> > +}
>
> Shouldn't you check for "compat=" somewhere in this function (and
> properly iterate over all parts of the comma separated string)? In case
> we support more properties than "compat=" some day, this will go wrong
> otherwise...
Currently since it is only "compat=", anything else would fail gracefully
when the property gets set. But obviously that is not future-safe as you
note. Let me rework on this.
Regards,
Bharata
next prev parent reply other threads:[~2016-06-22 2:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-18 8:34 [Qemu-devel] [RFC PATCH v0 1/1] spapr: Support setting of compat CPU type for CPU cores Bharata B Rao
2016-06-21 5:10 ` David Gibson
2016-06-22 2:36 ` Bharata B Rao
2016-06-22 3:03 ` David Gibson
2016-06-21 6:04 ` Thomas Huth
2016-06-22 2:31 ` Bharata B Rao [this message]
2016-06-21 7:09 ` Igor Mammedov
2016-06-21 7:42 ` Igor Mammedov
2016-06-22 2:30 ` Bharata B Rao
2016-06-22 7:09 ` Igor Mammedov
2016-06-23 15:55 ` Eduardo Habkost
2016-06-24 1:40 ` Bharata B Rao
2016-06-24 2:37 ` David Gibson
2016-06-24 13:36 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160622023144.GC5613@in.ibm.com \
--to=bharata@linux.vnet.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).