Skip to contentSkip to conversation

qapi: introduce the SysEmuTarget enumeration

PATCH Applied Laszlo Ersek 3 participants 14 messages Apr 27, 2018 – May 2, 2018

lore
Share & tools
lore
#0 lore raw

v3 cover qapi: introduce the SysEmuTarget enumeration

This is version 3 of the set posted earlier at

http://mid.mail-archive.com/[email protected]

This version seeks to address the v2 feedback. Changes are noted per patch.

The following firmware schema / interop docs patch remains dependent on this series, without any changes to the former:

[Qemu-devel] [qemu RFC v3 3/3] qapi: add "firmware.json"
http://mid.mail-archive.com/[email protected]

Cc "Daniel P. Berrange" <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Viktor VM Mihajlovski <[email protected]>

Thanks
Laszlo

Laszlo Ersek (5):
qapi: fill in CpuInfoFast.arch in query-cpus-fast
qapi: add SysEmuTarget to "common.json"
qapi: change the type of TargetInfo.arch from string to enum
SysEmuTarget
qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch
qapi: deprecate CpuInfoFast.arch

 qapi/common.json       | 23 ++++++++++++++++
 qapi/misc.json         | 68 ++++++++++++++++++++++++++++++++++------------
 arch_init.c            |  4 ++-
 cpus.c                 | 73 +++++++++++++++++++++++++++++++++++++++++++-------
 qemu-doc.texi          |  5 ++++
 scripts/qapi/common.py |  2 +-
 6 files changed, 146 insertions(+), 29 deletions(-)
Signature · 1 line
2.14.1.3.gb7cf6e02401b
#1 lore raw

PATCH v3 1/5 qapi: fill in CpuInfoFast.arch in query-cpus-fast

* Commit ca230ff33f89 added the @arch field to @CpuInfoFast, but it failed to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not defined. The updated @query-cpus-fast example in "qapi-schema.json" showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0() to allocate @CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is generated with value 0.

All @arch values other than @s390 implied the @CpuInfoOther sub-struct for @CpuInfoFast -- at the time of writing the patch --, thus no fields other than @arch needed to be set when TARGET_S390X was not defined. Set @arch now, by copying the corresponding assignments from qmp_query_cpus().

* Commit 25fa194b7b11 added the @riscv enum constant to @CpuInfoArch (used in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus and @query-cpus-fast commands, respectively), and assigned, in both return structures, the @CpuInfoRISCV sub-structure to the new enum value.

However, qmp_query_cpus_fast() would not populate either the @arch field or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only qmp_query_cpus() would.

Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and populate only the @arch field in qmp_query_cpus_fast(). Getting CPU state without interrupting KVM is an exceptional thing that only S390X does currently. Quoting Cornelia Huck <[email protected]>, "s390x is exceptional in that it has state in QEMU that is actually interesting for upper layers and can be retrieved without performance penalty". See also
<https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html>.

Cc Cornelia Huck <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Viktor VM Mihajlovski <[email protected]>
Fixes ca230ff33f89bf7102cbfbc2328716da6750aaed
Fixes 25fa194b7b11901561532e435beb83d046899f7a

---

Notes:
PATCHv3:

- pick up Cornelia's and Markus's R-b's

- no changes

PATCHv2:

- squash v1 patches 1/6 and 2/6 [Eric, Markus, Cornelia]

- fix "added added" typo in the commit message [Eric]

- update commit message wrt. S390X particulars [Cornelia, Markus, Viktor]

- pick up Eric's R-b (synthesized from his R-b's for v1 1/6 & 2/6)

- don't pick up Cornelia's R-b (only given for v1 1/6)

- update the CC list

PATCHv1:

- new patch

 qapi/misc.json |  2 +-
 cpus.c         | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
qapi/misc.json +1 -1
index 5636f4a14997..104d013adba6 100644
@@ -565,23 +565,23 @@
 { 'union': 'CpuInfoFast',
   'base': {'cpu-index': 'int', 'qom-path': 'str',
            'thread-id': 'int', '*props': 'CpuInstanceProperties',
            'arch': 'CpuInfoArch' },
   'discriminator': 'arch',
   'data': { 'x86': 'CpuInfoOther',
             'sparc': 'CpuInfoOther',
             'ppc': 'CpuInfoOther',
             'mips': 'CpuInfoOther',
             'tricore': 'CpuInfoOther',
             's390': 'CpuInfoS390',
-            'riscv': 'CpuInfoRISCV',
+            'riscv': 'CpuInfoOther',
             'other': 'CpuInfoOther' } }
 
 ##
 # @query-cpus-fast:
 #
 # Returns information about all virtual CPUs. This command does not
 # incur a performance penalty and should be used in production
 # instead of query-cpus.
 #
 # Returns: list of @CpuInfoFast
 #
cpus.c +15 -1
index 38eba8bff334..60563a6d54ec 100644
@@ -2210,27 +2210,41 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
         info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
         info->value->thread_id = cpu->thread_id;
 
         info->value->has_props = !!mc->cpu_index_to_instance_props;
         if (info->value->has_props) {
             CpuInstanceProperties *props;
             props = g_malloc0(sizeof(*props));
             *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
             info->value->props = props;
         }
 
-#if defined(TARGET_S390X)
+#if defined(TARGET_I386)
+        info->value->arch = CPU_INFO_ARCH_X86;
+#elif defined(TARGET_PPC)
+        info->value->arch = CPU_INFO_ARCH_PPC;
+#elif defined(TARGET_SPARC)
+        info->value->arch = CPU_INFO_ARCH_SPARC;
+#elif defined(TARGET_MIPS)
+        info->value->arch = CPU_INFO_ARCH_MIPS;
+#elif defined(TARGET_TRICORE)
+        info->value->arch = CPU_INFO_ARCH_TRICORE;
+#elif defined(TARGET_S390X)
         s390_cpu = S390_CPU(cpu);
         env = &s390_cpu->env;
         info->value->arch = CPU_INFO_ARCH_S390;
         info->value->u.s390.cpu_state = env->cpu_state;
+#elif defined(TARGET_RISCV)
+        info->value->arch = CPU_INFO_ARCH_RISCV;
+#else
+        info->value->arch = CPU_INFO_ARCH_OTHER;
 #endif
         if (!cur_item) {
             head = cur_item = info;
         } else {
             cur_item->next = info;
             cur_item = info;
         }
     }
 
     return head;
 }
Signature · 1 line
2.14.1.3.gb7cf6e02401b
#2 lore raw

PATCH v3 2/5 qapi: add SysEmuTarget to "common.json"

In reply to Laszlo Ersek

We'll soon need an enumeration type that lists all the softmmu targets that QEMU (the project) supports. Introduce @SysEmuTarget to "common.json".

The enum constant @x86_64 doesn't match the QAPI convention of preferring hyphen ("-") over underscore ("_"). This is intentional; the @SysEmuTarget constants are supposed to produce QEMU executable names when stringified and appended to the "qemu-system-" prefix. Put differently, the replacement text of the TARGET_NAME preprocessor macro must be possible to look up in the list of (stringified) enum constants.

Like other enum types, @SysEmuTarget too can be used for discriminator fields in unions. For the @i386 constant, a C-language union member called "i386" would be generated. On mingw build hosts, "i386" is a macro however. Add "i386" to "polluted_words" at once.

Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>

---

Notes:
PATCHv3:

- copy the suggested (shorter) Notes: wrt. underscore use in @x86_64 to the schema, and move the original (longer) schema Notes: to the commit message [Eric]

- no R-b's picked up due to the above change

PATCHv2:

- document the use of the underscore in @x86_64 in both the commit message and in the schema [Eric, Dan]

- extend "polluted_words" with "i386" [Eric]

- drop previous R-b's

- update the CC list

PATCHv1:

- pick up R-b's from Markus and Kashyap, no changes

RFCv3:

- The patch is new in this version. [Dan, Markus]

- The original idea was to call the new enum @Target; however, @Target generates exactly the TARGET_AARCH64, TARGET_ALPHA, TARGET_ARM, ... enumeration constants that conflict with the poisoned preprocessing macros of the same names. Hence @SysEmuTarget -- it's more accurate anyway, since we want it to stand for system emulation targets.

- Also, we discussed defining the new type in either "common.json" or "misc.json". "misc.json" turned out to be a problem: "firmware.json" would then include "misc.json" for the new type's sake, but that inclusion would become the first appearance of "misc.json" -- within "firmware.json". That messed up the generated documentation. By adding the new type to "common.json", "misc.json" (see the 2nd patch) and "firmware.json" (see the 3rd patch) can both consume the new type without problems.

 qapi/common.json       | 23 +++++++++++++++++++++++
 scripts/qapi/common.py |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)
qapi/common.json +23 -0
index d9b14dd429f3..c811d0498457 100644
@@ -118,11 +118,34 @@
 #
 # @bar3: PCI BAR3 is used for the feature
 #
 # @bar4: PCI BAR4 is used for the feature
 #
 # @bar5: PCI BAR5 is used for the feature
 #
 # Since: 2.12
 ##
 { 'enum': 'OffAutoPCIBAR',
   'data': [ 'off', 'auto', 'bar0', 'bar1', 'bar2', 'bar3', 'bar4', 'bar5' ] }
+
+##
+# @SysEmuTarget:
+#
+# The comprehensive enumeration of QEMU system emulation ("softmmu")
+# targets. Run "./configure --help" in the project root directory, and
+# look for the *-softmmu targets near the "--target-list" option. The
+# individual target constants are not documented here, for the time
+# being.
+#
+# Notes: The resulting QMP strings can be appended to the "qemu-system-"
+#        prefix to produce the corresponding QEMU executable name. This
+#        is true even for "qemu-system-x86_64".
+#
+# Since: 2.13
+##
+{ 'enum' : 'SysEmuTarget',
+  'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32',
+             'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64',
+             'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc',
+             'ppc64', 'ppcemb', 'riscv32', 'riscv64', 's390x', 'sh4',
+             'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32',
+             'x86_64', 'xtensa', 'xtensaeb' ] }
scripts/qapi/common.py +1 -1
index 3e14bc41f2c0..a032cec37509 100644
@@ -1814,23 +1814,23 @@ def c_name(name, protect=True):
     # C++ ISO/IEC 14882:2003 2.11
     cpp_words = set(['bool', 'catch', 'class', 'const_cast', 'delete',
                      'dynamic_cast', 'explicit', 'false', 'friend', 'mutable',
                      'namespace', 'new', 'operator', 'private', 'protected',
                      'public', 'reinterpret_cast', 'static_cast', 'template',
                      'this', 'throw', 'true', 'try', 'typeid', 'typename',
                      'using', 'virtual', 'wchar_t',
                      # alternative representations
                      'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
                      'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'])
     # namespace pollution:
-    polluted_words = set(['unix', 'errno', 'mips', 'sparc'])
+    polluted_words = set(['unix', 'errno', 'mips', 'sparc', 'i386'])
     name = name.translate(c_name_trans)
     if protect and (name in c89_words | c99_words | c11_words | gcc_words
                     | cpp_words | polluted_words):
         return 'q_' + name
     return name
 
 eatspace = '\033EATSPACE.'
 pointer_suffix = ' *' + eatspace
 
 
 def genindent(count):
Signature · 1 line
2.14.1.3.gb7cf6e02401b
Reviewed-by on v3 2/5
#3 lore raw

Re: [Qemu-devel] [PATCH v3 2/5] qapi: add SysEmuTarget to "common.json"

Quoted 20 lines · Laszlo Ersek

We'll soon need an enumeration type that lists all the softmmu targets that QEMU (the project) supports. Introduce @SysEmuTarget to "common.json".

The enum constant @x86_64 doesn't match the QAPI convention of preferring hyphen ("-") over underscore ("_"). This is intentional; the @SysEmuTarget constants are supposed to produce QEMU executable names when stringified and appended to the "qemu-system-" prefix. Put differently, the replacement text of the TARGET_NAME preprocessor macro must be possible to look up in the list of (stringified) enum constants.

Like other enum types, @SysEmuTarget too can be used for discriminator fields in unions. For the @i386 constant, a C-language union member called "i386" would be generated. On mingw build hosts, "i386" is a macro however. Add "i386" to "polluted_words" at once.

Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>
Quoted 8 lines

---

Notes:
PATCHv3:

- copy the suggested (shorter) Notes: wrt. underscore use in @x86_64 to the schema, and move the original (longer) schema Notes: to the commit message [Eric]

Thanks; that looks better.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by on v3 2/5
#4 lore raw

Re: [Qemu-devel] [PATCH v3 2/5] qapi: add SysEmuTarget to "common.json"

In reply to Laszlo Ersek
Quoted 16 lines · Laszlo Ersek

We'll soon need an enumeration type that lists all the softmmu targets that QEMU (the project) supports. Introduce @SysEmuTarget to "common.json".

The enum constant @x86_64 doesn't match the QAPI convention of preferring hyphen ("-") over underscore ("_"). This is intentional; the @SysEmuTarget constants are supposed to produce QEMU executable names when stringified and appended to the "qemu-system-" prefix. Put differently, the replacement text of the TARGET_NAME preprocessor macro must be possible to look up in the list of (stringified) enum constants.

Like other enum types, @SysEmuTarget too can be used for discriminator fields in unions. For the @i386 constant, a C-language union member called "i386" would be generated. On mingw build hosts, "i386" is a macro however. Add "i386" to "polluted_words" at once.

Quoted 4 lines
Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>
#5 lore raw

PATCH v3 3/5 qapi: change the type of TargetInfo.arch from string to enum SysEmuTarget

In reply to Laszlo Ersek

Now that we have @SysEmuTarget, it makes sense to restrict @TargetInfo.@arch to valid sysemu targets at the schema level.

---

Notes:
PATCHv3:

- pick up Eric's R-b

- no change

PATCHv2:

- drop naive code comment in qmp_query_target() [Markus]

- pick up Markus's R-b

- update CC list

PATCHv1:

- qmp_query_target(): pass (-1) as fallback value [Markus]
- qmp_query_target(): catch lookup error with error_abort [Markus]

RFCv3:

- The patch is new in this version. [Markus]

 qapi/misc.json | 6 ++++--
 arch_init.c    | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)
qapi/misc.json +4 -2
index 104d013adba6..460866cf542f 100644
@@ -1,18 +1,20 @@
 # -*- Mode: Python -*-
 #
 
 ##
 # = Miscellanea
 ##
 
+{ 'include': 'common.json' }
+
 ##
 # @qmp_capabilities:
 #
 # Enable QMP capabilities.
 #
 # Arguments:
 #
 # @enable:   An optional list of QMPCapability values to enable.  The
 #            client must not enable any capability that is not
 #            mentioned in the QMP greeting message.  If the field is not
 #            provided, it means no QMP capabilities will be enabled.
@@ -2441,28 +2443,28 @@
 #      ]
 #    }
 #
 ##
 { 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
 
 ##
 # @TargetInfo:
 #
 # Information describing the QEMU target.
 #
-# @arch: the target architecture (eg "x86_64", "i386", etc)
+# @arch: the target architecture
 #
 # Since: 1.2.0
 ##
 { 'struct': 'TargetInfo',
-  'data': { 'arch': 'str' } }
+  'data': { 'arch': 'SysEmuTarget' } }
 
 ##
 # @query-target:
 #
 # Return information about the target for this QEMU
 #
 # Returns: TargetInfo
 #
 # Since: 1.2.0
 ##
 { 'command': 'query-target', 'returns': 'TargetInfo' }
arch_init.c +3 -1
index 6ee07478bd11..9597218ceda3 100644
@@ -21,22 +21,23 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/arch_init.h"
 #include "hw/pci/pci.h"
 #include "hw/audio/soundhw.h"
 #include "qapi/qapi-commands-misc.h"
+#include "qapi/error.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "hw/acpi/acpi.h"
 #include "qemu/help_option.h"
 
 #ifdef TARGET_SPARC
 int graphic_width = 1024;
 int graphic_height = 768;
 int graphic_depth = 8;
 #else
 int graphic_width = 800;
@@ -104,15 +105,16 @@ int xen_available(void)
     return 1;
 #else
     return 0;
 #endif
 }
 
 
 TargetInfo *qmp_query_target(Error **errp)
 {
     TargetInfo *info = g_malloc0(sizeof(*info));
 
-    info->arch = g_strdup(TARGET_NAME);
+    info->arch = qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME, -1,
+                                 &error_abort);
 
     return info;
 }
Signature · 1 line
2.14.1.3.gb7cf6e02401b
#6 lore raw

PATCH v3 4/5 qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch

In reply to Laszlo Ersek

Add a new field @target (of type @SysEmuTarget) to the output of the @query-cpus-fast command, which provides more information about the emulation target than the field @arch (of type @CpuInfoArch). Make @target the new discriminator for the @CpuInfoFast return structure. Keep @arch for compatibility.

Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>

---

Notes:
PATCHv3:

- remove superfluous empty comment line addition after @target

- pick up Eric's R-b

- skip Markus's R-b due to the next patch

PATCHv2:

- drop patch v1 5/6 with the CpuInfoCommon refactoring / extraction, as @CpuInfo / @query-cpus are deprecated [Eric, Markus]

- for the same reason, add @target to @CpuInfoFast / @query-cpus-fast only [Eric, Markus]

- Can't set @arch compatibly from a QAPI enum lookup of the proposed TARGET_BASE_ARCH macro, because TARGET_BASE_ARCH=s390x is not identical to the @s390 @CpuInfoArch constant -- see more at
<http://mid.mail-archive.com/[email protected]>.
Keep sysemu_target_to_cpuinfo_arch() instead. [Markus, Eric]

- update CC list

PATCHv1:

- new patch

 qapi/misc.json | 62 +++++++++++++++++++++++++++++++----------
 cpus.c         | 87 ++++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 110 insertions(+), 39 deletions(-)
qapi/misc.json +47 -15
index 460866cf542f..fa4eec7b6b63 100644
@@ -550,41 +550,71 @@
 # Information about a virtual CPU
 #
 # @cpu-index: index of the virtual CPU
 #
 # @qom-path: path to the CPU object in the QOM tree
 #
 # @thread-id: ID of the underlying host thread
 #
 # @props: properties describing to which node/socket/core/thread
 #         virtual CPU belongs to, provided if supported by board
 #
-# @arch: architecture of the cpu, which determines which additional fields
-#        will be listed
+# @arch: base architecture of the cpu
+#
+# @target: the QEMU system emulation target, which is more specific than
+#          @arch and determines which additional fields will be listed
+#          (since 2.13)
 #
 # Since: 2.12
 #
 ##
-{ 'union': 'CpuInfoFast',
-  'base': {'cpu-index': 'int', 'qom-path': 'str',
-           'thread-id': 'int', '*props': 'CpuInstanceProperties',
-           'arch': 'CpuInfoArch' },
-  'discriminator': 'arch',
-  'data': { 'x86': 'CpuInfoOther',
-            'sparc': 'CpuInfoOther',
-            'ppc': 'CpuInfoOther',
-            'mips': 'CpuInfoOther',
-            'tricore': 'CpuInfoOther',
-            's390': 'CpuInfoS390',
-            'riscv': 'CpuInfoOther',
-            'other': 'CpuInfoOther' } }
+{ 'union'         : 'CpuInfoFast',
+  'base'          : { 'cpu-index'    : 'int',
+                      'qom-path'     : 'str',
+                      'thread-id'    : 'int',
+                      '*props'       : 'CpuInstanceProperties',
+                      'arch'         : 'CpuInfoArch',
+                      'target'       : 'SysEmuTarget' },
+  'discriminator' : 'target',
+  'data'          : { 'aarch64'      : 'CpuInfoOther',
+                      'alpha'        : 'CpuInfoOther',
+                      'arm'          : 'CpuInfoOther',
+                      'cris'         : 'CpuInfoOther',
+                      'hppa'         : 'CpuInfoOther',
+                      'i386'         : 'CpuInfoOther',
+                      'lm32'         : 'CpuInfoOther',
+                      'm68k'         : 'CpuInfoOther',
+                      'microblaze'   : 'CpuInfoOther',
+                      'microblazeel' : 'CpuInfoOther',
+                      'mips'         : 'CpuInfoOther',
+                      'mips64'       : 'CpuInfoOther',
+                      'mips64el'     : 'CpuInfoOther',
+                      'mipsel'       : 'CpuInfoOther',
+                      'moxie'        : 'CpuInfoOther',
+                      'nios2'        : 'CpuInfoOther',
+                      'or1k'         : 'CpuInfoOther',
+                      'ppc'          : 'CpuInfoOther',
+                      'ppc64'        : 'CpuInfoOther',
+                      'ppcemb'       : 'CpuInfoOther',
+                      'riscv32'      : 'CpuInfoOther',
+                      'riscv64'      : 'CpuInfoOther',
+                      's390x'        : 'CpuInfoS390',
+                      'sh4'          : 'CpuInfoOther',
+                      'sh4eb'        : 'CpuInfoOther',
+                      'sparc'        : 'CpuInfoOther',
+                      'sparc64'      : 'CpuInfoOther',
+                      'tricore'      : 'CpuInfoOther',
+                      'unicore32'    : 'CpuInfoOther',
+                      'x86_64'       : 'CpuInfoOther',
+                      'xtensa'       : 'CpuInfoOther',
+                      'xtensaeb'     : 'CpuInfoOther' } }
 
 ##
 # @query-cpus-fast:
 #
 # Returns information about all virtual CPUs. This command does not
 # incur a performance penalty and should be used in production
 # instead of query-cpus.
 #
 # Returns: list of @CpuInfoFast
 #
 # Since: 2.12
@@ -594,33 +624,35 @@
 # -> { "execute": "query-cpus-fast" }
 # <- { "return": [
 #         {
 #             "thread-id": 25627,
 #             "props": {
 #                 "core-id": 0,
 #                 "thread-id": 0,
 #                 "socket-id": 0
 #             },
 #             "qom-path": "/machine/unattached/device[0]",
 #             "arch":"x86",
+#             "target":"x86_64",
 #             "cpu-index": 0
 #         },
 #         {
 #             "thread-id": 25628,
 #             "props": {
 #                 "core-id": 0,
 #                 "thread-id": 0,
 #                 "socket-id": 1
 #             },
 #             "qom-path": "/machine/unattached/device[2]",
 #             "arch":"x86",
+#             "target":"x86_64",
 #             "cpu-index": 1
 #         }
 #     ]
 # }
 ##
 { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
 
 ##
 # @IOThreadInfo:
 #
 # Information about an iothread
cpus.c +63 -24

136 lines not on this page · raw message

Signature · 1 line
2.14.1.3.gb7cf6e02401b
Reviewed-by on v3 4/5
#7 lore raw

Re: [Qemu-devel] [PATCH v3 4/5] qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch

Quoted 11 lines · Laszlo Ersek

Add a new field @target (of type @SysEmuTarget) to the output of the @query-cpus-fast command, which provides more information about the emulation target than the field @arch (of type @CpuInfoArch). Make @target the new discriminator for the @CpuInfoFast return structure. Keep @arch for compatibility.

Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>
#8 lore raw

PATCH v3 5/5 qapi: deprecate CpuInfoFast.arch

In reply to Laszlo Ersek

The TARGET_BASE_ARCH values from "configure" don't all map to the @CpuInfoArch enum constants; in particular "s390x" from the former does not match @s390 in the latter. Clients are known to rely on the @s390 constant specifically, so we can't change it silently. Instead, deprecate the @CpuInfoFast.@arch member (in favor of @CpuInfoFast.@target) using the regular deprecation process.

(No deprecation reminder is added to sysemu_target_to_cpuinfo_arch(): once @CpuInfoFast.@arch is removed, the assignment expression that calls sysemu_target_to_cpuinfo_arch() from qmp_query_cpus_fast() will have to disappear; in turn the static function left without callers will also break the build, thus it'll have to go.)

Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>

---

Notes:
PATCHv3:

- new patch [Markus, Eric]

 qapi/misc.json | 8 ++++----
 qemu-doc.texi  | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)
qapi/misc.json +4 -4
index fa4eec7b6b63..f5988cc0b52d 100644
@@ -550,27 +550,27 @@
 # Information about a virtual CPU
 #
 # @cpu-index: index of the virtual CPU
 #
 # @qom-path: path to the CPU object in the QOM tree
 #
 # @thread-id: ID of the underlying host thread
 #
 # @props: properties describing to which node/socket/core/thread
 #         virtual CPU belongs to, provided if supported by board
 #
-# @arch: base architecture of the cpu
+# @arch: base architecture of the cpu; deprecated since 2.13.0 in favor
+#        of @target
 #
-# @target: the QEMU system emulation target, which is more specific than
-#          @arch and determines which additional fields will be listed
-#          (since 2.13)
+# @target: the QEMU system emulation target, which determines which
+#          additional fields will be listed (since 2.13)
 #
 # Since: 2.12
 #
 ##
 { 'union'         : 'CpuInfoFast',
   'base'          : { 'cpu-index'    : 'int',
                       'qom-path'     : 'str',
                       'thread-id'    : 'int',
                       '*props'       : 'CpuInstanceProperties',
                       'arch'         : 'CpuInfoArch',
                       'target'       : 'SysEmuTarget' },
qemu-doc.texi +5 -0
index 5813d276156a..0ed0f19e6bab 100644
@@ -2941,22 +2941,27 @@ by the ``convert -l snapshot_param'' argument instead.
 @section QEMU Machine Protocol (QMP) commands
 
 @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)
 
 "autoload" parameter is now ignored. All bitmaps are automatically loaded
 from qcow2 images.
 
 @subsection query-cpus (since 2.12.0)
 
 The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command.
 
+@subsection query-cpus-fast "arch" output member (since 2.13.0)
+
+The ``arch'' output member of the ``query-cpus-fast'' command is
+replaced by the ``target'' output member.
+
 @section System emulator devices
 
 @subsection ivshmem (since 2.6.0)
 
 The ``ivshmem'' device type is replaced by either the ``ivshmem-plain''
 or ``ivshmem-doorbell`` device types.
 
 @subsection Page size support < 4k for embedded PowerPC CPUs (since 2.12.0)
 
 qemu-system-ppcemb will be removed. qemu-system-ppc (or qemu-system-ppc64)
 should be used instead. That means that embedded 4xx PowerPC CPUs will not
Signature · 1 line
2.14.1.3.gb7cf6e02401b
Reviewed-by on v3 5/5
#9 lore raw

Re: [Qemu-devel] [PATCH v3 5/5] qapi: deprecate CpuInfoFast.arch

Quoted 13 lines · Laszlo Ersek

The TARGET_BASE_ARCH values from "configure" don't all map to the @CpuInfoArch enum constants; in particular "s390x" from the former does not match @s390 in the latter. Clients are known to rely on the @s390 constant specifically, so we can't change it silently. Instead, deprecate the @CpuInfoFast.@arch member (in favor of @CpuInfoFast.@target) using the regular deprecation process.

(No deprecation reminder is added to sysemu_target_to_cpuinfo_arch(): once @CpuInfoFast.@arch is removed, the assignment expression that calls sysemu_target_to_cpuinfo_arch() from qmp_query_cpus_fast() will have to disappear; in turn the static function left without callers will also break the build, thus it'll have to go.)

Quoted 6 lines
Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>

---

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by on v3 5/5
#10 lore raw

Re: [Qemu-devel] [PATCH v3 5/5] qapi: deprecate CpuInfoFast.arch

In reply to Laszlo Ersek
Quoted 13 lines · Laszlo Ersek

The TARGET_BASE_ARCH values from "configure" don't all map to the @CpuInfoArch enum constants; in particular "s390x" from the former does not match @s390 in the latter. Clients are known to rely on the @s390 constant specifically, so we can't change it silently. Instead, deprecate the @CpuInfoFast.@arch member (in favor of @CpuInfoFast.@target) using the regular deprecation process.

(No deprecation reminder is added to sysemu_target_to_cpuinfo_arch(): once @CpuInfoFast.@arch is removed, the assignment expression that calls sysemu_target_to_cpuinfo_arch() from qmp_query_cpus_fast() will have to disappear; in turn the static function left without callers will also break the build, thus it'll have to go.)

Quoted 4 lines
Cc "Daniel P. Berrange" <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>
#12 lore raw
Quoted 2 lines · Markus Armbruster

Applied to qapi-next, thanks!

\o/

Thank you all for working with me through this! :)

Laszlo

#13 lore raw
Quoted 7 lines · Laszlo Ersek
Quoted 2 lines · Markus Armbruster

Applied to qapi-next, thanks!

\o/

Thank you all for working with me through this! :)

Thank *you* for going the extra mile!