All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Jiri Denemark" <jdenemar@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Igor Mammedov" <imammedo@redhat.com>,
	libvir-list@redhat.com
Subject: [Qemu-devel] [PATCH 5/9] target-i386: Move warning code outside x86_cpu_filter_features()
Date: Fri,  6 May 2016 15:11:28 -0300	[thread overview]
Message-ID: <1462558292-2126-6-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1462558292-2126-1-git-send-email-ehabkost@redhat.com>

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>
---
 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 037b602..465c125 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2152,9 +2152,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;
         }
     }
@@ -2162,6 +2159,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;
@@ -2936,12 +2942,16 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
         env->cpuid_level = 7;
     }
 
-    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
-- 
2.5.5

  parent reply	other threads:[~2016-05-06 18:12 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 18:11 [Qemu-devel] [PATCH 0/9] Add runnability info to query-cpu-definitions Eduardo Habkost
2016-05-06 18:11 ` [Qemu-devel] [PATCH 1/9] target-i386: Move TCG initialization check to tcg_x86_init() Eduardo Habkost
2016-05-10 14:58   ` Igor Mammedov
2016-05-06 18:11 ` [Qemu-devel] [PATCH 2/9] target-i386: Move TCG initialization to realize time Eduardo Habkost
2016-05-10 15:10   ` Igor Mammedov
2016-05-06 18:11 ` [Qemu-devel] [PATCH 3/9] target-i386: Call cpu_exec_init() on realize Eduardo Habkost
2016-05-10 15:15   ` Igor Mammedov
2016-05-06 18:11 ` [Qemu-devel] [PATCH 4/9] target-i386: List CPU models using subclass list Eduardo Habkost
2016-05-06 18:11 ` Eduardo Habkost [this message]
2016-05-06 18:11 ` [Qemu-devel] [PATCH 6/9] target-i386: Define CPUID filtering functions before x86_cpu_list() Eduardo Habkost
2016-05-06 18:11 ` [Qemu-devel] [PATCH 7/9] qmp: Add runnability information to query-cpu-definitions Eduardo Habkost
2016-05-09  6:04   ` Markus Armbruster
2016-05-09  8:54   ` David Hildenbrand
2016-05-09 12:00     ` Eduardo Habkost
2016-05-09 12:05       ` David Hildenbrand
2016-05-09 12:36         ` Eduardo Habkost
2016-05-09 13:06           ` David Hildenbrand
2016-05-09 19:45             ` Eduardo Habkost
2016-05-10  6:32               ` David Hildenbrand
2016-05-10 12:03                 ` Eduardo Habkost
2016-05-09 15:20   ` [Qemu-devel] [libvirt] " Eric Blake
2016-05-09 19:25     ` Eduardo Habkost
2016-05-10  8:23       ` Markus Armbruster
2016-05-10  8:31         ` Jiri Denemark
2016-05-10 11:57         ` Eduardo Habkost
2016-05-11  7:11           ` Markus Armbruster
2016-05-11 19:35             ` Eduardo Habkost
2016-05-12  6:46               ` David Hildenbrand
2016-05-12  7:19               ` Jiri Denemark
2016-05-12 11:07                 ` Eduardo Habkost
2016-05-12  7:46               ` Markus Armbruster
2016-05-27 20:19                 ` Eduardo Habkost
2016-05-30  9:33                   ` Markus Armbruster
2016-05-31 12:01                     ` Eduardo Habkost
2016-05-31 13:24                       ` Markus Armbruster
2016-05-31 14:51                         ` Eduardo Habkost
2016-06-03 11:38                           ` David Hildenbrand
2016-05-06 18:11 ` [Qemu-devel] [PATCH 8/9] target-i386: Use "-" instead of "_" on all feature names Eduardo Habkost
2016-05-10 15:19   ` Igor Mammedov
2016-05-10 17:36     ` Jiri Denemark
2016-05-24 12:17   ` Igor Mammedov
2016-05-24 12:34     ` Eduardo Habkost
2016-05-24 13:22       ` Igor Mammedov
2016-05-27 20:32         ` Eduardo Habkost
2016-05-30  8:43           ` Igor Mammedov
2016-05-06 18:11 ` [Qemu-devel] [PATCH 9/9] target-i386: Return runnability information on query-cpu-definitions Eduardo Habkost
2016-05-09  7:24 ` [Qemu-devel] [PATCH 0/9] Add runnability info to query-cpu-definitions David Hildenbrand

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=1462558292-2126-6-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.