blob: f0a6b72414e91ea49209a901bff04d2cf987a941 [file] [log] [blame]
Markus Armbruster7f7b4e72019-06-19 22:10:45 +02001# -*- Mode: Python -*-
Andrea Bolognanif7160f32020-07-29 20:50:24 +02002# vim: filetype=python
Markus Armbruster7f7b4e72019-06-19 22:10:45 +02003#
4# This work is licensed under the terms of the GNU GPL, version 2 or later.
5# See the COPYING file in the top-level directory.
6
7##
8# @CpuModelInfo:
9#
10# Virtual CPU model.
11#
Markus Armbrustera937b6a2023-04-28 12:54:29 +020012# A CPU model consists of the name of a CPU definition, to which delta
13# changes are applied (e.g. features added/removed). Most magic values
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020014# that an architecture might require should be hidden behind the name.
15# However, if required, architectures can expose relevant properties.
16#
17# @name: the name of the CPU definition the model is based on
Markus Armbrustera937b6a2023-04-28 12:54:29 +020018#
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020019# @props: a dictionary of QOM properties to be applied
20#
Markus Armbruster9bc6e892020-11-18 07:41:58 +010021# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020022##
23{ 'struct': 'CpuModelInfo',
24 'data': { 'name': 'str',
25 '*props': 'any' } }
26
27##
28# @CpuModelExpansionType:
29#
30# An enumeration of CPU model expansion types.
31#
Markus Armbrustera937b6a2023-04-28 12:54:29 +020032# @static: Expand to a static CPU model, a combination of a static
33# base model name and property delta changes. As the static base
34# model will never change, the expanded CPU model will be the
35# same, independent of QEMU version, machine type, machine
36# options, and accelerator options. Therefore, the resulting
37# model can be used by tooling without having to specify a
38# compatibility machine - e.g. when displaying the "host" model.
39# The @static CPU models are migration-safe.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020040#
Markus Armbrustera937b6a2023-04-28 12:54:29 +020041# @full: Expand all properties. The produced model is not guaranteed
42# to be migration-safe, but allows tooling to get an insight and
43# work with model details.
44#
45# Note: When a non-migration-safe CPU model is expanded in static
46# mode, some features enabled by the CPU model may be omitted,
47# because they can't be implemented by a static CPU model
48# definition (e.g. cache info passthrough and PMU passthrough in
49# x86). If you need an accurate representation of the features
50# enabled by a non-migration-safe CPU model, use @full. If you
51# need a static representation that will keep ABI compatibility
52# even when changing QEMU version or machine-type, use @static
53# (but keep in mind that some features may be omitted).
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020054#
Markus Armbruster9bc6e892020-11-18 07:41:58 +010055# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020056##
57{ 'enum': 'CpuModelExpansionType',
58 'data': [ 'static', 'full' ] }
59
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020060##
61# @CpuModelCompareResult:
62#
Markus Armbrustera937b6a2023-04-28 12:54:29 +020063# An enumeration of CPU model comparison results. The result is
Markus Armbruster9e272072023-07-20 09:16:09 +020064# usually calculated using e.g. CPU features or CPU generations.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020065#
66# @incompatible: If model A is incompatible to model B, model A is not
Markus Armbrustera937b6a2023-04-28 12:54:29 +020067# guaranteed to run where model B runs and the other way around.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020068#
Markus Armbrustera937b6a2023-04-28 12:54:29 +020069# @identical: If model A is identical to model B, model A is
70# guaranteed to run where model B runs and the other way around.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020071#
Markus Armbrustera937b6a2023-04-28 12:54:29 +020072# @superset: If model A is a superset of model B, model B is
73# guaranteed to run where model A runs. There are no guarantees
74# about the other way.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020075#
Markus Armbrustera937b6a2023-04-28 12:54:29 +020076# @subset: If model A is a subset of model B, model A is guaranteed to
77# run where model B runs. There are no guarantees about the other
78# way.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020079#
Markus Armbruster9bc6e892020-11-18 07:41:58 +010080# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020081##
82{ 'enum': 'CpuModelCompareResult',
83 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
84
85##
86# @CpuModelBaselineInfo:
87#
88# The result of a CPU model baseline.
89#
90# @model: the baselined CpuModelInfo.
91#
Markus Armbruster9bc6e892020-11-18 07:41:58 +010092# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020093##
94{ 'struct': 'CpuModelBaselineInfo',
95 'data': { 'model': 'CpuModelInfo' },
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +040096 'if': 'TARGET_S390X' }
Markus Armbruster7f7b4e72019-06-19 22:10:45 +020097
98##
99# @CpuModelCompareInfo:
100#
101# The result of a CPU model comparison.
102#
103# @result: The result of the compare operation.
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200104#
105# @responsible-properties: List of properties that led to the
106# comparison result not being identical.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200107#
108# @responsible-properties is a list of QOM property names that led to
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200109# both CPUs not being detected as identical. For identical models,
110# this list is empty. If a QOM property is read-only, that means
111# there's no known way to make the CPU models identical. If the
112# special property name "type" is included, the models are by
113# definition not identical and cannot be made identical.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200114#
Markus Armbruster9bc6e892020-11-18 07:41:58 +0100115# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200116##
117{ 'struct': 'CpuModelCompareInfo',
118 'data': { 'result': 'CpuModelCompareResult',
119 'responsible-properties': ['str'] },
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +0400120 'if': 'TARGET_S390X' }
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200121
122##
123# @query-cpu-model-comparison:
124#
125# Compares two CPU models, returning how they compare in a specific
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200126# configuration. The results indicates how both models compare
127# regarding runnability. This result can be used by tooling to make
128# decisions if a certain CPU model will run in a certain configuration
129# or if a compatible CPU model has to be created by baselining.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200130#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200131# Usually, a CPU model is compared against the maximum possible CPU
132# model of a certain configuration (e.g. the "host" model for KVM).
133# If that CPU model is identical or a subset, it will run in that
134# configuration.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200135#
136# The result returned by this command may be affected by:
137#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200138# * QEMU version: CPU models may look different depending on the QEMU
139# version. (Except for CPU models reported as "static" in
140# query-cpu-definitions.)
141# * machine-type: CPU model may look different depending on the
142# machine-type. (Except for CPU models reported as "static" in
143# query-cpu-definitions.)
144# * machine options (including accelerator): in some architectures,
145# CPU models may look different depending on machine and accelerator
146# options. (Except for CPU models reported as "static" in
147# query-cpu-definitions.)
148# * "-cpu" arguments and global properties: arguments to the -cpu
149# option and global properties may affect expansion of CPU models.
150# Using query-cpu-model-expansion while using these is not advised.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200151#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200152# Some architectures may not support comparing CPU models. s390x
153# supports comparing CPU models.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200154#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200155# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU
156# models is not supported, if a model cannot be used, if a model
157# contains an unknown cpu definition name, unknown properties or
158# properties with wrong types.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200159#
160# Note: this command isn't specific to s390x, but is only implemented
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200161# on this architecture currently.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200162#
Markus Armbruster9bc6e892020-11-18 07:41:58 +0100163# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200164##
165{ 'command': 'query-cpu-model-comparison',
166 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
167 'returns': 'CpuModelCompareInfo',
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +0400168 'if': 'TARGET_S390X' }
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200169
170##
171# @query-cpu-model-baseline:
172#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200173# Baseline two CPU models, creating a compatible third model. The
174# created model will always be a static, migration-safe CPU model (see
175# "static" CPU model expansion for details).
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200176#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200177# This interface can be used by tooling to create a compatible CPU
178# model out two CPU models. The created CPU model will be identical
179# to or a subset of both CPU models when comparing them. Therefore,
180# the created CPU model is guaranteed to run where the given CPU
181# models run.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200182#
183# The result returned by this command may be affected by:
184#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200185# * QEMU version: CPU models may look different depending on the QEMU
186# version. (Except for CPU models reported as "static" in
187# query-cpu-definitions.)
188# * machine-type: CPU model may look different depending on the
189# machine-type. (Except for CPU models reported as "static" in
190# query-cpu-definitions.)
191# * machine options (including accelerator): in some architectures,
192# CPU models may look different depending on machine and accelerator
193# options. (Except for CPU models reported as "static" in
194# query-cpu-definitions.)
195# * "-cpu" arguments and global properties: arguments to the -cpu
196# option and global properties may affect expansion of CPU models.
197# Using query-cpu-model-expansion while using these is not advised.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200198#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200199# Some architectures may not support baselining CPU models. s390x
200# supports baselining CPU models.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200201#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200202# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU
203# models is not supported, if a model cannot be used, if a model
204# contains an unknown cpu definition name, unknown properties or
205# properties with wrong types.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200206#
207# Note: this command isn't specific to s390x, but is only implemented
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200208# on this architecture currently.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200209#
Markus Armbruster9bc6e892020-11-18 07:41:58 +0100210# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200211##
212{ 'command': 'query-cpu-model-baseline',
213 'data': { 'modela': 'CpuModelInfo',
214 'modelb': 'CpuModelInfo' },
215 'returns': 'CpuModelBaselineInfo',
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +0400216 'if': 'TARGET_S390X' }
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200217
218##
219# @CpuModelExpansionInfo:
220#
221# The result of a cpu model expansion.
222#
223# @model: the expanded CpuModelInfo.
224#
Markus Armbruster9bc6e892020-11-18 07:41:58 +0100225# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200226##
227{ 'struct': 'CpuModelExpansionInfo',
228 'data': { 'model': 'CpuModelInfo' },
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +0400229 'if': { 'any': [ 'TARGET_S390X',
230 'TARGET_I386',
231 'TARGET_ARM' ] } }
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200232
233##
234# @query-cpu-model-expansion:
235#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200236# Expands a given CPU model (or a combination of CPU model +
237# additional options) to different granularities, allowing tooling to
238# get an understanding what a specific CPU model looks like in QEMU
239# under a certain configuration.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200240#
241# This interface can be used to query the "host" CPU model.
242#
243# The data returned by this command may be affected by:
244#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200245# * QEMU version: CPU models may look different depending on the QEMU
246# version. (Except for CPU models reported as "static" in
247# query-cpu-definitions.)
248# * machine-type: CPU model may look different depending on the
249# machine-type. (Except for CPU models reported as "static" in
250# query-cpu-definitions.)
251# * machine options (including accelerator): in some architectures,
252# CPU models may look different depending on machine and accelerator
253# options. (Except for CPU models reported as "static" in
254# query-cpu-definitions.)
255# * "-cpu" arguments and global properties: arguments to the -cpu
256# option and global properties may affect expansion of CPU models.
257# Using query-cpu-model-expansion while using these is not advised.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200258#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200259# Some architectures may not support all expansion types. s390x
260# supports "full" and "static". Arm only supports "full".
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200261#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200262# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU
263# models is not supported, if the model cannot be expanded, if the
264# model contains an unknown CPU definition name, unknown
265# properties or properties with a wrong type. Also returns an
266# error if an expansion type is not supported.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200267#
Markus Armbruster9bc6e892020-11-18 07:41:58 +0100268# Since: 2.8
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200269##
270{ 'command': 'query-cpu-model-expansion',
271 'data': { 'type': 'CpuModelExpansionType',
272 'model': 'CpuModelInfo' },
273 'returns': 'CpuModelExpansionInfo',
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +0400274 'if': { 'any': [ 'TARGET_S390X',
275 'TARGET_I386',
276 'TARGET_ARM' ] } }
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200277
278##
279# @CpuDefinitionInfo:
280#
281# Virtual CPU definition.
282#
283# @name: the name of the CPU definition
284#
285# @migration-safe: whether a CPU definition can be safely used for
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200286# migration in combination with a QEMU compatibility machine when
287# migrating between different QEMU versions and between hosts with
288# different sets of (hardware or software) capabilities. If not
289# provided, information is not available and callers should not
290# assume the CPU definition to be migration-safe. (since 2.8)
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200291#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200292# @static: whether a CPU definition is static and will not change
293# depending on QEMU version, machine type, machine options and
294# accelerator options. A static model is always migration-safe.
295# (since 2.8)
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200296#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200297# @unavailable-features: List of properties that prevent the CPU model
298# from running in the current host. (since 2.8)
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200299#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200300# @typename: Type name that can be used as argument to
301# @device-list-properties, to introspect properties configurable
302# using -cpu or -global. (since 2.9)
Eduardo Habkost7d753f62019-06-27 21:28:36 -0300303#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200304# @alias-of: Name of CPU model this model is an alias for. The target
305# of the CPU model alias may change depending on the machine type.
306# Management software is supposed to translate CPU model aliases
307# in the VM configuration, because aliases may stop being
308# migration-safe in the future (since 4.1)
Robert Hoo61ad65d2020-09-22 15:14:14 +0800309#
Markus Armbrustera937b6a2023-04-28 12:54:29 +0200310# @deprecated: If true, this CPU model is deprecated and may be
311# removed in in some future version of QEMU according to the QEMU
312# deprecation policy. (since 5.2)
313#
314# @unavailable-features is a list of QOM property names that represent
315# CPU model attributes that prevent the CPU from running. If the QOM
316# property is read-only, that means there's no known way to make the
317# CPU model run in the current host. Implementations that choose not
318# to provide specific information return the property name "type". If
319# the property is read-write, it means that it MAY be possible to run
320# the CPU model in the current host if that property is changed.
321# Management software can use it as hints to suggest or choose an
322# alternative for the user, or just to generate meaningful error
323# messages explaining why the CPU model can't be used. If
324# @unavailable-features is an empty list, the CPU model is runnable
325# using the current host and machine-type. If @unavailable-features
326# is not present, runnability information for the CPU is not
327# available.
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200328#
Markus Armbruster9bc6e892020-11-18 07:41:58 +0100329# Since: 1.2
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200330##
331{ 'struct': 'CpuDefinitionInfo',
332 'data': { 'name': 'str',
333 '*migration-safe': 'bool',
334 'static': 'bool',
335 '*unavailable-features': [ 'str' ],
Eduardo Habkost7d753f62019-06-27 21:28:36 -0300336 'typename': 'str',
Robert Hoo61ad65d2020-09-22 15:14:14 +0800337 '*alias-of' : 'str',
338 'deprecated' : 'bool' },
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +0400339 'if': { 'any': [ 'TARGET_PPC',
340 'TARGET_ARM',
341 'TARGET_I386',
342 'TARGET_S390X',
Xiaojuan Yang425876f2022-06-06 20:43:11 +0800343 'TARGET_MIPS',
Daniel Henrique Barbozac0177f92023-04-11 15:35:10 -0300344 'TARGET_LOONGARCH64',
345 'TARGET_RISCV' ] } }
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200346
347##
348# @query-cpu-definitions:
349#
350# Return a list of supported virtual CPU definitions
351#
Markus Armbrusterd93ed1b2023-04-25 08:42:10 +0200352# Returns: a list of CpuDefinitionInfo
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200353#
Markus Armbruster9bc6e892020-11-18 07:41:58 +0100354# Since: 1.2
Markus Armbruster7f7b4e72019-06-19 22:10:45 +0200355##
356{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'],
Marc-André Lureau8a9f1e12021-08-04 12:31:05 +0400357 'if': { 'any': [ 'TARGET_PPC',
358 'TARGET_ARM',
359 'TARGET_I386',
360 'TARGET_S390X',
Xiaojuan Yang425876f2022-06-06 20:43:11 +0800361 'TARGET_MIPS',
Daniel Henrique Barbozac0177f92023-04-11 15:35:10 -0300362 'TARGET_LOONGARCH64',
363 'TARGET_RISCV' ] } }