* s390x CPU topology support

* Simplify the KVM register synchronization code
 * Disable the analyze-migration.py test on s390x
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmUyDYMRHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbUlgBAAkF3dvW0vMcb653sCI5vt2GHIvQQtc2Rw
 ghRRcTBZ7wyVxKHtqohCh7/byzDW5YEuCWUyLsc2oIz/84pc00VR/5Ng1EAxLAfe
 mvzzjr4jX96SmoO0DbJpqJQXaUPNYdmoshbRL0I3wkIfGtkvGRM8zHZuYINOg0hw
 bH6gWZ2QL/NFjXh0uAOaJB1+hRtPWvHD2rnVt0g9U9W5QhRxGJqti5YEaLBH7hh5
 RydsquRZ/E6uFw4pMjjvCxDaswPwejddrP2YeR5Fd5Zo+Kzp53r9Hf/eJwlZ8yFL
 5f1dRb19NZYpW1hZuJVOP8tkPydYxAM85vkUunI7Qg4gez5KI0Nz6hQozw6ufMlQ
 r8L17fwQMsCrwcRypImYNXyyrtHlNH5Y8FjqTct8aK64Bw3e7Qqi7d3ybFAuYZ+D
 k2EJ8Rlwhbg69h+Q+ucHx4NkYu9+2MFS6G7w5EcM6xl3WHSwUxh9orlEMsIkyHS3
 OMFMTr1jjfFdEN6EafhPwFE/xKglFF2Fe3u6NoR+5pkv3UA5Z87giitxoekYecpH
 J96P3anORpWW75qvOF+nccqrd7OrUL1/yYdOyJh5Tkm0oCIeQ9E5extVf3Gne3E/
 yWzr00GJRiHFO2qbGStgKHTQLItgQpccwNpSzEdgHCqwLbXl6e3Hoq42VIFOlbN/
 ZtgpyUkuYyQ=
 =xDb+
 -----END PGP SIGNATURE-----

Merge tag 'pull-request-2023-10-20' of https://gitlab.com/thuth/qemu into staging

* s390x CPU topology support
* Simplify the KVM register synchronization code
* Disable the analyze-migration.py test on s390x

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmUyDYMRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbUlgBAAkF3dvW0vMcb653sCI5vt2GHIvQQtc2Rw
# ghRRcTBZ7wyVxKHtqohCh7/byzDW5YEuCWUyLsc2oIz/84pc00VR/5Ng1EAxLAfe
# mvzzjr4jX96SmoO0DbJpqJQXaUPNYdmoshbRL0I3wkIfGtkvGRM8zHZuYINOg0hw
# bH6gWZ2QL/NFjXh0uAOaJB1+hRtPWvHD2rnVt0g9U9W5QhRxGJqti5YEaLBH7hh5
# RydsquRZ/E6uFw4pMjjvCxDaswPwejddrP2YeR5Fd5Zo+Kzp53r9Hf/eJwlZ8yFL
# 5f1dRb19NZYpW1hZuJVOP8tkPydYxAM85vkUunI7Qg4gez5KI0Nz6hQozw6ufMlQ
# r8L17fwQMsCrwcRypImYNXyyrtHlNH5Y8FjqTct8aK64Bw3e7Qqi7d3ybFAuYZ+D
# k2EJ8Rlwhbg69h+Q+ucHx4NkYu9+2MFS6G7w5EcM6xl3WHSwUxh9orlEMsIkyHS3
# OMFMTr1jjfFdEN6EafhPwFE/xKglFF2Fe3u6NoR+5pkv3UA5Z87giitxoekYecpH
# J96P3anORpWW75qvOF+nccqrd7OrUL1/yYdOyJh5Tkm0oCIeQ9E5extVf3Gne3E/
# yWzr00GJRiHFO2qbGStgKHTQLItgQpccwNpSzEdgHCqwLbXl6e3Hoq42VIFOlbN/
# ZtgpyUkuYyQ=
# =xDb+
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 19 Oct 2023 22:17:55 PDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2023-10-20' of https://gitlab.com/thuth/qemu: (24 commits)
  tests/qtest/migration-test: Disable the analyze-migration.py test on s390x
  target/s390x/kvm: Simplify the GPRs, ACRs, CRs and prefix synchronization code
  target/s390x/kvm: Turn KVM_CAP_SYNC_REGS into a hard requirement
  tests/avocado: s390x cpu topology bad move
  tests/avocado: s390x cpu topology dedicated errors
  tests/avocado: s390x cpu topology test socket full
  tests/avocado: s390x cpu topology test dedicated CPU
  tests/avocado: s390x cpu topology entitlement tests
  tests/avocado: s390x cpu topology polarization
  tests/avocado: s390x cpu topology core
  docs/s390x/cpu topology: document s390x cpu topology
  qapi/s390x/cpu topology: add query-s390x-cpu-polarization command
  qapi/s390x/cpu topology: CPU_POLARIZATION_CHANGE QAPI event
  machine: adding s390 topology to info hotpluggable-cpus
  machine: adding s390 topology to query-cpu-fast
  qapi/s390x/cpu topology: set-cpu-topology qmp command
  target/s390x/cpu topology: activate CPU topology
  s390x/cpu topology: interception of PTF instruction
  s390x/cpu topology: resetting the Topology-Change-Report
  s390x/sclp: reporting the maximum nested topology entries
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2023-10-20 06:46:41 -07:00
commit ebdf417220
35 changed files with 2288 additions and 128 deletions

21
qapi/machine-common.json Normal file
View file

@ -0,0 +1,21 @@
# -*- Mode: Python -*-
# vim: filetype=python
#
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
##
# = Machines S390 data types
##
##
# @CpuS390Entitlement:
#
# An enumeration of CPU entitlements that can be assumed by a virtual
# S390 CPU
#
# Since: 8.2
##
{ 'enum': 'CpuS390Entitlement',
'prefix': 'S390_CPU_ENTITLEMENT',
'data': [ 'auto', 'low', 'medium', 'high' ] }

View file

@ -4,6 +4,8 @@
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
{ 'include': 'machine-common.json' }
##
# @CpuModelInfo:
#
@ -361,3 +363,122 @@
'TARGET_MIPS',
'TARGET_LOONGARCH64',
'TARGET_RISCV' ] } }
##
# @CpuS390Polarization:
#
# An enumeration of CPU polarization that can be assumed by a virtual
# S390 CPU
#
# Since: 8.2
##
{ 'enum': 'CpuS390Polarization',
'prefix': 'S390_CPU_POLARIZATION',
'data': [ 'horizontal', 'vertical' ],
'if': 'TARGET_S390X'
}
##
# @set-cpu-topology:
#
# Modify the topology by moving the CPU inside the topology tree,
# or by changing a modifier attribute of a CPU.
# Absent values will not be modified.
#
# @core-id: the vCPU ID to be moved
#
# @socket-id: destination socket to move the vCPU to
#
# @book-id: destination book to move the vCPU to
#
# @drawer-id: destination drawer to move the vCPU to
#
# @entitlement: entitlement to set
#
# @dedicated: whether the provisioning of real to virtual CPU is dedicated
#
# Features:
#
# @unstable: This command is experimental.
#
# Returns: Nothing on success.
#
# Since: 8.2
##
{ 'command': 'set-cpu-topology',
'data': {
'core-id': 'uint16',
'*socket-id': 'uint16',
'*book-id': 'uint16',
'*drawer-id': 'uint16',
'*entitlement': 'CpuS390Entitlement',
'*dedicated': 'bool'
},
'features': [ 'unstable' ],
'if': { 'all': [ 'TARGET_S390X' , 'CONFIG_KVM' ] }
}
##
# @CPU_POLARIZATION_CHANGE:
#
# Emitted when the guest asks to change the polarization.
#
# The guest can tell the host (via the PTF instruction) whether the
# CPUs should be provisioned using horizontal or vertical polarization.
#
# On horizontal polarization the host is expected to provision all vCPUs
# equally.
#
# On vertical polarization the host can provision each vCPU differently.
# The guest will get information on the details of the provisioning
# the next time it uses the STSI(15) instruction.
#
# @polarization: polarization specified by the guest
#
# Features:
#
# @unstable: This event is experimental.
#
# Since: 8.2
#
# Example:
#
# <- { "event": "CPU_POLARIZATION_CHANGE",
# "data": { "polarization": "horizontal" },
# "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
##
{ 'event': 'CPU_POLARIZATION_CHANGE',
'data': { 'polarization': 'CpuS390Polarization' },
'features': [ 'unstable' ],
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
}
##
# @CpuPolarizationInfo:
#
# The result of a CPU polarization query.
#
# @polarization: the CPU polarization
#
# Since: 8.2
##
{ 'struct': 'CpuPolarizationInfo',
'data': { 'polarization': 'CpuS390Polarization' },
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
}
##
# @query-s390x-cpu-polarization:
#
# Features:
#
# @unstable: This command is experimental.
#
# Returns: the machine's CPU polarization
#
# Since: 8.2
##
{ 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
'features': [ 'unstable' ],
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
}

View file

@ -9,6 +9,7 @@
##
{ 'include': 'common.json' }
{ 'include': 'machine-common.json' }
##
# @SysEmuTarget:
@ -56,9 +57,16 @@
#
# @cpu-state: the virtual CPU's state
#
# @dedicated: the virtual CPU's dedication (since 8.2)
#
# @entitlement: the virtual CPU's entitlement (since 8.2)
#
# Since: 2.12
##
{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
{ 'struct': 'CpuInfoS390',
'data': { 'cpu-state': 'CpuS390State',
'*dedicated': 'bool',
'*entitlement': 'CpuS390Entitlement' } }
##
# @CpuInfoFast:
@ -71,8 +79,7 @@
#
# @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
# @props: properties associated with a virtual CPU, e.g. the socket id
#
# @target: the QEMU system emulation target, which determines which
# additional fields will be listed (since 3.0)
@ -899,29 +906,46 @@
# should be passed by management with device_add command when a CPU is
# being hotplugged.
#
# Which members are optional and which mandatory depends on the
# architecture and board.
#
# For s390x see :ref:`cpu-topology-s390x`.
#
# The ids other than the node-id specify the position of the CPU
# within the CPU topology (as defined by the machine property "smp",
# thus see also type @SMPConfiguration)
#
# @node-id: NUMA node ID the CPU belongs to
#
# @socket-id: socket number within node/board the CPU belongs to
# @drawer-id: drawer number within CPU topology the CPU belongs to
# (since 8.2)
#
# @die-id: die number within socket the CPU belongs to (since 4.1)
# @book-id: book number within parent container the CPU belongs to
# (since 8.2)
#
# @cluster-id: cluster number within die the CPU belongs to (since
# 7.1)
# @socket-id: socket number within parent container the CPU belongs to
#
# @core-id: core number within cluster the CPU belongs to
# @die-id: die number within the parent container the CPU belongs to
# (since 4.1)
#
# @thread-id: thread number within core the CPU belongs to
# @cluster-id: cluster number within the parent container the CPU
# belongs to (since 7.1)
#
# Note: currently there are 6 properties that could be present but
# management should be prepared to pass through other properties
# with device_add command to allow for future interface extension.
# This also requires the filed names to be kept in sync with the
# properties passed to -device/device_add.
# @core-id: core number within the parent container the CPU
# belongs to
#
# @thread-id: thread number within the core the CPU belongs to
#
# Note: management should be prepared to pass through additional
# properties with device_add.
#
# Since: 2.7
##
{ 'struct': 'CpuInstanceProperties',
# Keep these in sync with the properties device_add accepts
'data': { '*node-id': 'int',
'*drawer-id': 'int',
'*book-id': 'int',
'*socket-id': 'int',
'*die-id': 'int',
'*cluster-id': 'int',
@ -1478,26 +1502,43 @@
# Schema for CPU topology configuration. A missing value lets QEMU
# figure out a suitable value based on the ones that are provided.
#
# The members other than @cpus and @maxcpus define a topology of
# containers.
#
# The ordering from highest/coarsest to lowest/finest is:
# @drawers, @books, @sockets, @dies, @clusters, @cores, @threads.
#
# Different architectures support different subsets of topology
# containers.
#
# For example, s390x does not have clusters and dies, and the socket
# is the parent container of cores.
#
# @cpus: number of virtual CPUs in the virtual machine
#
# @sockets: number of sockets in the CPU topology
#
# @dies: number of dies per socket in the CPU topology
#
# @clusters: number of clusters per die in the CPU topology (since
# 7.0)
#
# @cores: number of cores per cluster in the CPU topology
#
# @threads: number of threads per core in the CPU topology
#
# @maxcpus: maximum number of hotpluggable virtual CPUs in the virtual
# machine
#
# @drawers: number of drawers in the CPU topology (since 8.2)
#
# @books: number of books in the CPU topology (since 8.2)
#
# @sockets: number of sockets per parent container
#
# @dies: number of dies per parent container
#
# @clusters: number of clusters per parent container (since 7.0)
#
# @cores: number of cores per parent container
#
# @threads: number of threads per core
#
# Since: 6.1
##
{ 'struct': 'SMPConfiguration', 'data': {
'*cpus': 'int',
'*drawers': 'int',
'*books': 'int',
'*sockets': 'int',
'*dies': 'int',
'*clusters': 'int',

View file

@ -36,6 +36,7 @@ qapi_all_modules = [
'error',
'introspect',
'job',
'machine-common',
'machine',
'machine-target',
'migration',

View file

@ -66,6 +66,7 @@
{ 'include': 'introspect.json' }
{ 'include': 'qom.json' }
{ 'include': 'qdev.json' }
{ 'include': 'machine-common.json' }
{ 'include': 'machine.json' }
{ 'include': 'machine-target.json' }
{ 'include': 'replay.json' }