From nobody Sun Feb 8 19:00:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614206814; cv=none; d=zohomail.com; s=zohoarc; b=ePm6JZKkdDzaTmqay9Cy1BvPa7hMBeiX2anPq8emgGfp923N6391jgU1wGYhuBEdOkahdb1CC0FqKIdrdVdcP1jlA6BV2s07v+X8Nwozl+loNGkQfu+6tv4Z7rlagCmF8A01BS76vnr5BykbY3PddH5Eq5oy4dO8NsBGFeoNSbQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614206814; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=t3qKRL/5hKgwJjLrl6DX6z760KxMHjG0maONNBBWZOo=; b=jgWdWHFwH3GPEoRT+YI88TAr98KJDCoswSi3P2gfRf0Usqrd98Awb9p3jtt51ylEOscvsdegfiFFMg1fU6xYfvVMojkhRlNZF7xuTGSC0rsj57kp9UjAx5Lddsb+xfpvgH5fHW3PkZ1cRvptzBXb081u7IiIS8asziURkQ90PFI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614206814185168.40947633030976; Wed, 24 Feb 2021 14:46:54 -0800 (PST) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-Myoji-XJNcO5wWOnpis40w-1; Wed, 24 Feb 2021 17:46:51 -0500 Received: by mail-wm1-f70.google.com with SMTP id z67so1140687wme.3 for ; Wed, 24 Feb 2021 14:46:50 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id q25sm4758201wmq.15.2021.02.24.14.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 14:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614206813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t3qKRL/5hKgwJjLrl6DX6z760KxMHjG0maONNBBWZOo=; b=KshQCUPQussEcAAXYLu727fzSayvbYnG85geCUrHlz8uOeLRkAmiqvmmBhdrSRyRK/8Dnm mDacX0axItYLCkdo7sf32l7MD30H8cpEJdTVutCTS34sExCMtPegh9gayLFCZl/uaa8Un9 Pie6gz4s70xirJtjWN04bpy3VcUwwFk= X-MC-Unique: Myoji-XJNcO5wWOnpis40w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t3qKRL/5hKgwJjLrl6DX6z760KxMHjG0maONNBBWZOo=; b=IeRZqnBHXR3T/hGx+O3hwFkzNMvFvUxzRxGxD7bwF3Vhv92eyt08foFlit9bDg1QDG IFHnaor38f3Cj+XoMDxee8mpWonJC8CyvVkZgdIQZpH8McM0PJLJJZHybEYSdr/DUPSj vK8t8Syfe54sCrj5EC/zZN1Rd/1QGGPP4lNnm9F+KVj4V0IStZeljWLfbWdGibM9m6qn FvwMp2Spn8bq8XZLc4v5pr7QfAmZ2762kwyk0Fo6+ONLbZG7ot1ES1rezJ/kUwR8ZKi6 D/SrYvdsLv4livANwMX/E2LZ/GsZKzROvPnYqwP5dSw+PCFIgL/N7hBaynr4DHrtoq9i ncVw== X-Gm-Message-State: AOAM531xl2KHPjeEgzNjMWGsPcuSA7XA7jXmAog1FakG7GtgCioH/6HC lGf0hR+aG8vWvfZLcIe2rds8B8V86PSpG/yBxJMT689gYQ1GNR44UAOEBiEBpNKTaojaonX+bhT r7GZi9kHzhJVRmw== X-Received: by 2002:a1c:f019:: with SMTP id a25mr246698wmb.125.1614206809982; Wed, 24 Feb 2021 14:46:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQ+LuWPaYSFLObDEA74/DDMFN9RFH/Udtvzcf51ajVQ+91j2B9aI4fPRfdXCuPOpXN8X7TwA== X-Received: by 2002:a1c:f019:: with SMTP id a25mr246680wmb.125.1614206809872; Wed, 24 Feb 2021 14:46:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Markus Armbruster , Laurent Vivier , Eric Blake , Marcel Apfelbaum , Claudio Fontana , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v5 1/4] target/i386/cpu: Introduce get_register_enum_32() helper Date: Wed, 24 Feb 2021 23:46:40 +0100 Message-Id: <20210224224643.3369940-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210224224643.3369940-1-philmd@redhat.com> References: <20210224224643.3369940-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Introduce get_register_enum_32(), similar to get_register_name_32(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu-internal.h | 4 ++++ target/i386/cpu.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu-internal.h b/target/i386/cpu-internal.h index be688cb393e..9df24c482ea 100644 --- a/target/i386/cpu-internal.h +++ b/target/i386/cpu-internal.h @@ -20,6 +20,8 @@ #ifndef I386_CPU_INTERNAL_H #define I386_CPU_INTERNAL_H =20 +#include "qapi/qapi-types-machine.h" + typedef enum FeatureWordType { CPUID_FEATURE_WORD, MSR_FEATURE_WORD, @@ -55,6 +57,8 @@ typedef struct FeatureWordInfo { =20 extern FeatureWordInfo feature_word_info[]; =20 +X86CPURegister32 get_register_enum_32(FeatureWord w); + void x86_cpu_expand_features(X86CPU *cpu, Error **errp); =20 #ifndef CONFIG_USER_ONLY diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 219d7652524..ffa342171ba 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1476,6 +1476,11 @@ static const char *get_register_name_32(unsigned int= reg) return x86_reg_info_32[reg].name; } =20 +X86CPURegister32 get_register_enum_32(FeatureWord w) +{ + return x86_reg_info_32[feature_word_info[w].cpuid.reg].qapi_enum; +} + /* * Returns the set of feature flags that are supported and migratable by * QEMU, for a given FeatureWord. @@ -4548,7 +4553,7 @@ static void x86_cpu_get_feature_words(Object *obj, Vi= sitor *v, qwi->cpuid_input_eax =3D wi->cpuid.eax; qwi->has_cpuid_input_ecx =3D wi->cpuid.needs_ecx; qwi->cpuid_input_ecx =3D wi->cpuid.ecx; - qwi->cpuid_register =3D x86_reg_info_32[wi->cpuid.reg].qapi_enum; + qwi->cpuid_register =3D get_register_enum_32(w); qwi->features =3D array[w]; =20 /* List will be in reverse order, but order shouldn't matter */ --=20 2.26.2 From nobody Sun Feb 8 19:00:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614206819; cv=none; d=zohomail.com; s=zohoarc; b=OrjSbf2uCPcNtAKHPpB9sn5t2zm/rTBlVI5MsLInQFmmloQXLCjTcNOOy4zR9HnrTqrNusG7orZBAZBiGvyYk2pu1F2UMalUYnUKy054JdWTYJIsx0HqUmpyx5mARGGhQBj5+sePSIX41yN5F3S4LFqt+7m5yCwlwNzmis0f/fA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614206819; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=EVnue42BrttlBCQCGj0TZzTKP7+Zxi1Gm+4446lormI=; b=WM0q23Z572HWaGLHSegJy4WmB7pVEcDufhgMpZWTS2UEl7aWJoJgjeaoiGKSMa5k5oHi2Dzkw+gFDYR/6/URX5lJhky7Xq7do27eV9vznKwKxR8MTdHddjOaw9NF1dugHlkdQ7imEIOc6xq8LT9+v0g8FAK0nouLS7j//0ILj70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614206819284791.729674282581; Wed, 24 Feb 2021 14:46:59 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-P0GGfzGONbieKFwoj4ObHQ-1; Wed, 24 Feb 2021 17:46:56 -0500 Received: by mail-wm1-f69.google.com with SMTP id b62so1136770wmc.5 for ; Wed, 24 Feb 2021 14:46:56 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id i8sm6364961wry.90.2021.02.24.14.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 14:46:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614206818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EVnue42BrttlBCQCGj0TZzTKP7+Zxi1Gm+4446lormI=; b=B1hB2tYmOvtiyaoTjqSPJvrDafiWKPFsoSS+jIwTvUbqBMjGKP4acwpsgw3h87/lvlgGUe gHih3nM5ba9hnG7R9SBZqlhD9RseQGj3uvvdp3QoEQ2GUo+Nu3RehsaYKntB9rGzT4HTzD mrQrvpUQ4512/FM6jUanA4EGhfHTeKc= X-MC-Unique: P0GGfzGONbieKFwoj4ObHQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EVnue42BrttlBCQCGj0TZzTKP7+Zxi1Gm+4446lormI=; b=oEm8hgL7FK0N5WhJsjNqi9U2El6VvL2ePt/rsK7ubjvUX5SFmuHo7klSdbGLPHP5cZ +i692wb5wxIhARMkePIkj9oXe+TK8lBoI7QQifrnk3MvLLSs76B1frx3ELD7scHJEBbd PrSBTUVZmS+jtUFy79Ioi/2nAOl2yVUKlqy0qXNCTnIatEh7Jz6hIjYk95YJyxZC8RFR R52vDmElvly2yBf6ph1OnO/rBUk4CTP9qrJowYomp1BoMxNb98rLFSuFjUuwYON2a2c0 YKNGCIKSgHFAaRiJPTLPcds4ORAEx4QwuknpfeAtwNzlOWzNa0u8w/tAh73Gr1kWLvv9 gzbg== X-Gm-Message-State: AOAM531z0kyCjKKkgC7wN6NVi0OuI6kH+VYerOXZZ113SCNR92YuGy/M Z8DUd07eWkd1tFT5wqaZb7ngh9tgg7wRwRzQ8MFRPkyZhe6Myy6lH3mW1QhvQG2YWMaNKM0w0c1 uvr6DgKse7M2Shw== X-Received: by 2002:a1c:65d6:: with SMTP id z205mr278831wmb.88.1614206815169; Wed, 24 Feb 2021 14:46:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1uPTEQliKMX3O/FOW4JYYaofFyYjKURWoqSHU31T+txdc51Rk/0Y43hyBTLMML56sBzmwng== X-Received: by 2002:a1c:65d6:: with SMTP id z205mr278821wmb.88.1614206814986; Wed, 24 Feb 2021 14:46:54 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Markus Armbruster , Laurent Vivier , Eric Blake , Marcel Apfelbaum , Claudio Fontana , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v5 2/4] target/i386/cpu: Restrict x86_cpu_get_feature_words to sysemu Date: Wed, 24 Feb 2021 23:46:41 +0100 Message-Id: <20210224224643.3369940-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210224224643.3369940-1-philmd@redhat.com> References: <20210224224643.3369940-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Only qemu-system-FOO and qemu-storage-daemon provide QMP monitors, therefore such declarations and definitions are irrelevant for user-mode emulation. Restricting the x86-specific commands to machine-target.json pulls less QAPI-generated code into user-mode. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu-internal.h | 3 +++ target/i386/cpu-softmmu.c | 36 ++++++++++++++++++++++++++++++++++ target/i386/cpu.c | 40 +++----------------------------------- 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/target/i386/cpu-internal.h b/target/i386/cpu-internal.h index 9df24c482ea..9355f86f6e1 100644 --- a/target/i386/cpu-internal.h +++ b/target/i386/cpu-internal.h @@ -69,6 +69,9 @@ void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v, void x86_cpu_apic_create(X86CPU *cpu, Error **errp); void x86_cpu_apic_realize(X86CPU *cpu, Error **errp); void x86_cpu_machine_reset_cb(void *opaque); +void x86_cpu_get_feature_words(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp); #endif /* CONFIG_USER_ONLY */ =20 #endif /* CPU_INTERNAL_H */ diff --git a/target/i386/cpu-softmmu.c b/target/i386/cpu-softmmu.c index c824408e8eb..34fd7b0de02 100644 --- a/target/i386/cpu-softmmu.c +++ b/target/i386/cpu-softmmu.c @@ -23,6 +23,7 @@ #include "sysemu/whpx.h" #include "kvm/kvm_i386.h" #include "qapi/error.h" +#include "qapi/qapi-visit-machine.h" #include "qapi/qapi-visit-run-state.h" #include "qapi/qmp/qdict.h" #include "qom/qom-qobject.h" @@ -350,3 +351,38 @@ void x86_cpu_get_crash_info_qom(Object *obj, Visitor *= v, qapi_free_GuestPanicInformation(panic_info); } =20 +/* Generic getter for "feature-words" and "filtered-features" properties */ +void x86_cpu_get_feature_words(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + uint64_t *array =3D (uint64_t *)opaque; + FeatureWord w; + X86CPUFeatureWordInfo word_infos[FEATURE_WORDS] =3D { }; + X86CPUFeatureWordInfoList list_entries[FEATURE_WORDS] =3D { }; + X86CPUFeatureWordInfoList *list =3D NULL; + + for (w =3D 0; w < FEATURE_WORDS; w++) { + FeatureWordInfo *wi =3D &feature_word_info[w]; + /* + * We didn't have MSR features when "feature-words" was + * introduced. Therefore skipped other type entries. + */ + if (wi->type !=3D CPUID_FEATURE_WORD) { + continue; + } + X86CPUFeatureWordInfo *qwi =3D &word_infos[w]; + qwi->cpuid_input_eax =3D wi->cpuid.eax; + qwi->has_cpuid_input_ecx =3D wi->cpuid.needs_ecx; + qwi->cpuid_input_ecx =3D wi->cpuid.ecx; + qwi->cpuid_register =3D get_register_enum_32(w); + qwi->features =3D array[w]; + + /* List will be in reverse order, but order shouldn't matter */ + list_entries[w].next =3D list; + list_entries[w].value =3D &word_infos[w]; + list =3D &list_entries[w]; + } + + visit_type_X86CPUFeatureWordInfoList(v, "feature-words", &list, errp); +} diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ffa342171ba..c088bcf3113 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -27,7 +27,7 @@ #include "sysemu/hvf.h" #include "kvm/kvm_i386.h" #include "sev_i386.h" -#include "qapi/qapi-visit-machine.h" +#include "qapi/qapi-builtin-visit.h" #include "qapi/qmp/qerror.h" #include "qapi/qapi-commands-machine-target.h" #include "standard-headers/asm-x86/kvm_para.h" @@ -4529,42 +4529,6 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visi= tor *v, const char *name, cpu->env.tsc_khz =3D cpu->env.user_tsc_khz =3D value / 1000; } =20 -/* 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, - Error **errp) -{ - uint64_t *array =3D (uint64_t *)opaque; - FeatureWord w; - X86CPUFeatureWordInfo word_infos[FEATURE_WORDS] =3D { }; - X86CPUFeatureWordInfoList list_entries[FEATURE_WORDS] =3D { }; - X86CPUFeatureWordInfoList *list =3D NULL; - - for (w =3D 0; w < FEATURE_WORDS; w++) { - FeatureWordInfo *wi =3D &feature_word_info[w]; - /* - * We didn't have MSR features when "feature-words" was - * introduced. Therefore skipped other type entries. - */ - if (wi->type !=3D CPUID_FEATURE_WORD) { - continue; - } - X86CPUFeatureWordInfo *qwi =3D &word_infos[w]; - qwi->cpuid_input_eax =3D wi->cpuid.eax; - qwi->has_cpuid_input_ecx =3D wi->cpuid.needs_ecx; - qwi->cpuid_input_ecx =3D wi->cpuid.ecx; - qwi->cpuid_register =3D get_register_enum_32(w); - qwi->features =3D array[w]; - - /* List will be in reverse order, but order shouldn't matter */ - list_entries[w].next =3D list; - list_entries[w].value =3D &word_infos[w]; - list =3D &list_entries[w]; - } - - visit_type_X86CPUFeatureWordInfoList(v, "feature-words", &list, errp); -} - /* Convert all '_' in a feature string option name to '-', to make feature * name conform to QOM property naming rule, which uses '-' instead of '_'. */ @@ -6422,12 +6386,14 @@ static void x86_cpu_initfn(Object *obj) env->nr_dies =3D 1; cpu_set_cpustate_pointers(cpu); =20 +#if !defined(CONFIG_USER_ONLY) object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)env->features); object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features); +#endif /* !CONFIG_USER_ONLY */ =20 object_property_add_alias(obj, "sse3", obj, "pni"); object_property_add_alias(obj, "pclmuldq", obj, "pclmulqdq"); --=20 2.26.2 From nobody Sun Feb 8 19:00:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614206826; cv=none; d=zohomail.com; s=zohoarc; b=nJH7p85Sdn0XT6Kta2m8LK2zSBE9mL3hpKUG11tadHdseQDpufqs/CxHb5M2u9AZt2jkhLNowU3BOmtH+zAvXGQsC1apRLDtKL3HuFZXmXLCqRgnA8PpuE8wQMqsA63QjZ+fq7Oo4g9zHsqsmHnZgWNkDxwMZ3RDK2fZOxe5uGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614206826; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=TGc1XDROpJa7heiKjiNOwGMcXXvKXrCBpdUx/v/xVvI=; b=cKZIvGFNqAg3DWRv+R8VKTfCFVXPepiiUiIsW1lIQaHFN92Ai2/5c2qizzI+PGA557n2XvYOm/nvMb1NUcG0+E/Ihteu/kDqdbhah3IiBXsS0wn3XUuLgrjuA+sRFAQ1fwGpiaRLa1fSUc7WT11hwTnpFxb8nU0mBICIaRIzgNg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614206826342855.4802565914908; Wed, 24 Feb 2021 14:47:06 -0800 (PST) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-547-kiu87brgOLyAi_IMarWZ4Q-1; Wed, 24 Feb 2021 17:47:01 -0500 Received: by mail-wr1-f69.google.com with SMTP id v13so714477wrs.21 for ; Wed, 24 Feb 2021 14:47:01 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id k128sm4650445wmf.42.2021.02.24.14.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 14:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614206825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TGc1XDROpJa7heiKjiNOwGMcXXvKXrCBpdUx/v/xVvI=; b=DKB2EBeKbt/RLRnIuF9okL91Sxt4yMiMWOiKv4SZTt1mZUmdkBMgO518pwRvG7iOutxnkp eoS5mDjukve9Ehe4Dcri5RVaOeLR3iVXMPRWj8TwMJlHiHBkAlrJ/Vf8ywInG6cu0nYzuX JD7JeXPJpcWXDS7Ji4+qjRztssbKAfM= X-MC-Unique: kiu87brgOLyAi_IMarWZ4Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TGc1XDROpJa7heiKjiNOwGMcXXvKXrCBpdUx/v/xVvI=; b=EC3B6w1lXbjfBH4XJ8C2fNK7vzNxwK+HvgzJIWptbRLV06oJevqTyzq0F114Wg0H3i 6s/ZdGyhY2YTh2xY9LGbHg/OFU4RjPhifvbD1TFjvlvXTt1v4G/d4u9BbpNhTdad7wea LnJa3o9Q7ScTaygB3yL1fasyJrEf51MwrQ7igMRhUcAsT0U/zcWA4jQ/NpD0Xlsk4tPT DB9SpBygvwOxJV090jdENBc93mVrg7ibQJDy4tpB3/cbCw+XKsrCIsxjDk9Ynbwmknlc weF1S7o5R2f2aPStWxSEfFjNjsNwbSs3jCvpJm9MwJxyz1I86fB+YDGgOUU90Fef1BQX 3xGQ== X-Gm-Message-State: AOAM533JO3iBHnZoZt1bVXcB338UnqkEAdjb+LLvDfJXjJ1ZfT39wb5X o7gHSKza8o6KiE5Xkyy8jCFUWdfhxGeljtNaVjQY72djQS1XQHcuvr+psF+AuLBowxmEUxB7kab 203LiIg37+fIV9w== X-Received: by 2002:a1c:b6d7:: with SMTP id g206mr252291wmf.123.1614206820136; Wed, 24 Feb 2021 14:47:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwC3nRTJpkI8hwMSqLH5Jsmo0ek5gPNs5pMiwn1v7m2ICWfSmZdd04F/nOhzG34hmes6j6rvg== X-Received: by 2002:a1c:b6d7:: with SMTP id g206mr252284wmf.123.1614206820015; Wed, 24 Feb 2021 14:47:00 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Markus Armbruster , Laurent Vivier , Eric Blake , Marcel Apfelbaum , Claudio Fontana , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v5 3/4] qapi: Move X86 specific types to machine-target.json Date: Wed, 24 Feb 2021 23:46:42 +0100 Message-Id: <20210224224643.3369940-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210224224643.3369940-1-philmd@redhat.com> References: <20210224224643.3369940-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X86CPURegister32 enum and X86CPUFeatureWordInfo structure are specific to the x86 architecture, move these entries to machine-target.json. Restricting the x86-specific commands to machine-target.json pulls less QAPI-generated code into non-x86 targets. Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- qapi/machine-target.json | 42 +++++++++++++++++++++++++++++++++++++++ qapi/machine.json | 42 --------------------------------------- target/i386/cpu-softmmu.c | 2 +- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/qapi/machine-target.json b/qapi/machine-target.json index e7811654b72..106fbd2e9ed 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -329,3 +329,45 @@ ## { 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386= ) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } + +## +# @X86CPURegister32: +# +# A X86 32-bit register +# +# Since: 1.5 +## +{ 'enum': 'X86CPURegister32', + 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } + +## +# @X86CPUFeatureWordInfo: +# +# Information about a X86 CPU feature word +# +# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature= word +# +# @cpuid-input-ecx: Input ECX value for CPUID instruction for that +# feature word +# +# @cpuid-register: Output register containing the feature bits +# +# @features: value of output register, containing the feature bits +# +# Since: 1.5 +## +{ 'struct': 'X86CPUFeatureWordInfo', + 'data': { 'cpuid-input-eax': 'int', + '*cpuid-input-ecx': 'int', + 'cpuid-register': 'X86CPURegister32', + 'features': 'int' } } + +## +# @DummyForceArrays: +# +# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally +# +# Since: 2.5 +## +{ 'struct': 'DummyForceArrays', + 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } diff --git a/qapi/machine.json b/qapi/machine.json index 330189efe3d..8053803a0e0 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -681,48 +681,6 @@ 'dst': 'uint16', 'val': 'uint8' }} =20 -## -# @X86CPURegister32: -# -# A X86 32-bit register -# -# Since: 1.5 -## -{ 'enum': 'X86CPURegister32', - 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } - -## -# @X86CPUFeatureWordInfo: -# -# Information about a X86 CPU feature word -# -# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature= word -# -# @cpuid-input-ecx: Input ECX value for CPUID instruction for that -# feature word -# -# @cpuid-register: Output register containing the feature bits -# -# @features: value of output register, containing the feature bits -# -# Since: 1.5 -## -{ 'struct': 'X86CPUFeatureWordInfo', - 'data': { 'cpuid-input-eax': 'int', - '*cpuid-input-ecx': 'int', - 'cpuid-register': 'X86CPURegister32', - 'features': 'int' } } - -## -# @DummyForceArrays: -# -# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally -# -# Since: 2.5 -## -{ 'struct': 'DummyForceArrays', - 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } - ## # @NumaCpuOptions: # diff --git a/target/i386/cpu-softmmu.c b/target/i386/cpu-softmmu.c index 34fd7b0de02..a7afa7963db 100644 --- a/target/i386/cpu-softmmu.c +++ b/target/i386/cpu-softmmu.c @@ -23,7 +23,7 @@ #include "sysemu/whpx.h" #include "kvm/kvm_i386.h" #include "qapi/error.h" -#include "qapi/qapi-visit-machine.h" +#include "qapi/qapi-visit-machine-target.h" #include "qapi/qapi-visit-run-state.h" #include "qapi/qmp/qdict.h" #include "qom/qom-qobject.h" --=20 2.26.2 From nobody Sun Feb 8 19:00:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614206829; cv=none; d=zohomail.com; s=zohoarc; b=Pqcl5l0mMh9zk7inY3BdTQjJMvf3uzxNuNUBo7/u9RT8Rwc3X7tN0tVrv7oJ5t8uc3tT9GXW3Tsgl7CJR7tpmHbjPUdVpeoXPKiqaYfmBLK0CO3mHpkc7/08djarRCs3dLumOTwStfM+0VSrldmw6m3XtjJKa0J0HqwZHN2CjuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614206829; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=6dtFkRI9hyOOeUpAKA3F6JXd4eQ65AOROSFOc2P9BEU=; b=Be8J7RpPQmJNQeqhj91swq36E0A9mpVs7RY9dz7cN5C29ieQsAiMmdbBo1OkcdDHx20bUVd73RmiAxKdJVVtBcQtBvCkajOLokoJemW7+qzaiRNEGNlUPsDJcuxqwWX4Bv9IjoXNWAwpSHZGHqD7F0U49b8KZelBB9g1kH6NkHY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1614206829803240.0489879885215; Wed, 24 Feb 2021 14:47:09 -0800 (PST) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-2-dhpO6oleOpqApsn9vE8_Gg-1; Wed, 24 Feb 2021 17:47:06 -0500 Received: by mail-wr1-f70.google.com with SMTP id g5so1672880wrd.22 for ; Wed, 24 Feb 2021 14:47:05 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id 75sm5375107wma.23.2021.02.24.14.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 14:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614206828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6dtFkRI9hyOOeUpAKA3F6JXd4eQ65AOROSFOc2P9BEU=; b=AQPSm/e2eSgQKAWnE7Pu9evWrRmkX9NeOxl0A34APcDQAUFTQfInZ3KU67wpTKTHHjcrUv +ayUbi6X/f00OAT8PNFw5EXpRva0dplJCYLAqeiSE0rOi9j3lebRMtkvZz/XStmtPukLTC oMgKwCknLWNxmCTQNSr1Aca7RS0zBu0= X-MC-Unique: dhpO6oleOpqApsn9vE8_Gg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6dtFkRI9hyOOeUpAKA3F6JXd4eQ65AOROSFOc2P9BEU=; b=Lj+KUgRSjj4KXFahF6jF/BTurPV/w0K0hpozRod/JuzR3ztsNtS9BgauQpc+nEi7VH 47/YObMkRis++gILRuwDYXg/LGbFUgBcpdorGI3Glm6rdaHYqyhLuRZtP7qEClpl0Whi rVxQh+0CT/e4oZgCNBK7JVgppCk7fC967QG8bNdQH6tr5ZUCkR506WpZPtrvDJGrSHh7 3RwzxiixCJy91m3dTU6iDeFtCSXpsv3GPLsZzEFVY1KSa6ATEhiwBtQh2guEc7hIO87d AXla8vfO0LBaIFyZgGEind6k9ne6wIM5s0byoqshspOh3EV03iC/UdHga7b/QlzlXMVB kx+g== X-Gm-Message-State: AOAM533HB114xrJw0RUWEurGSM1FoQIZgdgVjGf/GIuAz66ZT2e3LdGL QvJENTwWcmDMTavLOG0FHio+wHPR5/iACwleOEznr3AZ3GxrQ3CH6Oze6u2NjaogHA4G9ptGV8j +nzr1bweRGwXYog== X-Received: by 2002:a7b:c957:: with SMTP id i23mr292072wml.32.1614206824966; Wed, 24 Feb 2021 14:47:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPMD1MHIlrRzkJyhWirg05IJfKtPF6HXF3qdSMGXsVJwgpsk2XSnFXE/79lOPLG0z+v29nfQ== X-Received: by 2002:a7b:c957:: with SMTP id i23mr292059wml.32.1614206824817; Wed, 24 Feb 2021 14:47:04 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Markus Armbruster , Laurent Vivier , Eric Blake , Marcel Apfelbaum , Claudio Fontana , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v5 4/4] qapi/machine-target: Restrict X86 features to X86 targets Date: Wed, 24 Feb 2021 23:46:43 +0100 Message-Id: <20210224224643.3369940-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210224224643.3369940-1-philmd@redhat.com> References: <20210224224643.3369940-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X86CPURegister32 enum and X86CPUFeatureWordInfo structure are specific to the x86 architecture, restrict them to the X86 targets. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- qapi/machine-target.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 106fbd2e9ed..a8a5b3f86f6 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -338,7 +338,8 @@ # Since: 1.5 ## { 'enum': 'X86CPURegister32', - 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } + 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ], + 'if': 'defined(TARGET_I386)' } =20 ## # @X86CPUFeatureWordInfo: @@ -360,7 +361,8 @@ 'data': { 'cpuid-input-eax': 'int', '*cpuid-input-ecx': 'int', 'cpuid-register': 'X86CPURegister32', - 'features': 'int' } } + 'features': 'int' }, + 'if': 'defined(TARGET_I386)' } =20 ## # @DummyForceArrays: @@ -370,4 +372,5 @@ # Since: 2.5 ## { 'struct': 'DummyForceArrays', - 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } + 'data': { 'unused': ['X86CPUFeatureWordInfo'] }, + 'if': 'defined(TARGET_I386)' } --=20 2.26.2