* Extend s390x diagnose call 308 subcode 10 to return more information

* Make valgrind support configurable
 * Drop support for Python 3.8
 * Some other misc cosmetic changes
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmgScIQRHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbXf+hAAnt6RcceX8e9CSXaggozXMeI5c/7nMUJl
 PTJrWV0HXhspKR2SEYADkKk5cVGWnSum7PDgrwHXMyykUSE2jOsUhIrWauyLaiuE
 fKIOhTOX6DiYPINVJzsJ8JXrJ7jkYmnGMnrbZg1i1wnYwx9ZkAAZOagGu4pMguml
 digEVMJp7KiGztCrQwA/Og1zrTTPP9a6071tCvungQJDMrLuJgYb+hafpoNBaAy3
 WoOqP/Fh5AXHkySZlKGhL/mqrj7FVSUMWsNoBncZXtTcnnSP4u6gVt0fd7W9LC6u
 QGGGTEV8UkRhiW4s/Dxd6HOt0OS9m4sDWbubYv9nzIfRM1X8rfKqOCnjKxbeU/lI
 kdoZpK1FSyzKcH+QvEVYaQv33BitVrx3h+WQKgSCZTmTit9TjshBAEDAvzfL6oML
 xYM4oqf0kWqlJjIfatx11dfLJLpAwk8jtgKz9iSPH11lLqGQmsdPNMEdXvUiuiSZ
 tddvuKn0AKwTNO+OWonztBO2aiADSO9hZhWAPVuZUTYCt9zWyQF4ddAgOm2+FZOg
 B9u01aBNSodTaBFASDabWnoi/09lPuhcqINB18XJXG3EsdbrtTP9PjHkSL8Oj+eA
 v2g+uuxIlD3OfvTdrRAVpRjrGBcz3yKkPOw4KA/pnCyP/w3SnoObu0GjFcD4Okuk
 pfvd8eAw7dI=
 =K0wD
 -----END PGP SIGNATURE-----

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

* Extend s390x diagnose call 308 subcode 10 to return more information
* Make valgrind support configurable
* Drop support for Python 3.8
* Some other misc cosmetic changes

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmgScIQRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbXf+hAAnt6RcceX8e9CSXaggozXMeI5c/7nMUJl
# PTJrWV0HXhspKR2SEYADkKk5cVGWnSum7PDgrwHXMyykUSE2jOsUhIrWauyLaiuE
# fKIOhTOX6DiYPINVJzsJ8JXrJ7jkYmnGMnrbZg1i1wnYwx9ZkAAZOagGu4pMguml
# digEVMJp7KiGztCrQwA/Og1zrTTPP9a6071tCvungQJDMrLuJgYb+hafpoNBaAy3
# WoOqP/Fh5AXHkySZlKGhL/mqrj7FVSUMWsNoBncZXtTcnnSP4u6gVt0fd7W9LC6u
# QGGGTEV8UkRhiW4s/Dxd6HOt0OS9m4sDWbubYv9nzIfRM1X8rfKqOCnjKxbeU/lI
# kdoZpK1FSyzKcH+QvEVYaQv33BitVrx3h+WQKgSCZTmTit9TjshBAEDAvzfL6oML
# xYM4oqf0kWqlJjIfatx11dfLJLpAwk8jtgKz9iSPH11lLqGQmsdPNMEdXvUiuiSZ
# tddvuKn0AKwTNO+OWonztBO2aiADSO9hZhWAPVuZUTYCt9zWyQF4ddAgOm2+FZOg
# B9u01aBNSodTaBFASDabWnoi/09lPuhcqINB18XJXG3EsdbrtTP9PjHkSL8Oj+eA
# v2g+uuxIlD3OfvTdrRAVpRjrGBcz3yKkPOw4KA/pnCyP/w3SnoObu0GjFcD4Okuk
# pfvd8eAw7dI=
# =K0wD
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 30 Apr 2025 14:48:36 EDT
# 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-2025-04-30' of https://gitlab.com/thuth/qemu:
  docs/devel/build-environment: enhance MSYS2 instructions
  hw/rtc/mc146818rtc: Drop pre-v3 migration stream support
  meson.build: Put the D-Bus summary into the UI section
  tests/functional/test_ppc64_pseries: Skip test_ppc64_linux_smt_boot if necessary
  Drop support for Python 3.8
  meson/configure: add 'valgrind' option & --{en, dis}able-valgrind flag
  target/s390x: Return UVC cmd code, RC and RRC value when DIAG 308 Subcode 10 fails to enter secure mode
  target/s390x: Introduce function when exiting PV
  target/s390x: Introduce constant when checking if PV header couldn't be decrypted

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2025-05-05 11:26:28 -04:00
commit d0394ab5b9
18 changed files with 126 additions and 76 deletions

14
configure vendored
View file

@ -540,17 +540,17 @@ if test -n "$linux_arch" && ! test -d "$source_path/linux-headers/asm-$linux_arc
fi fi
check_py_version() { check_py_version() {
# We require python >= 3.8. # We require python >= 3.9.
# NB: a True python conditional creates a non-zero return code (Failure) # NB: a True python conditional creates a non-zero return code (Failure)
"$1" -c 'import sys; sys.exit(sys.version_info < (3,8))' "$1" -c 'import sys; sys.exit(sys.version_info < (3,9))'
} }
first_python= first_python=
if test -z "${PYTHON}"; then if test -z "${PYTHON}"; then
# A bare 'python' is traditionally python 2.x, but some distros # A bare 'python' is traditionally python 2.x, but some distros
# have it as python 3.x, so check in both places. # have it as python 3.x, so check in both places.
for binary in python3 python python3.12 python3.11 \ for binary in python3 python python3.13 python3.12 python3.11 \
python3.10 python3.9 python3.8; do python3.10 python3.9 ; do
if has "$binary"; then if has "$binary"; then
python=$(command -v "$binary") python=$(command -v "$binary")
if check_py_version "$python"; then if check_py_version "$python"; then
@ -933,7 +933,7 @@ then
# If first_python is set, there was a binary somewhere even though # If first_python is set, there was a binary somewhere even though
# it was not suitable. Use it for the error message. # it was not suitable. Use it for the error message.
if test -n "$first_python"; then if test -n "$first_python"; then
error_exit "Cannot use '$first_python', Python >= 3.8 is required." \ error_exit "Cannot use '$first_python', Python >= 3.9 is required." \
"Use --python=/path/to/python to specify a supported Python." "Use --python=/path/to/python to specify a supported Python."
else else
error_exit "Python not found. Use --python=/path/to/python" error_exit "Python not found. Use --python=/path/to/python"
@ -941,11 +941,11 @@ then
fi fi
if ! check_py_version "$python"; then if ! check_py_version "$python"; then
error_exit "Cannot use '$python', Python >= 3.8 is required." \ error_exit "Cannot use '$python', Python >= 3.9 is required." \
"Use --python=/path/to/python to specify a supported Python." \ "Use --python=/path/to/python to specify a supported Python." \
"Maybe try:" \ "Maybe try:" \
" openSUSE Leap 15.3+: zypper install python39" \ " openSUSE Leap 15.3+: zypper install python39" \
" CentOS 8: dnf install python38" " CentOS: dnf install python3.12"
fi fi
# Resolve PATH # Resolve PATH

View file

@ -101,7 +101,7 @@ Python runtime
option of the ``configure`` script to point QEMU to a supported option of the ``configure`` script to point QEMU to a supported
version of the Python runtime. version of the Python runtime.
As of QEMU |version|, the minimum supported version of Python is 3.8. As of QEMU |version|, the minimum supported version of Python is 3.9.
Python build dependencies Python build dependencies
Some of QEMU's build dependencies are written in Python. Usually these Some of QEMU's build dependencies are written in Python. Usually these

View file

@ -97,11 +97,11 @@ build QEMU in MSYS2 itself.
:: ::
pacman -S wget pacman -S wget base-devel git
wget https://raw.githubusercontent.com/msys2/MINGW-packages/refs/heads/master/mingw-w64-qemu/PKGBUILD wget https://raw.githubusercontent.com/msys2/MINGW-packages/refs/heads/master/mingw-w64-qemu/PKGBUILD
# Some packages may be missing for your environment, installation will still # Some packages may be missing for your environment, installation will still
# be done though. # be done though.
makepkg -s PKGBUILD || true makepkg --syncdeps --nobuild PKGBUILD || true
Build on windows-aarch64 Build on windows-aarch64
++++++++++++++++++++++++ ++++++++++++++++++++++++

View file

@ -819,7 +819,7 @@ static const VMStateDescription vmstate_rtc_irq_reinject_on_ack_count = {
static const VMStateDescription vmstate_rtc = { static const VMStateDescription vmstate_rtc = {
.name = "mc146818rtc", .name = "mc146818rtc",
.version_id = 3, .version_id = 3,
.minimum_version_id = 1, .minimum_version_id = 3,
.pre_save = rtc_pre_save, .pre_save = rtc_pre_save,
.post_load = rtc_post_load, .post_load = rtc_post_load,
.fields = (const VMStateField[]) { .fields = (const VMStateField[]) {
@ -829,13 +829,13 @@ static const VMStateDescription vmstate_rtc = {
VMSTATE_TIMER_PTR(periodic_timer, MC146818RtcState), VMSTATE_TIMER_PTR(periodic_timer, MC146818RtcState),
VMSTATE_INT64(next_periodic_time, MC146818RtcState), VMSTATE_INT64(next_periodic_time, MC146818RtcState),
VMSTATE_UNUSED(3*8), VMSTATE_UNUSED(3*8),
VMSTATE_UINT32_V(irq_coalesced, MC146818RtcState, 2), VMSTATE_UINT32(irq_coalesced, MC146818RtcState),
VMSTATE_UINT32_V(period, MC146818RtcState, 2), VMSTATE_UINT32(period, MC146818RtcState),
VMSTATE_UINT64_V(base_rtc, MC146818RtcState, 3), VMSTATE_UINT64(base_rtc, MC146818RtcState),
VMSTATE_UINT64_V(last_update, MC146818RtcState, 3), VMSTATE_UINT64(last_update, MC146818RtcState),
VMSTATE_INT64_V(offset, MC146818RtcState, 3), VMSTATE_INT64(offset, MC146818RtcState),
VMSTATE_TIMER_PTR_V(update_timer, MC146818RtcState, 3), VMSTATE_TIMER_PTR(update_timer, MC146818RtcState),
VMSTATE_UINT64_V(next_alarm_time, MC146818RtcState, 3), VMSTATE_UINT64(next_alarm_time, MC146818RtcState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
}, },
.subsections = (const VMStateDescription * const []) { .subsections = (const VMStateDescription * const []) {
@ -929,8 +929,6 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
memory_region_add_subregion(&s->io, 0, &s->coalesced_io); memory_region_add_subregion(&s->io, 0, &s->coalesced_io);
memory_region_add_coalescing(&s->coalesced_io, 0, 1); memory_region_add_coalescing(&s->coalesced_io, 0, 1);
qdev_set_legacy_instance_id(dev, s->io_base, 3);
object_property_add_tm(OBJECT(s), "date", rtc_get_date); object_property_add_tm(OBJECT(s), "date", rtc_get_date);
qdev_init_gpio_out(dev, &s->irq, 1); qdev_init_gpio_out(dev, &s->irq, 1);

View file

@ -26,7 +26,6 @@
#include "hw/s390x/vfio-ccw.h" #include "hw/s390x/vfio-ccw.h"
#include "hw/s390x/css.h" #include "hw/s390x/css.h"
#include "hw/s390x/ebcdic.h" #include "hw/s390x/ebcdic.h"
#include "target/s390x/kvm/pv.h"
#include "hw/scsi/scsi.h" #include "hw/scsi/scsi.h"
#include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-net.h"
#include "ipl.h" #include "ipl.h"
@ -676,7 +675,7 @@ static void s390_ipl_prepare_qipl(S390CPU *cpu)
cpu_physical_memory_unmap(addr, len, 1, len); cpu_physical_memory_unmap(addr, len, 1, len);
} }
int s390_ipl_prepare_pv_header(Error **errp) int s390_ipl_prepare_pv_header(struct S390PVResponse *pv_resp, Error **errp)
{ {
IplParameterBlock *ipib = s390_ipl_get_iplb_pv(); IplParameterBlock *ipib = s390_ipl_get_iplb_pv();
IPLBlockPV *ipib_pv = &ipib->pv; IPLBlockPV *ipib_pv = &ipib->pv;
@ -685,12 +684,13 @@ int s390_ipl_prepare_pv_header(Error **errp)
cpu_physical_memory_read(ipib_pv->pv_header_addr, hdr, cpu_physical_memory_read(ipib_pv->pv_header_addr, hdr,
ipib_pv->pv_header_len); ipib_pv->pv_header_len);
rc = s390_pv_set_sec_parms((uintptr_t)hdr, ipib_pv->pv_header_len, errp); rc = s390_pv_set_sec_parms((uintptr_t)hdr, ipib_pv->pv_header_len,
pv_resp, errp);
g_free(hdr); g_free(hdr);
return rc; return rc;
} }
int s390_ipl_pv_unpack(void) int s390_ipl_pv_unpack(struct S390PVResponse *pv_resp)
{ {
IplParameterBlock *ipib = s390_ipl_get_iplb_pv(); IplParameterBlock *ipib = s390_ipl_get_iplb_pv();
IPLBlockPV *ipib_pv = &ipib->pv; IPLBlockPV *ipib_pv = &ipib->pv;
@ -699,7 +699,8 @@ int s390_ipl_pv_unpack(void)
for (i = 0; i < ipib_pv->num_comp; i++) { for (i = 0; i < ipib_pv->num_comp; i++) {
rc = s390_pv_unpack(ipib_pv->components[i].addr, rc = s390_pv_unpack(ipib_pv->components[i].addr,
TARGET_PAGE_ALIGN(ipib_pv->components[i].size), TARGET_PAGE_ALIGN(ipib_pv->components[i].size),
ipib_pv->components[i].tweak_pref); ipib_pv->components[i].tweak_pref,
pv_resp);
if (rc) { if (rc) {
break; break;
} }

View file

@ -20,6 +20,7 @@
#include "hw/qdev-core.h" #include "hw/qdev-core.h"
#include "hw/s390x/ipl/qipl.h" #include "hw/s390x/ipl/qipl.h"
#include "qom/object.h" #include "qom/object.h"
#include "target/s390x/kvm/pv.h"
#define DIAG308_FLAGS_LP_VALID 0x80 #define DIAG308_FLAGS_LP_VALID 0x80
#define MAX_BOOT_DEVS 8 /* Max number of devices that may have a bootindex */ #define MAX_BOOT_DEVS 8 /* Max number of devices that may have a bootindex */
@ -28,8 +29,9 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp);
void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp); void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp);
void s390_rebuild_iplb(uint16_t index, IplParameterBlock *iplb); void s390_rebuild_iplb(uint16_t index, IplParameterBlock *iplb);
void s390_ipl_update_diag308(IplParameterBlock *iplb); void s390_ipl_update_diag308(IplParameterBlock *iplb);
int s390_ipl_prepare_pv_header(Error **errp); int s390_ipl_prepare_pv_header(struct S390PVResponse *pv_resp,
int s390_ipl_pv_unpack(void); Error **errp);
int s390_ipl_pv_unpack(struct S390PVResponse *pv_resp);
void s390_ipl_prepare_cpu(S390CPU *cpu); void s390_ipl_prepare_cpu(S390CPU *cpu);
IplParameterBlock *s390_ipl_get_iplb(void); IplParameterBlock *s390_ipl_get_iplb(void);
IplParameterBlock *s390_ipl_get_iplb_pv(void); IplParameterBlock *s390_ipl_get_iplb_pv(void);

View file

@ -365,7 +365,8 @@ static void s390_machine_unprotect(S390CcwMachineState *ms)
ram_block_discard_disable(false); ram_block_discard_disable(false);
} }
static int s390_machine_protect(S390CcwMachineState *ms) static int s390_machine_protect(S390CcwMachineState *ms,
struct S390PVResponse *pv_resp)
{ {
Error *local_err = NULL; Error *local_err = NULL;
int rc; int rc;
@ -408,19 +409,19 @@ static int s390_machine_protect(S390CcwMachineState *ms)
} }
/* Set SE header and unpack */ /* Set SE header and unpack */
rc = s390_ipl_prepare_pv_header(&local_err); rc = s390_ipl_prepare_pv_header(pv_resp, &local_err);
if (rc) { if (rc) {
goto out_err; goto out_err;
} }
/* Decrypt image */ /* Decrypt image */
rc = s390_ipl_pv_unpack(); rc = s390_ipl_pv_unpack(pv_resp);
if (rc) { if (rc) {
goto out_err; goto out_err;
} }
/* Verify integrity */ /* Verify integrity */
rc = s390_pv_verify(); rc = s390_pv_verify(pv_resp);
if (rc) { if (rc) {
goto out_err; goto out_err;
} }
@ -452,6 +453,7 @@ static void s390_pv_prepare_reset(S390CcwMachineState *ms)
static void s390_machine_reset(MachineState *machine, ResetType type) static void s390_machine_reset(MachineState *machine, ResetType type)
{ {
S390CcwMachineState *ms = S390_CCW_MACHINE(machine); S390CcwMachineState *ms = S390_CCW_MACHINE(machine);
struct S390PVResponse pv_resp;
enum s390_reset reset_type; enum s390_reset reset_type;
CPUState *cs, *t; CPUState *cs, *t;
S390CPU *cpu; S390CPU *cpu;
@ -540,8 +542,8 @@ static void s390_machine_reset(MachineState *machine, ResetType type)
} }
run_on_cpu(cs, s390_do_cpu_reset, RUN_ON_CPU_NULL); run_on_cpu(cs, s390_do_cpu_reset, RUN_ON_CPU_NULL);
if (s390_machine_protect(ms)) { if (s390_machine_protect(ms, &pv_resp)) {
s390_pv_inject_reset_error(cs); s390_pv_inject_reset_error(cs, pv_resp);
/* /*
* Continue after the diag308 so the guest knows something * Continue after the diag308 so the guest knows something
* went wrong. * went wrong.

View file

@ -2618,7 +2618,17 @@ config_host_data.set('CONFIG_FSTRIM', qga_fstrim)
# has_header # has_header
config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h')) config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h'))
config_host_data.set('CONFIG_LINUX_MAGIC_H', cc.has_header('linux/magic.h')) config_host_data.set('CONFIG_LINUX_MAGIC_H', cc.has_header('linux/magic.h'))
config_host_data.set('CONFIG_VALGRIND_H', cc.has_header('valgrind/valgrind.h')) valgrind = false
if get_option('valgrind').allowed()
if cc.has_header('valgrind/valgrind.h')
valgrind = true
else
if get_option('valgrind').enabled()
error('valgrind requested but valgrind.h not found')
endif
endif
endif
config_host_data.set('CONFIG_VALGRIND_H', valgrind)
config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h')) config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h'))
config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h'))
config_host_data.set('HAVE_OPENAT2_H', cc.has_header('linux/openat2.h')) config_host_data.set('HAVE_OPENAT2_H', cc.has_header('linux/openat2.h'))
@ -4609,7 +4619,6 @@ summary_info += {'Trace backends': ','.join(get_option('trace_backends'))}
if 'simple' in get_option('trace_backends') if 'simple' in get_option('trace_backends')
summary_info += {'Trace output file': get_option('trace_file') + '-<pid>'} summary_info += {'Trace output file': get_option('trace_file') + '-<pid>'}
endif endif
summary_info += {'D-Bus display': dbus_display}
summary_info += {'QOM debugging': get_option('qom_cast_debug')} summary_info += {'QOM debugging': get_option('qom_cast_debug')}
summary_info += {'Relocatable install': get_option('relocatable')} summary_info += {'Relocatable install': get_option('relocatable')}
summary_info += {'vhost-kernel support': have_vhost_kernel} summary_info += {'vhost-kernel support': have_vhost_kernel}
@ -4792,6 +4801,7 @@ summary_info = {}
if host_os == 'darwin' if host_os == 'darwin'
summary_info += {'Cocoa support': cocoa} summary_info += {'Cocoa support': cocoa}
endif endif
summary_info += {'D-Bus display': dbus_display}
summary_info += {'SDL support': sdl} summary_info += {'SDL support': sdl}
summary_info += {'SDL image support': sdl_image} summary_info += {'SDL image support': sdl_image}
summary_info += {'GTK support': gtk} summary_info += {'GTK support': gtk}
@ -4905,6 +4915,7 @@ endif
if host_os == 'darwin' if host_os == 'darwin'
summary_info += {'ParavirtualizedGraphics support': pvg} summary_info += {'ParavirtualizedGraphics support': pvg}
endif endif
summary_info += {'valgrind': valgrind}
summary(summary_info, bool_yn: true, section: 'Dependencies') summary(summary_info, bool_yn: true, section: 'Dependencies')
if host_arch == 'unknown' if host_arch == 'unknown'

View file

@ -115,6 +115,8 @@ option('dbus_display', type: 'feature', value: 'auto',
description: '-display dbus support') description: '-display dbus support')
option('tpm', type : 'feature', value : 'auto', option('tpm', type : 'feature', value : 'auto',
description: 'TPM support') description: 'TPM support')
option('valgrind', type : 'feature', value: 'auto',
description: 'valgrind debug support for coroutine stacks')
# Do not enable it by default even for Mingw32, because it doesn't # Do not enable it by default even for Mingw32, because it doesn't
# work on Wine. # work on Wine.

View file

@ -9,13 +9,13 @@ help:
@echo "make check-minreqs:" @echo "make check-minreqs:"
@echo " Run tests in the minreqs virtual environment." @echo " Run tests in the minreqs virtual environment."
@echo " These tests use the oldest dependencies." @echo " These tests use the oldest dependencies."
@echo " Requires: Python 3.8" @echo " Requires: Python 3.9"
@echo " Hint (Fedora): 'sudo dnf install python3.8'" @echo " Hint (Fedora): 'sudo dnf install python3.9'"
@echo "" @echo ""
@echo "make check-tox:" @echo "make check-tox:"
@echo " Run tests against multiple python versions." @echo " Run tests against multiple python versions."
@echo " These tests use the newest dependencies." @echo " These tests use the newest dependencies."
@echo " Requires: Python 3.8 - 3.11, and tox." @echo " Requires: Python 3.9 - 3.11, and tox."
@echo " Hint (Fedora): 'sudo dnf install python3-tox python3.11'" @echo " Hint (Fedora): 'sudo dnf install python3-tox python3.11'"
@echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra" @echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra"
@echo " arguments to tox". @echo " arguments to tox".
@ -59,7 +59,7 @@ PIP_INSTALL = pip install --disable-pip-version-check
min-venv: $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate min-venv: $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate
$(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate: setup.cfg tests/minreqs.txt $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate: setup.cfg tests/minreqs.txt
@echo "VENV $(QEMU_MINVENV_DIR)" @echo "VENV $(QEMU_MINVENV_DIR)"
@python3.8 -m venv $(QEMU_MINVENV_DIR) @python3.9 -m venv $(QEMU_MINVENV_DIR)
@( \ @( \
echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \ echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \
. $(QEMU_MINVENV_DIR)/bin/activate; \ . $(QEMU_MINVENV_DIR)/bin/activate; \

View file

@ -14,7 +14,6 @@ classifiers =
Natural Language :: English Natural Language :: English
Operating System :: OS Independent Operating System :: OS Independent
Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.11
@ -23,7 +22,7 @@ classifiers =
Typing :: Typed Typing :: Typed
[options] [options]
python_requires = >= 3.8 python_requires = >= 3.9
packages = packages =
qemu.qmp qemu.qmp
qemu.machine qemu.machine
@ -78,7 +77,7 @@ exclude = __pycache__,
[mypy] [mypy]
strict = True strict = True
python_version = 3.8 python_version = 3.9
warn_unused_configs = True warn_unused_configs = True
namespace_packages = True namespace_packages = True
warn_unused_ignores = False warn_unused_ignores = False
@ -186,7 +185,7 @@ multi_line_output=3
# of python available on your system to run this test. # of python available on your system to run this test.
[tox:tox] [tox:tox]
envlist = py38, py39, py310, py311, py312, py313 envlist = py39, py310, py311, py312, py313
skip_missing_interpreters = true skip_missing_interpreters = true
[testenv] [testenv]

View file

@ -1,5 +1,5 @@
# This file lists the ***oldest possible dependencies*** needed to run # This file lists the ***oldest possible dependencies*** needed to run
# "make check" successfully under ***Python 3.8***. It is used primarily # "make check" successfully under ***Python 3.9***. It is used primarily
# by GitLab CI to ensure that our stated minimum versions in setup.cfg # by GitLab CI to ensure that our stated minimum versions in setup.cfg
# are truthful and regularly validated. # are truthful and regularly validated.
# #

View file

@ -198,6 +198,7 @@ meson_options_help() {
printf "%s\n" ' u2f U2F emulation support' printf "%s\n" ' u2f U2F emulation support'
printf "%s\n" ' uadk UADK Library support' printf "%s\n" ' uadk UADK Library support'
printf "%s\n" ' usb-redir libusbredir support' printf "%s\n" ' usb-redir libusbredir support'
printf "%s\n" ' valgrind valgrind debug support for coroutine stacks'
printf "%s\n" ' vde vde network backend support' printf "%s\n" ' vde vde network backend support'
printf "%s\n" ' vdi vdi image format support' printf "%s\n" ' vdi vdi image format support'
printf "%s\n" ' vduse-blk-export' printf "%s\n" ' vduse-blk-export'
@ -526,6 +527,8 @@ _meson_option_parse() {
--disable-ubsan) printf "%s" -Dubsan=false ;; --disable-ubsan) printf "%s" -Dubsan=false ;;
--enable-usb-redir) printf "%s" -Dusb_redir=enabled ;; --enable-usb-redir) printf "%s" -Dusb_redir=enabled ;;
--disable-usb-redir) printf "%s" -Dusb_redir=disabled ;; --disable-usb-redir) printf "%s" -Dusb_redir=disabled ;;
--enable-valgrind) printf "%s" -Dvalgrind=enabled ;;
--disable-valgrind) printf "%s" -Dvalgrind=disabled ;;
--enable-vde) printf "%s" -Dvde=enabled ;; --enable-vde) printf "%s" -Dvde=enabled ;;
--disable-vde) printf "%s" -Dvde=disabled ;; --disable-vde) printf "%s" -Dvde=disabled ;;
--enable-vdi) printf "%s" -Dvdi=enabled ;; --enable-vdi) printf "%s" -Dvdi=enabled ;;

View file

@ -1,4 +1,4 @@
[mypy] [mypy]
strict = True strict = True
disallow_untyped_calls = False disallow_untyped_calls = False
python_version = 3.8 python_version = 3.9

View file

@ -30,7 +30,7 @@ static struct kvm_s390_pv_info_vm info_vm;
static struct kvm_s390_pv_info_dump info_dump; static struct kvm_s390_pv_info_dump info_dump;
static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data, static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data,
int *pvrc) struct S390PVResponse *pv_resp)
{ {
struct kvm_pv_cmd pv_cmd = { struct kvm_pv_cmd pv_cmd = {
.cmd = cmd, .cmd = cmd,
@ -47,8 +47,10 @@ static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data,
"IOCTL rc: %d", cmd, cmdname, pv_cmd.rc, pv_cmd.rrc, "IOCTL rc: %d", cmd, cmdname, pv_cmd.rc, pv_cmd.rrc,
rc); rc);
} }
if (pvrc) { if (pv_resp) {
*pvrc = pv_cmd.rc; pv_resp->cmd = cmd;
pv_resp->rc = pv_cmd.rc;
pv_resp->rrc = pv_cmd.rrc;
} }
return rc; return rc;
} }
@ -57,16 +59,15 @@ static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data,
* This macro lets us pass the command as a string to the function so * This macro lets us pass the command as a string to the function so
* we can print it on an error. * we can print it on an error.
*/ */
#define s390_pv_cmd(cmd, data) __s390_pv_cmd(cmd, #cmd, data, NULL) #define s390_pv_cmd(cmd, data) __s390_pv_cmd(cmd, #cmd, data, NULL)
#define s390_pv_cmd_pvrc(cmd, data, pvrc) __s390_pv_cmd(cmd, #cmd, data, pvrc) #define s390_pv_cmd_pv_resp(cmd, data, pv_resp) \
#define s390_pv_cmd_exit(cmd, data) \ __s390_pv_cmd(cmd, #cmd, data, pv_resp)
{ \
int rc; \ static void s390_pv_cmd_exit(uint32_t cmd, void *data)
\ {
rc = __s390_pv_cmd(cmd, #cmd, data, NULL); \ if (s390_pv_cmd(cmd, data)) {
if (rc) { \ exit(1);
exit(1); \ }
} \
} }
int s390_pv_query_info(void) int s390_pv_query_info(void)
@ -147,18 +148,20 @@ bool s390_pv_vm_try_disable_async(S390CcwMachineState *ms)
return true; return true;
} }
int s390_pv_set_sec_parms(uint64_t origin, uint64_t length, Error **errp) #define UV_RC_SSC_INVAL_HOSTKEY 0x0108
int s390_pv_set_sec_parms(uint64_t origin, uint64_t length,
struct S390PVResponse *pv_resp, Error **errp)
{ {
int ret, pvrc; int ret;
struct kvm_s390_pv_sec_parm args = { struct kvm_s390_pv_sec_parm args = {
.origin = origin, .origin = origin,
.length = length, .length = length,
}; };
ret = s390_pv_cmd_pvrc(KVM_PV_SET_SEC_PARMS, &args, &pvrc); ret = s390_pv_cmd_pv_resp(KVM_PV_SET_SEC_PARMS, &args, pv_resp);
if (ret) { if (ret) {
error_setg(errp, "Failed to set secure execution parameters"); error_setg(errp, "Failed to set secure execution parameters");
if (pvrc == 0x108) { if (pv_resp->rc == UV_RC_SSC_INVAL_HOSTKEY) {
error_append_hint(errp, "Please check whether the image is " error_append_hint(errp, "Please check whether the image is "
"correctly encrypted for this host\n"); "correctly encrypted for this host\n");
} }
@ -170,7 +173,8 @@ int s390_pv_set_sec_parms(uint64_t origin, uint64_t length, Error **errp)
/* /*
* Called for each component in the SE type IPL parameter block 0. * Called for each component in the SE type IPL parameter block 0.
*/ */
int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak) int s390_pv_unpack(uint64_t addr, uint64_t size,
uint64_t tweak, struct S390PVResponse *pv_resp)
{ {
struct kvm_s390_pv_unp args = { struct kvm_s390_pv_unp args = {
.addr = addr, .addr = addr,
@ -178,7 +182,7 @@ int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak)
.tweak = tweak, .tweak = tweak,
}; };
return s390_pv_cmd(KVM_PV_UNPACK, &args); return s390_pv_cmd_pv_resp(KVM_PV_UNPACK, &args, pv_resp);
} }
void s390_pv_prep_reset(void) void s390_pv_prep_reset(void)
@ -186,9 +190,9 @@ void s390_pv_prep_reset(void)
s390_pv_cmd_exit(KVM_PV_PREP_RESET, NULL); s390_pv_cmd_exit(KVM_PV_PREP_RESET, NULL);
} }
int s390_pv_verify(void) int s390_pv_verify(struct S390PVResponse *pv_resp)
{ {
return s390_pv_cmd(KVM_PV_VERIFY, NULL); return s390_pv_cmd_pv_resp(KVM_PV_VERIFY, NULL, pv_resp);
} }
void s390_pv_unshare(void) void s390_pv_unshare(void)
@ -196,13 +200,29 @@ void s390_pv_unshare(void)
s390_pv_cmd_exit(KVM_PV_UNSHARE_ALL, NULL); s390_pv_cmd_exit(KVM_PV_UNSHARE_ALL, NULL);
} }
void s390_pv_inject_reset_error(CPUState *cs) void s390_pv_inject_reset_error(CPUState *cs,
struct S390PVResponse pv_resp)
{ {
int r1 = (cs->kvm_run->s390_sieic.ipa & 0x00f0) >> 4; int r1 = (cs->kvm_run->s390_sieic.ipa & 0x00f0) >> 4;
CPUS390XState *env = &S390_CPU(cs)->env; CPUS390XState *env = &S390_CPU(cs)->env;
union {
struct {
uint16_t pv_cmd;
uint16_t pv_rrc;
uint16_t pv_rc;
uint16_t diag_rc;
};
uint64_t regs;
} resp = {
.pv_cmd = pv_resp.cmd,
.pv_rrc = pv_resp.rrc,
.pv_rc = pv_resp.rc,
.diag_rc = DIAG_308_RC_INVAL_FOR_PV
};
/* Report that we are unable to enter protected mode */ /* Report that we are unable to enter protected mode */
env->regs[r1 + 1] = DIAG_308_RC_INVAL_FOR_PV; env->regs[r1 + 1] = resp.regs;
} }
uint64_t kvm_s390_pv_dmp_get_size_cpu(void) uint64_t kvm_s390_pv_dmp_get_size_cpu(void)

View file

@ -16,6 +16,12 @@
#include "system/kvm.h" #include "system/kvm.h"
#include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/s390-virtio-ccw.h"
struct S390PVResponse {
uint16_t cmd;
uint16_t rrc;
uint16_t rc;
};
#ifdef CONFIG_KVM #ifdef CONFIG_KVM
#include "cpu.h" #include "cpu.h"
@ -42,12 +48,15 @@ int s390_pv_query_info(void);
int s390_pv_vm_enable(void); int s390_pv_vm_enable(void);
void s390_pv_vm_disable(void); void s390_pv_vm_disable(void);
bool s390_pv_vm_try_disable_async(S390CcwMachineState *ms); bool s390_pv_vm_try_disable_async(S390CcwMachineState *ms);
int s390_pv_set_sec_parms(uint64_t origin, uint64_t length, Error **errp); int s390_pv_set_sec_parms(uint64_t origin, uint64_t length,
int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak); struct S390PVResponse *pv_resp, Error **errp);
int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak,
struct S390PVResponse *pv_resp);
void s390_pv_prep_reset(void); void s390_pv_prep_reset(void);
int s390_pv_verify(void); int s390_pv_verify(struct S390PVResponse *pv_resp);
void s390_pv_unshare(void); void s390_pv_unshare(void);
void s390_pv_inject_reset_error(CPUState *cs); void s390_pv_inject_reset_error(CPUState *cs,
struct S390PVResponse pv_resp);
uint64_t kvm_s390_pv_dmp_get_size_cpu(void); uint64_t kvm_s390_pv_dmp_get_size_cpu(void);
uint64_t kvm_s390_pv_dmp_get_size_mem_state(void); uint64_t kvm_s390_pv_dmp_get_size_mem_state(void);
uint64_t kvm_s390_pv_dmp_get_size_completion_data(void); uint64_t kvm_s390_pv_dmp_get_size_completion_data(void);
@ -63,12 +72,15 @@ static inline int s390_pv_vm_enable(void) { return 0; }
static inline void s390_pv_vm_disable(void) {} static inline void s390_pv_vm_disable(void) {}
static inline bool s390_pv_vm_try_disable_async(S390CcwMachineState *ms) { return false; } static inline bool s390_pv_vm_try_disable_async(S390CcwMachineState *ms) { return false; }
static inline int s390_pv_set_sec_parms(uint64_t origin, uint64_t length, static inline int s390_pv_set_sec_parms(uint64_t origin, uint64_t length,
struct S390PVResponse *pv_resp,
Error **errp) { return 0; } Error **errp) { return 0; }
static inline int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak) { return 0; } static inline int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak,
struct S390PVResponse *pv_resp) { return 0; }
static inline void s390_pv_prep_reset(void) {} static inline void s390_pv_prep_reset(void) {}
static inline int s390_pv_verify(void) { return 0; } static inline int s390_pv_verify(struct S390PVResponse *pv_resp) { return 0; }
static inline void s390_pv_unshare(void) {} static inline void s390_pv_unshare(void) {}
static inline void s390_pv_inject_reset_error(CPUState *cs) {}; static inline void s390_pv_inject_reset_error(CPUState *cs,
struct S390PVResponse pv_resp) {};
static inline uint64_t kvm_s390_pv_dmp_get_size_cpu(void) { return 0; } static inline uint64_t kvm_s390_pv_dmp_get_size_cpu(void) { return 0; }
static inline uint64_t kvm_s390_pv_dmp_get_size_mem_state(void) { return 0; } static inline uint64_t kvm_s390_pv_dmp_get_size_mem_state(void) { return 0; }
static inline uint64_t kvm_s390_pv_dmp_get_size_completion_data(void) { return 0; } static inline uint64_t kvm_s390_pv_dmp_get_size_completion_data(void) { return 0; }

View file

@ -15,7 +15,6 @@ ENV PACKAGES \
python3.11 \ python3.11 \
python3.12 \ python3.12 \
python3.13 \ python3.13 \
python3.8 \
python3.9 python3.9
RUN dnf install -y $PACKAGES RUN dnf install -y $PACKAGES

View file

@ -63,6 +63,7 @@ class pseriesMachine(QemuSystemTest):
wait_for_console_pattern(self, self.good_message, self.panic_message) wait_for_console_pattern(self, self.good_message, self.panic_message)
def test_ppc64_linux_smt_boot(self): def test_ppc64_linux_smt_boot(self):
self.set_machine('pseries')
self.vm.add_args('-smp', '4,threads=4') self.vm.add_args('-smp', '4,threads=4')
self.do_test_ppc64_linux_boot() self.do_test_ppc64_linux_boot()
console_pattern = 'CPU maps initialized for 4 threads per core' console_pattern = 'CPU maps initialized for 4 threads per core'