mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-03-04 09:04:39 -07:00
* 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:
commit
ebdf417220
35 changed files with 2288 additions and 128 deletions
|
|
@ -135,12 +135,16 @@ typedef struct {
|
|||
* @clusters_supported - whether clusters are supported by the machine
|
||||
* @has_clusters - whether clusters are explicitly specified in the user
|
||||
* provided SMP configuration
|
||||
* @books_supported - whether books are supported by the machine
|
||||
* @drawers_supported - whether drawers are supported by the machine
|
||||
*/
|
||||
typedef struct {
|
||||
bool prefer_sockets;
|
||||
bool dies_supported;
|
||||
bool clusters_supported;
|
||||
bool has_clusters;
|
||||
bool books_supported;
|
||||
bool drawers_supported;
|
||||
} SMPCompatProps;
|
||||
|
||||
/**
|
||||
|
|
@ -323,7 +327,9 @@ typedef struct DeviceMemoryState {
|
|||
/**
|
||||
* CpuTopology:
|
||||
* @cpus: the number of present logical processors on the machine
|
||||
* @sockets: the number of sockets on the machine
|
||||
* @drawers: the number of drawers on the machine
|
||||
* @books: the number of books in one drawer
|
||||
* @sockets: the number of sockets in one book
|
||||
* @dies: the number of dies in one socket
|
||||
* @clusters: the number of clusters in one die
|
||||
* @cores: the number of cores in one cluster
|
||||
|
|
@ -332,6 +338,8 @@ typedef struct DeviceMemoryState {
|
|||
*/
|
||||
typedef struct CpuTopology {
|
||||
unsigned int cpus;
|
||||
unsigned int drawers;
|
||||
unsigned int books;
|
||||
unsigned int sockets;
|
||||
unsigned int dies;
|
||||
unsigned int clusters;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ extern const PropertyInfo qdev_prop_audiodev;
|
|||
extern const PropertyInfo qdev_prop_off_auto_pcibar;
|
||||
extern const PropertyInfo qdev_prop_pcie_link_speed;
|
||||
extern const PropertyInfo qdev_prop_pcie_link_width;
|
||||
extern const PropertyInfo qdev_prop_cpus390entitlement;
|
||||
|
||||
#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
|
||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t)
|
||||
|
|
@ -73,5 +74,8 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
|
|||
#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \
|
||||
DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID)
|
||||
|
||||
#define DEFINE_PROP_CPUS390ENTITLEMENT(_n, _s, _f, _d) \
|
||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_cpus390entitlement, \
|
||||
CpuS390Entitlement)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
83
include/hw/s390x/cpu-topology.h
Normal file
83
include/hw/s390x/cpu-topology.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* CPU Topology
|
||||
*
|
||||
* Copyright IBM Corp. 2022, 2023
|
||||
* Author(s): Pierre Morel <pmorel@linux.ibm.com>
|
||||
*
|
||||
*/
|
||||
#ifndef HW_S390X_CPU_TOPOLOGY_H
|
||||
#define HW_S390X_CPU_TOPOLOGY_H
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
||||
#include "qemu/queue.h"
|
||||
#include "hw/boards.h"
|
||||
#include "qapi/qapi-types-machine-target.h"
|
||||
|
||||
#define S390_TOPOLOGY_CPU_IFL 0x03
|
||||
|
||||
typedef struct S390TopologyId {
|
||||
uint8_t sentinel;
|
||||
uint8_t drawer;
|
||||
uint8_t book;
|
||||
uint8_t socket;
|
||||
uint8_t type;
|
||||
uint8_t vertical:1;
|
||||
uint8_t entitlement:2;
|
||||
uint8_t dedicated;
|
||||
uint8_t origin;
|
||||
} S390TopologyId;
|
||||
|
||||
typedef struct S390TopologyEntry {
|
||||
QTAILQ_ENTRY(S390TopologyEntry) next;
|
||||
S390TopologyId id;
|
||||
uint64_t mask;
|
||||
} S390TopologyEntry;
|
||||
|
||||
typedef struct S390Topology {
|
||||
uint8_t *cores_per_socket;
|
||||
CpuS390Polarization polarization;
|
||||
} S390Topology;
|
||||
|
||||
typedef QTAILQ_HEAD(, S390TopologyEntry) S390TopologyList;
|
||||
|
||||
#ifdef CONFIG_KVM
|
||||
bool s390_has_topology(void);
|
||||
void s390_topology_setup_cpu(MachineState *ms, S390CPU *cpu, Error **errp);
|
||||
void s390_topology_reset(void);
|
||||
#else
|
||||
static inline bool s390_has_topology(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static inline void s390_topology_setup_cpu(MachineState *ms,
|
||||
S390CPU *cpu,
|
||||
Error **errp) {}
|
||||
static inline void s390_topology_reset(void)
|
||||
{
|
||||
/* Unreachable, CPU topology not implemented for TCG */
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern S390Topology s390_topology;
|
||||
|
||||
static inline int s390_std_socket(int n, CpuTopology *smp)
|
||||
{
|
||||
return (n / smp->cores) % smp->sockets;
|
||||
}
|
||||
|
||||
static inline int s390_std_book(int n, CpuTopology *smp)
|
||||
{
|
||||
return (n / (smp->cores * smp->sockets)) % smp->books;
|
||||
}
|
||||
|
||||
static inline int s390_std_drawer(int n, CpuTopology *smp)
|
||||
{
|
||||
return (n / (smp->cores * smp->sockets * smp->books)) % smp->drawers;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USER_ONLY */
|
||||
|
||||
#endif
|
||||
|
|
@ -30,6 +30,12 @@ struct S390CcwMachineState {
|
|||
uint8_t loadparm[8];
|
||||
};
|
||||
|
||||
#define S390_PTF_REASON_NONE (0x00 << 8)
|
||||
#define S390_PTF_REASON_DONE (0x01 << 8)
|
||||
#define S390_PTF_REASON_BUSY (0x02 << 8)
|
||||
#define S390_TOPO_FC_MASK 0xffUL
|
||||
void s390_handle_ptf(S390CPU *cpu, uint8_t r1, uintptr_t ra);
|
||||
|
||||
struct S390CcwMachineClass {
|
||||
/*< private >*/
|
||||
MachineClass parent_class;
|
||||
|
|
|
|||
|
|
@ -112,11 +112,13 @@ typedef struct CPUEntry {
|
|||
} QEMU_PACKED CPUEntry;
|
||||
|
||||
#define SCLP_READ_SCP_INFO_FIXED_CPU_OFFSET 128
|
||||
#define SCLP_READ_SCP_INFO_MNEST 4
|
||||
typedef struct ReadInfo {
|
||||
SCCBHeader h;
|
||||
uint16_t rnmax;
|
||||
uint8_t rnsize;
|
||||
uint8_t _reserved1[16 - 11]; /* 11-15 */
|
||||
uint8_t _reserved1[15 - 11]; /* 11-14 */
|
||||
uint8_t stsi_parm; /* 15-15 */
|
||||
uint16_t entries_cpu; /* 16-17 */
|
||||
uint16_t offset_cpu; /* 18-19 */
|
||||
uint8_t _reserved2[24 - 20]; /* 20-23 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue