[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qom-cpu 1/4] target-i386: Inline -cpu host check
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH qom-cpu 1/4] target-i386: Inline -cpu host check into cpu_x86_register() |
Date: |
Mon, 10 Dec 2012 10:46:13 -0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, Dec 09, 2012 at 08:45:50PM +0100, Andreas Färber 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).
>
> Signed-off-by: Andreas Färber <address@hidden>
> ---
> target-i386/cpu.c | 12 +++++++-----
> 1 Datei geändert, 7 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)
>
> 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_cpu_def,
> const char *name)
> break;
> }
> }
> - if (kvm_enabled() && name && strcmp(name, "host") == 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
> *cpu_model)
> name = model_pieces[0];
> features = model_pieces[1];
>
> - if (cpu_x86_find_by_name(def, name) < 0) {
> - goto error;
> + if (kvm_enabled() && strcmp(name, "host") == 0) {
> + kvm_cpu_fill_host(def);
> + } else {
> + if (cpu_x86_find_by_name(def, name) < 0) {
> + goto error;
> + }
> }
>
> if (cpu_x86_parse_featurestr(def, features) < 0) {
> --
> 1.7.10.4
>
--
Eduardo
[Qemu-devel] [PATCH qom-cpu 0/4] target-i386: Finish killing cpudef support, Andreas Färber, 2012/12/09
[Qemu-devel] [PATCH qom-cpu 2/4] target-i386: Drop redundant list of CPU definitions, Andreas Färber, 2012/12/09
[Qemu-devel] [PATCH qom-cpu 3/4] Really finally kill cpudef config section support, Andreas Färber, 2012/12/09