From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>, qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
qemu-trivial@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Michael Tokarev" <mjt@tls.msk.ru>,
"Markus Armbruster" <armbru@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH v4 2/3] target/i386/cpu: Restrict some of feature-words uses to system-mode
Date: Thu, 1 Oct 2020 16:41:51 +0200 [thread overview]
Message-ID: <20201001144152.1555659-3-philmd@redhat.com> (raw)
In-Reply-To: <20201001144152.1555659-1-philmd@redhat.com>
The feature-words properties are not used in user-mode emulation,
restrict it to system-mode.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
target/i386/cpu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 2eec53ca22..9f72342506 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4607,6 +4607,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, const char *name,
cpu->env.tsc_khz = cpu->env.user_tsc_khz = value / 1000;
}
+#if !defined(CONFIG_USER_ONLY)
/* Generic getter for "feature-words" and "filtered-features" properties */
static void x86_cpu_get_feature_words(Object *obj, Visitor *v,
const char *name, void *opaque,
@@ -4666,6 +4667,7 @@ static const char *x86_cpu_feature_name(FeatureWord w, int bitnr)
assert(bitnr < 32 || !(name && feature_word_info[w].type == CPUID_FEATURE_WORD));
return name;
}
+#endif /* CONFIG_USER_ONLY */
/*
* Convert all '_' in a feature string option name to '-', to make feature
@@ -4783,6 +4785,7 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features,
static void x86_cpu_expand_features(X86CPU *cpu, Error **errp);
static void x86_cpu_filter_features(X86CPU *cpu, bool verbose);
+#if !defined(CONFIG_USER_ONLY)
/* 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)
@@ -4853,6 +4856,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
object_unref(OBJECT(xc));
}
+#endif /* CONFIG_USER_ONLY */
/* Print all cpuid feature names in featureset
*/
@@ -4987,7 +4991,9 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
info = g_malloc0(sizeof(*info));
info->name = x86_cpu_class_get_model_name(cc);
+#if !defined(CONFIG_USER_ONLY)
x86_cpu_class_check_missing_features(cc, &info->unavailable_features);
+#endif
info->has_unavailable_features = true;
info->q_typename = g_strdup(object_class_get_name(oc));
info->migration_safe = cc->migration_safe;
@@ -6941,6 +6947,7 @@ static void x86_cpu_initfn(Object *obj)
object_property_add(obj, "tsc-frequency", "int",
x86_cpuid_get_tsc_freq,
x86_cpuid_set_tsc_freq, NULL, NULL);
+#if !defined(CONFIG_USER_ONLY)
object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)env->features);
@@ -6957,7 +6964,6 @@ static void x86_cpu_initfn(Object *obj)
x86_cpu_get_unavailable_features,
NULL, NULL, NULL);
-#if !defined(CONFIG_USER_ONLY)
object_property_add(obj, "crash-information", "GuestPanicInformation",
x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
#endif
--
2.26.2
next prev parent reply other threads:[~2020-10-01 14:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 14:41 [PATCH v4 0/3] target/i386: Restrict 'feature-words' property to x86 machines Philippe Mathieu-Daudé
2020-10-01 14:41 ` [PATCH v4 1/3] target/i386/cpu: Trivial code movement Philippe Mathieu-Daudé
2020-10-01 14:41 ` Philippe Mathieu-Daudé [this message]
2020-10-01 14:44 ` [PATCH v4 2/3] target/i386/cpu: Restrict some of feature-words uses to system-mode Philippe Mathieu-Daudé
2020-10-01 15:14 ` Paolo Bonzini
2020-10-01 15:27 ` Philippe Mathieu-Daudé
2020-10-01 15:37 ` Eduardo Habkost
2020-10-01 15:57 ` Philippe Mathieu-Daudé
2020-10-01 16:15 ` Eduardo Habkost
2020-10-01 14:41 ` [PATCH v4 3/3] target/i386: Restrict X86CPUFeatureWord to X86 targets Philippe Mathieu-Daudé
2020-10-01 15:29 ` Eduardo Habkost
2020-10-01 15:37 ` Philippe Mathieu-Daudé
2020-10-01 15:53 ` Eduardo Habkost
2020-10-02 6:55 ` Markus Armbruster
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=20201001144152.1555659-3-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=laurent@vivier.eu \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).