* [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type
@ 2018-07-02 16:56 Greg Kurz
2018-07-02 17:05 ` Daniel P. Berrangé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Greg Kurz @ 2018-07-02 16:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost
Since commit d6dcc5583e7, '-cpu ?' shows the description of the
X86_CPU_TYPE_NAME("max") for the host CPU model:
Enables all features supported by the accelerator in the current host
instead of the expected:
KVM processor with all supported host features
or
HVF processor with all supported host features
This is caused by the early use of kvm_enabled() and hvf_enabled() in
a class_init function. Since the accelerator isn't configured yet, both
helpers return false unconditionally.
A QEMU binary will only be compiled with one of these accelerators, not
both. The appropriate description can thus be decided at build time.
Signed-off-by: Greg Kurz <groug@kaod.org>
---
target/i386/cpu.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1e6a7d0a7504..e5da60b28973 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2838,13 +2838,13 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
xcc->host_cpuid_required = true;
xcc->ordering = 8;
- if (kvm_enabled()) {
- xcc->model_description =
- "KVM processor with all supported host features ";
- } else if (hvf_enabled()) {
- xcc->model_description =
- "HVF processor with all supported host features ";
- }
+#if defined(CONFIG_KVM)
+ xcc->model_description =
+ "KVM processor with all supported host features ";
+#elif defined(CONFIG_HVF)
+ xcc->model_description =
+ "HVF processor with all supported host features ";
+#endif
}
static const TypeInfo host_x86_cpu_type_info = {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type
2018-07-02 16:56 [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type Greg Kurz
@ 2018-07-02 17:05 ` Daniel P. Berrangé
2018-07-02 17:35 ` Paolo Bonzini
2018-07-02 19:23 ` Eric Blake
2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-07-02 17:05 UTC (permalink / raw)
To: Greg Kurz; +Cc: qemu-devel, Paolo Bonzini, Eduardo Habkost, Richard Henderson
On Mon, Jul 02, 2018 at 06:56:06PM +0200, Greg Kurz wrote:
> Since commit d6dcc5583e7, '-cpu ?' shows the description of the
> X86_CPU_TYPE_NAME("max") for the host CPU model:
>
> Enables all features supported by the accelerator in the current host
>
> instead of the expected:
>
> KVM processor with all supported host features
>
> or
>
> HVF processor with all supported host features
>
> This is caused by the early use of kvm_enabled() and hvf_enabled() in
> a class_init function. Since the accelerator isn't configured yet, both
> helpers return false unconditionally.
>
> A QEMU binary will only be compiled with one of these accelerators, not
> both. The appropriate description can thus be decided at build time.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> target/i386/cpu.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 1e6a7d0a7504..e5da60b28973 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -2838,13 +2838,13 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
Sigh, yet another case of relying on runtime state during class_init impls.
> xcc->host_cpuid_required = true;
> xcc->ordering = 8;
>
> - if (kvm_enabled()) {
> - xcc->model_description =
> - "KVM processor with all supported host features ";
> - } else if (hvf_enabled()) {
> - xcc->model_description =
> - "HVF processor with all supported host features ";
> - }
> +#if defined(CONFIG_KVM)
> + xcc->model_description =
> + "KVM processor with all supported host features ";
> +#elif defined(CONFIG_HVF)
> + xcc->model_description =
> + "HVF processor with all supported host features ";
> +#endif
> }
>
> static const TypeInfo host_x86_cpu_type_info = {
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type
2018-07-02 16:56 [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type Greg Kurz
2018-07-02 17:05 ` Daniel P. Berrangé
@ 2018-07-02 17:35 ` Paolo Bonzini
2018-07-02 19:23 ` Eric Blake
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2018-07-02 17:35 UTC (permalink / raw)
To: Greg Kurz, qemu-devel; +Cc: Richard Henderson, Eduardo Habkost
On 02/07/2018 18:56, Greg Kurz wrote:
> Since commit d6dcc5583e7, '-cpu ?' shows the description of the
> X86_CPU_TYPE_NAME("max") for the host CPU model:
>
> Enables all features supported by the accelerator in the current host
>
> instead of the expected:
>
> KVM processor with all supported host features
>
> or
>
> HVF processor with all supported host features
>
> This is caused by the early use of kvm_enabled() and hvf_enabled() in
> a class_init function. Since the accelerator isn't configured yet, both
> helpers return false unconditionally.
>
> A QEMU binary will only be compiled with one of these accelerators, not
> both. The appropriate description can thus be decided at build time.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> target/i386/cpu.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 1e6a7d0a7504..e5da60b28973 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -2838,13 +2838,13 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
> xcc->host_cpuid_required = true;
> xcc->ordering = 8;
>
> - if (kvm_enabled()) {
> - xcc->model_description =
> - "KVM processor with all supported host features ";
> - } else if (hvf_enabled()) {
> - xcc->model_description =
> - "HVF processor with all supported host features ";
> - }
> +#if defined(CONFIG_KVM)
> + xcc->model_description =
> + "KVM processor with all supported host features ";
> +#elif defined(CONFIG_HVF)
> + xcc->model_description =
> + "HVF processor with all supported host features ";
> +#endif
> }
>
> static const TypeInfo host_x86_cpu_type_info = {
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type
2018-07-02 16:56 [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type Greg Kurz
2018-07-02 17:05 ` Daniel P. Berrangé
2018-07-02 17:35 ` Paolo Bonzini
@ 2018-07-02 19:23 ` Eric Blake
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2018-07-02 19:23 UTC (permalink / raw)
To: Greg Kurz, qemu-devel; +Cc: Paolo Bonzini, Eduardo Habkost, Richard Henderson
On 07/02/2018 11:56 AM, Greg Kurz wrote:
> Since commit d6dcc5583e7, '-cpu ?' shows the description of the
> X86_CPU_TYPE_NAME("max") for the host CPU model:
In the subject line and here, let's favor '-cpu help' as the preferred
spelling for this command line option. (-cpu ? requires shell quoting
to avoid unintentionally globbing to one-letter files in the current
directory)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-02 19:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-02 16:56 [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type Greg Kurz
2018-07-02 17:05 ` Daniel P. Berrangé
2018-07-02 17:35 ` Paolo Bonzini
2018-07-02 19:23 ` Eric Blake
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).