qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, dahi@linux.vnet.ibm.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	Jiri Denemark <jdenemar@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	libvir-list@redhat.com
Subject: Re: [Qemu-devel] [PATCH v6 1/3] target-i386: Move warning code outside x86_cpu_filter_features()
Date: Mon, 10 Oct 2016 13:57:08 +0200	[thread overview]
Message-ID: <20161010135708.580cd09b@nial.brq.redhat.com> (raw)
In-Reply-To: <1475872142-3986-2-git-send-email-ehabkost@redhat.com>

On Fri,  7 Oct 2016 17:29:00 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:

> x86_cpu_filter_features() will be reused by code that shouldn't
> print any warning. Move the warning code to a new
> x86_cpu_report_filtered_features() function, and call it from
> x86_cpu_realizefn().
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Changes v5 -> v6:
> * Recovered v3 of patch, because x86_cpu_load_features()
>   won't call x86_cpu_filter_features() anymore and we can keep
>   the previous logic in x86_cpu_realizefn() that checked
>   x86_cpu_filter_features() return value
> 
> Changes v4 -> v5:
> * (none)
> 
> Changes v3 -> v4:
> * Made x86_cpu_filter_features() void, make
>   x86_cpu_report_filtered_features() return true if
>   some features were filtered
> ---
>  target-i386/cpu.c | 28 +++++++++++++++++++---------
>  1 file changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 61240dd..1e8127b 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -2177,9 +2177,6 @@ static int x86_cpu_filter_features(X86CPU *cpu)
>          env->features[w] &= host_feat;
>          cpu->filtered_features[w] = requested_features & ~env->features[w];
>          if (cpu->filtered_features[w]) {
> -            if (cpu->check_cpuid || cpu->enforce_cpuid) {
> -                report_unavailable_features(w, cpu->filtered_features[w]);
> -            }
>              rv = 1;
>          }
>      }
> @@ -2187,6 +2184,15 @@ static int x86_cpu_filter_features(X86CPU *cpu)
>      return rv;
>  }
>  
> +static void x86_cpu_report_filtered_features(X86CPU *cpu)
> +{
> +    FeatureWord w;
> +
> +    for (w = 0; w < FEATURE_WORDS; w++) {
> +        report_unavailable_features(w, cpu->filtered_features[w]);
> +    }
> +}
> +
>  static void x86_cpu_apply_props(X86CPU *cpu, PropValue *props)
>  {
>      PropValue *pv;
> @@ -3080,12 +3086,16 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
>          env->cpuid_xlevel2 = env->cpuid_min_xlevel2;
>      }
>  
> -    if (x86_cpu_filter_features(cpu) && cpu->enforce_cpuid) {
> -        error_setg(&local_err,
> -                   kvm_enabled() ?
> -                       "Host doesn't support requested features" :
> -                       "TCG doesn't support requested features");
> -        goto out;
> +    if (x86_cpu_filter_features(cpu) &&
> +        (cpu->check_cpuid || cpu->enforce_cpuid)) {
> +        x86_cpu_report_filtered_features(cpu);
> +        if (cpu->enforce_cpuid) {
> +            error_setg(&local_err,
> +                       kvm_enabled() ?
> +                           "Host doesn't support requested features" :
> +                           "TCG doesn't support requested features");
> +            goto out;
> +        }
>      }
>  
>      /* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on

  reply	other threads:[~2016-10-10 11:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 20:28 [Qemu-devel] [PATCH v6 0/3] Add runnability info to query-cpu-definitions Eduardo Habkost
2016-10-07 20:29 ` [Qemu-devel] [PATCH v6 1/3] target-i386: Move warning code outside x86_cpu_filter_features() Eduardo Habkost
2016-10-10 11:57   ` Igor Mammedov [this message]
2016-10-10 17:04     ` Eduardo Habkost
2016-10-07 20:29 ` [Qemu-devel] [PATCH v6 2/3] target-i386: x86_cpu_load_features() function Eduardo Habkost
2016-10-10 12:25   ` Igor Mammedov
2016-10-10 16:58     ` [Qemu-devel] [PATCH] fixup! " Eduardo Habkost
2016-10-11 11:41       ` Igor Mammedov
2016-10-14 14:59         ` Eduardo Habkost
2016-10-07 20:29 ` [Qemu-devel] [PATCH v6 3/3] target-i386: Return runnability information on query-cpu-definitions Eduardo Habkost
2016-10-10 12:27   ` Igor Mammedov
2016-10-10 17:01     ` Eduardo Habkost
2016-10-11 11:45       ` Igor Mammedov
2016-10-11 11:58         ` Eduardo Habkost
2016-10-11 13:21           ` Igor Mammedov
2016-10-11 13:24             ` Eduardo Habkost
2016-10-11 13:51               ` Igor Mammedov
2016-10-11 14:13   ` Igor Mammedov
2016-10-14 14:59     ` Eduardo Habkost

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=20161010135708.580cd09b@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).