All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11
@ 2019-06-11 13:42 Eduardo Habkost
  2019-06-11 13:42 ` [Qemu-devel] [PULL 1/3] i386: x86_cpu_list_feature_names() function Eduardo Habkost
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eduardo Habkost @ 2019-06-11 13:42 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Richard Henderson

The following changes since commit a578cdfbdd8f9beff5ced52b7826ddb1669abbbf:

  Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190610' into staging (2019-06-10 16:09:19 +0100)

are available in the Git repository at:

  git://github.com/ehabkost/qemu.git tags/x86-next-pull-request

for you to fetch changes up to 89a44a103315267122119b4311218d00d2561ebe:

  i386: Save EFER for 32-bit targets (2019-06-11 10:17:47 -0300)

----------------------------------------------------------------
x86 queue, 2019-06-11

* "unavailable-features" QOM property (Eduardo Habkost)
* Save EFER for 32-bit targets (Pavel Dovgalyuk)

----------------------------------------------------------------

Eduardo Habkost (2):
  i386: x86_cpu_list_feature_names() function
  i386: "unavailable-features" QOM property

Pavel Dovgalyuk (1):
  i386: Save EFER for 32-bit targets

 target/i386/cpu.c     | 55 +++++++++++++++++++++++++++++++++----------
 target/i386/machine.c | 24 +++++++++++++++++++
 2 files changed, 66 insertions(+), 13 deletions(-)

-- 
2.18.0.rc1.1.g3f1ff2140



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 1/3] i386: x86_cpu_list_feature_names() function
  2019-06-11 13:42 [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Eduardo Habkost
@ 2019-06-11 13:42 ` Eduardo Habkost
  2019-06-11 13:42 ` [Qemu-devel] [PULL 2/3] i386: "unavailable-features" QOM property Eduardo Habkost
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2019-06-11 13:42 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Richard Henderson

Extract feature name listing code from
x86_cpu_class_check_missing_features().  It will be reused to
return information about CPU filtered features at runtime.

Message-Id: <20190422234742.15780-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b21ecaac17..36589adb1f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3671,6 +3671,27 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features,
 static void x86_cpu_expand_features(X86CPU *cpu, Error **errp);
 static int x86_cpu_filter_features(X86CPU *cpu);
 
+/* Build a list with the name of all features on a feature word array */
+static void x86_cpu_list_feature_names(FeatureWordArray features,
+                                       strList **feat_names)
+{
+    FeatureWord w;
+    strList **next = feat_names;
+
+    for (w = 0; w < FEATURE_WORDS; w++) {
+        uint32_t filtered = features[w];
+        int i;
+        for (i = 0; i < 32; i++) {
+            if (filtered & (1UL << i)) {
+                strList *new = g_new0(strList, 1);
+                new->value = g_strdup(x86_cpu_feature_name(w, i));
+                *next = new;
+                next = &new->next;
+            }
+        }
+    }
+}
+
 /* Check for missing features that may prevent the CPU class from
  * running using the current machine and accelerator.
  */
@@ -3678,7 +3699,6 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
                                                  strList **missing_feats)
 {
     X86CPU *xc;
-    FeatureWord w;
     Error *err = NULL;
     strList **next = missing_feats;
 
@@ -3705,18 +3725,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
 
     x86_cpu_filter_features(xc);
 
-    for (w = 0; w < FEATURE_WORDS; w++) {
-        uint32_t filtered = xc->filtered_features[w];
-        int i;
-        for (i = 0; i < 32; i++) {
-            if (filtered & (1UL << i)) {
-                strList *new = g_new0(strList, 1);
-                new->value = g_strdup(x86_cpu_feature_name(w, i));
-                *next = new;
-                next = &new->next;
-            }
-        }
-    }
+    x86_cpu_list_feature_names(xc->filtered_features, next);
 
     object_unref(OBJECT(xc));
 }
-- 
2.18.0.rc1.1.g3f1ff2140



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 2/3] i386: "unavailable-features" QOM property
  2019-06-11 13:42 [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Eduardo Habkost
  2019-06-11 13:42 ` [Qemu-devel] [PULL 1/3] i386: x86_cpu_list_feature_names() function Eduardo Habkost
@ 2019-06-11 13:42 ` Eduardo Habkost
  2019-06-11 13:42 ` [Qemu-devel] [PULL 3/3] i386: Save EFER for 32-bit targets Eduardo Habkost
  2019-06-11 15:40 ` [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2019-06-11 13:42 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Richard Henderson

Add a "unavailable-features" QOM property to X86CPU objects that
have the same semantics of "unavailable-features" on
query-cpu-definitions.  The new property has the same goal of
"filtered-features", but is generic enough to let any kind of CPU
feature to be listed there without relying on low level details
like CPUID leaves or MSR numbers.

Message-Id: <20190422234742.15780-3-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 36589adb1f..7e5b545005 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3692,6 +3692,17 @@ static void x86_cpu_list_feature_names(FeatureWordArray features,
     }
 }
 
+static void x86_cpu_get_unavailable_features(Object *obj, Visitor *v,
+                                             const char *name, void *opaque,
+                                             Error **errp)
+{
+    X86CPU *xc = X86_CPU(obj);
+    strList *result = NULL;
+
+    x86_cpu_list_feature_names(xc->filtered_features, &result);
+    visit_type_strList(v, "unavailable-features", &result, errp);
+}
+
 /* Check for missing features that may prevent the CPU class from
  * running using the current machine and accelerator.
  */
@@ -5632,6 +5643,15 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
                         x86_cpu_get_feature_words,
                         NULL, NULL, (void *)cpu->filtered_features, NULL);
+    /*
+     * The "unavailable-features" property has the same semantics as
+     * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
+     * QMP command: they list the features that would have prevented the
+     * CPU from running if the "enforce" flag was set.
+     */
+    object_property_add(obj, "unavailable-features", "strList",
+                        x86_cpu_get_unavailable_features,
+                        NULL, NULL, NULL, &error_abort);
 
     object_property_add(obj, "crash-information", "GuestPanicInformation",
                         x86_cpu_get_crash_info_qom, NULL, NULL, NULL, NULL);
-- 
2.18.0.rc1.1.g3f1ff2140



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 3/3] i386: Save EFER for 32-bit targets
  2019-06-11 13:42 [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Eduardo Habkost
  2019-06-11 13:42 ` [Qemu-devel] [PULL 1/3] i386: x86_cpu_list_feature_names() function Eduardo Habkost
  2019-06-11 13:42 ` [Qemu-devel] [PULL 2/3] i386: "unavailable-features" QOM property Eduardo Habkost
@ 2019-06-11 13:42 ` Eduardo Habkost
  2019-06-11 15:40 ` [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2019-06-11 13:42 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Pavel Dovgalyuk, Eduardo Habkost, Richard Henderson

From: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>

i386 (32 bit) emulation uses EFER in wrmsr and in MMU fault
processing.
But it does not included in VMState, because "efer" field is disabled with

This patch adds a section for 32-bit targets which saves EFER when
it's value is non-zero.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <155913371654.8429.1659082639780315242.stgit@pasha-Precision-3630-Tower>
Reviewed-by: Peter Xu <peterx@redhat.com>
[ehabkost: indentation fix]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/machine.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/target/i386/machine.c b/target/i386/machine.c
index 225b5d433b..2c96cfc9a2 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -964,6 +964,27 @@ static const VMStateDescription vmstate_svm_npt = {
     }
 };
 
+#ifndef TARGET_X86_64
+static bool intel_efer32_needed(void *opaque)
+{
+    X86CPU *cpu = opaque;
+    CPUX86State *env = &cpu->env;
+
+    return env->efer != 0;
+}
+
+static const VMStateDescription vmstate_efer32 = {
+    .name = "cpu/efer32",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = intel_efer32_needed,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT64(env.efer, X86CPU),
+        VMSTATE_END_OF_LIST()
+    }
+};
+#endif
+
 VMStateDescription vmstate_x86_cpu = {
     .name = "cpu",
     .version_id = 12,
@@ -1089,6 +1110,9 @@ VMStateDescription vmstate_x86_cpu = {
         &vmstate_msr_intel_pt,
         &vmstate_msr_virt_ssbd,
         &vmstate_svm_npt,
+#ifndef TARGET_X86_64
+        &vmstate_efer32,
+#endif
         NULL
     }
 };
-- 
2.18.0.rc1.1.g3f1ff2140



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11
  2019-06-11 13:42 [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Eduardo Habkost
                   ` (2 preceding siblings ...)
  2019-06-11 13:42 ` [Qemu-devel] [PULL 3/3] i386: Save EFER for 32-bit targets Eduardo Habkost
@ 2019-06-11 15:40 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2019-06-11 15:40 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, QEMU Developers, Richard Henderson

On Tue, 11 Jun 2019 at 14:42, Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> The following changes since commit a578cdfbdd8f9beff5ced52b7826ddb1669abbbf:
>
>   Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190610' into staging (2019-06-10 16:09:19 +0100)
>
> are available in the Git repository at:
>
>   git://github.com/ehabkost/qemu.git tags/x86-next-pull-request
>
> for you to fetch changes up to 89a44a103315267122119b4311218d00d2561ebe:
>
>   i386: Save EFER for 32-bit targets (2019-06-11 10:17:47 -0300)
>
> ----------------------------------------------------------------
> x86 queue, 2019-06-11
>
> * "unavailable-features" QOM property (Eduardo Habkost)
> * Save EFER for 32-bit targets (Pavel Dovgalyuk)
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-11 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 13:42 [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Eduardo Habkost
2019-06-11 13:42 ` [Qemu-devel] [PULL 1/3] i386: x86_cpu_list_feature_names() function Eduardo Habkost
2019-06-11 13:42 ` [Qemu-devel] [PULL 2/3] i386: "unavailable-features" QOM property Eduardo Habkost
2019-06-11 13:42 ` [Qemu-devel] [PULL 3/3] i386: Save EFER for 32-bit targets Eduardo Habkost
2019-06-11 15:40 ` [Qemu-devel] [PULL 0/3] x86 queue, 2019-06-11 Peter Maydell

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.