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