Re: [PATCH] target-i386: Improve x86_cpu_list output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 23, 2013 at 04:45:00PM +0100, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
> 
> Several issues fixed:
>  - We were missing a bunch of feature lists. Fix this by simply dumping
>    the meta list feature_word_info.
>  - kvm_enabled() cannot be true at this point because accelerators are
>    initialized much later during init. Simply dump unconditionally.
>  - Add explanation for "host" CPU type.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
> ---
>  target-i386/cpu.c |   20 +++++++++-----------
>  1 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index dfcf86e..6e742f0 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1453,18 +1453,16 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
>          snprintf(buf, sizeof(buf), "%s", def->name);
>          (*cpu_fprintf)(f, "x86 %16s  %-48s\n", buf, def->model_id);
>      }
> -    if (kvm_enabled()) {
> -        (*cpu_fprintf)(f, "x86 %16s\n", "[host]");
> -    }
> +    (*cpu_fprintf)(f, "x86 %16s  %-48s\n", "host",
> +                   "KVM processor with all supported host features");
> +
>      (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
> -    listflags(buf, sizeof(buf), (uint32_t)~0, feature_name, 1);
> -    (*cpu_fprintf)(f, "  %s\n", buf);
> -    listflags(buf, sizeof(buf), (uint32_t)~0, ext_feature_name, 1);
> -    (*cpu_fprintf)(f, "  %s\n", buf);
> -    listflags(buf, sizeof(buf), (uint32_t)~0, ext2_feature_name, 1);
> -    (*cpu_fprintf)(f, "  %s\n", buf);
> -    listflags(buf, sizeof(buf), (uint32_t)~0, ext3_feature_name, 1);
> -    (*cpu_fprintf)(f, "  %s\n", buf);
> +    for (i = 0; i < ARRAY_SIZE(feature_word_info); i++) {
> +        FeatureWordInfo *fw = &feature_word_info[i];
> +
> +        listflags(buf, sizeof(buf), (uint32_t)~0, fw->feat_names, 1);

To be done later: we can kill the 'fbits' parameter on listflags(). All
callers are using ~0, now (I don't even remember why the parameter
existed).

I was planning to keep the posibility of having FeatureWordInfo entries
without feat_names set. For example, we may want to make a specific
feature word supported by "-cpu host" before we make each bit
configurable individually in the command-line.

On the other hand, requiring feat_names to be always set would help
making the table more explicit. If we really want it (which I doubt), we
can have the same effect of feat_names==NULL by simply having a feature
name array with only NULL entries. So:

Reviewed-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>

> +        (*cpu_fprintf)(f, "  %s\n", buf);
> +    }
>  }
>  
>  CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
> -- 
> 1.7.3.4
> 



-- 
Eduardo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux