aboutsummaryrefslogtreecommitdiff
path: root/target/i386
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-02-23 16:55:38 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-03-02 07:51:33 +0100
commit390dbc6e2e08c30b95597371b9fc74f6157e8d0e (patch)
tree47e643bf8ef56940530762fa1f04794dd3707bc5 /target/i386
parent3362f04dbc6a66cd8f2c9f218b84c5c9f9559411 (diff)
target/i386: Restrict 'qapi-commands-machine.h' to system emulation
Since commit a0e61807a3 ("qapi: Remove QMP events and commands from user-mode builds") we don't generate the "qapi-commands-machine.h" header in a user-emulation-only build. Guard qmp_query_cpu_definitions() within CONFIG_USER_ONLY; move x86_cpu_class_check_missing_features() closer since it is only used by this QMP command handler. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230223155540.30370-3-philmd@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'target/i386')
-rw-r--r--target/i386/cpu.c74
1 files changed, 39 insertions, 35 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 4bad3d41d3..4d508624e1 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -31,11 +31,11 @@
#include "qapi/error.h"
#include "qapi/qapi-visit-machine.h"
#include "qapi/qmp/qerror.h"
-#include "qapi/qapi-commands-machine-target.h"
#include "standard-headers/asm-x86/kvm_para.h"
#include "hw/qdev-properties.h"
#include "hw/i386/topology.h"
#ifndef CONFIG_USER_ONLY
+#include "qapi/qapi-commands-machine-target.h"
#include "exec/address-spaces.h"
#include "hw/boards.h"
#include "hw/i386/sgx-epc.h"
@@ -4843,40 +4843,6 @@ static void x86_cpu_get_unavailable_features(Object *obj, Visitor *v,
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.
- */
-static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
- strList **list)
-{
- strList **tail = list;
- X86CPU *xc;
- Error *err = NULL;
-
- if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) {
- QAPI_LIST_APPEND(tail, g_strdup("kvm"));
- return;
- }
-
- xc = X86_CPU(object_new_with_class(OBJECT_CLASS(xcc)));
-
- x86_cpu_expand_features(xc, &err);
- if (err) {
- /* Errors at x86_cpu_expand_features should never happen,
- * but in case it does, just report the model as not
- * runnable at all using the "type" property.
- */
- QAPI_LIST_APPEND(tail, g_strdup("type"));
- error_free(err);
- }
-
- x86_cpu_filter_features(xc, false);
-
- x86_cpu_list_feature_names(xc->filtered_features, tail);
-
- object_unref(OBJECT(xc));
-}
-
/* Print all cpuid feature names in featureset
*/
static void listflags(GList *features)
@@ -5005,6 +4971,42 @@ void x86_cpu_list(void)
g_list_free(names);
}
+#ifndef CONFIG_USER_ONLY
+
+/* Check for missing features that may prevent the CPU class from
+ * running using the current machine and accelerator.
+ */
+static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
+ strList **list)
+{
+ strList **tail = list;
+ X86CPU *xc;
+ Error *err = NULL;
+
+ if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) {
+ QAPI_LIST_APPEND(tail, g_strdup("kvm"));
+ return;
+ }
+
+ xc = X86_CPU(object_new_with_class(OBJECT_CLASS(xcc)));
+
+ x86_cpu_expand_features(xc, &err);
+ if (err) {
+ /* Errors at x86_cpu_expand_features should never happen,
+ * but in case it does, just report the model as not
+ * runnable at all using the "type" property.
+ */
+ QAPI_LIST_APPEND(tail, g_strdup("type"));
+ error_free(err);
+ }
+
+ x86_cpu_filter_features(xc, false);
+
+ x86_cpu_list_feature_names(xc->filtered_features, tail);
+
+ object_unref(OBJECT(xc));
+}
+
static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
{
ObjectClass *oc = data;
@@ -5045,6 +5047,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
return cpu_list;
}
+#endif /* !CONFIG_USER_ONLY */
+
uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
bool migratable_only)
{