Received: from eggs.gnu.org ([208.118.235.92]:45217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti2j0-00088r-IM for qemu-devel@nongnu.org; Mon, 10 Dec 2012 07:44:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ti2iw-0005qT-9G for qemu-devel@nongnu.org; Mon, 10 Dec 2012 07:44:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti2iw-0005qN-1F for qemu-devel@nongnu.org; Mon, 10 Dec 2012 07:44:42 -0500 Date: Mon, 10 Dec 2012 10:46:13 -0200 From: Eduardo Habkost Message-ID: <20121210124613.GI4255@otherpad.lan.raisama.net> References: <1354645978-17362-1-git-send-email-ehabkost@redhat.com> <1355082353-322-1-git-send-email-afaerber@suse.de> <1355082353-322-2-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1355082353-322-2-git-send-email-afaerber@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-cpu 1/4] target-i386: Inline -cpu host check into cpu_x86_register() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: blauwirbel@gmail.com, imammedo@redhat.com, qemu-devel@nongnu.org On Sun, Dec 09, 2012 at 08:45:50PM +0100, Andreas F=E4rber wrote: > Simplifies the upcoming cleanup of cpu_x86_find_by_name(). ...by making cpu_x86_register() more complicated, and having CPU model name lookup spread into different parts of the code. The CPU model lookup is a bit complex because of the "host" exception, but at least the complexity was hidden inside cpu_x86_find_by_name() (making it very easy to replace that logic by a CPU subclass lookup, later). >=20 > Signed-off-by: Andreas F=E4rber > --- > target-i386/cpu.c | 12 +++++++----- > 1 Datei ge=E4ndert, 7 Zeilen hinzugef=FCgt(+), 5 Zeilen entfernt(-) >=20 > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 7be3ad8..a46faa2 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1217,9 +1217,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cp= u_def, const char *name) > break; > } > } > - if (kvm_enabled() && name && strcmp(name, "host") =3D=3D 0) { > - kvm_cpu_fill_host(x86_cpu_def); > - } else if (!def) { > + if (!def) { > return -1; > } else { > memcpy(x86_cpu_def, def, sizeof(*def)); > @@ -1505,8 +1503,12 @@ int cpu_x86_register(X86CPU *cpu, const char *cp= u_model) > name =3D model_pieces[0]; > features =3D model_pieces[1]; > =20 > - if (cpu_x86_find_by_name(def, name) < 0) { > - goto error; > + if (kvm_enabled() && strcmp(name, "host") =3D=3D 0) { > + kvm_cpu_fill_host(def); > + } else { > + if (cpu_x86_find_by_name(def, name) < 0) { > + goto error; > + } > } > =20 > if (cpu_x86_parse_featurestr(def, features) < 0) { > --=20 > 1.7.10.4 >=20 --=20 Eduardo