Skip to content

Commit

Permalink
Merge tag 'pull-request-2023-10-20' of https://gitlab.com/thuth/qemu
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
stefanhaRH committed Oct 20, 2023
2 parents e09eff8 + 18424d9 commit 06bb108
Show file tree
Hide file tree
Showing 35 changed files with 2,285 additions and 125 deletions.
11 changes: 11 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,16 @@ F: hw/s390x/event-facility.c
F: hw/s390x/sclp*.c
L: qemu-s390x@nongnu.org

S390 CPU topology
M: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
S: Supported
F: include/hw/s390x/cpu-topology.h
F: hw/s390x/cpu-topology.c
F: target/s390x/kvm/stsi-topology.c
F: docs/devel/s390-cpu-topology.rst
F: docs/system/s390x/cpu-topology.rst
F: tests/avocado/s390_topology.py

X86 Machines
------------
PC
Expand Down Expand Up @@ -1798,6 +1808,7 @@ F: hw/core/null-machine.c
F: hw/core/numa.c
F: hw/cpu/cluster.c
F: qapi/machine.json
F: qapi/machine-common.json
F: qapi/machine-target.json
F: include/hw/boards.h
F: include/hw/core/cpu.h
Expand Down
1 change: 1 addition & 0 deletions docs/devel/index-internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Details about QEMU's various subsystems including how to add features to them.
migration
multi-process
reset
s390-cpu-topology
s390-dasd-ipl
tracing
vfio-migration
Expand Down
170 changes: 170 additions & 0 deletions docs/devel/s390-cpu-topology.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
QAPI interface for S390 CPU topology
====================================

The following sections will explain the QAPI interface for S390 CPU topology
with the help of exemplary output.
For this, let's assume that QEMU has been started with the following
command, defining 4 CPUs, where CPU[0] is defined by the -smp argument and will
have default values:

.. code-block:: bash
qemu-system-s390x \
-enable-kvm \
-cpu z14,ctop=on \
-smp 1,drawers=3,books=3,sockets=2,cores=2,maxcpus=36 \
-device z14-s390x-cpu,core-id=19,entitlement=high \
-device z14-s390x-cpu,core-id=11,entitlement=low \
-device z14-s390x-cpu,core-id=112,entitlement=high \
...
Additions to query-cpus-fast
----------------------------

The command query-cpus-fast allows querying the topology tree and
modifiers for all configured vCPUs.

.. code-block:: QMP
{ "execute": "query-cpus-fast" }
{
"return": [
{
"dedicated": false,
"thread-id": 536993,
"props": {
"core-id": 0,
"socket-id": 0,
"drawer-id": 0,
"book-id": 0
},
"cpu-state": "operating",
"entitlement": "medium",
"qom-path": "/machine/unattached/device[0]",
"cpu-index": 0,
"target": "s390x"
},
{
"dedicated": false,
"thread-id": 537003,
"props": {
"core-id": 19,
"socket-id": 1,
"drawer-id": 0,
"book-id": 2
},
"cpu-state": "operating",
"entitlement": "high",
"qom-path": "/machine/peripheral-anon/device[0]",
"cpu-index": 19,
"target": "s390x"
},
{
"dedicated": false,
"thread-id": 537004,
"props": {
"core-id": 11,
"socket-id": 1,
"drawer-id": 0,
"book-id": 1
},
"cpu-state": "operating",
"entitlement": "low",
"qom-path": "/machine/peripheral-anon/device[1]",
"cpu-index": 11,
"target": "s390x"
},
{
"dedicated": true,
"thread-id": 537005,
"props": {
"core-id": 112,
"socket-id": 0,
"drawer-id": 3,
"book-id": 2
},
"cpu-state": "operating",
"entitlement": "high",
"qom-path": "/machine/peripheral-anon/device[2]",
"cpu-index": 112,
"target": "s390x"
}
]
}
QAPI command: set-cpu-topology
------------------------------

The command set-cpu-topology allows modifying the topology tree
or the topology modifiers of a vCPU in the configuration.

.. code-block:: QMP
{ "execute": "set-cpu-topology",
"arguments": {
"core-id": 11,
"socket-id": 0,
"book-id": 0,
"drawer-id": 0,
"entitlement": "low",
"dedicated": false
}
}
{"return": {}}
The core-id parameter is the only mandatory parameter and every
unspecified parameter keeps its previous value.

QAPI event CPU_POLARIZATION_CHANGE
----------------------------------

When a guest requests a modification of the polarization,
QEMU sends a CPU_POLARIZATION_CHANGE event.

When requesting the change, the guest only specifies horizontal or
vertical polarization.
It is the job of the entity administrating QEMU to set the dedication and fine
grained vertical entitlement in response to this event.

Note that a vertical polarized dedicated vCPU can only have a high
entitlement, giving 6 possibilities for vCPU polarization:

- Horizontal
- Horizontal dedicated
- Vertical low
- Vertical medium
- Vertical high
- Vertical high dedicated

Example of the event received when the guest issues the CPU instruction
Perform Topology Function PTF(0) to request an horizontal polarization:

.. code-block:: QMP
{
"timestamp": {
"seconds": 1687870305,
"microseconds": 566299
},
"event": "CPU_POLARIZATION_CHANGE",
"data": {
"polarization": "horizontal"
}
}
QAPI query command: query-s390x-cpu-polarization
------------------------------------------------

The query command query-s390x-cpu-polarization returns the current
CPU polarization of the machine.
In this case the guest previously issued a PTF(1) to request vertical polarization:

.. code-block:: QMP
{ "execute": "query-s390x-cpu-polarization" }
{
"return": {
"polarization": "vertical"
}
}

0 comments on commit 06bb108

Please sign in to comment.