qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
	Don Slutz <Don@CloudSwitch.Com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/6] target-i386: cpu: separate feature string parsing from CPU model lookup
Date: Wed, 05 Dec 2012 16:58:34 +0100	[thread overview]
Message-ID: <50BF6F2A.4080306@suse.de> (raw)
In-Reply-To: <1354649683-9078-3-git-send-email-ehabkost@redhat.com>

Am 04.12.2012 20:34, schrieb Eduardo Habkost:
> Instead of using parsing the whole cpu_model string inside

Dropped "using".

> cpu_x86_find_by_name(), first split it into the CPU model name and the
> full feature string, then parse the feature string into pieces.
[...]
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 7afe839..70ba323 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1208,25 +1208,10 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
>      cpu->env.tsc_khz = value / 1000;
>  }
>  
> -static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
> +static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *name)
>  {
> -    unsigned int i;
>      x86_def_t *def;
>  
> -    char *s = g_strdup(cpu_model);
> -    char *featurestr, *name = strtok(s, ",");
> -    /* Features to be added*/
[...]
> @@ -1235,16 +1220,37 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
>      if (kvm_enabled() && name && strcmp(name, "host") == 0) {
>          kvm_cpu_fill_host(x86_cpu_def);
>      } else if (!def) {
> -        goto error;
> +        return -1;
>      } else {
>          memcpy(x86_cpu_def, def, sizeof(*def));
>      }
>  
> +    return 0;
> +}
> +
> +/* Parse "+feature,-feature,feature=foo" CPU feature string
> + */
> +static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features)
> +{
> +    unsigned int i;
> +    char *featurestr; /* Single 'key=value" string being parsed */
> +    /* Features to be added*/

I took the liberty of adding a space above by editing patches 1 & 2.

Also, in Linux, multi-level topics such as "PPC: KVM: " seem to be
common, whereas in QEMU we've been using paths ("tcg/ppc: "); Anthony
has once used "isa: pic: " when he meant affecting both isa and pic
(8f04ee0882aec9fe91fb70f767edf5dacff59835), so since this does not touch
on the QOM cpu.c that I usually label "cpu: ", in a previous case I have
edited your patch as "target-i386/cpu: ", but since this subject
redundantly mentions CPU later on I'm dropping it. Hope this explains
the rationale! Generally I found the GNOME guidelines pretty convincing:
https://live.gnome.org/Git/CommitMessages
(capitalizing after the lowercase topic makes the main message stand out
when reading through shortlogs IMO)

Thanks, applied patches 1-2 to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  parent reply	other threads:[~2012-12-05 15:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04 19:34 [Qemu-devel] [PATCH 0/6] short x86 CPU init cleanup (v3) Eduardo Habkost
2012-12-04 19:34 ` [Qemu-devel] [PATCH 1/6] target-i386/cpu.c: coding style fixes Eduardo Habkost
2012-12-04 19:40   ` Igor Mammedov
2012-12-04 19:34 ` [Qemu-devel] [PATCH 2/6] target-i386: cpu: separate feature string parsing from CPU model lookup Eduardo Habkost
2012-12-04 19:47   ` Igor Mammedov
2012-12-05 15:58   ` Andreas Färber [this message]
2012-12-04 19:34 ` [Qemu-devel] [PATCH 3/6] target-i386: use define for cpuid vendor string size Eduardo Habkost
2012-12-04 19:38   ` Eduardo Habkost
2012-12-05 11:29     ` Andreas Färber
2012-12-05 11:51       ` Eduardo Habkost
2012-12-05 12:03         ` Igor Mammedov
2012-12-04 19:34 ` [Qemu-devel] [PATCH 4/6] target-i386: postpone cpuid_level update to realize time Eduardo Habkost
2012-12-04 19:36   ` Eduardo Habkost
2012-12-04 19:34 ` [Qemu-devel] [PATCH 5/6] add visitor for parsing hz[KMG] input string Eduardo Habkost
2012-12-04 19:41   ` Eduardo Habkost
2012-12-04 23:43   ` Andreas Färber
2012-12-05 17:52   ` mdroth
2012-12-05 19:21     ` Eduardo Habkost
2012-12-05 21:00       ` mdroth
2012-12-06 20:49         ` Igor Mammedov
2012-12-04 19:34 ` [Qemu-devel] [PATCH 6/6] target-i386: use visit_type_hz to parse tsc_freq property value Eduardo Habkost
2012-12-04 19:55   ` Eduardo Habkost
2012-12-05 16:24 ` [Qemu-devel] [PATCH 0/6] short x86 CPU init cleanup (v3) Andreas Färber
  -- strict thread matches above, loose matches on Subject: below --
2012-12-04 18:58 [Qemu-devel] [PATCH 0/6] short x86 CPU init cleanup (v2) Eduardo Habkost
2012-12-04 18:58 ` [Qemu-devel] [PATCH 2/6] target-i386: cpu: separate feature string parsing from CPU model lookup Eduardo Habkost
2012-12-04 19:13   ` Igor Mammedov

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=50BF6F2A.4080306@suse.de \
    --to=afaerber@suse.de \
    --cc=Don@CloudSwitch.Com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).