- Add a missing QAPI event + functional test for the CPI feature on s390x

- Remove the obsolete s390-ccw-virtio-4.2 machine type
 - 2nd try to fix the slow cache up/download in the MSYS2 CI job
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmj3kIkRHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbW4ZBAAlEulDcBvKukbIWyPcHNN3KLEk0YXRA9S
 Mj7dZ/4rLTvjpHt+y5NaZ+lkzzIPJF3KD6D8Y//no1ik911tCOSaJQLu9ByJHVk4
 EKdEw1LGFYNcpnAP2XAExrwjtB98/YqSqaKB5K5d3jJ/6MQSGHygdTB4OL19Nevt
 tfTxXMBYjze+/Wvkt9bF4gAv6VyQ0XAhzRT1xYcWmrtT0wRhNrl6zG+1GgHWtnhM
 AJbO6PwTsNdsmeRjNCDlamevdAXO44chZJXOEHkIQcfj9enuJyZnmdWH3E7NGjk+
 pTh89u1N+0AERc9DuQIMzYRKb2lgCi8v1xWjJMc/c9dgi7+sJOs7O1m4ySKuGxg0
 +0Czn6Q8tYqywl2i9DmdTqC+l3g4H/5M9xBQtMmLbLNRxXniDCXRedRBTWAUfh29
 K1lL0vL3oz/2oZLE3/SieQdxHP51LsbJGwu1o96T/HvPnaOkzF6c7PRIjuKyqAbR
 5qKhsQMCRqKx6kK4AxnmQ123hnZADpZXWTK9T59xHKwJ595JN7nWAWn3THq4XlPF
 5rkFTIUEkNIWhS92XNyy165tvXw2cz66J3ud/A006p0OzO3Kow3863TNAQI/wFNR
 xDGFNjzNp/8YpXMfsgQZ3oB7iEpK5zliosd61sxqGUcd33w8kMHaKeWwly2Mroy2
 eS1dHAHdSrg=
 =pnHC
 -----END PGP SIGNATURE-----

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

- Add a missing QAPI event + functional test for the CPI feature on s390x
- Remove the obsolete s390-ccw-virtio-4.2 machine type
- 2nd try to fix the slow cache up/download in the MSYS2 CI job

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCgAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmj3kIkRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbW4ZBAAlEulDcBvKukbIWyPcHNN3KLEk0YXRA9S
# Mj7dZ/4rLTvjpHt+y5NaZ+lkzzIPJF3KD6D8Y//no1ik911tCOSaJQLu9ByJHVk4
# EKdEw1LGFYNcpnAP2XAExrwjtB98/YqSqaKB5K5d3jJ/6MQSGHygdTB4OL19Nevt
# tfTxXMBYjze+/Wvkt9bF4gAv6VyQ0XAhzRT1xYcWmrtT0wRhNrl6zG+1GgHWtnhM
# AJbO6PwTsNdsmeRjNCDlamevdAXO44chZJXOEHkIQcfj9enuJyZnmdWH3E7NGjk+
# pTh89u1N+0AERc9DuQIMzYRKb2lgCi8v1xWjJMc/c9dgi7+sJOs7O1m4ySKuGxg0
# +0Czn6Q8tYqywl2i9DmdTqC+l3g4H/5M9xBQtMmLbLNRxXniDCXRedRBTWAUfh29
# K1lL0vL3oz/2oZLE3/SieQdxHP51LsbJGwu1o96T/HvPnaOkzF6c7PRIjuKyqAbR
# 5qKhsQMCRqKx6kK4AxnmQ123hnZADpZXWTK9T59xHKwJ595JN7nWAWn3THq4XlPF
# 5rkFTIUEkNIWhS92XNyy165tvXw2cz66J3ud/A006p0OzO3Kow3863TNAQI/wFNR
# xDGFNjzNp/8YpXMfsgQZ3oB7iEpK5zliosd61sxqGUcd33w8kMHaKeWwly2Mroy2
# eS1dHAHdSrg=
# =pnHC
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 21 Oct 2025 08:54:17 AM CDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [unknown]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [unknown]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2025-10-21' of https://gitlab.com/thuth/qemu:
  gitlab-ci: Decrease the size of the compiler cache
  hw/core/machine: Remove MachineClass::fixup_ram_size callback
  hw/s390x/ccw: Remove SCLPDevice::increment_size field
  hw/s390x/ccw: Remove deprecated s390-ccw-virtio-4.2 machine
  tests/functional: add tests for SCLP event CPI
  qapi/machine-s390x: add QAPI event SCLP_CPI_INFO_AVAILABLE

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2025-10-21 08:59:35 -05:00
commit 3c0b42c68f
9 changed files with 59 additions and 79 deletions

View file

@ -25,6 +25,7 @@ msys2-64bit:
expire_in: 7 days
paths:
- build/meson-logs
- build/cache-log.txt
reports:
junit: build/meson-logs/*.junit.xml
before_script:
@ -94,7 +95,7 @@ msys2-64bit:
- $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink
- $env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR"
- $env:CCACHE_DIR = "$env:CCACHE_BASEDIR/ccache"
- $env:CCACHE_MAXSIZE = "500M"
- $env:CCACHE_MAXSIZE = "180M"
- $env:CCACHE_DEPEND = 1 # cache misses are too expensive with preprocessor mode
- $env:CC = "ccache gcc"
- mkdir build
@ -103,5 +104,7 @@ msys2-64bit:
- ..\msys64\usr\bin\bash -lc "../configure $CONFIGURE_ARGS"
- ..\msys64\usr\bin\bash -lc "make -j$env:JOBS"
- ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat meson-logs/testlog.txt; exit 1; } ;"
- ..\msys64\usr\bin\bash -lc "ls -lR /var/cache > cache-log.txt"
- ..\msys64\usr\bin\bash -lc "du -sh ."
- ..\msys64\usr\bin\bash -lc "ccache --show-stats"
- Write-Output "Finished build at $(Get-Date -Format u)"

View file

@ -648,9 +648,6 @@ static void machine_set_mem(Object *obj, Visitor *v, const char *name,
mem->size = mc->default_ram_size;
}
mem->size = QEMU_ALIGN_UP(mem->size, 8192);
if (mc->fixup_ram_size) {
mem->size = mc->fixup_ram_size(mem->size);
}
if ((ram_addr_t)mem->size != mem->size) {
error_setg(errp, "ram size %llu exceeds permitted maximum %llu",
(unsigned long long)mem->size,

View file

@ -715,26 +715,6 @@ static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
s390_cpu_restart(S390_CPU(cs));
}
static ram_addr_t s390_fixup_ram_size(ram_addr_t sz)
{
/* same logic as in sclp.c */
int increment_size = 20;
ram_addr_t newsz;
while ((sz >> increment_size) > MAX_STORAGE_INCREMENTS) {
increment_size++;
}
newsz = sz >> increment_size << increment_size;
if (sz != newsz) {
qemu_printf("Ram size %" PRIu64 "MB was fixed up to %" PRIu64
"MB to match machine restrictions. Consider updating "
"the guest definition.\n", (uint64_t) (sz / MiB),
(uint64_t) (newsz / MiB));
}
return newsz;
}
static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp)
{
S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
@ -1165,19 +1145,6 @@ static void ccw_machine_5_0_class_options(MachineClass *mc)
}
DEFINE_CCW_MACHINE(5, 0);
static void ccw_machine_4_2_instance_options(MachineState *machine)
{
ccw_machine_5_0_instance_options(machine);
}
static void ccw_machine_4_2_class_options(MachineClass *mc)
{
ccw_machine_5_0_class_options(mc);
mc->fixup_ram_size = s390_fixup_ram_size;
compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
}
DEFINE_CCW_MACHINE(4, 2);
static void ccw_machine_register_types(void)
{
type_register_static(&ccw_machine_info);

View file

@ -110,7 +110,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
ReadInfo *read_info = (ReadInfo *) sccb;
MachineState *machine = MACHINE(qdev_get_machine());
int cpu_count;
int rnsize, rnmax;
int rnmax;
int required_len = SCCB_REQ_LEN(ReadInfo, machine->possible_cpus->len);
int offset_cpu = s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB) ?
offsetof(ReadInfo, entries) :
@ -153,21 +153,14 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
read_info->mha_pow = s390_get_mha_pow();
read_info->hmfai = cpu_to_be32(s390_get_hmfai());
rnsize = 1 << (sclp->increment_size - 20);
if (rnsize <= 128) {
read_info->rnsize = rnsize;
} else {
read_info->rnsize = 0;
read_info->rnsize2 = cpu_to_be32(rnsize);
}
read_info->rnsize = 1;
/*
* We don't support standby memory. maxram_size is used for sizing the
* memory device region, which is not exposed through SCLP but through
* diag500.
*/
rnmax = machine->ram_size >> sclp->increment_size;
rnmax = machine->ram_size >> 20;
if (rnmax < 0x10000) {
read_info->rnmax = cpu_to_be16(rnmax);
} else {
@ -406,25 +399,6 @@ static void sclp_realize(DeviceState *dev, Error **errp)
}
}
static void sclp_memory_init(SCLPDevice *sclp)
{
MachineState *machine = MACHINE(qdev_get_machine());
MachineClass *machine_class = MACHINE_GET_CLASS(qdev_get_machine());
ram_addr_t initial_mem = machine->ram_size;
int increment_size = 20;
/* The storage increment size is a multiple of 1M and is a power of 2.
* For some machine types, the number of storage increments must be
* MAX_STORAGE_INCREMENTS or fewer.
* The variable 'increment_size' is an exponent of 2 that can be
* used to calculate the size (in bytes) of an increment. */
while (machine_class->fixup_ram_size != NULL &&
(initial_mem >> increment_size) > MAX_STORAGE_INCREMENTS) {
increment_size++;
}
sclp->increment_size = increment_size;
}
static void sclp_init(Object *obj)
{
SCLPDevice *sclp = SCLP(obj);
@ -434,8 +408,6 @@ static void sclp_init(Object *obj)
object_property_add_child(obj, TYPE_SCLP_EVENT_FACILITY, new);
object_unref(new);
sclp->event_facility = EVENT_FACILITY(new);
sclp_memory_init(sclp);
}
static void sclp_class_init(ObjectClass *oc, const void *data)

View file

@ -54,6 +54,7 @@
#include "hw/s390x/event-facility.h"
#include "hw/s390x/ebcdic.h"
#include "qapi/qapi-visit-machine.h"
#include "qapi/qapi-events-machine-s390x.h"
#include "migration/vmstate.h"
typedef struct Data {
@ -106,6 +107,9 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr)
e->timestamp = qemu_clock_get_ns(QEMU_CLOCK_HOST);
cpim->ebh.flags = SCLP_EVENT_BUFFER_ACCEPTED;
qapi_event_send_sclp_cpi_info_available();
return SCLP_RC_NORMAL_COMPLETION;
}

View file

@ -250,12 +250,6 @@ typedef struct {
* It also will be used as a way to option into "-m" option support.
* If it's not set by board, '-m' will be ignored and generic code will
* not create default RAM MemoryRegion.
* @fixup_ram_size:
* Amends user provided ram size (with -m option) using machine
* specific algorithm. To be used by old machine types for compat
* purposes only.
* Applies only to default memory backend, i.e., explicit memory backend
* wasn't used.
* @smbios_memory_device_size:
* Default size of memory device,
* SMBIOS 3.1.0 "7.18 Memory Device (Type 17)"
@ -325,7 +319,6 @@ struct MachineClass {
unsigned cpu_index);
const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine);
int64_t (*get_default_cpu_node_id)(const MachineState *ms, int idx);
ram_addr_t (*fixup_ram_size)(ram_addr_t size);
uint64_t smbios_memory_device_size;
bool (*create_default_memdev)(MachineState *ms, const char *path,
Error **errp);

View file

@ -197,12 +197,9 @@ OBJECT_DECLARE_TYPE(SCLPDevice, SCLPDeviceClass,
struct SCLPEventFacility;
struct SCLPDevice {
/* private */
DeviceState parent_obj;
struct SCLPEventFacility *event_facility;
int increment_size;
/* public */
struct SCLPEventFacility *event_facility;
};
struct SCLPDeviceClass {

View file

@ -119,3 +119,24 @@
{ 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
'features': [ 'unstable' ]
}
##
# @SCLP_CPI_INFO_AVAILABLE:
#
# Emitted when the Control-Program Identification data is available
# in the QOM tree.
#
# Features:
#
# @unstable: This event is experimental.
#
# Since: 10.2
#
# .. qmp-example::
#
# <- { "event": "SCLP_CPI_INFO_AVAILABLE",
# "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
##
{ 'event': 'SCLP_CPI_INFO_AVAILABLE',
'features': [ 'unstable' ]
}

View file

@ -15,6 +15,7 @@ import os
import tempfile
from qemu_test import QemuSystemTest, Asset
from qemu_test import exec_command
from qemu_test import exec_command_and_wait_for_pattern
from qemu_test import wait_for_console_pattern
@ -270,5 +271,30 @@ class S390CCWVirtioMachine(QemuSystemTest):
'while ! (dmesg -c | grep Start.virtcrypto_remove) ; do'
' sleep 1 ; done', 'Start virtcrypto_remove.')
# Test SCLP event Control-Program Identification (CPI)
cpi = '/sys/firmware/cpi/'
sclpcpi = '/machine/sclp/s390-sclp-event-facility/sclpcpi'
self.log.info("Test SCLP event CPI")
exec_command(self, 'echo TESTVM > ' + cpi + 'system_name')
exec_command(self, 'echo LINUX > ' + cpi + 'system_type')
exec_command(self, 'echo TESTPLEX > ' + cpi + 'sysplex_name')
exec_command(self, 'echo 0x001a000000060b00 > ' + cpi + 'system_level')
exec_command_and_wait_for_pattern(self,
'echo 1 > ' + cpi + 'set', ':/#')
try:
event = self.vm.event_wait('SCLP_CPI_INFO_AVAILABLE')
except TimeoutError:
self.fail('Timed out waiting for the SCLP_CPI_INFO_AVAILABLE event')
ts = self.vm.cmd('qom-get', path=sclpcpi, property='timestamp')
self.assertNotEqual(ts, 0)
name = self.vm.cmd('qom-get', path=sclpcpi, property='system_name')
self.assertEqual(name.strip(), 'TESTVM')
typ = self.vm.cmd('qom-get', path=sclpcpi, property='system_type')
self.assertEqual(typ.strip(), 'LINUX')
sysplex = self.vm.cmd('qom-get', path=sclpcpi, property='sysplex_name')
self.assertEqual(sysplex.strip(), 'TESTPLEX')
level = self.vm.cmd('qom-get', path=sclpcpi, property='system_level')
self.assertEqual(level, 0x001a000000060b00)
if __name__ == '__main__':
QemuSystemTest.main()