xref: /openbmc/qemu/qapi/machine-target.json (revision 036144cf)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
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{ 'include': 'machine-common.json' }
8
9##
10# @CpuModelInfo:
11#
12# Virtual CPU model.
13#
14# A CPU model consists of the name of a CPU definition, to which delta
15# changes are applied (e.g. features added/removed). Most magic values
16# that an architecture might require should be hidden behind the name.
17# However, if required, architectures can expose relevant properties.
18#
19# @name: the name of the CPU definition the model is based on
20#
21# @props: a dictionary of QOM properties to be applied
22#
23# Since: 2.8
24##
25{ 'struct': 'CpuModelInfo',
26  'data': { 'name': 'str',
27            '*props': 'any' } }
28
29##
30# @CpuModelExpansionType:
31#
32# An enumeration of CPU model expansion types.
33#
34# @static: Expand to a static CPU model, a combination of a static
35#     base model name and property delta changes.  As the static base
36#     model will never change, the expanded CPU model will be the
37#     same, independent of QEMU version, machine type, machine
38#     options, and accelerator options.  Therefore, the resulting
39#     model can be used by tooling without having to specify a
40#     compatibility machine - e.g. when displaying the "host" model.
41#     The @static CPU models are migration-safe.
42#
43# @full: Expand all properties.  The produced model is not guaranteed
44#     to be migration-safe, but allows tooling to get an insight and
45#     work with model details.
46#
47# .. note:: When a non-migration-safe CPU model is expanded in static
48#    mode, some features enabled by the CPU model may be omitted,
49#    because they can't be implemented by a static CPU model definition
50#    (e.g. cache info passthrough and PMU passthrough in x86). If you
51#    need an accurate representation of the features enabled by a
52#    non-migration-safe CPU model, use @full.  If you need a static
53#    representation that will keep ABI compatibility even when changing
54#    QEMU version or machine-type, use @static (but keep in mind that
55#    some features may be omitted).
56#
57# Since: 2.8
58##
59{ 'enum': 'CpuModelExpansionType',
60  'data': [ 'static', 'full' ] }
61
62##
63# @CpuModelCompareResult:
64#
65# An enumeration of CPU model comparison results.  The result is
66# usually calculated using e.g. CPU features or CPU generations.
67#
68# @incompatible: If model A is incompatible to model B, model A is not
69#     guaranteed to run where model B runs and the other way around.
70#
71# @identical: If model A is identical to model B, model A is
72#     guaranteed to run where model B runs and the other way around.
73#
74# @superset: If model A is a superset of model B, model B is
75#     guaranteed to run where model A runs.  There are no guarantees
76#     about the other way.
77#
78# @subset: If model A is a subset of model B, model A is guaranteed to
79#     run where model B runs.  There are no guarantees about the other
80#     way.
81#
82# Since: 2.8
83##
84{ 'enum': 'CpuModelCompareResult',
85  'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
86
87##
88# @CpuModelBaselineInfo:
89#
90# The result of a CPU model baseline.
91#
92# @model: the baselined CpuModelInfo.
93#
94# Since: 2.8
95##
96{ 'struct': 'CpuModelBaselineInfo',
97  'data': { 'model': 'CpuModelInfo' },
98  'if': 'TARGET_S390X' }
99
100##
101# @CpuModelCompareInfo:
102#
103# The result of a CPU model comparison.
104#
105# @result: The result of the compare operation.
106#
107# @responsible-properties: List of properties that led to the
108#     comparison result not being identical.
109#
110# @responsible-properties is a list of QOM property names that led to
111# both CPUs not being detected as identical.  For identical models,
112# this list is empty.  If a QOM property is read-only, that means
113# there's no known way to make the CPU models identical.  If the
114# special property name "type" is included, the models are by
115# definition not identical and cannot be made identical.
116#
117# Since: 2.8
118##
119{ 'struct': 'CpuModelCompareInfo',
120  'data': { 'result': 'CpuModelCompareResult',
121            'responsible-properties': ['str'] },
122  'if': 'TARGET_S390X' }
123
124##
125# @query-cpu-model-comparison:
126#
127# Compares two CPU models, @modela and @modelb, returning how they
128# compare in a specific configuration.  The results indicates how
129# both models compare regarding runnability.  This result can be
130# used by tooling to make decisions if a certain CPU model will
131# run in a certain configuration or if a compatible CPU model has
132# to be created by baselining.
133#
134# Usually, a CPU model is compared against the maximum possible CPU
135# model of a certain configuration (e.g. the "host" model for KVM).
136# If that CPU model is identical or a subset, it will run in that
137# configuration.
138#
139# The result returned by this command may be affected by:
140#
141# * QEMU version: CPU models may look different depending on the QEMU
142#   version.  (Except for CPU models reported as "static" in
143#   query-cpu-definitions.)
144# * machine-type: CPU model may look different depending on the
145#   machine-type.  (Except for CPU models reported as "static" in
146#   query-cpu-definitions.)
147# * machine options (including accelerator): in some architectures,
148#   CPU models may look different depending on machine and accelerator
149#   options.  (Except for CPU models reported as "static" in
150#   query-cpu-definitions.)
151# * "-cpu" arguments and global properties: arguments to the -cpu
152#   option and global properties may affect expansion of CPU models.
153#   Using query-cpu-model-expansion while using these is not advised.
154#
155# Some architectures may not support comparing CPU models.  s390x
156# supports comparing CPU models.
157#
158# @modela: description of the first CPU model to compare, referred to as
159#     "model A" in CpuModelCompareResult
160#
161# @modelb: description of the second CPU model to compare, referred to as
162#     "model B" in CpuModelCompareResult
163#
164# Returns: a CpuModelCompareInfo describing how both CPU models
165#     compare
166#
167# Errors:
168#     - if comparing CPU models is not supported
169#     - if a model cannot be used
170#     - if a model contains an unknown cpu definition name, unknown
171#       properties or properties with wrong types.
172#
173# .. note:: This command isn't specific to s390x, but is only
174#    implemented on this architecture currently.
175#
176# Since: 2.8
177##
178{ 'command': 'query-cpu-model-comparison',
179  'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
180  'returns': 'CpuModelCompareInfo',
181  'if': 'TARGET_S390X' }
182
183##
184# @query-cpu-model-baseline:
185#
186# Baseline two CPU models, @modela and @modelb, creating a compatible
187# third model.  The created model will always be a static,
188# migration-safe CPU model (see "static" CPU model expansion for details).
189#
190# This interface can be used by tooling to create a compatible CPU
191# model out two CPU models.  The created CPU model will be identical
192# to or a subset of both CPU models when comparing them.  Therefore,
193# the created CPU model is guaranteed to run where the given CPU
194# models run.
195#
196# The result returned by this command may be affected by:
197#
198# * QEMU version: CPU models may look different depending on the QEMU
199#   version.  (Except for CPU models reported as "static" in
200#   query-cpu-definitions.)
201# * machine-type: CPU model may look different depending on the
202#   machine-type.  (Except for CPU models reported as "static" in
203#   query-cpu-definitions.)
204# * machine options (including accelerator): in some architectures,
205#   CPU models may look different depending on machine and accelerator
206#   options.  (Except for CPU models reported as "static" in
207#   query-cpu-definitions.)
208# * "-cpu" arguments and global properties: arguments to the -cpu
209#   option and global properties may affect expansion of CPU models.
210#   Using query-cpu-model-expansion while using these is not advised.
211#
212# Some architectures may not support baselining CPU models.  s390x
213# supports baselining CPU models.
214#
215# @modela: description of the first CPU model to baseline
216#
217# @modelb: description of the second CPU model to baseline
218#
219# Returns: a CpuModelBaselineInfo describing the baselined CPU model
220#
221# Errors:
222#     - if baselining CPU models is not supported
223#     - if a model cannot be used
224#     - if a model contains an unknown cpu definition name, unknown
225#       properties or properties with wrong types.
226#
227# .. note:: This command isn't specific to s390x, but is only
228#    implemented on this architecture currently.
229#
230# Since: 2.8
231##
232{ 'command': 'query-cpu-model-baseline',
233  'data': { 'modela': 'CpuModelInfo',
234            'modelb': 'CpuModelInfo' },
235  'returns': 'CpuModelBaselineInfo',
236  'if': 'TARGET_S390X' }
237
238##
239# @CpuModelExpansionInfo:
240#
241# The result of a cpu model expansion.
242#
243# @model: the expanded CpuModelInfo.
244#
245# @deprecated-props: a list of properties that are flagged as deprecated
246#     by the CPU vendor.  The list depends on the CpuModelExpansionType:
247#     "static" properties are a subset of the enabled-properties for
248#     the expanded model; "full" properties are a set of properties
249#     that are deprecated across all models for the architecture.
250#     (since: 9.1).
251#
252# Since: 2.8
253##
254{ 'struct': 'CpuModelExpansionInfo',
255  'data': { 'model': 'CpuModelInfo',
256            'deprecated-props' : { 'type': ['str'],
257                                   'if': 'TARGET_S390X' } },
258  'if': { 'any': [ 'TARGET_S390X',
259                   'TARGET_I386',
260                   'TARGET_ARM',
261                   'TARGET_LOONGARCH64',
262                   'TARGET_RISCV' ] } }
263
264##
265# @query-cpu-model-expansion:
266#
267# Expands a given CPU model, @model, (or a combination of CPU model +
268# additional options) to different granularities, specified by
269# @type, allowing tooling to get an understanding what a specific
270# CPU model looks like in QEMU under a certain configuration.
271#
272# This interface can be used to query the "host" CPU model.
273#
274# The data returned by this command may be affected by:
275#
276# * QEMU version: CPU models may look different depending on the QEMU
277#   version.  (Except for CPU models reported as "static" in
278#   query-cpu-definitions.)
279# * machine-type: CPU model may look different depending on the
280#   machine-type.  (Except for CPU models reported as "static" in
281#   query-cpu-definitions.)
282# * machine options (including accelerator): in some architectures,
283#   CPU models may look different depending on machine and accelerator
284#   options.  (Except for CPU models reported as "static" in
285#   query-cpu-definitions.)
286# * "-cpu" arguments and global properties: arguments to the -cpu
287#   option and global properties may affect expansion of CPU models.
288#   Using query-cpu-model-expansion while using these is not advised.
289#
290# Some architectures may not support all expansion types.  s390x
291# supports "full" and "static". Arm only supports "full".
292#
293# @model: description of the CPU model to expand
294#
295# @type: expansion type, specifying how to expand the CPU model
296#
297# Returns: a CpuModelExpansionInfo describing the expanded CPU model
298#
299# Errors:
300#     - if expanding CPU models is not supported
301#     - if the model cannot be expanded
302#     - if the model contains an unknown CPU definition name, unknown
303#       properties or properties with a wrong type
304#     - if an expansion type is not supported
305#
306# Since: 2.8
307##
308{ 'command': 'query-cpu-model-expansion',
309  'data': { 'type': 'CpuModelExpansionType',
310            'model': 'CpuModelInfo' },
311  'returns': 'CpuModelExpansionInfo',
312  'if': { 'any': [ 'TARGET_S390X',
313                   'TARGET_I386',
314                   'TARGET_ARM',
315                   'TARGET_LOONGARCH64',
316                   'TARGET_RISCV' ] } }
317
318##
319# @CpuDefinitionInfo:
320#
321# Virtual CPU definition.
322#
323# @name: the name of the CPU definition
324#
325# @migration-safe: whether a CPU definition can be safely used for
326#     migration in combination with a QEMU compatibility machine when
327#     migrating between different QEMU versions and between hosts with
328#     different sets of (hardware or software) capabilities.  If not
329#     provided, information is not available and callers should not
330#     assume the CPU definition to be migration-safe.  (since 2.8)
331#
332# @static: whether a CPU definition is static and will not change
333#     depending on QEMU version, machine type, machine options and
334#     accelerator options.  A static model is always migration-safe.
335#     (since 2.8)
336#
337# @unavailable-features: List of properties that prevent the CPU model
338#     from running in the current host.  (since 2.8)
339#
340# @typename: Type name that can be used as argument to
341#     @device-list-properties, to introspect properties configurable
342#     using -cpu or -global.  (since 2.9)
343#
344# @alias-of: Name of CPU model this model is an alias for.  The target
345#     of the CPU model alias may change depending on the machine type.
346#     Management software is supposed to translate CPU model aliases
347#     in the VM configuration, because aliases may stop being
348#     migration-safe in the future (since 4.1)
349#
350# @deprecated: If true, this CPU model is deprecated and may be
351#     removed in in some future version of QEMU according to the QEMU
352#     deprecation policy.  (since 5.2)
353#
354# @unavailable-features is a list of QOM property names that represent
355# CPU model attributes that prevent the CPU from running.  If the QOM
356# property is read-only, that means there's no known way to make the
357# CPU model run in the current host.  Implementations that choose not
358# to provide specific information return the property name "type". If
359# the property is read-write, it means that it MAY be possible to run
360# the CPU model in the current host if that property is changed.
361# Management software can use it as hints to suggest or choose an
362# alternative for the user, or just to generate meaningful error
363# messages explaining why the CPU model can't be used.  If
364# @unavailable-features is an empty list, the CPU model is runnable
365# using the current host and machine-type.  If @unavailable-features
366# is not present, runnability information for the CPU is not
367# available.
368#
369# Since: 1.2
370##
371{ 'struct': 'CpuDefinitionInfo',
372  'data': { 'name': 'str',
373            '*migration-safe': 'bool',
374            'static': 'bool',
375            '*unavailable-features': [ 'str' ],
376            'typename': 'str',
377            '*alias-of' : 'str',
378            'deprecated' : 'bool' },
379  'if': { 'any': [ 'TARGET_PPC',
380                   'TARGET_ARM',
381                   'TARGET_I386',
382                   'TARGET_S390X',
383                   'TARGET_MIPS',
384                   'TARGET_LOONGARCH64',
385                   'TARGET_RISCV' ] } }
386
387##
388# @query-cpu-definitions:
389#
390# Return a list of supported virtual CPU definitions
391#
392# Returns: a list of CpuDefinitionInfo
393#
394# Since: 1.2
395##
396{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'],
397  'if': { 'any': [ 'TARGET_PPC',
398                   'TARGET_ARM',
399                   'TARGET_I386',
400                   'TARGET_S390X',
401                   'TARGET_MIPS',
402                   'TARGET_LOONGARCH64',
403                   'TARGET_RISCV' ] } }
404
405##
406# @CpuS390Polarization:
407#
408# An enumeration of CPU polarization that can be assumed by a virtual
409# S390 CPU
410#
411# Since: 8.2
412##
413{ 'enum': 'CpuS390Polarization',
414  'prefix': 'S390_CPU_POLARIZATION',
415  'data': [ 'horizontal', 'vertical' ],
416  'if': 'TARGET_S390X'
417}
418
419##
420# @set-cpu-topology:
421#
422# Modify the topology by moving the CPU inside the topology tree, or
423# by changing a modifier attribute of a CPU.  Absent values will not
424# be modified.
425#
426# @core-id: the vCPU ID to be moved
427#
428# @socket-id: destination socket to move the vCPU to
429#
430# @book-id: destination book to move the vCPU to
431#
432# @drawer-id: destination drawer to move the vCPU to
433#
434# @entitlement: entitlement to set
435#
436# @dedicated: whether the provisioning of real to virtual CPU is
437#     dedicated
438#
439# Features:
440#
441# @unstable: This command is experimental.
442#
443# Since: 8.2
444##
445{ 'command': 'set-cpu-topology',
446  'data': {
447      'core-id': 'uint16',
448      '*socket-id': 'uint16',
449      '*book-id': 'uint16',
450      '*drawer-id': 'uint16',
451      '*entitlement': 'CpuS390Entitlement',
452      '*dedicated': 'bool'
453  },
454  'features': [ 'unstable' ],
455  'if': { 'all': [ 'TARGET_S390X' , 'CONFIG_KVM' ] }
456}
457
458##
459# @CPU_POLARIZATION_CHANGE:
460#
461# Emitted when the guest asks to change the polarization.
462#
463# The guest can tell the host (via the PTF instruction) whether the
464# CPUs should be provisioned using horizontal or vertical
465# polarization.
466#
467# On horizontal polarization the host is expected to provision all
468# vCPUs equally.
469#
470# On vertical polarization the host can provision each vCPU
471# differently.  The guest will get information on the details of the
472# provisioning the next time it uses the STSI(15) instruction.
473#
474# @polarization: polarization specified by the guest
475#
476# Features:
477#
478# @unstable: This event is experimental.
479#
480# Since: 8.2
481#
482# .. qmp-example::
483#
484#     <- { "event": "CPU_POLARIZATION_CHANGE",
485#          "data": { "polarization": "horizontal" },
486#          "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
487##
488{ 'event': 'CPU_POLARIZATION_CHANGE',
489  'data': { 'polarization': 'CpuS390Polarization' },
490  'features': [ 'unstable' ],
491  'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
492}
493
494##
495# @CpuPolarizationInfo:
496#
497# The result of a CPU polarization query.
498#
499# @polarization: the CPU polarization
500#
501# Since: 8.2
502##
503{ 'struct': 'CpuPolarizationInfo',
504  'data': { 'polarization': 'CpuS390Polarization' },
505  'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
506}
507
508##
509# @query-s390x-cpu-polarization:
510#
511# Features:
512#
513# @unstable: This command is experimental.
514#
515# Returns: the machine's CPU polarization
516#
517# Since: 8.2
518##
519{ 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
520  'features': [ 'unstable' ],
521  'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
522}
523