From fbe47688de7033c4a34aa43a7627946214bdfe38 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 18 Dec 2024 17:32:18 +0300 Subject: [PATCH 001/107] chore(ci): build libvirt Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 images/libvirt-artifact/werf.inc.yaml diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml new file mode 100644 index 000000000..daf6b823c --- /dev/null +++ b/images/libvirt-artifact/werf.inc.yaml @@ -0,0 +1,21 @@ +--- +{{- $version := "10.10.0" }} + +image: {{ $.ImageName }} +final: false +from: {{ .Images.BASE_DEBIAN_BOOKWORM_SLIM }} +shell: + install: + - apt-get -qq update + - | + apt install --yes build-essential git automake autoconf libtool \ + pkg-config libglib2.0-dev libgnutls28-dev libxml2-dev libyajl-dev \ + libxslt1-dev libpolkit-gobject-1-dev libsystemd-dev \ + libpciaccess-dev python3-dev + - git clone --depth 1 --branch v{{ $version }} https://gitlab.com/libvirt/libvirt.git + - cd libvirt + - ./autogen.sh + - ./configure --with-qemu + - make + - make install + - which virtqemud From 93533756bb2d78dcfabad94e1c68dca35903f55a Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 18 Dec 2024 19:14:24 +0300 Subject: [PATCH 002/107] chore(ci): fix build Signed-off-by: Nikita Korolev chore: build via meson Signed-off-by: Nikita Korolev chore: prepere build env Signed-off-by: Nikita Korolev chore: use make build Signed-off-by: Nikita Korolev chore: experimet of libvirt build Signed-off-by: Nikita Korolev chore: change werf.inc for build linvirt rpm Signed-off-by: Nikita Korolev chore: try build all libvirt rpms Signed-off-by: Nikita Korolev chore: use dockerfile insted werf Signed-off-by: Nikita Korolev chore: add ccache conf Signed-off-by: Nikita Korolev chore: docker build qemu Signed-off-by: Nikita Korolev chore: build libvirt werf Signed-off-by: Nikita Korolev chore: add qemu werf build Signed-off-by: Nikita Korolev chore: try to qemu build as root Signed-off-by: Nikita Korolev add draft virt-launcher build Signed-off-by: Nikita Korolev build virt-launcher try1 Signed-off-by: Nikita Korolev edk2 up to edk2-ovmf-20240811 Signed-off-by: Nikita Korolev --- .github/workflows/dev_module_build.yml | 3 + images/libvirt-artifact/install-libvirt.sh | 627 +++++++++++++++++++++ images/libvirt-artifact/werf.inc.yaml | 152 ++++- images/qemu-artifact/werf.inc.yaml | 142 +++++ images/virt-launcher/werf.inc.yaml | 107 +++- 5 files changed, 993 insertions(+), 38 deletions(-) create mode 100755 images/libvirt-artifact/install-libvirt.sh create mode 100644 images/qemu-artifact/werf.inc.yaml diff --git a/.github/workflows/dev_module_build.yml b/.github/workflows/dev_module_build.yml index 552fccd6f..7792dd424 100644 --- a/.github/workflows/dev_module_build.yml +++ b/.github/workflows/dev_module_build.yml @@ -32,6 +32,9 @@ on: type: number pull_request: types: [opened, reopened, synchronize, labeled, unlabeled] + branches: + - main + - chore/ci/build-libvirt push: branches: - main diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh new file mode 100755 index 000000000..835a519f5 --- /dev/null +++ b/images/libvirt-artifact/install-libvirt.sh @@ -0,0 +1,627 @@ +#!/usr/bin/env bash + +# Copyright 2024 Flant JSC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# List of files and destinations +FILE_LIST=$(cat <<'EOF' +src/libvirt_probes.stp to /usr/share/systemtap/tapset +src/access/org.libvirt.api.policy to /usr/share/polkit-1/actions +src/qemu/libvirt_qemu_probes.stp to /usr/share/systemtap/tapset +src/libvirt.so.0.10010.0 to /usr/local/lib64 +src/libvirt-qemu.so.0.10010.0 to /usr/local/lib64 +src/libvirt-lxc.so.0.10010.0 to /usr/local/lib64 +src/libvirt-admin.so.0.10010.0 to /usr/local/lib64 +src/libvirt_driver_interface.so to /usr/lib64/libvirt/connection-driver +src/lockd.so to /usr/lib64/libvirt/lock-driver +src/sanlock.so to /usr/lib64/libvirt/lock-driver +src/libvirt_driver_network.so to /usr/lib64/libvirt/connection-driver +src/libvirt_driver_nodedev.so to /usr/lib64/libvirt/connection-driver +src/libvirt_driver_nwfilter.so to /usr/lib64/libvirt/connection-driver +src/libvirt_driver_secret.so to /usr/lib64/libvirt/connection-driver +src/libvirt_driver_storage.so to /usr/lib64/libvirt/connection-driver +src/libvirt_storage_backend_fs.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_disk.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_gluster.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_iscsi.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_iscsi-direct.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_logical.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_mpath.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_rbd.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_scsi.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_vstorage.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_backend_zfs.so to /usr/lib64/libvirt/storage-backend +src/libvirt_storage_file_fs.so to /usr/lib64/libvirt/storage-file +src/libvirt_storage_file_gluster.so to /usr/lib64/libvirt/storage-file +src/libvirt_driver_lxc.so to /usr/lib64/libvirt/connection-driver +src/libvirt_driver_ch.so to /usr/lib64/libvirt/connection-driver +src/libvirt_driver_qemu.so to /usr/lib64/libvirt/connection-driver +src/libvirt_driver_vbox.so to /usr/lib64/libvirt/connection-driver +src/libvirtd to /usr/sbin +src/virtproxyd to /usr/sbin +src/virtinterfaced to /usr/sbin +src/virtlockd to /usr/sbin +src/virtlogd to /usr/sbin +src/virtnetworkd to /usr/sbin +src/virtnodedevd to /usr/sbin +src/virtnwfilterd to /usr/sbin +src/virtsecretd to /usr/sbin +src/virtstoraged to /usr/sbin +src/virtlxcd to /usr/sbin +src/virtchd to /usr/sbin +src/virtqemud to /usr/sbin +src/virtvboxd to /usr/sbin +src/libvirt_iohelper to /usr/libexec +src/virt-ssh-helper to /usr/bin +src/libvirt_sanlock_helper to /usr/libexec +src/libvirt_leaseshelper to /usr/libexec +src/libvirt_parthelper to /usr/libexec +src/libvirt_lxc to /usr/libexec +src/virt-qemu-run to /usr/bin +src/test_libvirt_lockd.aug to /usr/share/augeas/lenses/tests +src/test_libvirt_sanlock.aug to /usr/share/augeas/lenses/tests +src/test_virtlockd.aug to /usr/share/augeas/lenses/tests +src/test_virtlogd.aug to /usr/share/augeas/lenses/tests +src/test_libvirtd_network.aug to /usr/share/augeas/lenses/tests +src/test_libvirtd_lxc.aug to /usr/share/augeas/lenses/tests +src/test_libvirtd_qemu.aug to /usr/share/augeas/lenses/tests +src/test_libvirtd.aug to /usr/share/augeas/lenses/tests +src/test_virtproxyd.aug to /usr/share/augeas/lenses/tests +src/test_virtinterfaced.aug to /usr/share/augeas/lenses/tests +src/test_virtnetworkd.aug to /usr/share/augeas/lenses/tests +src/test_virtnodedevd.aug to /usr/share/augeas/lenses/tests +src/test_virtnwfilterd.aug to /usr/share/augeas/lenses/tests +src/test_virtsecretd.aug to /usr/share/augeas/lenses/tests +src/test_virtstoraged.aug to /usr/share/augeas/lenses/tests +src/test_virtlxcd.aug to /usr/share/augeas/lenses/tests +src/test_virtchd.aug to /usr/share/augeas/lenses/tests +src/test_virtqemud.aug to /usr/share/augeas/lenses/tests +src/test_virtvboxd.aug to /usr/share/augeas/lenses/tests +src/libvirt_functions.stp to /usr/share/systemtap/tapset +tools/virt-host-validate to /usr/bin +tools/virt-login-shell to /usr/bin +tools/virt-login-shell-helper to /usr/libexec +tools/virsh to /usr/bin +tools/virt-admin to /usr/bin +tools/virt-pki-validate to /usr/bin +tools/virt-pki-query-dn to /usr/bin +tools/nss/libnss_libvirt.so.2 to /usr/lib64 +tools/nss/libnss_libvirt_guest.so.2 to /usr/lib64 +tools/wireshark/src/libvirt.so to /usr/lib64/wireshark/plugins/4.4/epan +tools/ssh-proxy/libvirt-ssh-proxy to /usr/libexec +po/as/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/as/LC_MESSAGES +po/bg/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/bg/LC_MESSAGES +po/bn_IN/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/bn_IN/LC_MESSAGES +po/bs/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/bs/LC_MESSAGES +po/ca/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ca/LC_MESSAGES +po/cs/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/cs/LC_MESSAGES +po/da/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/da/LC_MESSAGES +po/de/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/de/LC_MESSAGES +po/el/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/el/LC_MESSAGES +po/en_GB/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/en_GB/LC_MESSAGES +po/es/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/es/LC_MESSAGES +po/fi/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/fi/LC_MESSAGES +po/fr/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/fr/LC_MESSAGES +po/gu/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/gu/LC_MESSAGES +po/hi/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/hi/LC_MESSAGES +po/hu/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/hu/LC_MESSAGES +po/id/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/id/LC_MESSAGES +po/it/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/it/LC_MESSAGES +po/ja/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ja/LC_MESSAGES +po/ka/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ka/LC_MESSAGES +po/kn/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/kn/LC_MESSAGES +po/ko/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ko/LC_MESSAGES +po/mk/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/mk/LC_MESSAGES +po/ml/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ml/LC_MESSAGES +po/mr/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/mr/LC_MESSAGES +po/ms/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ms/LC_MESSAGES +po/nb/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/nb/LC_MESSAGES +po/nl/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/nl/LC_MESSAGES +po/or/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/or/LC_MESSAGES +po/pa/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/pa/LC_MESSAGES +po/pl/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/pl/LC_MESSAGES +po/pt/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/pt/LC_MESSAGES +po/pt_BR/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/pt_BR/LC_MESSAGES +po/ru/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ru/LC_MESSAGES +po/si/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/si/LC_MESSAGES +po/sr/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/sr/LC_MESSAGES +po/sr@latin/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/sr@latin/LC_MESSAGES +po/sv/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/sv/LC_MESSAGES +po/ta/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ta/LC_MESSAGES +po/te/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/te/LC_MESSAGES +po/tr/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/tr/LC_MESSAGES +po/uk/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/uk/LC_MESSAGES +po/vi/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/vi/LC_MESSAGES +po/zh_CN/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/zh_CN/LC_MESSAGES +po/zh_TW/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/zh_TW/LC_MESSAGES +po/hr/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/hr/LC_MESSAGES +po/ro/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ro/LC_MESSAGES +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-admin.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-domain-checkpoint.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-domain.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-domain-snapshot.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-event.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-host.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-interface.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-lxc.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-network.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-nodedev.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-nwfilter.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-qemu.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-secret.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-storage.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/libvirt-stream.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/include/libvirt/virterror.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/build/include/libvirt/libvirt-common.h to /usr/include/libvirt +/home/builder/libvirt-10.10.0/src/cpu_map/arm_a64fx.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_cortex-a53.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_cortex-a57.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_cortex-a72.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_Falkor.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_FT-2000plus.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_features.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_Kunpeng-920.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_Neoverse-N1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_Neoverse-N2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_Neoverse-V1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_Tengyun-S2500.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_ThunderX299xx.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/arm_vendors.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/index.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_POWER6.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_POWER7.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_POWER8.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_POWER9.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_POWER10.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_POWERPC_e5500.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_POWERPC_e6500.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/ppc64_vendors.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_486.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_athlon.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell-noTSX-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell-noTSX.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Broadwell.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cascadelake-Server-noTSX.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cascadelake-Server-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cascadelake-Server-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cascadelake-Server-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cascadelake-Server-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cascadelake-Server-v5.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cascadelake-Server.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Conroe.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cooperlake-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cooperlake-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Cooperlake.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_core2duo.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_coreduo.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_cpu64-rhel5.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_cpu64-rhel6.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Denverton-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Denverton-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Denverton-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Denverton.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Dhyana-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Dhyana-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Dhyana.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-IBPB.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Genoa.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Milan-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Milan-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Milan.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Rome-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Rome-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Rome-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Rome-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_EPYC-Rome.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_features.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_GraniteRapids-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_GraniteRapids.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell-noTSX-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell-noTSX.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Haswell.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Client-noTSX.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Client.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-noTSX.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-v5.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-v6.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server-v7.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Icelake-Server.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_IvyBridge-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_IvyBridge-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_IvyBridge-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_IvyBridge.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_KnightsMill.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_kvm32.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_kvm64.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_n270.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Nehalem-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Nehalem-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Nehalem-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Nehalem.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Opteron_G1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Opteron_G2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Opteron_G3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Opteron_G4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Opteron_G5.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Penryn.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_pentium.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_pentium2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_pentium3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_pentiumpro.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_phenom.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_qemu32.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_qemu64.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SandyBridge-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SandyBridge-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SandyBridge-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SandyBridge.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SapphireRapids-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SapphireRapids-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SapphireRapids-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SapphireRapids.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SierraForest-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_SierraForest.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Client-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Client-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Client-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Client-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Client-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Client.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server-v5.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Skylake-Server.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Snowridge-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Snowridge-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Snowridge-v3.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Snowridge-v4.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Snowridge.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_vendors.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Westmere-IBRS.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Westmere-v1.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Westmere-v2.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/cpu_map/x86_Westmere.xml to /usr/share/libvirt/cpu_map +/home/builder/libvirt-10.10.0/src/conf/schemas/basictypes.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/capability.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/cpu.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/cputypes.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/domainbackup.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/domaincaps.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/domaincheckpoint.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/domaincommon.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/domain.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/domainoverrides.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/domainsnapshot.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/inactiveDomain.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/interface.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/networkcommon.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/networkport.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/network.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/nodedev.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/nwfilterbinding.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/nwfilter_params.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/nwfilter.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/privatedata.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/secret.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/storagecommon.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/storagepoolcaps.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/storagepool.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/src/conf/schemas/storagevol.rng to /usr/share/libvirt/schemas +/home/builder/libvirt-10.10.0/build/src/remote/libvirtd.qemu.logrotate to /etc/logrotate.d +/home/builder/libvirt-10.10.0/build/src/remote/libvirtd.lxc.logrotate to /etc/logrotate.d +/home/builder/libvirt-10.10.0/build/src/remote/libvirtd.libxl.logrotate to /etc/logrotate.d +/home/builder/libvirt-10.10.0/build/src/remote/libvirtd.logrotate to /etc/logrotate.d +/home/builder/libvirt-10.10.0/src/remote/libvirtd.sysctl to /usr/lib/sysctl.d +/home/builder/libvirt-10.10.0/src/remote/libvirtd.policy to /usr/share/polkit-1/actions +/home/builder/libvirt-10.10.0/src/remote/libvirtd.rules to /usr/share/polkit-1/rules.d +/home/builder/libvirt-10.10.0/src/remote/libvirtd.sasl to /etc/sasl2 +/home/builder/libvirt-10.10.0/build/src/network/default.xml to /etc/libvirt/qemu/networks +/home/builder/libvirt-10.10.0/src/network/libvirt.zone to /usr/lib/firewalld/zones +/home/builder/libvirt-10.10.0/src/network/libvirt-routed.zone to /usr/lib/firewalld/zones +/home/builder/libvirt-10.10.0/src/network/libvirt-to-host.policy to /usr/lib/firewalld/policies +/home/builder/libvirt-10.10.0/src/network/libvirt-routed-out.policy to /usr/lib/firewalld/policies +/home/builder/libvirt-10.10.0/src/network/libvirt-routed-in.policy to /usr/lib/firewalld/policies +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-arp.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-dhcp-server.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-dhcp.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-dhcpv6-server.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-dhcpv6.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-incoming-ipv4.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-incoming-ipv6.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-ipv4.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/allow-ipv6.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/clean-traffic-gateway.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/clean-traffic.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-arp-ip-spoofing.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-arp-mac-spoofing.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-arp-spoofing.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-ip-multicast.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-ip-spoofing.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-ipv6-multicast.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-ipv6-spoofing.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-mac-broadcast.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-mac-spoofing.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-other-l2-traffic.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/no-other-rarp-traffic.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/qemu-announce-self-rarp.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/nwfilter/xml/qemu-announce-self.xml to /etc/libvirt/nwfilter +/home/builder/libvirt-10.10.0/src/qemu/libvirt-qemu.sysusers.conf to /usr/lib/sysusers.d +/home/builder/libvirt-10.10.0/src/qemu/postcopy-migration.sysctl to /usr/lib/sysctl.d +/home/builder/libvirt-10.10.0/src/test/test-screenshot.png to /usr/share/libvirt +/home/builder/libvirt-10.10.0/src/admin/libvirt-admin.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/locking/qemu-lockd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/locking/qemu-sanlock.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/src/locking/virtlockd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/src/logging/virtlogd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/network/network.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/src/lxc/lxc.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/qemu/qemu.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/src/libvirt.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/src/locking/libvirt_lockd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/src/locking/libvirt_sanlock.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/src/locking/virtlockd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/src/logging/virtlogd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/src/network/libvirtd_network.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/src/lxc/libvirtd_lxc.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/src/qemu/libvirtd_qemu.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/libvirtd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/libvirtd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtproxyd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtproxyd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtinterfaced.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtinterfaced.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtnetworkd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtnetworkd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtnodedevd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtnodedevd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtnwfilterd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtnwfilterd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtsecretd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtsecretd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtstoraged.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtstoraged.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtlxcd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtlxcd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtchd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtchd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtqemud.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtqemud.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/build/src/virtvboxd.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/src/virtvboxd.aug to /usr/share/augeas/lenses +/home/builder/libvirt-10.10.0/src/remote/virt-guest-shutdown.target to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/libvirtd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/libvirtd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/libvirtd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/libvirtd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/libvirtd-tcp.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/libvirtd-tls.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtproxyd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtproxyd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtproxyd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtproxyd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtproxyd-tcp.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtproxyd-tls.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtinterfaced.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtinterfaced.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtinterfaced-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtinterfaced-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlockd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlockd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlockd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlogd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlogd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlogd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnetworkd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnetworkd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnetworkd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnetworkd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnodedevd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnodedevd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnodedevd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnodedevd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnwfilterd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnwfilterd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnwfilterd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtnwfilterd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtsecretd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtsecretd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtsecretd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtsecretd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtstoraged.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtstoraged.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtstoraged-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtstoraged-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlxcd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlxcd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlxcd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtlxcd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtchd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtchd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtchd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtchd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtqemud.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtqemud.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtqemud-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtqemud-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtvboxd.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtvboxd.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtvboxd-ro.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/build/src/virtvboxd-admin.socket to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/tools/virt-login-shell.conf to /etc/libvirt +/home/builder/libvirt-10.10.0/build/tools/virt-xml-validate to /usr/bin +/home/builder/libvirt-10.10.0/build/tools/virt-sanlock-cleanup to /usr/sbin +/home/builder/libvirt-10.10.0/tools/virt-qemu-sev-validate to /usr/bin +/home/builder/libvirt-10.10.0/build/tools/libvirt-guests.sh to /usr/libexec +/home/builder/libvirt-10.10.0/build/tools/libvirt-guests.service to /usr/lib/systemd/system +/home/builder/libvirt-10.10.0/tools/virt-qemu-qmp-proxy to /usr/bin +/home/builder/libvirt-10.10.0/build/tools/bash-completion/virsh to /usr/share/bash-completion/completions +/home/builder/libvirt-10.10.0/build/tools/bash-completion/virt-admin to /usr/share/bash-completion/completions +/home/builder/libvirt-10.10.0/build/tools/ssh-proxy/30-libvirt-ssh-proxy.conf to /etc/ssh/ssh_config.d +/home/builder/libvirt-10.10.0/examples/c/admin/client_close.c to /usr/share/doc/libvirt/examples/c/admin +/home/builder/libvirt-10.10.0/examples/c/admin/client_info.c to /usr/share/doc/libvirt/examples/c/admin +/home/builder/libvirt-10.10.0/examples/c/admin/client_limits.c to /usr/share/doc/libvirt/examples/c/admin +/home/builder/libvirt-10.10.0/examples/c/admin/list_clients.c to /usr/share/doc/libvirt/examples/c/admin +/home/builder/libvirt-10.10.0/examples/c/admin/list_servers.c to /usr/share/doc/libvirt/examples/c/admin +/home/builder/libvirt-10.10.0/examples/c/admin/logging.c to /usr/share/doc/libvirt/examples/c/admin +/home/builder/libvirt-10.10.0/examples/c/admin/threadpool_params.c to /usr/share/doc/libvirt/examples/c/admin +/home/builder/libvirt-10.10.0/examples/c/domain/dommigrate.c to /usr/share/doc/libvirt/examples/c/domain +/home/builder/libvirt-10.10.0/examples/c/domain/domtop.c to /usr/share/doc/libvirt/examples/c/domain +/home/builder/libvirt-10.10.0/examples/c/domain/info1.c to /usr/share/doc/libvirt/examples/c/domain +/home/builder/libvirt-10.10.0/examples/c/domain/rename.c to /usr/share/doc/libvirt/examples/c/domain +/home/builder/libvirt-10.10.0/examples/c/domain/suspend.c to /usr/share/doc/libvirt/examples/c/domain +/home/builder/libvirt-10.10.0/examples/c/misc/event-test.c to /usr/share/doc/libvirt/examples/c/misc +/home/builder/libvirt-10.10.0/examples/c/misc/hellolibvirt.c to /usr/share/doc/libvirt/examples/c/misc +/home/builder/libvirt-10.10.0/examples/c/misc/openauth.c to /usr/share/doc/libvirt/examples/c/misc +/home/builder/libvirt-10.10.0/examples/polkit/libvirt-acl.rules to /usr/share/doc/libvirt/examples/polkit +/home/builder/libvirt-10.10.0/examples/sh/virt-lxc-convert to /usr/share/doc/libvirt/examples/sh +/home/builder/libvirt-10.10.0/examples/systemtap/amd-sev-es-vmsa.stp to /usr/share/doc/libvirt/examples/systemtap +/home/builder/libvirt-10.10.0/examples/systemtap/events.stp to /usr/share/doc/libvirt/examples/systemtap +/home/builder/libvirt-10.10.0/examples/systemtap/lock-debug.stp to /usr/share/doc/libvirt/examples/systemtap +/home/builder/libvirt-10.10.0/examples/systemtap/qemu-monitor.stp to /usr/share/doc/libvirt/examples/systemtap +/home/builder/libvirt-10.10.0/examples/systemtap/rpc-monitor.stp to /usr/share/doc/libvirt/examples/systemtap +/home/builder/libvirt-10.10.0/examples/xml/storage/pool-dir.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/pool-fs.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/pool-logical.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/pool-netfs.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/vol-cow.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/vol-qcow.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/vol-qcow2.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/vol-raw.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/vol-sparse.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/storage/vol-vmdk.xml to /usr/share/doc/libvirt/examples/xml/storage +/home/builder/libvirt-10.10.0/examples/xml/test/testdev.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testnodeinline.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testdomfc4.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testdomfv0.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testnode.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testnetdef.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testvol.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testnetpriv.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/examples/xml/test/testpool.xml to /usr/share/doc/libvirt/examples/xml/test +/home/builder/libvirt-10.10.0/build/libvirt.pc to /usr/lib64/pkgconfig +/home/builder/libvirt-10.10.0/build/libvirt-qemu.pc to /usr/lib64/pkgconfig +/home/builder/libvirt-10.10.0/build/libvirt-lxc.pc to /usr/lib64/pkgconfig +/home/builder/libvirt-10.10.0/build/libvirt-admin.pc to /usr/lib64/pkgconfig +EOF +) + +# Base directories for source and build files +SRC_BASE="/home/builder/libvirt-10.10.0/build" # Actual source code path +BUILD_BASE="/home/builder/libvirt-10.10.0/build" # Build directory +DEST_BASE="/BINS" # Base path for installation (usually root) + + +# Function to copy files +copy_file() { + local source_file="$1" + local dest_dir="$2" + + # Compute the full source path + if [[ "$source_file" == /* ]]; then + SOURCE_PATH="$source_file" + else + SOURCE_PATH="$SRC_BASE/$source_file" + fi + + # Ensure the source file exists + if [ ! -e "$SOURCE_PATH" ]; then + echo "Error: Source file not found: $SOURCE_PATH" + return + fi + + # Create destination directory if it does not exist + mkdir -p "$DEST_BASE$dest_dir" + + # Copy the file + cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" + echo "Copied $SOURCE_PATH to $DEST_BASE$dest_dir" +} + +# Function to create symlink +create_symlink() { + local target="$1" + local link_name="$2" + + # Compute the full target path + if [[ "$target" == /* ]]; then + TARGET_PATH="$target" + else + TARGET_PATH="$BUILD_BASE/$target" + fi + + # Ensure the target exists + if [ ! -e "$TARGET_PATH" ]; then + echo "Error: Target file for symlink not found: $TARGET_PATH" + return + fi + + LINK_DIR=$(dirname "$DEST_BASE$link_name") + mkdir -p "$LINK_DIR" + + ln -sf "$TARGET_PATH" "$DEST_BASE$link_name" + echo "Created symlink: $DEST_BASE$link_name -> $TARGET_PATH" +} + +# Read the list and process each line +while IFS= read -r LINE; do + # Skip empty lines and comments + [[ -z "$LINE" ]] && continue + [[ "$LINE" =~ ^\# ]] && continue + + if [[ "$LINE" == symlink\ pointing\ to* ]]; then + # Handle symlink creation + REST=${LINE#symlink pointing to } + if [[ "$REST" =~ ^(.+?)\ to\ (.+)$ ]]; then + TARGET="${BASH_REMATCH[1]}" + LINK_NAME="${BASH_REMATCH[2]}" + create_symlink "$TARGET" "$LINK_NAME" + else + echo "Invalid symlink line: $LINE" + fi + else + # Handle file copying + if [[ "$LINE" =~ ^(.+?)\ to\ (.+)$ ]]; then + SOURCE_FILE="${BASH_REMATCH[1]}" + DEST_DIR="${BASH_REMATCH[2]}" + copy_file "$SOURCE_FILE" "$DEST_DIR" + else + echo "Invalid line: $LINE" + fi + fi +done <<< "$FILE_LIST" \ No newline at end of file diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index daf6b823c..724f5e8c5 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -1,21 +1,145 @@ --- -{{- $version := "10.10.0" }} +{{- $versionLibvirt := "10.10.0" }} +{{- $gitRepoUrl := "https://github.com/libvirt/libvirt.git" }} +{{- $gitRepoName := "libvirt" }} image: {{ $.ImageName }} final: false -from: {{ .Images.BASE_DEBIAN_BOOKWORM_SLIM }} +fromImage: base-alt-p11 +git: +- add: /images/{{ $.ImageName }}/ + to: / + includePaths: + - install-libvirt.sh + stageDependencies: + beforeSetup: + - install-libvirt.sh shell: + beforeInstall: + - | + apt-get update && apt-get install --yes \ + su sudo \ + dmidecode \ + gcc-c++ \ + git \ + gettext \ + bash-completion \ + clang \ + ccache \ + make cmake \ + meson \ + ninja-build \ + libudev-devel \ + libpciaccess-devel \ + libyajl-devel \ + sanlock-devel \ + libpcap-devel \ + libnl-devel \ + libselinux-devel \ + iproute \ + iptables \ + iptables-nft \ + iptables-ipv6 \ + openvswitch \ + ebtables \ + libsasl2-devel \ + pkgconfig \ + libssh-devel \ + libssh2-devel \ + polkit kmod \ + qemu-img \ + lvm2 \ + libparted-devel \ + parted \ + libdevmapper-devel \ + ceph-devel \ + open-iscsi \ + libiscsi-devel \ + libglusterfs-devel \ + libnuma-devel \ + libcap-ng-devel \ + libcurl-devel \ + libaudit-devel \ + libfuse-devel \ + libnbd-devel \ + libblkid-devel \ + libgcrypt-devel \ + libgnutls-devel \ + libp11-kit-devel \ + libreadline-devel \ + libtasn1-devel \ + libattr-devel \ + libbsd-devel \ + libsystemd-devel \ + libuuid-devel \ + libjson-c-devel \ + systemtap-sdt-devel \ + systemd-container \ + attr \ + libacl-devel \ + glib2-devel \ + glibc-utils \ + libgio-devel \ + libxml2-devel \ + xml-utils \ + xsltproc \ + python3 python3-devel \ + python3-module-pytest \ + python3-module-docutils \ + python3-tools \ + python3-module-pip \ + polkit \ + libtirpc-devel \ + libsasl2-devel \ + wireshark-devel \ + tshark \ + zlib-devel \ + mdevctl \ + util-linux dmsetup pm-utils \ + libfuse3-devel libnuma libslirp-devel libtirpc-devel \ + libyajl-devel libselinux-devel + + apt-get clean + rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin + + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED + rpm -qa | sort > /packages.txt + mkdir -p /usr/libexec/ccache-wrappers + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc + + pip3 install black + grep -qw ^rpm /etc/group || groupadd rpm + id -u builder &>/dev/null || useradd builder --shell /bin/bash --create-home --group rpm + install: - - apt-get -qq update - | - apt install --yes build-essential git automake autoconf libtool \ - pkg-config libglib2.0-dev libgnutls28-dev libxml2-dev libyajl-dev \ - libxslt1-dev libpolkit-gobject-1-dev libsystemd-dev \ - libpciaccess-dev python3-dev - - git clone --depth 1 --branch v{{ $version }} https://gitlab.com/libvirt/libvirt.git - - cd libvirt - - ./autogen.sh - - ./configure --with-qemu - - make - - make install - - which virtqemud + su - builder -s /bin/bash <<'EOFBASH' + echo "export CCACHE_WRAPPERSDIR=/usr/libexec/ccache-wrappers" >> .bashrc + echo "export MAKE=/usr/bin/make" >> .bashrc + echo "export NINJA="/usr/bin/ninja" >> .bashrc + echo "export PYTHON="/usr/bin/python3" >> .bashrc + EOFBASH + - | + su - builder -s /bin/bash <<'EOFBASH' + + git clone --depth=1 --branch v{{ $versionLibvirt }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionLibvirt }} + + cd {{ $gitRepoName }}-{{ $versionLibvirt }} + + CFLAGS="-Wframe-larger-than=8192" meson setup build \ + -Dsystem=true \ + -Ddriver_qemu=enabled \ + -Ddocs=disabled \ + -Ddriver_libvirtd=enabled && \ + ninja -C build -j$(nproc) + EOFBASH + + setup: + - | + mkdir -p /BINS + ls -la + /install-libvirt.sh + ls -lah /BINS + ls -lah /BINS/usr \ No newline at end of file diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml new file mode 100644 index 000000000..ed9c9fce3 --- /dev/null +++ b/images/qemu-artifact/werf.inc.yaml @@ -0,0 +1,142 @@ +--- +{{- $versionQemu := "9.1.2" }} +{{- $gitRepoUrl := "https://github.com/qemu/qemu.git" }} +{{- $gitRepoName := "qemu" }} + +image: {{ $.ImageName }} +final: false +fromImage: base-alt-p11 +shell: + beforeInstall: + - | + apt-get update && apt-get install -y su sudo \ + pkgconfig \ + pkg-config \ + gear rpm dmidecode \ + rpm-build \ + rpm-build-systemd \ + rpm-build-python3 \ + gcc-c++ \ + git \ + gettext \ + bash-completion \ + clang \ + ccache \ + make cmake \ + meson \ + ninja-build \ + glibc-devel-static \ + zlib-devel-static \ + glib2-devel-static \ + libpcre2-devel-static \ + libattr-devel-static \ + libdw-devel-static \ + libatomic-devel-static \ + glib2-devel \ + libdw-devel \ + makeinfo \ + perl-devel \ + python3 python3-dev \ + python3-module-pytest \ + python3-module-docutils \ + python3-tools \ + python3-module-pip \ + python3-module-sphinx \ + python3-module-sphinx_rtd_theme \ + pkgconfig \ + libssh-devel \ + libssh2-devel \ + libcap-ng-devel \ + libxfs-devel \ + zlib-devel \ + libcurl-devel \ + libpci-devel \ + libgvnc-devel \ + glibc-kernheaders \ + ipxe-roms-qemu \ + seavgabios \ + seabios \ + libfdt-devel \ + qboot \ + libpixman-devel \ + libkeyutils-devel \ + flex \ + libuuid-devel \ + libpam0-devel \ + libtasn1-devel \ + libslirp-devel \ + libdrm-devel \ + libxdp-devel libSDL2-devel libSDL2_image-devel \ + libncursesw-devel libalsa-devel libpulseaudio-devel \ + pipewire-libs pipewire-jack-libs-devel \ + libsoundio-devel libcapstone-devel libsasl2-devel \ + libjpeg-devel libpng-devel libxkbcommon-devel xkeyboard-config-devel \ + glusterfs11 libgtk+3-devel libvte libvte-devel libvte3-devel \ + libvirglrenderer-devel libusb-devel liburing-devel libbpf-devel \ + libspice-server-devel spice-protocol ceph-devel \ + libnfs-devel libzstd-devel libseccomp-devel \ + libgcrypt-devel libgnutls-devel libnettle-devel \ + libudev-devel libmultipath-devel libblkio-devel libpmem-devel \ + libdaxctl-devel libfuse3-devel rdma-core-devel libnuma-devel \ + bzlib-devel liblzo2-devel libsnappy-devel \ + libcacard-devel libusbredir-devel libepoxy-devel libgbm-devel \ + libvitastor-devel libiscsi-devel glusterfs-coreutils \ + libaio-devel libselinux-devel libqpl-devel \ + qemu-kvm-core shadow-utils sysvinit-utils libglusterfs11-api-devel hasher-provides-dev-kvm \ + filesystem libvdeplug-devel + + apt-get clean + rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED + rpm -qa | sort > /packages.txt + + mkdir -p /usr/libexec/ccache-wrappers + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc + + pip3 install black + + - | + grep -qw ^rpm /etc/group || groupadd rpm + id -u builder &>/dev/null || useradd builder --shell /bin/bash --create-home --group rpm + + install: + - | + su - builder -s /bin/bash <<'EOFBASH' + echo "export CCACHE_WRAPPERSDIR=/usr/libexec/ccache-wrappers" >> .bashrc + echo "export MAKE=/usr/bin/make" >> .bashrc + echo "export NINJA="/usr/bin/ninja" >> .bashrc + echo "export PYTHON="/usr/bin/python3" >> .bashrc + EOFBASH + + - | + # su - builder -s /bin/bash <<'EOFBASH' + + echo "export MAKE=/usr/bin/make" >> .bashrc + echo "export NINJA="/usr/bin/ninja" >> .bashrc + echo "export PYTHON="/usr/bin/python3" >> .bashrc + source ~/.bashrc + + git clone --depth=1 --branch v{{ $versionQemu }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionQemu }} + + cd {{ $gitRepoName }}-{{ $versionQemu }} + + # ./configure --prefix=/home/builder/BINS \ + ./configure --prefix=/BINS \ + --target-list="x86_64-softmmu i386-softmmu" \ + --enable-kvm \ + --enable-curses \ + --enable-vnc \ + --enable-gtk \ + --enable-system \ + --enable-tools \ + --disable-docs \ + make -j$(nproc) + + make install -j$(nproc) + # EOFBASH + setup: + - | + # ls -lah /home/builder/BINS + ls -lah /BINS diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index afe474bb3..8a74f93cc 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -11,6 +11,23 @@ import: includePaths: - edk2-ovmf-20240811-alt2.noarch.rpm +# Add bins from libvirt and qemu artifacts. +- image: tmp-merged + add: /BINS + to: / + before: install + +{{/* +# - image: libvirt-artifact +# add: /BINS +# to: / +# before: install +# - image: qemu-artifact +# add: /BINS +# to: / +# before: install +*/}} + # After install stage. # Add libxcrypto library. - image: {{ $.ImageName }}-libxcrypt-builder @@ -20,14 +37,16 @@ import: includePaths: - libcrypt.so.2.0.0 -# Add OpenSSL libraries. -- image: {{ $.ImageName }}-openssl-builder - add: /usr/local/lib64/ - to: /lib64 - after: install - includePaths: - - libcrypto.so.3 - - libssl.so.3 +{{/* +# # Add OpenSSL libraries. +# - image: {{ $.ImageName }}-openssl-builder +# add: /usr/local/lib64/ +# to: /lib64 +# after: install +# includePaths: +# - libcrypto.so.3 +# - libssl.so.3 +*/}} # Add liboverride library. - image: {{ $.ImageName }}-liboverride-builder @@ -99,20 +118,25 @@ git: shell: beforeInstall: # Install main packages. + - | apt-get update && apt-get install --yes \ acl \ pcre \ + procps \ ethtool \ nftables \ xorriso \ passt \ + ipxe-roms-qemu \ seabios \ + seavgabios \ libffi8 \ swtpm-tools \ - libvirt-client==10.7.0-alt1 \ - libvirt-daemon-driver-qemu==10.7.0-alt1 \ - qemu-kvm-core==9.1.2-alt1 + libcrypt libcrypto3 + # libvirt-client==10.7.0-alt1 \ + # libvirt-daemon-driver-qemu==10.7.0-alt1 \ + # qemu-kvm-core==9.1.2-alt2 - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: @@ -161,6 +185,37 @@ shell: #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] --- +image: tmp-merged +final: false +fromImage: base-alt-p11 +import: +- image: libvirt-artifact + add: /BINS + to: /libvirt-bins + before: install +- image: qemu-artifact + add: /BINS + to: /qemu-bins + before: install +shell: + install: + - | + apt-get update && apt-get install -y \ + tree + + echo "/libvirt-bins" + tree /libvirt-bins + + echo "/qemu-bins" + tree /qemu-bins + + echo "===========" + cp -rf /libvirt-bins /BINS + cp -rf /qemu-bins /BINS + + ls -lah /BINS + tree /BINS +--- image: {{ $.ImageName }}-lib-builder final: false fromImage: base-alt-p11 @@ -195,19 +250,23 @@ shell: - ./autogen.sh - ./configure --disable-obsolete-api - make && make install ---- -image: {{ $.ImageName }}-openssl-builder -final: false -fromImage: {{ $.ImageName }}-lib-builder -shell: - beforeInstall: - # Download OpenSSL sources. - - git clone --branch openssl-3.3.1 {{ $.SOURCE_REPO }}/openssl/openssl.git /tmp/openssl - install: - # Build libcrypto.so.3 and libssl.so.3. - - cd /tmp/openssl - - ./config no-docs - - make && make install + +{{/* +# --- +# image: {{ $.ImageName }}-openssl-builder +# final: false +# fromImage: {{ $.ImageName }}-lib-builder +# shell: +# beforeInstall: +# # Download OpenSSL sources. +# - git clone --branch openssl-3.3.1 {{ $.SOURCE_REPO }}/openssl/openssl.git /tmp/openssl +# install: +# # Build libcrypto.so.3 and libssl.so.3. +# - cd /tmp/openssl +# - ./config no-docs +# - make && make install +# +*/}} --- image: {{ $.ImageName }}-liboverride-builder final: false From 26cf624f74188d988dafdc362d6b58f659e5ea30 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 9 Jan 2025 09:46:35 +0300 Subject: [PATCH 003/107] fix script libvirt-install, correct symlinc Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 8 ++++++++ images/libvirt-artifact/werf.inc.yaml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 835a519f5..5b5683f2a 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -538,6 +538,14 @@ po/ro/LC_MESSAGES/libvirt.mo to /usr/local/share/locale/ro/LC_MESSAGES /home/builder/libvirt-10.10.0/build/libvirt-qemu.pc to /usr/lib64/pkgconfig /home/builder/libvirt-10.10.0/build/libvirt-lxc.pc to /usr/lib64/pkgconfig /home/builder/libvirt-10.10.0/build/libvirt-admin.pc to /usr/lib64/pkgconfig +symlink pointing to /usr/local/lib64/libvirt.so.0.10010.0 to /usr/lib64/libvirt.so.0 +symlink pointing to /usr/local/lib64/libvirt.so.0 to /usr/lib64/libvirt.so +symlink pointing to /usr/local/lib64/libvirt-qemu.so.0.10010.0 to /usr/lib64/libvirt-qemu.so.0 +symlink pointing to /usr/local/lib64/libvirt-qemu.so.0 to /usr/lib64/libvirt-qemu.so +symlink pointing to /usr/local/lib64/libvirt-lxc.so.0.10010.0 to /usr/lib64/libvirt-lxc.so.0 +symlink pointing to /usr/local/lib64/libvirt-lxc.so.0 to /usr/lib64/libvirt-lxc.so +symlink pointing to /usr/local/lib64/libvirt-admin.so.0.10010.0 to /usr/lib64/libvirt-admin.so.0 +symlink pointing to /usr/local/lib64/libvirt-admin.so.0 to /usr/lib64/libvirt-admin.so EOF ) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 724f5e8c5..447216f5b 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -12,7 +12,7 @@ git: includePaths: - install-libvirt.sh stageDependencies: - beforeSetup: + setup: - install-libvirt.sh shell: beforeInstall: From 94679265a121ed9e8873f5165cc0ab1dae1b6d05 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 9 Jan 2025 10:50:31 +0300 Subject: [PATCH 004/107] add symlinc in virt-launcher, remove creations symlinc from libvirt-artifact Signed-off-by: Nikita Korolev add dbg virt-launch Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 83 ++++++++++++---------- images/virt-launcher/werf.inc.yaml | 24 +++++++ 2 files changed, 70 insertions(+), 37 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 5b5683f2a..cf19f21e8 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -582,29 +582,29 @@ copy_file() { } # Function to create symlink -create_symlink() { - local target="$1" - local link_name="$2" +# create_symlink() { +# local target="$1" +# local link_name="$2" - # Compute the full target path - if [[ "$target" == /* ]]; then - TARGET_PATH="$target" - else - TARGET_PATH="$BUILD_BASE/$target" - fi +# # Compute the full target path +# if [[ "$target" == /* ]]; then +# TARGET_PATH="$target" +# else +# TARGET_PATH="$BUILD_BASE/$target" +# fi - # Ensure the target exists - if [ ! -e "$TARGET_PATH" ]; then - echo "Error: Target file for symlink not found: $TARGET_PATH" - return - fi +# # Ensure the target exists +# if [ ! -e "$TARGET_PATH" ]; then +# echo "Error: Target file for symlink not found: $TARGET_PATH" +# return +# fi - LINK_DIR=$(dirname "$DEST_BASE$link_name") - mkdir -p "$LINK_DIR" +# LINK_DIR=$(dirname "$DEST_BASE$link_name") +# mkdir -p "$LINK_DIR" - ln -sf "$TARGET_PATH" "$DEST_BASE$link_name" - echo "Created symlink: $DEST_BASE$link_name -> $TARGET_PATH" -} +# ln -sf "$TARGET_PATH" "$DEST_BASE$link_name" +# echo "Created symlink: $DEST_BASE$link_name -> $TARGET_PATH" +# } # Read the list and process each line while IFS= read -r LINE; do @@ -612,24 +612,33 @@ while IFS= read -r LINE; do [[ -z "$LINE" ]] && continue [[ "$LINE" =~ ^\# ]] && continue - if [[ "$LINE" == symlink\ pointing\ to* ]]; then - # Handle symlink creation - REST=${LINE#symlink pointing to } - if [[ "$REST" =~ ^(.+?)\ to\ (.+)$ ]]; then - TARGET="${BASH_REMATCH[1]}" - LINK_NAME="${BASH_REMATCH[2]}" - create_symlink "$TARGET" "$LINK_NAME" - else - echo "Invalid symlink line: $LINE" - fi + # Handle file copying + if [[ "$LINE" =~ ^(.+?)\ to\ (.+)$ ]]; then + SOURCE_FILE="${BASH_REMATCH[1]}" + DEST_DIR="${BASH_REMATCH[2]}" + copy_file "$SOURCE_FILE" "$DEST_DIR" else - # Handle file copying - if [[ "$LINE" =~ ^(.+?)\ to\ (.+)$ ]]; then - SOURCE_FILE="${BASH_REMATCH[1]}" - DEST_DIR="${BASH_REMATCH[2]}" - copy_file "$SOURCE_FILE" "$DEST_DIR" - else - echo "Invalid line: $LINE" - fi + echo "Invalid line: $LINE" fi + + # if [[ "$LINE" == symlink\ pointing\ to* ]]; then + # # Handle symlink creation + # REST=${LINE#symlink pointing to } + # if [[ "$REST" =~ ^(.+?)\ to\ (.+)$ ]]; then + # TARGET="${BASH_REMATCH[1]}" + # LINK_NAME="${BASH_REMATCH[2]}" + # create_symlink "$TARGET" "$LINK_NAME" + # else + # echo "Invalid symlink line: $LINE" + # fi + # else + # # Handle file copying + # if [[ "$LINE" =~ ^(.+?)\ to\ (.+)$ ]]; then + # SOURCE_FILE="${BASH_REMATCH[1]}" + # DEST_DIR="${BASH_REMATCH[2]}" + # copy_file "$SOURCE_FILE" "$DEST_DIR" + # else + # echo "Invalid line: $LINE" + # fi + # fi done <<< "$FILE_LIST" \ No newline at end of file diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 8a74f93cc..3f4322f48 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -166,6 +166,30 @@ shell: mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd rm -f OVMF_VARS_4M.secboot.qcow2 ls -la + # Create symlinc + - | + SYMLINC_LIST=$(cat <<'EOF' + /usr/local/lib64/libvirt.so.0.10010.0 /lib64/libvirt.so.0 + /usr/local/lib64/libvirt.so.0 /lib64/libvirt.so + /usr/local/lib64/libvirt-qemu.so.0.10010.0 /lib64/libvirt-qemu.so.0 + /usr/local/lib64/libvirt-qemu.so.0 /lib64/libvirt-qemu.so + /usr/local/lib64/libvirt-lxc.so.0.10010.0 /lib64/libvirt-lxc.so.0 + /usr/local/lib64/libvirt-lxc.so.0 /lib64/libvirt-lxc.so + /usr/local/lib64/libvirt-admin.so.0.10010.0 /lib64/libvirt-admin.so.0 + /usr/local/lib64/libvirt-admin.so.0 /lib64/libvirt-admin.so + EOF + ) + while IFS= read -r LINE; do + echo "Create symlinc for $LINE" + TARGET=$(echo $LINE | awk -F' to ' '{print $1}') + SYMLINK=$(echo $LINE | awk -F' to ' '{print $2}') + ln -s $TARGET $SYMLINK + done <<< "$SYMLINC_LIST" + cd / + - | + echo "----------------" + echo "List files /usr/local/lib64/" + ls -lah /usr/local/lib64/ setup: # Replace virt-launcher-monitor with the wrapper. - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig From 1b9338db435d4df6af123fe6288785fe530b1a5b Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 9 Jan 2025 15:00:27 +0300 Subject: [PATCH 005/107] add libs in virtlauncher, rm dublicate pks from libartifact Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 2 +- images/virt-launcher/werf.inc.yaml | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 447216f5b..87f92c651 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -96,7 +96,7 @@ shell: zlib-devel \ mdevctl \ util-linux dmsetup pm-utils \ - libfuse3-devel libnuma libslirp-devel libtirpc-devel \ + libfuse3-devel libnuma libslirp-devel \ libyajl-devel libselinux-devel apt-get clean diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 3f4322f48..772ad74b5 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -133,12 +133,21 @@ shell: seavgabios \ libffi8 \ swtpm-tools \ - libcrypt libcrypto3 + libcrypt libcrypto3 \ + libjson-c5 libtirpc libbsd libiscsi libglusterfs11 libnuma \ + libcap-ng libcurl libaudit libfuse libnbd libblkid libgcrypt20 \ + libgnutls libp11-kit libreadline8 libtasn1 libattr libbsd libsystemd \ + libuuid libssh libssh2 + + - apt-get clean + - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin + + # libvirt-client==10.7.0-alt1 \ # libvirt-daemon-driver-qemu==10.7.0-alt1 \ # qemu-kvm-core==9.1.2-alt2 - - apt-get clean - - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin + # - apt-get clean + # - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: # Upgrade edk2-ovmf package to custom build and remove its package. - | From 26f097958c59edba7709a13f48f9751909bf8975 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 9 Jan 2025 16:36:12 +0300 Subject: [PATCH 006/107] Copy BINS to virtlauncher Signed-off-by: Nikita Korolev fix libvirt adn qemu buildr and files location Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 2 +- images/virt-launcher/werf.inc.yaml | 104 ++++++++++++++++++-------- 2 files changed, 74 insertions(+), 32 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 87f92c651..af906d203 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -95,7 +95,7 @@ shell: tshark \ zlib-devel \ mdevctl \ - util-linux dmsetup pm-utils \ + util-linux dmsetup pm-utils libclocale \ libfuse3-devel libnuma libslirp-devel \ libyajl-devel libselinux-devel diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 772ad74b5..3f376c8aa 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -12,12 +12,39 @@ import: - edk2-ovmf-20240811-alt2.noarch.rpm # Add bins from libvirt and qemu artifacts. -- image: tmp-merged + +- image: libvirt-artifact add: /BINS to: / before: install +# Qemu to folders +- image: qemu-artifact + add: /BINS/bin + to: /usr/bin + before: install +- image: qemu-artifact + add: /BINS/share + to: /usr/share + before: install +- image: qemu-artifact + add: /BINS/libexec + to: /usr/lib/libexec + before: install +- image: qemu-artifact + add: /BINS/include + to: /usr/local/include + before: install +- image: qemu-artifact + add: /BINS/var + to: /var + before: install {{/* +# - image: tmp-merged +# add: /BINS +# to: /BINS +# before: install + # - image: libvirt-artifact # add: /BINS # to: / @@ -137,7 +164,14 @@ shell: libjson-c5 libtirpc libbsd libiscsi libglusterfs11 libnuma \ libcap-ng libcurl libaudit libfuse libnbd libblkid libgcrypt20 \ libgnutls libp11-kit libreadline8 libtasn1 libattr libbsd libsystemd \ - libuuid libssh libssh2 + libuuid libssh libssh2 \ + libcapstone libpixman libpng16 libjpeg libepoxy libusb \ + libsnappy liblzo2 libSDL2 libpmem libdaxctl libfdt libqpl1 \ + libslirp libvdeplug3 libxdp libbpf libdw libgbm libgtk+3 \ + libcairo libgdk-pixbuf libvte3 libX11 libSDL2_image \ + libspice-server libvirglrenderer libcacard libusbredir libalsa \ + libpulseaudio pipewire-jack-libs pipewire-libs libaio liburing \ + libblkio libglusterfs11-api libnfs librbd1 librados2 - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin @@ -175,7 +209,11 @@ shell: mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd rm -f OVMF_VARS_4M.secboot.qcow2 ls -la - # Create symlinc + - | + # cd / + # cp -a /BINS/. / + # rm -rf /BINS + # Create symlinc for libvirt - | SYMLINC_LIST=$(cat <<'EOF' /usr/local/lib64/libvirt.so.0.10010.0 /lib64/libvirt.so.0 @@ -196,9 +234,11 @@ shell: done <<< "$SYMLINC_LIST" cd / - | - echo "----------------" + echo "------libvirt----------" echo "List files /usr/local/lib64/" ls -lah /usr/local/lib64/ + echo "------qemu-------------" + ls -lah /usr/bin setup: # Replace virt-launcher-monitor with the wrapper. - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig @@ -217,37 +257,39 @@ shell: # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] ---- -image: tmp-merged -final: false -fromImage: base-alt-p11 -import: -- image: libvirt-artifact - add: /BINS - to: /libvirt-bins - before: install -- image: qemu-artifact - add: /BINS - to: /qemu-bins - before: install -shell: - install: - - | - apt-get update && apt-get install -y \ - tree +{{/* +# --- +# image: tmp-merged +# final: false +# fromImage: base-alt-p11 +# import: +# - image: libvirt-artifact +# add: /BINS +# to: /libvirt-bins +# before: install +# - image: qemu-artifact +# add: /BINS +# to: /qemu-bins +# before: install +# shell: +# install: +# - | +# apt-get update && apt-get install -y \ +# tree - echo "/libvirt-bins" - tree /libvirt-bins +# echo "/libvirt-bins" +# tree /libvirt-bins - echo "/qemu-bins" - tree /qemu-bins +# echo "/qemu-bins" +# tree /qemu-bins - echo "===========" - cp -rf /libvirt-bins /BINS - cp -rf /qemu-bins /BINS +# echo "===========" +# cp -a /libvirt-bins/. /BINS +# cp -a /qemu-bins/. /BINS/ - ls -lah /BINS - tree /BINS +# ls -lah /BINS +# tree /BINS +*/}} --- image: {{ $.ImageName }}-lib-builder final: false From 767ce3367e87e67e35054fccdc085e019367d60d Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 9 Jan 2025 19:42:42 +0300 Subject: [PATCH 007/107] try via tmp-merged image Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 132 ++++++++++++++++------------- 1 file changed, 71 insertions(+), 61 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 3f376c8aa..89a31b50f 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -13,37 +13,39 @@ import: # Add bins from libvirt and qemu artifacts. -- image: libvirt-artifact - add: /BINS - to: / - before: install -# Qemu to folders -- image: qemu-artifact - add: /BINS/bin - to: /usr/bin - before: install -- image: qemu-artifact - add: /BINS/share - to: /usr/share - before: install -- image: qemu-artifact - add: /BINS/libexec - to: /usr/lib/libexec - before: install -- image: qemu-artifact - add: /BINS/include - to: /usr/local/include - before: install -- image: qemu-artifact - add: /BINS/var - to: /var - before: install - {{/* -# - image: tmp-merged +# - image: libvirt-artifact # add: /BINS -# to: /BINS +# to: / +# before: install + +# # Qemu to folders +# - image: qemu-artifact +# add: /BINS/bin +# to: /usr/bin +# before: install +# - image: qemu-artifact +# add: /BINS/share +# to: /usr/share # before: install +# - image: qemu-artifact +# add: /BINS/libexec +# to: /usr/lib/libexec +# before: install +# - image: qemu-artifact +# add: /BINS/include +# to: /usr/local/include +# before: install +# - image: qemu-artifact +# add: /BINS/var +# to: /var +# before: install +*/}} + +- image: tmp-merged + add: /VBINS + to: /BINS + before: install # - image: libvirt-artifact # add: /BINS @@ -53,7 +55,6 @@ import: # add: /BINS # to: / # before: install -*/}} # After install stage. # Add libxcrypto library. @@ -210,9 +211,10 @@ shell: rm -f OVMF_VARS_4M.secboot.qcow2 ls -la - | - # cd / - # cp -a /BINS/. / - # rm -rf /BINS + echo "--copy bins--" + cp -a -u -v /BINS/usr/* /usr + cp -a -u -v /BINS/etc/* /etc + rm -rf /BINS/ # Create symlinc for libvirt - | SYMLINC_LIST=$(cat <<'EOF' @@ -238,7 +240,7 @@ shell: echo "List files /usr/local/lib64/" ls -lah /usr/local/lib64/ echo "------qemu-------------" - ls -lah /usr/bin + ls -lah /usr/bin/ setup: # Replace virt-launcher-monitor with the wrapper. - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig @@ -257,38 +259,46 @@ shell: # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] -{{/* -# --- -# image: tmp-merged -# final: false -# fromImage: base-alt-p11 -# import: -# - image: libvirt-artifact -# add: /BINS -# to: /libvirt-bins -# before: install -# - image: qemu-artifact -# add: /BINS -# to: /qemu-bins -# before: install -# shell: -# install: -# - | -# apt-get update && apt-get install -y \ -# tree +--- +image: tmp-merged +final: false +fromImage: base-alt-p11 +import: +- image: libvirt-artifact + add: /BINS + to: /libvirt-bins + before: install +- image: qemu-artifact + add: /BINS + to: /qemu-bins + before: install +shell: + install: + - | + apt-get update && apt-get install -y \ + tree + mkdir -p /VBINS -# echo "/libvirt-bins" -# tree /libvirt-bins + # echo "/libvirt-bins" + # tree /libvirt-bins -# echo "/qemu-bins" -# tree /qemu-bins + # echo "/qemu-bins" + # tree /qemu-bins -# echo "===========" -# cp -a /libvirt-bins/. /BINS -# cp -a /qemu-bins/. /BINS/ + echo "=====copy bins to folders======" + cp -a /libvirt-bins/. /VBINS/ -# ls -lah /BINS -# tree /BINS + cp -a /qemu-bins/bin/. /VBINS/usr/bin/ + cp -a /qemu-bins/share/. /VBINS/usr/share/ + cp -a /qemu-bins/libexec/. /VBINS/usr/lib/libexec/ + cp -a /qemu-bins/include/. /VBINS/usr/local/include/ + rm -rf /VBINS/var/run + # cp -a /qemu-bins/var/. /VBINS/var/ + + ls -lah /VBINS + tree -L 2 /VBINS + +{{/* */}} --- image: {{ $.ImageName }}-lib-builder From 1ef9d19d60dee4a02b3364c34af36cbc544e2ebd Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 10 Jan 2025 09:53:42 +0300 Subject: [PATCH 008/107] cleanup virt-launcher build Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 91 ++---------------------------- 1 file changed, 5 insertions(+), 86 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 89a31b50f..401a663a3 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -12,50 +12,11 @@ import: - edk2-ovmf-20240811-alt2.noarch.rpm # Add bins from libvirt and qemu artifacts. - -{{/* -# - image: libvirt-artifact -# add: /BINS -# to: / -# before: install - -# # Qemu to folders -# - image: qemu-artifact -# add: /BINS/bin -# to: /usr/bin -# before: install -# - image: qemu-artifact -# add: /BINS/share -# to: /usr/share -# before: install -# - image: qemu-artifact -# add: /BINS/libexec -# to: /usr/lib/libexec -# before: install -# - image: qemu-artifact -# add: /BINS/include -# to: /usr/local/include -# before: install -# - image: qemu-artifact -# add: /BINS/var -# to: /var -# before: install -*/}} - - image: tmp-merged add: /VBINS to: /BINS before: install -# - image: libvirt-artifact -# add: /BINS -# to: / -# before: install -# - image: qemu-artifact -# add: /BINS -# to: / -# before: install - # After install stage. # Add libxcrypto library. - image: {{ $.ImageName }}-libxcrypt-builder @@ -65,17 +26,6 @@ import: includePaths: - libcrypt.so.2.0.0 -{{/* -# # Add OpenSSL libraries. -# - image: {{ $.ImageName }}-openssl-builder -# add: /usr/local/lib64/ -# to: /lib64 -# after: install -# includePaths: -# - libcrypto.so.3 -# - libssl.so.3 -*/}} - # Add liboverride library. - image: {{ $.ImageName }}-liboverride-builder add: /liboverride/ @@ -210,8 +160,9 @@ shell: mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd rm -f OVMF_VARS_4M.secboot.qcow2 ls -la + # Installation libvirt and qemu - | - echo "--copy bins--" + echo "Install libvirt and qemu binaries" cp -a -u -v /BINS/usr/* /usr cp -a -u -v /BINS/etc/* /etc rm -rf /BINS/ @@ -235,12 +186,7 @@ shell: ln -s $TARGET $SYMLINK done <<< "$SYMLINC_LIST" cd / - - | - echo "------libvirt----------" - echo "List files /usr/local/lib64/" - ls -lah /usr/local/lib64/ - echo "------qemu-------------" - ls -lah /usr/bin/ + setup: # Replace virt-launcher-monitor with the wrapper. - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig @@ -279,27 +225,16 @@ shell: tree mkdir -p /VBINS - # echo "/libvirt-bins" - # tree /libvirt-bins - - # echo "/qemu-bins" - # tree /qemu-bins - - echo "=====copy bins to folders======" + echo "=====Copy libvirt binaries to temp folder======" cp -a /libvirt-bins/. /VBINS/ + echo "=====Copy qemu binaries to temp folder======" cp -a /qemu-bins/bin/. /VBINS/usr/bin/ cp -a /qemu-bins/share/. /VBINS/usr/share/ cp -a /qemu-bins/libexec/. /VBINS/usr/lib/libexec/ cp -a /qemu-bins/include/. /VBINS/usr/local/include/ rm -rf /VBINS/var/run - # cp -a /qemu-bins/var/. /VBINS/var/ - - ls -lah /VBINS - tree -L 2 /VBINS -{{/* -*/}} --- image: {{ $.ImageName }}-lib-builder final: false @@ -336,22 +271,6 @@ shell: - ./configure --disable-obsolete-api - make && make install -{{/* -# --- -# image: {{ $.ImageName }}-openssl-builder -# final: false -# fromImage: {{ $.ImageName }}-lib-builder -# shell: -# beforeInstall: -# # Download OpenSSL sources. -# - git clone --branch openssl-3.3.1 {{ $.SOURCE_REPO }}/openssl/openssl.git /tmp/openssl -# install: -# # Build libcrypto.so.3 and libssl.so.3. -# - cd /tmp/openssl -# - ./config no-docs -# - make && make install -# -*/}} --- image: {{ $.ImageName }}-liboverride-builder final: false From 1f26fd2f32bb4311741ca631508e145adadb1dc9 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 10 Jan 2025 11:33:31 +0300 Subject: [PATCH 009/107] refactor libvirt artifact build Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 1198 ++++++++++---------- images/libvirt-artifact/werf.inc.yaml | 36 +- 2 files changed, 622 insertions(+), 612 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index cf19f21e8..5ec133be5 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -14,546 +14,599 @@ # See the License for the specific language governing permissions and # limitations under the License. +usage() { + cat < $TARGET_PATH" -# } + # Handle file copying + if [[ "$LINE" =~ ^(.+?)\ to\ (.+)$ ]]; then + SOURCE_FILE="${BASH_REMATCH[1]}" + DEST_DIR="${BASH_REMATCH[2]}" + copy_file "$SOURCE_FILE" "$DEST_DIR" + else + echo "Invalid line: $LINE" + fi -# Read the list and process each line -while IFS= read -r LINE; do - # Skip empty lines and comments - [[ -z "$LINE" ]] && continue - [[ "$LINE" =~ ^\# ]] && continue - - # Handle file copying - if [[ "$LINE" =~ ^(.+?)\ to\ (.+)$ ]]; then - SOURCE_FILE="${BASH_REMATCH[1]}" - DEST_DIR="${BASH_REMATCH[2]}" - copy_file "$SOURCE_FILE" "$DEST_DIR" - else - echo "Invalid line: $LINE" - fi + done <<< "$FILE_LIST" +} - # if [[ "$LINE" == symlink\ pointing\ to* ]]; then - # # Handle symlink creation - # REST=${LINE#symlink pointing to } - # if [[ "$REST" =~ ^(.+?)\ to\ (.+)$ ]]; then - # TARGET="${BASH_REMATCH[1]}" - # LINK_NAME="${BASH_REMATCH[2]}" - # create_symlink "$TARGET" "$LINK_NAME" - # else - # echo "Invalid symlink line: $LINE" - # fi - # else - # # Handle file copying - # if [[ "$LINE" =~ ^(.+?)\ to\ (.+)$ ]]; then - # SOURCE_FILE="${BASH_REMATCH[1]}" - # DEST_DIR="${BASH_REMATCH[2]}" - # copy_file "$SOURCE_FILE" "$DEST_DIR" - # else - # echo "Invalid line: $LINE" - # fi - # fi -done <<< "$FILE_LIST" \ No newline at end of file +main \ No newline at end of file diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index af906d203..acb73cf32 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -12,7 +12,7 @@ git: includePaths: - install-libvirt.sh stageDependencies: - setup: + beforeSetup: - install-libvirt.sh shell: beforeInstall: @@ -115,31 +115,29 @@ shell: install: - | - su - builder -s /bin/bash <<'EOFBASH' - echo "export CCACHE_WRAPPERSDIR=/usr/libexec/ccache-wrappers" >> .bashrc - echo "export MAKE=/usr/bin/make" >> .bashrc - echo "export NINJA="/usr/bin/ninja" >> .bashrc - echo "export PYTHON="/usr/bin/python3" >> .bashrc - EOFBASH - - | - su - builder -s /bin/bash <<'EOFBASH' - + export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" + export MAKE="/usr/bin/make" + export NINJA="/usr/bin/ninja" + export PYTHON="/usr/bin/python3" + git clone --depth=1 --branch v{{ $versionLibvirt }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionLibvirt }} - + cd {{ $gitRepoName }}-{{ $versionLibvirt }} - + CFLAGS="-Wframe-larger-than=8192" meson setup build \ -Dsystem=true \ -Ddriver_qemu=enabled \ -Ddocs=disabled \ - -Ddriver_libvirtd=enabled && \ + -Ddriver_libvirtd=enabled + ninja -C build -j$(nproc) - EOFBASH setup: - | - mkdir -p /BINS - ls -la - /install-libvirt.sh - ls -lah /BINS - ls -lah /BINS/usr \ No newline at end of file + echo "/{{ $gitRepoName }}-{{ $versionLibvirt }}" + + ls -lah /{{ $gitRepoName }}-{{ $versionLibvirt }} + + /install-libvirt.sh -s /{{ $gitRepoName }}-{{ $versionLibvirt }} \ + -d /BINS \ + -b build From dcd0905b89c447f1a3fb1d1d91bc564e05604550 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 10 Jan 2025 16:45:39 +0300 Subject: [PATCH 010/107] refactor qemu build Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 2 +- images/qemu-artifact/werf.inc.yaml | 24 +++++------------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index acb73cf32..8d2a8785a 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -12,7 +12,7 @@ git: includePaths: - install-libvirt.sh stageDependencies: - beforeSetup: + setup: - install-libvirt.sh shell: beforeInstall: diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index ed9c9fce3..0ae89ef68 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -1,5 +1,5 @@ --- -{{- $versionQemu := "9.1.2" }} +{{- $versionQemu := "9.2.0" }} {{- $gitRepoUrl := "https://github.com/qemu/qemu.git" }} {{- $gitRepoName := "qemu" }} @@ -102,27 +102,15 @@ shell: id -u builder &>/dev/null || useradd builder --shell /bin/bash --create-home --group rpm install: - - | - su - builder -s /bin/bash <<'EOFBASH' - echo "export CCACHE_WRAPPERSDIR=/usr/libexec/ccache-wrappers" >> .bashrc - echo "export MAKE=/usr/bin/make" >> .bashrc - echo "export NINJA="/usr/bin/ninja" >> .bashrc - echo "export PYTHON="/usr/bin/python3" >> .bashrc - EOFBASH - - - | - # su - builder -s /bin/bash <<'EOFBASH' - - echo "export MAKE=/usr/bin/make" >> .bashrc - echo "export NINJA="/usr/bin/ninja" >> .bashrc - echo "export PYTHON="/usr/bin/python3" >> .bashrc - source ~/.bashrc + - | + export MAKE="/usr/bin/make" + export NINJA="/usr/bin/ninja" + export PYTHON="/usr/bin/python3" git clone --depth=1 --branch v{{ $versionQemu }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionQemu }} cd {{ $gitRepoName }}-{{ $versionQemu }} - # ./configure --prefix=/home/builder/BINS \ ./configure --prefix=/BINS \ --target-list="x86_64-softmmu i386-softmmu" \ --enable-kvm \ @@ -135,8 +123,6 @@ shell: make -j$(nproc) make install -j$(nproc) - # EOFBASH setup: - | - # ls -lah /home/builder/BINS ls -lah /BINS From 05d6c64ea60f09d71e4be45bb4755823f4bc7edf Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 10 Jan 2025 19:34:44 +0300 Subject: [PATCH 011/107] refactor build libvirt Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 8d2a8785a..cd102a2ff 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -125,10 +125,25 @@ shell: cd {{ $gitRepoName }}-{{ $versionLibvirt }} CFLAGS="-Wframe-larger-than=8192" meson setup build \ + -Dinit_script=systemd \ -Dsystem=true \ -Ddriver_qemu=enabled \ + -Ddriver_libvirtd=enabled \ -Ddocs=disabled \ - -Ddriver_libvirtd=enabled + -Ddriver_ch=disabled \ + -Ddriver_lxc=disabled \ + -Ddriver_openvz=disabled \ + -Ddriver_test=disabled \ + -Ddriver_vbox=disabled \ + -Dvbox_xpcomc_dir=disabled \ + -Ddriver_vmware=disabled \ + -Ddriver_vz=disabled \ + -Dwireshark_dissector=disabled \ + -Dwireshark_plugindir=disabled \ + -Dstorage_gluster=disabled \ + -Dstorage_zfs=disabled \ + -Dstorage_vstorage=disabled \ + -Dstorage_rbd=disabled ninja -C build -j$(nproc) From d88653039ea6926218fa5bbe81a836b0fe035148 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 10 Jan 2025 19:51:57 +0300 Subject: [PATCH 012/107] refactor qemu build Signed-off-by: Nikita Korolev libvirt, rm examples from BINS Signed-off-by: Nikita Korolev virt-launcher: temporary disable build OVMF, libvirt-artifact: disable unnecessary features Signed-off-by: Nikita Korolev qemu enable-tcg Signed-off-by: Nikita Korolev libvirt: Dcurl=enabled, qemu: comment enable-tcg Signed-off-by: Nikita Korolev qemu: enable-tcg Signed-off-by: Nikita Korolev libvirt: comment Ddriver_hyperv=disabled Signed-off-by: Nikita Korolev qemu: change enable features ti kvm tcg vnc virtfs spice curl Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 46 -------------- images/libvirt-artifact/werf.inc.yaml | 1 + images/qemu-artifact/werf.inc.yaml | 26 ++++++-- images/virt-launcher/werf.inc.yaml | 72 +++++++++++----------- 4 files changed, 58 insertions(+), 87 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 5ec133be5..909c9558f 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -555,47 +555,6 @@ $SRC_BASE/tools/virt-qemu-qmp-proxy to /usr/bin $SRC_BUILD/tools/bash-completion/virsh to /usr/share/bash-completion/completions $SRC_BUILD/tools/bash-completion/virt-admin to /usr/share/bash-completion/completions $SRC_BUILD/tools/ssh-proxy/30-libvirt-ssh-proxy.conf to /etc/ssh/ssh_config.d -$SRC_BASE/examples/c/admin/client_close.c to /usr/share/doc/libvirt/examples/c/admin -$SRC_BASE/examples/c/admin/client_info.c to /usr/share/doc/libvirt/examples/c/admin -$SRC_BASE/examples/c/admin/client_limits.c to /usr/share/doc/libvirt/examples/c/admin -$SRC_BASE/examples/c/admin/list_clients.c to /usr/share/doc/libvirt/examples/c/admin -$SRC_BASE/examples/c/admin/list_servers.c to /usr/share/doc/libvirt/examples/c/admin -$SRC_BASE/examples/c/admin/logging.c to /usr/share/doc/libvirt/examples/c/admin -$SRC_BASE/examples/c/admin/threadpool_params.c to /usr/share/doc/libvirt/examples/c/admin -$SRC_BASE/examples/c/domain/dommigrate.c to /usr/share/doc/libvirt/examples/c/domain -$SRC_BASE/examples/c/domain/domtop.c to /usr/share/doc/libvirt/examples/c/domain -$SRC_BASE/examples/c/domain/info1.c to /usr/share/doc/libvirt/examples/c/domain -$SRC_BASE/examples/c/domain/rename.c to /usr/share/doc/libvirt/examples/c/domain -$SRC_BASE/examples/c/domain/suspend.c to /usr/share/doc/libvirt/examples/c/domain -$SRC_BASE/examples/c/misc/event-test.c to /usr/share/doc/libvirt/examples/c/misc -$SRC_BASE/examples/c/misc/hellolibvirt.c to /usr/share/doc/libvirt/examples/c/misc -$SRC_BASE/examples/c/misc/openauth.c to /usr/share/doc/libvirt/examples/c/misc -$SRC_BASE/examples/polkit/libvirt-acl.rules to /usr/share/doc/libvirt/examples/polkit -$SRC_BASE/examples/sh/virt-lxc-convert to /usr/share/doc/libvirt/examples/sh -$SRC_BASE/examples/systemtap/amd-sev-es-vmsa.stp to /usr/share/doc/libvirt/examples/systemtap -$SRC_BASE/examples/systemtap/events.stp to /usr/share/doc/libvirt/examples/systemtap -$SRC_BASE/examples/systemtap/lock-debug.stp to /usr/share/doc/libvirt/examples/systemtap -$SRC_BASE/examples/systemtap/qemu-monitor.stp to /usr/share/doc/libvirt/examples/systemtap -$SRC_BASE/examples/systemtap/rpc-monitor.stp to /usr/share/doc/libvirt/examples/systemtap -$SRC_BASE/examples/xml/storage/pool-dir.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/pool-fs.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/pool-logical.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/pool-netfs.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/vol-cow.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/vol-qcow.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/vol-qcow2.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/vol-raw.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/vol-sparse.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/storage/vol-vmdk.xml to /usr/share/doc/libvirt/examples/xml/storage -$SRC_BASE/examples/xml/test/testdev.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testnodeinline.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testdomfc4.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testdomfv0.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testnode.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testnetdef.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testvol.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testnetpriv.xml to /usr/share/doc/libvirt/examples/xml/test -$SRC_BASE/examples/xml/test/testpool.xml to /usr/share/doc/libvirt/examples/xml/test $SRC_BUILD/libvirt.pc to /usr/lib64/pkgconfig $SRC_BUILD/libvirt-qemu.pc to /usr/lib64/pkgconfig $SRC_BUILD/libvirt-lxc.pc to /usr/lib64/pkgconfig @@ -603,11 +562,6 @@ $SRC_BUILD/libvirt-admin.pc to /usr/lib64/pkgconfig EOF ) -# Base directories for source and build files -# SRC_BASE="$SRC_BUILD" # Actual source code path -# SRC_BUILD="build" # Actual source build path -# DEST_BASE="/BINS" # Base path for installation - # Function to copy files copy_file() { local source_file="$1" diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index cd102a2ff..125f5ea8a 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -129,6 +129,7 @@ shell: -Dsystem=true \ -Ddriver_qemu=enabled \ -Ddriver_libvirtd=enabled \ + -Dcurl=enabled \ -Ddocs=disabled \ -Ddriver_ch=disabled \ -Ddriver_lxc=disabled \ diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 0ae89ef68..c26a17ca7 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -114,15 +114,31 @@ shell: ./configure --prefix=/BINS \ --target-list="x86_64-softmmu i386-softmmu" \ --enable-kvm \ - --enable-curses \ + --enable-tcg \ --enable-vnc \ - --enable-gtk \ - --enable-system \ - --enable-tools \ + --enable-virtfs \ + --enable-spice \ + --enable-usb-redir \ + --enable-libnfs \ + --enable-curl \ + --enable-debug \ + --enable-opengl \ --disable-docs \ + --disable-cocoa \ + --disable-cloop \ + --disable-dmg \ + --disable-glusterfs \ + --disable-guest-agent \ + --disable-guest-agent-msi \ + --disable-parallels \ + --disable-xen \ + --disable-xen-pci-passthrough + make -j$(nproc) make install -j$(nproc) + + # --disable-debug-tcg \ setup: - | - ls -lah /BINS + ls -lah /BINS diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 401a663a3..463d85fdf 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -4,13 +4,15 @@ fromImage: base-alt-p11 import: # Before install stage. # Add edk2-ovmf package -- image: {{ $.ImageName }}-edk2-builder - add: /home/builder/RPM/RPMS/noarch - to: / - before: install - includePaths: - - edk2-ovmf-20240811-alt2.noarch.rpm - +{{/* +# - image: {{ $.ImageName }}-edk2-builder +# add: /home/builder/RPM/RPMS/noarch +# to: / +# before: install +# includePaths: +# - edk2-ovmf-20231115-alt1.noarch.rpm +# - edk2-ovmf-20240811-alt2.noarch.rpm +*/}} # Add bins from libvirt and qemu artifacts. - image: tmp-merged add: /VBINS @@ -96,7 +98,6 @@ git: shell: beforeInstall: # Install main packages. - - | apt-get update && apt-get install --yes \ acl \ @@ -126,40 +127,39 @@ shell: - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin - - - # libvirt-client==10.7.0-alt1 \ - # libvirt-daemon-driver-qemu==10.7.0-alt1 \ - # qemu-kvm-core==9.1.2-alt2 - # - apt-get clean - # - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: # Upgrade edk2-ovmf package to custom build and remove its package. - | - rpm -Uv /edk2-ovmf-20240811-alt2.noarch.rpm - rm /edk2-ovmf-20240811-alt2.noarch.rpm + # Temp disable + # ls -la + # rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm + # rm /edk2-ovmf-20231115-alt1.noarch.rpm + # ======= + # rpm -Uv /edk2-ovmf-20240811-alt2.noarch.rpm + # rm /edk2-ovmf-20240811-alt2.noarch.rpm + # Restructure firware files in /usr/share/OVMF to mimic structure # in edk2-ovmf package from the original kubevirt. - | - cd /usr/share/OVMF - rm MICROVM.fd - rm OVMF.inteltdx.secboot.fd - rm OVMF_CODE.fd - rm OVMF_CODE.secboot.fd - mv OVMF_CODE_4M.fd OVMF_CODE.cc.fd - rm OVMF_CODE_4M.qcow2 - mv OVMF_CODE_4M.secboot.fd OVMF_CODE.secboot.fd - rm OVMF_CODE_4M.secboot.qcow2 - rm OVMF_VARS.fd - rm OVMF_VARS.ms.fd - rm OVMF_VARS.secboot.fd - mv OVMF_VARS_4M.fd OVMF_VARS.fd - rm OVMF_VARS_4M.ms.fd - rm -f OVMF_VARS_4M.ms.qcow2 - rm -f OVMF_VARS_4M.qcow2 - mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd - rm -f OVMF_VARS_4M.secboot.qcow2 - ls -la +# cd /usr/share/OVMF +# rm MICROVM.fd +# rm OVMF.inteltdx.secboot.fd +# rm OVMF_CODE.fd +# rm OVMF_CODE.secboot.fd +# mv OVMF_CODE_4M.fd OVMF_CODE.cc.fd +# rm OVMF_CODE_4M.qcow2 +# mv OVMF_CODE_4M.secboot.fd OVMF_CODE.secboot.fd +# rm OVMF_CODE_4M.secboot.qcow2 +# rm OVMF_VARS.fd +# rm OVMF_VARS.ms.fd +# rm OVMF_VARS.secboot.fd +# mv OVMF_VARS_4M.fd OVMF_VARS.fd +# rm OVMF_VARS_4M.ms.fd +# rm -f OVMF_VARS_4M.ms.qcow2 +# rm -f OVMF_VARS_4M.qcow2 +# mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd +# rm -f OVMF_VARS_4M.secboot.qcow2 +# ls -la # Installation libvirt and qemu - | echo "Install libvirt and qemu binaries" From 94c19983267eb2322d489886b1d8cb715b68f283 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 13 Jan 2025 13:28:17 +0300 Subject: [PATCH 013/107] refactor libvirt and qemu Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 629 +++++++++++---------- images/qemu-artifact/werf.inc.yaml | 2 +- images/virt-launcher/werf.inc.yaml | 2 +- 3 files changed, 325 insertions(+), 308 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 909c9558f..df451e00a 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -26,6 +26,14 @@ usage() { EOF exit 0 } +convert_version() { + local version="$1" + + # Split the version string into major, minor, and patch parts + IFS='.' read -r major minor patch <<< "$version" + # Construct the compact version by combining major and zero-padded minor + printf "%d%03d\n" "$major" "$minor" +} parse_args() { while [[ $# -gt 0 ]]; do @@ -57,6 +65,15 @@ parse_args() { usage fi ;; + -v|--libvirt-ver) + if [[ -n "$2" && "$2" != "-"* ]]; then + LIBVIRT_VERSION="$2" + shift 2 + else + echo "Error: Option '$1' requires a non-empty argument." + usage + fi + ;; -h|--help) usage ;; @@ -72,58 +89,65 @@ parse_args() { else SRC_BUILD="$SRC_BASE" fi + + if [ -z $LIBVIRT_VERSION ]; then + LIBVIRT_VERSION="10.10.0" + fi } parse_args $@ +# 10.10.0 -> 10010, 10.0.5 -> 10005 +lib_version=$(convert_version $LIBVIRT_VERSION) + # List of files and destinations FILE_LIST=$(cat < Date: Mon, 13 Jan 2025 17:29:25 +0300 Subject: [PATCH 014/107] virt-launcher: coment rm OVMF and add symlink Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index f01326e5f..39f8a8942 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -129,18 +129,18 @@ shell: - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: # Upgrade edk2-ovmf package to custom build and remove its package. - - | - # Temp disable - # ls -la - # rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm - # rm /edk2-ovmf-20231115-alt1.noarch.rpm + # - | + # # Temp disable + # ls -la + # rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm + # rm /edk2-ovmf-20231115-alt1.noarch.rpm # ======= # rpm -Uv /edk2-ovmf-20240811-alt2.noarch.rpm # rm /edk2-ovmf-20240811-alt2.noarch.rpm # Restructure firware files in /usr/share/OVMF to mimic structure # in edk2-ovmf package from the original kubevirt. - - | +# - | # cd /usr/share/OVMF # rm MICROVM.fd # rm OVMF.inteltdx.secboot.fd @@ -166,6 +166,9 @@ shell: cp -a -u -v /BINS/usr/* /usr cp -a -u -v /BINS/etc/* /etc rm -rf /BINS/ + + cd /usr/share/OVMF + ln -s /usr/share/OVMF/OVMF_CODE.cc.fd ../edk2/ovmf/OVMF_CODE.cc.fd # Create symlinc for libvirt - | SYMLINC_LIST=$(cat <<'EOF' From 0bf578db89af11a0a2286f06ed453fcad77b1c7a Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 13 Jan 2025 17:39:04 +0300 Subject: [PATCH 015/107] virt-launcher: add var for symlinks Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 90 ++++++++++++++++++------------ 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 39f8a8942..2ea38b77f 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -1,18 +1,22 @@ --- +{{- $versionLibvirt := "10.10.0" }} + image: {{ $.ImageName }} fromImage: base-alt-p11 import: # Before install stage. # Add edk2-ovmf package +- image: {{ $.ImageName }}-edk2-builder + add: /home/builder/RPM/RPMS/noarch + to: / + before: install + includePaths: + - edk2-ovmf-20231115-alt1.noarch.rpm + - edk2-ovmf-20240811-alt2.noarch.rpm + {{/* -# - image: {{ $.ImageName }}-edk2-builder -# add: /home/builder/RPM/RPMS/noarch -# to: / -# before: install -# includePaths: -# - edk2-ovmf-20231115-alt1.noarch.rpm -# - edk2-ovmf-20240811-alt2.noarch.rpm */}} + # Add bins from libvirt and qemu artifacts. - image: tmp-merged add: /VBINS @@ -129,37 +133,38 @@ shell: - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: # Upgrade edk2-ovmf package to custom build and remove its package. - # - | - # # Temp disable - # ls -la - # rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm - # rm /edk2-ovmf-20231115-alt1.noarch.rpm + - | + # Temp disable + ls -la + rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm + rm /edk2-ovmf-20231115-alt1.noarch.rpm # ======= # rpm -Uv /edk2-ovmf-20240811-alt2.noarch.rpm # rm /edk2-ovmf-20240811-alt2.noarch.rpm # Restructure firware files in /usr/share/OVMF to mimic structure # in edk2-ovmf package from the original kubevirt. -# - | -# cd /usr/share/OVMF -# rm MICROVM.fd -# rm OVMF.inteltdx.secboot.fd -# rm OVMF_CODE.fd -# rm OVMF_CODE.secboot.fd -# mv OVMF_CODE_4M.fd OVMF_CODE.cc.fd -# rm OVMF_CODE_4M.qcow2 -# mv OVMF_CODE_4M.secboot.fd OVMF_CODE.secboot.fd -# rm OVMF_CODE_4M.secboot.qcow2 -# rm OVMF_VARS.fd -# rm OVMF_VARS.ms.fd -# rm OVMF_VARS.secboot.fd -# mv OVMF_VARS_4M.fd OVMF_VARS.fd -# rm OVMF_VARS_4M.ms.fd -# rm -f OVMF_VARS_4M.ms.qcow2 -# rm -f OVMF_VARS_4M.qcow2 -# mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd -# rm -f OVMF_VARS_4M.secboot.qcow2 -# ls -la + - | + cd /usr/share/OVMF + rm MICROVM.fd + rm OVMF.inteltdx.secboot.fd + rm OVMF_CODE.fd + rm OVMF_CODE.secboot.fd + mv OVMF_CODE_4M.fd OVMF_CODE.cc.fd + rm OVMF_CODE_4M.qcow2 + mv OVMF_CODE_4M.secboot.fd OVMF_CODE.secboot.fd + rm OVMF_CODE_4M.secboot.qcow2 + rm OVMF_VARS.fd + rm OVMF_VARS.ms.fd + rm OVMF_VARS.secboot.fd + mv OVMF_VARS_4M.fd OVMF_VARS.fd + rm OVMF_VARS_4M.ms.fd + rm OVMF_VARS_4M.ms.qcow2 || true + rm OVMF_VARS_4M.qcow2 || true + mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd + rm OVMF_VARS_4M.secboot.qcow2 || true + ls -la + # Installation libvirt and qemu - | echo "Install libvirt and qemu binaries" @@ -171,17 +176,28 @@ shell: ln -s /usr/share/OVMF/OVMF_CODE.cc.fd ../edk2/ovmf/OVMF_CODE.cc.fd # Create symlinc for libvirt - | - SYMLINC_LIST=$(cat <<'EOF' - /usr/local/lib64/libvirt.so.0.10010.0 /lib64/libvirt.so.0 + convert_version() { + local version="$1" + IFS='.' read -r major minor patch <<< "$version" + printf "%d%03d\n" "$major" "$minor" + } + + libvirt_version=$(convert_version {{ $versionLibvirt }}) + + echo "libvirt_version: $libvirt_version" + + SYMLINC_LIST=$(cat < Date: Mon, 13 Jan 2025 20:13:52 +0300 Subject: [PATCH 016/107] add edk2 build Signed-off-by: Nikita Korolev fix packages for edk2 artifact Signed-off-by: Nikita Korolev ovmf: try to build with script Signed-off-by: Nikita Korolev --- images/virt-firmware-artifact/build.sh | 123 ++++++++++++++++++ images/virt-firmware-artifact/werf.inc.yaml | 131 ++++++++++++++++++++ 2 files changed, 254 insertions(+) create mode 100755 images/virt-firmware-artifact/build.sh create mode 100644 images/virt-firmware-artifact/werf.inc.yaml diff --git a/images/virt-firmware-artifact/build.sh b/images/virt-firmware-artifact/build.sh new file mode 100755 index 000000000..82fd990c0 --- /dev/null +++ b/images/virt-firmware-artifact/build.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +#!/usr/bin/env bash + +# Copyright 2024 Flant JSC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +# Source edksetup.sh +versionEdk2=stable202411 +gitRepoName=edk2 + +export EDK_TOOLS_PATH="/${gitRepoName}-${versionEdk2}/BaseTools" +export PACKAGES_PATH="/${gitRepoName}-${versionEdk2}/BaseTools:/edk2-platforms:/edk2-staging" + +cd "/${gitRepoName}-${versionEdk2}" +. edksetup.sh + +# Ensure the Build directory is clean +rm -rf Build/* + +# Build OVMF firmware +build_ovmf() { + local target=$1 + local out_code=$2 + local out_vars=$3 + local dsc_file=$4 + local build_dir=$5 + local build_opts=$6 + + build -a X64 -t GCC5 -p $dsc_file -b RELEASE $build_opts + cp $build_dir/RELEASE_GCC5/FV/$(basename $out_code) /FIRMWARE/$(basename $out_code) + if [[ -n "$out_vars" ]]; then + cp $build_dir/RELEASE_GCC5/FV/$(basename $out_vars) /FIRMWARE/$(basename $out_vars) + fi + rm -rf Build/* +} + +# Build Standard OVMF +build_ovmf "Standard OVMF" \ + "/FIRMWARE/OVMF_CODE.fd" \ + "/FIRMWARE/OVMF_VARS.fd" \ + "OvmfPkg/OvmfPkgX64.dsc" \ + "Build/OvmfX64" \ + "" + +# Build Secure Boot OVMF +build_ovmf "Secure Boot OVMF" \ + "/FIRMWARE/OVMF_CODE.secboot.fd" \ + "/FIRMWARE/OVMF_VARS.secboot.fd" \ + "OvmfPkg/OvmfPkgX64.dsc" \ + "Build/OvmfX64" \ + "-D SECURE_BOOT_ENABLE" + +# Build Confidential Computing OVMF +build_ovmf "Confidential Computing OVMF" \ + "/FIRMWARE/OVMF_CODE.cc.fd" \ + "" \ + "OvmfPkg/OvmfQemuCc.dsc" \ + "Build/OvmfQemuCc" \ + "" + +# Build AMD SEV OVMF +build_ovmf "AMD SEV OVMF" \ + "/FIRMWARE/OVMF.amdsev.fd" \ + "" \ + "OvmfPkg/OvmfPkgX64.dsc" \ + "Build/OvmfX64" \ + "-D AMD_SEV=TRUE" + +# Build Intel TDX OVMF +build_ovmf "Intel TDX OVMF" \ + "/FIRMWARE/OVMF.inteltdx.fd" \ + "" \ + "OvmfPkg/OvmfQemuTdx.dsc" \ + "Build/OvmfQemuTdx" \ + "" + +# Build Intel TDX Secure Boot OVMF +build_ovmf "Intel TDX Secure Boot OVMF" \ + "/FIRMWARE/OVMF.inteltdx.secboot.fd" \ + "" \ + "OvmfPkg/OvmfQemuTdx.dsc" \ + "Build/OvmfQemuTdx" \ + "-D SECURE_BOOT_ENABLE" + +# Build UEFI Shell +build -a X64 -t GCC5 -p ShellPkg/ShellPkg.dsc -b RELEASE +cp Build/Shell/RELEASE_GCC5/X64/Shell.efi /FIRMWARE/Shell.efi +rm -rf Build/* + +# Create UEFI Shell ISO +mkdir -p /iso/efi/boot +cp /FIRMWARE/Shell.efi /iso/efi/boot/bootx64.efi +genisoimage -o /FIRMWARE/UefiShell.iso -efi-boot-part --efi-boot-image -no-emul-boot /iso +rm -rf /iso + +# Build EnrollDefaultKeys.efi from edk2-apps +cd /edk2-apps +. ../edk2/edksetup.sh + +# Build EnrollDefaultKeys.efi +build -a X64 -t GCC5 -p SecMainPkg/SecMainPkg.dsc -m SecureBootEnrollDefaultKeys/EnrollDefaultKeys.inf -b RELEASE +cp Build/SecMainPkg/RELEASE_GCC5/X64/EnrollDefaultKeys.efi /FIRMWARE/EnrollDefaultKeys.efi +rm -rf Build/* + +# Build DBXUpdate binary +cd /openssl req -new -x509 -newkey rsa:2048 -subj "/CN=Test DBX Update/" -keyout dbxupdate_key.pem -out dbxupdate_cert.pem -nodes -days 365 +sbattach --remove /FIRMWARE/EnrollDefaultKeys.efi +sbattach --attach dbxupdate_cert.pem /FIRMWARE/EnrollDefaultKeys.efi +cp /FIRMWARE/EnrollDefaultKeys.efi /FIRMWARE/DBXUpdate-20230509.x64.bin \ No newline at end of file diff --git a/images/virt-firmware-artifact/werf.inc.yaml b/images/virt-firmware-artifact/werf.inc.yaml new file mode 100644 index 000000000..ac5b1fa4e --- /dev/null +++ b/images/virt-firmware-artifact/werf.inc.yaml @@ -0,0 +1,131 @@ +--- +{{- $versionEdk2 := "stable202411" }} +{{- $gitRepoUrl := "https://github.com/tianocore/edk2.git" }} +{{- $gitRepoName := "edk2" }} + +image: {{ $.ImageName }} +final: false +fromImage: base-alt-p11 +git: +- add: /images/{{ $.ImageName }}/ + to: / + includePaths: + - build.sh + stageDependencies: + setup: + - build.sh +shell: + beforeInstall: + - | + apt-get update && apt-get install -y \ + gcc gcc-c++ \ + git \ + bash-completion \ + clang \ + ccache \ + make cmake \ + python3 python3-dev \ + python3-tools python3-module-setuptools \ + python3-module-pip \ + nasm acpica libssl-devel libdwarf-devel libuuid-devel bison flex wget \ + dosfstools mtools genisoimage binutils-devel \ + qemu-kvm-core \ + iasl \ + python3-modules-sqlite3 python3-module-virt-firmware libuuid-devel \ + qemu-img xorriso libssl-devel \ + bc zlib-devel perl-PathTools perl-IPC-Cmd perl-JSON + + apt-get clean + rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin + + install: + - | + git clone --depth=1 --branch {{ $gitRepoName }}-{{ $versionEdk2 }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionEdk2 }} + + git clone https://github.com/tianocore/edk2-platforms.git + git clone https://github.com/tianocore/edk2-staging.git + + cd {{ $gitRepoName }}-{{ $versionEdk2 }} + git submodule update --init --recursive + + # Set env edk + export EDK_TOOLS_PATH=$(pwd)/BaseTools + export PACKAGES_PATH=$(pwd)/BaseTools:/edk2-platforms:/edk2-staging + + echo "Building BaseTools..." + ln /usr/bin/python3 /usr/bin/python + make -C BaseTools -j$(nproc) + + # Set up the build environment + echo "Setting up the build environment..." + . edksetup.sh BaseTools + + mkdir -p /FIRMWARE +{{/* + + # #========== + # # Create a clean Build directory + # rm -rf Build/* + + # # Build OVMF_CODE.fd and OVMF_VARS.fd (Standard OVMF) + # build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc -b RELEASE + # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_CODE.fd /FIRMWARE/OVMF_CODE.fd + # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_VARS.fd /FIRMWARE/OVMF_VARS.fd + + # # Clean Build directory + # rm -rf Build/* + + # # Build OVMF_CODE.secboot.fd and OVMF_VARS.secboot.fd (Secure Boot enabled) + # build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc -b RELEASE -D SECURE_BOOT_ENABLE + # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_CODE.fd /FIRMWARE/OVMF_CODE.secboot.fd + # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_VARS.fd /FIRMWARE/OVMF_VARS.secboot.fd + + # # Clean Build directory + # rm -rf Build/* + + # # Build OVMF_CODE.cc.fd (Confidential Computing) + # build -a X64 -t GCC5 -p OvmfPkg/OvmfQemuCc.dsc -b RELEASE + # cp Build/OvmfQemuCc/RELEASE_GCC5/FV/OVMF_CODE.fd /FIRMWARE/OVMF_CODE.cc.fd + + # # Clean Build directory + # rm -rf Build/* + + # # Build OVMF.amdsev.fd (AMD SEV) + # build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc -b RELEASE -D AMD_SEV=TRUE + # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/OVMF.amdsev.fd + + # # Clean Build directory + # rm -rf Build/* + + # # Build OVMF.inteltdx.fd (Intel TDX) + # build -a X64 -t GCC5 -p OvmfPkg/OvmfQemuTdx.dsc -b RELEASE + # cp Build/OvmfQemuTdx/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/OVMF.inteltdx.fd + + # # Clean Build directory + # rm -rf Build/* + + # # Build OVMF.inteltdx.secboot.fd (Intel TDX with Secure Boot) + # build -a X64 -t GCC5 -p OvmfPkg/OvmfQemuTdx.dsc -b RELEASE -D SECURE_BOOT_ENABLE + # cp Build/OvmfQemuTdx/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/OVMF.inteltdx.secboot.fd + # #========== + + # # source edksetup.sh + + # # Build the firmware + # echo "Building the firmware..." + # build --cmd-len=65536 -p OvmfPkg/OvmfPkgX64.dsc -a X64 -b RELEASE -t GCC5 + + # # Create the FIRMWARE directory if it doesn't exist + # mkdir -p /FIRMWARE + + # # Copy the built firmware to the FIRMWARE directory + # echo "Copying firmware to FIRMWARE directory..." + # cp -v Build/OvmfX64/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/ + + # echo "Build completed successfully. Firmware is located in the FIRMWARE directory." +*/}} + setup: + - | + /build.sh + + ls -lah /FIRMWARE From e452f3e5eee90c672a59deb1d3d1d6da82c0929b Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 14 Jan 2025 10:38:53 +0300 Subject: [PATCH 017/107] qemu: chnage build Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 33 ++- images/libvirt-artifact/werf.inc.yaml | 2 +- images/qemu-artifact/install-qemu.sh | 279 ++++++++++++++++++++ images/qemu-artifact/werf.inc.yaml | 15 +- images/virt-firmware-artifact/werf.inc.yaml | 10 +- images/virt-launcher/werf.inc.yaml | 22 +- 6 files changed, 329 insertions(+), 32 deletions(-) create mode 100755 images/qemu-artifact/install-qemu.sh diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index df451e00a..b6ad750fd 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -65,9 +65,9 @@ parse_args() { usage fi ;; - -v|--libvirt-ver) + -v|--version-num) if [[ -n "$2" && "$2" != "-"* ]]; then - LIBVIRT_VERSION="$2" + VERSION_NUM="$2" shift 2 else echo "Error: Option '$1' requires a non-empty argument." @@ -90,15 +90,15 @@ parse_args() { SRC_BUILD="$SRC_BASE" fi - if [ -z $LIBVIRT_VERSION ]; then - LIBVIRT_VERSION="10.10.0" + if [ -z $VERSION_NUM ]; then + VERSION_NUM="10.10.0" fi } parse_args $@ # 10.10.0 -> 10010, 10.0.5 -> 10005 -lib_version=$(convert_version $LIBVIRT_VERSION) +lib_version=$(convert_version $VERSION_NUM) # List of files and destinations FILE_LIST=$(cat < Date: Tue, 14 Jan 2025 15:40:03 +0300 Subject: [PATCH 018/107] qemu: add feat numa,balloon,trim Signed-off-by: Nikita Korolev --- images/qemu-artifact/install-qemu.sh | 23 +- images/qemu-artifact/werf.inc.yaml | 10 +- images/virt-firmware-artifact/build.sh | 208 +++++++++--------- images/virt-firmware-artifact/build_old.sh | 220 ++++++++++++++++++++ images/virt-firmware-artifact/werf.inc.yaml | 15 +- images/virt-launcher/werf.inc.yaml | 6 +- 6 files changed, 363 insertions(+), 119 deletions(-) create mode 100755 images/virt-firmware-artifact/build_old.sh diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 724818b5b..0f4e7f09b 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -92,6 +92,7 @@ parse_args $@ FILE_LIST=$(cat < Date: Thu, 16 Jan 2025 16:33:28 +0300 Subject: [PATCH 019/107] fix build iso edk, copy OVMF to virt-launcher Signed-off-by: Nikita Korolev minimize script output Signed-off-by: Nikita Korolev qemu change '/usr/local/bin' to '/usr/bin' Signed-off-by: Nikita Korolev add xorriso pkg to virt-launcher Signed-off-by: Nikita Korolev --- images/qemu-artifact/install-qemu.sh | 22 ++-- images/virt-firmware-artifact/Logo.bmp | Bin 0 -> 300138 bytes images/virt-firmware-artifact/build.sh | 55 ++++++++-- images/virt-firmware-artifact/werf.inc.yaml | 74 +------------ images/virt-launcher/werf.inc.yaml | 112 +++++++++++--------- 5 files changed, 124 insertions(+), 139 deletions(-) create mode 100644 images/virt-firmware-artifact/Logo.bmp diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 0f4e7f09b..d662f274e 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -91,19 +91,19 @@ parse_args $@ FILE_LIST=$(cat <Ybb0J0jp2qG1Ri!>6DHh|Qm zNwW(ijVtLt(3a^0#S7Pv4Mpd3i}L-`kIPdK!{5XU_R?&c_*E z-nT#dyMO%mZ{I!N{+0j!ng1St>+bIV`2V-={*>Q$cmMrw-@g0qAKkt9@5O-^znWky`skylPoJJjvJk5;zx)!%b__eFLm&k1A%QQx z_~O~KXXlZuCRVtFWA_l}jxKXgIooaJY%c9cKc-JW0CD*0tFI6TwlhdpiB)rn-4j5X zb>ZE2-~CiJc4w=0C*FDI9clV0yIqy%2M~l0KKP*BQyLR~v-`;>pENiW%Fd*Pb`bko zlO}Jy^;VrK3l!!&DdSZ5?6c1pE#(hG2$z@-&s{H~&@Kj`9zT9uH6J~CRGqd0_UkMK z$XJEt9a+Qd-U|YZy&82CUae#?8d(OaKZAjN2D~VMddu!|ugEoR+ov9;IH^$pLx1V}l-d)hjb@muYghcNMCt0NUzWy<$|%nNqWq zdpTMzBiaRJizs?!Kwh_99Ue96IC!vRO^Ox%^dt6E7sw=~&(ndo<5>-}l)4%t~!(X0N_~5ul`AEr{6RYM=J!ZK!x&!K)8f>Lk0MS)mZc zK03ft9ebQr7p@Pvw?kW&QEYWf8Y^eB+4qP)ctTqqTTPxV`&fux^_M0`t|h=otD)W( zj*+afSmD)~-)h)NugvTugbzRbu)kzB0PKE*c1?=^MZKbx_4V<`A6s82l4&E7SaqUT zg(8L31p3>e4a>bH>!MiU4^FNQaPNjDEbK1tai9`*UFOUp8g{*`chi|Uk^@hgK?`%C z9R^SN6TK=FDXb$fx#+O*&+dMbwM49%Kf1D57wk^0ERp#bj@;L6az4|Xp_wx$(aLt#R6-{_T65q@t7acBVpf}L+59Qb&67C=#*|v1ti~zZjIobsc}HeB zyC)}LS5}9;l^HghE5>rM!WqrwQ&Ba&GHz`b!I@mr&Z&f@BrkXjLbjQh)wE08XLqYV z=Sf*p4I!vfp{h`YIb}0XqE|&Mg@pwAHyI|=tsR`qxP=`}RwSvUiIj5WK6&Y zp$_}Ly!rgfva;_{kKpP!mREIlxn2>D&6MU;0$J18t(8S;uh-gHQ;F4jWwW@!V6d9C z95zq5SDLG}tHZLt?lx@th^(W5FjkK#oS%SQcTJGK+z*>g0<^K+_p3)3hnsY|t&ywr zif}Z2=JW~=?Sr<;dUL+Nh*rUpx6kfYf8a^0KtsJ2bCYe9);zB%rFk-#G^$?FsYPTV z_jW861#YIYdyfb(!h9?FNFu zKfmuC0j{qNp202yV7~w@3kGg*s)qD_{#qAcC~k#VzruF3y4`t zs*z^FENg{p%XBxkIp>c~uCRb^jJvMzCx-;01jflzm<0%Ddnx01Ntv=u`F;_&>bq&& zl=q8nGAri>b`9zM{JGZh61}n&O3lGcRV+Hhc`iNY_;9@WPm-=^J82d>#iV~db+QQu zX=OK;8}(|kqk(R>`h~heNZ~#bund|U40W*P1A9bz9_3sY-4eaB`+o5p>lOZx^8FL4 zx-P9?6)K8#a%aZbRlUOa63ObtiiWCJ7%{i$sN|aFqllHrpEbP## z-^{*N>$4vJwMQK)ST5O7Pbe1$jJGR@^VF~A)vyk-#G@fm^xaX1g6W+^pdm-n@KP17shmLxH2 zV;*b3*)1QqA{7*cO4zEP1#A*B%V#z^)xU{HVuGS=+JrJQ5OsitR-x^hC-gO0O%Ku? ztuTl`hy%WjTa}Y0BiO-7+EQrtDYQ*%a)d7Ej;-&AnjCy_@)NwGvbvh`eIdX_BxU-! zx2DOs%ox}^SjOSlhrwCyvjj+(I=1(ASnb1S;9h@Qqr4`t%QyUg^#XWa5&68db zHuNW^LO=;{b7A=6ISgp9+$28&I!L+cpSFWPRM4euaA+Vohao0a4gw~5KjxMUu!U_?qBQIk5 z3W19Rc9Jaauot`DumVvml%VC+B32t-pqL7Qtq5!`S%mf3cZr27R=~)O=yz`SrMyK4bC_d0zHA%lErL_SFd@3goWPh@ke;%%bV)B zH2Dd8W>&{vk@Oe>dl0xvvY3SMR?@-GsjiJ0_n7Z3Un*v1buHo44}n)m;G$%);5yG# zYB?z4V$y~4gGpD!YB|r;41tpn=q0O7rFe~;rPeJ@zWK*@%YSa^XwbI3Ak(zYn?`x4P^vDkwXcRh9b!BBst0 zqqeobHc6t@Sp!&ZQ>X7`?uap`?I2Q&pg%}iS)1cL8M1~}7AVkT1yu!P$70tel;^Np z_=Tk`Q!sRRt7l)g^5%N=)jvGIPYg|b7=e>RO9ziN(Nmi8n3~HYZGy;H3bb8wW3HOD zog4Gxq%$MzYEt8^HD97vv}%8azBk?>=}(vRd~fP-_nb@(&Bs2N4fTqSCLJIVRIdirDrKsmx!;_h%iL@ekS`L4jZ@WWUyaoeGcNqpWl{5A^AQV{ z6s-=eh@IvA9g%Wg&W1C>9p>&?}}`n0+wY+zphx7{q8n)wUIkz-qms3v)ny(-DA*OJrI^Q zT6E}Aw!x_}TLS8-tMrPb&`vd9)TWL6$!g{jp*0KE1>Myt?Se81rOs@qSLVN2RyS-) zGgs3L;&!iBswAkriC%T8AuCwBj+~mb(0fwV>{Rrsn9mh<(kosceHfc987yHZ2UrW- z#6fA;IPddFD=!(+)Hhw7bj&in`sI^HP02Y0pcm#XgPOO@uP|XizS^{63hH5(f&0Igx|&iTCL;@XwX{EFq<=0ChU`T#cWgSyC~YzeEQ*W!J(dNnz! z=XBDJPqwY-6o@I?je14$E)fu0#MNA-JgkDn)eGQ~?yxqeR~E0Wpvw&kAXOvfN%Tr7 zEh+Cbzj_#t+__`wFynp-QWK)N_xG%tUWK z%8P2&R(mlEgLMS0mJDgCEg99;FT2evTMy1fL}ey3n!KCq63A!{|8U$x<3ZQHJ`9E-eNT;ti=F1fOkoj%BeJL%Pv`~Srp8z-!T+5oVe zoy;j}T3YGgG2IyG1FdXG&s8>WC+A4kZ)Hut$emkc**wAW%ko#H#@w5Wf_TlDz9vUh zKn7osu}e_#*0s1%uZ%|TYIUTGXq+#NwTr7_SZ(d9OD2@He9-QRI!-KQ z`b1#ZShDCqvJuEA)zsFSlx;}QC4~usdRqpqUv*nEmxO97-)h(jcw%|ChhEXw7_UX4 z>8}n$KxK`x#@lLY)RS7#s;M2VX3|Qv$%g|rkm|;Val5#aPFnNvY+MOE$ns8lh1q+( zF~P9hL=Y+>TR`yyxK34Jxn40!$pXe9X6dDFzRi>k>7Ded|56P8Yse%!PU5O=o9Gqs z(vfbaNGcJHiFv}6LY-<(2r--KHJ>-vE1a>bOh@Voq4l2Vt;8-a%?S+@Elhs*lBj2^ z+Urx;L$CM>;Tzw%-v}*bEHR1A)Qo{=0ozE{vu0cspp956+rhcrk}rm_*3qP>uB~6q zU;H-_Xx0dG@_0LISS&Y{iMdy9>09pZ{N% znQDYCiYEoE>DemJdBXA1)j@OafFQz+GS~_@ti8X6R-0M z=xvJ^xxm`R${LzhZdXU6?x&_&U(4XNDCXo&TWR?>1ldFCbuJ^e_#8uvbt1Vzix%i^@@Kt=e}=DPIRcujT0O5 z_NY98VYHYc+W$6CtQStGNnUIC%c zccM1V#fm7XU#L0WoNr-rs(@D$Eof+Zyj`7UM1Ny&&J&t&efwJ;&1qG}+uVs;#-trx zpK8CaTX|c(dKh2BseEi>X>JluM$}-VpxtF^}eJ|)g-$SJz^wNAb=YcLf?BkHPEX;*JbTup&YORIgW?;iMRO7jRRAyj`mAg z8&XFli|LIzpq2G_Syoe3rj>HT8Rb^hv{1(FV6%e-3gb?-;e#)4s8?V9;@&@I=W;W^ zRE5wk9lAOmtR}7Y7+2U-e@IF7;Z)^;UY*L%at5|_Z_)`>RY>7%1h&$vhapy69h;4h zhq2zEQ59~5b$#pp$Ssnsj$d1N7`bF(H{gA1*m&rP;BbSb6= z1UAvDj~~jvKgd){Co`1C^Lbkm>Wf&WdxJ|bKJ_s4%I2b{nk6DxT5!Ovel@;` zIlC2s8}*7mef*IAeP`~ZIyeW5!N$K0b#20tb}D*>($*+FvtHpOAIuFNXzTTjUez_d zSm5r@9h^j9QmTXDV#7g&6?(-R3p`inbHJUHiqKe05hi0}t1t%y^c3q9x~^?JxoQoo zaw}}ESL)u$%Y)}vC)cYn*yz=m&*a%AR)&u67BLd$9tcm`v4i}h%*f92A8WqhE`c!M z(I|`YV9DAlB0k6?mfE&5duBVRy*}#EVadfU6ci@EpLp8P)bqiz@wEOQ?^rKZn$#>? zww-hx7GRr7k=pHBeAQISJlEYwR#8nM1kOfaE3vASC*O~ckxt8j+Y6DbQR zMF%#iz#8y&jWP?7tW7RWjD)~e1a=ZD693?D6VRQh%_h5%tgS{`?1aFL1ojgvwBq2m zN9b-7f$EJ!vTht^X&wT%6WCR(TGk)-E)%f~-m2;)=-MNZtlP(1EQG)<1o#ruwP|~8 zeZDqwi-*hG@{-lHzFk|N7fqM@lbRtA0-F1WrN#wPB`l%j|`f+TO9;@+JeJv1mO&RQHB3X}|qJ z41TZMZfw4;)7x9MKLE1Y&g$mJH(VX#gKx+j23cUWceDNS+Rzt$w{6{z5C`J ze}{1H=kbr9|LrgSZrD{D^*{UR-P2#)J^S_7Kl~Z7&wswu&IjLr{x`>HQq7gUF^LPJZglo_*Jq|e25GBvHApzD<%T;36w;Ir&<(}9-gS8=$)ut?GEm>@L zJd!V}O|wR(^jVMpOsfWITb@idud@_XuMiVUOr|2WS?nwHYGKHD_1RCV+iw(*4t0L6 zjH|ZwIy~7Hsba3@QxR=q6Yp!KUXXthut zn~`4Yjv12=ua|3AVfzud>Ur9!R)UR*<*beNxm||6ZG9rNCr)G;S;;>tWTrT)Td#E_ z8a6-p%R82Dy_8uhsqxCtUJcA`i~U-?vgY_e*TjX-bVQ+d+a8hiQPYaH{7jxIVip?x zmYPvuSAkSq%r?!XFW-AUt;H*T=+qjj+3Grlbp)<@%DvMEaF|`b7{uXqk?z{cl8#;7 z82k)lMzxNA$_)ETkXGLkp>m|Gkr8I3ELiqY&Hm9eo>_hRlW#O9m2^|f?Nq-KP z7JKhA^-VX*=RWtbUuRoK?3w~#tu`#E+mzq`=GyJUZmCFgPH#2XKZ!NgE-J5!bk|lkhE1=k>qp%qWgYD%IC`oqP(ZS% zSwEG1_K3cohihBPmP#rwnx0LsY$eFS>aNUM>}s&;%;^=Ct<&B=HM$vnaV3^H@5A5A4qPo#-N(<78Q(r*^~WSu#^ zGChRA+-B-gb0I$6QztRlZ`RAChqM9()(FSEZT1@|=xKM|+%`edycm?9yj-AZoi;nVHX^ma%)$Jeo3L5zlWJfJ0ED(# z$dhebO%wA{He0n#k~a?vc=6$g1*<41cXH7u4WlAnKk7S3q2j=B{-J6T4zwMRMI-P>y=ugJTPdnPioHXdNrp@bH|G|1@ln# z3KXkWf1XzStN6n4Qulh@K z{E_jjrk&kGtXibYCF_K5GPDqE*pKzf?$I@MAvH8#K7M=p*@$Imt&HrcvL#v#Dvl#@ z_4Cf3*O_nhj#uUnMRr=l$5Is1lCl)*X)<*!X-(D8fAGJ@p#H8v_ur74= zc#B>caEp$!u&tl+$JVxpTff;Q=F()_kihsM(%xd#0=Xzz=X{f)Id2Iy)+Vr1Nf}WygvuRCgI`{nai_KiZ2ob585YXk;&#-Q$-1zmYy1*#clzrP0GDUHh_GI=3>bB&}-d|dPVOS z6@HS{63Lo$xW${_HxjTf@x3asYEkr(b=o%>n!}c}n$C4y7~y>`Pu8RfmFMz^<2J{r zE~>zst?#Qz2hIDeZw*yjRIfP85=qZeu6GYCc4|)QEe35SS>Cn+UfCm~>JcepRW<4M z?RrJ;DAJ@_j(tYP2Ms4x&O*-aEd=V1B)nR&Y9W|po%T(J=B?!{Pe0mYkoKENg*^{x znMgYHlPkS~WCZ!hC+uV^zp*o!v)V+<^iGr391oF;ar4p#3Z_?>rLF$pTiYylI&E9) zowNMddg|*MQ~zrr)1-w=p$tw{e?Fg_^hzr)tb>!w`z`wz$HNs3%R&n42=I?n@CfS+ zV%7XF$vX3!49!)Bt0w!BGB@;#)1-CRadj(oyVt8ZvljbUUgnJCcnDlefHl{7#Hu;p zB&1 > /dev/null ls -lah /FIRMWARE -{{/* - - # #========== - # # Create a clean Build directory - # rm -rf Build/* - - # # Build OVMF_CODE.fd and OVMF_VARS.fd (Standard OVMF) - # build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc -b RELEASE - # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_CODE.fd /FIRMWARE/OVMF_CODE.fd - # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_VARS.fd /FIRMWARE/OVMF_VARS.fd - - # # Clean Build directory - # rm -rf Build/* - - # # Build OVMF_CODE.secboot.fd and OVMF_VARS.secboot.fd (Secure Boot enabled) - # build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc -b RELEASE -D SECURE_BOOT_ENABLE - # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_CODE.fd /FIRMWARE/OVMF_CODE.secboot.fd - # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF_VARS.fd /FIRMWARE/OVMF_VARS.secboot.fd - - # # Clean Build directory - # rm -rf Build/* - - # # Build OVMF_CODE.cc.fd (Confidential Computing) - # build -a X64 -t GCC5 -p OvmfPkg/OvmfQemuCc.dsc -b RELEASE - # cp Build/OvmfQemuCc/RELEASE_GCC5/FV/OVMF_CODE.fd /FIRMWARE/OVMF_CODE.cc.fd - - # # Clean Build directory - # rm -rf Build/* - - # # Build OVMF.amdsev.fd (AMD SEV) - # build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc -b RELEASE -D AMD_SEV=TRUE - # cp Build/OvmfX64/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/OVMF.amdsev.fd - - # # Clean Build directory - # rm -rf Build/* - - # # Build OVMF.inteltdx.fd (Intel TDX) - # build -a X64 -t GCC5 -p OvmfPkg/OvmfQemuTdx.dsc -b RELEASE - # cp Build/OvmfQemuTdx/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/OVMF.inteltdx.fd - - # # Clean Build directory - # rm -rf Build/* - - # # Build OVMF.inteltdx.secboot.fd (Intel TDX with Secure Boot) - # build -a X64 -t GCC5 -p OvmfPkg/OvmfQemuTdx.dsc -b RELEASE -D SECURE_BOOT_ENABLE - # cp Build/OvmfQemuTdx/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/OVMF.inteltdx.secboot.fd - # #========== - - # # source edksetup.sh - - # # Build the firmware - # echo "Building the firmware..." - # build --cmd-len=65536 -p OvmfPkg/OvmfPkgX64.dsc -a X64 -b RELEASE -t GCC5 - - # # Create the FIRMWARE directory if it doesn't exist - # mkdir -p /FIRMWARE - - # # Copy the built firmware to the FIRMWARE directory - # echo "Copying firmware to FIRMWARE directory..." - # cp -v Build/OvmfX64/RELEASE_GCC5/FV/OVMF.fd /FIRMWARE/ - - # echo "Build completed successfully. Firmware is located in the FIRMWARE directory." - # setup: - # - | - # /build.sh - - # ls -lah /FIRMWARE -*/}} diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index f45990db2..925e278ec 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -5,16 +5,16 @@ image: {{ $.ImageName }} fromImage: base-alt-p11 import: # Before install stage. -# Add edk2-ovmf package -- image: {{ $.ImageName }}-edk2-builder - add: /home/builder/RPM/RPMS/noarch - to: / - before: install - includePaths: - - edk2-ovmf-20231115-alt1.noarch.rpm - - edk2-ovmf-20240811-alt2.noarch.rpm - {{/* +# # Add edk2-ovmf package +# - image: {{ $.ImageName }}-edk2-builder +# add: /home/builder/RPM/RPMS/noarch +# to: / +# before: install +# includePaths: +# - edk2-ovmf-20231115-alt1.noarch.rpm +# - edk2-ovmf-20240811-alt2.noarch.rpm + */}} # Add bins from libvirt and qemu artifacts. @@ -22,15 +22,21 @@ import: add: /VBINS to: /BINS before: install +- image: virt-firmware-artifact + add: /FIRMWARE/ + to: /usr/share/OVMF + before: install # After install stage. -# Add libxcrypto library. -- image: {{ $.ImageName }}-libxcrypt-builder - add: /usr/local/lib/ - to: /lib64 - after: install - includePaths: - - libcrypt.so.2.0.0 +{{/* +# # Add libxcrypto library. +# - image: {{ $.ImageName }}-libxcrypt-builder +# add: /usr/local/lib/ +# to: /lib64 +# after: install +# includePaths: +# - libcrypt.so.2.0.0 +*/}} # Add liboverride library. - image: {{ $.ImageName }}-liboverride-builder @@ -107,14 +113,12 @@ shell: acl \ pcre \ procps \ - seavgabios seabios \ ethtool \ nftables \ - xorriso \ passt \ - ipxe-roms-qemu \ libffi8 \ swtpm-tools \ + xorriso \ libcrypt libcrypto3 \ libjson-c5 libtirpc libbsd libiscsi libglusterfs11 libnuma \ libcap-ng libcurl libaudit libfuse libnbd libblkid libgcrypt20 \ @@ -129,47 +133,55 @@ shell: libpulseaudio pipewire-libs libaio liburing \ libblkio libglusterfs11-api libnfs librbd1 librados2 - # libspice-server pipewire-jack-libs - # seavgabios \ - # seabios \ + # xorriso \ + # pipewire-jack-libs \ + # ipxe-roms-qemu \ + # seavgabios seabios \ # libvirt-client==10.2.0-alt1 \ # libvirt-daemon-driver-qemu==10.2.0-alt1 \ # qemu-kvm-core==9.0.2-alt2 - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: +{{/* # Upgrade edk2-ovmf package to custom build and remove its package. - - | - # Temp disable - ls -la - rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm - rm /edk2-ovmf-20231115-alt1.noarch.rpm - # ======= - # rpm -Uv /edk2-ovmf-20240811-alt2.noarch.rpm - # rm /edk2-ovmf-20240811-alt2.noarch.rpm + # - | + # # Temp disable + # ls -la + # rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm + # rm /edk2-ovmf-20231115-alt1.noarch.rpm + # # ======= + # # rpm -Uv /edk2-ovmf-20240811-alt2.noarch.rpm + # # rm /edk2-ovmf-20240811-alt2.noarch.rpm # Restructure firware files in /usr/share/OVMF to mimic structure # in edk2-ovmf package from the original kubevirt. +*/}} - | - cd /usr/share/OVMF - rm MICROVM.fd - rm OVMF.inteltdx.secboot.fd - rm OVMF_CODE.fd - rm OVMF_CODE.secboot.fd - mv OVMF_CODE_4M.fd OVMF_CODE.cc.fd - rm OVMF_CODE_4M.qcow2 - mv OVMF_CODE_4M.secboot.fd OVMF_CODE.secboot.fd - rm OVMF_CODE_4M.secboot.qcow2 - rm OVMF_VARS.fd - rm OVMF_VARS.ms.fd - rm OVMF_VARS.secboot.fd - mv OVMF_VARS_4M.fd OVMF_VARS.fd - rm OVMF_VARS_4M.ms.fd - rm OVMF_VARS_4M.ms.qcow2 || true - rm OVMF_VARS_4M.qcow2 || true - mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd - rm OVMF_VARS_4M.secboot.qcow2 || true - ls -la + # Link to dir OVMF + mkdir -p /usr/share/edk2 + ln -s /usr/share/OVMF /usr/share/edk2/ovmf + ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd + + # cd /usr/share/OVMF + # rm MICROVM.fd + # rm OVMF.inteltdx.secboot.fd + # rm OVMF_CODE.fd + # rm OVMF_CODE.secboot.fd + # mv OVMF_CODE_4M.fd OVMF_CODE.cc.fd + # rm OVMF_CODE_4M.qcow2 + # mv OVMF_CODE_4M.secboot.fd OVMF_CODE.secboot.fd + # rm OVMF_CODE_4M.secboot.qcow2 + # rm OVMF_VARS.fd + # rm OVMF_VARS.ms.fd + # rm OVMF_VARS.secboot.fd + # mv OVMF_VARS_4M.fd OVMF_VARS.fd + # rm OVMF_VARS_4M.ms.fd + # rm OVMF_VARS_4M.ms.qcow2 || true + # rm OVMF_VARS_4M.qcow2 || true + # mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd + # rm OVMF_VARS_4M.secboot.qcow2 || true + # ls -la # Installation libvirt and qemu - | @@ -220,7 +232,7 @@ shell: # Create qemu group and user. - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home # Create links to required for virt-launcher libs. - - ln -s /lib64/libcrypt.so.2.0.0 /lib64/libcrypt.so.2 + # - ln -s /lib64/libcrypt.so.2.0.0 /lib64/libcrypt.so.2 # - ln -s /lib64/libpcre.so.1.2.13 /lib64/libpcre.so.1 - | [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp From 456325db1b7fb91559d93e8093b858ea3c9efbdd Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 17 Jan 2025 02:03:26 +0300 Subject: [PATCH 020/107] qemu change folder for all from '/usr/local/*' to '/usr/*' Signed-off-by: Nikita Korolev edk2: try with enrol Signed-off-by: Nikita Korolev add json cfgs Signed-off-by: Nikita Korolev add import json Signed-off-by: Nikita Korolev back ubuntu-22.04 to job Signed-off-by: Nikita Korolev --- images/qemu-artifact/install-qemu.sh | 272 +++++++++--------- images/virt-firmware-artifact/build.sh | 35 +-- images/virt-firmware-artifact/build_old.sh | 220 -------------- ...30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json | 36 +++ .../json/30-edk2-ovmf-ia32-sb-enrolled.json | 36 +++ .../31-edk2-ovmf-2m-raw-x64-sb-enrolled.json | 36 +++ .../json/40-edk2-ovmf-4m-qcow2-x64-sb.json | 35 +++ .../json/40-edk2-ovmf-ia32-sb.json | 35 +++ .../json/41-edk2-ovmf-2m-raw-x64-sb.json | 35 +++ .../json/50-edk2-ovmf-4m-qcow2-x64-nosb.json | 36 +++ .../json/50-edk2-ovmf-ia32-nosb.json | 34 +++ .../json/50-edk2-ovmf-x64-microvm.json | 22 ++ .../json/51-edk2-ovmf-2m-raw-x64-nosb.json | 36 +++ .../json/60-edk2-ovmf-x64-amdsev.json | 31 ++ .../json/60-edk2-ovmf-x64-inteltdx.json | 27 ++ images/virt-firmware-artifact/werf.inc.yaml | 7 + images/virt-launcher/werf.inc.yaml | 10 + 17 files changed, 571 insertions(+), 372 deletions(-) delete mode 100755 images/virt-firmware-artifact/build_old.sh create mode 100644 images/virt-firmware-artifact/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json create mode 100644 images/virt-firmware-artifact/json/30-edk2-ovmf-ia32-sb-enrolled.json create mode 100644 images/virt-firmware-artifact/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json create mode 100644 images/virt-firmware-artifact/json/40-edk2-ovmf-4m-qcow2-x64-sb.json create mode 100644 images/virt-firmware-artifact/json/40-edk2-ovmf-ia32-sb.json create mode 100644 images/virt-firmware-artifact/json/41-edk2-ovmf-2m-raw-x64-sb.json create mode 100644 images/virt-firmware-artifact/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json create mode 100644 images/virt-firmware-artifact/json/50-edk2-ovmf-ia32-nosb.json create mode 100644 images/virt-firmware-artifact/json/50-edk2-ovmf-x64-microvm.json create mode 100644 images/virt-firmware-artifact/json/51-edk2-ovmf-2m-raw-x64-nosb.json create mode 100644 images/virt-firmware-artifact/json/60-edk2-ovmf-x64-amdsev.json create mode 100644 images/virt-firmware-artifact/json/60-edk2-ovmf-x64-inteltdx.json diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index d662f274e..244780447 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -90,7 +90,7 @@ parse_args() { parse_args $@ FILE_LIST=$(cat < Date: Fri, 17 Jan 2025 17:04:27 +0300 Subject: [PATCH 021/107] OVMF: chage enroll func Signed-off-by: Nikita Korolev edk2: fix enrol step in script Signed-off-by: Nikita Korolev virt-launcher: byp[ass override libvirt.conf Signed-off-by: Nikita Korolev libvirt: add pciaccess driver_remote Signed-off-by: Nikita Korolev virt-launcher: add libvirt.conf Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 1 + images/virt-firmware-artifact/build.sh | 21 ++++++++++++++------- images/virt-launcher/werf.inc.yaml | 9 ++++++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index b1523e911..218812218 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -129,6 +129,7 @@ shell: -Dsystem=true \ -Ddriver_qemu=enabled \ -Ddriver_libvirtd=enabled \ + -Dpciaccess=enabled -Ddriver_remote=enabled \ -Dcurl=enabled \ -Ddocs=disabled \ -Ddriver_ch=disabled \ diff --git a/images/virt-firmware-artifact/build.sh b/images/virt-firmware-artifact/build.sh index 3af05d2c8..9a806e3f1 100755 --- a/images/virt-firmware-artifact/build.sh +++ b/images/virt-firmware-artifact/build.sh @@ -153,25 +153,32 @@ download_DBXUpdate enroll() { virt-fw-vars --input $FIRMWARE/OVMF_VARS.fd \ --output $FIRMWARE/OVMF_VARS.secboot.fd \ - --set-dbx DBXUpdate-$DBXDATE.x64.bin \ - --secure-boot --enroll-altlinux --distro-keys altlinux + --set-dbx $FIRMWARE/DBXUpdate-$DBXDATE.x64.bin \ + --secure-boot +# --enroll-altlinux +# --distro-keys altlinux virt-fw-vars --input $FIRMWARE/OVMF_VARS_4M.fd \ --output $FIRMWARE/OVMF_VARS_4M.secboot.fd \ - --set-dbx DBXUpdate-$DBXDATE.x64.bin \ - --secure-boot --enroll-altlinux --distro-keys altlinux + --set-dbx $FIRMWARE/DBXUpdate-$DBXDATE.x64.bin \ + --secure-boot +# --enroll-altlinux +# --distro-keys altlinux virt-fw-vars --input $FIRMWARE/OVMF.inteltdx.fd \ --output $FIRMWARE/OVMF.inteltdx.secboot.fd \ - --set-dbx DBXUpdate-$DBXDATE.x64.bin \ - --secure-boot --enroll-altlinux --distro-keys altlinux + --set-dbx $FIRMWARE/DBXUpdate-$DBXDATE.x64.bin \ + --secure-boot +# --enroll-altlinux +# --distro-keys altlinux } +enroll + # cp -p $FIRMWARE/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.secboot.fd # cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd # cp -p $FIRMWARE/OVMF.inteltdx.fd $FIRMWARE/OVMF.inteltdx.secboot.fd -enroll # build microvm echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc" diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index eba99821c..9772bf1aa 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -143,6 +143,7 @@ shell: libpulseaudio pipewire-libs libaio liburing \ libblkio libglusterfs11-api libnfs librbd1 librados2 +{{/* # xorriso \ # pipewire-jack-libs \ # ipxe-roms-qemu \ @@ -150,8 +151,11 @@ shell: # libvirt-client==10.2.0-alt1 \ # libvirt-daemon-driver-qemu==10.2.0-alt1 \ # qemu-kvm-core==9.0.2-alt2 +*/}} + - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin + install: {{/* # Upgrade edk2-ovmf package to custom build and remove its package. @@ -237,15 +241,18 @@ shell: - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig - cp /scripts/virt-launcher-monitor-wrapper.sh /usr/bin/virt-launcher-monitor - chmod +x /usr/bin/virt-launcher-monitor + # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - cp /etc/ld.so.preload.in /etc/ld.so.preload + # Create qemu group and user. - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home + # Create links to required for virt-launcher libs. # - ln -s /lib64/libcrypt.so.2.0.0 /lib64/libcrypt.so.2 # - ln -s /lib64/libpcre.so.1.2.13 /lib64/libpcre.so.1 - | - [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp + # [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp - mkdir -p /init/usr/bin && ln -s /usr/bin/container-disk /init/usr/bin/container-disk # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: From 7eaabef0fadce70262f96aafed1bb3ac9fafbd00 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 20 Jan 2025 19:58:29 +0300 Subject: [PATCH 022/107] libvirt: add coment in conf Signed-off-by: Nikita Korolev virt-launcher: add dmidecode Signed-off-by: Nikita Korolev qemu: add tools Signed-off-by: Nikita Korolev --- images/qemu-artifact/werf.inc.yaml | 1 + images/virt-launcher/libvirt.conf | 2 +- images/virt-launcher/werf.inc.yaml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 7e3a3b62c..b8480fe5a 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -133,6 +133,7 @@ shell: --enable-usb-redir \ --enable-libnfs \ --enable-curl \ + --enable-tools \ --enable-debug \ --enable-opengl \ --disable-docs \ diff --git a/images/virt-launcher/libvirt.conf b/images/virt-launcher/libvirt.conf index 7de9a4707..d8d298ecb 100644 --- a/images/virt-launcher/libvirt.conf +++ b/images/virt-launcher/libvirt.conf @@ -15,6 +15,6 @@ # These can be used in cases when no URI is supplied by the application # (@uri_default also prevents probing of the hypervisor driver). # -# Explicitly set uri_default for AltLinux. Libvirt is compiled here without probing modular daemons. +# Explicitly set uri_default for AltLinux and vanila libvirt. Libvirt is compiled here without probing modular daemons. uri_default = "qemu:///system" remote_mode = "direct" diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 9772bf1aa..6ea687a4e 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -129,6 +129,7 @@ shell: libffi8 \ swtpm-tools \ xorriso \ + dmidecode \ libcrypt libcrypto3 \ libjson-c5 libtirpc libbsd libiscsi libglusterfs11 libnuma \ libcap-ng libcurl libaudit libfuse libnbd libblkid libgcrypt20 \ From 0bde6303a8e517b1e2f2548fb2163716b0c8251a Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 21 Jan 2025 10:25:09 +0300 Subject: [PATCH 023/107] virt-launcher: add swtpm pkg Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 6ea687a4e..a2b40a113 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -127,7 +127,7 @@ shell: nftables \ passt \ libffi8 \ - swtpm-tools \ + swtpm swtpm-tools \ xorriso \ dmidecode \ libcrypt libcrypto3 \ From de96bd575a523c3957c056f9f170323a926a1367 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 22 Jan 2025 10:22:07 +0300 Subject: [PATCH 024/107] qemu: disable build qemu-guest-agent Signed-off-by: Nikita Korolev copy hypervisors bins and libs via script Signed-off-by: Nikita Korolev virt-luncher: rm -f option from script Signed-off-by: Nikita Korolev virt-luncher: libLLVM Signed-off-by: Nikita Korolev libvirt: disable some features Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 18 +++- images/qemu-artifact/werf.inc.yaml | 9 +- images/virt-launcher/reloclibs.sh | 134 ++++++++++++++++++++++++++ images/virt-launcher/werf.inc.yaml | 91 +++++++++++------ 4 files changed, 214 insertions(+), 38 deletions(-) create mode 100755 images/virt-launcher/reloclibs.sh diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 218812218..0972de242 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -18,7 +18,6 @@ shell: beforeInstall: - | apt-get update && apt-get install --yes \ - su sudo \ dmidecode \ gcc-c++ \ git \ @@ -129,23 +128,34 @@ shell: -Dsystem=true \ -Ddriver_qemu=enabled \ -Ddriver_libvirtd=enabled \ - -Dpciaccess=enabled -Ddriver_remote=enabled \ + -Dpciaccess=enabled \ + -Ddriver_remote=enabled \ -Dcurl=enabled \ + -Dlibssh=enabled \ + -Dlibssh2=enabled \ + -Dfirewalld=disabled \ + -Dfirewalld_zone=disabled \ -Ddocs=disabled \ -Ddriver_ch=disabled \ -Ddriver_lxc=disabled \ -Ddriver_openvz=disabled \ -Ddriver_test=disabled \ -Ddriver_vbox=disabled \ - -Dvbox_xpcomc_dir=disabled \ -Ddriver_vmware=disabled \ -Ddriver_vz=disabled \ + -Ddriver_bhyve=disabled \ + -Dvbox_xpcomc_dir=disabled \ -Dwireshark_dissector=disabled \ -Dwireshark_plugindir=disabled \ -Dstorage_gluster=disabled \ + -Dstorage_fs=disabled \ + -Dstorage_lvm=disabled \ -Dstorage_zfs=disabled \ -Dstorage_vstorage=disabled \ - -Dstorage_rbd=disabled + -Dstorage_rbd=disabled \ + -Dstorage_mpath=disabled \ + -Dstorage_iscsi_direct=disabled \ + -Dlibiscsi=disabled ninja -C build -j$(nproc) diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index b8480fe5a..e1a1a4b25 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -17,13 +17,10 @@ git: shell: beforeInstall: - | - apt-get update && apt-get install -y su sudo \ + apt-get update && apt-get install -y \ pkgconfig \ pkg-config \ - gear rpm dmidecode \ - rpm-build \ - rpm-build-systemd \ - rpm-build-python3 \ + dmidecode \ gcc-c++ \ git \ gettext \ @@ -122,7 +119,6 @@ shell: ./configure \ --target-list="x86_64-softmmu" \ --enable-kvm \ - --enable-guest-agent \ --enable-hv-balloon \ --enable-malloc-trim \ --enable-numa \ @@ -141,6 +137,7 @@ shell: --disable-cloop \ --disable-dmg \ --disable-glusterfs \ + --disable-guest-agent \ --disable-guest-agent-msi \ --disable-jack \ --disable-parallels \ diff --git a/images/virt-launcher/reloclibs.sh b/images/virt-launcher/reloclibs.sh new file mode 100755 index 000000000..d74c49bf2 --- /dev/null +++ b/images/virt-launcher/reloclibs.sh @@ -0,0 +1,134 @@ +#!/usr/bin/env bash + +# Copyright 2024 Flant JSC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -Eeuo pipefail +shopt -s failglob + +FILE_TEMPLATE_BINS="" +TEMPLATE_BINS="" +OUT_DIR="" + +tools=("ldd" "readlink" "awk" "dirname" "ls" "cat") +for tool in "${tools[@]}"; do + if ! command -v "$tool" >/dev/null 2>&1; then + echo "$tool is not installed." + exit 1 + fi +done + +function Help() { + # Display Help + cat<<'EOF' + Copy binaries and their libraries to a folder + Only one input parameter allowed (-f or -i) !!! + + Syntax: scriptTemplate [-h|f|i|o] + options: + + -f Files with paths to binaries; Support mask like /sbin/m* + -i Paths to binaries separated by space; Support mask like /sbin/m*; Example: /bin/chmod /bin/mount /sbin/m* + List of binaries should be in double quotes, -i /bin/chmod /bin/mount + -o Output directory (Default value: '/relocate') + -h Print this help + +EOF +} + +while getopts ":h:i:f:o:" option; do + case $option in + h) # display Help + Help + exit;; + f) + FILE_TEMPLATE_BINS=$OPTARG + ;; + i) + TEMPLATE_BINS=$OPTARG + ;; + o) + OUT_DIR=$OPTARG + ;; + \?) + echo "Error: Invalid option" + exit;; + esac +done + +if [[ -z $OUT_DIR ]];then + OUT_DIR="/relocate" +fi +mkdir -p "${OUT_DIR}" + +function relocate_item() { + local file=$1 + local new_place="${OUT_DIR}$(dirname ${file})" + + mkdir -p ${new_place} + cp -a ${file} ${new_place} || true + + # if symlink, copy original file too + local orig_file="$(readlink -f ${file})" + if [[ "${file}" != "${orig_file}" ]]; then + cp -a ${orig_file} ${new_place} || true + fi +} + +function relocate_lib() { + local item=$1 + if ! [[ $item =~ /(BINS|VBINS) ]];then + relocate_item ${item} + fi + + for lib in $(ldd ${item} 2>/dev/null | awk '{if ($2=="=>") print $3; else print $1}'); do + # don't try to relocate linux-vdso.so lib due to this lib is virtual + if [[ "${lib}" =~ "linux-vdso" || "${lib}" == "not" ]]; then + continue + fi + relocate_item ${lib} + done +} + +function get_binary_path () { + local bin + BINARY_LIST=() + + for bin in "$@"; do + if [[ ! -f $bin ]] || [ "${bin}" == "${OUT_DIR}" ]; then + echo "Not found $bin" + exit 1 + fi + BINARY_LIST+=$(ls -la $bin 2>/dev/null | awk '{print $9}')" " + done + + if [[ -z $BINARY_LIST ]]; then echo "No binaryes for replace"; exit 1; fi; +} + +# if get file with binaryes (-f) +if [[ -n $FILE_TEMPLATE_BINS ]] && [[ -f $FILE_TEMPLATE_BINS ]] && [[ -z $TEMPLATE_BINS ]]; then + BIN_TEMPLATE=$(cat $FILE_TEMPLATE_BINS) + get_binary_path ${BIN_TEMPLATE} +# Or get paths to bin via raw input (-i) +elif [[ -n $TEMPLATE_BINS ]] && [[ -z $FILE_TEMPLATE_BINS ]]; then + get_binary_path ${TEMPLATE_BINS} +else + Help + exit +fi + + +for binary in ${BINARY_LIST[@]}; do + relocate_lib ${binary} +done \ No newline at end of file diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index a2b40a113..90afc5712 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -38,7 +38,7 @@ import: - '*.json' # After install stage. -{{/* +{{/* # # Add libxcrypto library. # - image: {{ $.ImageName }}-libxcrypt-builder # add: /usr/local/lib/ @@ -126,23 +126,25 @@ shell: ethtool \ nftables \ passt \ - libffi8 \ swtpm swtpm-tools \ xorriso \ - dmidecode \ - libcrypt libcrypto3 \ - libjson-c5 libtirpc libbsd libiscsi libglusterfs11 libnuma \ - libcap-ng libcurl libaudit libfuse libnbd libblkid libgcrypt20 \ - libgnutls libp11-kit libreadline8 libtasn1 libattr libbsd libsystemd \ - libuuid libssh libssh2 \ - libspice-server \ - libcapstone libpixman libpng16 libjpeg libepoxy libusb \ - libsnappy liblzo2 libSDL2 libpmem libdaxctl libfdt libqpl1 \ - libslirp libvdeplug3 libxdp libbpf libdw libgbm libgtk+3 \ - libcairo libgdk-pixbuf libvte3 libX11 libSDL2_image \ - libvirglrenderer libcacard libusbredir libalsa \ - libpulseaudio pipewire-libs libaio liburing \ - libblkio libglusterfs11-api libnfs librbd1 librados2 + dmidecode +{{/* + # libffi8 \ + # libcrypt libcrypto3 \ + # libjson-c5 libtirpc libbsd libiscsi libglusterfs11 libnuma \ + # libcap-ng libcurl libaudit libfuse libnbd libblkid libgcrypt20 \ + # libgnutls libp11-kit libreadline8 libtasn1 libattr libsystemd \ + # libuuid libssh libssh2 \ + # libspice-server \ + # libcapstone libpixman libpng16 libjpeg libepoxy libusb \ + # libsnappy liblzo2 libSDL2 libpmem libdaxctl libfdt libqpl1 \ + # libslirp libvdeplug3 libxdp libbpf libdw libgbm libgtk+3 \ + # libcairo libgdk-pixbuf libvte3 libX11 libSDL2_image \ + # libvirglrenderer libcacard libusbredir libalsa \ + # libpulseaudio pipewire-libs libaio liburing \ + # libblkio libglusterfs11-api libnfs librbd1 librados2 +*/}} {{/* # xorriso \ @@ -178,6 +180,7 @@ shell: ln -s /usr/share/OVMF /usr/share/edk2/ovmf ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd +{{/* # cd /usr/share/OVMF # rm MICROVM.fd # rm OVMF.inteltdx.secboot.fd @@ -197,12 +200,14 @@ shell: # mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd # rm OVMF_VARS_4M.secboot.qcow2 || true # ls -la +*/}} # Installation libvirt and qemu - | echo "Install libvirt and qemu binaries" cp -a -u -v /BINS/usr/* /usr cp -a -u -v /BINS/etc/* /etc + cp -a -u -v /BINS/lib64/* /lib64 rm -rf /BINS/ # Create symlinc for libvirt @@ -242,13 +247,13 @@ shell: - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig - cp /scripts/virt-launcher-monitor-wrapper.sh /usr/bin/virt-launcher-monitor - chmod +x /usr/bin/virt-launcher-monitor - + # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - cp /etc/ld.so.preload.in /etc/ld.so.preload - + # Create qemu group and user. - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home - + # Create links to required for virt-launcher libs. # - ln -s /lib64/libcrypt.so.2.0.0 /lib64/libcrypt.so.2 # - ln -s /lib64/libpcre.so.1.2.13 /lib64/libpcre.so.1 @@ -271,26 +276,56 @@ import: add: /BINS to: /qemu-bins before: install +git: + - add: /images/{{ $.ImageName }} + to: / + stageDependencies: + setup: + - '**/*' + includePaths: + - reloclibs.sh shell: install: - | - apt-get update && apt-get install -y \ - tree - mkdir -p /VBINS + apt-get update && apt-get install -y tree \ + glibc-utils \ + libffi8 \ + libssh-devel libssh2-devel \ + libcap-ng-devel \ + libxfs-devel zlib-devel libcurl-devel libpci-devel libgvnc-devel libfdt-devel \ + libpixman-devel libkeyutils-devel libuuid-devel libpam0-devel libtasn1-devel libslirp-devel \ + libdrm-devel libxdp-devel libSDL2-devel libSDL2_image-devel libncursesw-devel libalsa-devel \ + libpulseaudio-devel pipewire-libs pipewire-jack-libs-devel libsoundio-devel \ + libcapstone-devel libsasl2-devel libjpeg-devel libpng-devel libxkbcommon-devel xkeyboard-config-devel libgtk+3-devel \ + libvte libvte-devel libvte3-devel libvirglrenderer-devel libusb-devel liburing-devel libbpf-devel \ + libspice-server-devel ceph-devel libnfs-devel libzstd-devel libseccomp-devel \ + libgcrypt-devel libgnutls-devel libnettle-devel libudev-devel libmultipath-devel \ + libblkio-devel libpmem-devel libdaxctl-devel libfuse3-devel rdma-core-devel libnuma-devel \ + bzlib-devel liblzo2-devel libsnappy-devel libcacard-devel libusbredir-devel libepoxy-devel libgbm-devel \ + libvitastor-devel libiscsi-devel libaio-devel libselinux-devel libqpl-devel libglusterfs11-api-devel \ + libvdeplug-devel libpciaccess-devel libyajl-devel sanlock-devel libpcap-devel libnl-devel libparted-devel libdevmapper-devel \ + libglusterfs-devel libaudit-devel libfuse-devel libnbd-devel libblkid-devel libp11-kit-devel libreadline-devel \ + libattr-devel libbsd-devel libsystemd-devel libjson-c-devel systemtap-sdt-devel libacl-devel glib2-devel \ + libgio-devel libxml2-devel libtirpc-devel libclocale libLLVMSPIRVLib-devel - echo "====/qemu-bins====" - tree -L 2 /qemu-bins + apt-get clean + + mkdir -p /VBINS echo "=====Copy libvirt binaries to temp folder======" cp -a /libvirt-bins/. /VBINS/ echo "=====Copy qemu binaries to temp folder======" cp -a /qemu-bins/. /VBINS/ - # cp -a /qemu-bins/bin/. /VBINS/usr/bin/ - # cp -a /qemu-bins/share/. /VBINS/usr/share/ - # cp -a /qemu-bins/libexec/. /VBINS/usr/lib/libexec/ - # cp -a /qemu-bins/include/. /VBINS/usr/local/include/ + rm -rf /VBINS/var/run + setup: + - | + LIST="$(find /VBINS/usr/bin/ -type f)" + LIST+=" $(find /VBINS/usr/sbin/ -type f)" + LIST+=" /usr/lib64/libbsd.so.0 /usr/lib64/libnbd.so.0 /usr/lib64/libfuse3.so.3" + # LIST+=" /usr/lib/llvm-18.1/lib64/libLLVM-18.so /usr/lib64/libLLVMSPIRVLib.so" + ./reloclibs.sh -i "$LIST" -o /VBINS --- image: {{ $.ImageName }}-lib-builder From d7418393e0222fb6746ab8812485bb0cf562585d Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 23 Jan 2025 10:23:20 +0300 Subject: [PATCH 025/107] rename virt-firmware-artifact to edk2-artifact Signed-off-by: Nikita Korolev --- .../Logo.bmp | Bin .../build.sh | 0 .../json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json | 0 .../json/30-edk2-ovmf-ia32-sb-enrolled.json | 0 .../json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json | 0 .../json/40-edk2-ovmf-4m-qcow2-x64-sb.json | 0 .../json/40-edk2-ovmf-ia32-sb.json | 0 .../json/41-edk2-ovmf-2m-raw-x64-sb.json | 0 .../json/50-edk2-ovmf-4m-qcow2-x64-nosb.json | 0 .../json/50-edk2-ovmf-ia32-nosb.json | 0 .../json/50-edk2-ovmf-x64-microvm.json | 0 .../json/51-edk2-ovmf-2m-raw-x64-nosb.json | 0 .../json/60-edk2-ovmf-x64-amdsev.json | 0 .../json/60-edk2-ovmf-x64-inteltdx.json | 0 .../werf.inc.yaml | 0 images/virt-launcher/werf.inc.yaml | 4 ++-- 16 files changed, 2 insertions(+), 2 deletions(-) rename images/{virt-firmware-artifact => edk2-artifact}/Logo.bmp (100%) rename images/{virt-firmware-artifact => edk2-artifact}/build.sh (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/30-edk2-ovmf-ia32-sb-enrolled.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/40-edk2-ovmf-4m-qcow2-x64-sb.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/40-edk2-ovmf-ia32-sb.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/41-edk2-ovmf-2m-raw-x64-sb.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/50-edk2-ovmf-ia32-nosb.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/50-edk2-ovmf-x64-microvm.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/51-edk2-ovmf-2m-raw-x64-nosb.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/60-edk2-ovmf-x64-amdsev.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/json/60-edk2-ovmf-x64-inteltdx.json (100%) rename images/{virt-firmware-artifact => edk2-artifact}/werf.inc.yaml (100%) diff --git a/images/virt-firmware-artifact/Logo.bmp b/images/edk2-artifact/Logo.bmp similarity index 100% rename from images/virt-firmware-artifact/Logo.bmp rename to images/edk2-artifact/Logo.bmp diff --git a/images/virt-firmware-artifact/build.sh b/images/edk2-artifact/build.sh similarity index 100% rename from images/virt-firmware-artifact/build.sh rename to images/edk2-artifact/build.sh diff --git a/images/virt-firmware-artifact/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json b/images/edk2-artifact/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json similarity index 100% rename from images/virt-firmware-artifact/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json rename to images/edk2-artifact/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json diff --git a/images/virt-firmware-artifact/json/30-edk2-ovmf-ia32-sb-enrolled.json b/images/edk2-artifact/json/30-edk2-ovmf-ia32-sb-enrolled.json similarity index 100% rename from images/virt-firmware-artifact/json/30-edk2-ovmf-ia32-sb-enrolled.json rename to images/edk2-artifact/json/30-edk2-ovmf-ia32-sb-enrolled.json diff --git a/images/virt-firmware-artifact/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json b/images/edk2-artifact/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json similarity index 100% rename from images/virt-firmware-artifact/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json rename to images/edk2-artifact/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json diff --git a/images/virt-firmware-artifact/json/40-edk2-ovmf-4m-qcow2-x64-sb.json b/images/edk2-artifact/json/40-edk2-ovmf-4m-qcow2-x64-sb.json similarity index 100% rename from images/virt-firmware-artifact/json/40-edk2-ovmf-4m-qcow2-x64-sb.json rename to images/edk2-artifact/json/40-edk2-ovmf-4m-qcow2-x64-sb.json diff --git a/images/virt-firmware-artifact/json/40-edk2-ovmf-ia32-sb.json b/images/edk2-artifact/json/40-edk2-ovmf-ia32-sb.json similarity index 100% rename from images/virt-firmware-artifact/json/40-edk2-ovmf-ia32-sb.json rename to images/edk2-artifact/json/40-edk2-ovmf-ia32-sb.json diff --git a/images/virt-firmware-artifact/json/41-edk2-ovmf-2m-raw-x64-sb.json b/images/edk2-artifact/json/41-edk2-ovmf-2m-raw-x64-sb.json similarity index 100% rename from images/virt-firmware-artifact/json/41-edk2-ovmf-2m-raw-x64-sb.json rename to images/edk2-artifact/json/41-edk2-ovmf-2m-raw-x64-sb.json diff --git a/images/virt-firmware-artifact/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json b/images/edk2-artifact/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json similarity index 100% rename from images/virt-firmware-artifact/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json rename to images/edk2-artifact/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json diff --git a/images/virt-firmware-artifact/json/50-edk2-ovmf-ia32-nosb.json b/images/edk2-artifact/json/50-edk2-ovmf-ia32-nosb.json similarity index 100% rename from images/virt-firmware-artifact/json/50-edk2-ovmf-ia32-nosb.json rename to images/edk2-artifact/json/50-edk2-ovmf-ia32-nosb.json diff --git a/images/virt-firmware-artifact/json/50-edk2-ovmf-x64-microvm.json b/images/edk2-artifact/json/50-edk2-ovmf-x64-microvm.json similarity index 100% rename from images/virt-firmware-artifact/json/50-edk2-ovmf-x64-microvm.json rename to images/edk2-artifact/json/50-edk2-ovmf-x64-microvm.json diff --git a/images/virt-firmware-artifact/json/51-edk2-ovmf-2m-raw-x64-nosb.json b/images/edk2-artifact/json/51-edk2-ovmf-2m-raw-x64-nosb.json similarity index 100% rename from images/virt-firmware-artifact/json/51-edk2-ovmf-2m-raw-x64-nosb.json rename to images/edk2-artifact/json/51-edk2-ovmf-2m-raw-x64-nosb.json diff --git a/images/virt-firmware-artifact/json/60-edk2-ovmf-x64-amdsev.json b/images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json similarity index 100% rename from images/virt-firmware-artifact/json/60-edk2-ovmf-x64-amdsev.json rename to images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json diff --git a/images/virt-firmware-artifact/json/60-edk2-ovmf-x64-inteltdx.json b/images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json similarity index 100% rename from images/virt-firmware-artifact/json/60-edk2-ovmf-x64-inteltdx.json rename to images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json diff --git a/images/virt-firmware-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml similarity index 100% rename from images/virt-firmware-artifact/werf.inc.yaml rename to images/edk2-artifact/werf.inc.yaml diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 90afc5712..9ae61d3e3 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -22,7 +22,7 @@ import: add: /VBINS to: /BINS before: install -- image: virt-firmware-artifact +- image: edk2-artifact add: /FIRMWARE/ to: /usr/share/OVMF before: install @@ -30,7 +30,7 @@ import: - '*.fd' - '*.bin' - '*.efi' -- image: virt-firmware-artifact +- image: edk2-artifact add: /FIRMWARE/ to: /usr/share/qemu/firmware before: install From 3227fbe1a6ebec9849faabee4f9e292601b3a7b1 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 23 Jan 2025 11:02:00 +0300 Subject: [PATCH 026/107] qemu: disable-safe-stack Signed-off-by: Nikita Korolev --- images/qemu-artifact/werf.inc.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index e1a1a4b25..07c1bd976 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -132,6 +132,10 @@ shell: --enable-tools \ --enable-debug \ --enable-opengl \ + --enable-cap-ng \ + --enable-capstone \ + --enable-coroutine-pool \ + --disable-safe-stack \ --disable-docs \ --disable-cocoa \ --disable-cloop \ From 532be608c44ead4488eb471bdae9fe7cde12ba28 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 23 Jan 2025 11:06:30 +0300 Subject: [PATCH 027/107] qemu: disable opengl Signed-off-by: Nikita Korolev --- images/qemu-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 07c1bd976..0a14c5d25 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -131,10 +131,10 @@ shell: --enable-curl \ --enable-tools \ --enable-debug \ - --enable-opengl \ --enable-cap-ng \ --enable-capstone \ --enable-coroutine-pool \ + --disable-opengl \ --disable-safe-stack \ --disable-docs \ --disable-cocoa \ From 342d4f30e91fc80ccecf0a301e639b9463201b16 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 23 Jan 2025 11:44:45 +0300 Subject: [PATCH 028/107] qemu: add i386-softmmu in build Signed-off-by: Nikita Korolev qemu: change build configure Signed-off-by: Nikita Korolev --- images/qemu-artifact/install-qemu.sh | 1 + images/qemu-artifact/werf.inc.yaml | 204 +++++++++++++++++++++++---- images/virt-launcher/werf.inc.yaml | 4 +- 3 files changed, 184 insertions(+), 25 deletions(-) diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 244780447..4ec32b530 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -92,6 +92,7 @@ parse_args $@ FILE_LIST=$(cat < Date: Thu, 23 Jan 2025 15:36:44 +0300 Subject: [PATCH 029/107] tmp-merged add libjson-c.so.5 Signed-off-by: Nikita Korolev tmp-merged: libssh.so.4 Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index fdfce6a5c..b4248f0fc 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -326,6 +326,7 @@ shell: LIST="$(find /VBINS/usr/bin/ -type f)" LIST+=" $(find /VBINS/usr/sbin/ -type f)" LIST+=" /usr/lib64/libbsd.so.0 /usr/lib64/libnbd.so.0 /usr/lib64/libfuse3.so.3" + LIST+=" /usr/lib64/libjson-c.so.5 /usr/lib64/libssh.so.4" # LIST+=" /usr/lib/llvm-18.1/lib64/libLLVM-18.so /usr/lib64/libLLVMSPIRVLib.so" ./reloclibs.sh -i "$LIST" -o /VBINS From 5cc3d33ff9283d15d6f1b651a0be68d16f3b88c4 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 23 Jan 2025 16:11:15 +0300 Subject: [PATCH 030/107] qemu: add qemu libs Signed-off-by: Nikita Korolev --- images/qemu-artifact/install-qemu.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 4ec32b530..31cc52575 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -91,6 +91,23 @@ parse_args $@ FILE_LIST=$(cat < Date: Thu, 23 Jan 2025 16:27:08 +0300 Subject: [PATCH 031/107] scripts,qemu: change cp to install -s and add libs Signed-off-by: Nikita Korolev libvirt: disable hyperv feature Signed-off-by: Nikita Korolev libvirt: remove driver_hyperv=disabled Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 3 ++- images/libvirt-artifact/werf.inc.yaml | 5 +++++ images/qemu-artifact/install-qemu.sh | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index b6ad750fd..fdd10f553 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -600,7 +600,8 @@ copy_file() { mkdir -p "$DEST_BASE$dest_dir" # Copy the file - cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" + install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" + # cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" echo "Copied $SOURCE_PATH to $DEST_BASE$dest_dir" } diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 0972de242..43f135511 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -133,6 +133,8 @@ shell: -Dcurl=enabled \ -Dlibssh=enabled \ -Dlibssh2=enabled \ + -Dnumactl=enabled \ + -Dcapng=enabled \ -Dfirewalld=disabled \ -Dfirewalld_zone=disabled \ -Ddocs=disabled \ @@ -159,6 +161,9 @@ shell: ninja -C build -j$(nproc) + # -Ddriver_hyperv=disabled \ + # -Dopenwsman=disabled \ + setup: - | echo "/{{ $gitRepoName }}-{{ $versionLibvirt }}" diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 31cc52575..702ffd505 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -106,8 +106,8 @@ $SRC_BUILD/audio-dbus.so to /usr/lib64/qemu $SRC_BUILD/block-blkio.so to /usr/lib64/qemu $SRC_BUILD/block-curl.so to /usr/lib64/qemu $SRC_BUILD/block-rbd.so to /usr/lib64/qemu -$SRC_BUILD/accel-qtest-x86_64.so to /usr/local/lib64/qemu -$SRC_BUILD/accel-tcg-x86_64.so to /usr/local/lib64/qemu +$SRC_BUILD/accel-qtest-x86_64.so to /usr/lib64/qemu +$SRC_BUILD/accel-tcg-x86_64.so to /usr/lib64/qemu $SRC_BUILD/qemu-system-x86_64 to /usr/bin $SRC_BUILD/qemu-system-i386 to /usr/bin $SRC_BUILD/qga/qemu-ga to /usr/bin @@ -186,7 +186,7 @@ $SRC_BASE/ui/icons/qemu_256x256.png to /usr/share/icons/hicolor/256x256/apps $SRC_BASE/ui/icons/qemu_512x512.png to /usr/share/icons/hicolor/512x512/apps $SRC_BASE/ui/icons/qemu_32x32.bmp to /usr/share/icons/hicolor/32x32/apps $SRC_BASE/ui/icons/qemu.svg to /usr/share/icons/hicolor/scalable/apps -$SRC_BASE/ui/qemu.desktop to /usr/share/applications +# $SRC_BASE/ui/qemu.desktop to /usr/share/applications $SRC_BUILD/contrib/vhost-user-gpu/50-qemu-gpu.json to /usr/share/qemu/vhost-user $SRC_BASE/pc-bios/bios.bin to /usr/share/qemu $SRC_BASE/pc-bios/bios-256k.bin to /usr/share/qemu @@ -272,7 +272,8 @@ copy_file() { mkdir -p "$DEST_BASE$dest_dir" # Copy the file - cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" + install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" + # cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" echo "Copied $SOURCE_PATH to $DEST_BASE$dest_dir" } From 491f820a150261f5ed8a1561066c1b2f98a03407 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 23 Jan 2025 20:01:12 +0300 Subject: [PATCH 032/107] qemu,libvirt: strip insted install -s Signed-off-by: Nikita Korolev qemu: format params Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 5 +- images/libvirt-artifact/werf.inc.yaml | 10 +- images/qemu-artifact/install-qemu.sh | 7 +- images/qemu-artifact/werf.inc.yaml | 111 +++++++++++---------- 4 files changed, 67 insertions(+), 66 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index fdd10f553..6f9a2dd1e 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -600,8 +600,9 @@ copy_file() { mkdir -p "$DEST_BASE$dest_dir" # Copy the file - install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - # cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" + # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" + strip "$SOURCE_PATH" + cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" echo "Copied $SOURCE_PATH to $DEST_BASE$dest_dir" } diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 43f135511..47295a829 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -18,6 +18,7 @@ shell: beforeInstall: - | apt-get update && apt-get install --yes \ + binutils \ dmidecode \ gcc-c++ \ git \ @@ -114,7 +115,8 @@ shell: install: - | - export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" + # export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" + # export PATH="$CCACHE_WRAPPERSDIR:$PATH" export MAKE="/usr/bin/make" export NINJA="/usr/bin/ninja" export PYTHON="/usr/bin/python3" @@ -165,11 +167,7 @@ shell: # -Dopenwsman=disabled \ setup: - - | - echo "/{{ $gitRepoName }}-{{ $versionLibvirt }}" - - # ls -lah /{{ $gitRepoName }}-{{ $versionLibvirt }} - + - | /install-libvirt.sh -s /{{ $gitRepoName }}-{{ $versionLibvirt }} \ -d /BINS \ -b build diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 702ffd505..1875819b7 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -109,7 +109,7 @@ $SRC_BUILD/block-rbd.so to /usr/lib64/qemu $SRC_BUILD/accel-qtest-x86_64.so to /usr/lib64/qemu $SRC_BUILD/accel-tcg-x86_64.so to /usr/lib64/qemu $SRC_BUILD/qemu-system-x86_64 to /usr/bin -$SRC_BUILD/qemu-system-i386 to /usr/bin +# $SRC_BUILD/qemu-system-i386 to /usr/bin $SRC_BUILD/qga/qemu-ga to /usr/bin $SRC_BUILD/qemu-keymap to /usr/bin $SRC_BUILD/qemu-img to /usr/bin @@ -272,8 +272,9 @@ copy_file() { mkdir -p "$DEST_BASE$dest_dir" # Copy the file - install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - # cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" + # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" + strip "$SOURCE_PATH" + cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" echo "Copied $SOURCE_PATH to $DEST_BASE$dest_dir" } diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index af6e41b28..5861b5e3a 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -18,6 +18,7 @@ shell: beforeInstall: - | apt-get update && apt-get install -y \ + binutils \ pkgconfig \ pkg-config \ dmidecode \ @@ -107,7 +108,11 @@ shell: id -u builder &>/dev/null || useradd builder --shell /bin/bash --create-home --group rpm install: - - | + - | + # export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" + # export PATH="$CCACHE_WRAPPERSDIR:$PATH" + # export CCACHE_BASEDIR="$(pwd)" + # export CCACHE_DIR="$CCACHE_BASEDIR/ccache" export MAKE="/usr/bin/make" export NINJA="/usr/bin/ninja" export PYTHON="/usr/bin/python3" @@ -252,65 +257,61 @@ shell: --disable-xen-pci-passthrough \ --disable-xkbcommon \ --disable-zstd \ - --enable-attr \ - --enable-blkio \ - --enable-cap-ng \ - --enable-capstone \ - --enable-coroutine-pool \ - --enable-curl \ - --enable-dbus-display \ - --enable-debug-info \ - --enable-fdt=system \ - --enable-gio \ - --enable-gnutls \ - --enable-guest-agent \ - --enable-iconv \ - --enable-kvm \ - --enable-libusb \ - --enable-libudev \ - --enable-linux-aio \ - --enable-linux-io-uring \ - --enable-lzo \ - --enable-malloc-trim \ - --enable-modules \ - --enable-mpath \ - --enable-numa \ - --enable-opengl \ - --enable-pa \ - --enable-pie \ - --enable-rbd \ - --enable-rdma \ - --enable-seccomp \ - --enable-selinux \ - --enable-slirp \ - --enable-snappy \ - --enable-spice-protocol \ - --enable-system \ - --enable-tcg \ - --enable-tools \ - --enable-tpm \ - --enable-usb-redir \ - --enable-vdi \ - --enable-vhost-kernel \ - --enable-vhost-net \ - --enable-vhost-user \ - --enable-vhost-user-blk-server \ - --enable-vhost-vdpa \ - --enable-vnc \ - --enable-png \ - --enable-vnc-sasl \ - --enable-werror \ - --enable-xkbcommon \ + --enable-attr \ + --enable-blkio \ + --enable-cap-ng \ + --enable-capstone \ + --enable-coroutine-pool \ + --enable-curl \ + --enable-dbus-display \ + --enable-debug-info \ + --enable-fdt=system \ + --enable-gio \ + --enable-gnutls \ + --enable-guest-agent \ + --enable-iconv \ + --enable-kvm \ + --enable-libusb \ + --enable-libudev \ + --enable-linux-aio \ + --enable-linux-io-uring \ + --enable-lzo \ + --enable-malloc-trim \ + --enable-modules \ + --enable-mpath \ + --enable-numa \ + --enable-opengl \ + --enable-pa \ + --enable-pie \ + --enable-rbd \ + --enable-rdma \ + --enable-seccomp \ + --enable-selinux \ + --enable-slirp \ + --enable-snappy \ + --enable-spice-protocol \ + --enable-system \ + --enable-tcg \ + --enable-tools \ + --enable-tpm \ + --enable-usb-redir \ + --enable-vdi \ + --enable-vhost-kernel \ + --enable-vhost-net \ + --enable-vhost-user \ + --enable-vhost-user-blk-server \ + --enable-vhost-vdpa \ + --enable-vnc \ + --enable-png \ + --enable-vnc-sasl \ + --enable-werror \ + --enable-xkbcommon \ --enable-zstd - make install -j$(nproc) + make -j$(nproc) - # --disable-debug-tcg \ - # make all build -j$(nproc) setup: - | - echo "/{{ $gitRepoName }}-{{ $versionQemu }}" - /install-qemu.sh -s /{{ $gitRepoName }}-{{ $versionQemu }} \ -d /BINS \ -b build From ec471247aef7d45428393e24575b992acf47b3a5 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Jan 2025 11:02:23 +0300 Subject: [PATCH 033/107] libvirt: change meson build params Signed-off-by: Nikita Korolev libvirt: add glibc-gconv-modules pkg Signed-off-by: Nikita Korolev libvirt: Duserfaultfd_sysctl=disabled Signed-off-by: Nikita Korolev libvirt: comment paaram Dselinux=enabled Signed-off-by: Nikita Korolev libvirt: comment arg tls_priority Signed-off-by: Nikita Korolev libvirt: comment arg Duserfaultfd_sysctl=disabled Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 59 ++++++------ images/libvirt-artifact/werf.inc.yaml | 103 +++++++++++++-------- images/virt-launcher/werf.inc.yaml | 3 +- 3 files changed, 98 insertions(+), 67 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 6f9a2dd1e..054b642f4 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -102,22 +102,23 @@ lib_version=$(convert_version $VERSION_NUM) # List of files and destinations FILE_LIST=$(cat < Date: Fri, 24 Jan 2025 13:01:47 +0300 Subject: [PATCH 034/107] libvirt,virt-launcher: fix params and add numactl Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 5 ++--- images/libvirt-artifact/werf.inc.yaml | 4 ++-- images/virt-launcher/werf.inc.yaml | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 054b642f4..d2a09a03a 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -102,9 +102,8 @@ lib_version=$(convert_version $VERSION_NUM) # List of files and destinations FILE_LIST=$(cat < Date: Fri, 24 Jan 2025 13:54:39 +0300 Subject: [PATCH 035/107] virt-launcher: fix import binaries from VBINS Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 2 +- images/virt-launcher/werf.inc.yaml | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index e8793ab92..bcb8b40dd 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -173,7 +173,7 @@ shell: -Daudit=enabled \ -Ddtrace=disabled \ -Dfirewalld=disabled \ - -Dfirewalld_zone=enabled \ + -Dfirewalld_zone=disabled \ -Dwireshark_dissector=disabled \ -Dlibssh=enabled -Dlibssh2=enabled \ -Dpm_utils=disabled \ diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index d41f73c7b..04046dcb2 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -20,8 +20,12 @@ import: # Add bins from libvirt and qemu artifacts. - image: tmp-merged add: /VBINS - to: /BINS + to: / before: install + includePaths: + - usr + - etc + - lib64 - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/OVMF @@ -92,6 +96,8 @@ import: add: /kubevirt/cmd/{{ $.ImageName }}/node-labeller/ to: /usr/bin before: setup + includePaths: + - '*.sh' git: - add: /images/{{ $.ImageName }} to: / @@ -204,15 +210,15 @@ shell: # mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd # rm OVMF_VARS_4M.secboot.qcow2 || true # ls -la -*/}} # Installation libvirt and qemu - - | - echo "Install libvirt and qemu binaries" - cp -a -u -v /BINS/usr/* /usr - cp -a -u -v /BINS/etc/* /etc - cp -a -u -v /BINS/lib64/* /lib64 - rm -rf /BINS/ + # - | + # echo "Install libvirt and qemu binaries" + # cp -a -u -v /BINS/usr/* /usr + # cp -a -u -v /BINS/etc/* /etc + # cp -a -u -v /BINS/lib64/* /lib64 + # rm -rf /BINS/ +*/}} # Create symlinc for libvirt - | From 74ac5629480e4df51d10e18f6d4cb1459f2abe4f Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Jan 2025 14:10:15 +0300 Subject: [PATCH 036/107] libvirt: return old meson build conf Signed-off-by: Nikita Korolev libvirt: rm params qemu_user qemu_group, rm lic test Signed-off-by: Nikita Korolev libvirt: rm virtqemud.aug Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 4 +- images/libvirt-artifact/werf.inc.yaml | 138 +++++++++++++-------- 2 files changed, 90 insertions(+), 52 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index d2a09a03a..07cf648ba 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -172,7 +172,7 @@ $SRC_BUILD/src/test_libvirtd_qemu.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_virtstoraged.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_virtlxcd.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_virtchd.aug to /usr/share/augeas/lenses/tests -$SRC_BUILD/src/test_virtqemud.aug to /usr/share/augeas/lenses/tests +# $SRC_BUILD/src/test_virtqemud.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_virtvboxd.aug to /usr/share/augeas/lenses/tests $SRC_BUILD/src/libvirt_functions.stp to /usr/share/systemtap/tapset $SRC_BUILD/tools/virt-host-validate to /usr/bin @@ -507,7 +507,7 @@ $SRC_BUILD/src/libvirtd.aug to /usr/share/augeas/lenses # $SRC_BUILD/src/virtchd.conf to /etc/libvirt # $SRC_BUILD/src/virtchd.aug to /usr/share/augeas/lenses $SRC_BUILD/src/virtqemud.conf to /etc/libvirt -$SRC_BUILD/src/virtqemud.aug to /usr/share/augeas/lenses +# $SRC_BUILD/src/virtqemud.aug to /usr/share/augeas/lenses # $SRC_BUILD/src/virtvboxd.conf to /etc/libvirt # $SRC_BUILD/src/virtvboxd.aug to /usr/share/augeas/lenses $SRC_BASE/src/remote/virt-guest-shutdown.target to /usr/lib/systemd/system diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index bcb8b40dd..4ddb8c536 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -126,67 +126,105 @@ shell: cd {{ $gitRepoName }}-{{ $versionLibvirt }} CFLAGS="-Wframe-larger-than=262144" meson setup build \ + -Dinit_script=systemd \ + -Dsystem=true \ -Ddriver_qemu=enabled \ - -Ddriver_openvz=disabled \ - -Ddriver_lxc=disabled -Dlogin_shell=disabled \ - -Ddriver_vbox=disabled \ - -Ddriver_libxl=disabled \ - -Dsasl=enabled \ - -Dpolkit=enabled \ -Ddriver_libvirtd=enabled \ + -Dpciaccess=enabled \ -Ddriver_remote=enabled \ - -Ddriver_test=disabled \ + -Dsasl=enabled \ + -Dpolkit=enabled \ + -Dlibssh=enabled \ + -Dlibssh2=enabled \ + -Dnumactl=enabled \ + -Dcapng=enabled \ -Ddriver_esx=disabled -Dcurl=disabled \ - -Ddriver_hyperv=disabled -Dopenwsman=disabled \ + -Dfirewalld=disabled \ + -Dfirewalld_zone=disabled \ + -Ddocs=disabled \ + -Ddriver_ch=disabled \ + -Ddriver_lxc=disabled -Dlogin_shell=disabled \ + -Ddriver_openvz=disabled \ + -Ddriver_test=disabled \ + -Ddriver_vbox=disabled \ -Ddriver_vmware=disabled \ + -Ddriver_hyperv=disabled -Dopenwsman=disabled \ -Ddriver_vz=disabled \ -Ddriver_bhyve=disabled \ - -Ddriver_ch=disabled \ - -Dremote_default_mode=direct \ - -Ddriver_interface=enabled \ - -Ddriver_network=enabled \ + -Dvbox_xpcomc_dir=disabled \ + -Dwireshark_dissector=disabled \ + -Dwireshark_plugindir=disabled \ + -Dstorage_gluster=disabled \ -Dstorage_fs=disabled \ -Dstorage_lvm=disabled \ - -Dstorage_iscsi=disabled \ - -Dstorage_iscsi_direct=disabled -Dlibiscsi=disabled \ - -Dstorage_scsi=disabled \ - -Dstorage_disk=disabled \ - -Dstorage_mpath=disabled \ - -Dstorage_rbd=disabled \ - -Dstorage_gluster=disabled -Dglusterfs=disabled \ -Dstorage_zfs=disabled \ -Dstorage_vstorage=disabled \ - -Dnumactl=enabled \ - -Dcapng=enabled \ - -Dfuse=enabled \ - -Dnetcf=disabled \ - -Dnls=enabled \ - -Dapparmor=disabled \ - -Dapparmor_profiles=disabled \ - -Dsecdriver_apparmor=disabled \ - -Dudev=enabled \ - -Djson_c=enabled \ - -Dsanlock=disabled \ - -Dlibpcap=enabled \ - -Dnbdkit=disabled -Dnbdkit_config_default=disabled \ - -Dlibnl=enabled \ - -Daudit=enabled \ - -Ddtrace=disabled \ - -Dfirewalld=disabled \ - -Dfirewalld_zone=disabled \ - -Dwireshark_dissector=disabled \ - -Dlibssh=enabled -Dlibssh2=enabled \ - -Dpm_utils=disabled \ - -Dnss=enabled \ - -Dqemu_user="qemu" \ - -Dqemu_group="qemu" \ - -Dsysctl_config=enabled \ - -Dssh_proxy=enabled \ - -Dinit_script=systemd \ - -Dfirewall_backend_priority="iptables,nftables" \ - -Ddocs=disabled \ - -Dtests=disabled \ - -Drpath=disabled + -Dstorage_rbd=disabled \ + -Dstorage_mpath=disabled \ + -Dstorage_iscsi_direct=disabled \ + -Dlibiscsi=disabled + + # -Ddriver_qemu=enabled \ + # -Ddriver_openvz=disabled \ + # -Ddriver_lxc=disabled -Dlogin_shell=disabled \ + # -Ddriver_vbox=disabled \ + # -Ddriver_libxl=disabled \ + # -Dsasl=enabled \ + # -Dpolkit=enabled \ + # -Ddriver_libvirtd=enabled \ + # -Ddriver_remote=enabled \ + # -Ddriver_test=disabled \ + # -Ddriver_esx=disabled -Dcurl=disabled \ + # -Ddriver_hyperv=disabled -Dopenwsman=disabled \ + # -Ddriver_vmware=disabled \ + # -Ddriver_vz=disabled \ + # -Ddriver_bhyve=disabled \ + # -Ddriver_ch=disabled \ + # -Dremote_default_mode=direct \ + # -Ddriver_interface=enabled \ + # -Ddriver_network=enabled \ + # -Dstorage_fs=disabled \ + # -Dstorage_lvm=disabled \ + # -Dstorage_iscsi=disabled \ + # -Dstorage_iscsi_direct=disabled -Dlibiscsi=disabled \ + # -Dstorage_scsi=disabled \ + # -Dstorage_disk=disabled \ + # -Dstorage_mpath=disabled \ + # -Dstorage_rbd=disabled \ + # -Dstorage_gluster=disabled -Dglusterfs=disabled \ + # -Dstorage_zfs=disabled \ + # -Dstorage_vstorage=disabled \ + # -Dnumactl=enabled \ + # -Dcapng=enabled \ + # -Dfuse=enabled \ + # -Dnetcf=disabled \ + # -Dnls=enabled \ + # -Dapparmor=disabled \ + # -Dapparmor_profiles=disabled \ + # -Dsecdriver_apparmor=disabled \ + # -Dudev=enabled \ + # -Djson_c=enabled \ + # -Dsanlock=disabled \ + # -Dlibpcap=enabled \ + # -Dnbdkit=disabled -Dnbdkit_config_default=disabled \ + # -Dlibnl=enabled \ + # -Daudit=enabled \ + # -Ddtrace=disabled \ + # -Dfirewalld=disabled \ + # -Dfirewalld_zone=disabled \ + # -Dwireshark_dissector=disabled \ + # -Dlibssh=enabled -Dlibssh2=enabled \ + # -Dpm_utils=disabled \ + # -Dnss=enabled \ + # -Dqemu_user="qemu" \ + # -Dqemu_group="qemu" \ + # -Dsysctl_config=enabled \ + # -Dssh_proxy=enabled \ + # -Dinit_script=systemd \ + # -Dfirewall_backend_priority="iptables,nftables" \ + # -Ddocs=disabled \ + # -Dtests=disabled \ + # -Drpath=disabled ninja -C build -j$(nproc) From 5fd5d181d6594cce33eb665964befba66ed0f0e5 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Jan 2025 15:05:16 +0300 Subject: [PATCH 037/107] libvirt: add libvirtd.sasl, rm augeas, correct disable features Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 20 ++++++++++---------- images/libvirt-artifact/werf.inc.yaml | 6 ++++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 07cf648ba..f11192c59 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -161,7 +161,7 @@ $SRC_BUILD/src/virt-qemu-run to /usr/bin $SRC_BUILD/src/test_virtlogd.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_libvirtd_network.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_libvirtd_lxc.aug to /usr/share/augeas/lenses/tests -$SRC_BUILD/src/test_libvirtd_qemu.aug to /usr/share/augeas/lenses/tests +# $SRC_BUILD/src/test_libvirtd_qemu.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_libvirtd.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_virtproxyd.aug to /usr/share/augeas/lenses/tests # $SRC_BUILD/src/test_virtinterfaced.aug to /usr/share/augeas/lenses/tests @@ -436,7 +436,7 @@ $SRC_BASE/src/cpu_map/x86_Westmere.xml to /usr/share/libvirt/cpu_map # $SRC_BASE/src/remote/libvirtd.sysctl to /usr/lib/sysctl.d $SRC_BASE/src/remote/libvirtd.policy to /usr/share/polkit-1/actions # $SRC_BASE/src/remote/libvirtd.rules to /usr/share/polkit-1/rules.d -# $SRC_BASE/src/remote/libvirtd.sasl to /etc/sasl2 +$SRC_BASE/src/remote/libvirtd.sasl to /etc/sasl2 # $SRC_BUILD/src/network/default.xml to /etc/libvirt/qemu/networks # $SRC_BASE/src/network/libvirt.zone to /usr/lib/firewalld/zones # $SRC_BASE/src/network/libvirt-routed.zone to /usr/lib/firewalld/zones @@ -482,12 +482,12 @@ $SRC_BASE/src/libvirt.conf to /etc/libvirt # $SRC_BASE/src/locking/libvirt_lockd.aug to /usr/share/augeas/lenses # $SRC_BASE/src/locking/libvirt_sanlock.aug to /usr/share/augeas/lenses # $SRC_BASE/src/locking/virtlockd.aug to /usr/share/augeas/lenses -$SRC_BASE/src/logging/virtlogd.aug to /usr/share/augeas/lenses +# $SRC_BASE/src/logging/virtlogd.aug to /usr/share/augeas/lenses # $SRC_BASE/src/network/libvirtd_network.aug to /usr/share/augeas/lenses # $SRC_BASE/src/lxc/libvirtd_lxc.aug to /usr/share/augeas/lenses -$SRC_BASE/src/qemu/libvirtd_qemu.aug to /usr/share/augeas/lenses +# $SRC_BASE/src/qemu/libvirtd_qemu.aug to /usr/share/augeas/lenses $SRC_BUILD/src/libvirtd.conf to /etc/libvirt -$SRC_BUILD/src/libvirtd.aug to /usr/share/augeas/lenses +# $SRC_BUILD/src/libvirtd.aug to /usr/share/augeas/lenses # $SRC_BUILD/src/virtproxyd.conf to /etc/libvirt # $SRC_BUILD/src/virtproxyd.aug to /usr/share/augeas/lenses # $SRC_BUILD/src/virtinterfaced.conf to /etc/libvirt @@ -512,11 +512,11 @@ $SRC_BUILD/src/virtqemud.conf to /etc/libvirt # $SRC_BUILD/src/virtvboxd.aug to /usr/share/augeas/lenses $SRC_BASE/src/remote/virt-guest-shutdown.target to /usr/lib/systemd/system # $SRC_BUILD/src/libvirtd.service to /usr/lib/systemd/system -$SRC_BUILD/src/libvirtd.socket to /usr/lib/systemd/system -$SRC_BUILD/src/libvirtd-ro.socket to /usr/lib/systemd/system -$SRC_BUILD/src/libvirtd-admin.socket to /usr/lib/systemd/system -$SRC_BUILD/src/libvirtd-tcp.socket to /usr/lib/systemd/system -$SRC_BUILD/src/libvirtd-tls.socket to /usr/lib/systemd/system +# $SRC_BUILD/src/libvirtd.socket to /usr/lib/systemd/system +# $SRC_BUILD/src/libvirtd-ro.socket to /usr/lib/systemd/system +# $SRC_BUILD/src/libvirtd-admin.socket to /usr/lib/systemd/system +# $SRC_BUILD/src/libvirtd-tcp.socket to /usr/lib/systemd/system +# $SRC_BUILD/src/libvirtd-tls.socket to /usr/lib/systemd/system # $SRC_BUILD/src/virtproxyd.service to /usr/lib/systemd/system # $SRC_BUILD/src/virtproxyd.socket to /usr/lib/systemd/system # $SRC_BUILD/src/virtproxyd-ro.socket to /usr/lib/systemd/system diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 4ddb8c536..c5e9c4fc3 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -138,6 +138,7 @@ shell: -Dlibssh2=enabled \ -Dnumactl=enabled \ -Dcapng=enabled \ + -Dudev=enabled \ -Ddriver_esx=disabled -Dcurl=disabled \ -Dfirewalld=disabled \ -Dfirewalld_zone=disabled \ @@ -154,14 +155,15 @@ shell: -Dvbox_xpcomc_dir=disabled \ -Dwireshark_dissector=disabled \ -Dwireshark_plugindir=disabled \ - -Dstorage_gluster=disabled \ + -Dstorage_gluster=disabled -Dglusterfs=disabled \ -Dstorage_fs=disabled \ -Dstorage_lvm=disabled \ -Dstorage_zfs=disabled \ -Dstorage_vstorage=disabled \ -Dstorage_rbd=disabled \ -Dstorage_mpath=disabled \ - -Dstorage_iscsi_direct=disabled \ + -Dstorage_iscsi=disabled \ + -Dstorage_iscsi_direct=disabled -Dlibiscsi=disabled \ -Dlibiscsi=disabled # -Ddriver_qemu=enabled \ From 08da935fa2ff12fc3546f23a8ef28180ba7ffb4b Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Jan 2025 15:19:53 +0300 Subject: [PATCH 038/107] libvirt: add libvirtd.sysctl Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 2 +- images/libvirt-artifact/werf.inc.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index f11192c59..7a4111d05 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -433,7 +433,7 @@ $SRC_BASE/src/cpu_map/x86_Westmere.xml to /usr/share/libvirt/cpu_map # $SRC_BUILD/src/remote/libvirtd.lxc.logrotate to /etc/logrotate.d # $SRC_BUILD/src/remote/libvirtd.libxl.logrotate to /etc/logrotate.d # $SRC_BUILD/src/remote/libvirtd.logrotate to /etc/logrotate.d -# $SRC_BASE/src/remote/libvirtd.sysctl to /usr/lib/sysctl.d +$SRC_BASE/src/remote/libvirtd.sysctl to /usr/lib/sysctl.d $SRC_BASE/src/remote/libvirtd.policy to /usr/share/polkit-1/actions # $SRC_BASE/src/remote/libvirtd.rules to /usr/share/polkit-1/rules.d $SRC_BASE/src/remote/libvirtd.sasl to /etc/sasl2 diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index c5e9c4fc3..7f1c6d33c 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -139,6 +139,7 @@ shell: -Dnumactl=enabled \ -Dcapng=enabled \ -Dudev=enabled \ + -Ddriver_network=enabled \ -Ddriver_esx=disabled -Dcurl=disabled \ -Dfirewalld=disabled \ -Dfirewalld_zone=disabled \ From 47ee1f9dff87151b4ce27dc7112fa27d16e959e0 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Jan 2025 15:32:38 +0300 Subject: [PATCH 039/107] except strip text files Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 4 +++- images/qemu-artifact/install-qemu.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 7a4111d05..078e1ee6d 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -601,7 +601,9 @@ copy_file() { # Copy the file # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - strip "$SOURCE_PATH" + if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml) ]];then + strip "$SOURCE_PATH" + fi cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" echo "Copied $SOURCE_PATH to $DEST_BASE$dest_dir" } diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 1875819b7..e406c7ca3 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -273,7 +273,9 @@ copy_file() { # Copy the file # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - strip "$SOURCE_PATH" + if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml) ]];then + strip "$SOURCE_PATH" + fi cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" echo "Copied $SOURCE_PATH to $DEST_BASE$dest_dir" } From d317a1804fd93d22cb1b16c451b6cc5629d2319d Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Jan 2025 15:57:31 +0300 Subject: [PATCH 040/107] libvirt: rm bash autocomplete, add build options Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 4 ++-- images/libvirt-artifact/werf.inc.yaml | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 078e1ee6d..1b1fc98a5 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -576,8 +576,8 @@ $SRC_BASE/tools/virt-qemu-sev-validate to /usr/bin $SRC_BUILD/tools/libvirt-guests.sh to /usr/libexec # $SRC_BUILD/tools/libvirt-guests.service to /usr/lib/systemd/system # $SRC_BASE/tools/virt-qemu-qmp-proxy to /usr/bin -$SRC_BUILD/tools/bash-completion/virsh to /usr/share/bash-completion/completions -$SRC_BUILD/tools/bash-completion/virt-admin to /usr/share/bash-completion/completions +# $SRC_BUILD/tools/bash-completion/virsh to /usr/share/bash-completion/completions +# $SRC_BUILD/tools/bash-completion/virt-admin to /usr/share/bash-completion/completions # $SRC_BUILD/tools/ssh-proxy/30-libvirt-ssh-proxy.conf to /etc/ssh/ssh_config.d # $SRC_BUILD/libvirt.pc to /usr/lib64/pkgconfig # $SRC_BUILD/libvirt-qemu.pc to /usr/lib64/pkgconfig diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 7f1c6d33c..48a16067f 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -128,10 +128,8 @@ shell: CFLAGS="-Wframe-larger-than=262144" meson setup build \ -Dinit_script=systemd \ -Dsystem=true \ - -Ddriver_qemu=enabled \ - -Ddriver_libvirtd=enabled \ + -Dremote_default_mode=direct \ -Dpciaccess=enabled \ - -Ddriver_remote=enabled \ -Dsasl=enabled \ -Dpolkit=enabled \ -Dlibssh=enabled \ @@ -140,6 +138,10 @@ shell: -Dcapng=enabled \ -Dudev=enabled \ -Ddriver_network=enabled \ + -Ddriver_interface=enabled \ + -Ddriver_libvirtd=enabled \ + -Ddriver_qemu=enabled \ + -Ddriver_remote=enabled \ -Ddriver_esx=disabled -Dcurl=disabled \ -Dfirewalld=disabled \ -Dfirewalld_zone=disabled \ From f803274bdc0183636a033bd4d4df21d2110640c0 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Jan 2025 15:58:08 +0300 Subject: [PATCH 041/107] virt-launcher: back to import BINS and cp Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 11 ++++--- images/qemu-artifact/werf.inc.yaml | 5 --- images/virt-launcher/werf.inc.yaml | 44 +++++++++++++++------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 48a16067f..98d6ded46 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -110,8 +110,6 @@ shell: ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc pip3 install black - grep -qw ^rpm /etc/group || groupadd rpm - id -u builder &>/dev/null || useradd builder --shell /bin/bash --create-home --group rpm install: - | @@ -169,6 +167,9 @@ shell: -Dstorage_iscsi_direct=disabled -Dlibiscsi=disabled \ -Dlibiscsi=disabled + ninja -C build -j$(nproc) + +{{/* # -Ddriver_qemu=enabled \ # -Ddriver_openvz=disabled \ # -Ddriver_lxc=disabled -Dlogin_shell=disabled \ @@ -230,14 +231,14 @@ shell: # -Ddocs=disabled \ # -Dtests=disabled \ # -Drpath=disabled +*/}} - ninja -C build -j$(nproc) - +{{/* # -Dselinux=enabled -Dselinux_mount="/sys/fs/selinux" \ # -Dtls_priority="@LIBVIRT,SYSTEM" \ # -Duserfaultfd_sysctl=disabled \ # -Dnumad=disabled \ - +*/}} setup: - | /install-libvirt.sh -s /{{ $gitRepoName }}-{{ $versionLibvirt }} \ diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 5861b5e3a..e6e6bd6ff 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -103,10 +103,6 @@ shell: pip3 install black - - | - grep -qw ^rpm /etc/group || groupadd rpm - id -u builder &>/dev/null || useradd builder --shell /bin/bash --create-home --group rpm - install: - | # export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" @@ -315,4 +311,3 @@ shell: /install-qemu.sh -s /{{ $gitRepoName }}-{{ $versionQemu }} \ -d /BINS \ -b build - ls -lah /BINS diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 04046dcb2..76320677d 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -18,14 +18,22 @@ import: */}} # Add bins from libvirt and qemu artifacts. +{{/* +# - image: tmp-merged +# add: /VBINS +# to: / +# before: install +# includePaths: +# - usr +# - etc +# - lib64 +*/}} + - image: tmp-merged add: /VBINS - to: / + to: /BINS before: install - includePaths: - - usr - - etc - - lib64 + - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/OVMF @@ -106,14 +114,6 @@ git: - '**/*' includePaths: - scripts - # Override libvirt daemon configuration. - - add: /images/{{ $.ImageName }} - to: /etc/libvirt - stageDependencies: - setup: - - '**/*' - includePaths: - - libvirt.conf # Add liboverride as a global LD_PRELOAD. - add: /images/{{ $.ImageName }}/liboverride to: /etc @@ -138,7 +138,9 @@ shell: dmidecode \ numactl \ hwclock \ + libffi8 \ glibc-gconv-modules + {{/* # libffi8 \ # libcrypt libcrypto3 \ @@ -184,6 +186,7 @@ shell: # Restructure firware files in /usr/share/OVMF to mimic structure # in edk2-ovmf package from the original kubevirt. */}} + - | # Link to dir OVMF mkdir -p /usr/share/edk2 @@ -211,15 +214,16 @@ shell: # rm OVMF_VARS_4M.secboot.qcow2 || true # ls -la - # Installation libvirt and qemu - # - | - # echo "Install libvirt and qemu binaries" - # cp -a -u -v /BINS/usr/* /usr - # cp -a -u -v /BINS/etc/* /etc - # cp -a -u -v /BINS/lib64/* /lib64 - # rm -rf /BINS/ */}} + # Installation libvirt and qemu + - | + echo "Install libvirt and qemu binaries" + cp -a -u -v /BINS/usr/* /usr + cp -a -u -v /BINS/etc/* /etc + cp -a -u -v /BINS/lib64/* /lib64 + rm -rf /BINS/ + # Create symlinc for libvirt - | convert_version() { From 5148af77d6b5fc62ade059ad67029dcdfba65d5b Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 14:25:44 +0300 Subject: [PATCH 042/107] virt-launcher: rm alt rebuild edk2 Signed-off-by: Nikita Korolev virt-launcher: rm qemu pkgs Signed-off-by: Nikita Korolev virt-launcher: rm libs install Signed-off-by: Nikita Korolev virt-launcher: rm OVMF commented step Signed-off-by: Nikita Korolev virt-launcher: rm builds libcrypt,libpcre libs Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 92 ------------------------------ 1 file changed, 92 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 76320677d..eabe2b44c 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -51,16 +51,6 @@ import: - '*.json' # After install stage. -{{/* -# # Add libxcrypto library. -# - image: {{ $.ImageName }}-libxcrypt-builder -# add: /usr/local/lib/ -# to: /lib64 -# after: install -# includePaths: -# - libcrypt.so.2.0.0 -*/}} - # Add liboverride library. - image: {{ $.ImageName }}-liboverride-builder add: /liboverride/ @@ -141,81 +131,16 @@ shell: libffi8 \ glibc-gconv-modules -{{/* - # libffi8 \ - # libcrypt libcrypto3 \ - # libjson-c5 libtirpc libbsd libiscsi libglusterfs11 libnuma \ - # libcap-ng libcurl libaudit libfuse libnbd libblkid libgcrypt20 \ - # libgnutls libp11-kit libreadline8 libtasn1 libattr libsystemd \ - # libuuid libssh libssh2 \ - # libspice-server \ - # libcapstone libpixman libpng16 libjpeg libepoxy libusb \ - # libsnappy liblzo2 libSDL2 libpmem libdaxctl libfdt libqpl1 \ - # libslirp libvdeplug3 libxdp libbpf libdw libgbm libgtk+3 \ - # libcairo libgdk-pixbuf libvte3 libX11 libSDL2_image \ - # libvirglrenderer libcacard libusbredir libalsa \ - # libpulseaudio pipewire-libs libaio liburing \ - # libblkio libglusterfs11-api libnfs librbd1 librados2 -*/}} - -{{/* - # xorriso \ - # pipewire-jack-libs \ - # ipxe-roms-qemu \ - # seavgabios seabios \ - # libvirt-client==10.2.0-alt1 \ - # libvirt-daemon-driver-qemu==10.2.0-alt1 \ - # qemu-kvm-core==9.0.2-alt2 -*/}} - - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: -{{/* - # Upgrade edk2-ovmf package to custom build and remove its package. - # - | - # # Temp disable - # ls -la - # rpm -Uv /edk2-ovmf-20231115-alt1.noarch.rpm - # rm /edk2-ovmf-20231115-alt1.noarch.rpm - # # ======= - # # rpm -Uv /edk2-ovmf-20240811-alt2.noarch.rpm - # # rm /edk2-ovmf-20240811-alt2.noarch.rpm - - # Restructure firware files in /usr/share/OVMF to mimic structure - # in edk2-ovmf package from the original kubevirt. -*/}} - - | # Link to dir OVMF mkdir -p /usr/share/edk2 ln -s /usr/share/OVMF /usr/share/edk2/ovmf ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd -{{/* - # cd /usr/share/OVMF - # rm MICROVM.fd - # rm OVMF.inteltdx.secboot.fd - # rm OVMF_CODE.fd - # rm OVMF_CODE.secboot.fd - # mv OVMF_CODE_4M.fd OVMF_CODE.cc.fd - # rm OVMF_CODE_4M.qcow2 - # mv OVMF_CODE_4M.secboot.fd OVMF_CODE.secboot.fd - # rm OVMF_CODE_4M.secboot.qcow2 - # rm OVMF_VARS.fd - # rm OVMF_VARS.ms.fd - # rm OVMF_VARS.secboot.fd - # mv OVMF_VARS_4M.fd OVMF_VARS.fd - # rm OVMF_VARS_4M.ms.fd - # rm OVMF_VARS_4M.ms.qcow2 || true - # rm OVMF_VARS_4M.qcow2 || true - # mv OVMF_VARS_4M.secboot.fd OVMF_VARS.secboot.fd - # rm OVMF_VARS_4M.secboot.qcow2 || true - # ls -la - -*/}} - # Installation libvirt and qemu - | echo "Install libvirt and qemu binaries" @@ -268,9 +193,6 @@ shell: # Create qemu group and user. - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home - # Create links to required for virt-launcher libs. - # - ln -s /lib64/libcrypt.so.2.0.0 /lib64/libcrypt.so.2 - # - ln -s /lib64/libpcre.so.1.2.13 /lib64/libpcre.so.1 - | # [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp - mkdir -p /init/usr/bin && ln -s /usr/bin/container-disk /init/usr/bin/container-disk @@ -363,20 +285,6 @@ shell: gcc-c++==13-alt1 - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin ---- -image: {{ $.ImageName }}-libxcrypt-builder -final: false -fromImage: {{ $.ImageName }}-lib-builder -shell: - beforeInstall: - # Download libxcrypt sources. - - git clone --branch v4.4.36 {{ $.SOURCE_REPO }}/besser82/libxcrypt.git /tmp/libxcrypt - install: - # Build libcrypt.so.2. - - cd /tmp/libxcrypt - - ./autogen.sh - - ./configure --disable-obsolete-api - - make && make install --- image: {{ $.ImageName }}-liboverride-builder From a1e4953dc447d75f14ad4e0eb9c4d0fdaadda313 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 14:34:56 +0300 Subject: [PATCH 043/107] virt-launcher: rm edk2-builder, comment image edk2-builder Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 133 ++++++++++++++--------------- 1 file changed, 62 insertions(+), 71 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index eabe2b44c..a9dcbafca 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -5,18 +5,6 @@ image: {{ $.ImageName }} fromImage: base-alt-p11 import: # Before install stage. -{{/* -# # Add edk2-ovmf package -# - image: {{ $.ImageName }}-edk2-builder -# add: /home/builder/RPM/RPMS/noarch -# to: / -# before: install -# includePaths: -# - edk2-ovmf-20231115-alt1.noarch.rpm -# - edk2-ovmf-20240811-alt2.noarch.rpm - -*/}} - # Add bins from libvirt and qemu artifacts. {{/* # - image: tmp-merged @@ -304,66 +292,69 @@ shell: - cd /liboverride - gcc -shared -fPIC -DPIC -Wall -o liboverride.so override.c -ldl - strip liboverride.so ---- -# Note: edk2-ovmf==20231115 requires p11 AltLinux to build. -image: {{ $.ImageName }}-edk2-builder -final: false -from: {{ $.Images.BASE_ALT_P11 }} -git: -- add: /images/{{ $.ImageName }}/edk2 - to: /edk2 - excludePaths: - - '*.py' - - '*.md' - stageDependencies: - install: - - '*.bmp' -shell: - beforeInstall: - # Install build dependencies. No versions required here, - # because we rebuild SRPM already built by distro authors. - - | - apt-get update && apt-get install --yes \ - bc \ - su \ - git \ - rpm-build \ - rpm-build-python3 \ - gcc-c++ \ - acpica \ - nasm \ - python3-dev \ - python3-modules-sqlite3 \ - python3-module-virt-firmware \ - perl-JSON \ - perl-IPC-Cmd \ - libuuid-devel \ - xorriso \ - dosfstools \ - mtools \ - qemu-img \ - zlib-devel - - apt-get clean - - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin - install: - # AltLinux requires building packages by non-root users. - - useradd builder --shell /bin/bash --create-home --group rpm +{{/* +# --- +# # Note: edk2-ovmf==20231115 requires p11 AltLinux to build. +# image: {{ $.ImageName }}-edk2-builder +# final: false +# from: {{ $.Images.BASE_ALT_P11 }} +# git: +# - add: /images/{{ $.ImageName }}/edk2 +# to: /edk2 +# excludePaths: +# - '*.py' +# - '*.md' +# stageDependencies: +# install: +# - '*.bmp' +# shell: +# beforeInstall: +# # Install build dependencies. No versions required here, +# # because we rebuild SRPM already built by distro authors. +# - | +# apt-get update && apt-get install --yes \ +# bc \ +# su \ +# git \ +# rpm-build \ +# rpm-build-python3 \ +# gcc-c++ \ +# acpica \ +# nasm \ +# python3-dev \ +# python3-modules-sqlite3 \ +# python3-module-virt-firmware \ +# perl-JSON \ +# perl-IPC-Cmd \ +# libuuid-devel \ +# xorriso \ +# dosfstools \ +# mtools \ +# qemu-img \ +# zlib-devel +# - apt-get clean +# - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin - # Download and unpack SRPM. - - echo "rpm-src [p11] http://ftp.altlinux.org/pub/distributions/ALTLinux p11/branch/noarch classic" >> /etc/apt/sources.list.d/src.list - - apt-get update - - su - builder -c 'apt-get source edk2-ovmf' - - apt-get clean - - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin +# install: +# # AltLinux requires building packages by non-root users. +# - useradd builder --shell /bin/bash --create-home --group rpm - # Add DVP logo into SOURCES. - - cp /edk2/Logo.bmp /home/builder/RPM/SOURCES/ +# # Download and unpack SRPM. +# - echo "rpm-src [p11] http://ftp.altlinux.org/pub/distributions/ALTLinux p11/branch/noarch classic" >> /etc/apt/sources.list.d/src.list +# - apt-get update +# - su - builder -c 'apt-get source edk2-ovmf' +# - apt-get clean +# - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin - # Build RPMs. edk2 package prints a huge log with about 770k lines, - # we can keep only last 1k lines, it should be enough to get error - # context and troubleshoot it locally. - - | - echo "Build RPMs from:" /home/builder/*.rpm - echo "Note: time consuming operation, be patient ..." - su - builder -c 'trap "echo Build log tail: ; tail -n 1024 /tmp/build.log" EXIT ; rpm -ba /home/builder/RPM/SPECS/edk2.spec > /tmp/build.log 2>&1' +# # Add DVP logo into SOURCES. +# - cp /edk2/Logo.bmp /home/builder/RPM/SOURCES/ + +# # Build RPMs. edk2 package prints a huge log with about 770k lines, +# # we can keep only last 1k lines, it should be enough to get error +# # context and troubleshoot it locally. +# - | +# echo "Build RPMs from:" /home/builder/*.rpm +# echo "Note: time consuming operation, be patient ..." +# su - builder -c 'trap "echo Build log tail: ; tail -n 1024 /tmp/build.log" EXIT ; rpm -ba /home/builder/RPM/SPECS/edk2.spec > /tmp/build.log 2>&1' +*/}} From 028f24f48603e5a88ab2f570cafa4518c4bfc1d9 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 14:38:09 +0300 Subject: [PATCH 044/107] base-images: change distroless-base sha Signed-off-by: Nikita Korolev --- base-images/alt_image_versions.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/base-images/alt_image_versions.yml b/base-images/alt_image_versions.yml index 6f0c769d7..2330af5be 100644 --- a/base-images/alt_image_versions.yml +++ b/base-images/alt_image_versions.yml @@ -2,4 +2,8 @@ REGISTRY_PATH: "registry.altlinux.org/" # Virtualization images +<<<<<<< HEAD DISTROLESS_ALT_P11: "alt/distroless-base:p11@sha256:0026e22d332e49303b8a39756accb7c782a52e41d85fa903584e253c9b87a9fc" +======= +DISTROLESS_ALT_P11: "alt/distroless-base:p11@sha256:2f1d5a97dd2cf03b156a1103d9010a2d1017bd128f16ddaeef33e13860778a81" +>>>>>>> c70438d2 (base-images: change distroless-base sha) From 6bff0020a77371e335ac395886652cd674af3dbf Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 3 Feb 2025 11:59:17 +0300 Subject: [PATCH 045/107] resolve conflicts: update sha DISTROLESS_ALT_P11 Signed-off-by: Nikita Korolev --- base-images/alt_image_versions.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/base-images/alt_image_versions.yml b/base-images/alt_image_versions.yml index 2330af5be..6f0c769d7 100644 --- a/base-images/alt_image_versions.yml +++ b/base-images/alt_image_versions.yml @@ -2,8 +2,4 @@ REGISTRY_PATH: "registry.altlinux.org/" # Virtualization images -<<<<<<< HEAD DISTROLESS_ALT_P11: "alt/distroless-base:p11@sha256:0026e22d332e49303b8a39756accb7c782a52e41d85fa903584e253c9b87a9fc" -======= -DISTROLESS_ALT_P11: "alt/distroless-base:p11@sha256:2f1d5a97dd2cf03b156a1103d9010a2d1017bd128f16ddaeef33e13860778a81" ->>>>>>> c70438d2 (base-images: change distroless-base sha) From a13850dff8a5bda67765a2713864f2e4765c41dc Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 15:32:41 +0300 Subject: [PATCH 046/107] virt-launcher: try use scratch Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index a9dcbafca..9b7c01b2c 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -1,7 +1,7 @@ --- {{- $versionLibvirt := "10.10.0" }} -image: {{ $.ImageName }} +image: {{ $.ImageName }}-prepared fromImage: base-alt-p11 import: # Before install stage. @@ -188,6 +188,14 @@ shell: #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] --- +image: {{ $.ImageName }} +from: {{ $.Images.BASE_SCRATCH }} +import: +- image: {{ $.ImageName }}-prepared + add: / + to: / + before: setup +--- image: tmp-merged final: false fromImage: base-alt-p11 From 0bef33ab882d85c42a50b9ce583c49d62fd80751 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 15:57:59 +0300 Subject: [PATCH 047/107] virt-launcher: rename image tmp-merged Signed-off-by: Nikita Korolev virt-launcher: temporary rm scatch image Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 9b7c01b2c..3073ee84f 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -1,7 +1,8 @@ --- {{- $versionLibvirt := "10.10.0" }} -image: {{ $.ImageName }}-prepared +# image: {{ $.ImageName }}-prepared +image: {{ $.ImageName }} fromImage: base-alt-p11 import: # Before install stage. @@ -17,7 +18,7 @@ import: # - lib64 */}} -- image: tmp-merged +- image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries add: /VBINS to: /BINS before: install @@ -187,16 +188,18 @@ shell: # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] +{{/* +# --- +# image: {{ $.ImageName }} +# from: {{ $.Images.BASE_SCRATCH }} +# import: +# - image: {{ $.ImageName }}-prepared +# add: / +# to: / +# before: setup +*/}} --- -image: {{ $.ImageName }} -from: {{ $.Images.BASE_SCRATCH }} -import: -- image: {{ $.ImageName }}-prepared - add: / - to: / - before: setup ---- -image: tmp-merged +image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries final: false fromImage: base-alt-p11 import: @@ -257,7 +260,6 @@ shell: LIST+=" $(find /VBINS/usr/sbin/ -type f)" LIST+=" /usr/lib64/libbsd.so.0 /usr/lib64/libnbd.so.0 /usr/lib64/libfuse3.so.3" LIST+=" /usr/lib64/libjson-c.so.5 /usr/lib64/libssh.so.4" - # LIST+=" /usr/lib/llvm-18.1/lib64/libLLVM-18.so /usr/lib64/libLLVMSPIRVLib.so" ./reloclibs.sh -i "$LIST" -o /VBINS --- From 6d8af34f2ae30142e232c7b9ed2705db98f6e37b Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 16:01:28 +0300 Subject: [PATCH 048/107] virt-launcher: rm edk2-builder from build virt-launcher Signed-off-by: Nikita Korolev vl: test-vbins, try1 Signed-off-by: Nikita Korolev vl: test-vbins, try2 Signed-off-by: Nikita Korolev vl: test-vbins, try3, just from image vl Signed-off-by: Nikita Korolev vl: test-vbins, try4, just from image vl, rm commented block Signed-off-by: Nikita Korolev vl: test-vbins, try4, add liboverride Signed-off-by: Nikita Korolev vl: test-vbins, try5, import root/root Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 138 ++++++++++------------------- 1 file changed, 49 insertions(+), 89 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 3073ee84f..f449d55fe 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -7,17 +7,6 @@ fromImage: base-alt-p11 import: # Before install stage. # Add bins from libvirt and qemu artifacts. -{{/* -# - image: tmp-merged -# add: /VBINS -# to: / -# before: install -# includePaths: -# - usr -# - etc -# - lib64 -*/}} - - image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries add: /VBINS to: /BINS @@ -41,12 +30,14 @@ import: # After install stage. # Add liboverride library. -- image: {{ $.ImageName }}-liboverride-builder - add: /liboverride/ - to: /liboverride - after: install - includePaths: - - liboverride.so +{{/* +# - image: {{ $.ImageName }}-liboverride-builder +# add: /liboverride/ +# to: /liboverride +# after: install +# includePaths: +# - liboverride.so +*/}} # Add kubeivrt files from virt-artifact. - image: virt-artifact @@ -94,13 +85,13 @@ git: includePaths: - scripts # Add liboverride as a global LD_PRELOAD. - - add: /images/{{ $.ImageName }}/liboverride - to: /etc - stageDependencies: - setup: - - 'ld.so.preload.in' - includePaths: - - ld.so.preload.in + # - add: /images/{{ $.ImageName }}/liboverride + # to: /etc + # stageDependencies: + # setup: + # - 'ld.so.preload.in' + # includePaths: + # - ld.so.preload.in shell: beforeInstall: # Install main packages. @@ -179,6 +170,8 @@ shell: # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - cp /etc/ld.so.preload.in /etc/ld.so.preload + # - cp /etc/ld.so.preload.in /etc/ld.so.preload + # Create qemu group and user. - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home @@ -302,69 +295,36 @@ shell: - cd /liboverride - gcc -shared -fPIC -DPIC -Wall -o liboverride.so override.c -ldl - strip liboverride.so - -{{/* -# --- -# # Note: edk2-ovmf==20231115 requires p11 AltLinux to build. -# image: {{ $.ImageName }}-edk2-builder +--- +image: {{ $.ImageName }}-test-01 +final: false +fromImage: {{ $.ImageName }} +import: +- image: {{ $.ImageName }}-liboverride-builder + add: /liboverride/ + to: /liboverride + after: install + includePaths: + - liboverride.so +git: + # Add liboverride as a global LD_PRELOAD. + - add: /images/{{ $.ImageName }}/liboverride + to: /etc + stageDependencies: + setup: + - 'ld.so.preload.in' + includePaths: + - ld.so.preload.in +shell: + setup: + - mv /etc/ld.so.preload.in /etc/ld.so.preload +--- +image: {{ $.ImageName }}-virtlauncher # final: false -# from: {{ $.Images.BASE_ALT_P11 }} -# git: -# - add: /images/{{ $.ImageName }}/edk2 -# to: /edk2 -# excludePaths: -# - '*.py' -# - '*.md' -# stageDependencies: -# install: -# - '*.bmp' -# shell: -# beforeInstall: -# # Install build dependencies. No versions required here, -# # because we rebuild SRPM already built by distro authors. -# - | -# apt-get update && apt-get install --yes \ -# bc \ -# su \ -# git \ -# rpm-build \ -# rpm-build-python3 \ -# gcc-c++ \ -# acpica \ -# nasm \ -# python3-dev \ -# python3-modules-sqlite3 \ -# python3-module-virt-firmware \ -# perl-JSON \ -# perl-IPC-Cmd \ -# libuuid-devel \ -# xorriso \ -# dosfstools \ -# mtools \ -# qemu-img \ -# zlib-devel -# - apt-get clean -# - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin - -# install: -# # AltLinux requires building packages by non-root users. -# - useradd builder --shell /bin/bash --create-home --group rpm - -# # Download and unpack SRPM. -# - echo "rpm-src [p11] http://ftp.altlinux.org/pub/distributions/ALTLinux p11/branch/noarch classic" >> /etc/apt/sources.list.d/src.list -# - apt-get update -# - su - builder -c 'apt-get source edk2-ovmf' -# - apt-get clean -# - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin - -# # Add DVP logo into SOURCES. -# - cp /edk2/Logo.bmp /home/builder/RPM/SOURCES/ - -# # Build RPMs. edk2 package prints a huge log with about 770k lines, -# # we can keep only last 1k lines, it should be enough to get error -# # context and troubleshoot it locally. -# - | -# echo "Build RPMs from:" /home/builder/*.rpm -# echo "Note: time consuming operation, be patient ..." -# su - builder -c 'trap "echo Build log tail: ; tail -n 1024 /tmp/build.log" EXIT ; rpm -ba /home/builder/RPM/SPECS/edk2.spec > /tmp/build.log 2>&1' -*/}} +from: {{ $.Images.BASE_SCRATCH }} +# from: {{ $.Images.DISTROLESS_ALT_P11 }} +import: +- image: {{ $.ImageName }}-test-01 + add: / + to: / + after: install From 31c892b88659ef9f509ae8ce91facb80c50f2625 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 20:44:01 +0300 Subject: [PATCH 049/107] virt-launcher: try VBINS import Signed-off-by: Nikita Korolev virt-launcher: try VBINS import; except lib64 Signed-off-by: Nikita Korolev virt-launcher: try VBINS import; after install Signed-off-by: Nikita Korolev virt-launcher: try VBINS import; install->beforeSetup Signed-off-by: Nikita Korolev virt-launcher: try VBINS import; separate import libs Signed-off-by: Nikita Korolev virt-launcher: try VBINS import; separate import libs 2 step Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 157 +++++++++++++++++------------ 1 file changed, 93 insertions(+), 64 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index f449d55fe..310f7652f 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -9,13 +9,32 @@ import: # Add bins from libvirt and qemu artifacts. - image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries add: /VBINS - to: /BINS - before: install + to: / + # before: install + after: install + includePaths: + - etc +- image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries + add: /VBINS + to: /usr + # before: install + after: install + includePaths: + - lib64 +- image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries + add: /VBINS + to: / + # before: install + after: install + includePaths: + - usr + - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/OVMF - before: install + after: install + # before: install includePaths: - '*.fd' - '*.bin' @@ -24,20 +43,21 @@ import: - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/qemu/firmware - before: install + after: install + # before: install includePaths: - '*.json' # After install stage. # Add liboverride library. {{/* -# - image: {{ $.ImageName }}-liboverride-builder -# add: /liboverride/ -# to: /liboverride -# after: install -# includePaths: -# - liboverride.so */}} +- image: {{ $.ImageName }}-liboverride-builder + add: /liboverride/ + to: /liboverride + after: install + includePaths: + - liboverride.so # Add kubeivrt files from virt-artifact. - image: virt-artifact @@ -85,13 +105,13 @@ git: includePaths: - scripts # Add liboverride as a global LD_PRELOAD. - # - add: /images/{{ $.ImageName }}/liboverride - # to: /etc - # stageDependencies: - # setup: - # - 'ld.so.preload.in' - # includePaths: - # - ld.so.preload.in + - add: /images/{{ $.ImageName }}/liboverride + to: /etc + stageDependencies: + setup: + - 'ld.so.preload.in' + includePaths: + - ld.so.preload.in shell: beforeInstall: # Install main packages. @@ -115,19 +135,24 @@ shell: - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: + - | + # Create qemu group and user. + groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home + + beforeSetup: - | # Link to dir OVMF mkdir -p /usr/share/edk2 ln -s /usr/share/OVMF /usr/share/edk2/ovmf ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd - # Installation libvirt and qemu - - | - echo "Install libvirt and qemu binaries" - cp -a -u -v /BINS/usr/* /usr - cp -a -u -v /BINS/etc/* /etc - cp -a -u -v /BINS/lib64/* /lib64 - rm -rf /BINS/ + # Installation libvirt and qemu + # - | + # echo "Install libvirt and qemu binaries" + # cp -a -u -v /BINS/usr/* /usr + # cp -a -u -v /BINS/etc/* /etc + # cp -a -u -v /BINS/lib64/* /lib64 + # rm -rf /BINS/ # Create symlinc for libvirt - | @@ -166,14 +191,13 @@ shell: - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig - cp /scripts/virt-launcher-monitor-wrapper.sh /usr/bin/virt-launcher-monitor - chmod +x /usr/bin/virt-launcher-monitor - + # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - - cp /etc/ld.so.preload.in /etc/ld.so.preload - + - mv /etc/ld.so.preload.in /etc/ld.so.preload # - cp /etc/ld.so.preload.in /etc/ld.so.preload - - # Create qemu group and user. - - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home + + # # Create qemu group and user. + # - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home - | # [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp @@ -181,6 +205,7 @@ shell: # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] + {{/* # --- # image: {{ $.ImageName }} @@ -191,6 +216,7 @@ shell: # to: / # before: setup */}} + --- image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries final: false @@ -242,10 +268,10 @@ shell: echo "=====Copy libvirt binaries to temp folder======" cp -a /libvirt-bins/. /VBINS/ - + echo "=====Copy qemu binaries to temp folder======" cp -a /qemu-bins/. /VBINS/ - + rm -rf /VBINS/var/run setup: - | @@ -295,36 +321,39 @@ shell: - cd /liboverride - gcc -shared -fPIC -DPIC -Wall -o liboverride.so override.c -ldl - strip liboverride.so ---- -image: {{ $.ImageName }}-test-01 -final: false -fromImage: {{ $.ImageName }} -import: -- image: {{ $.ImageName }}-liboverride-builder - add: /liboverride/ - to: /liboverride - after: install - includePaths: - - liboverride.so -git: - # Add liboverride as a global LD_PRELOAD. - - add: /images/{{ $.ImageName }}/liboverride - to: /etc - stageDependencies: - setup: - - 'ld.so.preload.in' - includePaths: - - ld.so.preload.in -shell: - setup: - - mv /etc/ld.so.preload.in /etc/ld.so.preload ---- -image: {{ $.ImageName }}-virtlauncher + +{{/* +# === +# image: {{ $.ImageName }}-test-01 # final: false -from: {{ $.Images.BASE_SCRATCH }} -# from: {{ $.Images.DISTROLESS_ALT_P11 }} -import: -- image: {{ $.ImageName }}-test-01 - add: / - to: / - after: install +# fromImage: {{ $.ImageName }} +# import: +# - image: {{ $.ImageName }}-liboverride-builder +# add: /liboverride/ +# to: /liboverride +# after: install +# includePaths: +# - liboverride.so +# git: +# # Add liboverride as a global LD_PRELOAD. +# - add: /images/{{ $.ImageName }}/liboverride +# to: /etc +# stageDependencies: +# setup: +# - 'ld.so.preload.in' +# includePaths: +# - ld.so.preload.in +# shell: +# setup: +# - mv /etc/ld.so.preload.in /etc/ld.so.preload +# === +# image: {{ $.ImageName }}-virtlauncher +# # final: false +# from: {{ $.Images.BASE_SCRATCH }} +# # from: {{ $.Images.DISTROLESS_ALT_P11 }} +# import: +# - image: {{ $.ImageName }}-test-01 +# add: / +# to: / +# after: install +*/}} From 0e743d535f79cf428220966e8dac564fc8124b08 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 21:41:41 +0300 Subject: [PATCH 050/107] qemu: pkgversion to 'dvp' Signed-off-by: Nikita Korolev --- images/qemu-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index e6e6bd6ff..75a9c6644 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -119,7 +119,7 @@ shell: ./configure \ --target-list="x86_64-softmmu" \ - --with-pkgversion="qemu-9.2.0-dvp" \ + --with-pkgversion="dvp" \ --with-coroutine=ucontext \ --tls-priority="@QEMU,SYSTEM" \ --block-drv-rw-whitelist="qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress,virtio-blk-vhost-vdpa,virtio-blk-vfio-pci,virtio-blk-vhost-user,io_uring,nvme-io_uring" \ From d3e09369e3ca172de0ff42ab6230ea218c83ae23 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 21:55:16 +0300 Subject: [PATCH 051/107] virt-launcher: fix imports Signed-off-by: Nikita Korolev virt-launcher: change virtlauncher image, add vl-prepared Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 83 ++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 310f7652f..fa2c2a603 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -1,27 +1,58 @@ --- +image: {{ $.ImageName }} +fromImage: {{ $.ImageName }}-prepared +git: + # Add liboverride as a global LD_PRELOAD. + - add: /images/{{ $.ImageName }}/liboverride + to: /etc + stageDependencies: + setup: + - 'ld.so.preload.in' + includePaths: + - ld.so.preload.in +import: + - image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries + add: /VBINS + to: /usr/ + # before: install + after: install + includePaths: + - lib64 + - image: {{ $.ImageName }}-liboverride-builder + add: /liboverride/ + to: /liboverride + after: install + includePaths: + - liboverride.so +shell: + setup: + # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. + - mv /etc/ld.so.preload.in /etc/ld.so.preload +--- {{- $versionLibvirt := "10.10.0" }} -# image: {{ $.ImageName }}-prepared -image: {{ $.ImageName }} +image: {{ $.ImageName }}-prepared +final: false +# image: {{ $.ImageName }} fromImage: base-alt-p11 import: # Before install stage. # Add bins from libvirt and qemu artifacts. -- image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries +- image: {{ $.ImageName }}-merge-qemu-libvirt-binaries add: /VBINS to: / # before: install after: install includePaths: - etc -- image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries - add: /VBINS - to: /usr - # before: install - after: install - includePaths: - - lib64 -- image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries +# - image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries +# add: /VBINS +# to: /usr/lib64 +# # before: install +# after: install +# includePaths: +# - lib64 +- image: {{ $.ImageName }}-merge-qemu-libvirt-binaries add: /VBINS to: / # before: install @@ -51,13 +82,13 @@ import: # After install stage. # Add liboverride library. {{/* +# - image: {{ $.ImageName }}-liboverride-builder +# add: /liboverride/ +# to: /liboverride +# after: install +# includePaths: +# - liboverride.so */}} -- image: {{ $.ImageName }}-liboverride-builder - add: /liboverride/ - to: /liboverride - after: install - includePaths: - - liboverride.so # Add kubeivrt files from virt-artifact. - image: virt-artifact @@ -105,13 +136,13 @@ git: includePaths: - scripts # Add liboverride as a global LD_PRELOAD. - - add: /images/{{ $.ImageName }}/liboverride - to: /etc - stageDependencies: - setup: - - 'ld.so.preload.in' - includePaths: - - ld.so.preload.in + # - add: /images/{{ $.ImageName }}/liboverride + # to: /etc + # stageDependencies: + # setup: + # - 'ld.so.preload.in' + # includePaths: + # - ld.so.preload.in shell: beforeInstall: # Install main packages. @@ -193,7 +224,7 @@ shell: - chmod +x /usr/bin/virt-launcher-monitor # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - - mv /etc/ld.so.preload.in /etc/ld.so.preload + # - mv /etc/ld.so.preload.in /etc/ld.so.preload # - cp /etc/ld.so.preload.in /etc/ld.so.preload # # Create qemu group and user. @@ -218,7 +249,7 @@ shell: */}} --- -image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries +image: {{ $.ImageName }}-merge-qemu-libvirt-binaries final: false fromImage: base-alt-p11 import: From eaf9b5856f95062f8d0a3e47a5ea028ce22dc002 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 22:13:15 +0300 Subject: [PATCH 052/107] virt-artifact: strip virt binaries Signed-off-by: Nikita Korolev --- images/virt-artifact/werf.inc.yaml | 56 +++++++++++++++--------------- images/virt-launcher/werf.inc.yaml | 4 +-- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index 50b2904b7..1e6a64c21 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -89,46 +89,46 @@ shell: - gcc -static cmd/container-disk-v2alpha/main.c -o /kubevirt-binaries/container-disk - echo ============== Build virt-launcher ==================== - - CGO_ENABLED=1 go build -o /kubevirt-binaries/virt-launcher ./cmd/virt-launcher/ + - CGO_ENABLED=1 go build -ldflags="-s -w" -o /kubevirt-binaries/virt-launcher ./cmd/virt-launcher/ - echo ============== Build virt-handler ===================== - - CGO_ENABLED=1 go build -o /kubevirt-binaries/virt-handler ./cmd/virt-handler/ - + - CGO_ENABLED=1 go build -ldflags="-s -w" -o /kubevirt-binaries/virt-handler ./cmd/virt-handler/ + - echo ============== Build virt-launcher-monitor ============ - - go build -o /kubevirt-binaries/virt-launcher-monitor ./cmd/virt-launcher-monitor/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-launcher-monitor-orig ./cmd/virt-launcher-monitor/ + - echo ============== Build virt-tail ======================== - - go build -o /kubevirt-binaries/virt-tail ./cmd/virt-tail/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-tail ./cmd/virt-tail/ + - echo ============== Build virt-freezer ===================== - - go build -o /kubevirt-binaries/virt-freezer ./cmd/virt-freezer/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-freezer ./cmd/virt-freezer/ + - echo ============== Build virt-probe ======================= - - go build -o /kubevirt-binaries/virt-probe ./cmd/virt-probe/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-probe ./cmd/virt-probe/ + - echo ============== Build virt-api ========================= - - go build -o /kubevirt-binaries/virt-api ./cmd/virt-api/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-api ./cmd/virt-api/ + - echo ============== Build virt-chroot ====================== - - go build -o /kubevirt-binaries/virt-chroot ./cmd/virt-chroot/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-chroot ./cmd/virt-chroot/ + - echo ============== Build virt-exportproxy ================= - - go build -o /kubevirt-binaries/virt-exportproxy ./cmd/virt-exportproxy/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-exportproxy ./cmd/virt-exportproxy/ + - echo ============== Build virt-exportserver ================ - - go build -o /kubevirt-binaries/virt-exportserver ./cmd/virt-exportserver/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-exportserver ./cmd/virt-exportserver/ + - echo ============== Build virt-controller ================== - - go build -o /kubevirt-binaries/virt-controller ./cmd/virt-controller/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-controller ./cmd/virt-controller/ + - echo ============== Build virt-operator ==================== - - go build -o /kubevirt-binaries/virt-operator ./cmd/virt-operator/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-operator ./cmd/virt-operator/ + - echo ============== Build csv-generator ==================== - - go build -o /kubevirt-binaries/csv-generator ./tools/csv-generator - + - go build -ldflags="-s -w" -o /kubevirt-binaries/csv-generator ./tools/csv-generator + - echo ============== Build sidecars ========================= - - go build -o /kubevirt-binaries/sidecars ./cmd/sidecars/ - + - go build -ldflags="-s -w" -o /kubevirt-binaries/sidecars ./cmd/sidecars/ + - echo ============== Build virtctl ========================== - - go build -o /kubevirt-binaries/virtctl ./cmd/virtctl/ + - go build -ldflags="-s -w" -o /kubevirt-binaries/virtctl ./cmd/virtctl/ diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index fa2c2a603..8427177a0 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -118,7 +118,7 @@ import: - container-disk - virt-freezer - virt-launcher - - virt-launcher-monitor + - virt-launcher-monitor-orig - virt-probe - virt-tail - image: virt-artifact @@ -219,7 +219,7 @@ shell: setup: # Replace virt-launcher-monitor with the wrapper. - - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig + # - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig - cp /scripts/virt-launcher-monitor-wrapper.sh /usr/bin/virt-launcher-monitor - chmod +x /usr/bin/virt-launcher-monitor From b0ed1c2c918b4719653640af0036119dc00b034a Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 22:17:26 +0300 Subject: [PATCH 053/107] fix vl build Signed-off-by: Nikita Korolev --- images/qemu-artifact/werf.inc.yaml | 2 +- images/virt-launcher/werf.inc.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 75a9c6644..5e83e7ecc 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -119,7 +119,7 @@ shell: ./configure \ --target-list="x86_64-softmmu" \ - --with-pkgversion="dvp" \ + --with-pkgversion="-dvp" \ --with-coroutine=ucontext \ --tls-priority="@QEMU,SYSTEM" \ --block-drv-rw-whitelist="qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress,virtio-blk-vhost-vdpa,virtio-blk-vfio-pci,virtio-blk-vhost-user,io_uring,nvme-io_uring" \ diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 8427177a0..ac821d59c 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -11,7 +11,7 @@ git: includePaths: - ld.so.preload.in import: - - image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries + - image: {{ $.ImageName }}-merge-qemu-libvirt-binaries add: /VBINS to: /usr/ # before: install @@ -26,8 +26,8 @@ import: - liboverride.so shell: setup: - # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - - mv /etc/ld.so.preload.in /etc/ld.so.preload + # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. + - mv /etc/ld.so.preload.in /etc/ld.so.preload --- {{- $versionLibvirt := "10.10.0" }} From ad8e96f2961325661c17aef446e0b14ccf4164a5 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 27 Jan 2025 23:58:39 +0300 Subject: [PATCH 054/107] virt-launcher: reduse size image by deleting docs and some locales Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 90 +++--------------------------- 1 file changed, 8 insertions(+), 82 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index ac821d59c..5f869d754 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -45,13 +45,6 @@ import: after: install includePaths: - etc -# - image: {{ $.ImageName }}-merge-eqmu-libvirt-binaries -# add: /VBINS -# to: /usr/lib64 -# # before: install -# after: install -# includePaths: -# - lib64 - image: {{ $.ImageName }}-merge-qemu-libvirt-binaries add: /VBINS to: / @@ -59,8 +52,6 @@ import: after: install includePaths: - usr - - - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/OVMF @@ -80,16 +71,6 @@ import: - '*.json' # After install stage. -# Add liboverride library. -{{/* -# - image: {{ $.ImageName }}-liboverride-builder -# add: /liboverride/ -# to: /liboverride -# after: install -# includePaths: -# - liboverride.so -*/}} - # Add kubeivrt files from virt-artifact. - image: virt-artifact add: /kubevirt-config-files/ @@ -135,14 +116,6 @@ git: - '**/*' includePaths: - scripts - # Add liboverride as a global LD_PRELOAD. - # - add: /images/{{ $.ImageName }}/liboverride - # to: /etc - # stageDependencies: - # setup: - # - 'ld.so.preload.in' - # includePaths: - # - ld.so.preload.in shell: beforeInstall: # Install main packages. @@ -177,14 +150,6 @@ shell: ln -s /usr/share/OVMF /usr/share/edk2/ovmf ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd - # Installation libvirt and qemu - # - | - # echo "Install libvirt and qemu binaries" - # cp -a -u -v /BINS/usr/* /usr - # cp -a -u -v /BINS/etc/* /etc - # cp -a -u -v /BINS/lib64/* /lib64 - # rm -rf /BINS/ - # Create symlinc for libvirt - | convert_version() { @@ -233,21 +198,18 @@ shell: - | # [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp - mkdir -p /init/usr/bin && ln -s /usr/bin/container-disk /init/usr/bin/container-disk + - | + # Delete unnecessary locales + KEEP_DIRS=("ru" "en_US" "en_GB") + EXCLUDE_PATTERN=$(printf "! -name %s " "${KEEP_DIRS[@]}") + find /usr/share/locale -mindepth 1 -maxdepth 1 -type d ${EXCLUDE_PATTERN} -exec rm -rf {} + + + # delete docs + rm -rf /usr/share/doc/* # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] -{{/* -# --- -# image: {{ $.ImageName }} -# from: {{ $.Images.BASE_SCRATCH }} -# import: -# - image: {{ $.ImageName }}-prepared -# add: / -# to: / -# before: setup -*/}} - --- image: {{ $.ImageName }}-merge-qemu-libvirt-binaries final: false @@ -352,39 +314,3 @@ shell: - cd /liboverride - gcc -shared -fPIC -DPIC -Wall -o liboverride.so override.c -ldl - strip liboverride.so - -{{/* -# === -# image: {{ $.ImageName }}-test-01 -# final: false -# fromImage: {{ $.ImageName }} -# import: -# - image: {{ $.ImageName }}-liboverride-builder -# add: /liboverride/ -# to: /liboverride -# after: install -# includePaths: -# - liboverride.so -# git: -# # Add liboverride as a global LD_PRELOAD. -# - add: /images/{{ $.ImageName }}/liboverride -# to: /etc -# stageDependencies: -# setup: -# - 'ld.so.preload.in' -# includePaths: -# - ld.so.preload.in -# shell: -# setup: -# - mv /etc/ld.so.preload.in /etc/ld.so.preload -# === -# image: {{ $.ImageName }}-virtlauncher -# # final: false -# from: {{ $.Images.BASE_SCRATCH }} -# # from: {{ $.Images.DISTROLESS_ALT_P11 }} -# import: -# - image: {{ $.ImageName }}-test-01 -# add: / -# to: / -# after: install -*/}} From 20b69f2269f88a8bfa790b83704a07d49e71f2eb Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 28 Jan 2025 00:17:47 +0300 Subject: [PATCH 055/107] virt-launcher: change stages, add echo for rm files Signed-off-by: Nikita Korolev virt-launcher: cleanup code Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 51 +++++++++++------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 5f869d754..98939d6f6 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -13,8 +13,7 @@ git: import: - image: {{ $.ImageName }}-merge-qemu-libvirt-binaries add: /VBINS - to: /usr/ - # before: install + to: /usr after: install includePaths: - lib64 @@ -28,12 +27,21 @@ shell: setup: # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - mv /etc/ld.so.preload.in /etc/ld.so.preload + - | + # Delete unnecessary locales + KEEP_LOCALES=("ru" "en_US" "en_GB") + EXCLUDE_PATTERN=$(printf "! -name %s " "${KEEP_LOCALES[@]}") + echo "Delete unnecessary locales" + find /usr/share/locale -mindepth 1 -maxdepth 1 -type d ${EXCLUDE_PATTERN} -exec rm -rf {} + + + # delete docs + echo "Delete docs" + rm -rf /usr/share/doc/* --- {{- $versionLibvirt := "10.10.0" }} image: {{ $.ImageName }}-prepared final: false -# image: {{ $.ImageName }} fromImage: base-alt-p11 import: # Before install stage. @@ -41,22 +49,19 @@ import: - image: {{ $.ImageName }}-merge-qemu-libvirt-binaries add: /VBINS to: / - # before: install - after: install + before: install includePaths: - etc - image: {{ $.ImageName }}-merge-qemu-libvirt-binaries add: /VBINS to: / - # before: install - after: install + before: install includePaths: - usr - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/OVMF - after: install - # before: install + before: install includePaths: - '*.fd' - '*.bin' @@ -65,8 +70,7 @@ import: - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/qemu/firmware - after: install - # before: install + before: install includePaths: - '*.json' @@ -139,13 +143,11 @@ shell: - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin install: - - | - # Create qemu group and user. - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home + # Create qemu group and user. + - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home - beforeSetup: + # Link to dir OVMF - | - # Link to dir OVMF mkdir -p /usr/share/edk2 ln -s /usr/share/OVMF /usr/share/edk2/ovmf ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd @@ -184,28 +186,13 @@ shell: setup: # Replace virt-launcher-monitor with the wrapper. - # - mv /usr/bin/virt-launcher-monitor /usr/bin/virt-launcher-monitor-orig - cp /scripts/virt-launcher-monitor-wrapper.sh /usr/bin/virt-launcher-monitor - chmod +x /usr/bin/virt-launcher-monitor - - # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - # - mv /etc/ld.so.preload.in /etc/ld.so.preload - # - cp /etc/ld.so.preload.in /etc/ld.so.preload - - # # Create qemu group and user. - # - groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home - | # [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp - mkdir -p /init/usr/bin && ln -s /usr/bin/container-disk /init/usr/bin/container-disk - - | - # Delete unnecessary locales - KEEP_DIRS=("ru" "en_US" "en_GB") - EXCLUDE_PATTERN=$(printf "! -name %s " "${KEEP_DIRS[@]}") - find /usr/share/locale -mindepth 1 -maxdepth 1 -type d ${EXCLUDE_PATTERN} -exec rm -rf {} + - - # delete docs - rm -rf /usr/share/doc/* + # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] From ba7199710fb43a3c325cc65c4c96e680f3f5539f Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 28 Jan 2025 13:15:45 +0300 Subject: [PATCH 056/107] qemu: change to 9.1.0 Signed-off-by: Nikita Korolev qemu: disable-af-xdp for 9.1.0 Signed-off-by: Nikita Korolev qemu: add patches 9.1.0 Signed-off-by: Nikita Korolev edk2: rm unnecessary comments Signed-off-by: Nikita Korolev qemu: add all patches Signed-off-by: Nikita Korolev --- images/edk2-artifact/werf.inc.yaml | 2 - .../patches/0004-Initial-redhat-build.patch | 331 +++++ ...0005-Enable-disable-devices-for-RHEL.patch | 905 ++++++++++++ ...Machine-type-related-general-changes.patch | 749 ++++++++++ ...temporarily-disable-Wunused-function.patch | 36 + ...machine-type-versions-for-aarch64-s3.patch | 139 ++ ...rsioned-machine-type-macros-for-RHEL.patch | 195 +++ ...ease-deletion-schedule-to-3-releases.patch | 33 + ...aarch64-versioned-virt-machine-types.patch | 368 +++++ ...-ppc64-versioned-spapr-machine-types.patch | 529 ++++++++ ...390x-versioned-s390-ccw-virtio-machi.patch | 327 +++++ ...86_64-versioned-pc-q35-machine-types.patch | 925 +++++++++++++ ...temporarily-disable-Wunused-function.patch | 32 + .../patches/0016-Enable-make-check.patch | 280 ++++ ...mber-of-devices-that-can-be-assigned.patch | 110 ++ ...Add-support-statement-to-help-output.patch | 55 + ...documentation-instead-of-qemu-system.patch | 61 + ...on-warning-when-opening-v2-images-rw.patch | 77 ++ ...-Update-the-logfile-path-of-qga-fsfr.patch | 43 + ...0023-Add-upstream-compatibility-bits.patch | 109 ++ ...9.1-compat-handling-to-the-s390x-mac.patch | 37 + ...25-redhat-Add-rhel9.6.0-machine-type.patch | 55 + ...tibility-of-pc-q35-rhel9-and-pc-i440.patch | 43 + ...m-ensure-compatibility-of-virt-rhel9.patch | 27 + ...e-new-virt-machine-type-for-rhel-9.6.patch | 41 + ...new-pc-q35-machine-type-for-rhel-9.6.patch | 42 + ...Manufacturer-and-Product-Name-in-emu.patch | 90 ++ ...-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch | 49 + ...KVM-Dynamic-sized-kvm-memslots-array.patch | 250 ++++ ...moryListener.nr_used_slots-to-nr_slo.patch | 72 + ...me-KVMState-nr_slots-to-nr_slots_max.patch | 89 ++ ...-accel-kvm-refactor-dirty-ring-setup.patch | 143 ++ ...m-Update-documentation-for-s390x-IPL.patch | 76 ++ ...index-Make-it-clear-that-s390x-can-a.patch | 45 + ...x-bootdevices-Update-loadparm-docume.patch | 65 + ...x-bootdevices-Update-the-documentati.patch | 66 + ...rge-property-after-the-memory-region.patch | 61 + ...property-to-scsi-disk-devices-for-bo.patch | 221 +++ ...x-Build-an-IPLB-for-each-boot-device.patch | 270 ++++ ...the-possibility-to-load-the-s390-net.patch | 201 +++ ...t-loadparm-property-to-devices-that-.patch | 113 ++ ...vide-more-memory-to-the-s390-ccw.img.patch | 61 + ...-Add-include-files-for-common-IPL-st.patch | 402 ++++++ ...ch_get-put_registers-to-accept-Error.patch | 287 ++++ ...e-virtual-machine-creation-into-its-.patch | 143 ++ ...ntf-with-error_report-printf-in-kvm_.patch | 131 ++ ...pipes-to-keep-working-for-fd-migrati.patch | 116 ++ ...ration-Ensure-vmstate_save-sets-errp.patch | 92 ++ ...90-ccw-Clarify-alignment-is-in-bytes.patch | 60 + ...ios-s390-ccw-Don-t-generate-TEXTRELs.patch | 83 ++ ...-Enable-failed-IPL-to-return-after-e.patch | 426 ++++++ ...ios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch | 63 + ...-Link-the-netboot-code-into-the-main.patch | 263 ++++ ...-Merge-netboot.mak-into-the-main-Mak.patch | 141 ++ ...-Re-initialize-receive-queue-index-b.patch | 45 + ...ccw-Remove-panics-from-DASD-IPL-path.patch | 177 +++ ...ccw-Remove-panics-from-ECKD-IPL-path.patch | 475 +++++++ ...-ccw-Remove-panics-from-ISO-IPL-path.patch | 269 ++++ ...-Remove-panics-from-Netboot-IPL-path.patch | 130 ++ ...ccw-Remove-panics-from-SCSI-IPL-path.patch | 554 ++++++++ ...-Use-the-libc-from-SLOF-and-remove-s.patch | 1208 +++++++++++++++++ ...-s390x-Enable-multi-device-boot-loop.patch | 227 ++++ ...itialize-cdrom-type-to-false-for-eac.patch | 43 + ...itialize-machine-loadparm-before-pro.patch | 55 + ...m-pc-q35-Bump-max_cpus-to-4096-vcpus.patch | 75 + ...dual-loadparm-assignment-to-CCW-devi.patch | 362 +++++ ...LB-for-SCSI-device-directly-from-DIA.patch | 264 ++++ ...si-fix-allocation-for-s390x-loadparm.patch | 48 + ...Report-which-action-failed-in-kvm_ar.patch | 176 +++ ...s390x-boot-order-tests-to-cdrom-test.patch | 74 + ...ner-Fix-container-object-destruction.patch | 61 + ...hange-trace-formats-from-hex-to-deci.patch | 70 + ...eport-only-stop-copy-size-in-vfio_st.patch | 66 + ...o-net-Add-queues-before-loading-them.patch | 94 ++ ...c-fix-crash-when-no-console-attached.patch | 61 + images/qemu-artifact/werf.inc.yaml | 17 +- 76 files changed, 14178 insertions(+), 3 deletions(-) create mode 100644 images/qemu-artifact/patches/0004-Initial-redhat-build.patch create mode 100644 images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch create mode 100644 images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch create mode 100644 images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch create mode 100644 images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch create mode 100644 images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch create mode 100644 images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch create mode 100644 images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch create mode 100644 images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch create mode 100644 images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch create mode 100644 images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch create mode 100644 images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch create mode 100644 images/qemu-artifact/patches/0016-Enable-make-check.patch create mode 100644 images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch create mode 100644 images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch create mode 100644 images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch create mode 100644 images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch create mode 100644 images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch create mode 100644 images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch create mode 100644 images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch create mode 100644 images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch create mode 100644 images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch create mode 100644 images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch create mode 100644 images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch create mode 100644 images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch create mode 100644 images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch create mode 100644 images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch create mode 100644 images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch create mode 100644 images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch create mode 100644 images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch create mode 100644 images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch create mode 100644 images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch create mode 100644 images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch create mode 100644 images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch create mode 100644 images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch create mode 100644 images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch create mode 100644 images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch create mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch create mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch create mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch create mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch create mode 100644 images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch create mode 100644 images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch create mode 100644 images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch create mode 100644 images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch create mode 100644 images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch create mode 100644 images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch create mode 100644 images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch create mode 100644 images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch create mode 100644 images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch create mode 100644 images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch create mode 100644 images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch create mode 100644 images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch create mode 100644 images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch create mode 100644 images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch create mode 100644 images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch create mode 100644 images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch create mode 100644 images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml index 52a6876cd..5a85bc936 100644 --- a/images/edk2-artifact/werf.inc.yaml +++ b/images/edk2-artifact/werf.inc.yaml @@ -52,7 +52,6 @@ shell: git clone --depth=1 --branch {{ $gitRepoName }}-{{ $versionEdk2 }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionEdk2 }} git clone https://github.com/tianocore/edk2-platforms.git - # git clone https://github.com/tianocore/edk2-staging.git cd {{ $gitRepoName }}-{{ $versionEdk2 }} git submodule update --init --recursive @@ -69,7 +68,6 @@ shell: echo "Setting up the build environment..." source ./edksetup.sh BaseTools - # mkdir -p /FIRMWARE setup: - | /build.sh 2>&1 > /dev/null diff --git a/images/qemu-artifact/patches/0004-Initial-redhat-build.patch b/images/qemu-artifact/patches/0004-Initial-redhat-build.patch new file mode 100644 index 000000000..6fae1c686 --- /dev/null +++ b/images/qemu-artifact/patches/0004-Initial-redhat-build.patch @@ -0,0 +1,331 @@ +From cbd36e2ba7f3e96ce441c7cfbf92017a7ba3bfe8 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Wed, 26 May 2021 10:56:02 +0200 +Subject: Initial redhat build + +This patch introduces redhat build structure in redhat subdirectory. In addition, +several issues are fixed in QEMU tree: + +- Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm + - As we use qemu-kvm as name in all places, this is updated to be consistent +- Man page renamed from qemu to qemu-kvm + - man page is installed using make install so we have to fix it in qemu tree + +We disable make check due to issues with some of the tests. + +This rebase is based on qemu-kvm-9.0.0-10.el9 + +Signed-off-by: Miroslav Rezanina +-- +Rebase changes (6.1.0): +- Move build to .distro +- Move changes for support file to related commit +- Added dependency for python3-sphinx-rtd_theme +- Removed --disable-sheepdog configure option +- Added new hw-display modules +- SASL initialization moved to ui/vnc-auth-sasl.c +- Add accel-qtest- and accel-tcg-x86_64 libraries +- Added hw-usb-host module +- Disable new configure options (bpf, nvmm, slirp-smbd) +- Use -pie for ksmctl build (annocheck complain fix) + +Rebase changes (6.2.0): +- removed --disable-jemalloc and --disable-tcmalloc configure options +- added audio-oss.so +- added fdt requirement for x86_64 +- tests/acceptance renamed to tests/avocado +- added multiboot_dma.bin +- Add -Wno-string-plus-int to extra flags +- Updated configure options + +Rebase changes (7.0.0): +- Do not use -mlittle CFLAG on ppc64le +- Used upstream handling issue with ui/clipboard.c +- Use -mlittle-endian on ppc64le instead of deleteing it in configure +- Drop --disable-libxml2 option for configure (upstream) +- Remove vof roms +- Disable AVX2 support +- Use internal meson +- Disable new configure options (dbus-display and qga-vss) +- Change permissions on installing tests/Makefile.include +- Remove ssh block driver + +Rebase changes (7.1.0): +- --disable-vnc-png renamed to --disable-png (upstream) +- removed --disable-vhost-vsock and --disable-vhost-scsi +- capstone submodule removed +- Temporary include capstone build + +Rebase changes (7.2.0): +- Switch --enable-slirp=system to --enable-slirp +- Added new configure options (blkio and sndio, both disabled) + +Rebase changes (7.2.0): +- Fix SRPM name generation to work on Fedora 37 +- Switch back to system meson + +Rebase changes (8.0.0): +- use enable-dtrace-backands instead of enable-dtrace-backend +- Removed qemu virtiofsd bits +- test/check-block.sh removed (upstream) +- Add new --disable-* options for configure + +Rebase changes (8.1.0): +- qmp-spec.txt installed by make +- Removed --meson configure option +- Add --disable-pypi +- Removed --with-git and -with-gitsubmodules +- Renamed --disable-pypi to --disable-downloads +- Minor updates in README.tests + +Rebase changes (8.2.0): +- Removed --disable-hax (upstream) +- Added --disable-plugins configure option +- Fixing frh.py strings + +Rebase notes (9.0.0): +- Fixed qemu-kvm binary location change +- Remove hppa-firmware64.img +- Package stp files for utilities +- Download subprojects on local build + +Rebase notes (9.1.0 rc0): +- Explicit BuildRequires for python3-tomli +- Removed --disable-avx512f configure option + +Merged patches (6.0.0): + - 605758c902 Limit build on Power to qemu-img and qemu-ga only + +Merged patches (6.1.0): +- f04f91751f Use cached tarballs +- 6581165c65 Remove message with running VM count +- 03c3cac9fc spec-file: build qemu-kvm without SPICE and QXL +- e0ae6c1f6c spec-file: Obsolete qemu-kvm-ui-spice +- 9d2e9f9ecf spec: Do not build qemu-kvm-block-gluster +- cf470b4234 spec: Do not link pcnet and ne2k_pci roms +- e981284a6b redhat: Install the s390-netboot.img that we've built +- 24ef557f33 spec: Remove usage of Group: tag +- c40d69b4f4 spec: Drop %defattr usage +- f8e98798ce spec: Clean up BuildRequires +- 47246b43ee spec: Remove iasl BuildRequires +- 170dc1cbe0 spec: Remove redundant 0 in conditionals +- 8718f6fa11 spec: Add more have_XXX conditionals +- a001269ce9 spec: Remove binutils versioned Requires +- 34545ee641 spec: Remove diffutils BuildRequires +- c2c82beac9 spec: Remove redundant Requires: +- 9314c231f4 spec: Add XXX_version macros +- c43db0bf0f spec: Add have_block_rbd +- 3ecb0c0319 qga: drop StandardError=syslog +- 018049dc80 Remove iscsi support +- a2edf18777 redhat: Replace the kvm-setup.service with a /etc/modules-load.d config file +- 387b5fbcfe redhat: Move qemu-kvm-docs dependency to qemu-kvm +- 4ead693178 redhat: introducting qemu-kvm-hw-usbredir +- 4dc6fc3035 redhat: use the standard vhost-user JSON path +- 84757178b4 Fix local build +- 8c394227dd spec: Restrict block drivers in tools +- b6aa7c1fae Move tools to separate package +- eafd82e509 Split qemu-pr-helper to separate package +- 2c0182e2aa spec: RPM_BUILD_ROOT -> %{buildroot} +- 91bd55ca13 spec: More use of %{name} instead of 'qemu-kvm' +- 50ba299c61 spec: Use qemu-pr-helper.service from qemu.git (partial) +- ee08d4e0a3 spec: Use %{_sourcedir} for referencing sources +- 039e7f7d02 spec: Add tools_only +- 884ba71617 spec: %build: Add run_configure helper +- 8ebd864d65 spec: %build: Disable more bits with %{disable_everything} (partial) +- f23fdb53f5 spec: %build: Add macros for some 'configure' parameters +- fe951a8bd8 spec: %files: Move qemu-guest-agent and qemu-img earlier +- 353b632e37 spec: %install: Remove redundant bits +- 9d2015b752 spec: %install: Add %{modprobe_kvm_conf} macro +- 6d05134e8c spec: %install: Remove qemu-guest-agent /etc/qemu-kvm usage +- 985b226467 spec: %install: clean up qemu-ga section +- dfaf9c600d spec: %install: Use a single %{tools_only} section +- f6978ddb46 spec: Make tools_only not cross spec sections +- 071c211098 spec: %install: Limit time spent in %{qemu_kvm_build} +- 1b65c674be spec: misc syntactic merges with Fedora +- 4da16294cf spec: Use Fedora's pattern for specifying rc version +- d7ee259a79 spec: %files: don't use fine grained -docs file list +- 64cad0c60f spec: %files: Add licenses to qemu-common too +- c3de4f080a spec: %install: Drop python3 shebang fixup +- 46fc216115 Update local build to work with spec file improvements +- bab9531548 spec: Remove buildldflags +- c8360ab6a9 spec: Use %make_build macro +- f6966c66e9 spec: Drop make install sharedir and datadir usage +- 86982421bc spec: use %make_install macro +- 191c405d22 spec: parallelize `make check` +- 251a1fb958 spec: Drop explicit --build-id +- 44c7dda6c3 spec: use %{build_ldflags} +- 0009a34354 Move virtiofsd to separate package +- 34d1b200b3 Utilize --firmware configure option +- 2800e1dd03 spec: Switch toolchain to Clang/LLVM (except process-patches.sh) +- e8a70f500f spec: Use safe-stack for x86_64 +- e29445d50d spec: Reenable write support for VMDK etc. in tools +- a4fe2a3e16 redhat: Disable LTO on non-x86 architectures + +Merged patches (6.2.0): +- 333452440b remove sgabios dependency +- 7d3633f184 enable pulseaudio +- bd898709b0 spec: disable use of gcrypt for crypto backends in favour of gnutls +- e4f0c6dee6 spec: Remove block-curl and block-ssh dependency +- 4dc13bfe63 spec: Build the VDI block driver +- d2f2ff3c74 spec: Explicitly include compress filter +- a7d047f9c2 Move ksmtuned files to separate package + +Merged patches (7.0.0): +- 098d4d08d0 spec: Rename qemu-kvm-hw-usbredir to qemu-kvm-device-usb-redirect +- c2bd0d6834 spec: Split qemu-kvm-ui-opengl +- 2c9cda805d spec: Introduce packages for virtio-gpu-* modules (changed as rhel device tree not set) +- d0414a3e0b spec: Introduce device-display-virtio-vga* packages +- 3534ec46d4 spec: Move usb-host module to separate package +- ddc14d4737 spec: Move qtest accel module to tests package +- 6f2c4befa6 spec: Extend qemu-kvm-core description +- 6f11866e4e (rhel/rhel-9.0.0) Update to qemu-kvm-6.2.0-6.el9 +- da0a28758f ui/clipboard: fix use-after-free regression +- 895d4d52eb spec: Remove qemu-virtiofsd +- c8c8c8bd84 spec: Fix obsolete for spice subpackages +- d46d2710b2 spec: Obsolete old usb redir subpackage +- 6f52a50b68 spec: Obsolete ssh driver + +Merged patches (7.2.0): +- 8c6834feb6 Remove opengl display device subpackages (C9S MR 124) +- 0ecc97f29e spec: Add requires for packages with additional virtio-gpu variants (C9S MR 124) + +Merged patches (8.0.0): +- 7754f6ba78 Minor packaging fixes +- 401af56187 spec: Disable VDUSE + +Merged patches (8.1.0): +- 0c2306676f Enable Linux io_uring +- b7fa6426d5 Enable libblkio block drivers +- 19f6d7a6f4 Fix virtio-blk-vhost-vdpa typo in spec file +- f356cae88f spec: Build DBUS display +- 77b763efd5 Provide elf2dmp binary in qemu-tools + +Merged patches (8.2.0): +- cd9efa221d Enable qemu-kvm-device-usb-redirec for aarch64 + +Merged patches (9.0.0 rc0): +- 25de053dbf spec: Enable zstd + +Signed-off-by: Miroslav Rezanina +--- + .distro/Makefile | 101 + + .distro/Makefile.common | 42 + + .distro/README.tests | 39 + + .distro/modules-load.conf | 4 + + .distro/qemu-guest-agent.service | 1 - + .distro/qemu-kvm.spec.template | 5351 +++++++++++++++++++++++ + .distro/rpminspect.yaml | 6 +- + .distro/scripts/extract_build_cmd.py | 12 + + .distro/scripts/frh.py | 4 +- + .distro/scripts/process-patches.sh | 6 +- + .gitignore | 1 + + README.systemtap | 43 + + scripts/qemu-guest-agent/fsfreeze-hook | 2 +- + scripts/systemtap/conf.d/qemu_kvm.conf | 4 + + scripts/systemtap/script.d/qemu_kvm.stp | 1 + + ui/vnc-auth-sasl.c | 2 +- + 16 files changed, 5612 insertions(+), 7 deletions(-) + create mode 100644 .distro/Makefile + create mode 100644 .distro/Makefile.common + create mode 100644 .distro/README.tests + create mode 100644 .distro/modules-load.conf + create mode 100644 .distro/qemu-kvm.spec.template + create mode 100644 README.systemtap + create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf + create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp + +diff --git a/README.systemtap b/README.systemtap +new file mode 100644 +index 0000000000..ad913fc990 +--- /dev/null ++++ b/README.systemtap +@@ -0,0 +1,43 @@ ++QEMU tracing using systemtap-initscript ++--------------------------------------- ++ ++You can capture QEMU trace data all the time using systemtap-initscript. This ++uses SystemTap's flight recorder mode to trace all running guests to a ++fixed-size buffer on the host. Old trace entries are overwritten by new ++entries when the buffer size wraps. ++ ++1. Install the systemtap-initscript package: ++ # yum install systemtap-initscript ++ ++2. Install the systemtap scripts and the conf file: ++ # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/ ++ # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/ ++ ++The set of trace events to enable is given in qemu_kvm.stp. This SystemTap ++script can be customized to add or remove trace events provided in ++/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp. ++ ++SystemTap customizations can be made to qemu_kvm.conf to control the flight ++recorder buffer size and whether to store traces in memory only or disk too. ++See stap(1) for option documentation. ++ ++3. Start the systemtap service. ++ # service systemtap start qemu_kvm ++ ++4. Make the service start at boot time. ++ # chkconfig systemtap on ++ ++5. Confirm that the service works. ++ # service systemtap status qemu_kvm ++ qemu_kvm is running... ++ ++When you want to inspect the trace buffer, perform the following steps: ++ ++1. Dump the trace buffer. ++ # staprun -A qemu_kvm >/tmp/trace.log ++ ++2. Start the systemtap service because the preceding step stops the service. ++ # service systemtap start qemu_kvm ++ ++3. Translate the trace record to readable format. ++ # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log +diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook +index 13aafd4845..e9b84ec028 100755 +--- a/scripts/qemu-guest-agent/fsfreeze-hook ++++ b/scripts/qemu-guest-agent/fsfreeze-hook +@@ -8,7 +8,7 @@ + # request, it is issued with "thaw" argument after filesystem is thawed. + + LOGFILE=/var/log/qga-fsfreeze-hook.log +-FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d ++FSFREEZE_D=$(dirname -- "$(realpath $0)")/fsfreeze-hook.d + + # Check whether file $1 is a backup or rpm-generated file and should be ignored + is_ignored_file() { +diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf +new file mode 100644 +index 0000000000..372d8160a4 +--- /dev/null ++++ b/scripts/systemtap/conf.d/qemu_kvm.conf +@@ -0,0 +1,4 @@ ++# Force load uprobes (see BZ#1118352) ++stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true ++ ++qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes +diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp +new file mode 100644 +index 0000000000..c04abf9449 +--- /dev/null ++++ b/scripts/systemtap/script.d/qemu_kvm.stp +@@ -0,0 +1 @@ ++probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {} +diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c +index 47fdae5b21..2a950caa2a 100644 +--- a/ui/vnc-auth-sasl.c ++++ b/ui/vnc-auth-sasl.c +@@ -42,7 +42,7 @@ + + bool vnc_sasl_server_init(Error **errp) + { +- int saslErr = sasl_server_init(NULL, "qemu"); ++ int saslErr = sasl_server_init(NULL, "qemu-kvm"); + + if (saslErr != SASL_OK) { + error_setg(errp, "Failed to initialize SASL auth: %s", +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch b/images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch new file mode 100644 index 000000000..0fdb3617b --- /dev/null +++ b/images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch @@ -0,0 +1,905 @@ +From f9c7b0f1176bc2a0ddd97de6e0fbc1055eab7b57 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Wed, 7 Dec 2022 03:05:48 -0500 +Subject: Enable/disable devices for RHEL + +This commit adds all changes related to changes in supported devices. + +Signed-off-by: Miroslav Rezanina +-- +Rebase notes (6.1.0): +- Added CONFIG_TPM (except s390x) +- default-configs moved to configs +- Use --with-device- configure option to use rhel configs + +Rebase notes (6.2.0): +- Add CONFIG_ISA_FDC +- Do not remove -no-hpet documentation + +Rebase notes (7.0.0): +- Added CONFIG_ARM_GIC_TCG option for aarch64 +- Fixes necessary for layout change fixes +- Renamed CONFIG_ARM_GIC_TCG to CONFIG_ARM_GICV3_TCG +- Removed upstream devices + +Rebase notes (7.1.0): +- Added CONFIG_VHOST_VSOCK and CONFIG_VHOST_USER_VSOCK configs +- Added CONFIG_CXL and CONFIG_CXL_MEM_DEVICE for aarch64 and x86_64 +- Added CONFIG_VHOST_USER_FS option (all archs) + +Rebase notes (7.2.0): +- Removed disabling a15mpcore.c as no longer needed + +Rebase notes (8.0.0): +- Rename CONFIG_ACPI_X86_ICH to CONFIG_ACPI_ICH9 +- Inlude qemu/error-report.h in hw/display/cirrus_vga.c +- Change virtiofsd dependency version + +Rebase notes (8.1.0): +- Added CONFIG_PCIE_PCI_BRIDGE for x86_64 +- Disabling tcg cpus for aarch64 +- Disable CONFIG_ARM_V7M and remove related hack +- Moved aarch64 tcg cpu disabling from arm machine type commit + +Rebase notes (8.2.0): +- Disabled new a710 arm64 tcg cpu +- No longer needed hack for removal of i2c-echo +- Disable new neoverse-v2 +- Removed CONFIG_OPENGL from x86_64 config file + +Rebase notes (9.0.0 rc0): +- Split CONFIG_IDE_QDEV to CONFIG_IDE_DEV and CONFIG_IDE_BUS (upstream change) + +Rebase notes (9.0.0 rc1): +- Do not compile armv7 cpu types + +Rebase notes (9.1.0 rc0): +- Return value added for kvm_s390_apply_cpu_model +- Added new USB_HID and USB_HUB options + +Rebase notes (9.1.0 rc1): +- Fix disabling cpus in valid_cpy_types + +Merged patches (6.1.0): +- c51bf45304 Remove SPICE and QXL from x86_64-rh-devices.mak +- 02fc745601 aarch64-rh-devices: add CONFIG_PVPANIC_PCI +- f2fe835153 aarch64-rh-devices: add CONFIG_PXB +- b5431733ad disable CONFIG_USB_STORAGE_BOT +- 478ba0cdf6 Disable TPM passthrough +- 2504d68a7c aarch64: Add USB storage devices +- 51c2a3253c disable ac97 audio + +Merged patches (6.2.0): +- 9f2f9fa2ba disable sga device + +Merged patches (7.0.0): +- fd7c45a5a8 redhat: Enable virtio-mem as tech-preview on x86-64 +- c9e68ea451 Enable SGX -- RH Only + +Merged patches (7.1.0): +- 38b89dc245 pc: Move s3/s4 suspend disabling to compat (only hw/acpi/ich9.c chunk) +- 8f663466c6 configs/devices/aarch64-softmmu: Enable CONFIG_VIRTIO_MEM +- 1bf372717a Enable virtio-iommu-pci on aarch64 +- ae3f269458 Enable virtio-iommu-pci on x86_64 + +Merged patches (8.1.0): +- 8173d2eaba Disable unwanted new devices + +Merged patches (8.2.0): +- b29f66431f Enable igb on x86_64 + +Merged patches (9.0.0 rc0): +- 3889ede5d9 Compile IOMMUFD on x86_64 +- 0beb18451f Compile IOMMUFD on s390x +- 2b4b13f70d Compile IOMMUFD object on aarch64 +--- + .distro/qemu-kvm.spec.template | 18 +-- + .../aarch64-softmmu/aarch64-rh-devices.mak | 44 +++++++ + .../ppc64-softmmu/ppc64-rh-devices.mak | 37 ++++++ + configs/devices/rh-virtio.mak | 10 ++ + .../s390x-softmmu/s390x-rh-devices.mak | 19 +++ + .../x86_64-softmmu/x86_64-rh-devices.mak | 114 ++++++++++++++++++ + hw/arm/virt.c | 4 + + hw/block/fdc.c | 10 ++ + hw/cxl/meson.build | 3 +- + hw/display/cirrus_vga.c | 4 + + hw/ide/piix.c | 5 +- + hw/input/pckbd.c | 2 + + hw/net/e1000.c | 2 + + hw/ppc/spapr_cpu_core.c | 2 + + hw/usb/meson.build | 2 +- + hw/virtio/meson.build | 6 +- + target/arm/arm-qmp-cmds.c | 2 + + target/arm/cpu.c | 4 + + target/arm/cpu.h | 3 + + target/arm/cpu64.c | 12 +- + target/arm/tcg/cpu32.c | 2 + + target/arm/tcg/cpu64.c | 8 ++ + target/arm/tcg/meson.build | 4 +- + target/ppc/cpu-models.c | 9 ++ + target/s390x/cpu_models_sysemu.c | 3 + + target/s390x/kvm/kvm.c | 8 ++ + tests/qtest/arm-cpu-features.c | 4 + + 27 files changed, 325 insertions(+), 16 deletions(-) + create mode 100644 configs/devices/aarch64-softmmu/aarch64-rh-devices.mak + create mode 100644 configs/devices/ppc64-softmmu/ppc64-rh-devices.mak + create mode 100644 configs/devices/rh-virtio.mak + create mode 100644 configs/devices/s390x-softmmu/s390x-rh-devices.mak + create mode 100644 configs/devices/x86_64-softmmu/x86_64-rh-devices.mak + +diff --git a/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak +new file mode 100644 +index 0000000000..c7e4fdc25a +--- /dev/null ++++ b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak +@@ -0,0 +1,44 @@ ++include ../rh-virtio.mak ++ ++CONFIG_ARM_GIC_KVM=y ++CONFIG_ARM_GICV3_TCG=y ++CONFIG_ARM_GIC=y ++CONFIG_ARM_SMMUV3=y ++CONFIG_ARM_VIRT=y ++CONFIG_CXL=y ++CONFIG_CXL_MEM_DEVICE=y ++CONFIG_EDID=y ++CONFIG_PCIE_PORT=y ++CONFIG_PCIE_PCI_BRIDGE=y ++CONFIG_PCI_DEVICES=y ++CONFIG_PCI_TESTDEV=y ++CONFIG_PFLASH_CFI01=y ++CONFIG_SCSI=y ++CONFIG_SEMIHOSTING=y ++CONFIG_USB=y ++CONFIG_USB_XHCI=y ++CONFIG_USB_XHCI_PCI=y ++CONFIG_USB_STORAGE_CORE=y ++CONFIG_USB_STORAGE_CLASSIC=y ++CONFIG_USB_HUB=y ++CONFIG_USB_HID=y ++CONFIG_VFIO=y ++CONFIG_VFIO_PCI=y ++CONFIG_VIRTIO_MMIO=y ++CONFIG_VIRTIO_PCI=y ++CONFIG_VIRTIO_MEM=y ++CONFIG_VIRTIO_IOMMU=y ++CONFIG_XIO3130=y ++CONFIG_NVDIMM=y ++CONFIG_ACPI_APEI=y ++CONFIG_TPM=y ++CONFIG_TPM_EMULATOR=y ++CONFIG_TPM_TIS_SYSBUS=y ++CONFIG_PTIMER=y ++CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y ++CONFIG_PVPANIC_PCI=y ++CONFIG_PXB=y ++CONFIG_VHOST_VSOCK=y ++CONFIG_VHOST_USER_VSOCK=y ++CONFIG_VHOST_USER_FS=y ++CONFIG_IOMMUFD=y +diff --git a/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak b/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak +new file mode 100644 +index 0000000000..dbb7d30829 +--- /dev/null ++++ b/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak +@@ -0,0 +1,37 @@ ++include ../rh-virtio.mak ++ ++CONFIG_DIMM=y ++CONFIG_MEM_DEVICE=y ++CONFIG_NVDIMM=y ++CONFIG_PCI=y ++CONFIG_PCI_DEVICES=y ++CONFIG_PCI_TESTDEV=y ++CONFIG_PCI_EXPRESS=y ++CONFIG_PSERIES=y ++CONFIG_SCSI=y ++CONFIG_SPAPR_VSCSI=y ++CONFIG_TEST_DEVICES=y ++CONFIG_USB=y ++CONFIG_USB_OHCI=y ++CONFIG_USB_OHCI_PCI=y ++CONFIG_USB_SMARTCARD=y ++CONFIG_USB_STORAGE_CORE=y ++CONFIG_USB_STORAGE_CLASSIC=y ++CONFIG_USB_XHCI=y ++CONFIG_USB_XHCI_NEC=y ++CONFIG_USB_XHCI_PCI=y ++CONFIG_VFIO=y ++CONFIG_VFIO_PCI=y ++CONFIG_VGA=y ++CONFIG_VGA_PCI=y ++CONFIG_VHOST_USER=y ++CONFIG_VIRTIO_PCI=y ++CONFIG_VIRTIO_VGA=y ++CONFIG_WDT_IB6300ESB=y ++CONFIG_XICS=y ++CONFIG_XIVE=y ++CONFIG_TPM=y ++CONFIG_TPM_SPAPR=y ++CONFIG_TPM_EMULATOR=y ++CONFIG_VHOST_VSOCK=y ++CONFIG_VHOST_USER_VSOCK=y +diff --git a/configs/devices/rh-virtio.mak b/configs/devices/rh-virtio.mak +new file mode 100644 +index 0000000000..94ede1b5f6 +--- /dev/null ++++ b/configs/devices/rh-virtio.mak +@@ -0,0 +1,10 @@ ++CONFIG_VIRTIO=y ++CONFIG_VIRTIO_BALLOON=y ++CONFIG_VIRTIO_BLK=y ++CONFIG_VIRTIO_GPU=y ++CONFIG_VIRTIO_INPUT=y ++CONFIG_VIRTIO_INPUT_HOST=y ++CONFIG_VIRTIO_NET=y ++CONFIG_VIRTIO_RNG=y ++CONFIG_VIRTIO_SCSI=y ++CONFIG_VIRTIO_SERIAL=y +diff --git a/configs/devices/s390x-softmmu/s390x-rh-devices.mak b/configs/devices/s390x-softmmu/s390x-rh-devices.mak +new file mode 100644 +index 0000000000..24cf6dbd03 +--- /dev/null ++++ b/configs/devices/s390x-softmmu/s390x-rh-devices.mak +@@ -0,0 +1,19 @@ ++include ../rh-virtio.mak ++ ++CONFIG_PCI=y ++CONFIG_S390_CCW_VIRTIO=y ++CONFIG_S390_FLIC=y ++CONFIG_S390_FLIC_KVM=y ++CONFIG_SCLPCONSOLE=y ++CONFIG_SCSI=y ++CONFIG_VFIO=y ++CONFIG_VFIO_AP=y ++CONFIG_VFIO_CCW=y ++CONFIG_VFIO_PCI=y ++CONFIG_VHOST_USER=y ++CONFIG_VIRTIO_CCW=y ++CONFIG_WDT_DIAG288=y ++CONFIG_VHOST_VSOCK=y ++CONFIG_VHOST_USER_VSOCK=y ++CONFIG_VHOST_USER_FS=y ++CONFIG_IOMMUFD=y +diff --git a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak +new file mode 100644 +index 0000000000..3e5f693b62 +--- /dev/null ++++ b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak +@@ -0,0 +1,114 @@ ++include ../rh-virtio.mak ++ ++CONFIG_ACPI=y ++CONFIG_ACPI_PCI=y ++CONFIG_ACPI_CPU_HOTPLUG=y ++CONFIG_ACPI_MEMORY_HOTPLUG=y ++CONFIG_ACPI_NVDIMM=y ++CONFIG_ACPI_SMBUS=y ++CONFIG_ACPI_VMGENID=y ++CONFIG_ACPI_X86=y ++CONFIG_ACPI_ICH9=y ++CONFIG_AHCI=y ++CONFIG_APIC=y ++CONFIG_APM=y ++CONFIG_BOCHS_DISPLAY=y ++CONFIG_CXL=y ++CONFIG_CXL_MEM_DEVICE=y ++CONFIG_DIMM=y ++CONFIG_E1000E_PCI_EXPRESS=y ++CONFIG_E1000_PCI=y ++CONFIG_EDU=y ++CONFIG_FDC=y ++CONFIG_FDC_SYSBUS=y ++CONFIG_FDC_ISA=y ++CONFIG_FW_CFG_DMA=y ++CONFIG_HDA=y ++CONFIG_HYPERV=y ++CONFIG_HYPERV_TESTDEV=y ++CONFIG_I2C=y ++CONFIG_I440FX=y ++CONFIG_I8254=y ++CONFIG_I8257=y ++CONFIG_I8259=y ++CONFIG_I82801B11=y ++CONFIG_IDE_CORE=y ++CONFIG_IDE_PCI=y ++CONFIG_IDE_PIIX=y ++CONFIG_IDE_DEV=y ++CONFIG_IDE_BUS=y ++CONFIG_IGB_PCI_EXPRESS=y ++CONFIG_IOAPIC=y ++CONFIG_IOH3420=y ++CONFIG_ISA_BUS=y ++CONFIG_ISA_DEBUG=y ++CONFIG_ISA_TESTDEV=y ++CONFIG_LPC_ICH9=y ++CONFIG_MC146818RTC=y ++CONFIG_MEM_DEVICE=y ++CONFIG_NVDIMM=y ++CONFIG_PAM=y ++CONFIG_PC=y ++CONFIG_PCI=y ++CONFIG_PCIE_PORT=y ++CONFIG_PCI_DEVICES=y ++CONFIG_PCI_EXPRESS=y ++CONFIG_PCI_EXPRESS_Q35=y ++CONFIG_PCI_I440FX=y ++CONFIG_PCI_TESTDEV=y ++CONFIG_PCKBD=y ++CONFIG_PCSPK=y ++CONFIG_PC_ACPI=y ++CONFIG_PC_PCI=y ++CONFIG_PCIE_PCI_BRIDGE=y ++CONFIG_PFLASH_CFI01=y ++CONFIG_PVPANIC_ISA=y ++CONFIG_PXB=y ++CONFIG_Q35=y ++CONFIG_RTL8139_PCI=y ++CONFIG_SCSI=y ++CONFIG_SERIAL=y ++CONFIG_SERIAL_ISA=y ++CONFIG_SERIAL_PCI=y ++CONFIG_SEV=y ++CONFIG_SMBIOS=y ++CONFIG_SMBUS_EEPROM=y ++CONFIG_TEST_DEVICES=y ++CONFIG_USB=y ++CONFIG_USB_EHCI=y ++CONFIG_USB_EHCI_PCI=y ++CONFIG_USB_SMARTCARD=y ++CONFIG_USB_STORAGE_CORE=y ++CONFIG_USB_STORAGE_CLASSIC=y ++CONFIG_USB_UHCI=y ++CONFIG_USB_XHCI=y ++CONFIG_USB_XHCI_NEC=y ++CONFIG_USB_XHCI_PCI=y ++CONFIG_USB_HUB=y ++CONFIG_USB_HID=y ++CONFIG_VFIO=y ++CONFIG_VFIO_PCI=y ++CONFIG_VGA=y ++CONFIG_VGA_CIRRUS=y ++CONFIG_VGA_PCI=y ++CONFIG_VHOST_USER=y ++CONFIG_VHOST_USER_BLK=y ++CONFIG_VIRTIO_MEM=y ++CONFIG_VIRTIO_PCI=y ++CONFIG_VIRTIO_VGA=y ++CONFIG_VIRTIO_IOMMU=y ++CONFIG_VMMOUSE=y ++CONFIG_VMPORT=y ++CONFIG_VTD=y ++CONFIG_WDT_IB6300ESB=y ++CONFIG_WDT_IB700=y ++CONFIG_XIO3130=y ++CONFIG_TPM=y ++CONFIG_TPM_CRB=y ++CONFIG_TPM_TIS_ISA=y ++CONFIG_TPM_EMULATOR=y ++CONFIG_SGX=y ++CONFIG_VHOST_VSOCK=y ++CONFIG_VHOST_USER_VSOCK=y ++CONFIG_VHOST_USER_FS=y ++CONFIG_IOMMUFD=y +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index 687fe0bb8b..eea7d2d038 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -3032,6 +3032,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + MachineClass *mc = MACHINE_CLASS(oc); + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); + static const char * const valid_cpu_types[] = { ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + #ifdef CONFIG_TCG + ARM_CPU_TYPE_NAME("cortex-a7"), + ARM_CPU_TYPE_NAME("cortex-a15"), +@@ -3047,8 +3048,11 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + ARM_CPU_TYPE_NAME("neoverse-n2"), + #endif /* TARGET_AARCH64 */ + #endif /* CONFIG_TCG */ ++#endif /* disabled for RHEL */ + #ifdef TARGET_AARCH64 ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + ARM_CPU_TYPE_NAME("cortex-a53"), ++#endif /* disabled for RHEL */ + ARM_CPU_TYPE_NAME("cortex-a57"), + #if defined(CONFIG_KVM) || defined(CONFIG_HVF) + ARM_CPU_TYPE_NAME("host"), +diff --git a/hw/block/fdc.c b/hw/block/fdc.c +index 6dd94e98bc..a05757fc9a 100644 +--- a/hw/block/fdc.c ++++ b/hw/block/fdc.c +@@ -49,6 +49,8 @@ + #include "qom/object.h" + #include "fdc-internal.h" + ++#include "hw/boards.h" ++ + /********************************************************/ + /* debug Floppy devices */ + +@@ -2346,6 +2348,14 @@ void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, Error **errp) + FDrive *drive; + static int command_tables_inited = 0; + ++ /* Restricted for Red Hat Enterprise Linux: */ ++ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); ++ if (!strstr(mc->name, "-rhel7.")) { ++ error_setg(errp, "Device %s is not supported with machine type %s", ++ object_get_typename(OBJECT(dev)), mc->name); ++ return; ++ } ++ + if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) { + error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'"); + return; +diff --git a/hw/cxl/meson.build b/hw/cxl/meson.build +index 3e375f61a9..613adb3ebb 100644 +--- a/hw/cxl/meson.build ++++ b/hw/cxl/meson.build +@@ -6,7 +6,8 @@ system_ss.add(when: 'CONFIG_CXL', + 'cxl-host.c', + 'cxl-cdat.c', + 'cxl-events.c', +- 'switch-mailbox-cci.c', ++# Disabled for 8.2.0 rebase for RHEL 9.4.0 ++# 'switch-mailbox-cci.c', + ), + if_false: files( + 'cxl-host-stubs.c', +diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c +index 150883a971..497365bd80 100644 +--- a/hw/display/cirrus_vga.c ++++ b/hw/display/cirrus_vga.c +@@ -36,6 +36,7 @@ + #include "qemu/module.h" + #include "qemu/units.h" + #include "qemu/log.h" ++#include "qemu/error-report.h" + #include "sysemu/reset.h" + #include "qapi/error.h" + #include "trace.h" +@@ -2946,6 +2947,9 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Error **errp) + PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); + int16_t device_id = pc->device_id; + ++ warn_report("'cirrus-vga' is deprecated, " ++ "please use a different VGA card instead"); ++ + /* + * Follow real hardware, cirrus card emulated has 4 MB video memory. + * Also accept 8 MB/16 MB for backward compatibility. +diff --git a/hw/ide/piix.c b/hw/ide/piix.c +index 80efc633d3..9cb82b8eea 100644 +--- a/hw/ide/piix.c ++++ b/hw/ide/piix.c +@@ -191,7 +191,8 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data) + k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1; + k->class_id = PCI_CLASS_STORAGE_IDE; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); +- dc->hotpluggable = false; ++ /* Disabled for Red Hat Enterprise Linux: */ ++ dc->user_creatable = false; + } + + static const TypeInfo piix3_ide_info = { +@@ -215,6 +216,8 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data) + k->class_id = PCI_CLASS_STORAGE_IDE; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + dc->hotpluggable = false; ++ /* Disabled for Red Hat Enterprise Linux: */ ++ dc->user_creatable = false; + } + + static const TypeInfo piix4_ide_info = { +diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c +index 74f10b640f..2e85ecf476 100644 +--- a/hw/input/pckbd.c ++++ b/hw/input/pckbd.c +@@ -952,6 +952,8 @@ static void i8042_class_initfn(ObjectClass *klass, void *data) + dc->vmsd = &vmstate_kbd_isa; + adevc->build_dev_aml = i8042_build_aml; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); ++ /* Disabled for Red Hat Enterprise Linux: */ ++ dc->user_creatable = false; + } + + static const TypeInfo i8042_info = { +diff --git a/hw/net/e1000.c b/hw/net/e1000.c +index 5012b96464..b435e54228 100644 +--- a/hw/net/e1000.c ++++ b/hw/net/e1000.c +@@ -1746,6 +1746,7 @@ static const E1000Info e1000_devices[] = { + .revision = 0x03, + .phy_id2 = E1000_PHY_ID2_8254xx_DEFAULT, + }, ++#if 0 /* Disabled for Red Hat Enterprise Linux 7 */ + { + .name = "e1000-82544gc", + .device_id = E1000_DEV_ID_82544GC_COPPER, +@@ -1758,6 +1759,7 @@ static const E1000Info e1000_devices[] = { + .revision = 0x03, + .phy_id2 = E1000_PHY_ID2_8254xx_DEFAULT, + }, ++#endif + }; + + static void e1000_register_types(void) +diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c +index 56090abcd1..0bf7c52077 100644 +--- a/hw/ppc/spapr_cpu_core.c ++++ b/hw/ppc/spapr_cpu_core.c +@@ -399,10 +399,12 @@ static const TypeInfo spapr_cpu_core_type_infos[] = { + .instance_size = sizeof(SpaprCpuCore), + .class_size = sizeof(SpaprCpuCoreClass), + }, ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + DEFINE_SPAPR_CPU_CORE_TYPE("970_v2.2"), + DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.0"), + DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.1"), + DEFINE_SPAPR_CPU_CORE_TYPE("power5p_v2.1"), ++#endif + DEFINE_SPAPR_CPU_CORE_TYPE("power7_v2.3"), + DEFINE_SPAPR_CPU_CORE_TYPE("power7p_v2.1"), + DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"), +diff --git a/hw/usb/meson.build b/hw/usb/meson.build +index d7de1003e3..1cdc0a1ba0 100644 +--- a/hw/usb/meson.build ++++ b/hw/usb/meson.build +@@ -55,7 +55,7 @@ system_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader + if cacard.found() + usbsmartcard_ss = ss.source_set() + usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD', +- if_true: [cacard, files('ccid-card-emulated.c', 'ccid-card-passthru.c')]) ++ if_true: [cacard, files('ccid-card-passthru.c')]) + hw_usb_modules += {'smartcard': usbsmartcard_ss} + endif + +diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build +index 621fc65454..c38bdd6fa4 100644 +--- a/hw/virtio/meson.build ++++ b/hw/virtio/meson.build +@@ -20,7 +20,8 @@ if have_vhost + system_virtio_ss.add(files('vhost-user-base.c')) + + # MMIO Stubs +- system_virtio_ss.add(files('vhost-user-device.c')) ++# Disabled for 8.2.0 rebase for RHEL 9.4.0 ++# system_virtio_ss.add(files('vhost-user-device.c')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) +@@ -28,7 +29,8 @@ if have_vhost + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c')) + + # PCI Stubs +- system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) ++# Disabled for 8.2.0 rebase for RHEL 9.4.0 ++# system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], + if_true: files('vhost-user-gpio-pci.c')) + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], +diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c +index 3cc8cc738b..6f21fea1f5 100644 +--- a/target/arm/arm-qmp-cmds.c ++++ b/target/arm/arm-qmp-cmds.c +@@ -223,6 +223,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, + static void arm_cpu_add_definition(gpointer data, gpointer user_data) + { + ObjectClass *oc = data; ++ CPUClass *cc = CPU_CLASS(oc); + CpuDefinitionInfoList **cpu_list = user_data; + CpuDefinitionInfo *info; + const char *typename; +@@ -231,6 +232,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data) + info = g_malloc0(sizeof(*info)); + info->name = cpu_model_from_type(typename); + info->q_typename = g_strdup(typename); ++ info->deprecated = !!cc->deprecation_note; + + QAPI_LIST_PREPEND(*cpu_list, info); + } +diff --git a/target/arm/cpu.c b/target/arm/cpu.c +index 19191c2391..465f423d25 100644 +--- a/target/arm/cpu.c ++++ b/target/arm/cpu.c +@@ -2726,6 +2726,10 @@ static void cpu_register_class_init(ObjectClass *oc, void *data) + + acc->info = data; + cc->gdb_core_xml_file = "arm-core.xml"; ++ ++ if (acc->info->deprecation_note) { ++ cc->deprecation_note = acc->info->deprecation_note; ++ } + } + + void arm_cpu_register(const ARMCPUInfo *info) +diff --git a/target/arm/cpu.h b/target/arm/cpu.h +index 9a3fd59562..1261eae94d 100644 +--- a/target/arm/cpu.h ++++ b/target/arm/cpu.h +@@ -35,6 +35,8 @@ + #define KVM_HAVE_MCE_INJECTION 1 + #endif + ++#define RHEL_CPU_DEPRECATION "use 'host' / 'max'" ++ + #define EXCP_UDEF 1 /* undefined instruction */ + #define EXCP_SWI 2 /* software interrupt */ + #define EXCP_PREFETCH_ABORT 3 +@@ -1110,6 +1112,7 @@ typedef struct ARMCPUInfo { + const char *name; + void (*initfn)(Object *obj); + void (*class_init)(ObjectClass *oc, void *data); ++ const char *deprecation_note; + } ARMCPUInfo; + + /** +diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c +index 262a1d6c0b..800514d3fc 100644 +--- a/target/arm/cpu64.c ++++ b/target/arm/cpu64.c +@@ -653,6 +653,7 @@ static void aarch64_a57_initfn(Object *obj) + define_cortex_a72_a57_a53_cp_reginfo(cpu); + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void aarch64_a53_initfn(Object *obj) + { + ARMCPU *cpu = ARM_CPU(obj); +@@ -710,6 +711,7 @@ static void aarch64_a53_initfn(Object *obj) + cpu->gic_pribits = 5; + define_cortex_a72_a57_a53_cp_reginfo(cpu); + } ++#endif + + static void aarch64_host_initfn(Object *obj) + { +@@ -748,8 +750,11 @@ static void aarch64_max_initfn(Object *obj) + } + + static const ARMCPUInfo aarch64_cpus[] = { +- { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, ++ { .name = "cortex-a57", .initfn = aarch64_a57_initfn, ++ .deprecation_note = RHEL_CPU_DEPRECATION }, ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, ++#endif /* disabled for RHEL */ + { .name = "max", .initfn = aarch64_max_initfn }, + #if defined(CONFIG_KVM) || defined(CONFIG_HVF) + { .name = "host", .initfn = aarch64_host_initfn }, +@@ -820,8 +825,13 @@ static void aarch64_cpu_instance_init(Object *obj) + static void cpu_register_class_init(ObjectClass *oc, void *data) + { + ARMCPUClass *acc = ARM_CPU_CLASS(oc); ++ CPUClass *cc = CPU_CLASS(oc); + + acc->info = data; ++ ++ if (acc->info->deprecation_note) { ++ cc->deprecation_note = acc->info->deprecation_note; ++ } + } + + void aarch64_cpu_register(const ARMCPUInfo *info) +diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c +index 20c2737f17..7e66fb6f14 100644 +--- a/target/arm/tcg/cpu32.c ++++ b/target/arm/tcg/cpu32.c +@@ -120,6 +120,7 @@ void aa32_max_features(ARMCPU *cpu) + cpu->isar.id_dfr1 = t; + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + /* CPU models. These are not needed for the AArch64 linux-user build. */ + #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) + +@@ -1066,3 +1067,4 @@ static void arm_tcg_cpu_register_types(void) + type_init(arm_tcg_cpu_register_types) + + #endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */ ++#endif /* disabled for RHEL */ +diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c +index fe232eb306..2678047488 100644 +--- a/target/arm/tcg/cpu64.c ++++ b/target/arm/tcg/cpu64.c +@@ -29,6 +29,7 @@ + #include "cpu-features.h" + #include "cpregs.h" + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static uint64_t make_ccsidr64(unsigned assoc, unsigned linesize, + unsigned cachesize) + { +@@ -135,6 +136,7 @@ static void aarch64_a35_initfn(Object *obj) + /* These values are the same with A53/A57/A72. */ + define_cortex_a72_a57_a53_cp_reginfo(cpu); + } ++#endif + + static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +@@ -224,6 +226,7 @@ static void cpu_max_get_l0gptsz(Object *obj, Visitor *v, const char *name, + static Property arm_cpu_lpa2_property = + DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true); + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void aarch64_a55_initfn(Object *obj) + { + ARMCPU *cpu = ARM_CPU(obj); +@@ -1074,6 +1077,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj) + aarch64_add_pauth_properties(obj); + aarch64_add_sve_properties(obj); + } ++#endif + + /* + * -cpu max: a CPU with as many features enabled as our emulation supports. +@@ -1295,6 +1299,7 @@ void aarch64_max_tcg_initfn(Object *obj) + qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static const ARMCPUInfo aarch64_cpus[] = { + { .name = "cortex-a35", .initfn = aarch64_a35_initfn }, + { .name = "cortex-a55", .initfn = aarch64_a55_initfn }, +@@ -1306,14 +1311,17 @@ static const ARMCPUInfo aarch64_cpus[] = { + { .name = "neoverse-v1", .initfn = aarch64_neoverse_v1_initfn }, + { .name = "neoverse-n2", .initfn = aarch64_neoverse_n2_initfn }, + }; ++#endif + + static void aarch64_cpu_register_types(void) + { ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + size_t i; + + for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { + aarch64_cpu_register(&aarch64_cpus[i]); + } ++#endif + } + + type_init(aarch64_cpu_register_types) +diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build +index 508932a249..7a12d7bfba 100644 +--- a/target/arm/tcg/meson.build ++++ b/target/arm/tcg/meson.build +@@ -58,5 +58,5 @@ arm_system_ss.add(files( + 'psci.c', + )) + +-arm_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c')) +-arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files('cpu-v7m.c')) ++#arm_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c')) ++#arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files('cpu-v7m.c')) +diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c +index f2301b43f7..f77ebfcc81 100644 +--- a/target/ppc/cpu-models.c ++++ b/target/ppc/cpu-models.c +@@ -66,6 +66,7 @@ + #define POWERPC_DEF(_name, _pvr, _type, _desc) \ + POWERPC_DEF_SVR(_name, _desc, _pvr, POWERPC_SVR_NONE, _type) + ++#if 0 /* Embedded and 32-bit CPUs disabled for Red Hat Enterprise Linux */ + /* Embedded PowerPC */ + /* PowerPC 405 family */ + /* PowerPC 405 cores */ +@@ -698,8 +699,10 @@ + "PowerPC 7447A v1.2 (G4)") + POWERPC_DEF("7457a_v1.2", CPU_POWERPC_74x7A_v12, 7455, + "PowerPC 7457A v1.2 (G4)") ++#endif + /* 64 bits PowerPC */ + #if defined(TARGET_PPC64) ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + POWERPC_DEF("970_v2.2", CPU_POWERPC_970_v22, 970, + "PowerPC 970 v2.2") + POWERPC_DEF("970fx_v1.0", CPU_POWERPC_970FX_v10, 970, +@@ -718,6 +721,7 @@ + "PowerPC 970MP v1.1") + POWERPC_DEF("power5p_v2.1", CPU_POWERPC_POWER5P_v21, POWER5P, + "POWER5+ v2.1") ++#endif + POWERPC_DEF("power7_v2.3", CPU_POWERPC_POWER7_v23, POWER7, + "POWER7 v2.3") + POWERPC_DEF("power7p_v2.1", CPU_POWERPC_POWER7P_v21, POWER7, +@@ -894,13 +898,16 @@ PowerPCCPUAlias ppc_cpu_aliases[] = { + { "7447a", "7447a_v1.2" }, + { "7457a", "7457a_v1.2" }, + { "apollo7pm", "7457a_v1.0" }, ++#endif + #if defined(TARGET_PPC64) ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + { "970", "970_v2.2" }, + { "970fx", "970fx_v3.1" }, + { "970mp", "970mp_v1.1" }, + { "power5+", "power5p_v2.1" }, + { "power5+_v2.1", "power5p_v2.1" }, + { "power5gs", "power5+_v2.1" }, ++#endif + { "power7", "power7_v2.3" }, + { "power7+", "power7p_v2.1" }, + { "power7+_v2.1", "power7p_v2.1" }, +@@ -911,12 +918,14 @@ PowerPCCPUAlias ppc_cpu_aliases[] = { + { "power10", "power10_v2.0" }, + #endif + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + /* Generic PowerPCs */ + #if defined(TARGET_PPC64) + { "ppc64", "970fx_v3.1" }, + #endif + { "ppc32", "604" }, + { "ppc", "604" }, ++#endif + + { NULL, NULL } + }; +diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c +index f6df691b66..72572726b8 100644 +--- a/target/s390x/cpu_models_sysemu.c ++++ b/target/s390x/cpu_models_sysemu.c +@@ -34,6 +34,9 @@ static void check_unavailable_features(const S390CPUModel *max_model, + (max_model->def->gen == model->def->gen && + max_model->def->ec_ga < model->def->ec_ga)) { + list_add_feat("type", unavailable); ++ } else if (model->def->gen < 11 && kvm_enabled()) { ++ /* Older CPU models are not supported on Red Hat Enterprise Linux */ ++ list_add_feat("type", unavailable); + } + + /* detect missing features if any to properly report them */ +diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c +index 94181d9281..45c23758e7 100644 +--- a/target/s390x/kvm/kvm.c ++++ b/target/s390x/kvm/kvm.c +@@ -2566,6 +2566,14 @@ bool kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) + error_setg(errp, "KVM doesn't support CPU models"); + return false; + } ++ ++ /* Older CPU models are not supported on Red Hat Enterprise Linux */ ++ if (model->def->gen < 11) { ++ error_setg(errp, "KVM: Unsupported CPU type specified: %s", ++ MACHINE(qdev_get_machine())->cpu_type); ++ return false; ++ } ++ + prop.cpuid = s390_cpuid_from_cpu_model(model); + prop.ibc = s390_ibc_from_cpu_model(model); + /* configure cpu features indicated via STFL(e) */ +diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c +index cfd6f77353..3016e6233c 100644 +--- a/tests/qtest/arm-cpu-features.c ++++ b/tests/qtest/arm-cpu-features.c +@@ -452,8 +452,10 @@ static void test_query_cpu_model_expansion(const void *data) + assert_error(qts, "host", "The CPU type 'host' requires KVM", NULL); + + /* Test expected feature presence/absence for some cpu types */ ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + assert_has_feature_enabled(qts, "cortex-a15", "pmu"); + assert_has_not_feature(qts, "cortex-a15", "aarch64"); ++#endif /* disabled for RHEL */ + + /* Enabling and disabling pmu should always work. */ + assert_has_feature_enabled(qts, "max", "pmu"); +@@ -470,6 +472,7 @@ static void test_query_cpu_model_expansion(const void *data) + assert_has_feature_enabled(qts, "cortex-a57", "pmu"); + assert_has_feature_enabled(qts, "cortex-a57", "aarch64"); + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + assert_has_feature_enabled(qts, "a64fx", "pmu"); + assert_has_feature_enabled(qts, "a64fx", "aarch64"); + /* +@@ -482,6 +485,7 @@ static void test_query_cpu_model_expansion(const void *data) + "{ 'sve384': true }"); + assert_error(qts, "a64fx", "cannot enable sve640", + "{ 'sve640': true }"); ++#endif /* disabled for RHEL */ + + sve_tests_default(qts, "max"); + pauth_tests_default(qts, "max"); +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch b/images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch new file mode 100644 index 000000000..2d6ee37f9 --- /dev/null +++ b/images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch @@ -0,0 +1,749 @@ +From dc310c3f76c0d986ec4dc5a548a8ff37a85d61cf Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Fri, 11 Jan 2019 09:54:45 +0100 +Subject: Machine type related general changes + +This patch is first part of original "Add RHEL machine types" patch we +split to allow easier review. It contains changes not related to any +architecture. + +Signed-off-by: Miroslav Rezanina +-- +Rebase notes (6.2.0): +- Do not duplicate minimal_version_id for piix4_pm +- Remove empty line chunks in serial.c +- Remove migration.h include in serial.c +- Update hw_compat_rhel_8_5 (from MR 66) + +Rebase notes (7.0.0): +- Remove downstream changes leftovers in hw/rtc/mc146818rtc.c +- Remove unnecessary change in hw/usb/hcd-uhci.c + +Rebase notes (7.1.0): +- Moved adding rhel_old_machine_deprecation variable from s390x to general machine types commit +- Moved adding hw_compat_rhel_8_6 struct from x86_64 to general machine types commit + +Rebase notes (8.1.0): +- Do not modify unused vga-isa.c + +Rebase notes (9.0.0 rc0): +- Updated smsbios handling + +Rebase notes (9.0.0 rc4): +- Moving downstream compat changes + +Merged patches (6.1.0): +- f2fb42a3c6 redhat: add missing entries in hw_compat_rhel_8_4 +- 1949ec258e hw/arm/virt: Disable PL011 clock migration through hw_compat_rhel_8_3 +- a3995e2eff Remove RHEL 7.0.0 machine type (only generic changes) +- ad3190a79b Remove RHEL 7.1.0 machine type (only generic changes) +- 84bbe15d4e Remove RHEL 7.2.0 machine type (only generic changes) +- 0215eb3356 Remove RHEL 7.3.0 machine types (only generic changes) +- af69d1ca6e Remove RHEL 7.4.0 machine types (only generic changes) +- 8f7a74ab78 Remove RHEL 7.5.0 machine types (only generic changes) + +Merged patches (6.2.0): +- d687ac13d2 redhat: Define hw_compat_rhel_8_5 + +Merged patches (7.0.0): +- ef5afcc86d Fix virtio-net-pci* "vectors" compat +- 168f0d56e3 compat: Update hw_compat_rhel_8_5 with 6.2.0 RC2 changes + +Merged patches (7.1.0): +- 38b89dc245 pc: Move s3/s4 suspend disabling to compat (only hw/acpi/piix4.c chunk) +- 1d6439527a WRB: Introduce RHEL 9.0.0 hw compat structure (only hw/core/machine.c and include/hw/boards.h chunk) + +Merged patches (7.2.0): +- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) + +Merged patches (8.0.0): +- 21ed34787b Addd 7.2 compat bits for RHEL 9.1 machine type +- e5c8d5d603 virtio-rng-pci: fix migration compat for vectors +- 5a5fa77059 virtio-rng-pci: fix transitional migration compat for vectors + +Merged patches (8.1.0): +- bd5d81d286 Add RHEL 9.2.0 compat structure (general part) +- 1165e24c6b hw/pci: Disable PCI_ERR_UNCOR_MASK reg for machine type <= pc-q35-rhel9.2.0 + +Merged patches (8.2.0): +- 4ee284aca9 Add machine types compat bits. (partial) + +Merged patches (9.0.0 rc0): +- 4b8fe42abc virtio-mem: default-enable "dynamic-memslots" + +Merged patches (9.1.0 rc0): +- 043ad5ce97 Add upstream compatibility bits (partial) +- 770eeed61e rhel 9.4.0 machine type compat for virtio-gpu migration +--- + hw/acpi/piix4.c | 2 +- + hw/arm/virt.c | 3 +- + hw/core/machine.c | 281 +++++++++++++++++++++++++++++++++++ + hw/i386/fw_cfg.c | 3 +- + hw/net/rtl8139.c | 4 +- + hw/smbios/smbios.c | 46 +++++- + hw/timer/i8254_common.c | 2 +- + hw/usb/hcd-xhci-pci.c | 59 ++++++-- + hw/usb/hcd-xhci-pci.h | 1 + + hw/virtio/virtio-mem.c | 3 +- + include/hw/boards.h | 43 ++++++ + include/hw/firmware/smbios.h | 4 +- + include/hw/i386/pc.h | 3 + + 13 files changed, 430 insertions(+), 24 deletions(-) + +diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c +index debe1adb84..e8ddcd716e 100644 +--- a/hw/acpi/piix4.c ++++ b/hw/acpi/piix4.c +@@ -245,7 +245,7 @@ static bool vmstate_test_migrate_acpi_index(void *opaque, int version_id) + static const VMStateDescription vmstate_acpi = { + .name = "piix4_pm", + .version_id = 3, +- .minimum_version_id = 3, ++ .minimum_version_id = 2, + .post_load = vmstate_acpi_post_load, + .fields = (const VMStateField[]) { + VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState), +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index eea7d2d038..b2aa3f1355 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -1699,7 +1699,8 @@ static void virt_build_smbios(VirtMachineState *vms) + } + + smbios_set_defaults("QEMU", product, +- vmc->smbios_old_sys_ver ? "1.0" : mc->name); ++ vmc->smbios_old_sys_ver ? "1.0" : mc->name, ++ NULL, NULL); + + /* build the array of physical mem area from base_memmap */ + mem_array.address = vms->memmap[VIRT_MEM].base; +diff --git a/hw/core/machine.c b/hw/core/machine.c +index 27dcda0248..f7fed78e4b 100644 +--- a/hw/core/machine.c ++++ b/hw/core/machine.c +@@ -305,6 +305,287 @@ GlobalProperty hw_compat_2_1[] = { + }; + const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); + ++/* ++ * RHEL only: machine types for previous major releases are deprecated ++ */ ++const char *rhel_old_machine_deprecation = ++ "machine types for previous major releases are deprecated"; ++ ++GlobalProperty hw_compat_rhel_9_5[] = { ++ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ ++ { "migration", "zero-page-detection", "legacy"}, ++ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ ++ { TYPE_VIRTIO_IOMMU_PCI, "granule", "4k" }, ++ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ ++ { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "64" }, ++ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ ++ { "virtio-gpu-device", "x-scanout-vmstate-version", "1" }, ++}; ++const size_t hw_compat_rhel_9_5_len = G_N_ELEMENTS(hw_compat_rhel_9_5); ++ ++GlobalProperty hw_compat_rhel_9_4[] = { ++ /* hw_compat_rhel_9_4 from hw_compat_8_0 */ ++ { TYPE_VIRTIO_NET, "host_uso", "off"}, ++ /* hw_compat_rhel_9_4 from hw_compat_8_0 */ ++ { TYPE_VIRTIO_NET, "guest_uso4", "off"}, ++ /* hw_compat_rhel_9_4 from hw_compat_8_0 */ ++ { TYPE_VIRTIO_NET, "guest_uso6", "off"}, ++ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ ++ { TYPE_PCI_BRIDGE, "x-pci-express-writeable-slt-bug", "true" }, ++ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ ++ { "ramfb", "x-migrate", "off" }, ++ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ ++ { "vfio-pci-nohotplug", "x-ramfb-migrate", "off" }, ++ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ ++ { "igb", "x-pcie-flr-init", "off" }, ++ /* hw_compat_rhel_9_4 jira RHEL-24045 */ ++ { "virtio-mem", "dynamic-memslots", "off" }, ++}; ++const size_t hw_compat_rhel_9_4_len = G_N_ELEMENTS(hw_compat_rhel_9_4); ++ ++GlobalProperty hw_compat_rhel_9_3[] = { ++ /* hw_compat_rhel_9_3 from hw_compat_8_0 */ ++ { "migration", "multifd-flush-after-each-section", "on"}, ++ /* hw_compat_rhel_9_3 from hw_compat_8_0 */ ++ { TYPE_PCI_DEVICE, "x-pcie-ari-nextfn-1", "on" }, ++}; ++const size_t hw_compat_rhel_9_3_len = G_N_ELEMENTS(hw_compat_rhel_9_3); ++ ++GlobalProperty hw_compat_rhel_9_2[] = { ++ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ ++ { "e1000e", "migrate-timadj", "off" }, ++ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ ++ { "virtio-mem", "x-early-migration", "false" }, ++ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ ++ { "migration", "x-preempt-pre-7-2", "true" }, ++ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ ++ { TYPE_PCI_DEVICE, "x-pcie-err-unc-mask", "off" }, ++}; ++const size_t hw_compat_rhel_9_2_len = G_N_ELEMENTS(hw_compat_rhel_9_2); ++ ++/* ++ * Mostly the same as hw_compat_7_0 ++ */ ++GlobalProperty hw_compat_rhel_9_1[] = { ++ /* hw_compat_rhel_9_1 from hw_compat_7_0 */ ++ { "arm-gicv3-common", "force-8-bit-prio", "on" }, ++ /* hw_compat_rhel_9_1 from hw_compat_7_0 */ ++ { "nvme-ns", "eui64-default", "on"}, ++ /* hw_compat_rhel_9_1 from hw_compat_7_1 */ ++ { "virtio-device", "queue_reset", "false" }, ++ /* hw_compat_rhel_9_1 bz 2155749 */ ++ { "virtio-rng-pci", "vectors", "0" }, ++ /* hw_compat_rhel_9_1 bz 2162569 */ ++ { "virtio-rng-pci-transitional", "vectors", "0" }, ++ { "virtio-rng-pci-non-transitional", "vectors", "0" }, ++}; ++const size_t hw_compat_rhel_9_1_len = G_N_ELEMENTS(hw_compat_rhel_9_1); ++ ++/* ++ * Mostly the same as hw_compat_6_2 ++ */ ++GlobalProperty hw_compat_rhel_9_0[] = { ++ /* hw_compat_rhel_9_0 from hw_compat_6_2 */ ++ { "PIIX4_PM", "x-not-migrate-acpi-index", "on"}, ++}; ++const size_t hw_compat_rhel_9_0_len = G_N_ELEMENTS(hw_compat_rhel_9_0); ++ ++GlobalProperty hw_compat_rhel_8_6[] = { ++ /* hw_compat_rhel_8_6 bz 2065589 */ ++ /* ++ * vhost-vsock device in RHEL 8 kernels doesn't support seqpacket, so ++ * we need do disable it downstream on the latest hw_compat_rhel_8. ++ */ ++ { "vhost-vsock-device", "seqpacket", "off" }, ++}; ++const size_t hw_compat_rhel_8_6_len = G_N_ELEMENTS(hw_compat_rhel_8_6); ++ ++/* ++ * Mostly the same as hw_compat_6_0 and hw_compat_6_1 ++ */ ++GlobalProperty hw_compat_rhel_8_5[] = { ++ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ ++ { "gpex-pcihost", "allow-unmapped-accesses", "false" }, ++ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ ++ { "i8042", "extended-state", "false"}, ++ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ ++ { "nvme-ns", "eui64-default", "off"}, ++ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ ++ { "e1000", "init-vet", "off" }, ++ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ ++ { "e1000e", "init-vet", "off" }, ++ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ ++ { "vhost-vsock-device", "seqpacket", "off" }, ++ /* hw_compat_rhel_8_5 from hw_compat_6_1 */ ++ { "vhost-user-vsock-device", "seqpacket", "off" }, ++ /* hw_compat_rhel_8_5 from hw_compat_6_1 */ ++ { "nvme-ns", "shared", "off" }, ++}; ++const size_t hw_compat_rhel_8_5_len = G_N_ELEMENTS(hw_compat_rhel_8_5); ++ ++/* ++ * Mostly the same as hw_compat_5_2 ++ */ ++GlobalProperty hw_compat_rhel_8_4[] = { ++ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ ++ { "ICH9-LPC", "smm-compat", "on"}, ++ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ ++ { "PIIX4_PM", "smm-compat", "on"}, ++ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ ++ { "virtio-blk-device", "report-discard-granularity", "off" }, ++ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ ++ /* ++ * Upstream incorrectly had "virtio-net-pci" instead of "virtio-net-pci-base", ++ * (https://bugzilla.redhat.com/show_bug.cgi?id=1999141) ++ */ ++ { "virtio-net-pci-base", "vectors", "3"}, ++}; ++const size_t hw_compat_rhel_8_4_len = G_N_ELEMENTS(hw_compat_rhel_8_4); ++ ++/* ++ * Mostly the same as hw_compat_5_1 ++ */ ++GlobalProperty hw_compat_rhel_8_3[] = { ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "vhost-scsi", "num_queues", "1"}, ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "vhost-user-blk", "num-queues", "1"}, ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "vhost-user-scsi", "num_queues", "1"}, ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "virtio-blk-device", "num-queues", "1"}, ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "virtio-scsi-device", "num_queues", "1"}, ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "nvme", "use-intel-id", "on"}, ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "pvpanic", "events", "1"}, /* PVPANIC_PANICKED */ ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "pl011", "migrate-clk", "off" }, ++ /* hw_compat_rhel_8_3 bz 1912846 */ ++ { "pci-xhci", "x-rh-late-msi-cap", "off" }, ++ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ ++ { "virtio-pci", "x-ats-page-aligned", "off"}, ++}; ++const size_t hw_compat_rhel_8_3_len = G_N_ELEMENTS(hw_compat_rhel_8_3); ++ ++/* ++ * The same as hw_compat_4_2 + hw_compat_5_0 ++ */ ++GlobalProperty hw_compat_rhel_8_2[] = { ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "virtio-blk-device", "queue-size", "128"}, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "virtio-scsi-device", "virtqueue_size", "128"}, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "virtio-blk-device", "x-enable-wce-if-config-wce", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "virtio-blk-device", "seg-max-adjust", "off"}, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "virtio-scsi-device", "seg_max_adjust", "off"}, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "vhost-blk-device", "seg_max_adjust", "off"}, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "usb-host", "suppress-remote-wake", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "usb-redir", "suppress-remote-wake", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "qxl", "revision", "4" }, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "qxl-vga", "revision", "4" }, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "fw_cfg", "acpi-mr-restore", "false" }, ++ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ ++ { "virtio-device", "use-disabled-flag", "false" }, ++ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ ++ { "pci-host-bridge", "x-config-reg-migration-enabled", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ ++ { "virtio-balloon-device", "page-poison", "false" }, ++ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ ++ { "vmport", "x-read-set-eax", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ ++ { "vmport", "x-signal-unsupported-cmd", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ ++ { "vmport", "x-report-vmx-type", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ ++ { "vmport", "x-cmds-v2", "off" }, ++ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ ++ { "virtio-device", "x-disable-legacy-check", "true" }, ++}; ++const size_t hw_compat_rhel_8_2_len = G_N_ELEMENTS(hw_compat_rhel_8_2); ++ ++/* ++ * The same as hw_compat_4_1 ++ */ ++GlobalProperty hw_compat_rhel_8_1[] = { ++ /* hw_compat_rhel_8_1 from hw_compat_4_1 */ ++ { "virtio-pci", "x-pcie-flr-init", "off" }, ++}; ++const size_t hw_compat_rhel_8_1_len = G_N_ELEMENTS(hw_compat_rhel_8_1); ++ ++/* The same as hw_compat_3_1 ++ * format of array has been changed by: ++ * 6c36bddf5340 ("machine: Use shorter format for GlobalProperty arrays") ++ */ ++GlobalProperty hw_compat_rhel_8_0[] = { ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "pcie-root-port", "x-speed", "2_5" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "pcie-root-port", "x-width", "1" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "memory-backend-file", "x-use-canonical-path-for-ramblock-id", "true" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "memory-backend-memfd", "x-use-canonical-path-for-ramblock-id", "true" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "tpm-crb", "ppi", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "tpm-tis", "ppi", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "usb-kbd", "serial", "42" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "usb-mouse", "serial", "42" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "usb-tablet", "serial", "42" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "virtio-blk-device", "discard", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ ++ { "virtio-blk-device", "write-zeroes", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ ++ { "VGA", "edid", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ ++ { "secondary-vga", "edid", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ ++ { "bochs-display", "edid", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ ++ { "virtio-vga", "edid", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ ++ { "virtio-gpu-device", "edid", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ ++ { "virtio-device", "use-started", "false" }, ++ /* hw_compat_rhel_8_0 from hw_compat_3_1 - that was added in 4.1 */ ++ { "pcie-root-port-base", "disable-acs", "true" }, ++}; ++const size_t hw_compat_rhel_8_0_len = G_N_ELEMENTS(hw_compat_rhel_8_0); ++ ++/* The same as hw_compat_3_0 + hw_compat_2_12 ++ * except that ++ * there's nothing in 3_0 ++ * migration.decompress-error-check=off was in 7.5 from bz 1584139 ++ */ ++GlobalProperty hw_compat_rhel_7_6[] = { ++ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ ++ { "hda-audio", "use-timer", "false" }, ++ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ ++ { "cirrus-vga", "global-vmstate", "true" }, ++ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ ++ { "VGA", "global-vmstate", "true" }, ++ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ ++ { "vmware-svga", "global-vmstate", "true" }, ++ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ ++ { "qxl-vga", "global-vmstate", "true" }, ++}; ++const size_t hw_compat_rhel_7_6_len = G_N_ELEMENTS(hw_compat_rhel_7_6); ++ + MachineState *current_machine; + + static char *machine_get_kernel(Object *obj, Error **errp) +diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c +index 0e4494627c..33ef280420 100644 +--- a/hw/i386/fw_cfg.c ++++ b/hw/i386/fw_cfg.c +@@ -73,7 +73,8 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, + + if (pcmc->smbios_defaults) { + /* These values are guest ABI, do not change */ +- smbios_set_defaults("QEMU", mc->desc, mc->name); ++ smbios_set_defaults("QEMU", mc->desc, mc->name, ++ pcmc->smbios_stream_product, pcmc->smbios_stream_version); + } + + /* tell smbios about cpuid version and features */ +diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c +index 03a204ef8a..f2fe057535 100644 +--- a/hw/net/rtl8139.c ++++ b/hw/net/rtl8139.c +@@ -3173,7 +3173,7 @@ static int rtl8139_pre_save(void *opaque) + + static const VMStateDescription vmstate_rtl8139 = { + .name = "rtl8139", +- .version_id = 5, ++ .version_id = 4, + .minimum_version_id = 3, + .post_load = rtl8139_post_load, + .pre_save = rtl8139_pre_save, +@@ -3254,7 +3254,9 @@ static const VMStateDescription vmstate_rtl8139 = { + VMSTATE_UINT32(tally_counters.TxMCol, RTL8139State), + VMSTATE_UINT64(tally_counters.RxOkPhy, RTL8139State), + VMSTATE_UINT64(tally_counters.RxOkBrd, RTL8139State), ++#if 0 /* Disabled for Red Hat Enterprise Linux bz 1420195 */ + VMSTATE_UINT32_V(tally_counters.RxOkMul, RTL8139State, 5), ++#endif + VMSTATE_UINT16(tally_counters.TxAbt, RTL8139State), + VMSTATE_UINT16(tally_counters.TxUndrn, RTL8139State), + +diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c +index a394514264..88642ccce0 100644 +--- a/hw/smbios/smbios.c ++++ b/hw/smbios/smbios.c +@@ -38,6 +38,10 @@ size_t usr_blobs_len; + static unsigned usr_table_max; + static unsigned usr_table_cnt; + ++/* Set to true for modern Windows 10 HardwareID-6 compat */ ++static bool smbios_type2_required; ++ ++ + uint8_t *smbios_tables; + size_t smbios_tables_len; + unsigned smbios_table_max; +@@ -626,7 +630,7 @@ static void smbios_build_type_1_table(void) + + static void smbios_build_type_2_table(void) + { +- SMBIOS_BUILD_TABLE_PRE(2, T2_BASE, false); /* optional */ ++ SMBIOS_BUILD_TABLE_PRE(2, T2_BASE, smbios_type2_required); + + SMBIOS_TABLE_SET_STR(2, manufacturer_str, type2.manufacturer); + SMBIOS_TABLE_SET_STR(2, product_str, type2.product); +@@ -1014,15 +1018,51 @@ void smbios_set_default_processor_family(uint16_t processor_family) + } + + void smbios_set_defaults(const char *manufacturer, const char *product, +- const char *version) ++ const char *version, ++ const char *stream_product, ++ const char *stream_version) + { + smbios_have_defaults = true; + ++ /* ++ * If @stream_product & @stream_version are non-NULL, then ++ * we're following rules for new Windows driver support. ++ * The data we have to report is defined in this doc: ++ * ++ * https://docs.microsoft.com/en-us/windows-hardware/drivers/install/specifying-hardware-ids-for-a-computer ++ * ++ * The Windows drivers are written to expect use of the ++ * scheme documented as "HardwareID-6" against Windows 10, ++ * which uses SMBIOS System (Type 1) and Base Board (Type 2) ++ * tables and will match on ++ * ++ * System Manufacturer = Red Hat (@manufacturer) ++ * System SKU Number = 8.2.0 (@stream_version) ++ * Baseboard Manufacturer = Red Hat (@manufacturer) ++ * Baseboard Product = RHEL-AV (@stream_product) ++ * ++ * NB, SKU must be changed with each RHEL-AV release ++ * ++ * Other fields can be freely used by applications using ++ * QEMU. For example apps can use the "System product" ++ * and "System version" to identify themselves. ++ * ++ * We get 'System Manufacturer' and 'Baseboard Manufacturer' ++ */ + SMBIOS_SET_DEFAULT(smbios_type1.manufacturer, manufacturer); + SMBIOS_SET_DEFAULT(smbios_type1.product, product); + SMBIOS_SET_DEFAULT(smbios_type1.version, version); ++ SMBIOS_SET_DEFAULT(smbios_type1.family, "Red Hat Enterprise Linux"); ++ if (stream_version != NULL) { ++ SMBIOS_SET_DEFAULT(smbios_type1.sku, stream_version); ++ } + SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer); +- SMBIOS_SET_DEFAULT(type2.product, product); ++ if (stream_product != NULL) { ++ SMBIOS_SET_DEFAULT(type2.product, stream_product); ++ smbios_type2_required = true; ++ } else { ++ SMBIOS_SET_DEFAULT(type2.product, product); ++ } + SMBIOS_SET_DEFAULT(type2.version, version); + SMBIOS_SET_DEFAULT(type3.manufacturer, manufacturer); + SMBIOS_SET_DEFAULT(type3.version, version); +diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c +index 28fdabc321..bad13ec224 100644 +--- a/hw/timer/i8254_common.c ++++ b/hw/timer/i8254_common.c +@@ -229,7 +229,7 @@ static const VMStateDescription vmstate_pit_common = { + .pre_save = pit_dispatch_pre_save, + .post_load = pit_dispatch_post_load, + .fields = (const VMStateField[]) { +- VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3), ++ VMSTATE_UINT32(channels[0].irq_disabled, PITCommonState), /* qemu-kvm's v2 had 'flags' here */ + VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2, + vmstate_pit_channel, PITChannelState), + VMSTATE_INT64(channels[0].next_transition_time, +diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c +index 264d7ebb77..2b9a3e06d4 100644 +--- a/hw/usb/hcd-xhci-pci.c ++++ b/hw/usb/hcd-xhci-pci.c +@@ -104,6 +104,33 @@ static int xhci_pci_vmstate_post_load(void *opaque, int version_id) + return 0; + } + ++/* RH bz 1912846 */ ++static bool usb_xhci_pci_add_msi(struct PCIDevice *dev, Error **errp) ++{ ++ int ret; ++ Error *err = NULL; ++ XHCIPciState *s = XHCI_PCI(dev); ++ ++ ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err); ++ /* ++ * Any error other than -ENOTSUP(board's MSI support is broken) ++ * is a programming error ++ */ ++ assert(!ret || ret == -ENOTSUP); ++ if (ret && s->msi == ON_OFF_AUTO_ON) { ++ /* Can't satisfy user's explicit msi=on request, fail */ ++ error_append_hint(&err, "You have to use msi=auto (default) or " ++ "msi=off with this machine type.\n"); ++ error_propagate(errp, err); ++ return true; ++ } ++ assert(!err || s->msi == ON_OFF_AUTO_AUTO); ++ /* With msi=auto, we fall back to MSI off silently */ ++ error_free(err); ++ ++ return false; ++} ++ + static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp) + { + int ret; +@@ -125,23 +152,12 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp) + s->xhci.nec_quirks = true; + } + +- if (s->msi != ON_OFF_AUTO_OFF) { +- ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err); +- /* +- * Any error other than -ENOTSUP(board's MSI support is broken) +- * is a programming error +- */ +- assert(!ret || ret == -ENOTSUP); +- if (ret && s->msi == ON_OFF_AUTO_ON) { +- /* Can't satisfy user's explicit msi=on request, fail */ +- error_append_hint(&err, "You have to use msi=auto (default) or " +- "msi=off with this machine type.\n"); ++ if (s->msi != ON_OFF_AUTO_OFF && s->rh_late_msi_cap) { ++ /* This gives the behaviour from 5.2.0 onwards, lspci shows 90,a0,70 */ ++ if (usb_xhci_pci_add_msi(dev, &err)) { + error_propagate(errp, err); + return; + } +- assert(!err || s->msi == ON_OFF_AUTO_AUTO); +- /* With msi=auto, we fall back to MSI off silently */ +- error_free(err); + } + pci_register_bar(dev, 0, + PCI_BASE_ADDRESS_SPACE_MEMORY | +@@ -153,6 +169,14 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp) + assert(ret > 0); + } + ++ /* RH bz 1912846 */ ++ if (s->msi != ON_OFF_AUTO_OFF && !s->rh_late_msi_cap) { ++ /* This gives the older RH machine behaviour, lspci shows 90,70,a0 */ ++ if (usb_xhci_pci_add_msi(dev, &err)) { ++ error_propagate(errp, err); ++ return; ++ } ++ } + if (s->msix != ON_OFF_AUTO_OFF) { + /* TODO check for errors, and should fail when msix=on */ + msix_init(dev, s->xhci.numintrs, +@@ -197,11 +221,18 @@ static void xhci_instance_init(Object *obj) + qdev_alias_all_properties(DEVICE(&s->xhci), obj); + } + ++static Property xhci_pci_properties[] = { ++ /* RH bz 1912846 */ ++ DEFINE_PROP_BOOL("x-rh-late-msi-cap", XHCIPciState, rh_late_msi_cap, true), ++ DEFINE_PROP_END_OF_LIST() ++}; ++ + static void xhci_class_init(ObjectClass *klass, void *data) + { + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); + ++ device_class_set_props(dc, xhci_pci_properties); + dc->reset = xhci_pci_reset; + dc->vmsd = &vmstate_xhci_pci; + set_bit(DEVICE_CATEGORY_USB, dc->categories); +diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h +index 08f70ce97c..1be7527c1b 100644 +--- a/hw/usb/hcd-xhci-pci.h ++++ b/hw/usb/hcd-xhci-pci.h +@@ -40,6 +40,7 @@ typedef struct XHCIPciState { + XHCIState xhci; + OnOffAuto msi; + OnOffAuto msix; ++ bool rh_late_msi_cap; /* bz 1912846 */ + } XHCIPciState; + + #endif +diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c +index ef64bf1b4a..ba11aa4646 100644 +--- a/hw/virtio/virtio-mem.c ++++ b/hw/virtio/virtio-mem.c +@@ -1694,8 +1694,9 @@ static Property virtio_mem_properties[] = { + #endif + DEFINE_PROP_BOOL(VIRTIO_MEM_EARLY_MIGRATION_PROP, VirtIOMEM, + early_migration, true), ++ /* RHEL: default-enable "dynamic-memslots" (jira RHEL-24045) */ + DEFINE_PROP_BOOL(VIRTIO_MEM_DYNAMIC_MEMSLOTS_PROP, VirtIOMEM, +- dynamic_memslots, false), ++ dynamic_memslots, true), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/include/hw/boards.h b/include/hw/boards.h +index 48ff6d8b93..ccfc3e10eb 100644 +--- a/include/hw/boards.h ++++ b/include/hw/boards.h +@@ -822,4 +822,47 @@ extern const size_t hw_compat_2_2_len; + extern GlobalProperty hw_compat_2_1[]; + extern const size_t hw_compat_2_1_len; + ++extern GlobalProperty hw_compat_rhel_9_5[]; ++extern const size_t hw_compat_rhel_9_5_len; ++ ++extern GlobalProperty hw_compat_rhel_9_4[]; ++extern const size_t hw_compat_rhel_9_4_len; ++ ++extern GlobalProperty hw_compat_rhel_9_3[]; ++extern const size_t hw_compat_rhel_9_3_len; ++ ++extern GlobalProperty hw_compat_rhel_9_2[]; ++extern const size_t hw_compat_rhel_9_2_len; ++ ++extern GlobalProperty hw_compat_rhel_9_1[]; ++extern const size_t hw_compat_rhel_9_1_len; ++ ++extern GlobalProperty hw_compat_rhel_9_0[]; ++extern const size_t hw_compat_rhel_9_0_len; ++ ++extern GlobalProperty hw_compat_rhel_8_6[]; ++extern const size_t hw_compat_rhel_8_6_len; ++ ++extern GlobalProperty hw_compat_rhel_8_5[]; ++extern const size_t hw_compat_rhel_8_5_len; ++ ++extern GlobalProperty hw_compat_rhel_8_4[]; ++extern const size_t hw_compat_rhel_8_4_len; ++ ++extern GlobalProperty hw_compat_rhel_8_3[]; ++extern const size_t hw_compat_rhel_8_3_len; ++ ++extern GlobalProperty hw_compat_rhel_8_2[]; ++extern const size_t hw_compat_rhel_8_2_len; ++ ++extern GlobalProperty hw_compat_rhel_8_1[]; ++extern const size_t hw_compat_rhel_8_1_len; ++ ++extern GlobalProperty hw_compat_rhel_8_0[]; ++extern const size_t hw_compat_rhel_8_0_len; ++ ++extern GlobalProperty hw_compat_rhel_7_6[]; ++extern const size_t hw_compat_rhel_7_6_len; ++ ++extern const char *rhel_old_machine_deprecation; + #endif +diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h +index f066ab7262..e805d25fbe 100644 +--- a/include/hw/firmware/smbios.h ++++ b/include/hw/firmware/smbios.h +@@ -331,7 +331,9 @@ void smbios_add_usr_blob_size(size_t size); + void smbios_entry_add(QemuOpts *opts, Error **errp); + void smbios_set_cpuid(uint32_t version, uint32_t features); + void smbios_set_defaults(const char *manufacturer, const char *product, +- const char *version); ++ const char *version, ++ const char *stream_product, ++ const char *stream_version); + void smbios_set_default_processor_family(uint16_t processor_family); + uint8_t *smbios_get_table_legacy(size_t *length, Error **errp); + void smbios_get_tables(MachineState *ms, +diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h +index 4e55d7ef6e..8776a3c937 100644 +--- a/include/hw/i386/pc.h ++++ b/include/hw/i386/pc.h +@@ -103,6 +103,9 @@ struct PCMachineClass { + bool smbios_defaults; + bool smbios_legacy_mode; + SmbiosEntryPointType default_smbios_ep_type; ++ /* New fields needed for Windows HardwareID-6 matching */ ++ const char *smbios_stream_product; ++ const char *smbios_stream_version; + + /* RAM / address space compat: */ + bool gigabyte_align; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch b/images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch new file mode 100644 index 000000000..071618810 --- /dev/null +++ b/images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch @@ -0,0 +1,36 @@ +From 8781d75adf542ea09e62a0cafd0c79875015a272 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 13:32:32 +0100 +Subject: meson: temporarily disable -Wunused-function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Deleting the upstream versioned machine types will leave some functions +unused until RHEL machine types are added once again. Temporarily +disable the -Wunused-function warning to preserve bisectability with +fine grained patch splits. + +Signed-off-by: Daniel P. Berrangé + +Rebase notes (9.1.0 rc0) +- New patch +--- + meson.build | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/meson.build b/meson.build +index fbda17c987..161d496d55 100644 +--- a/meson.build ++++ b/meson.build +@@ -651,6 +651,7 @@ warn_flags = [ + '-Wno-string-plus-int', + '-Wno-tautological-type-limit-compare', + '-Wno-typedef-redefinition', ++ '-Wno-unused-function', + ] + + if host_os != 'darwin' +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch b/images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch new file mode 100644 index 000000000..2590cc4b4 --- /dev/null +++ b/images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch @@ -0,0 +1,139 @@ +From c5e6c533f498a698ef6797f58f3f8aced62476fd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 13:25:13 +0100 +Subject: Remove upstream machine type versions for aarch64, s390x and x86_64 + architectures +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The upstream versions will later be replaced by RHEL machine type +definitions. + +Signed-off-by: Daniel P. Berrangé +Signed-off-by: Mirslav Rezanina + +Rebase notes (9.1.0 rc0) + - Split off from downstream machine type addition patch +--- + hw/arm/virt.c | 2 ++ + hw/i386/pc_piix.c | 2 ++ + hw/i386/pc_q35.c | 2 ++ + hw/ppc/spapr.c | 5 +++++ + hw/s390x/s390-virtio-ccw.c | 2 ++ + 5 files changed, 13 insertions(+) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index b2aa3f1355..5396e7cb24 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -3306,6 +3306,7 @@ static void machvirt_machine_init(void) + } + type_init(machvirt_machine_init); + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void virt_machine_9_1_options(MachineClass *mc) + { + } +@@ -3552,3 +3553,4 @@ static void virt_machine_2_6_options(MachineClass *mc) + vmc->no_pmu = true; + } + DEFINE_VIRT_MACHINE(2, 6) ++#endif /* disabled for RHEL */ +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index 347afa4c37..67107b174a 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -448,6 +448,7 @@ static void pc_i440fx_init(MachineState *machine) + #define DEFINE_I440FX_MACHINE(major, minor) \ + DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor); + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void pc_i440fx_machine_options(MachineClass *m) + { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); +@@ -775,6 +776,7 @@ static void pc_i440fx_machine_2_4_options(MachineClass *m) + } + + DEFINE_I440FX_MACHINE(2, 4); ++#endif /* Disabled for Red Hat Enterprise Linux */ + + #ifdef CONFIG_ISAPC + static void isapc_machine_options(MachineClass *m) +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index f2d8edfa84..5fb283f2df 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -356,6 +356,7 @@ static void pc_q35_machine_options(MachineClass *m) + pc_q35_compat_defaults, pc_q35_compat_defaults_len); + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void pc_q35_machine_9_1_options(MachineClass *m) + { + pc_q35_machine_options(m); +@@ -668,3 +669,4 @@ static void pc_q35_machine_2_4_options(MachineClass *m) + } + + DEFINE_Q35_MACHINE(2, 4); ++#endif /* Disabled for Red Hat Enterprise Linux */ +diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c +index 370d7c35d3..b48a2afc38 100644 +--- a/hw/ppc/spapr.c ++++ b/hw/ppc/spapr.c +@@ -4837,6 +4837,7 @@ static void spapr_machine_latest_class_options(MachineClass *mc) + #define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, tag) \ + DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, _, tag) + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + /* + * pseries-9.1 + */ +@@ -5041,6 +5042,7 @@ static void spapr_machine_4_1_class_options(MachineClass *mc) + } + + DEFINE_SPAPR_MACHINE(4, 1); ++#endif /* disabled for RHEL */ + + /* + * pseries-4.0 +@@ -5056,6 +5058,8 @@ static bool phb_placement_4_0(SpaprMachineState *spapr, uint32_t index, + } + return true; + } ++ ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void spapr_machine_4_0_class_options(MachineClass *mc) + { + SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); +@@ -5380,6 +5384,7 @@ static void spapr_machine_2_1_class_options(MachineClass *mc) + compat_props_add(mc->compat_props, hw_compat_2_1, hw_compat_2_1_len); + } + DEFINE_SPAPR_MACHINE(2, 1); ++#endif /* disabled for RHEL */ + + static void spapr_machine_register_types(void) + { +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index c483ff8064..86bfc9d2eb 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -871,6 +871,7 @@ static const TypeInfo ccw_machine_info = { + DEFINE_CCW_MACHINE_IMPL(false, major, minor) + + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void ccw_machine_9_1_instance_options(MachineState *machine) + { + } +@@ -1305,6 +1306,7 @@ static void ccw_machine_2_4_class_options(MachineClass *mc) + DEFINE_CCW_MACHINE(2, 4); + + #endif ++#endif /* disabled for RHEL */ + + static void ccw_machine_register_types(void) + { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch b/images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch new file mode 100644 index 000000000..e5b4b10f9 --- /dev/null +++ b/images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch @@ -0,0 +1,195 @@ +From 3cb90f2fec9096ddde4038e037e82a9c44614791 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 15:27:03 +0100 +Subject: Adapt versioned machine type macros for RHEL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The versioned machine type macros are changed thus: + + * All symbol names get 'rhel' inserted eg 'virt_rhel_macine_9_4_0_' + * All machine type names get 'rhel' inserted eg 'virt-rhel9.4.0-machine' + * Lifecycle is changed to deprecate after 1 major RHEL release, + force non-registration (effectively deletion) after 2 major releases + * Custom message to explain RHEL deprecation/deletion policy + * Remove upstream logic that temporarily disabled deletion since + the upstream constraints in this area don't apply to RHEL + * For automatic deprecation/deletion, RHEL_VERSION is defined + +Signed-off-by: Daniel P. Berrangé +Signed-off-by: Miroslav Rezanina +--- + .distro/Makefile.common | 1 + + .distro/qemu-kvm.spec.template | 1 + + include/hw/boards.h | 60 +++++++++++----------------------- + meson.build | 1 + + meson_options.txt | 2 ++ + scripts/meson-buildoptions.sh | 2 ++ + 6 files changed, 26 insertions(+), 41 deletions(-) + +diff --git a/include/hw/boards.h b/include/hw/boards.h +index ccfc3e10eb..7f7eb4ec40 100644 +--- a/include/hw/boards.h ++++ b/include/hw/boards.h +@@ -548,16 +548,16 @@ struct MachineState { + * "{prefix}-{major}.{minor}.{micro}-{tag}" + */ + #define _MACHINE_VER_TYPE_NAME2(prefix, major, minor) \ +- prefix "-" #major "." #minor TYPE_MACHINE_SUFFIX ++ prefix "-rhel" #major "." #minor TYPE_MACHINE_SUFFIX + + #define _MACHINE_VER_TYPE_NAME3(prefix, major, minor, micro) \ +- prefix "-" #major "." #minor "." #micro TYPE_MACHINE_SUFFIX ++ prefix "-rhel" #major "." #minor "." #micro TYPE_MACHINE_SUFFIX + + #define _MACHINE_VER_TYPE_NAME4(prefix, major, minor, _unused_, tag) \ +- prefix "-" #major "." #minor "-" #tag TYPE_MACHINE_SUFFIX ++ prefix "-rhel" #major "." #minor "-" #tag TYPE_MACHINE_SUFFIX + + #define _MACHINE_VER_TYPE_NAME5(prefix, major, minor, micro, _unused_, tag) \ +- prefix "-" #major "." #minor "." #micro "-" #tag TYPE_MACHINE_SUFFIX ++ prefix "-rhel" #major "." #minor "." #micro "-" #tag TYPE_MACHINE_SUFFIX + + #define MACHINE_VER_TYPE_NAME(prefix, ...) \ + _MACHINE_VER_PICK(__VA_ARGS__, \ +@@ -585,16 +585,16 @@ struct MachineState { + * {prefix}_machine_{major}_{minor}_{micro}_{tag}_{sym} + */ + #define _MACHINE_VER_SYM2(sym, prefix, major, minor) \ +- prefix ## _machine_ ## major ## _ ## minor ## _ ## sym ++ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## sym + + #define _MACHINE_VER_SYM3(sym, prefix, major, minor, micro) \ +- prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## sym ++ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## micro ## _ ## sym + + #define _MACHINE_VER_SYM4(sym, prefix, major, minor, _unused_, tag) \ +- prefix ## _machine_ ## major ## _ ## minor ## _ ## tag ## _ ## sym ++ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## tag ## _ ## sym + + #define _MACHINE_VER_SYM5(sym, prefix, major, minor, micro, _unused_, tag) \ +- prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym ++ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym + + #define MACHINE_VER_SYM(sym, prefix, ...) \ + _MACHINE_VER_PICK(__VA_ARGS__, \ +@@ -605,26 +605,22 @@ struct MachineState { + + + /* +- * How many years/major releases for each phase +- * of the life cycle. Assumes use of versioning +- * scheme where major is bumped each year ++ * How many RHEL major releases for each phase ++ * of the life cycle. + */ +-#define MACHINE_VER_DELETION_MAJOR 6 +-#define MACHINE_VER_DEPRECATION_MAJOR 3 ++#define MACHINE_VER_DELETION_MAJOR 2 ++#define MACHINE_VER_DEPRECATION_MAJOR 1 + + /* + * Expands to a static string containing a deprecation + * message for a versioned machine type + */ + #define MACHINE_VER_DEPRECATION_MSG \ +- "machines more than " stringify(MACHINE_VER_DEPRECATION_MAJOR) \ +- " years old are subject to deletion after " \ +- stringify(MACHINE_VER_DELETION_MAJOR) " years" ++ "machines from the previous RHEL major release are " \ ++ "subject to deletion in the next RHEL major release" + + #define _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) \ +- (((QEMU_VERSION_MAJOR - major) > cutoff) || \ +- (((QEMU_VERSION_MAJOR - major) == cutoff) && \ +- (QEMU_VERSION_MINOR - minor) >= 0)) ++ ((RHEL_VERSION - major) >= cutoff) + + #define _MACHINE_VER_IS_EXPIRED2(cutoff, major, minor) \ + _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) +@@ -686,32 +682,14 @@ struct MachineState { + * This must be unconditionally used in the register + * method for all machine types which support versioning. + * +- * Inijtially it will effectively be a no-op, but after a +- * suitable period of time has passed, it will cause +- * execution of the method to return, avoiding registration +- * of the machine +- * +- * The new deprecation and deletion policy for versioned +- * machine types was introduced in QEMU 9.1.0. +- * +- * Under the new policy a number of old machine types (any +- * prior to 2.12) would be liable for immediate deletion +- * which would be a violation of our historical deprecation +- * and removal policy +- * +- * Thus deletions are temporarily gated on existance of +- * the env variable "QEMU_DELETE_MACHINES" / QEMU version +- * number >= 10.1.0. This gate can be deleted in the 10.1.0 +- * dev cycle ++ * It will automatically avoid registration of machines ++ * that should have been deleted at the start of this ++ * RHEL release + */ + #define MACHINE_VER_DELETION(...) \ + do { \ + if (MACHINE_VER_SHOULD_DELETE(__VA_ARGS__)) { \ +- if (getenv("QEMU_DELETE_MACHINES") || \ +- QEMU_VERSION_MAJOR > 10 || (QEMU_VERSION_MAJOR == 10 && \ +- QEMU_VERSION_MINOR >= 1)) { \ +- return; \ +- } \ ++ return; \ + } \ + } while (0) + +diff --git a/meson.build b/meson.build +index 161d496d55..2de5ab024f 100644 +--- a/meson.build ++++ b/meson.build +@@ -2440,6 +2440,7 @@ config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version())) + config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]) + config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) + config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) ++config_host_data.set('RHEL_VERSION', get_option('rhel_version').split('.')[0]) + + config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf) + config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) +diff --git a/meson_options.txt b/meson_options.txt +index 0269fa0f16..aa2ba0baef 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -2,6 +2,8 @@ + # on the configure script command line. If you add more, list them in + # scripts/meson-buildoptions.py's SKIP_OPTIONS constant too. + ++option('rhel_version', type: 'string', value: '0.0', ++ description: 'RHEL major/minor version') + option('qemu_suffix', type : 'string', value: 'qemu', + description: 'Suffix for QEMU data/modules/config directories (can be empty)') + option('docdir', type : 'string', value : 'share/doc', +diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh +index c97079a38c..5f0cbfc725 100644 +--- a/scripts/meson-buildoptions.sh ++++ b/scripts/meson-buildoptions.sh +@@ -71,6 +71,7 @@ meson_options_help() { + printf "%s\n" ' "manufacturer" name for qemu-ga registry entries' + printf "%s\n" ' [QEMU]' + printf "%s\n" ' --qemu-ga-version=VALUE version number for qemu-ga installer' ++ printf "%s\n" ' --rhel-version=VALUE RHEL major/minor version [0.0]' + printf "%s\n" ' --smbd=VALUE Path to smbd for slirp networking' + printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]' + printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string' +@@ -450,6 +451,7 @@ _meson_option_parse() { + --disable-relocatable) printf "%s" -Drelocatable=false ;; + --enable-replication) printf "%s" -Dreplication=enabled ;; + --disable-replication) printf "%s" -Dreplication=disabled ;; ++ --rhel-version=*) quote_sh "-Drhel_version=$2" ;; + --enable-rng-none) printf "%s" -Drng_none=true ;; + --disable-rng-none) printf "%s" -Drng_none=false ;; + --enable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=enabled ;; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch b/images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch new file mode 100644 index 000000000..09bebec65 --- /dev/null +++ b/images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch @@ -0,0 +1,33 @@ +From f25d2c0298d8d6328cb0071926d477f647a512fc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 18:45:58 +0100 +Subject: Increase deletion schedule to 3 releases +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The RHEL-9 series still keeps the rhel 7.6.0 machine types as a +special exception to our normal rule of deleting machine types +after 2 releases. The exception will go away in RHEL-10. + +Signed-off-by: Daniel P. Berrangé +--- + include/hw/boards.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/hw/boards.h b/include/hw/boards.h +index 7f7eb4ec40..32c4642f5a 100644 +--- a/include/hw/boards.h ++++ b/include/hw/boards.h +@@ -608,7 +608,7 @@ struct MachineState { + * How many RHEL major releases for each phase + * of the life cycle. + */ +-#define MACHINE_VER_DELETION_MAJOR 2 ++#define MACHINE_VER_DELETION_MAJOR 3 + #define MACHINE_VER_DEPRECATION_MAJOR 1 + + /* +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch b/images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch new file mode 100644 index 000000000..df71e687f --- /dev/null +++ b/images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch @@ -0,0 +1,368 @@ +From a2e5218bbe2e39712e06c5d8a51f836807c1cae9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 13:25:47 +0100 +Subject: Add downstream aarch64 versioned 'virt' machine types + +Adding changes to add RHEL machine types for aarch64 architecture. + +Signed-off-by: Miroslav Rezanina +--- +Rebase notes (6.1.0): +- Use CONFIG_TPM check when using TPM structures +- Add support for default_bus_bypass_iommu +- ea4c0b32d9 arm/virt: Register highmem and gic-version as class properties +- 895e1fa86a hw/arm/virt: Add 8.5 and 9.0 machine types and remove older ones + +Rebase notes (7.0.0): +- Added dtb-kaslr-seed option +- Set no_tcg_lpa2 to true + +Rebase notes (7.1.0): +- replace dtb_kaslr_seed by dtb_randomness +- Updated dtb_randomness comment + +Rebase notes (7.2.0): +- Disabled cortex-a35 + +Rebase notes (8.0.0): +- Moved changed code from target/arm/helper.c to target/arm/arm-qmp-cmds.c + +Rebase notes (8.1.0): +- Added setting default_nic + +Rebase notes (9.0.0 rc0): +- call arm_virt_compat_set on rhel type class_init + +Rebase notes (9.1.0 rc0): +- Merge copy+pasted base machine definition back with upstream + base machine definition to reduce RHEL delta, as is done with + other targets +- Convert to new DEFINE_VIRT_MACHINE macros + +Rebase notes (9.1.0 rc1): +- do not remove cpu_valid_types + +Rebase notes (9.1.0 rc2): +- Use preprocessing to remove unwanted code instead of removal + +Merged patches (6.2.0): +- 9a3d4fde0e hw/arm/virt: Remove 9.0 machine type +- f7d04d6695 hw: arm: virt: Add hw_compat_rhel_8_5 to 8.5 machine type + +Merged patches (7.0.0): +- 3b82be3dd3 redhat: virt-rhel8.5.0: Update machine type compatibility for QEMU 6.2.0 update +- c354a86c9b hw/arm/virt: Register "iommu" as a class property +- c1a2630dc9 hw/arm/virt: Register "its" as a class property +- 9d8c61dc93 hw/arm/virt: Rename default_bus_bypass_iommu +- a1d1b6eeb6 hw/arm/virt: Expose the 'RAS' option +- 47f8fe1b82 hw/arm/virt: Add 9.0 machine type and remove 8.5 one +- ed2346788f hw/arm/virt: Check no_tcg_its and minor style changes + +Merged patches (7.0.0): +- f79b31bdef hw/arm/virt: Remove the dtb-kaslr-seed machine option +- b6fca85f4a hw/arm/virt: Fix missing initialization in instance/class_init() + +Merged patches (7.1.0): +- ac97dd4f9f RHEL-only: AArch64: Drop unsupported CPU types +- e9c0a70664 target/arm: deprecate named CPU models + +Merged patches (7.2.0): +- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) + +Merged patches (8.0.0): +- c1a21266d8 redhat: aarch64: add rhel9.2.0 virt machine type +- d97cd7c513 redhat: fix virt-rhel9.2.0 compat props + +Merged patches (8.1.0): +- bd5d81d286 Add RHEL 9.2.0 compat structure (arm part) +- c07f666086 hw/arm/virt: Validate cluster and NUMA node boundary for RHEL machines + +Merged patches (8.2.0): +- 4ee284aca9 Add machine types compat bits. (partial) + +Merged patches (9.0.0 rc0): +- 117068376a hw/arm/virt: Fix compats +- 8bcccfabc4 hw/arm/virt: Add properties to disable high memory regions + 0005a8b93a hw/arm/virt: deprecate virt-rhel9.{0,2}.0 machine types + +Merged patches (9.1.0 rc0): +- 043ad5ce97 Add upstream compatibility bits (partial) +- 092cb319ea hw/arm/virt: Fix spurious call to arm_virt_compat_set() +--- + hw/arm/virt.c | 101 ++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 81 insertions(+), 20 deletions(-) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index 5396e7cb24..903c0f2e9f 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -90,6 +90,22 @@ static GlobalProperty arm_virt_compat[] = { + }; + static const size_t arm_virt_compat_len = G_N_ELEMENTS(arm_virt_compat); + ++/* ++ * This variable is for changes to properties that are RHEL specific, ++ * different to the current upstream and to be applied to the latest ++ * machine type. They may be overriden by older machine compats. ++ * ++ * virtio-net-pci variant romfiles are not needed because edk2 does ++ * fully support the pxe boot. Besides virtio romfiles are not shipped ++ * on rhel/aarch64. ++ */ ++GlobalProperty arm_rhel_compat[] = { ++ {"virtio-net-pci", "romfile", "" }, ++ {"virtio-net-pci-transitional", "romfile", "" }, ++ {"virtio-net-pci-non-transitional", "romfile", "" }, ++}; ++const size_t arm_rhel_compat_len = G_N_ELEMENTS(arm_rhel_compat); ++ + /* + * This cannot be called from the virt_machine_class_init() because + * TYPE_VIRT_MACHINE is abstract and mc->compat_props g_ptr_array_new() +@@ -99,6 +115,8 @@ static void arm_virt_compat_set(MachineClass *mc) + { + compat_props_add(mc->compat_props, arm_virt_compat, + arm_virt_compat_len); ++ compat_props_add(mc->compat_props, arm_rhel_compat, ++ arm_rhel_compat_len); + } + + #define DEFINE_VIRT_MACHINE_IMPL(latest, ...) \ +@@ -109,10 +127,11 @@ static void arm_virt_compat_set(MachineClass *mc) + MachineClass *mc = MACHINE_CLASS(oc); \ + arm_virt_compat_set(mc); \ + MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ +- mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \ ++ mc->desc = "RHEL " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \ + MACHINE_VER_DEPRECATION(__VA_ARGS__); \ + if (latest) { \ + mc->alias = "virt"; \ ++ mc->is_default = 1; \ + } \ + } \ + static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \ +@@ -128,10 +147,10 @@ static void arm_virt_compat_set(MachineClass *mc) + } \ + type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); + +-#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \ +- DEFINE_VIRT_MACHINE_IMPL(true, major, minor) +-#define DEFINE_VIRT_MACHINE(major, minor) \ +- DEFINE_VIRT_MACHINE_IMPL(false, major, minor) ++#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor, micro) \ ++ DEFINE_VIRT_MACHINE_IMPL(true, major, minor, micro) ++#define DEFINE_VIRT_MACHINE(major, minor, micro) \ ++ DEFINE_VIRT_MACHINE_IMPL(false, major, minor, micro) + + + /* Number of external interrupt lines to configure the GIC with */ +@@ -2434,6 +2453,7 @@ static void machvirt_init(MachineState *machine) + qemu_add_machine_init_done_notifier(&vms->machine_done); + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static bool virt_get_secure(Object *obj, Error **errp) + { + VirtMachineState *vms = VIRT_MACHINE(obj); +@@ -2461,6 +2481,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp) + + vms->virt = value; + } ++#endif /* disabled for RHEL */ + + static bool virt_get_highmem(Object *obj, Error **errp) + { +@@ -2476,6 +2497,7 @@ static void virt_set_highmem(Object *obj, bool value, Error **errp) + vms->highmem = value; + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static bool virt_get_compact_highmem(Object *obj, Error **errp) + { + VirtMachineState *vms = VIRT_MACHINE(obj); +@@ -2489,6 +2511,7 @@ static void virt_set_compact_highmem(Object *obj, bool value, Error **errp) + + vms->highmem_compact = value; + } ++#endif /* disabled for RHEL */ + + static bool virt_get_highmem_redists(Object *obj, Error **errp) + { +@@ -2547,6 +2570,7 @@ static void virt_set_its(Object *obj, bool value, Error **errp) + vms->its = value; + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static bool virt_get_dtb_randomness(Object *obj, Error **errp) + { + VirtMachineState *vms = VIRT_MACHINE(obj); +@@ -2560,6 +2584,7 @@ static void virt_set_dtb_randomness(Object *obj, bool value, Error **errp) + + vms->dtb_randomness = value; + } ++#endif /* disabled for RHEL */ + + static char *virt_get_oem_id(Object *obj, Error **errp) + { +@@ -2643,6 +2668,7 @@ static void virt_set_ras(Object *obj, bool value, Error **errp) + vms->ras = value; + } + ++#if 0 /* Disabled for Red Hat Enterprise Linux */ + static bool virt_get_mte(Object *obj, Error **errp) + { + VirtMachineState *vms = VIRT_MACHINE(obj); +@@ -2656,6 +2682,7 @@ static void virt_set_mte(Object *obj, bool value, Error **errp) + + vms->mte = value; + } ++#endif /* disabled for RHEL */ + + static char *virt_get_gic_version(Object *obj, Error **errp) + { +@@ -3063,16 +3090,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + NULL + }; + ++ mc->family = "virt-rhel-Z"; + mc->init = machvirt_init; +- /* Start with max_cpus set to 512, which is the maximum supported by KVM. +- * The value may be reduced later when we have more information about the +- * configuration of the particular instance. +- */ +- mc->max_cpus = 512; +- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC); +- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE); +- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); +- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); ++ /* Maximum supported VCPU count for all virt-rhel* machines */ ++ mc->max_cpus = 384; + #ifdef CONFIG_TPM + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); + #endif +@@ -3083,11 +3104,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + mc->minimum_page_bits = 12; + mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; + mc->cpu_index_to_instance_props = virt_cpu_index_to_props; +-#ifdef CONFIG_TCG +- mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); +-#else +- mc->default_cpu_type = ARM_CPU_TYPE_NAME("max"); +-#endif ++ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57"); + mc->valid_cpu_types = valid_cpu_types; + mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; + mc->kvm_type = virt_kvm_type; +@@ -3111,6 +3128,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + NULL, NULL); + object_class_property_set_description(oc, "acpi", + "Enable ACPI"); ++#if 0 /* disabled for RHEL */ + object_class_property_add_bool(oc, "secure", virt_get_secure, + virt_set_secure); + object_class_property_set_description(oc, "secure", +@@ -3123,6 +3141,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + "Set on/off to enable/disable emulating a " + "guest CPU which implements the ARM " + "Virtualization Extensions"); ++#endif /* disabled for RHEL */ + + object_class_property_add_bool(oc, "highmem", virt_get_highmem, + virt_set_highmem); +@@ -3130,12 +3149,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + "Set on/off to enable/disable using " + "physical address space above 32 bits"); + ++#if 0 /* disabled for RHEL */ + object_class_property_add_bool(oc, "compact-highmem", + virt_get_compact_highmem, + virt_set_compact_highmem); + object_class_property_set_description(oc, "compact-highmem", + "Set on/off to enable/disable compact " + "layout for high memory regions"); ++#endif /* disabled for RHEL */ + + object_class_property_add_bool(oc, "highmem-redists", + virt_get_highmem_redists, +@@ -3163,7 +3184,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + virt_set_gic_version); + object_class_property_set_description(oc, "gic-version", + "Set GIC version. " +- "Valid values are 2, 3, 4, host and max"); ++ "Valid values are 2, 3, host and max"); + + object_class_property_add_str(oc, "iommu", virt_get_iommu, virt_set_iommu); + object_class_property_set_description(oc, "iommu", +@@ -3183,11 +3204,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + "Set on/off to enable/disable reporting host memory errors " + "to a KVM guest using ACPI and guest external abort exceptions"); + ++#if 0 /* disabled for RHEL */ + object_class_property_add_bool(oc, "mte", virt_get_mte, virt_set_mte); + object_class_property_set_description(oc, "mte", + "Set on/off to enable/disable emulating a " + "guest CPU which implements the ARM " + "Memory Tagging Extension"); ++#endif /* disabled for RHEL */ + + object_class_property_add_bool(oc, "its", virt_get_its, + virt_set_its); +@@ -3195,6 +3218,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + "Set on/off to enable/disable " + "ITS instantiation"); + ++#if 0 /* disabled for RHEL */ + object_class_property_add_bool(oc, "dtb-randomness", + virt_get_dtb_randomness, + virt_set_dtb_randomness); +@@ -3207,6 +3231,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) + virt_set_dtb_randomness); + object_class_property_set_description(oc, "dtb-kaslr-seed", + "Deprecated synonym of dtb-randomness"); ++#endif /* disabled for RHEL */ + + object_class_property_add_str(oc, "x-oem-id", + virt_get_oem_id, +@@ -3554,3 +3579,39 @@ static void virt_machine_2_6_options(MachineClass *mc) + } + DEFINE_VIRT_MACHINE(2, 6) + #endif /* disabled for RHEL */ ++ ++static void virt_rhel_machine_9_4_0_options(MachineClass *mc) ++{ ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); ++} ++DEFINE_VIRT_MACHINE_AS_LATEST(9, 4, 0) ++ ++static void virt_rhel_machine_9_2_0_options(MachineClass *mc) ++{ ++ virt_rhel_machine_9_4_0_options(mc); ++ ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_4, hw_compat_rhel_9_4_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_3, hw_compat_rhel_9_3_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_2, hw_compat_rhel_9_2_len); ++ ++ /* RHEL 9.4 is the first supported release */ ++ mc->deprecation_reason = ++ "machine types for versions prior to 9.4 are deprecated"; ++} ++DEFINE_VIRT_MACHINE(9, 2, 0) ++ ++static void virt_rhel_machine_9_0_0_options(MachineClass *mc) ++{ ++ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); ++ ++ virt_rhel_machine_9_2_0_options(mc); ++ ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_1, hw_compat_rhel_9_1_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_0, hw_compat_rhel_9_0_len); ++ ++ /* Disable FEAT_LPA2 since old kernels (<= v5.12) don't boot with that feature */ ++ vmc->no_tcg_lpa2 = true; ++ /* Compact layout for high memory regions was introduced with 9.2.0 */ ++ vmc->no_highmem_compact = true; ++} ++DEFINE_VIRT_MACHINE(9, 0, 0) +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch b/images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch new file mode 100644 index 000000000..fb5651424 --- /dev/null +++ b/images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch @@ -0,0 +1,529 @@ +From 676f3da2fc29ae71ed4189483b86e3c6496b8905 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 13:44:31 +0100 +Subject: Add downstream ppc64 versioned 'spapr' machine types + +Adding changes to add RHEL machine types for ppc64 architecture. + +Signed-off-by: Miroslav Rezanina + +Rebase notes (6.2.0): +- Fixed rebase conflict relicts +- Update machine type compat for 6.2 (from MR 66) + +Rebase notes (9.1.0 rc0) +- Don't call kvmppc_svm_allow() when !CONFIG_KVM +- Convert to new DEFINE_SPAPR_MACHINE macros + +Merged patches (6.1.0): +- c438c25ac3 redhat: Define pseries-rhel8.5.0 machine type +- a3995e2eff Remove RHEL 7.0.0 machine type (only ppc64 changes) +- ad3190a79b Remove RHEL 7.1.0 machine type (only ppc64 changes) +- 84bbe15d4e Remove RHEL 7.2.0 machine type (only ppc64 changes) +- 0215eb3356 Remove RHEL 7.3.0 machine types (only ppc64 changes) +- af69d1ca6e Remove RHEL 7.4.0 machine types (only ppc64 changes) +- 8f7a74ab78 Remove RHEL 7.5.0 machine types (only ppc64 changes) + +Merged patches (7.1.0): +- baa6790171 target/ppc/cpu-models: Fix ppc_cpu_aliases list for RHEL +--- + hw/ppc/spapr.c | 254 +++++++++++++++++++++++++++++++++++++++- + hw/ppc/spapr_cpu_core.c | 13 ++ + include/hw/ppc/spapr.h | 4 + + target/ppc/compat.c | 11 ++ + target/ppc/cpu.h | 1 + + target/ppc/kvm.c | 27 +++++ + target/ppc/kvm_ppc.h | 13 ++ + 7 files changed, 317 insertions(+), 6 deletions(-) + +diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c +index b48a2afc38..29e66f1b3f 100644 +--- a/hw/ppc/spapr.c ++++ b/hw/ppc/spapr.c +@@ -1746,6 +1746,13 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason) + } + spapr_caps_apply(spapr); + spapr_nested_reset(spapr); ++ if (spapr->svm_allowed) { ++#ifdef CONFIG_KVM ++ kvmppc_svm_allow(&error_fatal); ++#else ++ error_setg(&error_fatal, "No PEF support in tcg, try x-svm-allowed=off"); ++#endif ++ } + + first_ppc_cpu = POWERPC_CPU(first_cpu); + if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && +@@ -3452,6 +3459,20 @@ static void spapr_set_host_serial(Object *obj, const char *value, Error **errp) + spapr->host_serial = g_strdup(value); + } + ++static bool spapr_get_svm_allowed(Object *obj, Error **errp) ++{ ++ SpaprMachineState *spapr = SPAPR_MACHINE(obj); ++ ++ return spapr->svm_allowed; ++} ++ ++static void spapr_set_svm_allowed(Object *obj, bool value, Error **errp) ++{ ++ SpaprMachineState *spapr = SPAPR_MACHINE(obj); ++ ++ spapr->svm_allowed = value; ++} ++ + static void spapr_instance_init(Object *obj) + { + SpaprMachineState *spapr = SPAPR_MACHINE(obj); +@@ -3530,6 +3551,12 @@ static void spapr_instance_init(Object *obj) + spapr_get_host_serial, spapr_set_host_serial); + object_property_set_description(obj, "host-serial", + "Host serial number to advertise in guest device tree"); ++ object_property_add_bool(obj, "x-svm-allowed", ++ spapr_get_svm_allowed, ++ spapr_set_svm_allowed); ++ object_property_set_description(obj, "x-svm-allowed", ++ "Allow the guest to become a Secure Guest" ++ " (experimental only)"); + } + + static void spapr_machine_finalizefn(Object *obj) +@@ -4775,6 +4802,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) + vmc->client_architecture_support = spapr_vof_client_architecture_support; + vmc->quiesce = spapr_vof_quiesce; + vmc->setprop = spapr_vof_setprop; ++ smc->has_power9_support = true; + } + + static const TypeInfo spapr_machine_info = { +@@ -4830,12 +4858,12 @@ static void spapr_machine_latest_class_options(MachineClass *mc) + } \ + type_init(MACHINE_VER_SYM(register, spapr, __VA_ARGS__)) + +-#define DEFINE_SPAPR_MACHINE_AS_LATEST(major, minor) \ +- DEFINE_SPAPR_MACHINE_IMPL(true, major, minor) +-#define DEFINE_SPAPR_MACHINE(major, minor) \ +- DEFINE_SPAPR_MACHINE_IMPL(false, major, minor) +-#define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, tag) \ +- DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, _, tag) ++#define DEFINE_SPAPR_MACHINE_AS_LATEST(major, minor, micro) \ ++ DEFINE_SPAPR_MACHINE_IMPL(true, major, minor, micro) ++#define DEFINE_SPAPR_MACHINE(major, minor, micro) \ ++ DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, micro) ++#define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, micro, tag) \ ++ DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, micro, _, tag) + + #if 0 /* Disabled for Red Hat Enterprise Linux */ + /* +@@ -5386,6 +5414,220 @@ static void spapr_machine_2_1_class_options(MachineClass *mc) + DEFINE_SPAPR_MACHINE(2, 1); + #endif /* disabled for RHEL */ + ++static void spapr_rhel_machine_default_class_options(MachineClass *mc) ++{ ++ /* ++ * Defaults for the latest behaviour inherited from the base class ++ * can be overriden here for all pseries-rhel* machines. ++ */ ++ ++ /* Maximum supported VCPU count */ ++ mc->max_cpus = 384; ++} ++ ++/* ++ * pseries-rhel8.5.0 ++ * like pseries-6.0 ++ */ ++ ++static void spapr_rhel_machine_8_5_0_class_options(MachineClass *mc) ++{ ++ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); ++ ++ /* The default machine type must apply the RHEL specific defaults */ ++ spapr_rhel_machine_default_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_5, ++ hw_compat_rhel_8_5_len); ++ smc->pre_6_2_numa_affinity = true; ++ mc->smp_props.prefer_sockets = true; ++} ++ ++DEFINE_SPAPR_MACHINE_AS_LATEST(8, 5, 0); ++ ++/* ++ * pseries-rhel8.4.0 ++ * like pseries-5.2 ++ */ ++ ++static void spapr_rhel_machine_8_4_0_class_options(MachineClass *mc) ++{ ++ spapr_rhel_machine_8_5_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_4, ++ hw_compat_rhel_8_4_len); ++} ++ ++DEFINE_SPAPR_MACHINE(8, 4, 0); ++ ++/* ++ * pseries-rhel8.3.0 ++ * like pseries-5.1 ++ */ ++ ++static void spapr_rhel_machine_8_3_0_class_options(MachineClass *mc) ++{ ++ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); ++ ++ spapr_rhel_machine_8_4_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_3, ++ hw_compat_rhel_8_3_len); ++ ++ /* from pseries-5.1 */ ++ smc->pre_5_2_numa_associativity = true; ++} ++ ++DEFINE_SPAPR_MACHINE(8, 3, 0); ++ ++/* ++ * pseries-rhel8.2.0 ++ * like pseries-4.2 + pseries-5.0 ++ * except SPAPR_CAP_CCF_ASSIST that has been backported to pseries-rhel8.1.0 ++ */ ++ ++static void spapr_rhel_machine_8_2_0_class_options(MachineClass *mc) ++{ ++ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); ++ /* from pseries-5.0 */ ++ static GlobalProperty compat[] = { ++ { TYPE_SPAPR_PCI_HOST_BRIDGE, "pre-5.1-associativity", "on" }, ++ }; ++ ++ spapr_rhel_machine_8_3_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_2, ++ hw_compat_rhel_8_2_len); ++ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); ++ ++ /* from pseries-4.2 */ ++ smc->default_caps.caps[SPAPR_CAP_FWNMI] = SPAPR_CAP_OFF; ++ smc->rma_limit = 16 * GiB; ++ mc->nvdimm_supported = false; ++ ++ /* from pseries-5.0 */ ++ mc->numa_mem_supported = true; ++ smc->pre_5_1_assoc_refpoints = true; ++} ++ ++DEFINE_SPAPR_MACHINE(8, 2, 0); ++ ++/* ++ * pseries-rhel8.1.0 ++ * like pseries-4.1 ++ */ ++ ++static void spapr_rhel_machine_8_1_0_class_options(MachineClass *mc) ++{ ++ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); ++ static GlobalProperty compat[] = { ++ /* Only allow 4kiB and 64kiB IOMMU pagesizes */ ++ { TYPE_SPAPR_PCI_HOST_BRIDGE, "pgsz", "0x11000" }, ++ }; ++ ++ spapr_rhel_machine_8_2_0_class_options(mc); ++ ++ /* from pseries-4.1 */ ++ smc->linux_pci_probe = false; ++ smc->smp_threads_vsmt = false; ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_1, ++ hw_compat_rhel_8_1_len); ++ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); ++ ++ /* from pseries-4.2 */ ++ smc->default_caps.caps[SPAPR_CAP_CCF_ASSIST] = SPAPR_CAP_OFF; ++} ++ ++DEFINE_SPAPR_MACHINE(8, 1, 0); ++ ++/* ++ * pseries-rhel8.0.0 ++ * like pseries-3.1 and pseries-4.0 ++ * except SPAPR_CAP_CFPC, SPAPR_CAP_SBBC and SPAPR_CAP_IBS ++ * that have been backported to pseries-rhel8.0.0 ++ */ ++ ++static void spapr_rhel_machine_8_0_0_class_options(MachineClass *mc) ++{ ++ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); ++ ++ spapr_rhel_machine_8_1_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_0, ++ hw_compat_rhel_8_0_len); ++ ++ /* pseries-4.0 */ ++ smc->phb_placement = phb_placement_4_0; ++ smc->irq = &spapr_irq_xics; ++ smc->pre_4_1_migration = true; ++ ++ /* pseries-3.1 */ ++ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0"); ++ smc->update_dt_enabled = false; ++ smc->dr_phb_enabled = false; ++ smc->broken_host_serial_model = true; ++ smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = SPAPR_CAP_OFF; ++} ++ ++DEFINE_SPAPR_MACHINE(8, 0, 0); ++ ++/* ++ * pseries-rhel7.6.0 ++ * like spapr_compat_2_12 and spapr_compat_3_0 ++ * spapr_compat_0 is empty ++ */ ++GlobalProperty spapr_compat_rhel7_6[] = { ++ { TYPE_POWERPC_CPU, "pre-3.0-migration", "on" }, ++ { TYPE_SPAPR_CPU_CORE, "pre-3.0-migration", "on" }, ++}; ++const size_t spapr_compat_rhel7_6_len = G_N_ELEMENTS(spapr_compat_rhel7_6); ++ ++ ++static void spapr_rhel_machine_7_6_0_class_options(MachineClass *mc) ++{ ++ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); ++ ++ spapr_rhel_machine_8_0_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); ++ compat_props_add(mc->compat_props, spapr_compat_rhel7_6, spapr_compat_rhel7_6_len); ++ ++ /* from spapr_machine_3_0_class_options() */ ++ smc->legacy_irq_allocation = true; ++ smc->nr_xirqs = 0x400; ++ smc->irq = &spapr_irq_xics_legacy; ++ ++ /* from spapr_machine_2_12_class_options() */ ++ /* We depend on kvm_enabled() to choose a default value for the ++ * hpt-max-page-size capability. Of course we can't do it here ++ * because this is too early and the HW accelerator isn't initialzed ++ * yet. Postpone this to machine init (see default_caps_with_cpu()). ++ */ ++ smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = 0; ++ ++ /* SPAPR_CAP_WORKAROUND enabled in pseries-rhel800 by ++ * f21757edc554 ++ * "Enable mitigations by default for pseries-4.0 machine type") ++ */ ++ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN; ++ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN; ++ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN; ++} ++ ++DEFINE_SPAPR_MACHINE(7, 6, 0); ++ ++/* ++ * pseries-rhel7.6.0-sxxm ++ * ++ * pseries-rhel7.6.0 with speculative execution exploit mitigations enabled by default ++ */ ++ ++static void spapr_rhel_machine_7_6_0_sxxm_class_options(MachineClass *mc) ++{ ++ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); ++ ++ spapr_rhel_machine_7_6_0_class_options(mc); ++ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND; ++ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND; ++ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD; ++} ++ ++DEFINE_SPAPR_MACHINE_TAGGED(7, 6, 0, sxxm); ++ + static void spapr_machine_register_types(void) + { + type_register_static(&spapr_machine_info); +diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c +index 0bf7c52077..c845f4acef 100644 +--- a/hw/ppc/spapr_cpu_core.c ++++ b/hw/ppc/spapr_cpu_core.c +@@ -25,6 +25,7 @@ + #include "sysemu/reset.h" + #include "sysemu/hw_accel.h" + #include "qemu/error-report.h" ++#include "cpu-models.h" + + static void spapr_reset_vcpu(PowerPCCPU *cpu) + { +@@ -264,6 +265,7 @@ static bool spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr, + { + CPUPPCState *env = &cpu->env; + CPUState *cs = CPU(cpu); ++ SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); + + if (!qdev_realize(DEVICE(cpu), NULL, errp)) { + return false; +@@ -280,6 +282,17 @@ static bool spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr, + /* Set time-base frequency to 512 MHz. vhyp must be set first. */ + cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ); + ++ if (!smc->has_power9_support && ++ (((spapr->max_compat_pvr && ++ ppc_compat_cmp(spapr->max_compat_pvr, ++ CPU_POWERPC_LOGICAL_3_00) >= 0)) || ++ (!spapr->max_compat_pvr && ++ ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, 0)))) { ++ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, ++ "POWER9 CPU is not supported by this machine class"); ++ return false; ++ } ++ + if (spapr_irq_cpu_intc_create(spapr, cpu, errp) < 0) { + qdev_unrealize(DEVICE(cpu)); + return false; +diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h +index f6de3e9972..fc48348747 100644 +--- a/include/hw/ppc/spapr.h ++++ b/include/hw/ppc/spapr.h +@@ -157,6 +157,7 @@ struct SpaprMachineClass { + bool pre_5_2_numa_associativity; + bool pre_6_2_numa_affinity; + ++ bool has_power9_support; + bool (*phb_placement)(SpaprMachineState *spapr, uint32_t index, + uint64_t *buid, hwaddr *pio, + hwaddr *mmio32, hwaddr *mmio64, +@@ -259,6 +260,9 @@ struct SpaprMachineState { + /* Set by -boot */ + char *boot_device; + ++ /* Secure Guest support via x-svm-allowed */ ++ bool svm_allowed; ++ + /*< public >*/ + char *kvm_type; + char *host_model; +diff --git a/target/ppc/compat.c b/target/ppc/compat.c +index ebef2cccec..ab7ed76806 100644 +--- a/target/ppc/compat.c ++++ b/target/ppc/compat.c +@@ -114,6 +114,17 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr) + return NULL; + } + ++long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2) ++{ ++ const CompatInfo *compat1 = compat_by_pvr(pvr1); ++ const CompatInfo *compat2 = compat_by_pvr(pvr2); ++ ++ g_assert(compat1); ++ g_assert(compat2); ++ ++ return compat1 - compat2; ++} ++ + static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr, + uint32_t min_compat_pvr, uint32_t max_compat_pvr) + { +diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h +index 321ed2da75..e35a997628 100644 +--- a/target/ppc/cpu.h ++++ b/target/ppc/cpu.h +@@ -1673,6 +1673,7 @@ static inline int ppc_env_mmu_index(CPUPPCState *env, bool ifetch) + + /* Compatibility modes */ + #if defined(TARGET_PPC64) ++long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2); + bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr, + uint32_t min_compat_pvr, uint32_t max_compat_pvr); + bool ppc_type_check_compat(const char *cputype, uint32_t compat_pvr, +diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c +index 907dba60d1..c942ff55b2 100644 +--- a/target/ppc/kvm.c ++++ b/target/ppc/kvm.c +@@ -92,6 +92,7 @@ static int cap_large_decr; + static int cap_fwnmi; + static int cap_rpt_invalidate; + static int cap_ail_mode_3; ++static int cap_ppc_secure_guest; + + #ifdef CONFIG_PSERIES + static int cap_papr; +@@ -150,6 +151,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) + cap_resize_hpt = kvm_vm_check_extension(s, KVM_CAP_SPAPR_RESIZE_HPT); + kvmppc_get_cpu_characteristics(s); + cap_ppc_nested_kvm_hv = kvm_vm_check_extension(s, KVM_CAP_PPC_NESTED_HV); ++ cap_ppc_secure_guest = kvm_vm_check_extension(s, KVM_CAP_PPC_SECURE_GUEST); + cap_large_decr = kvmppc_get_dec_bits(); + cap_fwnmi = kvm_vm_check_extension(s, KVM_CAP_PPC_FWNMI); + /* +@@ -2597,6 +2599,16 @@ bool kvmppc_supports_ail_3(void) + return cap_ail_mode_3; + } + ++bool kvmppc_has_cap_secure_guest(void) ++{ ++ return !!cap_ppc_secure_guest; ++} ++ ++int kvmppc_enable_cap_secure_guest(void) ++{ ++ return kvm_vm_enable_cap(kvm_state, KVM_CAP_PPC_SECURE_GUEST, 0, 1); ++} ++ + PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) + { + uint32_t host_pvr = mfpvr(); +@@ -3012,3 +3024,18 @@ static void kvm_cpu_accel_register_types(void) + type_register_static(&kvm_cpu_accel_type_info); + } + type_init(kvm_cpu_accel_register_types); ++ ++void kvmppc_svm_allow(Error **errp) ++{ ++ if (!kvm_enabled()) { ++ error_setg(errp, "No PEF support in tcg, try x-svm-allowed=off"); ++ return; ++ } ++ ++ if (!kvmppc_has_cap_secure_guest()) { ++ error_setg(errp, "KVM implementation does not support secure guests, " ++ "try x-svm-allowed=off"); ++ } else if (kvmppc_enable_cap_secure_guest() < 0) { ++ error_setg(errp, "Error enabling x-svm-allowed, try x-svm-allowed=off"); ++ } ++} +diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h +index 1975fb5ee6..d1017f98be 100644 +--- a/target/ppc/kvm_ppc.h ++++ b/target/ppc/kvm_ppc.h +@@ -46,6 +46,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu); + target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu, + bool radix, bool gtse, + uint64_t proc_tbl); ++void kvmppc_svm_allow(Error **errp); + bool kvmppc_spapr_use_multitce(void); + int kvmppc_spapr_enable_inkernel_multitce(void); + void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, +@@ -79,6 +80,8 @@ int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable); + int kvmppc_has_cap_rpt_invalidate(void); + bool kvmppc_supports_ail_3(void); + int kvmppc_enable_hwrng(void); ++bool kvmppc_has_cap_secure_guest(void); ++int kvmppc_enable_cap_secure_guest(void); + int kvmppc_put_books_sregs(PowerPCCPU *cpu); + PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void); + void kvmppc_check_papr_resize_hpt(Error **errp); +@@ -427,6 +430,16 @@ static inline bool kvmppc_supports_ail_3(void) + return false; + } + ++static inline bool kvmppc_has_cap_secure_guest(void) ++{ ++ return false; ++} ++ ++static inline int kvmppc_enable_cap_secure_guest(void) ++{ ++ return -1; ++} ++ + static inline int kvmppc_enable_hwrng(void) + { + return -1; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch b/images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch new file mode 100644 index 000000000..adad3c72d --- /dev/null +++ b/images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch @@ -0,0 +1,327 @@ +From 450ae6631771593689f7f9c3eb2081e93d3e75c5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 13:44:36 +0100 +Subject: Add downstream s390x versioned 's390-ccw-virtio' machine types + +Adding changes to add RHEL machine types for s390x architecture. + +Signed-off-by: Miroslav Rezanina +-- + +Rebase changes (7.1.0): +- Moved adding rhel_old_machine_deprecation variable to general machine types commit + +Rebase notes (9.1.0 rc0) +- Convert to new DEFINE_CCW_MACHINE macros + +Merged patches (6.1.0): +- 64a9a5c971 hw/s390x: Remove the RHEL7-only machine type +- 395516d62b redhat: s390x: add rhel-8.5.0 compat machine + +Merged patches (6.2.0): +- 3bf66f4520 redhat: Add s390x machine type compatibility update for 6.1 rebase + +Merged patches (7.0.0): +- e6ff4de4f7 redhat: Add s390x machine type compatibility handling for the rebase to v6.2 +- 4b0efa7e21 redhat: Add rhel8.6.0 and rhel9.0.0 machine types for s390x +- dcc64971bf RHEL: mark old machine types as deprecated (partialy) + +Merged patches (7.1.0): +- 1d6439527a WRB: Introduce RHEL 9.0.0 hw compat structure (only hw/s390x/s390-virtio-ccw.c chunk) +- c8ad21ca31 redhat: Update s390x machine type compatibility for rebase to QEMU 7.0.0 +- 5bcf8d874c target/s390x: deprecate CPUs older than z14 + +Merged patches (7.2.0): +- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) + +Merged patches (8.0.0): +- 27c188c6a4 redhat: Update s390x machine type compatibility for QEMU 7.2.0 update +- a932b8d429 redhat: Add new rhel-9.2.0 s390x machine type +- ac88104bad s390x/s390-virtio-ccw: Activate zPCI features on s390-ccw-virtio-rhel8.6.0 + +Merged patches (8.1.0): +- bd5d81d286 Add RHEL 9.2.0 compat structure (s390x part) + +Merged patches (8.2.0): +- 4ee284aca9 Add machine types compat bits. (partial) + +Merged patches (9.1.0 rc0): +- 043ad5ce97 Add upstream compatibility bits (partial) +--- + hw/s390x/s390-virtio-ccw.c | 164 ++++++++++++++++++++++++++++++- + target/s390x/cpu_models.c | 11 +++ + target/s390x/cpu_models.h | 2 + + target/s390x/cpu_models_sysemu.c | 2 + + 4 files changed, 174 insertions(+), 5 deletions(-) + +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index 86bfc9d2eb..72e1279db9 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -837,7 +837,7 @@ static const TypeInfo ccw_machine_info = { + { \ + MachineClass *mc = MACHINE_CLASS(oc); \ + MACHINE_VER_SYM(class_options, ccw, __VA_ARGS__)(mc); \ +- mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \ ++ mc->desc = "Virtual s390x machine (version rhel" MACHINE_VER_STR(__VA_ARGS__) ")"; \ + MACHINE_VER_DEPRECATION(__VA_ARGS__); \ + if (latest) { \ + mc->alias = "s390-ccw-virtio"; \ +@@ -864,11 +864,11 @@ static const TypeInfo ccw_machine_info = { + } \ + type_init(MACHINE_VER_SYM(register, ccw, __VA_ARGS__)) + +-#define DEFINE_CCW_MACHINE_AS_LATEST(major, minor) \ +- DEFINE_CCW_MACHINE_IMPL(true, major, minor) ++#define DEFINE_CCW_MACHINE_AS_LATEST(major, minor, micro) \ ++ DEFINE_CCW_MACHINE_IMPL(true, major, minor, micro) + +-#define DEFINE_CCW_MACHINE(major, minor) \ +- DEFINE_CCW_MACHINE_IMPL(false, major, minor) ++#define DEFINE_CCW_MACHINE(major, minor, micro) \ ++ DEFINE_CCW_MACHINE_IMPL(false, major, minor, micro) + + + #if 0 /* Disabled for Red Hat Enterprise Linux */ +@@ -1308,6 +1308,160 @@ DEFINE_CCW_MACHINE(2, 4); + #endif + #endif /* disabled for RHEL */ + ++static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) ++{ ++} ++ ++static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) ++{ ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); ++} ++DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); ++ ++static void ccw_rhel_machine_9_2_0_instance_options(MachineState *machine) ++{ ++ ccw_rhel_machine_9_4_0_instance_options(machine); ++} ++ ++static void ccw_rhel_machine_9_2_0_class_options(MachineClass *mc) ++{ ++ ccw_rhel_machine_9_4_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_4, hw_compat_rhel_9_4_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_3, hw_compat_rhel_9_3_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_2, hw_compat_rhel_9_2_len); ++ mc->smp_props.drawers_supported = false; /* from ccw_machine_8_1 */ ++ mc->smp_props.books_supported = false; /* from ccw_machine_8_1 */ ++} ++DEFINE_CCW_MACHINE(9, 2, 0); ++ ++static void ccw_rhel_machine_9_0_0_instance_options(MachineState *machine) ++{ ++ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_2 }; ++ ++ ccw_rhel_machine_9_2_0_instance_options(machine); ++ ++ s390_set_qemu_cpu_model(0x3906, 14, 2, qemu_cpu_feat); ++ s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE); ++} ++ ++static void ccw_rhel_machine_9_0_0_class_options(MachineClass *mc) ++{ ++ S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); ++ static GlobalProperty compat[] = { ++ { TYPE_S390_PCI_DEVICE, "interpret", "off", }, ++ { TYPE_S390_PCI_DEVICE, "forwarding-assist", "off", }, ++ }; ++ ++ ccw_rhel_machine_9_2_0_class_options(mc); ++ ++ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_1, hw_compat_rhel_9_1_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_0, hw_compat_rhel_9_0_len); ++ s390mc->max_threads = S390_MAX_CPUS; ++} ++DEFINE_CCW_MACHINE(9, 0, 0); ++ ++static void ccw_rhel_machine_8_6_0_instance_options(MachineState *machine) ++{ ++ /* Note: The -rhel8.6.0 and -rhel9.0.0 machines are technically identical */ ++ ccw_rhel_machine_9_0_0_instance_options(machine); ++} ++ ++static void ccw_rhel_machine_8_6_0_class_options(MachineClass *mc) ++{ ++ static GlobalProperty compat[] = { ++ { TYPE_S390_PCI_DEVICE, "interpret", "on", }, ++ { TYPE_S390_PCI_DEVICE, "forwarding-assist", "on", }, ++ }; ++ ++ ccw_rhel_machine_9_0_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_6, hw_compat_rhel_8_6_len); ++ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); ++} ++DEFINE_CCW_MACHINE(8, 6, 0); ++ ++static void ccw_rhel_machine_8_5_0_instance_options(MachineState *machine) ++{ ++ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_0 }; ++ ++ ccw_rhel_machine_8_6_0_instance_options(machine); ++ ++ s390_set_qemu_cpu_model(0x2964, 13, 2, qemu_cpu_feat); ++ ++ s390_cpudef_featoff_greater(16, 1, S390_FEAT_NNPA); ++ s390_cpudef_featoff_greater(16, 1, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2); ++ s390_cpudef_featoff_greater(16, 1, S390_FEAT_BEAR_ENH); ++ s390_cpudef_featoff_greater(16, 1, S390_FEAT_RDP); ++ s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAI); ++} ++ ++static void ccw_rhel_machine_8_5_0_class_options(MachineClass *mc) ++{ ++ static GlobalProperty compat[] = { ++ { TYPE_S390_PCI_DEVICE, "interpret", "off", }, ++ { TYPE_S390_PCI_DEVICE, "forwarding-assist", "off", }, ++ }; ++ ++ ccw_rhel_machine_8_6_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_5, hw_compat_rhel_8_5_len); ++ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); ++ mc->smp_props.prefer_sockets = true; ++} ++DEFINE_CCW_MACHINE(8, 5, 0); ++ ++static void ccw_rhel_machine_8_4_0_instance_options(MachineState *machine) ++{ ++ ccw_rhel_machine_8_5_0_instance_options(machine); ++} ++ ++static void ccw_rhel_machine_8_4_0_class_options(MachineClass *mc) ++{ ++ ccw_rhel_machine_8_5_0_class_options(mc); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_4, hw_compat_rhel_8_4_len); ++} ++DEFINE_CCW_MACHINE(8, 4, 0); ++ ++static void ccw_rhel_machine_8_2_0_instance_options(MachineState *machine) ++{ ++ ccw_rhel_machine_8_4_0_instance_options(machine); ++} ++ ++static void ccw_rhel_machine_8_2_0_class_options(MachineClass *mc) ++{ ++ ccw_rhel_machine_8_4_0_class_options(mc); ++ mc->fixup_ram_size = s390_fixup_ram_size; ++ /* we did not publish a rhel8.3.0 machine */ ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_3, hw_compat_rhel_8_3_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_2, hw_compat_rhel_8_2_len); ++} ++DEFINE_CCW_MACHINE(8, 2, 0); ++ ++static void ccw_rhel_machine_7_6_0_instance_options(MachineState *machine) ++{ ++ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V3_1 }; ++ ++ ccw_rhel_machine_8_2_0_instance_options(machine); ++ ++ s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat); ++ ++ /* The multiple-epoch facility was not available with rhel7.6.0 on z14GA1 */ ++ s390_cpudef_featoff(14, 1, S390_FEAT_MULTIPLE_EPOCH); ++ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QSIE); ++ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QTOUE); ++ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOE); ++ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOUE); ++} ++ ++static void ccw_rhel_machine_7_6_0_class_options(MachineClass *mc) ++{ ++ ccw_rhel_machine_8_2_0_class_options(mc); ++ /* We never published the s390x version of RHEL-AV 8.0 and 8.1, so add this here */ ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len); ++ compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); ++} ++DEFINE_CCW_MACHINE(7, 6, 0); ++ + static void ccw_machine_register_types(void) + { + type_register_static(&ccw_machine_info); +diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c +index a27f4b6f79..9ee30310c6 100644 +--- a/target/s390x/cpu_models.c ++++ b/target/s390x/cpu_models.c +@@ -47,6 +47,9 @@ + * of a following release have been a superset of the previous release. With + * generation 15 one base feature and one optional feature have been deprecated. + */ ++ ++#define RHEL_CPU_DEPRECATION "use at least 'z14', or 'host' / 'qemu' / 'max'" ++ + static S390CPUDef s390_cpu_defs[] = { + /* + * Linux requires at least z10 nowadays, and IBM only supports recent CPUs +@@ -871,22 +874,30 @@ static void s390_host_cpu_model_class_init(ObjectClass *oc, void *data) + static void s390_base_cpu_model_class_init(ObjectClass *oc, void *data) + { + S390CPUClass *xcc = S390_CPU_CLASS(oc); ++ CPUClass *cc = CPU_CLASS(oc); + + /* all base models are migration safe */ + xcc->cpu_def = (const S390CPUDef *) data; + xcc->is_migration_safe = true; + xcc->is_static = true; + xcc->desc = xcc->cpu_def->desc; ++ if (xcc->cpu_def->gen < 14) { ++ cc->deprecation_note = RHEL_CPU_DEPRECATION; ++ } + } + + static void s390_cpu_model_class_init(ObjectClass *oc, void *data) + { + S390CPUClass *xcc = S390_CPU_CLASS(oc); ++ CPUClass *cc = CPU_CLASS(oc); + + /* model that can change between QEMU versions */ + xcc->cpu_def = (const S390CPUDef *) data; + xcc->is_migration_safe = true; + xcc->desc = xcc->cpu_def->desc; ++ if (xcc->cpu_def->gen < 14) { ++ cc->deprecation_note = RHEL_CPU_DEPRECATION; ++ } + } + + static void s390_qemu_cpu_model_class_init(ObjectClass *oc, void *data) +diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h +index 71d4bc2dd4..d6c7c2cb50 100644 +--- a/target/s390x/cpu_models.h ++++ b/target/s390x/cpu_models.h +@@ -38,6 +38,8 @@ typedef struct S390CPUDef { + S390FeatBitmap full_feat; + /* used to init full_feat from generated data */ + S390FeatInit full_init; ++ /* if deprecated, provides a suggestion */ ++ const char *deprecation_note; + } S390CPUDef; + + /* CPU model based on a CPU definition */ +diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c +index 72572726b8..707d546ca1 100644 +--- a/target/s390x/cpu_models_sysemu.c ++++ b/target/s390x/cpu_models_sysemu.c +@@ -59,6 +59,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque) + CpuDefinitionInfo *info; + char *name = g_strdup(object_class_get_name(klass)); + S390CPUClass *scc = S390_CPU_CLASS(klass); ++ CPUClass *cc = CPU_CLASS(klass); + + /* strip off the -s390x-cpu */ + g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0; +@@ -68,6 +69,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque) + info->migration_safe = scc->is_migration_safe; + info->q_static = scc->is_static; + info->q_typename = g_strdup(object_class_get_name(klass)); ++ info->deprecated = !!cc->deprecation_note; + /* check for unavailable features */ + if (cpu_list_data->model) { + Object *obj; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch b/images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch new file mode 100644 index 000000000..7959d6ddc --- /dev/null +++ b/images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch @@ -0,0 +1,925 @@ +From a7d5687a80eca95a1c39b73bebb9d478f3adfb0c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 13:44:41 +0100 +Subject: Add downstream x86_64 versioned 'pc' & 'q35' machine types + +Adding changes to add RHEL machine types for x86_64 architecture. + +Signed-off-by: Miroslav Rezanina + +Rebase notes (6.1.0): +- Update qemu64 cpu spec + +Rebase notes (7.0.0): +- Reset alias for all machine-types except latest one + +Rebase notes (8.0.0): +- remove legacy_no_rng_seed usage (removed upstream) + +Rebase notes (8.1.0): +- default_nic_model to default_nic + +Rebase notes (9.1.0 rc0) +- Merged pc_q35_machine_rhel_options back into + pc_q35_machine_options to reduce delta to upstream +- Convert to new DEFINE_(I440FX|Q35)_MACHINE macros + +Merged patches (6.1.0): +- 59c284ad3b x86: Add x86 rhel8.5 machine types +- a8868b42fe redhat: x86: Enable 'kvm-asyncpf-int' by default +- a3995e2eff Remove RHEL 7.0.0 machine type (only x86_64 changes) +- ad3190a79b Remove RHEL 7.1.0 machine type (only x86_64 changes) +- 84bbe15d4e Remove RHEL 7.2.0 machine type (only x86_64 changes) +- 0215eb3356 Remove RHEL 7.3.0 machine types (only x86_64 changes) +- af69d1ca6e Remove RHEL 7.4.0 machine types (only x86_64 changes) +- 8f7a74ab78 Remove RHEL 7.5.0 machine types (only x86_64 changes) + +Merged patches (7.0.0): +- eae7d8dd3c x86/rhel machine types: Add pc_rhel_8_5_compat +- 6762f56469 x86/rhel machine types: Wire compat into q35 and i440fx +- 5762101438 rhel machine types/x86: set prefer_sockets +- 9ba9ddc632 x86: Add q35 RHEL 8.6.0 machine type +- 6110d865e5 x86: Add q35 RHEL 9.0.0 machine type +- dcc64971bf RHEL: mark old machine types as deprecated (partialy) +- 6b396f182b RHEL: disable "seqpacket" for "vhost-vsock-device" in rhel8.6.0 + +Merged patches (7.1.0): +- 38b89dc245 pc: Move s3/s4 suspend disabling to compat (only hw/i386/pc.c chunk) +- 1d6439527a WRB: Introduce RHEL 9.0.0 hw compat structure (x86_64 specific changes) +- 35b5c8554f target/i386: deprecate CPUs older than x86_64-v2 ABI + +Merged patches (7.2.0): +- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) + +Merged patches (8.0.0): +- f33ca8aed4 x86: rhel 9.2.0 machine type + +Merged patches (8.1.0): +- bd5d81d286 Add RHEL 9.2.0 compat structure (x86_64 part) +- c6eaf73add redhat: hw/i386/pc: Update x86 machine type compatibility for QEMU 8.0.0 update +- 6cbf496e5e hw/acpi: Mark acpi blobs as resizable on RHEL pc machines version 7.6 and above + +Merged patches (8.2.0): +- 4ee284aca9 Add machine types compat bits. (partial) +- 719e2ac147 Fix x86 machine type compatibility for qemu-kvm 8.1.0 + +Merged patches (9.0.0 rc0): +- 9149e2bc8f x86: rhel 9.2.0 machine type compat fix + +Merged patches (9.1.0 rc0): +- 043ad5ce97 Add upstream compatibility bits (partial) + +Merged patches (9.1.0 rc2): +- 06ee79be2b introduce pc_rhel_9_5_compat +- 5cfd133600 target/i386: add guest-phys-bits cpu property (partial) +- 46206b821b hw/i386/sev: Use legacy SEV VM types for older machine types (partial) +- 414fe1d14f hw/i386/pc_sysfw: Alias rather than copy isa-bios region (partial) +- 0b6825631a i386/sev: Don't allow automatic fallback to legacy KVM_SEV*_INIT (partial) +--- + hw/i386/fw_cfg.c | 2 +- + hw/i386/pc.c | 167 +++++++++++++++++++++++++++++- + hw/i386/pc_piix.c | 105 ++++++++++++++++++- + hw/i386/pc_q35.c | 207 +++++++++++++++++++++++++++++++++++-- + include/hw/boards.h | 2 + + include/hw/i386/pc.h | 36 +++++++ + target/i386/cpu.c | 21 ++++ + target/i386/kvm/kvm-cpu.c | 1 + + target/i386/kvm/kvm.c | 4 + + tests/qtest/pvpanic-test.c | 5 +- + 10 files changed, 537 insertions(+), 13 deletions(-) + +diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c +index 33ef280420..a322709ffa 100644 +--- a/hw/i386/fw_cfg.c ++++ b/hw/i386/fw_cfg.c +@@ -73,7 +73,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, + + if (pcmc->smbios_defaults) { + /* These values are guest ABI, do not change */ +- smbios_set_defaults("QEMU", mc->desc, mc->name, ++ smbios_set_defaults("Red Hat", "KVM", mc->desc, + pcmc->smbios_stream_product, pcmc->smbios_stream_version); + } + +diff --git a/hw/i386/pc.c b/hw/i386/pc.c +index 7779c88a91..fa0e42d072 100644 +--- a/hw/i386/pc.c ++++ b/hw/i386/pc.c +@@ -276,6 +276,169 @@ const size_t pc_compat_2_4_len = G_N_ELEMENTS(pc_compat_2_4); + */ + #define PC_FW_DATA (0x20000 + 0x8000) + ++/* This macro is for changes to properties that are RHEL specific, ++ * different to the current upstream and to be applied to the latest ++ * machine type. ++ */ ++GlobalProperty pc_rhel_compat[] = { ++ /* we don't support s3/s4 suspend */ ++ { "PIIX4_PM", "disable_s3", "1" }, ++ { "PIIX4_PM", "disable_s4", "1" }, ++ { "ICH9-LPC", "disable_s3", "1" }, ++ { "ICH9-LPC", "disable_s4", "1" }, ++ ++ { TYPE_X86_CPU, "host-phys-bits", "on" }, ++ { TYPE_X86_CPU, "host-phys-bits-limit", "48" }, ++ { TYPE_X86_CPU, "vmx-entry-load-perf-global-ctrl", "off" }, ++ { TYPE_X86_CPU, "vmx-exit-load-perf-global-ctrl", "off" }, ++ /* bz 1508330 */ ++ { "vfio-pci", "x-no-geforce-quirks", "on" }, ++ /* bz 1941397 */ ++ { TYPE_X86_CPU, "kvm-asyncpf-int", "on" }, ++}; ++const size_t pc_rhel_compat_len = G_N_ELEMENTS(pc_rhel_compat); ++ ++GlobalProperty pc_rhel_9_5_compat[] = { ++ /* pc_rhel_9_5_compat from pc_compat_pc_9_0 (backported from 9.1) */ ++ { TYPE_X86_CPU, "guest-phys-bits", "0" }, ++ /* pc_rhel_9_5_compat from pc_compat_pc_9_0 (backported from 9.1) */ ++ { "sev-guest", "legacy-vm-type", "on" }, ++}; ++const size_t pc_rhel_9_5_compat_len = G_N_ELEMENTS(pc_rhel_9_5_compat); ++ ++GlobalProperty pc_rhel_9_3_compat[] = { ++ /* pc_rhel_9_3_compat from pc_compat_8_0 */ ++ { "virtio-mem", "unplugged-inaccessible", "auto" }, ++}; ++const size_t pc_rhel_9_3_compat_len = G_N_ELEMENTS(pc_rhel_9_3_compat); ++ ++GlobalProperty pc_rhel_9_2_compat[] = { ++ /* pc_rhel_9_2_compat from pc_compat_7_2 */ ++ { "ICH9-LPC", "noreboot", "true" }, ++}; ++const size_t pc_rhel_9_2_compat_len = G_N_ELEMENTS(pc_rhel_9_2_compat); ++ ++GlobalProperty pc_rhel_9_0_compat[] = { ++ /* pc_rhel_9_0_compat from pc_compat_6_2 */ ++ { "virtio-mem", "unplugged-inaccessible", "off" }, ++}; ++const size_t pc_rhel_9_0_compat_len = G_N_ELEMENTS(pc_rhel_9_0_compat); ++ ++GlobalProperty pc_rhel_8_5_compat[] = { ++ /* pc_rhel_8_5_compat from pc_compat_6_0 */ ++ { "qemu64" "-" TYPE_X86_CPU, "family", "6" }, ++ /* pc_rhel_8_5_compat from pc_compat_6_0 */ ++ { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, ++ /* pc_rhel_8_5_compat from pc_compat_6_0 */ ++ { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, ++ /* pc_rhel_8_5_compat from pc_compat_6_0 */ ++ { TYPE_X86_CPU, "x-vendor-cpuid-only", "off" }, ++ /* pc_rhel_8_5_compat from pc_compat_6_0 */ ++ { "ICH9-LPC", ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, "off" }, ++ ++ /* pc_rhel_8_5_compat from pc_compat_6_1 */ ++ { TYPE_X86_CPU, "hv-version-id-build", "0x1bbc" }, ++ /* pc_rhel_8_5_compat from pc_compat_6_1 */ ++ { TYPE_X86_CPU, "hv-version-id-major", "0x0006" }, ++ /* pc_rhel_8_5_compat from pc_compat_6_1 */ ++ { TYPE_X86_CPU, "hv-version-id-minor", "0x0001" }, ++}; ++const size_t pc_rhel_8_5_compat_len = G_N_ELEMENTS(pc_rhel_8_5_compat); ++ ++GlobalProperty pc_rhel_8_4_compat[] = { ++ /* pc_rhel_8_4_compat from pc_compat_5_2 */ ++ { "ICH9-LPC", "x-smi-cpu-hotunplug", "off" }, ++ { TYPE_X86_CPU, "kvm-asyncpf-int", "off" }, ++}; ++const size_t pc_rhel_8_4_compat_len = G_N_ELEMENTS(pc_rhel_8_4_compat); ++ ++GlobalProperty pc_rhel_8_3_compat[] = { ++ /* pc_rhel_8_3_compat from pc_compat_5_1 */ ++ { "ICH9-LPC", "x-smi-cpu-hotplug", "off" }, ++}; ++const size_t pc_rhel_8_3_compat_len = G_N_ELEMENTS(pc_rhel_8_3_compat); ++ ++GlobalProperty pc_rhel_8_2_compat[] = { ++ /* pc_rhel_8_2_compat from pc_compat_4_2 */ ++ { "mch", "smbase-smram", "off" }, ++}; ++const size_t pc_rhel_8_2_compat_len = G_N_ELEMENTS(pc_rhel_8_2_compat); ++ ++/* pc_rhel_8_1_compat is empty since pc_4_1_compat is */ ++GlobalProperty pc_rhel_8_1_compat[] = { }; ++const size_t pc_rhel_8_1_compat_len = G_N_ELEMENTS(pc_rhel_8_1_compat); ++ ++GlobalProperty pc_rhel_8_0_compat[] = { ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "intel-iommu", "dma-drain", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Opteron_G4" "-" TYPE_X86_CPU, "rdtscp", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Opteron_G4" "-" TYPE_X86_CPU, "npt", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Opteron_G4" "-" TYPE_X86_CPU, "nrip-save", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Opteron_G5" "-" TYPE_X86_CPU, "rdtscp", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Opteron_G5" "-" TYPE_X86_CPU, "npt", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Opteron_G5" "-" TYPE_X86_CPU, "nrip-save", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "EPYC" "-" TYPE_X86_CPU, "npt", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" }, ++ /** The mpx=on entries from pc_compat_3_1 are in pc_rhel_7_6_compat **/ ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { "Cascadelake-Server" "-" TYPE_X86_CPU, "stepping", "5" }, ++ /* pc_rhel_8_0_compat from pc_compat_3_1 */ ++ { TYPE_X86_CPU, "x-intel-pt-auto-level", "off" }, ++}; ++const size_t pc_rhel_8_0_compat_len = G_N_ELEMENTS(pc_rhel_8_0_compat); ++ ++/* Similar to PC_COMPAT_3_0 + PC_COMPAT_2_12, but: ++ * all of the 2_12 stuff was already in 7.6 from bz 1481253 ++ * x-migrate-smi-count comes from PC_COMPAT_2_11 but ++ * is really tied to kernel version so keep it off on 7.x ++ * machine types irrespective of host. ++ */ ++GlobalProperty pc_rhel_7_6_compat[] = { ++ /* pc_rhel_7_6_compat from pc_compat_3_0 */ ++ { TYPE_X86_CPU, "x-hv-synic-kvm-only", "on" }, ++ /* pc_rhel_7_6_compat from pc_compat_3_0 */ ++ { "Skylake-Server" "-" TYPE_X86_CPU, "pku", "off" }, ++ /* pc_rhel_7_6_compat from pc_compat_3_0 */ ++ { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "pku", "off" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { TYPE_X86_CPU, "x-migrate-smi-count", "off" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { "Cascadelake-Server" "-" TYPE_X86_CPU, "mpx", "on" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { "Icelake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, ++ /* pc_rhel_7_6_compat from pc_compat_2_11 */ ++ { "Icelake-Server" "-" TYPE_X86_CPU, "mpx", "on" }, ++}; ++const size_t pc_rhel_7_6_compat_len = G_N_ELEMENTS(pc_rhel_7_6_compat); ++ ++/* ++ * The PC_RHEL_*_COMPAT serve the same purpose for RHEL-7 machine ++ * types as the PC_COMPAT_* do for upstream types. ++ * PC_RHEL_7_*_COMPAT apply both to i440fx and q35 types. ++ */ ++ + GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled) + { + GSIState *s; +@@ -1767,6 +1930,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) + pcmc->kvmclock_create_always = true; + x86mc->apic_xrupt_override = true; + assert(!mc->get_hotplug_handler); ++ mc->async_pf_vmexit_disable = false; + mc->get_hotplug_handler = pc_get_hotplug_handler; + mc->hotplug_allowed = pc_hotplug_allowed; + mc->auto_enable_numa_with_memhp = true; +@@ -1774,7 +1938,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) + mc->has_hotpluggable_cpus = true; + mc->default_boot_order = "cad"; + mc->block_default_type = IF_IDE; +- mc->max_cpus = 255; ++ /* 240: max CPU count for RHEL */ ++ mc->max_cpus = 240; + mc->reset = pc_machine_reset; + mc->wakeup = pc_machine_wakeup; + hc->pre_plug = pc_machine_device_pre_plug_cb; +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index 67107b174a..c93e78e896 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -52,6 +52,7 @@ + #include "qapi/error.h" + #include "qemu/error-report.h" + #include "sysemu/xen.h" ++#include "migration/migration.h" + #ifdef CONFIG_XEN + #include + #include "hw/xen/xen_pt.h" +@@ -445,8 +446,8 @@ static void pc_i440fx_init(MachineState *machine) + pc_init1(machine, TYPE_I440FX_PCI_DEVICE); + } + +-#define DEFINE_I440FX_MACHINE(major, minor) \ +- DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor); ++#define DEFINE_I440FX_MACHINE(major, minor, micro) \ ++ DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor, micro); + + #if 0 /* Disabled for Red Hat Enterprise Linux */ + static void pc_i440fx_machine_options(MachineClass *m) +@@ -826,3 +827,103 @@ static void xenfv_machine_3_1_options(MachineClass *m) + DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init, + xenfv_machine_3_1_options); + #endif ++ ++/* Red Hat Enterprise Linux machine types */ ++ ++/* Options for the latest rhel7 machine type */ ++static void pc_machine_rhel7_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ m->family = "pc_piix_Y"; ++ m->default_machine_opts = "firmware=bios-256k.bin,hpet=off"; ++ pcmc->pci_root_uid = 0; ++ m->default_nic = "e1000"; ++ m->default_display = "std"; ++ m->no_parallel = 1; ++ m->numa_mem_supported = true; ++ m->auto_enable_numa_with_memdev = false; ++ machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); ++ compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len); ++ m->alias = "pc"; ++ m->is_default = 1; ++ m->smp_props.prefer_sockets = true; ++ pcmc->isa_bios_alias = false; ++} ++ ++static void pc_i440fx_rhel_machine_7_6_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ ObjectClass *oc = OBJECT_CLASS(m); ++ pc_machine_rhel7_options(m); ++ m->desc = "RHEL 7.6.0 PC (i440FX + PIIX, 1996)"; ++ m->async_pf_vmexit_disable = true; ++ m->smbus_no_migration_support = true; ++ ++ pcmc->pvh_enabled = false; ++ pcmc->default_cpu_version = CPU_VERSION_LEGACY; ++ pcmc->kvmclock_create_always = false; ++ /* From pc_i440fx_5_1_machine_options() */ ++ pcmc->pci_root_uid = 1; ++ /* From pc_i440fx_7_0_machine_options() */ ++ pcmc->enforce_amd_1tb_hole = false; ++ /* From pc_i440fx_8_0_machine_options() */ ++ pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32; ++ /* From pc_i440fx_8_1_machine_options() */ ++ pcmc->broken_32bit_mem_addr_check = true; ++ /* Introduced in QEMU 8.2 */ ++ pcmc->default_south_bridge = TYPE_PIIX3_DEVICE; ++ ++ object_class_property_add_enum(oc, "x-south-bridge", "PCSouthBridgeOption", ++ &PCSouthBridgeOption_lookup, ++ pc_get_south_bridge, ++ pc_set_south_bridge); ++ object_class_property_set_description(oc, "x-south-bridge", ++ "Use a different south bridge than PIIX3"); ++ ++ compat_props_add(m->compat_props, pc_rhel_9_5_compat, ++ pc_rhel_9_5_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_5, ++ hw_compat_rhel_9_5_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_4, ++ hw_compat_rhel_9_4_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_3, ++ hw_compat_rhel_9_3_len); ++ compat_props_add(m->compat_props, pc_rhel_9_3_compat, ++ pc_rhel_9_3_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_2, ++ hw_compat_rhel_9_2_len); ++ compat_props_add(m->compat_props, pc_rhel_9_2_compat, ++ pc_rhel_9_2_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_1, ++ hw_compat_rhel_9_1_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_0, ++ hw_compat_rhel_9_0_len); ++ compat_props_add(m->compat_props, pc_rhel_9_0_compat, ++ pc_rhel_9_0_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_8_6, ++ hw_compat_rhel_8_6_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_8_5, ++ hw_compat_rhel_8_5_len); ++ compat_props_add(m->compat_props, pc_rhel_8_5_compat, ++ pc_rhel_8_5_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_8_4, ++ hw_compat_rhel_8_4_len); ++ compat_props_add(m->compat_props, pc_rhel_8_4_compat, ++ pc_rhel_8_4_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_8_3, ++ hw_compat_rhel_8_3_len); ++ compat_props_add(m->compat_props, pc_rhel_8_3_compat, ++ pc_rhel_8_3_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_8_2, ++ hw_compat_rhel_8_2_len); ++ compat_props_add(m->compat_props, pc_rhel_8_2_compat, ++ pc_rhel_8_2_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len); ++ compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len); ++ compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); ++ compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len); ++} ++ ++DEFINE_I440FX_MACHINE(7, 6, 0); +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 5fb283f2df..76f0ac1acd 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -338,20 +338,19 @@ static void pc_q35_machine_options(MachineClass *m) + pcmc->pci_root_uid = 0; + pcmc->default_cpu_version = 1; + +- m->family = "pc_q35"; +- m->desc = "Standard PC (Q35 + ICH9, 2009)"; ++ m->family = "pc_q35_Z"; + m->units_per_default_bus = 1; +- m->default_machine_opts = "firmware=bios-256k.bin"; ++ m->default_machine_opts = "firmware=bios-256k.bin,hpet=off"; + m->default_display = "std"; + m->default_nic = "e1000e"; +- m->default_kernel_irqchip_split = false; + m->no_floppy = 1; +- m->max_cpus = 4096; +- m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); ++ m->max_cpus = 710; ++ m->no_parallel = 1; + machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); + machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); + machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); +- machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); ++ m->alias = "q35"; ++ compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len); + compat_props_add(m->compat_props, + pc_q35_compat_defaults, pc_q35_compat_defaults_len); + } +@@ -670,3 +669,197 @@ static void pc_q35_machine_2_4_options(MachineClass *m) + + DEFINE_Q35_MACHINE(2, 4); + #endif /* Disabled for Red Hat Enterprise Linux */ ++ ++/* Red Hat Enterprise Linux machine types */ ++ ++static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_machine_options(m); ++ m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; ++ pcmc->smbios_stream_product = "RHEL"; ++ pcmc->smbios_stream_version = "9.4.0"; ++ pcmc->isa_bios_alias = false; ++ ++ compat_props_add(m->compat_props, pc_rhel_9_5_compat, ++ pc_rhel_9_5_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_5, ++ hw_compat_rhel_9_5_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(9, 4, 0); ++ ++static void pc_q35_rhel_machine_9_2_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_9_4_0_options(m); ++ m->desc = "RHEL-9.2.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ pcmc->smbios_stream_product = "RHEL"; ++ pcmc->smbios_stream_version = "9.2.0"; ++ ++ /* From pc_q35_8_0_machine_options() */ ++ pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32; ++ /* From pc_q35_8_1_machine_options() */ ++ pcmc->broken_32bit_mem_addr_check = true; ++ ++ compat_props_add(m->compat_props, hw_compat_rhel_9_4, ++ hw_compat_rhel_9_4_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_3, ++ hw_compat_rhel_9_3_len); ++ compat_props_add(m->compat_props, pc_rhel_9_3_compat, ++ pc_rhel_9_3_compat_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_2, ++ hw_compat_rhel_9_2_len); ++ compat_props_add(m->compat_props, pc_rhel_9_2_compat, ++ pc_rhel_9_2_compat_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(9, 2, 0); ++ ++static void pc_q35_rhel_machine_9_0_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_9_2_0_options(m); ++ m->desc = "RHEL-9.0.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ pcmc->smbios_stream_product = "RHEL"; ++ pcmc->smbios_stream_version = "9.0.0"; ++ pcmc->enforce_amd_1tb_hole = false; ++ compat_props_add(m->compat_props, hw_compat_rhel_9_1, ++ hw_compat_rhel_9_1_len); ++ compat_props_add(m->compat_props, hw_compat_rhel_9_0, ++ hw_compat_rhel_9_0_len); ++ compat_props_add(m->compat_props, pc_rhel_9_0_compat, ++ pc_rhel_9_0_compat_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(9, 0, 0); ++ ++static void pc_q35_rhel_machine_8_6_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_9_0_0_options(m); ++ m->desc = "RHEL-8.6.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ ++ pcmc->smbios_stream_product = "RHEL-AV"; ++ pcmc->smbios_stream_version = "8.6.0"; ++ compat_props_add(m->compat_props, hw_compat_rhel_8_6, ++ hw_compat_rhel_8_6_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(8, 6, 0); ++ ++static void pc_q35_rhel_machine_8_5_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_8_6_0_options(m); ++ m->desc = "RHEL-8.5.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ pcmc->smbios_stream_product = "RHEL-AV"; ++ pcmc->smbios_stream_version = "8.5.0"; ++ compat_props_add(m->compat_props, hw_compat_rhel_8_5, ++ hw_compat_rhel_8_5_len); ++ compat_props_add(m->compat_props, pc_rhel_8_5_compat, ++ pc_rhel_8_5_compat_len); ++ m->smp_props.prefer_sockets = true; ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(8, 5, 0); ++ ++static void pc_q35_rhel_machine_8_4_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_8_5_0_options(m); ++ m->desc = "RHEL-8.4.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ pcmc->smbios_stream_product = "RHEL-AV"; ++ pcmc->smbios_stream_version = "8.4.0"; ++ compat_props_add(m->compat_props, hw_compat_rhel_8_4, ++ hw_compat_rhel_8_4_len); ++ compat_props_add(m->compat_props, pc_rhel_8_4_compat, ++ pc_rhel_8_4_compat_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(8, 4, 0); ++ ++static void pc_q35_rhel_machine_8_3_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_8_4_0_options(m); ++ m->desc = "RHEL-8.3.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ pcmc->smbios_stream_product = "RHEL-AV"; ++ pcmc->smbios_stream_version = "8.3.0"; ++ compat_props_add(m->compat_props, hw_compat_rhel_8_3, ++ hw_compat_rhel_8_3_len); ++ compat_props_add(m->compat_props, pc_rhel_8_3_compat, ++ pc_rhel_8_3_compat_len); ++ /* From pc_q35_5_1_machine_options() */ ++ pcmc->kvmclock_create_always = false; ++ /* From pc_q35_5_1_machine_options() */ ++ pcmc->pci_root_uid = 1; ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(8, 3, 0); ++ ++static void pc_q35_rhel_machine_8_2_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_8_3_0_options(m); ++ m->desc = "RHEL-8.2.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ m->numa_mem_supported = true; ++ m->auto_enable_numa_with_memdev = false; ++ pcmc->smbios_stream_product = "RHEL-AV"; ++ pcmc->smbios_stream_version = "8.2.0"; ++ compat_props_add(m->compat_props, hw_compat_rhel_8_2, ++ hw_compat_rhel_8_2_len); ++ compat_props_add(m->compat_props, pc_rhel_8_2_compat, ++ pc_rhel_8_2_compat_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(8, 2, 0); ++ ++static void pc_q35_rhel_machine_8_1_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_8_2_0_options(m); ++ m->desc = "RHEL-8.1.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; ++ pcmc->smbios_stream_product = NULL; ++ pcmc->smbios_stream_version = NULL; ++ compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len); ++ compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(8, 1, 0); ++ ++static void pc_q35_rhel_machine_8_0_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_8_1_0_options(m); ++ m->desc = "RHEL-8.0.0 PC (Q35 + ICH9, 2009)"; ++ m->smbus_no_migration_support = true; ++ m->alias = NULL; ++ pcmc->pvh_enabled = false; ++ pcmc->default_cpu_version = CPU_VERSION_LEGACY; ++ compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len); ++ compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(8, 0, 0); ++ ++static void pc_q35_rhel_machine_7_6_0_options(MachineClass *m) ++{ ++ pc_q35_rhel_machine_8_0_0_options(m); ++ m->alias = NULL; ++ m->desc = "RHEL-7.6.0 PC (Q35 + ICH9, 2009)"; ++ m->async_pf_vmexit_disable = true; ++ compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); ++ compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len); ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(7, 6, 0); ++ +diff --git a/include/hw/boards.h b/include/hw/boards.h +index 32c4642f5a..85b43e3d0d 100644 +--- a/include/hw/boards.h ++++ b/include/hw/boards.h +@@ -289,6 +289,8 @@ struct MachineClass { + strList *allowed_dynamic_sysbus_devices; + bool auto_enable_numa_with_memhp; + bool auto_enable_numa_with_memdev; ++ /* RHEL only */ ++ bool async_pf_vmexit_disable; + bool ignore_boot_device_suffixes; + bool smbus_no_migration_support; + bool nvdimm_supported; +diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h +index 8776a3c937..75c9271cdd 100644 +--- a/include/hw/i386/pc.h ++++ b/include/hw/i386/pc.h +@@ -302,6 +302,42 @@ extern const size_t pc_compat_2_4_len; + extern GlobalProperty pc_compat_2_3[]; + extern const size_t pc_compat_2_3_len; + ++extern GlobalProperty pc_rhel_compat[]; ++extern const size_t pc_rhel_compat_len; ++ ++extern GlobalProperty pc_rhel_9_5_compat[]; ++extern const size_t pc_rhel_9_5_compat_len; ++ ++extern GlobalProperty pc_rhel_9_3_compat[]; ++extern const size_t pc_rhel_9_3_compat_len; ++ ++extern GlobalProperty pc_rhel_9_2_compat[]; ++extern const size_t pc_rhel_9_2_compat_len; ++ ++extern GlobalProperty pc_rhel_9_0_compat[]; ++extern const size_t pc_rhel_9_0_compat_len; ++ ++extern GlobalProperty pc_rhel_8_5_compat[]; ++extern const size_t pc_rhel_8_5_compat_len; ++ ++extern GlobalProperty pc_rhel_8_4_compat[]; ++extern const size_t pc_rhel_8_4_compat_len; ++ ++extern GlobalProperty pc_rhel_8_3_compat[]; ++extern const size_t pc_rhel_8_3_compat_len; ++ ++extern GlobalProperty pc_rhel_8_2_compat[]; ++extern const size_t pc_rhel_8_2_compat_len; ++ ++extern GlobalProperty pc_rhel_8_1_compat[]; ++extern const size_t pc_rhel_8_1_compat_len; ++ ++extern GlobalProperty pc_rhel_8_0_compat[]; ++extern const size_t pc_rhel_8_0_compat_len; ++ ++extern GlobalProperty pc_rhel_7_6_compat[]; ++extern const size_t pc_rhel_7_6_compat_len; ++ + #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ + static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ + { \ +diff --git a/target/i386/cpu.c b/target/i386/cpu.c +index 85ef7452c0..ed278dd4a1 100644 +--- a/target/i386/cpu.c ++++ b/target/i386/cpu.c +@@ -2411,9 +2411,13 @@ static const CPUCaches epyc_genoa_cache_info = { + * PT in VMX operation + */ + ++#define RHEL_CPU_DEPRECATION \ ++ "use at least 'Nehalem' / 'Opteron_G4', or 'host' / 'max'" ++ + static const X86CPUDefinition builtin_x86_defs[] = { + { + .name = "qemu64", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 0xd, + .vendor = CPUID_VENDOR_AMD, + .family = 15, +@@ -2434,6 +2438,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "phenom", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 5, + .vendor = CPUID_VENDOR_AMD, + .family = 16, +@@ -2466,6 +2471,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "core2duo", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 10, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -2508,6 +2514,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "kvm64", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 0xd, + .vendor = CPUID_VENDOR_INTEL, + .family = 15, +@@ -2549,6 +2556,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "qemu32", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 4, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -2563,6 +2571,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "kvm32", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 5, + .vendor = CPUID_VENDOR_INTEL, + .family = 15, +@@ -2593,6 +2602,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "coreduo", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 10, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -2626,6 +2636,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "486", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 1, + .vendor = CPUID_VENDOR_INTEL, + .family = 4, +@@ -2638,6 +2649,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "pentium", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 1, + .vendor = CPUID_VENDOR_INTEL, + .family = 5, +@@ -2650,6 +2662,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "pentium2", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 2, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -2662,6 +2675,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "pentium3", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 3, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -2674,6 +2688,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "athlon", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 2, + .vendor = CPUID_VENDOR_AMD, + .family = 6, +@@ -2689,6 +2704,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "n270", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 10, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -2714,6 +2730,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "Conroe", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 10, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -2754,6 +2771,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "Penryn", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 10, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, +@@ -4762,6 +4780,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "Opteron_G1", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 5, + .vendor = CPUID_VENDOR_AMD, + .family = 15, +@@ -4782,6 +4801,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "Opteron_G2", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 5, + .vendor = CPUID_VENDOR_AMD, + .family = 15, +@@ -4804,6 +4824,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { + }, + { + .name = "Opteron_G3", ++ .deprecation_note = RHEL_CPU_DEPRECATION, + .level = 5, + .vendor = CPUID_VENDOR_AMD, + .family = 16, +diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c +index 6bf8dcfc60..684e731cbc 100644 +--- a/target/i386/kvm/kvm-cpu.c ++++ b/target/i386/kvm/kvm-cpu.c +@@ -178,6 +178,7 @@ static PropValue kvm_default_props[] = { + { "acpi", "off" }, + { "monitor", "off" }, + { "svm", "off" }, ++ { "kvm-pv-unhalt", "on" }, + { NULL, NULL }, + }; + +diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c +index 2fa88ef1e3..2b28c18693 100644 +--- a/target/i386/kvm/kvm.c ++++ b/target/i386/kvm/kvm.c +@@ -4244,6 +4244,7 @@ static int kvm_get_msrs(X86CPU *cpu) + struct kvm_msr_entry *msrs = cpu->kvm_msr_buf->entries; + int ret, i; + uint64_t mtrr_top_bits; ++ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); + + kvm_msr_buf_reset(cpu); + +@@ -4636,6 +4637,9 @@ static int kvm_get_msrs(X86CPU *cpu) + break; + case MSR_KVM_ASYNC_PF_EN: + env->async_pf_en_msr = msrs[i].data; ++ if (mc->async_pf_vmexit_disable) { ++ env->async_pf_en_msr &= ~(1ULL << 2); ++ } + break; + case MSR_KVM_ASYNC_PF_INT: + env->async_pf_int_msr = msrs[i].data; +diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c +index d49d2ba931..c18f63e255 100644 +--- a/tests/qtest/pvpanic-test.c ++++ b/tests/qtest/pvpanic-test.c +@@ -18,7 +18,7 @@ static void test_panic_nopause(void) + QDict *response, *data; + QTestState *qts; + +- qts = qtest_init("-device pvpanic -action panic=none"); ++ qts = qtest_init("-M q35 -device pvpanic -action panic=none"); + + val = qtest_inb(qts, 0x505); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); +@@ -41,7 +41,8 @@ static void test_panic(void) + QDict *response, *data; + QTestState *qts; + +- qts = qtest_init("-device pvpanic -action panic=pause"); ++ /* RHEL: Use q35 */ ++ qts = qtest_init("-M q35 -device pvpanic -action panic=pause"); + + val = qtest_inb(qts, 0x505); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch b/images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch new file mode 100644 index 000000000..e528ecf89 --- /dev/null +++ b/images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch @@ -0,0 +1,32 @@ +From 2698c3de00b8736553112a037c7ffb5f5d9086b1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 3 Jul 2024 13:47:04 +0100 +Subject: Revert "meson: temporarily disable -Wunused-function" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit c682111eaa73d9b985187b8be330338f50b78a7a. + +No longer needed after introduction of downstream machines. + +Signed-off-by: Daniel P. Berrangé +--- + meson.build | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 2de5ab024f..b3529aa0e1 100644 +--- a/meson.build ++++ b/meson.build +@@ -651,7 +651,6 @@ warn_flags = [ + '-Wno-string-plus-int', + '-Wno-tautological-type-limit-compare', + '-Wno-typedef-redefinition', +- '-Wno-unused-function', + ] + + if host_os != 'darwin' +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0016-Enable-make-check.patch b/images/qemu-artifact/patches/0016-Enable-make-check.patch new file mode 100644 index 000000000..0afff4ecf --- /dev/null +++ b/images/qemu-artifact/patches/0016-Enable-make-check.patch @@ -0,0 +1,280 @@ +From b877c7926d84e264bcfa57e6797f997d400fb19d Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Wed, 2 Sep 2020 09:39:41 +0200 +Subject: Enable make check + +Fixing tests after device disabling and machine types changes and enabling +make check run during build. + +Signed-off-by: Miroslav Rezanina +--- +Rebase changes (6.1.0): +- removed unnecessary test changes + +Rebase changes (6.2.0): +- new way of disabling bios-table-test + +Rebase changes (7.0.0): +- Disable testing virtio-iommu-pci +- Rename default_bus_bypass_iommu property to default-bus-bypass-iommu +- Disable qtest-bios-table for aarch64 +- Removed redhat chunks for boot-serial-test.c, cdrom-test.c and cpu-plug-test.c qtests +- Do not disable boot-order-test, prom-env-test and boot-serial-test qtests +- Use rhel machine type for new intel hda qtest +- Remove unnecessary changes in iotest 051 +- Remove changes in bios-tables-test.c and prom-env-test.c qtests + +Rebase changes (7.1.0): +- Disable bcm2835-dma-test (added upstream) + +Rebase changes (8.0.0): +- Removed chunks for disabling bios-table-test (protected upstream) +- Disable new qemu-iotests execution +- Revert change in tco qtest (blocking test run) + +Rebase changes (8.1.0): +- Do not disable device-plug-test for s390x + +Rebase changes (8.2.0 rc1): +- Remove unneeded hack in qtest/usb-hcd-xhci-test.c + +Rebase changes (9.1.0 rc0): +- use q35 for new pvpanic test + +Merged patches (6.1.0): +- 2f129df7d3 redhat: Enable the 'test-block-iothread' test again + +Merged patches (7.1.0): +- 64d736640e RHEL-only: tests/avocado: Switch aarch64 tests from a53 to a57 + +Merged patches (8.1.0): +- f468163234 iotests: Use alternative CPU type that is not deprecated in RHEL +--- + .distro/Makefile | 2 +- + .distro/qemu-kvm.spec.template | 4 ++-- + .distro/scripts/process-patches.sh | 3 +++ + tests/avocado/replay_kernel.py | 2 +- + tests/avocado/reverse_debugging.py | 2 +- + tests/avocado/tcg_plugins.py | 4 ++-- + tests/qemu-iotests/meson.build | 34 ++++++++++++++--------------- + tests/qemu-iotests/testenv.py | 3 +++ + tests/qtest/fuzz-e1000e-test.c | 2 +- + tests/qtest/fuzz-virtio-scsi-test.c | 2 +- + tests/qtest/intel-hda-test.c | 2 +- + tests/qtest/libqos/meson.build | 2 +- + tests/qtest/lpc-ich9-test.c | 2 +- + tests/qtest/meson.build | 1 - + tests/qtest/pvpanic-test.c | 2 +- + tests/qtest/virtio-net-failover.c | 1 + + 16 files changed, 37 insertions(+), 31 deletions(-) + +diff --git a/tests/avocado/replay_kernel.py b/tests/avocado/replay_kernel.py +index e22c200a36..cb7ca19b1b 100644 +--- a/tests/avocado/replay_kernel.py ++++ b/tests/avocado/replay_kernel.py +@@ -193,7 +193,7 @@ def test_aarch64_virt(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt +- :avocado: tags=cpu:cortex-a53 ++ :avocado: tags=cpu:cortex-a57 + """ + kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' + '/linux/releases/29/Everything/aarch64/os/images/pxeboot' +diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py +index f24287cd0a..3880b81df6 100644 +--- a/tests/avocado/reverse_debugging.py ++++ b/tests/avocado/reverse_debugging.py +@@ -228,7 +228,7 @@ def test_aarch64_virt(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt +- :avocado: tags=cpu:cortex-a53 ++ :avocado: tags=cpu:cortex-a57 + """ + kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' + '/linux/releases/29/Everything/aarch64/os/images/pxeboot' +diff --git a/tests/avocado/tcg_plugins.py b/tests/avocado/tcg_plugins.py +index a6ff457e27..5172ee9b9e 100644 +--- a/tests/avocado/tcg_plugins.py ++++ b/tests/avocado/tcg_plugins.py +@@ -66,7 +66,7 @@ def test_aarch64_virt_insn(self): + :avocado: tags=accel:tcg + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt +- :avocado: tags=cpu:cortex-a53 ++ :avocado: tags=cpu:cortex-a57 + """ + kernel_path = self._grab_aarch64_kernel() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + +@@ -96,7 +96,7 @@ def test_aarch64_virt_insn_icount(self): + :avocado: tags=accel:tcg + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt +- :avocado: tags=cpu:cortex-a53 ++ :avocado: tags=cpu:cortex-a57 + """ + kernel_path = self._grab_aarch64_kernel() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + +diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build +index fad340ad59..3c0d5241f6 100644 +--- a/tests/qemu-iotests/meson.build ++++ b/tests/qemu-iotests/meson.build +@@ -51,21 +51,21 @@ foreach format, speed: qemu_iotests_formats + check: true, + ) + +- foreach item: rc.stdout().strip().split() +- args = [qemu_iotests_check_cmd, +- '-tap', '-' + format, item, +- '--source-dir', meson.current_source_dir(), +- '--build-dir', meson.current_build_dir()] +- # Some individual tests take as long as 45 seconds +- # Bump the timeout to 3 minutes for some headroom +- # on slow machines to minimize spurious failures +- test('io-' + format + '-' + item, +- python, +- args: args, +- depends: qemu_iotests_binaries, +- env: qemu_iotests_env, +- protocol: 'tap', +- timeout: 180, +- suite: suites) +- endforeach ++# foreach item: rc.stdout().strip().split() ++# args = [qemu_iotests_check_cmd, ++# '-tap', '-' + format, item, ++# '--source-dir', meson.current_source_dir(), ++# '--build-dir', meson.current_build_dir()] ++# # Some individual tests take as long as 45 seconds ++# # Bump the timeout to 3 minutes for some headroom ++# # on slow machines to minimize spurious failures ++# test('io-' + format + '-' + item, ++# python, ++# args: args, ++# depends: qemu_iotests_binaries, ++# env: qemu_iotests_env, ++# protocol: 'tap', ++# timeout: 180, ++# suite: suites) ++# endforeach + endforeach +diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py +index c8848f2ec2..d515e5b8b0 100644 +--- a/tests/qemu-iotests/testenv.py ++++ b/tests/qemu-iotests/testenv.py +@@ -249,6 +249,9 @@ def __init__(self, source_dir: str, build_dir: str, + if self.qemu_prog.endswith(f'qemu-system-{suffix}'): + self.qemu_options += f' -machine {machine}' + ++ if self.qemu_prog.endswith('qemu-system-x86_64'): ++ self.qemu_options += ' -cpu Nehalem' ++ + # QEMU_DEFAULT_MACHINE + self.qemu_default_machine = get_default_machine(self.qemu_prog) + +diff --git a/tests/qtest/fuzz-e1000e-test.c b/tests/qtest/fuzz-e1000e-test.c +index 5052883fb6..b5286f4b12 100644 +--- a/tests/qtest/fuzz-e1000e-test.c ++++ b/tests/qtest/fuzz-e1000e-test.c +@@ -17,7 +17,7 @@ static void test_lp1879531_eth_get_rss_ex_dst_addr(void) + { + QTestState *s; + +- s = qtest_init("-nographic -monitor none -serial none -M pc-q35-5.0"); ++ s = qtest_init("-nographic -monitor none -serial none -M pc-q35-rhel8.4.0"); + + qtest_outl(s, 0xcf8, 0x80001010); + qtest_outl(s, 0xcfc, 0xe1020000); +diff --git a/tests/qtest/fuzz-virtio-scsi-test.c b/tests/qtest/fuzz-virtio-scsi-test.c +index e37b48b2cc..88647da054 100644 +--- a/tests/qtest/fuzz-virtio-scsi-test.c ++++ b/tests/qtest/fuzz-virtio-scsi-test.c +@@ -19,7 +19,7 @@ static void test_mmio_oob_from_memory_region_cache(void) + { + QTestState *s; + +- s = qtest_init("-M pc-q35-5.2 -m 512M " ++ s = qtest_init("-M pc-q35-rhel8.4.0 -m 512M " + "-device virtio-scsi,num_queues=8,addr=03.0 "); + + qtest_outl(s, 0xcf8, 0x80001811); +diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c +index 663bb6c485..2efc43e3f7 100644 +--- a/tests/qtest/intel-hda-test.c ++++ b/tests/qtest/intel-hda-test.c +@@ -42,7 +42,7 @@ static void test_issue542_ich6(void) + { + QTestState *s; + +- s = qtest_init("-nographic -nodefaults -M pc-q35-6.2 " ++ s = qtest_init("-nographic -nodefaults -M pc-q35-rhel9.0.0 " + AUDIODEV + "-device intel-hda,id=" HDA_ID CODEC_DEVICES); + +diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build +index 1b2b2dbb22..86afbddb58 100644 +--- a/tests/qtest/libqos/meson.build ++++ b/tests/qtest/libqos/meson.build +@@ -44,7 +44,7 @@ libqos_srcs = files( + 'virtio-rng.c', + 'virtio-scsi.c', + 'virtio-serial.c', +- 'virtio-iommu.c', ++# 'virtio-iommu.c', + 'virtio-gpio.c', + 'virtio-scmi.c', + 'generic-pcihost.c', +diff --git a/tests/qtest/lpc-ich9-test.c b/tests/qtest/lpc-ich9-test.c +index 8ac95b89f7..cd2102555c 100644 +--- a/tests/qtest/lpc-ich9-test.c ++++ b/tests/qtest/lpc-ich9-test.c +@@ -15,7 +15,7 @@ static void test_lp1878642_pci_bus_get_irq_level_assert(void) + { + QTestState *s; + +- s = qtest_init("-M pc-q35-5.0 " ++ s = qtest_init("-M pc-q35-rhel8.4.0 " + "-nographic -monitor none -serial none"); + + qtest_outl(s, 0xcf8, 0x8000f840); /* PMBASE */ +diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build +index 2f0d3ef080..44ee791508 100644 +--- a/tests/qtest/meson.build ++++ b/tests/qtest/meson.build +@@ -102,7 +102,6 @@ qtests_i386 = \ + 'drive_del-test', + 'tco-test', + 'cpu-plug-test', +- 'q35-test', + 'vmgenid-test', + 'migration-test', + 'test-x86-cpuid-compat', +diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c +index c18f63e255..57fb129ae4 100644 +--- a/tests/qtest/pvpanic-test.c ++++ b/tests/qtest/pvpanic-test.c +@@ -65,7 +65,7 @@ static void test_pvshutdown(void) + QDict *response, *data; + QTestState *qts; + +- qts = qtest_init("-device pvpanic"); ++ qts = qtest_init("-M q35 -device pvpanic"); + + val = qtest_inb(qts, 0x505); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); +diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c +index 73dfabc272..a9dd304781 100644 +--- a/tests/qtest/virtio-net-failover.c ++++ b/tests/qtest/virtio-net-failover.c +@@ -26,6 +26,7 @@ + #define PCI_SEL_BASE 0x0010 + + #define BASE_MACHINE "-M q35 -nodefaults " \ ++ "-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=on " \ + "-device pcie-root-port,id=root0,addr=0x1,bus=pcie.0,chassis=1 " \ + "-device pcie-root-port,id=root1,addr=0x2,bus=pcie.0,chassis=2 " + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch b/images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch new file mode 100644 index 000000000..b18c2bd3d --- /dev/null +++ b/images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch @@ -0,0 +1,110 @@ +From a30996377bd8b1316cd79ac482b4f9ae9a50c31d Mon Sep 17 00:00:00 2001 +From: Bandan Das +Date: Tue, 3 Dec 2013 20:05:13 +0100 +Subject: vfio: cap number of devices that can be assigned + +RH-Author: Bandan Das +Message-id: <1386101113-31560-3-git-send-email-bsd@redhat.com> +Patchwork-id: 55984 +O-Subject: [PATCH RHEL7 qemu-kvm v2 2/2] vfio: cap number of devices that can be assigned +Bugzilla: 678368 +RH-Acked-by: Alex Williamson +RH-Acked-by: Marcelo Tosatti +RH-Acked-by: Michael S. Tsirkin + +Go through all groups to get count of total number of devices +active to enforce limit + +Reasoning from Alex for the limit(32) - Assuming 3 slots per +device, with 125 slots (number of memory slots for RHEL 7), +we can support almost 40 devices and still have few slots left +for other uses. Stepping down a bit, the number 32 arbitrarily +matches the number of slots on a PCI bus and is also a nice power +of two. + +Count of slots increased to 509 later so we could increase limit +to 64 as some usecases require more than 32 devices. + +Signed-off-by: Bandan Das + +Rebase changes (8.2.0): +- Update to upstream changes +--- + hw/vfio/pci.c | 31 ++++++++++++++++++++++++++++++- + hw/vfio/pci.h | 1 + + 2 files changed, 31 insertions(+), 1 deletion(-) + +diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c +index 2407720c35..82a47edc89 100644 +--- a/hw/vfio/pci.c ++++ b/hw/vfio/pci.c +@@ -50,6 +50,9 @@ + /* Protected by BQL */ + static KVMRouteChange vfio_route_change; + ++/* RHEL only: Set once for the first assigned dev */ ++static uint16_t device_limit; ++ + static void vfio_disable_interrupts(VFIOPCIDevice *vdev); + static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled); + static void vfio_msi_disable_common(VFIOPCIDevice *vdev); +@@ -2963,10 +2966,33 @@ static void vfio_realize(PCIDevice *pdev, Error **errp) + ERRP_GUARD(); + VFIOPCIDevice *vdev = VFIO_PCI(pdev); + VFIODevice *vbasedev = &vdev->vbasedev; +- int i, ret; ++ int ret, i = 0; ++ VFIODevice *vbasedev_iter; ++ VFIOGroup *group; + char uuid[UUID_STR_LEN]; + g_autofree char *name = NULL; + ++ if (device_limit && device_limit != vdev->assigned_device_limit) { ++ error_setg(errp, "Assigned device limit has been redefined. " ++ "Old:%d, New:%d", ++ device_limit, vdev->assigned_device_limit); ++ return; ++ } else { ++ device_limit = vdev->assigned_device_limit; ++ } ++ ++ QLIST_FOREACH(group, &vfio_group_list, next) { ++ QLIST_FOREACH(vbasedev_iter, &group->device_list, next) { ++ i++; ++ } ++ } ++ ++ if (i >= vdev->assigned_device_limit) { ++ error_setg(errp, "Maximum supported vfio devices (%d) " ++ "already attached", vdev->assigned_device_limit); ++ return; ++ } ++ + if (vbasedev->fd < 0 && !vbasedev->sysfsdev) { + if (!(~vdev->host.domain || ~vdev->host.bus || + ~vdev->host.slot || ~vdev->host.function)) { +@@ -3388,6 +3414,9 @@ static Property vfio_pci_dev_properties[] = { + DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false), + DEFINE_PROP_BOOL("x-no-geforce-quirks", VFIOPCIDevice, + no_geforce_quirks, false), ++ /* RHEL only */ ++ DEFINE_PROP_UINT16("x-assigned-device-limit", VFIOPCIDevice, ++ assigned_device_limit, 64), + DEFINE_PROP_BOOL("x-no-kvm-ioeventfd", VFIOPCIDevice, no_kvm_ioeventfd, + false), + DEFINE_PROP_BOOL("x-no-vfio-ioeventfd", VFIOPCIDevice, no_vfio_ioeventfd, +diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h +index bf67df2fbc..0d3c93fb2e 100644 +--- a/hw/vfio/pci.h ++++ b/hw/vfio/pci.h +@@ -142,6 +142,7 @@ struct VFIOPCIDevice { + EventNotifier err_notifier; + EventNotifier req_notifier; + int (*resetfn)(struct VFIOPCIDevice *); ++ uint16_t assigned_device_limit; + uint32_t vendor_id; + uint32_t device_id; + uint32_t sub_vendor_id; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch b/images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch new file mode 100644 index 000000000..a3ef6f66c --- /dev/null +++ b/images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch @@ -0,0 +1,55 @@ +From d2a73465e69118a37a2bbc487b6faa30c9b5a81f Mon Sep 17 00:00:00 2001 +From: Eduardo Habkost +Date: Wed, 4 Dec 2013 18:53:17 +0100 +Subject: Add support statement to -help output + +RH-Author: Eduardo Habkost +Message-id: <1386183197-27761-1-git-send-email-ehabkost@redhat.com> +Patchwork-id: 55994 +O-Subject: [qemu-kvm RHEL7 PATCH] Add support statement to -help output +Bugzilla: 972773 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: knoel@redhat.com +RH-Acked-by: Paolo Bonzini + +Add support statement to -help output, reporting direct qemu-kvm usage +as unsupported by Red Hat, and advising users to use libvirt instead. + +Signed-off-by: Eduardo Habkost +--- + system/vl.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/system/vl.c b/system/vl.c +index 01b8b8e77a..5359231bf5 100644 +--- a/system/vl.c ++++ b/system/vl.c +@@ -877,9 +877,17 @@ static void version(void) + QEMU_COPYRIGHT "\n"); + } + ++static void print_rh_warning(void) ++{ ++ printf("\nWARNING: Direct use of qemu-kvm from the command line is not supported by Red Hat.\n" ++ "WARNING: Use libvirt as the stable management interface.\n" ++ "WARNING: Some command line options listed here may not be available in future releases.\n\n"); ++} ++ + static void help(int exitcode) + { + version(); ++ print_rh_warning(); + printf("usage: %s [options] [disk_image]\n\n" + "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n", + g_get_prgname()); +@@ -905,6 +913,7 @@ static void help(int exitcode) + "\n" + QEMU_HELP_BOTTOM "\n"); + ++ print_rh_warning(); + exit(exitcode); + } + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch b/images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch new file mode 100644 index 000000000..4eb7d299d --- /dev/null +++ b/images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch @@ -0,0 +1,61 @@ +From ca0507cfda11a73cb4311fc0b3a934ce8b40c5e9 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Wed, 8 Jul 2020 08:35:50 +0200 +Subject: Use qemu-kvm in documentation instead of qemu-system- + +Patchwork-id: 62380 +O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCHv4] Use qemu-kvm in documentation instead of qemu-system-i386 +Bugzilla: 1140620 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Markus Armbruster +RH-Acked-by: Stefan Hajnoczi + +From: Miroslav Rezanina + +We change the name and location of qemu-kvm binaries. Update documentation +to reflect this change. Only architectures available in RHEL are updated. + +Signed-off-by: Miroslav Rezanina +--- + docs/defs.rst.inc | 4 ++-- + qemu-options.hx | 10 +++++----- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/docs/defs.rst.inc b/docs/defs.rst.inc +index 52d6454b93..d74dbdeca9 100644 +--- a/docs/defs.rst.inc ++++ b/docs/defs.rst.inc +@@ -9,7 +9,7 @@ + but the manpages will end up misrendered with following normal text + incorrectly in boldface. + +-.. |qemu_system| replace:: qemu-system-x86_64 +-.. |qemu_system_x86| replace:: qemu-system-x86_64 ++.. |qemu_system| replace:: qemu-kvm ++.. |qemu_system_x86| replace:: qemu-kvm + .. |I2C| replace:: I\ :sup:`2`\ C + .. |I2S| replace:: I\ :sup:`2`\ S +diff --git a/qemu-options.hx b/qemu-options.hx +index d94e2cbbae..a7444abc7f 100644 +--- a/qemu-options.hx ++++ b/qemu-options.hx +@@ -3688,11 +3688,11 @@ SRST + + :: + +- qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ +- -numa node,memdev=mem \ +- -chardev socket,id=chr0,path=/path/to/socket \ +- -netdev type=vhost-user,id=net0,chardev=chr0 \ +- -device virtio-net-pci,netdev=net0 ++ qemu-kvm -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ ++ -numa node,memdev=mem \ ++ -chardev socket,id=chr0,path=/path/to/socket \ ++ -netdev type=vhost-user,id=net0,chardev=chr0 \ ++ -device virtio-net-pci,netdev=net0 + + ``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]`` + Establish a vhost-vdpa netdev. +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch b/images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch new file mode 100644 index 000000000..f1414a2d3 --- /dev/null +++ b/images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch @@ -0,0 +1,77 @@ +From 3fbdf1e92fe0dbabb59b611dfb3ad906edf80979 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Fri, 20 Aug 2021 18:25:12 +0200 +Subject: qcow2: Deprecation warning when opening v2 images rw +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Kevin Wolf +RH-MergeRequest: 37: qcow2: Deprecation warning when opening v2 images rw +RH-Commit: [1/1] f450d0ae32d35063b28c72c4f2d2ebb9e6d8db3e (kmwolf/centos-qemu-kvm) +RH-Bugzilla: 1951814 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Hanna Reitz +RH-Acked-by: Thomas Huth +RH-Acked-by: Philippe Mathieu-Daudé + +qcow2 v3 has been around for a long time (since QEMU 1.1/RHEL 7), so +there is no real reason any more to use it. People still using it might +do so unintentionally. Warn about it and suggest upgrading during the +RHEL 9 timeframe so that the code can possibly be disabled in RHEL 10. + +The warning is restricted to read-write mode and the system emulator. +The primary motivation for not having it in qemu-img is that 'qemu-img +amend' for upgrades would warn otherwise. It also avoids having to make +too many changes to the test suite. + +bdrv_uses_whitelist() is used as a proxy for deciding whether we are +running in a tool or the system emulator. This is not entirely clean, +but it's what is available and the same function qcow2_do_open() already +uses it this way for another warning. + +Signed-off-by: Kevin Wolf + +patch_name: kvm-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch +present_in_specfile: true +location_in_specfile: 116 +--- +Rebase notes (6.1.0): +- Replace bs->read_only with bdrv_is_read_only +--- + block/qcow2.c | 6 ++++++ + tests/qemu-iotests/common.filter | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/block/qcow2.c b/block/qcow2.c +index 70b19730a3..a4cffb628c 100644 +--- a/block/qcow2.c ++++ b/block/qcow2.c +@@ -1358,6 +1358,12 @@ qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, + ret = -ENOTSUP; + goto fail; + } ++ if (header.version < 3 && !bdrv_is_read_only(bs) && bdrv_uses_whitelist()) { ++ warn_report_once("qcow2 v2 images are deprecated and may not be " ++ "supported in future versions. Please consider " ++ "upgrading the image with 'qemu-img amend " ++ "-o compat=v3'."); ++ } + + s->qcow_version = header.version; + +diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter +index fc3c64bcb8..4b238954d5 100644 +--- a/tests/qemu-iotests/common.filter ++++ b/tests/qemu-iotests/common.filter +@@ -83,6 +83,7 @@ _filter_qemu() + { + gsed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \ + -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \ ++ -e "/qcow2 v2 images are deprecated/d" \ + -e $'s#\r##' # QEMU monitor uses \r\n line endings + } + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch b/images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch new file mode 100644 index 000000000..96578428f --- /dev/null +++ b/images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch @@ -0,0 +1,43 @@ +From 8c62f120efeedfcdc43fece9f65b4c1b5b0a06e6 Mon Sep 17 00:00:00 2001 +From: Dehan Meng +Date: Wed, 21 Aug 2024 14:55:01 +0800 +Subject: qemu-guest-agent: Update the logfile path of qga-fsfreeze-hook.log + +RH-Author: 6-dehan +RH-MergeRequest: 265: qemu-guest-agent: Update the logfile path of qga-fsfreeze-hook.log +RH-Jira: RHEL-52250 +RH-Acked-by: Konstantin Kostiuk +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 7c5cfb882dbc277becb7daa2c5d6b8eff3d601b2 (6-dehan/src_centosupstream_qemu-kvm) + +selinux context 'system_u:object_r:virt_qemu_ga_log_t:s0', it +should be changed to '/var/log/qemu-ga/qga-fsfreeze-hook.log'. And +it's worth to mention that this is RHEL-only change for matching +existing SELinux boolean and policy. + +Jira: https://issues.redhat.com/browse/RHEL-52250 +Signed-off-by: Dehan Meng + +Patch-name: kvm-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch +Patch-id: 137 +Patch-present-in-specfile: True +--- + scripts/qemu-guest-agent/fsfreeze-hook | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook +index e9b84ec028..70536ba3e3 100755 +--- a/scripts/qemu-guest-agent/fsfreeze-hook ++++ b/scripts/qemu-guest-agent/fsfreeze-hook +@@ -7,7 +7,7 @@ + # "freeze" argument before the filesystem is frozen. And for fsfreeze-thaw + # request, it is issued with "thaw" argument after filesystem is thawed. + +-LOGFILE=/var/log/qga-fsfreeze-hook.log ++LOGFILE=/var/log/qemu-ga/qga-fsfreeze-hook.log + FSFREEZE_D=$(dirname -- "$(realpath $0)")/fsfreeze-hook.d + + # Check whether file $1 is a backup or rpm-generated file and should be ignored +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch b/images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch new file mode 100644 index 000000000..8d7587458 --- /dev/null +++ b/images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch @@ -0,0 +1,109 @@ +From 2b6f52a948d4ee1bbaadec56151a6c30782693a2 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Wed, 15 May 2024 01:41:13 -0400 +Subject: Add upstream compatibility bits + +--- + hw/arm/virt.c | 1 + + hw/core/machine.c | 17 +++++++++++++++++ + hw/i386/pc_piix.c | 2 ++ + hw/i386/pc_q35.c | 2 ++ + hw/s390x/s390-virtio-ccw.c | 1 + + include/hw/boards.h | 3 +++ + 6 files changed, 26 insertions(+) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index 903c0f2e9f..3c776b5011 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -3582,6 +3582,7 @@ DEFINE_VIRT_MACHINE(2, 6) + + static void virt_rhel_machine_9_4_0_options(MachineClass *mc) + { ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); + compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); + } + DEFINE_VIRT_MACHINE_AS_LATEST(9, 4, 0) +diff --git a/hw/core/machine.c b/hw/core/machine.c +index f7fed78e4b..add42660f8 100644 +--- a/hw/core/machine.c ++++ b/hw/core/machine.c +@@ -311,6 +311,23 @@ const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); + const char *rhel_old_machine_deprecation = + "machine types for previous major releases are deprecated"; + ++GlobalProperty hw_compat_rhel_9_6[] = { ++ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ ++ {"arm-cpu", "backcompat-cntfrq", "true" }, ++ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ ++ { "scsi-hd", "migrate-emulated-scsi-request", "false" }, ++ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ ++ { "scsi-cd", "migrate-emulated-scsi-request", "false" }, ++ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ ++ {"vfio-pci", "skip-vsc-check", "false" }, ++ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ ++ { "virtio-pci", "x-pcie-pm-no-soft-reset", "off" }, ++ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ ++ {"sd-card", "spec_version", "2" }, ++}; ++const size_t hw_compat_rhel_9_6_len = G_N_ELEMENTS(hw_compat_rhel_9_6); ++ ++ + GlobalProperty hw_compat_rhel_9_5[] = { + /* hw_compat_rhel_9_5 from hw_compat_8_2 */ + { "migration", "zero-page-detection", "legacy"}, +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index c93e78e896..80323cc08c 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -880,6 +880,8 @@ static void pc_i440fx_rhel_machine_7_6_0_options(MachineClass *m) + object_class_property_set_description(oc, "x-south-bridge", + "Use a different south bridge than PIIX3"); + ++ compat_props_add(m->compat_props, hw_compat_rhel_9_6, ++ hw_compat_rhel_9_6_len); + compat_props_add(m->compat_props, pc_rhel_9_5_compat, + pc_rhel_9_5_compat_len); + compat_props_add(m->compat_props, hw_compat_rhel_9_5, +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 76f0ac1acd..4580b2266e 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -681,6 +681,8 @@ static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) + pcmc->smbios_stream_version = "9.4.0"; + pcmc->isa_bios_alias = false; + ++ compat_props_add(m->compat_props, hw_compat_rhel_9_6, ++ hw_compat_rhel_9_6_len); + compat_props_add(m->compat_props, pc_rhel_9_5_compat, + pc_rhel_9_5_compat_len); + compat_props_add(m->compat_props, hw_compat_rhel_9_5, +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index 72e1279db9..f884528639 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -1314,6 +1314,7 @@ static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) + + static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) + { ++ compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); + compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); + } + DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); +diff --git a/include/hw/boards.h b/include/hw/boards.h +index 85b43e3d0d..ffefc0a625 100644 +--- a/include/hw/boards.h ++++ b/include/hw/boards.h +@@ -802,6 +802,9 @@ extern const size_t hw_compat_2_2_len; + extern GlobalProperty hw_compat_2_1[]; + extern const size_t hw_compat_2_1_len; + ++extern GlobalProperty hw_compat_rhel_9_6[]; ++extern const size_t hw_compat_rhel_9_6_len; ++ + extern GlobalProperty hw_compat_rhel_9_5[]; + extern const size_t hw_compat_rhel_9_5_len; + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch b/images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch new file mode 100644 index 000000000..1f2c7961e --- /dev/null +++ b/images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch @@ -0,0 +1,37 @@ +From 492900c0b6a99f157249c2706c2f2ef5f67d20df Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Mon, 26 Aug 2024 14:27:49 +0200 +Subject: redhat: Add QEMU 9.1 compat handling to the s390x machine types + +JIRA: https://issues.redhat.com/browse/RHEL-52323 + +Upstream changed the amount of information that is migrated for +the S390 interrupt controller (FLIC), so we have to switch on +a compatibility property for older machine types. + +Signed-off-by: Thomas Huth +--- + hw/s390x/s390-virtio-ccw.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index f884528639..4b7290f7a8 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -1314,8 +1314,13 @@ static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) + + static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) + { ++ static GlobalProperty compat[] = { ++ { TYPE_QEMU_S390_FLIC, "migrate-all-state", "off", }, ++ }; ++ + compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); + compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); ++ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); + } + DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch b/images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch new file mode 100644 index 000000000..abaa414c3 --- /dev/null +++ b/images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch @@ -0,0 +1,55 @@ +From 1ceaf6413ec7cb19ea2b6147ec91c776c7c5df40 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Mon, 26 Aug 2024 14:42:24 +0200 +Subject: redhat: Add rhel9.6.0 machine type + +JIRA: https://issues.redhat.com/browse/RHEL-52323 + +Add a new machine type to enable the latest features by default. + +Signed-off-by: Thomas Huth +--- + hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index 4b7290f7a8..a4a6ffa053 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -1308,8 +1308,18 @@ DEFINE_CCW_MACHINE(2, 4); + #endif + #endif /* disabled for RHEL */ + ++static void ccw_rhel_machine_9_6_0_instance_options(MachineState *machine) ++{ ++} ++ ++static void ccw_rhel_machine_9_6_0_class_options(MachineClass *mc) ++{ ++} ++DEFINE_CCW_MACHINE_AS_LATEST(9, 6, 0); ++ + static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) + { ++ ccw_rhel_machine_9_6_0_instance_options(machine); + } + + static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) +@@ -1318,11 +1328,13 @@ static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) + { TYPE_QEMU_S390_FLIC, "migrate-all-state", "off", }, + }; + ++ ccw_rhel_machine_9_6_0_class_options(mc); ++ + compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); + compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); + compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); + } +-DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); ++DEFINE_CCW_MACHINE(9, 4, 0); + + static void ccw_rhel_machine_9_2_0_instance_options(MachineState *machine) + { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch b/images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch new file mode 100644 index 000000000..e6f14b89b --- /dev/null +++ b/images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch @@ -0,0 +1,43 @@ +From f35f400c9255be5fbb0158c6885a96ef23e7fb86 Mon Sep 17 00:00:00 2001 +From: Sebastian Ott +Date: Thu, 5 Sep 2024 12:54:34 +0200 +Subject: x86: ensure compatibility of pc-q35-rhel9* and pc-i440fx-rhel7.6.0 + +Signed-off-by: Sebastian Ott +--- + hw/i386/pc_piix.c | 3 +++ + hw/i386/pc_q35.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index 80323cc08c..656abb5d39 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -872,6 +872,9 @@ static void pc_i440fx_rhel_machine_7_6_0_options(MachineClass *m) + pcmc->broken_32bit_mem_addr_check = true; + /* Introduced in QEMU 8.2 */ + pcmc->default_south_bridge = TYPE_PIIX3_DEVICE; ++ /* From pc_i440fx_machine_9_0_options() */ ++ m->smbios_memory_device_size = 16 * GiB; ++ pcmc->isa_bios_alias = false; + + object_class_property_add_enum(oc, "x-south-bridge", "PCSouthBridgeOption", + &PCSouthBridgeOption_lookup, +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 4580b2266e..5cfed8b62f 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -679,7 +679,10 @@ static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) + m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; + pcmc->smbios_stream_product = "RHEL"; + pcmc->smbios_stream_version = "9.4.0"; ++ ++ /* From pc_q35_machine_9_0_options() */ + pcmc->isa_bios_alias = false; ++ m->smbios_memory_device_size = 16 * GiB; + + compat_props_add(m->compat_props, hw_compat_rhel_9_6, + hw_compat_rhel_9_6_len); +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch b/images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch new file mode 100644 index 000000000..2e09fa2a8 --- /dev/null +++ b/images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch @@ -0,0 +1,27 @@ +From 9c65a3e2e15c96b3b74d7c7846dbd60b13474370 Mon Sep 17 00:00:00 2001 +From: Sebastian Ott +Date: Thu, 5 Sep 2024 13:02:32 +0200 +Subject: arm: ensure compatibility of virt-rhel9* + +Signed-off-by: Sebastian Ott +--- + hw/arm/virt.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index 3c776b5011..1af1c9e170 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -3582,6 +3582,9 @@ DEFINE_VIRT_MACHINE(2, 6) + + static void virt_rhel_machine_9_4_0_options(MachineClass *mc) + { ++ /* From virt_machine_9_0_options() */ ++ mc->smbios_memory_device_size = 16 * GiB; ++ + compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); + compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); + } +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch b/images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch new file mode 100644 index 000000000..ff63e0ada --- /dev/null +++ b/images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch @@ -0,0 +1,41 @@ +From 005be8f390c038ab9674103e1644dc1549c434a9 Mon Sep 17 00:00:00 2001 +From: Sebastian Ott +Date: Thu, 5 Sep 2024 13:11:23 +0200 +Subject: arm: create new virt machine type for rhel 9.6 + +Signed-off-by: Sebastian Ott +--- + hw/arm/virt.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index 1af1c9e170..bf05499a12 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -3580,15 +3580,22 @@ static void virt_machine_2_6_options(MachineClass *mc) + DEFINE_VIRT_MACHINE(2, 6) + #endif /* disabled for RHEL */ + ++static void virt_rhel_machine_9_6_0_options(MachineClass *mc) ++{ ++} ++DEFINE_VIRT_MACHINE_AS_LATEST(9, 6, 0) ++ + static void virt_rhel_machine_9_4_0_options(MachineClass *mc) + { ++ virt_rhel_machine_9_6_0_options(mc); ++ + /* From virt_machine_9_0_options() */ + mc->smbios_memory_device_size = 16 * GiB; + + compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); + compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); + } +-DEFINE_VIRT_MACHINE_AS_LATEST(9, 4, 0) ++DEFINE_VIRT_MACHINE(9, 4, 0) + + static void virt_rhel_machine_9_2_0_options(MachineClass *mc) + { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch b/images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch new file mode 100644 index 000000000..e118d8eef --- /dev/null +++ b/images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch @@ -0,0 +1,42 @@ +From 826f14b90a0ad2427e4e80232c0fbaea80600650 Mon Sep 17 00:00:00 2001 +From: Sebastian Ott +Date: Thu, 5 Sep 2024 13:31:12 +0200 +Subject: x86: create new pc-q35 machine type for rhel 9.6 + +Signed-off-by: Sebastian Ott +--- + hw/i386/pc_q35.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 5cfed8b62f..7606007bda 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -672,11 +672,23 @@ DEFINE_Q35_MACHINE(2, 4); + + /* Red Hat Enterprise Linux machine types */ + +-static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) ++static void pc_q35_rhel_machine_9_6_0_options(MachineClass *m) + { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + pc_q35_machine_options(m); ++ m->desc = "RHEL-9.6.0 PC (Q35 + ICH9, 2009)"; ++ pcmc->smbios_stream_product = "RHEL"; ++ pcmc->smbios_stream_version = "9.6.0"; ++} ++ ++DEFINE_Q35_MACHINE_BUGFIX(9, 6, 0); ++ ++static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) ++{ ++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); ++ pc_q35_rhel_machine_9_6_0_options(m); + m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; ++ m->alias = NULL; + pcmc->smbios_stream_product = "RHEL"; + pcmc->smbios_stream_version = "9.4.0"; + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch b/images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch new file mode 100644 index 000000000..141944575 --- /dev/null +++ b/images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch @@ -0,0 +1,90 @@ +From d6a415e7a62ca1bc21f1833f4251f512b2072a93 Mon Sep 17 00:00:00 2001 +From: Shaoqin Huang +Date: Wed, 22 May 2024 03:23:28 -0400 +Subject: hw/arm/virt: Fix Manufacturer and Product Name in emulated SMBIOS + mode + +Status: RHEL-only + +In vm, when run 'dmidecode -t system', it outputs different Manufacturer +and Product Name on x86_64 and aarch64 system. For example: + +For aarch64 vm: + Manufacturer: QEMU + Product Name: KVM Virtual Machine + +For x86_64 vm: + Manufacturer: Red Hat + Product Name: KVM + +Fixing this issue by changing Manufacturer to 'Red Hat' and Product +Name to 'KVM' on aarch64 platform. Thus the output is aligned on both +x86_64 and aarch64 platform. + +To keep the compatability, this only apply for the RHEL9.6 machine +type. For RHEL9.4 machine type, it still keep the old Manufacturer and +Product Name. + +Signed-off-by: Shaoqin Huang +--- + hw/arm/virt.c | 14 ++++++++++++-- + include/hw/arm/virt.h | 1 + + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index bf05499a12..c50bff2a6c 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -1711,14 +1711,21 @@ static void virt_build_smbios(VirtMachineState *vms) + uint8_t *smbios_tables, *smbios_anchor; + size_t smbios_tables_len, smbios_anchor_len; + struct smbios_phys_mem_area mem_array; ++ const char *manufacturer = "QEMU"; + const char *product = "QEMU Virtual Machine"; ++ const char *version = vmc->smbios_old_sys_ver ? "1.0" : mc->name; + + if (kvm_enabled()) { + product = "KVM Virtual Machine"; + } + +- smbios_set_defaults("QEMU", product, +- vmc->smbios_old_sys_ver ? "1.0" : mc->name, ++ if (!vmc->manufacturer_product_compat) { ++ manufacturer = "Red Hat"; ++ product = "KVM"; ++ version = mc->desc; ++ } ++ ++ smbios_set_defaults(manufacturer, product, version, + NULL, NULL); + + /* build the array of physical mem area from base_memmap */ +@@ -3587,10 +3594,13 @@ DEFINE_VIRT_MACHINE_AS_LATEST(9, 6, 0) + + static void virt_rhel_machine_9_4_0_options(MachineClass *mc) + { ++ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); ++ + virt_rhel_machine_9_6_0_options(mc); + + /* From virt_machine_9_0_options() */ + mc->smbios_memory_device_size = 16 * GiB; ++ vmc->manufacturer_product_compat = true; + + compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); + compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); +diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h +index a4d937ed45..2fc30a7626 100644 +--- a/include/hw/arm/virt.h ++++ b/include/hw/arm/virt.h +@@ -134,6 +134,7 @@ struct VirtMachineClass { + bool no_cpu_topology; + bool no_tcg_lpa2; + bool no_ns_el2_virt_timer_irq; ++ bool manufacturer_product_compat; + }; + + struct VirtMachineState { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch b/images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch new file mode 100644 index 000000000..2670a2317 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch @@ -0,0 +1,49 @@ +From f9dfed0e5fd03ee6fa7364801db7d101bf085a79 Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Tue, 17 Sep 2024 12:38:33 -0400 +Subject: [PATCH 6/9] KVM: Define KVM_MEMSLOTS_NUM_MAX_DEFAULT + +RH-Author: Peter Xu +RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array +RH-Jira: RHEL-57682 +RH-Acked-by: Juraj Marcin +RH-Commit: [5/7] c95bdaa406e76b943882fd75c4d345ca5fc397d4 (peterx/qemu-kvm) + +Make the default max nr_slots a macro, it's only used when KVM reports +nothing. + +Reviewed-by: David Hildenbrand +Signed-off-by: Peter Xu +Link: https://lore.kernel.org/r/20240917163835.194664-3-peterx@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit b34a908c8f24eedb0a8e5ff486b059b58fd793f4) +Signed-off-by: Peter Xu +--- + accel/kvm/kvm-all.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index 44bf4180fa..3900de8883 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -71,6 +71,8 @@ + + /* Default num of memslots to be allocated when VM starts */ + #define KVM_MEMSLOTS_NR_ALLOC_DEFAULT 16 ++/* Default max allowed memslots if kernel reported nothing */ ++#define KVM_MEMSLOTS_NR_MAX_DEFAULT 32 + + struct KVMParkedVcpu { + unsigned long vcpu_id; +@@ -2617,7 +2619,7 @@ static int kvm_init(MachineState *ms) + + /* If unspecified, use the default value */ + if (!s->nr_slots) { +- s->nr_slots = 32; ++ s->nr_slots_max = KVM_MEMSLOTS_NR_MAX_DEFAULT; + } + + s->nr_as = kvm_check_extension(s, KVM_CAP_MULTI_ADDRESS_SPACE); +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch b/images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch new file mode 100644 index 000000000..f3f052261 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch @@ -0,0 +1,250 @@ +From 9813dc1d19a6afedbab382b79e72691190e42fcf Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Tue, 17 Sep 2024 12:38:32 -0400 +Subject: [PATCH 5/9] KVM: Dynamic sized kvm memslots array + +RH-Author: Peter Xu +RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array +RH-Jira: RHEL-57682 +RH-Acked-by: Juraj Marcin +RH-Commit: [4/7] 04d74707873b28a50b1e1bc08e4788c79455518c (peterx/qemu-kvm) + +Zhiyi reported an infinite loop issue in VFIO use case. The cause of that +was a separate discussion, however during that I found a regression of +dirty sync slowness when profiling. + +Each KVMMemoryListerner maintains an array of kvm memslots. Currently it's +statically allocated to be the max supported by the kernel. However after +Linux commit 4fc096a99e ("KVM: Raise the maximum number of user memslots"), +the max supported memslots reported now grows to some number large enough +so that it may not be wise to always statically allocate with the max +reported. + +What's worse, QEMU kvm code still walks all the allocated memslots entries +to do any form of lookups. It can drastically slow down all memslot +operations because each of such loop can run over 32K times on the new +kernels. + +Fix this issue by making the memslots to be allocated dynamically. + +Here the initial size was set to 16 because it should cover the basic VM +usages, so that the hope is the majority VM use case may not even need to +grow at all (e.g. if one starts a VM with ./qemu-system-x86_64 by default +it'll consume 9 memslots), however not too large to waste memory. + +There can also be even better way to address this, but so far this is the +simplest and should be already better even than before we grow the max +supported memslots. For example, in the case of above issue when VFIO was +attached on a 32GB system, there are only ~10 memslots used. So it could +be good enough as of now. + +In the above VFIO context, measurement shows that the precopy dirty sync +shrinked from ~86ms to ~3ms after this patch applied. It should also apply +to any KVM enabled VM even without VFIO. + +NOTE: we don't have a FIXES tag for this patch because there's no real +commit that regressed this in QEMU. Such behavior existed for a long time, +but only start to be a problem when the kernel reports very large +nr_slots_max value. However that's pretty common now (the kernel change +was merged in 2021) so we attached cc:stable because we'll want this change +to be backported to stable branches. + +Cc: qemu-stable +Reported-by: Zhiyi Guo +Tested-by: Zhiyi Guo +Signed-off-by: Peter Xu +Acked-by: David Hildenbrand +Reviewed-by: Fabiano Rosas +Link: https://lore.kernel.org/r/20240917163835.194664-2-peterx@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit 5504a8126115d173687b37e657312a8ffe29fc0c) +Signed-off-by: Peter Xu +--- + accel/kvm/kvm-all.c | 87 +++++++++++++++++++++++++++++++++------- + accel/kvm/trace-events | 1 + + include/sysemu/kvm_int.h | 1 + + 3 files changed, 74 insertions(+), 15 deletions(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index de709fbc43..44bf4180fa 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -69,6 +69,9 @@ + #define KVM_GUESTDBG_BLOCKIRQ 0 + #endif + ++/* Default num of memslots to be allocated when VM starts */ ++#define KVM_MEMSLOTS_NR_ALLOC_DEFAULT 16 ++ + struct KVMParkedVcpu { + unsigned long vcpu_id; + int kvm_fd; +@@ -165,6 +168,57 @@ void kvm_resample_fd_notify(int gsi) + } + } + ++/** ++ * kvm_slots_grow(): Grow the slots[] array in the KVMMemoryListener ++ * ++ * @kml: The KVMMemoryListener* to grow the slots[] array ++ * @nr_slots_new: The new size of slots[] array ++ * ++ * Returns: True if the array grows larger, false otherwise. ++ */ ++static bool kvm_slots_grow(KVMMemoryListener *kml, unsigned int nr_slots_new) ++{ ++ unsigned int i, cur = kml->nr_slots_allocated; ++ KVMSlot *slots; ++ ++ if (nr_slots_new > kvm_state->nr_slots) { ++ nr_slots_new = kvm_state->nr_slots; ++ } ++ ++ if (cur >= nr_slots_new) { ++ /* Big enough, no need to grow, or we reached max */ ++ return false; ++ } ++ ++ if (cur == 0) { ++ slots = g_new0(KVMSlot, nr_slots_new); ++ } else { ++ assert(kml->slots); ++ slots = g_renew(KVMSlot, kml->slots, nr_slots_new); ++ /* ++ * g_renew() doesn't initialize extended buffers, however kvm ++ * memslots require fields to be zero-initialized. E.g. pointers, ++ * memory_size field, etc. ++ */ ++ memset(&slots[cur], 0x0, sizeof(slots[0]) * (nr_slots_new - cur)); ++ } ++ ++ for (i = cur; i < nr_slots_new; i++) { ++ slots[i].slot = i; ++ } ++ ++ kml->slots = slots; ++ kml->nr_slots_allocated = nr_slots_new; ++ trace_kvm_slots_grow(cur, nr_slots_new); ++ ++ return true; ++} ++ ++static bool kvm_slots_double(KVMMemoryListener *kml) ++{ ++ return kvm_slots_grow(kml, kml->nr_slots_allocated * 2); ++} ++ + unsigned int kvm_get_max_memslots(void) + { + KVMState *s = KVM_STATE(current_accel()); +@@ -193,15 +247,26 @@ unsigned int kvm_get_free_memslots(void) + /* Called with KVMMemoryListener.slots_lock held */ + static KVMSlot *kvm_get_free_slot(KVMMemoryListener *kml) + { +- KVMState *s = kvm_state; ++ unsigned int n; + int i; + +- for (i = 0; i < s->nr_slots; i++) { ++ for (i = 0; i < kml->nr_slots_allocated; i++) { + if (kml->slots[i].memory_size == 0) { + return &kml->slots[i]; + } + } + ++ /* ++ * If no free slots, try to grow first by doubling. Cache the old size ++ * here to avoid another round of search: if the grow succeeded, it ++ * means slots[] now must have the existing "n" slots occupied, ++ * followed by one or more free slots starting from slots[n]. ++ */ ++ n = kml->nr_slots_allocated; ++ if (kvm_slots_double(kml)) { ++ return &kml->slots[n]; ++ } ++ + return NULL; + } + +@@ -222,10 +287,9 @@ static KVMSlot *kvm_lookup_matching_slot(KVMMemoryListener *kml, + hwaddr start_addr, + hwaddr size) + { +- KVMState *s = kvm_state; + int i; + +- for (i = 0; i < s->nr_slots; i++) { ++ for (i = 0; i < kml->nr_slots_allocated; i++) { + KVMSlot *mem = &kml->slots[i]; + + if (start_addr == mem->start_addr && size == mem->memory_size) { +@@ -267,7 +331,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram, + int i, ret = 0; + + kvm_slots_lock(); +- for (i = 0; i < s->nr_slots; i++) { ++ for (i = 0; i < kml->nr_slots_allocated; i++) { + KVMSlot *mem = &kml->slots[i]; + + if (ram >= mem->ram && ram < mem->ram + mem->memory_size) { +@@ -1071,7 +1135,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml, + + kvm_slots_lock(); + +- for (i = 0; i < s->nr_slots; i++) { ++ for (i = 0; i < kml->nr_slots_allocated; i++) { + mem = &kml->slots[i]; + /* Discard slots that are empty or do not overlap the section */ + if (!mem->memory_size || +@@ -1719,12 +1783,8 @@ static void kvm_log_sync_global(MemoryListener *l, bool last_stage) + /* Flush all kernel dirty addresses into KVMSlot dirty bitmap */ + kvm_dirty_ring_flush(); + +- /* +- * TODO: make this faster when nr_slots is big while there are +- * only a few used slots (small VMs). +- */ + kvm_slots_lock(); +- for (i = 0; i < s->nr_slots; i++) { ++ for (i = 0; i < kml->nr_slots_allocated; i++) { + mem = &kml->slots[i]; + if (mem->memory_size && mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { + kvm_slot_sync_dirty_pages(mem); +@@ -1839,12 +1899,9 @@ void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml, + { + int i; + +- kml->slots = g_new0(KVMSlot, s->nr_slots); + kml->as_id = as_id; + +- for (i = 0; i < s->nr_slots; i++) { +- kml->slots[i].slot = i; +- } ++ kvm_slots_grow(kml, KVM_MEMSLOTS_NR_ALLOC_DEFAULT); + + QSIMPLEQ_INIT(&kml->transaction_add); + QSIMPLEQ_INIT(&kml->transaction_del); +diff --git a/accel/kvm/trace-events b/accel/kvm/trace-events +index 37626c1ac5..ad2ae6fca5 100644 +--- a/accel/kvm/trace-events ++++ b/accel/kvm/trace-events +@@ -36,3 +36,4 @@ kvm_io_window_exit(void) "" + kvm_run_exit_system_event(int cpu_index, uint32_t event_type) "cpu_index %d, system_even_type %"PRIu32 + kvm_convert_memory(uint64_t start, uint64_t size, const char *msg) "start 0x%" PRIx64 " size 0x%" PRIx64 " %s" + kvm_memory_fault(uint64_t start, uint64_t size, uint64_t flags) "start 0x%" PRIx64 " size 0x%" PRIx64 " flags 0x%" PRIx64 ++kvm_slots_grow(unsigned int old, unsigned int new) "%u -> %u" +diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h +index 1d8fb1473b..48e496b3d4 100644 +--- a/include/sysemu/kvm_int.h ++++ b/include/sysemu/kvm_int.h +@@ -46,6 +46,7 @@ typedef struct KVMMemoryListener { + MemoryListener listener; + KVMSlot *slots; + unsigned int nr_used_slots; ++ unsigned int nr_slots_allocated; + int as_id; + QSIMPLEQ_HEAD(, KVMMemoryUpdate) transaction_add; + QSIMPLEQ_HEAD(, KVMMemoryUpdate) transaction_del; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch b/images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch new file mode 100644 index 000000000..299831829 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch @@ -0,0 +1,72 @@ +From 6c0a0d9734c507af2c84aa33eb1624f35e1f51fb Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Tue, 17 Sep 2024 12:38:34 -0400 +Subject: [PATCH 7/9] KVM: Rename KVMMemoryListener.nr_used_slots to + nr_slots_used + +RH-Author: Peter Xu +RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array +RH-Jira: RHEL-57682 +RH-Acked-by: Juraj Marcin +RH-Commit: [6/7] 74e9576751e0adeb8113a5e8e495b4b1285b0d76 (peterx/qemu-kvm) + +This will make all nr_slots counters to be named in the same manner. + +Reviewed-by: David Hildenbrand +Signed-off-by: Peter Xu +Link: https://lore.kernel.org/r/20240917163835.194664-4-peterx@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit dbdc00ba5b136bba80d850f61cc79a9cafaae1cd) +Signed-off-by: Peter Xu +--- + accel/kvm/kvm-all.c | 6 +++--- + include/sysemu/kvm_int.h | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index 3900de8883..e414d015c9 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -239,7 +239,7 @@ unsigned int kvm_get_free_memslots(void) + if (!s->as[i].ml) { + continue; + } +- used_slots = MAX(used_slots, s->as[i].ml->nr_used_slots); ++ used_slots = MAX(used_slots, s->as[i].ml->nr_slots_used); + } + kvm_slots_unlock(); + +@@ -1516,7 +1516,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, + } + start_addr += slot_size; + size -= slot_size; +- kml->nr_used_slots--; ++ kml->nr_slots_used--; + } while (size); + return; + } +@@ -1555,7 +1555,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, + ram_start_offset += slot_size; + ram += slot_size; + size -= slot_size; +- kml->nr_used_slots++; ++ kml->nr_slots_used++; + } while (size); + } + +diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h +index 48e496b3d4..b705dfc9b4 100644 +--- a/include/sysemu/kvm_int.h ++++ b/include/sysemu/kvm_int.h +@@ -45,7 +45,7 @@ typedef struct KVMMemoryUpdate { + typedef struct KVMMemoryListener { + MemoryListener listener; + KVMSlot *slots; +- unsigned int nr_used_slots; ++ unsigned int nr_slots_used; + unsigned int nr_slots_allocated; + int as_id; + QSIMPLEQ_HEAD(, KVMMemoryUpdate) transaction_add; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch b/images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch new file mode 100644 index 000000000..1787c16a8 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch @@ -0,0 +1,89 @@ +From 5b731abd3a932fe9a21f83f3849a3b3769906e19 Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Tue, 17 Sep 2024 12:38:35 -0400 +Subject: [PATCH 8/9] KVM: Rename KVMState->nr_slots to nr_slots_max + +RH-Author: Peter Xu +RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array +RH-Jira: RHEL-57682 +RH-Acked-by: Juraj Marcin +RH-Commit: [7/7] 43471483e7380119ba6415bff6d8ee6c69aa9cd7 (peterx/qemu-kvm) + +This value used to reflect the maximum supported memslots from KVM kernel. +Rename it to be clearer. + +Reviewed-by: David Hildenbrand +Signed-off-by: Peter Xu +Link: https://lore.kernel.org/r/20240917163835.194664-5-peterx@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit 943c742868c739c0b14fd996bad3adf744156fec) +Signed-off-by: Peter Xu +--- + accel/kvm/kvm-all.c | 12 ++++++------ + include/sysemu/kvm_int.h | 4 ++-- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index e414d015c9..49dedda47e 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -183,8 +183,8 @@ static bool kvm_slots_grow(KVMMemoryListener *kml, unsigned int nr_slots_new) + unsigned int i, cur = kml->nr_slots_allocated; + KVMSlot *slots; + +- if (nr_slots_new > kvm_state->nr_slots) { +- nr_slots_new = kvm_state->nr_slots; ++ if (nr_slots_new > kvm_state->nr_slots_max) { ++ nr_slots_new = kvm_state->nr_slots_max; + } + + if (cur >= nr_slots_new) { +@@ -225,7 +225,7 @@ unsigned int kvm_get_max_memslots(void) + { + KVMState *s = KVM_STATE(current_accel()); + +- return s->nr_slots; ++ return s->nr_slots_max; + } + + unsigned int kvm_get_free_memslots(void) +@@ -243,7 +243,7 @@ unsigned int kvm_get_free_memslots(void) + } + kvm_slots_unlock(); + +- return s->nr_slots - used_slots; ++ return s->nr_slots_max - used_slots; + } + + /* Called with KVMMemoryListener.slots_lock held */ +@@ -2615,10 +2615,10 @@ static int kvm_init(MachineState *ms) + (kvm_supported_memory_attributes & KVM_MEMORY_ATTRIBUTE_PRIVATE); + + kvm_immediate_exit = kvm_check_extension(s, KVM_CAP_IMMEDIATE_EXIT); +- s->nr_slots = kvm_check_extension(s, KVM_CAP_NR_MEMSLOTS); ++ s->nr_slots_max = kvm_check_extension(s, KVM_CAP_NR_MEMSLOTS); + + /* If unspecified, use the default value */ +- if (!s->nr_slots) { ++ if (!s->nr_slots_max) { + s->nr_slots_max = KVM_MEMSLOTS_NR_MAX_DEFAULT; + } + +diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h +index b705dfc9b4..2c57194b6b 100644 +--- a/include/sysemu/kvm_int.h ++++ b/include/sysemu/kvm_int.h +@@ -103,8 +103,8 @@ struct KVMDirtyRingReaper { + struct KVMState + { + AccelState parent_obj; +- +- int nr_slots; ++ /* Max number of KVM slots supported */ ++ int nr_slots_max; + int fd; + int vmfd; + int coalesced_mmio; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch b/images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch new file mode 100644 index 000000000..ec064f582 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch @@ -0,0 +1,143 @@ +From e27a9d1e5194243084efe4405fe50463442f0fe3 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Thu, 12 Sep 2024 11:48:38 +0530 +Subject: [PATCH 4/9] accel/kvm: refactor dirty ring setup + +RH-Author: Peter Xu +RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array +RH-Jira: RHEL-57682 +RH-Acked-by: Juraj Marcin +RH-Commit: [3/7] 226ae9826237887fc55f75b9175524f12b4fa4a9 (peterx/qemu-kvm) + +Refactor setting up of dirty ring code in kvm_init() so that is can be +reused in the future patchsets. + +Signed-off-by: Ani Sinha +Link: https://lore.kernel.org/r/20240912061838.4501-1-anisinha@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit 28ed7f9761eb273e7dedcfdc0507d158106d0451) +Signed-off-by: Peter Xu +--- + accel/kvm/kvm-all.c | 88 +++++++++++++++++++++++++-------------------- + 1 file changed, 50 insertions(+), 38 deletions(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index 4f96d8b45e..de709fbc43 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -2439,6 +2439,55 @@ static int find_kvm_machine_type(MachineState *ms) + return type; + } + ++static int kvm_setup_dirty_ring(KVMState *s) ++{ ++ uint64_t dirty_log_manual_caps; ++ int ret; ++ ++ /* ++ * Enable KVM dirty ring if supported, otherwise fall back to ++ * dirty logging mode ++ */ ++ ret = kvm_dirty_ring_init(s); ++ if (ret < 0) { ++ return ret; ++ } ++ ++ /* ++ * KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is not needed when dirty ring is ++ * enabled. More importantly, KVM_DIRTY_LOG_INITIALLY_SET will assume no ++ * page is wr-protected initially, which is against how kvm dirty ring is ++ * usage - kvm dirty ring requires all pages are wr-protected at the very ++ * beginning. Enabling this feature for dirty ring causes data corruption. ++ * ++ * TODO: Without KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 and kvm clear dirty log, ++ * we may expect a higher stall time when starting the migration. In the ++ * future we can enable KVM_CLEAR_DIRTY_LOG to work with dirty ring too: ++ * instead of clearing dirty bit, it can be a way to explicitly wr-protect ++ * guest pages. ++ */ ++ if (!s->kvm_dirty_ring_size) { ++ dirty_log_manual_caps = ++ kvm_check_extension(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2); ++ dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | ++ KVM_DIRTY_LOG_INITIALLY_SET); ++ s->manual_dirty_log_protect = dirty_log_manual_caps; ++ if (dirty_log_manual_caps) { ++ ret = kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2, 0, ++ dirty_log_manual_caps); ++ if (ret) { ++ warn_report("Trying to enable capability %"PRIu64" of " ++ "KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 but failed. " ++ "Falling back to the legacy mode. ", ++ dirty_log_manual_caps); ++ s->manual_dirty_log_protect = 0; ++ } ++ } ++ } ++ ++ return 0; ++} ++ + static int kvm_init(MachineState *ms) + { + MachineClass *mc = MACHINE_GET_CLASS(ms); +@@ -2458,7 +2507,6 @@ static int kvm_init(MachineState *ms) + const KVMCapabilityInfo *missing_cap; + int ret; + int type; +- uint64_t dirty_log_manual_caps; + + qemu_mutex_init(&kml_slots_lock); + +@@ -2570,47 +2618,11 @@ static int kvm_init(MachineState *ms) + s->coalesced_pio = s->coalesced_mmio && + kvm_check_extension(s, KVM_CAP_COALESCED_PIO); + +- /* +- * Enable KVM dirty ring if supported, otherwise fall back to +- * dirty logging mode +- */ +- ret = kvm_dirty_ring_init(s); ++ ret = kvm_setup_dirty_ring(s); + if (ret < 0) { + goto err; + } + +- /* +- * KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is not needed when dirty ring is +- * enabled. More importantly, KVM_DIRTY_LOG_INITIALLY_SET will assume no +- * page is wr-protected initially, which is against how kvm dirty ring is +- * usage - kvm dirty ring requires all pages are wr-protected at the very +- * beginning. Enabling this feature for dirty ring causes data corruption. +- * +- * TODO: Without KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 and kvm clear dirty log, +- * we may expect a higher stall time when starting the migration. In the +- * future we can enable KVM_CLEAR_DIRTY_LOG to work with dirty ring too: +- * instead of clearing dirty bit, it can be a way to explicitly wr-protect +- * guest pages. +- */ +- if (!s->kvm_dirty_ring_size) { +- dirty_log_manual_caps = +- kvm_check_extension(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2); +- dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | +- KVM_DIRTY_LOG_INITIALLY_SET); +- s->manual_dirty_log_protect = dirty_log_manual_caps; +- if (dirty_log_manual_caps) { +- ret = kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2, 0, +- dirty_log_manual_caps); +- if (ret) { +- warn_report("Trying to enable capability %"PRIu64" of " +- "KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 but failed. " +- "Falling back to the legacy mode. ", +- dirty_log_manual_caps); +- s->manual_dirty_log_protect = 0; +- } +- } +- } +- + #ifdef KVM_CAP_VCPU_EVENTS + s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS); + #endif +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch b/images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch new file mode 100644 index 000000000..2b707e605 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch @@ -0,0 +1,76 @@ +From 38df1fff536527bf47e190d000d8c05679f0f220 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:52 -0400 +Subject: [PATCH 19/27] docs/system: Update documentation for s390x IPL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [19/23] feefab248336e1744eeb6bdf86e9033fe8184b3a (thuth/qemu-kvm-cs9) + +Update docs to show that s390x PC BIOS can support more than one boot device. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-19-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 0bd107138ff0b171e3cd314dbc200950bcab2b05) +--- + docs/system/bootindex.rst | 7 ++++--- + docs/system/s390x/bootdevices.rst | 9 ++++++--- + 2 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/docs/system/bootindex.rst b/docs/system/bootindex.rst +index 8b057f812f..988f7b3beb 100644 +--- a/docs/system/bootindex.rst ++++ b/docs/system/bootindex.rst +@@ -49,10 +49,11 @@ Limitations + ----------- + + Some firmware has limitations on which devices can be considered for +-booting. For instance, the PC BIOS boot specification allows only one +-disk to be bootable. If boot from disk fails for some reason, the BIOS ++booting. For instance, the x86 PC BIOS boot specification allows only one ++disk to be bootable. If boot from disk fails for some reason, the x86 BIOS + won't retry booting from other disk. It can still try to boot from +-floppy or net, though. ++floppy or net, though. In the case of s390x BIOS, the BIOS will try up to ++8 total devices, any number of which may be disks. + + Sometimes, firmware cannot map the device path QEMU wants firmware to + boot from to a boot method. It doesn't happen for devices the firmware +diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst +index c97efb8fc0..1a1a764c1c 100644 +--- a/docs/system/s390x/bootdevices.rst ++++ b/docs/system/s390x/bootdevices.rst +@@ -6,9 +6,7 @@ Booting with bootindex parameter + + For classical mainframe guests (i.e. LPAR or z/VM installations), you always + have to explicitly specify the disk where you want to boot from (or "IPL" from, +-in s390x-speak -- IPL means "Initial Program Load"). In particular, there can +-also be only one boot device according to the architecture specification, thus +-specifying multiple boot devices is not possible (yet). ++in s390x-speak -- IPL means "Initial Program Load"). + + So for booting an s390x guest in QEMU, you should always mark the + device where you want to boot from with the ``bootindex`` property, for +@@ -17,6 +15,11 @@ example:: + qemu-system-s390x -drive if=none,id=dr1,file=guest.qcow2 \ + -device virtio-blk,drive=dr1,bootindex=1 + ++Multiple devices may have a bootindex. The lowest bootindex is assigned to the ++device to IPL first. If the IPL fails for the first, the device with the second ++lowest bootindex will be tried and so on until IPL is successful or there are no ++remaining boot devices to try. ++ + For booting from a CD-ROM ISO image (which needs to include El-Torito boot + information in order to be bootable), it is recommended to specify a ``scsi-cd`` + device, for example like this:: +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch b/images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch new file mode 100644 index 000000000..095614954 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch @@ -0,0 +1,45 @@ +From 5a0451f82a143dbaa0f75543a75c8e4560ac477f Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Mon, 11 Nov 2024 11:55:06 +0100 +Subject: [PATCH 03/10] docs/system/bootindex: Make it clear that s390x can + also boot from virtio-net +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [2/8] 2921f4532ad7b0891dea251a4d768776170c6271 (thuth/qemu-kvm-cs9) + +Let's make it clear that s390x can also boot from virtio-net, to avoid +that people think that s390x can only boot from disk devices. + +Reported-by: Boris Fiuczynski +Message-ID: <20241111105506.264640-1-thuth@redhat.com> +Reviewed-by: Prasad Pandit +Reviewed-by: Boris Fiuczynski +Signed-off-by: Thomas Huth +(cherry picked from commit b8c5fdc6588f82d95807be0eb2215d215a3ba16e) +--- + docs/system/bootindex.rst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/docs/system/bootindex.rst b/docs/system/bootindex.rst +index 988f7b3beb..5e1b33ee22 100644 +--- a/docs/system/bootindex.rst ++++ b/docs/system/bootindex.rst +@@ -53,7 +53,7 @@ booting. For instance, the x86 PC BIOS boot specification allows only one + disk to be bootable. If boot from disk fails for some reason, the x86 BIOS + won't retry booting from other disk. It can still try to boot from + floppy or net, though. In the case of s390x BIOS, the BIOS will try up to +-8 total devices, any number of which may be disks. ++8 total devices, any number of which may be disks or virtio-net devices. + + Sometimes, firmware cannot map the device path QEMU wants firmware to + boot from to a boot method. It doesn't happen for devices the firmware +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch b/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch new file mode 100644 index 000000000..900b9abfd --- /dev/null +++ b/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch @@ -0,0 +1,65 @@ +From 255d789ab8fbc5a79236e0943a222371ceded164 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Thu, 14 Nov 2024 19:27:42 -0500 +Subject: [PATCH 02/10] docs/system/s390x/bootdevices: Update loadparm + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/8] df997bcf56bad83b5d4832dbf6c3298abd15b249 (thuth/qemu-kvm-cs9) + +Update documentation to include per-device loadparm support. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241115002742.3576842-1-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 0271fdc650b212533b8aeaecbedfe8ccf6bbbef3) +--- + docs/system/s390x/bootdevices.rst | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst +index 1a1a764c1c..97b3914785 100644 +--- a/docs/system/s390x/bootdevices.rst ++++ b/docs/system/s390x/bootdevices.rst +@@ -79,7 +79,29 @@ The second way to use this parameter is to use a number in the range from 0 + to 31. The numbers that can be used here correspond to the numbers that are + shown when using the ``PROMPT`` option, and the s390-ccw bios will then try + to automatically boot the kernel that is associated with the given number. +-Note that ``0`` can be used to boot the default entry. ++Note that ``0`` can be used to boot the default entry. If the machine ++``loadparm`` is not assigned a value, then the default entry is used. ++ ++By default, the machine ``loadparm`` applies to all boot devices. If multiple ++devices are assigned a ``bootindex`` and the ``loadparm`` is to be different ++between them, an independent ``loadparm`` may be assigned on a per-device basis. ++ ++An example guest using per-device ``loadparm``:: ++ ++ qemu-system-s390x -drive if=none,id=dr1,file=primary.qcow2 \ ++ -device virtio-blk,drive=dr1,bootindex=1 \ ++ -drive if=none,id=dr2,file=secondary.qcow2 \ ++ -device virtio-blk,drive=dr2,bootindex=2,loadparm=3 ++ ++In this case, the primary boot device will attempt to IPL using the default ++entry (because no ``loadparm`` is specified for this device or for the ++machine). If that device fails to boot, the secondary device will attempt to ++IPL using entry number 3. ++ ++If a ``loadparm`` is specified on both the machine and a device, the per-device ++value will superseded the machine value. Per-device ``loadparm`` values are ++only used for devices with an assigned ``bootindex``. The machine ``loadparm`` ++is used when attempting to boot without a ``bootindex``. + + + Booting from a network device +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch b/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch new file mode 100644 index 000000000..fdc7d4b9f --- /dev/null +++ b/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch @@ -0,0 +1,66 @@ +From 63c705bdd8d8f17860988d22aa29a238e9fae631 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:40 -0400 +Subject: [PATCH 07/27] docs/system/s390x/bootdevices: Update the documentation + about network booting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [7/23] 31b1f484e98304c385adbefb6eb50b501d179268 (thuth/qemu-kvm-cs9) + +Remove the information about the separate s390-netboot.img from +the documentation. + +Co-authored by: Thomas Huth +Signed-off-by: Jared Rossi +Message-ID: <20241020012953.1380075-7-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit ab2691b6c7ff360875e0af86ff463278f17786f5) +--- + docs/system/s390x/bootdevices.rst | 20 +++++++------------- + 1 file changed, 7 insertions(+), 13 deletions(-) + +diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst +index 1a7a18b43b..c97efb8fc0 100644 +--- a/docs/system/s390x/bootdevices.rst ++++ b/docs/system/s390x/bootdevices.rst +@@ -82,23 +82,17 @@ Note that ``0`` can be used to boot the default entry. + Booting from a network device + ----------------------------- + +-Beside the normal guest firmware (which is loaded from the file ``s390-ccw.img`` +-in the data directory of QEMU, or via the ``-bios`` option), QEMU ships with +-a small TFTP network bootloader firmware for virtio-net-ccw devices, too. This +-firmware is loaded from a file called ``s390-netboot.img`` in the QEMU data +-directory. In case you want to load it from a different filename instead, +-you can specify it via the ``-global s390-ipl.netboot_fw=filename`` +-command line option. +- +-The ``bootindex`` property is especially important for booting via the network. +-If you don't specify the ``bootindex`` property here, the network bootloader +-firmware code won't get loaded into the guest memory so that the network boot +-will fail. For a successful network boot, try something like this:: ++The firmware that ships with QEMU includes a small TFTP network bootloader ++for virtio-net-ccw devices. The ``bootindex`` property is especially ++important for booting via the network. If you don't specify the ``bootindex`` ++property here, the network bootloader won't be taken into consideration and ++the network boot will fail. For a successful network boot, try something ++like this:: + + qemu-system-s390x -netdev user,id=n1,tftp=...,bootfile=... \ + -device virtio-net-ccw,netdev=n1,bootindex=1 + +-The network bootloader firmware also has basic support for pxelinux.cfg-style ++The network bootloader also has basic support for pxelinux.cfg-style + configuration files. See the `PXELINUX Configuration page + `__ + for details how to set up the configuration file on your TFTP server. +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch b/images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch new file mode 100644 index 000000000..70e6bcc11 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch @@ -0,0 +1,61 @@ +From 34266f76ec5c96aceee89d1dd25c338af81f99dc Mon Sep 17 00:00:00 2001 +From: Gavin Shan +Date: Wed, 20 Nov 2024 17:13:44 +1000 +Subject: [PATCH 2/2] hostmem: Apply merge property after the memory region is + initialized + +RH-Author: Gavin Shan +RH-MergeRequest: 296: hostmem: Apply merge property after the memory region is initialized +RH-Jira: RHEL-68289 +RH-Acked-by: David Hildenbrand +RH-Acked-by: Eric Auger +RH-Acked-by: Sebastian Ott +RH-Commit: [1/1] fc01302c3299a15fd523247e5a3df0957becba6a (gwshan/qemu-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-68289 + +The semantic change has been introduced by commit 5becdc0ab0 ("hostmem: +simplify the code for merge and dump properties") even it clarifies that +no senmatic change has been introduced. After the commit, the merge +property can be applied even the corresponding memory region isn't +initialized yet. This leads to crash dump by the following command +lines. + + # /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ + -accel kvm -machine virt -cpu host \ + -object memory-backend-ram,id=mem-memN0,size=4096M,merge=off + : + qemu-system-aarch64: ../system/memory.c:2419: memory_region_get_ram_ptr: \ + Assertion `mr->ram_block' failed. + +Fix it by applying the merge property only when the memory region is +initialized. + +Message-ID: <20240915233117.478169-1-gshan@redhat.com> +Fixes: 5becdc0ab083 ("hostmem: simplify the code for merge and dump properties") +Reported-by: Zhenyu Zhang +Tested-by: Zhenyu Zhang +Signed-off-by: Gavin Shan +Signed-off-by: David Hildenbrand +(cherry picked from commit 78c8f780d3f0d6d17aa93d6f99ff72960080fdd7) +Signed-off-by: Gavin Shan +--- + backends/hostmem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/backends/hostmem.c b/backends/hostmem.c +index 4e5576a4ad..181446626a 100644 +--- a/backends/hostmem.c ++++ b/backends/hostmem.c +@@ -178,7 +178,7 @@ static void host_memory_backend_set_merge(Object *obj, bool value, Error **errp) + return; + } + +- if (!host_memory_backend_mr_inited(backend) && ++ if (host_memory_backend_mr_inited(backend) && + value != backend->merge) { + void *ptr = memory_region_get_ram_ptr(&backend->mr); + uint64_t sz = memory_region_size(&backend->mr); +-- +2.45.1 + diff --git a/images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch b/images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch new file mode 100644 index 000000000..14fe2f049 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch @@ -0,0 +1,221 @@ +From 7aa02e169dde52b4a7f6ec832a3fe55027fbd5e2 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Fri, 15 Nov 2024 15:12:02 +0100 +Subject: [PATCH 05/10] hw: Add "loadparm" property to scsi disk devices for + booting on s390x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [4/8] 7e3444e1fda776ca3b6de246b2dd696edf4980dd (thuth/qemu-kvm-cs9) + +While adding the new flexible boot order feature on s390x recently, +we missed to add the "loadparm" property to the scsi-hd and scsi-cd +devices. This property is required on s390x to pass the information +to the boot loader about which kernel should be started or whether +the boot menu should be shown. But even more serious: The missing +property is now causing trouble with the corresponding libvirt patches +that assume that the "loadparm" property is either settable for all +bootable devices (when the "boot order" feature is implemented in +QEMU), or none (meaning the behaviour of older QEMUs that only allowed +one "loadparm" at the machine level). To fix this broken situation, +let's implement the "loadparm" property in for the SCSI devices, too. + +Message-ID: <20241115141202.1877294-1-thuth@redhat.com> +Acked-by: Eric Farman +Signed-off-by: Thomas Huth +(cherry picked from commit 429442e52d94f890fa194a151e8cd649b04e9e63) +--- + hw/core/qdev-properties-system.c | 26 +++++++++++++++++ + hw/s390x/ipl.c | 19 ++++--------- + hw/scsi/scsi-disk.c | 43 +++++++++++++++++++++++++++++ + include/hw/qdev-properties-system.h | 3 ++ + 4 files changed, 78 insertions(+), 13 deletions(-) + +diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c +index f13350b4fb..5cd527cdba 100644 +--- a/hw/core/qdev-properties-system.c ++++ b/hw/core/qdev-properties-system.c +@@ -58,6 +58,32 @@ static bool check_prop_still_unset(Object *obj, const char *name, + return false; + } + ++bool qdev_prop_sanitize_s390x_loadparm(uint8_t *loadparm, const char *str, ++ Error **errp) ++{ ++ int i, len; ++ ++ len = strlen(str); ++ if (len > 8) { ++ error_setg(errp, "'loadparm' can only contain up to 8 characters"); ++ return false; ++ } ++ ++ for (i = 0; i < len; i++) { ++ uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ ++ ++ if (qemu_isalnum(c) || c == '.' || c == ' ') { ++ loadparm[i] = c; ++ } else { ++ error_setg(errp, ++ "invalid character in 'loadparm': '%c' (ASCII 0x%02x)", ++ c, c); ++ return false; ++ } ++ } ++ ++ return true; ++} + + /* --- drive --- */ + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index 5fbd43c346..8101825dfe 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -418,21 +418,9 @@ static uint64_t s390_ipl_map_iplb_chain(IplParameterBlock *iplb_chain) + + void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) + { +- int i; +- + /* Initialize the loadparm with spaces */ + memset(loadparm, ' ', LOADPARM_LEN); +- for (i = 0; i < LOADPARM_LEN && str[i]; i++) { +- uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ +- +- if (qemu_isalnum(c) || c == '.' || c == ' ') { +- loadparm[i] = c; +- } else { +- error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", +- c, c); +- return; +- } +- } ++ qdev_prop_sanitize_s390x_loadparm(loadparm, str, errp); + } + + void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) +@@ -452,6 +440,7 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + SCSIDevice *sd; + int devtype; + uint8_t *lp; ++ g_autofree void *scsi_lp = NULL; + + /* + * Currently allow IPL only from CCW devices. +@@ -463,6 +452,10 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + switch (devtype) { + case CCW_DEVTYPE_SCSI: + sd = SCSI_DEVICE(dev_st); ++ scsi_lp = object_property_get_str(OBJECT(sd), "loadparm", NULL); ++ if (scsi_lp && strlen(scsi_lp) > 0) { ++ lp = scsi_lp; ++ } + iplb->len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); + iplb->blk0_len = + cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); +diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c +index 4d94b2b816..7566a5f531 100644 +--- a/hw/scsi/scsi-disk.c ++++ b/hw/scsi/scsi-disk.c +@@ -32,6 +32,7 @@ + #include "migration/vmstate.h" + #include "hw/scsi/emulation.h" + #include "scsi/constants.h" ++#include "sysemu/arch_init.h" + #include "sysemu/block-backend.h" + #include "sysemu/blockdev.h" + #include "hw/block/block.h" +@@ -111,6 +112,7 @@ struct SCSIDiskState { + char *vendor; + char *product; + char *device_id; ++ char *loadparm; /* only for s390x */ + bool tray_open; + bool tray_locked; + /* +@@ -3135,6 +3137,43 @@ BlockAIOCB *scsi_dma_writev(int64_t offset, QEMUIOVector *iov, + return blk_aio_pwritev(s->qdev.conf.blk, offset, iov, 0, cb, cb_opaque); + } + ++static char *scsi_property_get_loadparm(Object *obj, Error **errp) ++{ ++ return g_strdup(SCSI_DISK_BASE(obj)->loadparm); ++} ++ ++static void scsi_property_set_loadparm(Object *obj, const char *value, ++ Error **errp) ++{ ++ void *lp_str; ++ ++ if (object_property_get_int(obj, "bootindex", NULL) < 0) { ++ error_setg(errp, "'loadparm' is only valid for boot devices"); ++ return; ++ } ++ ++ lp_str = g_malloc0(strlen(value)); ++ if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) { ++ g_free(lp_str); ++ return; ++ } ++ SCSI_DISK_BASE(obj)->loadparm = lp_str; ++} ++ ++static void scsi_property_add_specifics(DeviceClass *dc) ++{ ++ ObjectClass *oc = OBJECT_CLASS(dc); ++ ++ /* The loadparm property is only supported on s390x */ ++ if (arch_type & QEMU_ARCH_S390X) { ++ object_class_property_add_str(oc, "loadparm", ++ scsi_property_get_loadparm, ++ scsi_property_set_loadparm); ++ object_class_property_set_description(oc, "loadparm", ++ "load parameter (s390x only)"); ++ } ++} ++ + static void scsi_disk_base_class_initfn(ObjectClass *klass, void *data) + { + DeviceClass *dc = DEVICE_CLASS(klass); +@@ -3218,6 +3257,8 @@ static void scsi_hd_class_initfn(ObjectClass *klass, void *data) + dc->desc = "virtual SCSI disk"; + device_class_set_props(dc, scsi_hd_properties); + dc->vmsd = &vmstate_scsi_disk_state; ++ ++ scsi_property_add_specifics(dc); + } + + static const TypeInfo scsi_hd_info = { +@@ -3258,6 +3299,8 @@ static void scsi_cd_class_initfn(ObjectClass *klass, void *data) + dc->desc = "virtual SCSI CD-ROM"; + device_class_set_props(dc, scsi_cd_properties); + dc->vmsd = &vmstate_scsi_disk_state; ++ ++ scsi_property_add_specifics(dc); + } + + static const TypeInfo scsi_cd_info = { +diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h +index 438f65389f..88e4257ad0 100644 +--- a/include/hw/qdev-properties-system.h ++++ b/include/hw/qdev-properties-system.h +@@ -3,6 +3,9 @@ + + #include "hw/qdev-properties.h" + ++bool qdev_prop_sanitize_s390x_loadparm(uint8_t *loadparm, const char *str, ++ Error **errp); ++ + extern const PropertyInfo qdev_prop_chr; + extern const PropertyInfo qdev_prop_macaddr; + extern const PropertyInfo qdev_prop_reserved_region; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch b/images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch new file mode 100644 index 000000000..2b89353ba --- /dev/null +++ b/images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch @@ -0,0 +1,270 @@ +From ca648a6167953204a9ec55131e9aa836f63ab7e8 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:49 -0400 +Subject: [PATCH 16/27] hw/s390x: Build an IPLB for each boot device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [16/23] 4b87f66a28d9a34b0182e0a2c92af406d2e492a6 (thuth/qemu-kvm-cs9) + +Build an IPLB for any device with a bootindex (up to a maximum of 8 devices). + +The IPLB chain is placed immediately before the BIOS in memory. Because this +is not a fixed address, the location of the next IPLB and number of remaining +boot devices is stored in the QIPL global variable for possible later access by +the guest during IPL. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-16-jrossi@linux.ibm.com> +[thuth: Fix endianness problem when accessing the qipl structure] +Signed-off-by: Thomas Huth +(cherry picked from commit 0927875e704e93ace03bb7533c0877bf97e4bda9) +--- + hw/s390x/ipl.c | 129 ++++++++++++++++++++++++++++-------- + hw/s390x/ipl.h | 1 + + include/hw/s390x/ipl/qipl.h | 4 +- + 3 files changed, 105 insertions(+), 29 deletions(-) + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index d83832d975..f4576f8822 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -56,6 +56,13 @@ static bool iplb_extended_needed(void *opaque) + return ipl->iplbext_migration; + } + ++/* Place the IPLB chain immediately before the BIOS in memory */ ++static uint64_t find_iplb_chain_addr(uint64_t bios_addr, uint16_t count) ++{ ++ return (bios_addr & TARGET_PAGE_MASK) ++ - (count * sizeof(IplParameterBlock)); ++} ++ + static const VMStateDescription vmstate_iplb_extended = { + .name = "ipl/iplb_extended", + .version_id = 0, +@@ -398,6 +405,17 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype) + return ccw_dev; + } + ++static uint64_t s390_ipl_map_iplb_chain(IplParameterBlock *iplb_chain) ++{ ++ S390IPLState *ipl = get_ipl_device(); ++ uint16_t count = be16_to_cpu(ipl->qipl.chain_len); ++ uint64_t len = sizeof(IplParameterBlock) * count; ++ uint64_t chain_addr = find_iplb_chain_addr(ipl->bios_start_addr, count); ++ ++ cpu_physical_memory_write(chain_addr, iplb_chain, len); ++ return chain_addr; ++} ++ + void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) + { + int i; +@@ -428,54 +446,51 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) + } + } + +-static bool s390_gen_initial_iplb(S390IPLState *ipl) ++static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + { +- DeviceState *dev_st; ++ S390IPLState *ipl = get_ipl_device(); + CcwDevice *ccw_dev = NULL; + SCSIDevice *sd; + int devtype; + uint8_t *lp; + +- dev_st = get_boot_device(0); +- if (dev_st) { +- ccw_dev = s390_get_ccw_device(dev_st, &devtype); +- } +- + /* + * Currently allow IPL only from CCW devices. + */ ++ ccw_dev = s390_get_ccw_device(dev_st, &devtype); + if (ccw_dev) { + lp = ccw_dev->loadparm; + + switch (devtype) { + case CCW_DEVTYPE_SCSI: + sd = SCSI_DEVICE(dev_st); +- ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); +- ipl->iplb.blk0_len = ++ iplb->len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); ++ iplb->blk0_len = + cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); +- ipl->iplb.pbt = S390_IPL_TYPE_QEMU_SCSI; +- ipl->iplb.scsi.lun = cpu_to_be32(sd->lun); +- ipl->iplb.scsi.target = cpu_to_be16(sd->id); +- ipl->iplb.scsi.channel = cpu_to_be16(sd->channel); +- ipl->iplb.scsi.devno = cpu_to_be16(ccw_dev->sch->devno); +- ipl->iplb.scsi.ssid = ccw_dev->sch->ssid & 3; ++ iplb->pbt = S390_IPL_TYPE_QEMU_SCSI; ++ iplb->scsi.lun = cpu_to_be32(sd->lun); ++ iplb->scsi.target = cpu_to_be16(sd->id); ++ iplb->scsi.channel = cpu_to_be16(sd->channel); ++ iplb->scsi.devno = cpu_to_be16(ccw_dev->sch->devno); ++ iplb->scsi.ssid = ccw_dev->sch->ssid & 3; + break; + case CCW_DEVTYPE_VFIO: +- ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); +- ipl->iplb.pbt = S390_IPL_TYPE_CCW; +- ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno); +- ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3; ++ iplb->len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); ++ iplb->pbt = S390_IPL_TYPE_CCW; ++ iplb->ccw.devno = cpu_to_be16(ccw_dev->sch->devno); ++ iplb->ccw.ssid = ccw_dev->sch->ssid & 3; + break; + case CCW_DEVTYPE_VIRTIO_NET: ++ /* The S390IPLState netboot is true if ANY IPLB may use netboot */ + ipl->netboot = true; + /* Fall through to CCW_DEVTYPE_VIRTIO case */ + case CCW_DEVTYPE_VIRTIO: +- ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); +- ipl->iplb.blk0_len = ++ iplb->len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); ++ iplb->blk0_len = + cpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN); +- ipl->iplb.pbt = S390_IPL_TYPE_CCW; +- ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno); +- ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3; ++ iplb->pbt = S390_IPL_TYPE_CCW; ++ iplb->ccw.devno = cpu_to_be16(ccw_dev->sch->devno); ++ iplb->ccw.ssid = ccw_dev->sch->ssid & 3; + break; + } + +@@ -484,8 +499,8 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) + lp = S390_CCW_MACHINE(qdev_get_machine())->loadparm; + } + +- s390_ipl_convert_loadparm((char *)lp, ipl->iplb.loadparm); +- ipl->iplb.flags |= DIAG308_FLAGS_LP_VALID; ++ s390_ipl_convert_loadparm((char *)lp, iplb->loadparm); ++ iplb->flags |= DIAG308_FLAGS_LP_VALID; + + return true; + } +@@ -493,6 +508,62 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) + return false; + } + ++static bool s390_init_all_iplbs(S390IPLState *ipl) ++{ ++ int iplb_num = 0; ++ IplParameterBlock iplb_chain[7]; ++ DeviceState *dev_st = get_boot_device(0); ++ Object *machine = qdev_get_machine(); ++ ++ /* ++ * Parse the boot devices. Generate an IPLB for only the first boot device ++ * which will later be set with DIAG308. ++ */ ++ if (!dev_st) { ++ ipl->qipl.chain_len = 0; ++ return false; ++ } ++ ++ /* If no machine loadparm was defined fill it with spaces */ ++ if (memcmp(S390_CCW_MACHINE(machine)->loadparm, NO_LOADPARM, 8) == 0) { ++ object_property_set_str(machine, "loadparm", " ", NULL); ++ } ++ ++ iplb_num = 1; ++ s390_build_iplb(dev_st, &ipl->iplb); ++ ++ /* Index any fallback boot devices */ ++ while (get_boot_device(iplb_num)) { ++ iplb_num++; ++ } ++ ++ if (iplb_num > MAX_BOOT_DEVS) { ++ warn_report("Excess boot devices defined! %d boot devices found, " ++ "but only the first %d will be considered.", ++ iplb_num, MAX_BOOT_DEVS); ++ ++ iplb_num = MAX_BOOT_DEVS; ++ } ++ ++ ipl->qipl.chain_len = cpu_to_be16(iplb_num - 1); ++ ++ /* ++ * Build fallback IPLBs for any boot devices above index 0, up to a ++ * maximum amount as defined in ipl.h ++ */ ++ if (iplb_num > 1) { ++ /* Start at 1 because the IPLB for boot index 0 is not chained */ ++ for (int i = 1; i < iplb_num; i++) { ++ dev_st = get_boot_device(i); ++ s390_build_iplb(dev_st, &iplb_chain[i - 1]); ++ } ++ ++ ipl->qipl.next_iplb = cpu_to_be64(s390_ipl_map_iplb_chain(iplb_chain)); ++ } ++ ++ return iplb_num; ++} ++ + static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, + int virtio_id) + { +@@ -620,7 +691,7 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) + * this is the original boot device's SCSI + * so restore IPL parameter info from it + */ +- ipl->iplb_valid = s390_gen_initial_iplb(ipl); ++ ipl->iplb_valid = s390_build_iplb(get_boot_device(0), &ipl->iplb); + } + } + if (reset_type == S390_RESET_MODIFIED_CLEAR || +@@ -714,7 +785,9 @@ void s390_ipl_prepare_cpu(S390CPU *cpu) + if (!ipl->kernel || ipl->iplb_valid) { + cpu->env.psw.addr = ipl->bios_start_addr; + if (!ipl->iplb_valid) { +- ipl->iplb_valid = s390_gen_initial_iplb(ipl); ++ ipl->iplb_valid = s390_init_all_iplbs(ipl); ++ } else { ++ ipl->qipl.chain_len = 0; + } + } + s390_ipl_set_boot_menu(ipl); +diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h +index b670bad551..54eb48fd6e 100644 +--- a/hw/s390x/ipl.h ++++ b/hw/s390x/ipl.h +@@ -20,6 +20,7 @@ + #include "qom/object.h" + + #define DIAG308_FLAGS_LP_VALID 0x80 ++#define MAX_BOOT_DEVS 8 /* Max number of devices that may have a bootindex */ + + void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp); + void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp); +diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h +index b67d2ae061..1da4f75aa8 100644 +--- a/include/hw/s390x/ipl/qipl.h ++++ b/include/hw/s390x/ipl/qipl.h +@@ -32,7 +32,9 @@ struct QemuIplParameters { + uint8_t reserved1[3]; + uint64_t reserved2; + uint32_t boot_menu_timeout; +- uint8_t reserved3[12]; ++ uint8_t reserved3[2]; ++ uint16_t chain_len; ++ uint64_t next_iplb; + } QEMU_PACKED; + typedef struct QemuIplParameters QemuIplParameters; + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch b/images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch new file mode 100644 index 000000000..b5b820df1 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch @@ -0,0 +1,201 @@ +From 99d6e739324ff1be46ad89a2682978cc1fa3a56c Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Thu, 20 Jun 2024 16:59:28 +0200 +Subject: [PATCH 05/27] hw/s390x: Remove the possibility to load the + s390-netboot.img binary +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [5/23] e4e037f24be08626c02f8e870992e8f0a5ed505e (thuth/qemu-kvm-cs9) + +Since the netboot code has now been merged into the main s390-ccw.img +binary, we don't need the separate s390-netboot.img anymore. Remove +it and the code that was responsible for loading it. + +Message-Id: <20240621082422.136217-6-thuth@redhat.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 188e255bf8ed68fa64bcb63577cb100eeb326254) +--- + hw/s390x/ipl.c | 55 -------------------------------------- + hw/s390x/ipl.h | 12 +++------ + hw/s390x/s390-virtio-ccw.c | 10 ++----- + pc-bios/meson.build | 1 - + 4 files changed, 6 insertions(+), 72 deletions(-) + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index 9362de0b6f..8a0a3e6961 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -288,7 +288,6 @@ static Property s390_ipl_properties[] = { + DEFINE_PROP_STRING("initrd", S390IPLState, initrd), + DEFINE_PROP_STRING("cmdline", S390IPLState, cmdline), + DEFINE_PROP_STRING("firmware", S390IPLState, firmware), +- DEFINE_PROP_STRING("netboot_fw", S390IPLState, netboot_fw), + DEFINE_PROP_BOOL("enforce_bios", S390IPLState, enforce_bios, false), + DEFINE_PROP_BOOL("iplbext_migration", S390IPLState, iplbext_migration, + true), +@@ -480,56 +479,6 @@ int s390_ipl_set_loadparm(uint8_t *loadparm) + return -1; + } + +-static int load_netboot_image(Error **errp) +-{ +- MachineState *ms = MACHINE(qdev_get_machine()); +- S390IPLState *ipl = get_ipl_device(); +- char *netboot_filename; +- MemoryRegion *sysmem = get_system_memory(); +- MemoryRegion *mr = NULL; +- void *ram_ptr = NULL; +- int img_size = -1; +- +- mr = memory_region_find(sysmem, 0, 1).mr; +- if (!mr) { +- error_setg(errp, "Failed to find memory region at address 0"); +- return -1; +- } +- +- ram_ptr = memory_region_get_ram_ptr(mr); +- if (!ram_ptr) { +- error_setg(errp, "No RAM found"); +- goto unref_mr; +- } +- +- netboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->netboot_fw); +- if (netboot_filename == NULL) { +- error_setg(errp, "Could not find network bootloader '%s'", +- ipl->netboot_fw); +- goto unref_mr; +- } +- +- img_size = load_elf_ram(netboot_filename, NULL, NULL, NULL, +- &ipl->start_addr, +- NULL, NULL, NULL, 1, EM_S390, 0, 0, NULL, +- false); +- +- if (img_size < 0) { +- img_size = load_image_size(netboot_filename, ram_ptr, ms->ram_size); +- ipl->start_addr = KERN_IMAGE_START; +- } +- +- if (img_size < 0) { +- error_setg(errp, "Failed to load network bootloader"); +- } +- +- g_free(netboot_filename); +- +-unref_mr: +- memory_region_unref(mr); +- return img_size; +-} +- + static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, + int virtio_id) + { +@@ -754,10 +703,6 @@ void s390_ipl_prepare_cpu(S390CPU *cpu) + ipl->iplb_valid = s390_gen_initial_iplb(ipl); + } + } +- if (ipl->netboot) { +- load_netboot_image(&error_fatal); +- ipl->qipl.netboot_start_addr = cpu_to_be64(ipl->start_addr); +- } + s390_ipl_set_boot_menu(ipl); + s390_ipl_prepare_qipl(cpu); + } +diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h +index 57cd125769..b2105b616a 100644 +--- a/hw/s390x/ipl.h ++++ b/hw/s390x/ipl.h +@@ -134,11 +134,8 @@ void s390_ipl_clear_reset_request(void); + /* + * The QEMU IPL Parameters will be stored at absolute address + * 204 (0xcc) which means it is 32-bit word aligned but not +- * double-word aligned. +- * Placement of data fields in this area must account for +- * their alignment needs. E.g., netboot_start_address must +- * have an offset of 4 + n * 8 bytes within the struct in order +- * to keep it double-word aligned. ++ * double-word aligned. Placement of 64-bit data fields in this ++ * area must account for their alignment needs. + * The total size of the struct must never exceed 28 bytes. + * This definition must be kept in sync with the definition + * in pc-bios/s390-ccw/iplb.h. +@@ -146,9 +143,9 @@ void s390_ipl_clear_reset_request(void); + struct QemuIplParameters { + uint8_t qipl_flags; + uint8_t reserved1[3]; +- uint64_t netboot_start_addr; ++ uint64_t reserved2; + uint32_t boot_menu_timeout; +- uint8_t reserved2[12]; ++ uint8_t reserved3[12]; + } QEMU_PACKED; + typedef struct QemuIplParameters QemuIplParameters; + +@@ -178,7 +175,6 @@ struct S390IPLState { + char *initrd; + char *cmdline; + char *firmware; +- char *netboot_fw; + uint8_t cssid; + uint8_t ssid; + uint16_t devno; +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index a4a6ffa053..5113313aa8 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -197,11 +197,10 @@ static void s390_memory_init(MemoryRegion *ram) + static void s390_init_ipl_dev(const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, const char *firmware, +- const char *netboot_fw, bool enforce_bios) ++ bool enforce_bios) + { + Object *new = object_new(TYPE_S390_IPL); + DeviceState *dev = DEVICE(new); +- char *netboot_fw_prop; + + if (kernel_filename) { + qdev_prop_set_string(dev, "kernel", kernel_filename); +@@ -212,11 +211,6 @@ static void s390_init_ipl_dev(const char *kernel_filename, + qdev_prop_set_string(dev, "cmdline", kernel_cmdline); + qdev_prop_set_string(dev, "firmware", firmware); + qdev_prop_set_bit(dev, "enforce_bios", enforce_bios); +- netboot_fw_prop = object_property_get_str(new, "netboot_fw", &error_abort); +- if (!strlen(netboot_fw_prop)) { +- qdev_prop_set_string(dev, "netboot_fw", netboot_fw); +- } +- g_free(netboot_fw_prop); + object_property_add_child(qdev_get_machine(), TYPE_S390_IPL, + new); + object_unref(new); +@@ -284,7 +278,7 @@ static void ccw_init(MachineState *machine) + s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline, + machine->initrd_filename, + machine->firmware ?: "s390-ccw.img", +- "s390-netboot.img", true); ++ true); + + dev = qdev_new(TYPE_S390_PCI_HOST_BRIDGE); + object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE, +diff --git a/pc-bios/meson.build b/pc-bios/meson.build +index 8602b45b9b..ea85c54c86 100644 +--- a/pc-bios/meson.build ++++ b/pc-bios/meson.build +@@ -66,7 +66,6 @@ blobs = [ + 'kvmvapic.bin', + 'pvh.bin', + 's390-ccw.img', +- 's390-netboot.img', + 'slof.bin', + 'skiboot.lid', + 'palcode-clipper', +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch b/images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch new file mode 100644 index 000000000..3395dec2d --- /dev/null +++ b/images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch @@ -0,0 +1,113 @@ +From ffffba85b269096d25fef307b342b8f576610d34 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Wed, 13 Nov 2024 12:47:41 +0100 +Subject: [PATCH 04/10] hw/s390x: Restrict "loadparm" property to devices that + can be used for booting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [3/8] e381997b44f5b8c80a90ae99f5ae5d863f6d5aa5 (thuth/qemu-kvm-cs9) + +Commit bb185de423 ("s390x: Add individual loadparm assignment to +CCW device") added a "loadparm" property to all CCW devices. This +was a little bit unfortunate, since this property is only useful +for devices that can be used for booting, but certainly it is not +useful for devices like virtio-gpu or virtio-tablet. + +Thus let's restrict the property to CCW devices that we can boot from +(i.e. virtio-block, virtio-net and vfio-ccw devices). + +Message-ID: <20241113114741.681096-1-thuth@redhat.com> +Reviewed-by: Philippe Mathieu-Daudé +Reviewed-by: Jared Rossi +Signed-off-by: Thomas Huth +(cherry picked from commit 6e7c96ae61e0542e97d385084f1f2281a0331054) +--- + hw/s390x/ccw-device.c | 4 +--- + hw/s390x/ccw-device.h | 5 +++++ + hw/s390x/virtio-ccw-blk.c | 1 + + hw/s390x/virtio-ccw-net.c | 1 + + hw/vfio/ccw.c | 1 + + 5 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c +index 4e54f34b1c..d7bb364579 100644 +--- a/hw/s390x/ccw-device.c ++++ b/hw/s390x/ccw-device.c +@@ -73,7 +73,7 @@ static void ccw_device_set_loadparm(Object *obj, Visitor *v, + s390_ipl_fmt_loadparm(dev->loadparm, val, errp); + } + +-static const PropertyInfo ccw_loadparm = { ++const PropertyInfo ccw_loadparm = { + .name = "ccw_loadparm", + .description = "Up to 8 chars in set of [A-Za-z0-9. ] to pass" + " to the guest loader/kernel", +@@ -85,8 +85,6 @@ static Property ccw_device_properties[] = { + DEFINE_PROP_CSS_DEV_ID("devno", CcwDevice, devno), + DEFINE_PROP_CSS_DEV_ID_RO("dev_id", CcwDevice, dev_id), + DEFINE_PROP_CSS_DEV_ID_RO("subch_id", CcwDevice, subch_id), +- DEFINE_PROP("loadparm", CcwDevice, loadparm, ccw_loadparm, +- typeof(uint8_t[8])), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h +index 1e1737c0f3..4439feb140 100644 +--- a/hw/s390x/ccw-device.h ++++ b/hw/s390x/ccw-device.h +@@ -51,4 +51,9 @@ static inline CcwDevice *to_ccw_dev_fast(DeviceState *d) + + OBJECT_DECLARE_TYPE(CcwDevice, CCWDeviceClass, CCW_DEVICE) + ++extern const PropertyInfo ccw_loadparm; ++ ++#define DEFINE_PROP_CCW_LOADPARM(_n, _s, _f) \ ++ DEFINE_PROP(_n, _s, _f, ccw_loadparm, typeof(uint8_t[8])) ++ + #endif +diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c +index 8e0e58b77d..2364432c6e 100644 +--- a/hw/s390x/virtio-ccw-blk.c ++++ b/hw/s390x/virtio-ccw-blk.c +@@ -48,6 +48,7 @@ static Property virtio_ccw_blk_properties[] = { + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), ++ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c +index 484e617659..a4a3f65c7e 100644 +--- a/hw/s390x/virtio-ccw-net.c ++++ b/hw/s390x/virtio-ccw-net.c +@@ -51,6 +51,7 @@ static Property virtio_ccw_net_properties[] = { + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), ++ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c +index 115862f430..99f16614ad 100644 +--- a/hw/vfio/ccw.c ++++ b/hw/vfio/ccw.c +@@ -662,6 +662,7 @@ static Property vfio_ccw_properties[] = { + DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd, + TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), + #endif ++ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), + DEFINE_PROP_END_OF_LIST(), + }; + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch b/images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch new file mode 100644 index 000000000..3e333d410 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch @@ -0,0 +1,61 @@ +From 22693a98eca5872f87249006d873a95e71c448f2 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Fri, 21 Jun 2024 10:24:17 +0200 +Subject: [PATCH 01/27] hw/s390x/ipl: Provide more memory to the s390-ccw.img + firmware +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/23] b54cc7784876becb9fcec189811f505c22119b72 (thuth/qemu-kvm-cs9) + +We are going to link the SLOF libc into the s390-ccw.img, and this +libc needs more memory for providing space for malloc() and friends. +Thus bump the memory size that we reserve for the bios to 3 MiB +instead of only 2 MiB. While we're at it, add a proper check that +there is really enough memory assigned to the machine before blindly +using it. + +Message-ID: <20240621082422.136217-3-thuth@redhat.com> +Signed-off-by: Thomas Huth +(cherry picked from commit abaabb2e601adfe296a64471746a997eabcc607f) +--- + hw/s390x/ipl.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index e934bf89d1..9362de0b6f 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -45,6 +45,7 @@ + #define INITRD_PARM_START 0x010408UL + #define PARMFILE_START 0x001000UL + #define ZIPL_IMAGE_START 0x009000UL ++#define BIOS_MAX_SIZE 0x300000UL + #define IPL_PSW_MASK (PSW_MASK_32 | PSW_MASK_64) + + static bool iplb_extended_needed(void *opaque) +@@ -144,7 +145,14 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) + * even if an external kernel has been defined. + */ + if (!ipl->kernel || ipl->enforce_bios) { +- uint64_t fwbase = (MIN(ms->ram_size, 0x80000000U) - 0x200000) & ~0xffffUL; ++ uint64_t fwbase; ++ ++ if (ms->ram_size < BIOS_MAX_SIZE) { ++ error_setg(errp, "not enough RAM to load the BIOS file"); ++ return; ++ } ++ ++ fwbase = (MIN(ms->ram_size, 0x80000000U) - BIOS_MAX_SIZE) & ~0xffffUL; + + bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->firmware); + if (bios_filename == NULL) { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch b/images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch new file mode 100644 index 000000000..944c5499a --- /dev/null +++ b/images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch @@ -0,0 +1,402 @@ +From 40b5689f28e6fef2dfdd0269639c8556200458a3 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:47 -0400 +Subject: [PATCH 14/27] include/hw/s390x: Add include files for common IPL + structs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [14/23] 632d18ef238ded324c962855edb77e3d3f0b4eae (thuth/qemu-kvm-cs9) + +Currently, structures defined in both hw/s390x/ipl.h and pc-bios/s390-ccw/iplb.h +must be kept in sync, which is prone to error. Instead, create a new directory +at include/hw/s390x/ipl/ to contain the definitions that must be shared. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-14-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit ba3658adc80a9370257a9c4e114829ec691311e3) +--- + hw/s390x/ipl.h | 104 +----------------------------- + include/hw/s390x/ipl/qipl.h | 123 ++++++++++++++++++++++++++++++++++++ + pc-bios/s390-ccw/Makefile | 2 +- + pc-bios/s390-ccw/iplb.h | 84 ++---------------------- + 4 files changed, 130 insertions(+), 183 deletions(-) + create mode 100644 include/hw/s390x/ipl/qipl.h + +diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h +index b2105b616a..fa394c339d 100644 +--- a/hw/s390x/ipl.h ++++ b/hw/s390x/ipl.h +@@ -16,95 +16,11 @@ + #include "cpu.h" + #include "exec/address-spaces.h" + #include "hw/qdev-core.h" ++#include "hw/s390x/ipl/qipl.h" + #include "qom/object.h" + +-struct IPLBlockPVComp { +- uint64_t tweak_pref; +- uint64_t addr; +- uint64_t size; +-} QEMU_PACKED; +-typedef struct IPLBlockPVComp IPLBlockPVComp; +- +-struct IPLBlockPV { +- uint8_t reserved18[87]; /* 0x18 */ +- uint8_t version; /* 0x6f */ +- uint32_t reserved70; /* 0x70 */ +- uint32_t num_comp; /* 0x74 */ +- uint64_t pv_header_addr; /* 0x78 */ +- uint64_t pv_header_len; /* 0x80 */ +- struct IPLBlockPVComp components[0]; +-} QEMU_PACKED; +-typedef struct IPLBlockPV IPLBlockPV; +- +-struct IplBlockCcw { +- uint8_t reserved0[85]; +- uint8_t ssid; +- uint16_t devno; +- uint8_t vm_flags; +- uint8_t reserved3[3]; +- uint32_t vm_parm_len; +- uint8_t nss_name[8]; +- uint8_t vm_parm[64]; +- uint8_t reserved4[8]; +-} QEMU_PACKED; +-typedef struct IplBlockCcw IplBlockCcw; +- +-struct IplBlockFcp { +- uint8_t reserved1[305 - 1]; +- uint8_t opt; +- uint8_t reserved2[3]; +- uint16_t reserved3; +- uint16_t devno; +- uint8_t reserved4[4]; +- uint64_t wwpn; +- uint64_t lun; +- uint32_t bootprog; +- uint8_t reserved5[12]; +- uint64_t br_lba; +- uint32_t scp_data_len; +- uint8_t reserved6[260]; +- uint8_t scp_data[0]; +-} QEMU_PACKED; +-typedef struct IplBlockFcp IplBlockFcp; +- +-struct IplBlockQemuScsi { +- uint32_t lun; +- uint16_t target; +- uint16_t channel; +- uint8_t reserved0[77]; +- uint8_t ssid; +- uint16_t devno; +-} QEMU_PACKED; +-typedef struct IplBlockQemuScsi IplBlockQemuScsi; +- + #define DIAG308_FLAGS_LP_VALID 0x80 + +-union IplParameterBlock { +- struct { +- uint32_t len; +- uint8_t reserved0[3]; +- uint8_t version; +- uint32_t blk0_len; +- uint8_t pbt; +- uint8_t flags; +- uint16_t reserved01; +- uint8_t loadparm[8]; +- union { +- IplBlockCcw ccw; +- IplBlockFcp fcp; +- IPLBlockPV pv; +- IplBlockQemuScsi scsi; +- }; +- } QEMU_PACKED; +- struct { +- uint8_t reserved1[110]; +- uint16_t devno; +- uint8_t reserved2[88]; +- uint8_t reserved_ext[4096 - 200]; +- } QEMU_PACKED; +-} QEMU_PACKED; +-typedef union IplParameterBlock IplParameterBlock; +- + int s390_ipl_set_loadparm(uint8_t *loadparm); + void s390_ipl_update_diag308(IplParameterBlock *iplb); + int s390_ipl_prepare_pv_header(Error **errp); +@@ -131,24 +47,6 @@ void s390_ipl_clear_reset_request(void); + #define QIPL_FLAG_BM_OPTS_CMD 0x80 + #define QIPL_FLAG_BM_OPTS_ZIPL 0x40 + +-/* +- * The QEMU IPL Parameters will be stored at absolute address +- * 204 (0xcc) which means it is 32-bit word aligned but not +- * double-word aligned. Placement of 64-bit data fields in this +- * area must account for their alignment needs. +- * The total size of the struct must never exceed 28 bytes. +- * This definition must be kept in sync with the definition +- * in pc-bios/s390-ccw/iplb.h. +- */ +-struct QemuIplParameters { +- uint8_t qipl_flags; +- uint8_t reserved1[3]; +- uint64_t reserved2; +- uint32_t boot_menu_timeout; +- uint8_t reserved3[12]; +-} QEMU_PACKED; +-typedef struct QemuIplParameters QemuIplParameters; +- + #define TYPE_S390_IPL "s390-ipl" + OBJECT_DECLARE_SIMPLE_TYPE(S390IPLState, S390_IPL) + +diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h +new file mode 100644 +index 0000000000..0ef04af027 +--- /dev/null ++++ b/include/hw/s390x/ipl/qipl.h +@@ -0,0 +1,123 @@ ++/* ++ * S/390 boot structures ++ * ++ * Copyright 2024 IBM Corp. ++ * Author(s): Jared Rossi ++ * ++ * This work is licensed under the terms of the GNU GPL, version 2 or (at ++ * your option) any later version. See the COPYING file in the top-level ++ * directory. ++ */ ++ ++#ifndef S390X_QIPL_H ++#define S390X_QIPL_H ++ ++/* Boot Menu flags */ ++#define QIPL_FLAG_BM_OPTS_CMD 0x80 ++#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 ++ ++#define QIPL_ADDRESS 0xcc ++#define LOADPARM_LEN 8 ++ ++/* ++ * The QEMU IPL Parameters will be stored at absolute address ++ * 204 (0xcc) which means it is 32-bit word aligned but not ++ * double-word aligned. Placement of 64-bit data fields in this ++ * area must account for their alignment needs. ++ * The total size of the struct must never exceed 28 bytes. ++ */ ++struct QemuIplParameters { ++ uint8_t qipl_flags; ++ uint8_t reserved1[3]; ++ uint64_t reserved2; ++ uint32_t boot_menu_timeout; ++ uint8_t reserved3[12]; ++} QEMU_PACKED; ++typedef struct QemuIplParameters QemuIplParameters; ++ ++struct IPLBlockPVComp { ++ uint64_t tweak_pref; ++ uint64_t addr; ++ uint64_t size; ++} QEMU_PACKED; ++typedef struct IPLBlockPVComp IPLBlockPVComp; ++ ++struct IPLBlockPV { ++ uint8_t reserved18[87]; /* 0x18 */ ++ uint8_t version; /* 0x6f */ ++ uint32_t reserved70; /* 0x70 */ ++ uint32_t num_comp; /* 0x74 */ ++ uint64_t pv_header_addr; /* 0x78 */ ++ uint64_t pv_header_len; /* 0x80 */ ++ struct IPLBlockPVComp components[0]; ++} QEMU_PACKED; ++typedef struct IPLBlockPV IPLBlockPV; ++ ++struct IplBlockCcw { ++ uint8_t reserved0[85]; ++ uint8_t ssid; ++ uint16_t devno; ++ uint8_t vm_flags; ++ uint8_t reserved3[3]; ++ uint32_t vm_parm_len; ++ uint8_t nss_name[8]; ++ uint8_t vm_parm[64]; ++ uint8_t reserved4[8]; ++} QEMU_PACKED; ++typedef struct IplBlockCcw IplBlockCcw; ++ ++struct IplBlockFcp { ++ uint8_t reserved1[305 - 1]; ++ uint8_t opt; ++ uint8_t reserved2[3]; ++ uint16_t reserved3; ++ uint16_t devno; ++ uint8_t reserved4[4]; ++ uint64_t wwpn; ++ uint64_t lun; ++ uint32_t bootprog; ++ uint8_t reserved5[12]; ++ uint64_t br_lba; ++ uint32_t scp_data_len; ++ uint8_t reserved6[260]; ++ uint8_t scp_data[0]; ++} QEMU_PACKED; ++typedef struct IplBlockFcp IplBlockFcp; ++ ++struct IplBlockQemuScsi { ++ uint32_t lun; ++ uint16_t target; ++ uint16_t channel; ++ uint8_t reserved0[77]; ++ uint8_t ssid; ++ uint16_t devno; ++} QEMU_PACKED; ++typedef struct IplBlockQemuScsi IplBlockQemuScsi; ++ ++union IplParameterBlock { ++ struct { ++ uint32_t len; ++ uint8_t reserved0[3]; ++ uint8_t version; ++ uint32_t blk0_len; ++ uint8_t pbt; ++ uint8_t flags; ++ uint16_t reserved01; ++ uint8_t loadparm[LOADPARM_LEN]; ++ union { ++ IplBlockCcw ccw; ++ IplBlockFcp fcp; ++ IPLBlockPV pv; ++ IplBlockQemuScsi scsi; ++ }; ++ } QEMU_PACKED; ++ struct { ++ uint8_t reserved1[110]; ++ uint16_t devno; ++ uint8_t reserved2[88]; ++ uint8_t reserved_ext[4096 - 200]; ++ } QEMU_PACKED; ++} QEMU_PACKED; ++typedef union IplParameterBlock IplParameterBlock; ++ ++#endif +diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile +index 27cbb354af..db9e8f0892 100644 +--- a/pc-bios/s390-ccw/Makefile ++++ b/pc-bios/s390-ccw/Makefile +@@ -3,7 +3,7 @@ all: build-all + @true + + include config-host.mak +-CFLAGS = -O2 -g ++CFLAGS = -O2 -g -I $(SRC_PATH)/../../include/hw/s390x/ipl + MAKEFLAGS += -rR + + GIT_SUBMODULES = roms/SLOF +diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h +index 3758698468..16643f5879 100644 +--- a/pc-bios/s390-ccw/iplb.h ++++ b/pc-bios/s390-ccw/iplb.h +@@ -12,88 +12,14 @@ + #ifndef IPLB_H + #define IPLB_H + +-#define LOADPARM_LEN 8 ++#ifndef QEMU_PACKED ++#define QEMU_PACKED __attribute__((packed)) ++#endif + +-struct IplBlockCcw { +- uint8_t reserved0[85]; +- uint8_t ssid; +- uint16_t devno; +- uint8_t vm_flags; +- uint8_t reserved3[3]; +- uint32_t vm_parm_len; +- uint8_t nss_name[8]; +- uint8_t vm_parm[64]; +- uint8_t reserved4[8]; +-} __attribute__ ((packed)); +-typedef struct IplBlockCcw IplBlockCcw; +- +-struct IplBlockFcp { +- uint8_t reserved1[305 - 1]; +- uint8_t opt; +- uint8_t reserved2[3]; +- uint16_t reserved3; +- uint16_t devno; +- uint8_t reserved4[4]; +- uint64_t wwpn; +- uint64_t lun; +- uint32_t bootprog; +- uint8_t reserved5[12]; +- uint64_t br_lba; +- uint32_t scp_data_len; +- uint8_t reserved6[260]; +- uint8_t scp_data[]; +-} __attribute__ ((packed)); +-typedef struct IplBlockFcp IplBlockFcp; +- +-struct IplBlockQemuScsi { +- uint32_t lun; +- uint16_t target; +- uint16_t channel; +- uint8_t reserved0[77]; +- uint8_t ssid; +- uint16_t devno; +-} __attribute__ ((packed)); +-typedef struct IplBlockQemuScsi IplBlockQemuScsi; +- +-struct IplParameterBlock { +- uint32_t len; +- uint8_t reserved0[3]; +- uint8_t version; +- uint32_t blk0_len; +- uint8_t pbt; +- uint8_t flags; +- uint16_t reserved01; +- uint8_t loadparm[LOADPARM_LEN]; +- union { +- IplBlockCcw ccw; +- IplBlockFcp fcp; +- IplBlockQemuScsi scsi; +- }; +-} __attribute__ ((packed)); +-typedef struct IplParameterBlock IplParameterBlock; +- +-extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); +- +-#define QIPL_ADDRESS 0xcc +- +-/* Boot Menu flags */ +-#define QIPL_FLAG_BM_OPTS_CMD 0x80 +-#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 +- +-/* +- * This definition must be kept in sync with the definition +- * in hw/s390x/ipl.h +- */ +-struct QemuIplParameters { +- uint8_t qipl_flags; +- uint8_t reserved1[3]; +- uint64_t reserved2; +- uint32_t boot_menu_timeout; +- uint8_t reserved3[12]; +-} __attribute__ ((packed)); +-typedef struct QemuIplParameters QemuIplParameters; ++#include + + extern QemuIplParameters qipl; ++extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); + + #define S390_IPL_TYPE_FCP 0x00 + #define S390_IPL_TYPE_CCW 0x02 +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch b/images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch new file mode 100644 index 000000000..5432fd33a --- /dev/null +++ b/images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch @@ -0,0 +1,287 @@ +From 07a472e19f11c6364e787e71c95c990b76aaf187 Mon Sep 17 00:00:00 2001 +From: Julia Suvorova +Date: Fri, 27 Sep 2024 12:47:40 +0200 +Subject: [PATCH 26/27] kvm: Allow kvm_arch_get/put_registers to accept Error** + +RH-Author: Julia Suvorova +RH-MergeRequest: 286: kvm: Allow kvm_arch_get/put_registers to accept Error** +RH-Jira: RHEL-60914 +RH-Acked-by: Juraj Marcin +RH-Acked-by: Peter Xu +RH-Commit: [1/2] 2ab30f24245a52c4254a5b9238b1b2e966a8c6a2 + +This is necessary to provide discernible error messages to the caller. + +Signed-off-by: Julia Suvorova +Reviewed-by: Peter Xu +Link: https://lore.kernel.org/r/20240927104743.218468-2-jusual@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit a1676bb3047f28b292ecbce3a378ccc0b4721d47) +--- + accel/kvm/kvm-all.c | 41 +++++++++++++++++++++++++++++--------- + include/sysemu/kvm.h | 4 ++-- + target/arm/kvm.c | 4 ++-- + target/i386/kvm/kvm.c | 4 ++-- + target/loongarch/kvm/kvm.c | 4 ++-- + target/mips/kvm.c | 4 ++-- + target/ppc/kvm.c | 4 ++-- + target/riscv/kvm/kvm-cpu.c | 4 ++-- + target/s390x/kvm/kvm.c | 4 ++-- + 9 files changed, 48 insertions(+), 25 deletions(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index 75d11a07b2..a220178822 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -2766,9 +2766,15 @@ void kvm_flush_coalesced_mmio_buffer(void) + static void do_kvm_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg) + { + if (!cpu->vcpu_dirty && !kvm_state->guest_state_protected) { +- int ret = kvm_arch_get_registers(cpu); ++ Error *err = NULL; ++ int ret = kvm_arch_get_registers(cpu, &err); + if (ret) { +- error_report("Failed to get registers: %s", strerror(-ret)); ++ if (err) { ++ error_reportf_err(err, "Failed to synchronize CPU state: "); ++ } else { ++ error_report("Failed to get registers: %s", strerror(-ret)); ++ } ++ + cpu_dump_state(cpu, stderr, CPU_DUMP_CODE); + vm_stop(RUN_STATE_INTERNAL_ERROR); + } +@@ -2786,9 +2792,15 @@ void kvm_cpu_synchronize_state(CPUState *cpu) + + static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg) + { +- int ret = kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE); ++ Error *err = NULL; ++ int ret = kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE, &err); + if (ret) { +- error_report("Failed to put registers after reset: %s", strerror(-ret)); ++ if (err) { ++ error_reportf_err(err, "Restoring resisters after reset: "); ++ } else { ++ error_report("Failed to put registers after reset: %s", ++ strerror(-ret)); ++ } + cpu_dump_state(cpu, stderr, CPU_DUMP_CODE); + vm_stop(RUN_STATE_INTERNAL_ERROR); + } +@@ -2803,9 +2815,15 @@ void kvm_cpu_synchronize_post_reset(CPUState *cpu) + + static void do_kvm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) + { +- int ret = kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE); ++ Error *err = NULL; ++ int ret = kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE, &err); + if (ret) { +- error_report("Failed to put registers after init: %s", strerror(-ret)); ++ if (err) { ++ error_reportf_err(err, "Putting registers after init: "); ++ } else { ++ error_report("Failed to put registers after init: %s", ++ strerror(-ret)); ++ } + exit(1); + } + +@@ -2995,10 +3013,15 @@ int kvm_cpu_exec(CPUState *cpu) + MemTxAttrs attrs; + + if (cpu->vcpu_dirty) { +- ret = kvm_arch_put_registers(cpu, KVM_PUT_RUNTIME_STATE); ++ Error *err = NULL; ++ ret = kvm_arch_put_registers(cpu, KVM_PUT_RUNTIME_STATE, &err); + if (ret) { +- error_report("Failed to put registers after init: %s", +- strerror(-ret)); ++ if (err) { ++ error_reportf_err(err, "Putting registers after init: "); ++ } else { ++ error_report("Failed to put registers after init: %s", ++ strerror(-ret)); ++ } + ret = -1; + break; + } +diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h +index 9cf14ca3d5..d9ad723f78 100644 +--- a/include/sysemu/kvm.h ++++ b/include/sysemu/kvm.h +@@ -359,7 +359,7 @@ int kvm_arch_handle_exit(CPUState *cpu, struct kvm_run *run); + + int kvm_arch_process_async_events(CPUState *cpu); + +-int kvm_arch_get_registers(CPUState *cpu); ++int kvm_arch_get_registers(CPUState *cpu, Error **errp); + + /* state subset only touched by the VCPU itself during runtime */ + #define KVM_PUT_RUNTIME_STATE 1 +@@ -368,7 +368,7 @@ int kvm_arch_get_registers(CPUState *cpu); + /* full state set, modified during initialization or on vmload */ + #define KVM_PUT_FULL_STATE 3 + +-int kvm_arch_put_registers(CPUState *cpu, int level); ++int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp); + + int kvm_arch_get_default_type(MachineState *ms); + +diff --git a/target/arm/kvm.c b/target/arm/kvm.c +index 849e2e21b3..f1f1b5b375 100644 +--- a/target/arm/kvm.c ++++ b/target/arm/kvm.c +@@ -2042,7 +2042,7 @@ static int kvm_arch_put_sve(CPUState *cs) + return 0; + } + +-int kvm_arch_put_registers(CPUState *cs, int level) ++int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) + { + uint64_t val; + uint32_t fpr; +@@ -2226,7 +2226,7 @@ static int kvm_arch_get_sve(CPUState *cs) + return 0; + } + +-int kvm_arch_get_registers(CPUState *cs) ++int kvm_arch_get_registers(CPUState *cs, Error **errp) + { + uint64_t val; + unsigned int el; +diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c +index 2b28c18693..423e6922d8 100644 +--- a/target/i386/kvm/kvm.c ++++ b/target/i386/kvm/kvm.c +@@ -5121,7 +5121,7 @@ static int kvm_get_nested_state(X86CPU *cpu) + return ret; + } + +-int kvm_arch_put_registers(CPUState *cpu, int level) ++int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) + { + X86CPU *x86_cpu = X86_CPU(cpu); + int ret; +@@ -5209,7 +5209,7 @@ int kvm_arch_put_registers(CPUState *cpu, int level) + return 0; + } + +-int kvm_arch_get_registers(CPUState *cs) ++int kvm_arch_get_registers(CPUState *cs, Error **errp) + { + X86CPU *cpu = X86_CPU(cs); + int ret; +diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c +index e1be6a6959..9204d4295d 100644 +--- a/target/loongarch/kvm/kvm.c ++++ b/target/loongarch/kvm/kvm.c +@@ -585,7 +585,7 @@ static int kvm_loongarch_put_cpucfg(CPUState *cs) + return ret; + } + +-int kvm_arch_get_registers(CPUState *cs) ++int kvm_arch_get_registers(CPUState *cs, Error **errp) + { + int ret; + +@@ -613,7 +613,7 @@ int kvm_arch_get_registers(CPUState *cs) + return ret; + } + +-int kvm_arch_put_registers(CPUState *cs, int level) ++int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) + { + int ret; + +diff --git a/target/mips/kvm.c b/target/mips/kvm.c +index a631ab544f..a98798c669 100644 +--- a/target/mips/kvm.c ++++ b/target/mips/kvm.c +@@ -1172,7 +1172,7 @@ static int kvm_mips_get_cp0_registers(CPUState *cs) + return ret; + } + +-int kvm_arch_put_registers(CPUState *cs, int level) ++int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) + { + CPUMIPSState *env = cpu_env(cs); + struct kvm_regs regs; +@@ -1207,7 +1207,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) + return ret; + } + +-int kvm_arch_get_registers(CPUState *cs) ++int kvm_arch_get_registers(CPUState *cs, Error **errp) + { + CPUMIPSState *env = cpu_env(cs); + int ret = 0; +diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c +index c942ff55b2..7daa097164 100644 +--- a/target/ppc/kvm.c ++++ b/target/ppc/kvm.c +@@ -902,7 +902,7 @@ int kvmppc_put_books_sregs(PowerPCCPU *cpu) + return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_SREGS, &sregs); + } + +-int kvm_arch_put_registers(CPUState *cs, int level) ++int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) + { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; +@@ -1207,7 +1207,7 @@ static int kvmppc_get_books_sregs(PowerPCCPU *cpu) + return 0; + } + +-int kvm_arch_get_registers(CPUState *cs) ++int kvm_arch_get_registers(CPUState *cs, Error **errp) + { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; +diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c +index f6e3156b8d..2bfb112be0 100644 +--- a/target/riscv/kvm/kvm-cpu.c ++++ b/target/riscv/kvm/kvm-cpu.c +@@ -1192,7 +1192,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { + KVM_CAP_LAST_INFO + }; + +-int kvm_arch_get_registers(CPUState *cs) ++int kvm_arch_get_registers(CPUState *cs, Error **errp) + { + int ret = 0; + +@@ -1237,7 +1237,7 @@ int kvm_riscv_sync_mpstate_to_kvm(RISCVCPU *cpu, int state) + return 0; + } + +-int kvm_arch_put_registers(CPUState *cs, int level) ++int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) + { + int ret = 0; + +diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c +index 45c23758e7..0d51a4ea6b 100644 +--- a/target/s390x/kvm/kvm.c ++++ b/target/s390x/kvm/kvm.c +@@ -472,7 +472,7 @@ static int can_sync_regs(CPUState *cs, int regs) + #define KVM_SYNC_REQUIRED_REGS (KVM_SYNC_GPRS | KVM_SYNC_ACRS | \ + KVM_SYNC_CRS | KVM_SYNC_PREFIX) + +-int kvm_arch_put_registers(CPUState *cs, int level) ++int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) + { + CPUS390XState *env = cpu_env(cs); + struct kvm_fpu fpu = {}; +@@ -598,7 +598,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) + return 0; + } + +-int kvm_arch_get_registers(CPUState *cs) ++int kvm_arch_get_registers(CPUState *cs, Error **errp) + { + CPUS390XState *env = cpu_env(cs); + struct kvm_fpu fpu; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch b/images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch new file mode 100644 index 000000000..b4ed91786 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch @@ -0,0 +1,143 @@ +From 90a18a9e2e585413eba96ab96df4a878f6c405be Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Thu, 8 Aug 2024 17:08:38 +0530 +Subject: [PATCH 3/9] kvm: refactor core virtual machine creation into its own + function + +RH-Author: Peter Xu +RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array +RH-Jira: RHEL-57682 +RH-Acked-by: Juraj Marcin +RH-Commit: [2/7] 3db75ee31b109048ef2de5c7f193116ab8c185a7 (peterx/qemu-kvm) + +Refactoring the core logic around KVM_CREATE_VM into its own separate function +so that it can be called from other functions in subsequent patches. There is +no functional change in this patch. + +CC: pbonzini@redhat.com +CC: zhao1.liu@intel.com +Signed-off-by: Ani Sinha +Link: https://lore.kernel.org/r/20240808113838.1697366-1-anisinha@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit 67388078da1cf6dac89e5a7c748cca3444d49690) +Signed-off-by: Peter Xu +--- + accel/kvm/kvm-all.c | 89 ++++++++++++++++++++++++++++----------------- + 1 file changed, 56 insertions(+), 33 deletions(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index b51441523d..4f96d8b45e 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -2385,6 +2385,60 @@ uint32_t kvm_dirty_ring_size(void) + return kvm_state->kvm_dirty_ring_size; + } + ++static int do_kvm_create_vm(MachineState *ms, int type) ++{ ++ KVMState *s; ++ int ret; ++ ++ s = KVM_STATE(ms->accelerator); ++ ++ do { ++ ret = kvm_ioctl(s, KVM_CREATE_VM, type); ++ } while (ret == -EINTR); ++ ++ if (ret < 0) { ++ error_report("ioctl(KVM_CREATE_VM) failed: %s", strerror(-ret)); ++ ++#ifdef TARGET_S390X ++ if (ret == -EINVAL) { ++ error_printf("Host kernel setup problem detected." ++ " Please verify:\n"); ++ error_printf("- for kernels supporting the" ++ " switch_amode or user_mode parameters, whether"); ++ error_printf(" user space is running in primary address space\n"); ++ error_printf("- for kernels supporting the vm.allocate_pgste" ++ " sysctl, whether it is enabled\n"); ++ } ++#elif defined(TARGET_PPC) ++ if (ret == -EINVAL) { ++ error_printf("PPC KVM module is not loaded. Try modprobe kvm_%s.\n", ++ (type == 2) ? "pr" : "hv"); ++ } ++#endif ++ } ++ ++ return ret; ++} ++ ++static int find_kvm_machine_type(MachineState *ms) ++{ ++ MachineClass *mc = MACHINE_GET_CLASS(ms); ++ int type; ++ ++ if (object_property_find(OBJECT(current_machine), "kvm-type")) { ++ g_autofree char *kvm_type; ++ kvm_type = object_property_get_str(OBJECT(current_machine), ++ "kvm-type", ++ &error_abort); ++ type = mc->kvm_type(ms, kvm_type); ++ } else if (mc->kvm_type) { ++ type = mc->kvm_type(ms, NULL); ++ } else { ++ type = kvm_arch_get_default_type(ms); ++ } ++ return type; ++} ++ + static int kvm_init(MachineState *ms) + { + MachineClass *mc = MACHINE_GET_CLASS(ms); +@@ -2467,45 +2521,14 @@ static int kvm_init(MachineState *ms) + } + s->as = g_new0(struct KVMAs, s->nr_as); + +- if (object_property_find(OBJECT(current_machine), "kvm-type")) { +- g_autofree char *kvm_type = object_property_get_str(OBJECT(current_machine), +- "kvm-type", +- &error_abort); +- type = mc->kvm_type(ms, kvm_type); +- } else if (mc->kvm_type) { +- type = mc->kvm_type(ms, NULL); +- } else { +- type = kvm_arch_get_default_type(ms); +- } +- ++ type = find_kvm_machine_type(ms); + if (type < 0) { + ret = -EINVAL; + goto err; + } + +- do { +- ret = kvm_ioctl(s, KVM_CREATE_VM, type); +- } while (ret == -EINTR); +- ++ ret = do_kvm_create_vm(ms, type); + if (ret < 0) { +- error_report("ioctl(KVM_CREATE_VM) failed: %s", strerror(-ret)); +- +-#ifdef TARGET_S390X +- if (ret == -EINVAL) { +- error_printf("Host kernel setup problem detected." +- " Please verify:\n"); +- error_printf("- for kernels supporting the" +- " switch_amode or user_mode parameters, whether"); +- error_printf(" user space is running in primary address space\n"); +- error_printf("- for kernels supporting the vm.allocate_pgste" +- " sysctl, whether it is enabled\n"); +- } +-#elif defined(TARGET_PPC) +- if (ret == -EINVAL) { +- error_printf("PPC KVM module is not loaded. Try modprobe kvm_%s.\n", +- (type == 2) ? "pr" : "hv"); +- } +-#endif + goto err; + } + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch b/images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch new file mode 100644 index 000000000..3ebe06d55 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch @@ -0,0 +1,131 @@ +From 66c634c4749d58c0c3644ace27a656c507433288 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Wed, 28 Aug 2024 18:15:39 +0530 +Subject: [PATCH 2/9] kvm: replace fprintf with error_report()/printf() in + kvm_init() + +RH-Author: Peter Xu +RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array +RH-Jira: RHEL-57682 +RH-Acked-by: Juraj Marcin +RH-Commit: [1/7] 3dd0b67d3b6662001eb35201ca41b15d0dd97994 (peterx/qemu-kvm) + +error_report() is more appropriate for error situations. Replace fprintf with +error_report() and error_printf() as appropriate. Some improvement in error +reporting also happens as a part of this change. For example: + +From: +$ ./qemu-system-x86_64 --accel kvm +Could not access KVM kernel module: No such file or directory + +To: +$ ./qemu-system-x86_64 --accel kvm +qemu-system-x86_64: --accel kvm: Could not access KVM kernel module: No such file or directory + +CC: qemu-trivial@nongnu.org +CC: zhao1.liu@intel.com +CC: armbru@redhat.com +Reviewed-by: Zhao Liu +Reviewed-by: Markus Armbruster +Signed-off-by: Ani Sinha +Link: https://lore.kernel.org/r/20240828124539.62672-1-anisinha@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit 804dfbe3ef5e950328b162ae85741be2e228544f) +Signed-off-by: Peter Xu +--- + accel/kvm/kvm-all.c | 40 ++++++++++++++++++---------------------- + 1 file changed, 18 insertions(+), 22 deletions(-) + +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index a220178822..b51441523d 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -2427,7 +2427,7 @@ static int kvm_init(MachineState *ms) + QLIST_INIT(&s->kvm_parked_vcpus); + s->fd = qemu_open_old(s->device ?: "/dev/kvm", O_RDWR); + if (s->fd == -1) { +- fprintf(stderr, "Could not access KVM kernel module: %m\n"); ++ error_report("Could not access KVM kernel module: %m"); + ret = -errno; + goto err; + } +@@ -2437,13 +2437,13 @@ static int kvm_init(MachineState *ms) + if (ret >= 0) { + ret = -EINVAL; + } +- fprintf(stderr, "kvm version too old\n"); ++ error_report("kvm version too old"); + goto err; + } + + if (ret > KVM_API_VERSION) { + ret = -EINVAL; +- fprintf(stderr, "kvm version not supported\n"); ++ error_report("kvm version not supported"); + goto err; + } + +@@ -2488,26 +2488,22 @@ static int kvm_init(MachineState *ms) + } while (ret == -EINTR); + + if (ret < 0) { +- fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -ret, +- strerror(-ret)); ++ error_report("ioctl(KVM_CREATE_VM) failed: %s", strerror(-ret)); + + #ifdef TARGET_S390X + if (ret == -EINVAL) { +- fprintf(stderr, +- "Host kernel setup problem detected. Please verify:\n"); +- fprintf(stderr, "- for kernels supporting the switch_amode or" +- " user_mode parameters, whether\n"); +- fprintf(stderr, +- " user space is running in primary address space\n"); +- fprintf(stderr, +- "- for kernels supporting the vm.allocate_pgste sysctl, " +- "whether it is enabled\n"); ++ error_printf("Host kernel setup problem detected." ++ " Please verify:\n"); ++ error_printf("- for kernels supporting the" ++ " switch_amode or user_mode parameters, whether"); ++ error_printf(" user space is running in primary address space\n"); ++ error_printf("- for kernels supporting the vm.allocate_pgste" ++ " sysctl, whether it is enabled\n"); + } + #elif defined(TARGET_PPC) + if (ret == -EINVAL) { +- fprintf(stderr, +- "PPC KVM module is not loaded. Try modprobe kvm_%s.\n", +- (type == 2) ? "pr" : "hv"); ++ error_printf("PPC KVM module is not loaded. Try modprobe kvm_%s.\n", ++ (type == 2) ? "pr" : "hv"); + } + #endif + goto err; +@@ -2526,9 +2522,9 @@ static int kvm_init(MachineState *ms) + nc->name, nc->num, soft_vcpus_limit); + + if (nc->num > hard_vcpus_limit) { +- fprintf(stderr, "Number of %s cpus requested (%d) exceeds " +- "the maximum cpus supported by KVM (%d)\n", +- nc->name, nc->num, hard_vcpus_limit); ++ error_report("Number of %s cpus requested (%d) exceeds " ++ "the maximum cpus supported by KVM (%d)", ++ nc->name, nc->num, hard_vcpus_limit); + exit(1); + } + } +@@ -2542,8 +2538,8 @@ static int kvm_init(MachineState *ms) + } + if (missing_cap) { + ret = -EINVAL; +- fprintf(stderr, "kvm does not support %s\n%s", +- missing_cap->name, upgrade_note); ++ error_report("kvm does not support %s", missing_cap->name); ++ error_printf("%s", upgrade_note); + goto err; + } + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch b/images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch new file mode 100644 index 000000000..45c09e0a5 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch @@ -0,0 +1,116 @@ +From 090cdb81ce6913f1c5989853d0af0dbb2f1d3f9f Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Wed, 20 Nov 2024 11:01:32 -0500 +Subject: [PATCH] migration: Allow pipes to keep working for fd migrations +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Peter Xu +RH-MergeRequest: 301: migration: Allow pipes to keep working for fd migrations +RH-Jira: RHEL-66089 +RH-Acked-by: Juraj Marcin +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 8b62be63720f81e9d1633844917ab6992d99566f (peterx/qemu-kvm) + +Libvirt may still use pipes for old file migrations in fd: URI form, +especially when loading old images dumped from Libvirt's compression +algorithms. + +In that case, Libvirt needs to compress / uncompress the images on its own +over the migration binary stream, and pipes are passed over to QEMU for +outgoing / incoming migrations in "fd:" URIs. + +For future such use case, it should be suggested to use mapped-ram when +saving such VM image. However there can still be old images that was +compressed in such way, so libvirt needs to be able to load those images, +uncompress them and use the same pipe mechanism to pass that over to QEMU. + +It means, even if new file migrations can be gradually moved over to +mapped-ram (after Libvirt start supporting it), Libvirt still needs the +uncompressor for the old images to be able to load like before. + +Meanwhile since Libvirt currently exposes the compression capability to +guest images, it may needs its own lifecycle management to move that over +to mapped-ram, maybe can be done after mapped-ram saved the image, however +Dan and PeterK raised concern on temporary double disk space consumption. +I suppose for now the easiest is to enable pipes for both sides of "fd:" +migrations, until all things figured out from Libvirt side on how to move +on. + +And for "channels" QMP interface support on "migrate" / "migrate-incoming" +commands, we'll also need to move away from pipe. But let's leave that for +later too. + +So far, still allow pipes to happen like before on both save/load sides, +just like we would allow sockets to pass. + +Cc: qemu-stable +Cc: Fabiano Rosas +Cc: Peter Krempa +Cc: Daniel P. Berrangé +Fixes: c55deb860c ("migration: Deprecate fd: for file migration") +Reviewed-by: Fabiano Rosas +Link: https://lore.kernel.org/r/20241120160132.3659735-1-peterx@redhat.com +Signed-off-by: Peter Xu +(cherry picked from commit 87ae45e602e2943d58509e470e3a1d4ba084ab2f) +Signed-off-by: Peter Xu +--- + migration/fd.c | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +diff --git a/migration/fd.c b/migration/fd.c +index aab5189eac..9bf9be6acb 100644 +--- a/migration/fd.c ++++ b/migration/fd.c +@@ -25,6 +25,29 @@ + #include "io/channel-util.h" + #include "trace.h" + ++static bool fd_is_pipe(int fd) ++{ ++ struct stat statbuf; ++ ++ if (fstat(fd, &statbuf) == -1) { ++ return false; ++ } ++ ++ return S_ISFIFO(statbuf.st_mode); ++} ++ ++static bool migration_fd_valid(int fd) ++{ ++ if (fd_is_socket(fd)) { ++ return true; ++ } ++ ++ if (fd_is_pipe(fd)) { ++ return true; ++ } ++ ++ return false; ++} + + void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp) + { +@@ -34,7 +57,7 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error ** + return; + } + +- if (!fd_is_socket(fd)) { ++ if (!migration_fd_valid(fd)) { + warn_report("fd: migration to a file is deprecated." + " Use file: instead."); + } +@@ -68,7 +91,7 @@ void fd_start_incoming_migration(const char *fdname, Error **errp) + return; + } + +- if (!fd_is_socket(fd)) { ++ if (!migration_fd_valid(fd)) { + warn_report("fd: migration to a file is deprecated." + " Use file: instead."); + } +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch b/images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch new file mode 100644 index 000000000..6493c3e98 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch @@ -0,0 +1,92 @@ +From 91f67a47a3fd31be578988d7ac11bb814314ec5a Mon Sep 17 00:00:00 2001 +From: Hanna Czenczek +Date: Tue, 15 Oct 2024 19:04:37 +0200 +Subject: [PATCH] migration: Ensure vmstate_save() sets errp + +RH-Author: Hanna Czenczek +RH-MergeRequest: 295: migration: Ensure vmstate_save() sets errp +RH-Jira: RHEL-67844 +RH-Acked-by: Stefano Garzarella +RH-Acked-by: Jon Maloy +RH-Commit: [1/1] df65f254fa6bf241b1fd4f4d2101f137d2a6e44b (hreitz/qemu-kvm-c-9-s) + +migration/savevm.c contains some calls to vmstate_save() that are +followed by migrate_set_error() if the integer return value indicates an +error. migrate_set_error() requires that the `Error *` object passed to +it is set. Therefore, vmstate_save() is assumed to always set *errp on +error. + +Right now, that assumption is not met: vmstate_save_state_v() (called +internally by vmstate_save()) will not set *errp if +vmstate_subsection_save() or vmsd->post_save() fail. Fix that by adding +an *errp parameter to vmstate_subsection_save(), and by generating a +generic error in case post_save() fails (as is already done for +pre_save()). + +Without this patch, qemu will crash after vmstate_subsection_save() or +post_save() have failed inside of a vmstate_save() call (unless +migrate_set_error() then happen to discard the new error because +s->error is already set). This happens e.g. when receiving the state +from a virtio-fs back-end (virtiofsd) fails. + +Signed-off-by: Hanna Czenczek +Link: https://lore.kernel.org/r/20241015170437.310358-1-hreitz@redhat.com +Signed-off-by: Peter Xu +(cherry picked from commit 37dfcba1a04989830c706f9cbc00450e5d3a7447) +Signed-off-by: Hanna Czenczek +--- + migration/vmstate.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/migration/vmstate.c b/migration/vmstate.c +index ef26f26ccd..d19b42630a 100644 +--- a/migration/vmstate.c ++++ b/migration/vmstate.c +@@ -22,7 +22,8 @@ + #include "trace.h" + + static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, +- void *opaque, JSONWriter *vmdesc); ++ void *opaque, JSONWriter *vmdesc, ++ Error **errp); + static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, + void *opaque); + +@@ -440,12 +441,13 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, + json_writer_end_array(vmdesc); + } + +- ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc); ++ ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc, errp); + + if (vmsd->post_save) { + int ps_ret = vmsd->post_save(opaque); +- if (!ret) { ++ if (!ret && ps_ret) { + ret = ps_ret; ++ error_setg(errp, "post-save failed: %s", vmsd->name); + } + } + return ret; +@@ -517,7 +519,8 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, + } + + static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, +- void *opaque, JSONWriter *vmdesc) ++ void *opaque, JSONWriter *vmdesc, ++ Error **errp) + { + const VMStateDescription * const *sub = vmsd->subsections; + bool vmdesc_has_subsections = false; +@@ -545,7 +548,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, + qemu_put_byte(f, len); + qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len); + qemu_put_be32(f, vmsdsub->version_id); +- ret = vmstate_save_state(f, vmsdsub, opaque, vmdesc); ++ ret = vmstate_save_state_with_err(f, vmsdsub, opaque, vmdesc, errp); + if (ret) { + return ret; + } +-- +2.45.1 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch new file mode 100644 index 000000000..83c0a3c23 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch @@ -0,0 +1,60 @@ +From 77dab9f12b3c4cdaacea1dff687cf1c49e95f304 Mon Sep 17 00:00:00 2001 +From: Jens Remus +Date: Tue, 1 Oct 2024 17:36:16 +0200 +Subject: [PATCH 21/27] pc-bios/s390-ccw: Clarify alignment is in bytes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [21/23] d00be9e7c87cb047d20b729f2ac539fe624f5ce0 (thuth/qemu-kvm-cs9) + +The assembler directive .align [1] has architecture-dependent behavior, +which may be ambiguous for the reader. Some architectures perform the +alignment in bytes, others in power of two. s390 does in bytes. + +Use the directive .balign [2] instead, to clarify that the alignment +request is in bytes. No functional change. + +[1] https://sourceware.org/binutils/docs/as/Align.html +[2] https://sourceware.org/binutils/docs/as/Balign.html + +Signed-off-by: Jens Remus +Reviewed-by: Marc Hartmayer +Message-ID: <20241001153618.17791-2-mhartmay@linux.ibm.com> +Reviewed-by: Thomas Huth +Signed-off-by: Thomas Huth +(cherry picked from commit c58df213af7ec8924d219025a593b8f3ac475f16) +--- + pc-bios/s390-ccw/start.S | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S +index 061b06591c..576fc12c06 100644 +--- a/pc-bios/s390-ccw/start.S ++++ b/pc-bios/s390-ccw/start.S +@@ -112,7 +112,7 @@ io_new_code: + lctlg %c6,%c6,0(%r15) + br %r14 + +- .align 8 ++ .balign 8 + bss_start_literal: + .quad __bss_start + disabled_wait_psw: +@@ -125,7 +125,7 @@ io_new_mask: + .quad 0x0000000180000000 + + .bss +- .align 8 ++ .balign 8 + stack: + .space STACK_SIZE + .size stack,STACK_SIZE +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch new file mode 100644 index 000000000..95d42fcfc --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch @@ -0,0 +1,83 @@ +From 7a5f9ea3bb8ff78bd93eb2cee9b8be876e745346 Mon Sep 17 00:00:00 2001 +From: Jens Remus +Date: Tue, 1 Oct 2024 17:36:17 +0200 +Subject: [PATCH 22/27] pc-bios/s390-ccw: Don't generate TEXTRELs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [22/23] 8d8b2959be6c798f24e1991252fe6c680a6c6025 (thuth/qemu-kvm-cs9) + +Commit 7cd50cbe4ca3 ("pc-bios/s390-ccw: Don't use __bss_start with the +"larl" instruction") introduced the address constant bss_start_literal +for __bss_start in the .text section, which introduced a relocation in +code (i.e. TEXTREL). The dedicated constant is required, as __bss_start +may not necessarily be aligned on a 2-byte boundary (see subject commit +for details). + +Move the constant to the .data section to get rid of the relocation in +the .text section. Add the linker option -z text to prevent TEXTRELs to +get introduced in the future. + +Note that the R_390_RELATIVE relocations are taken care of by function +glue() in include/hw/elf_ops.h.inc introduced by commit 5dce07e1cb67 +("elf-loader: Provide the possibility to relocate s390 ELF files"). + +Reported-by: Marc Hartmayer +Signed-off-by: Jens Remus +Reviewed-by: Marc Hartmayer +Message-ID: <20241001153618.17791-3-mhartmay@linux.ibm.com> +Reviewed-by: Thomas Huth +Signed-off-by: Thomas Huth +(cherry picked from commit 3259b4424a85d9cdfd1a33ed6030a6c51c1b9b8b) +--- + pc-bios/s390-ccw/Makefile | 2 +- + pc-bios/s390-ccw/start.S | 7 +++++-- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile +index db9e8f0892..38254e22df 100644 +--- a/pc-bios/s390-ccw/Makefile ++++ b/pc-bios/s390-ccw/Makefile +@@ -46,7 +46,7 @@ EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables + EXTRA_CFLAGS += -msoft-float + EXTRA_CFLAGS += -std=gnu99 + EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) +-LDFLAGS += -Wl,-pie -nostdlib -z noexecstack ++LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text + + cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null + cc-option = if $(call cc-test, $1); then \ +diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S +index 576fc12c06..b70213e412 100644 +--- a/pc-bios/s390-ccw/start.S ++++ b/pc-bios/s390-ccw/start.S +@@ -113,8 +113,6 @@ io_new_code: + br %r14 + + .balign 8 +-bss_start_literal: +- .quad __bss_start + disabled_wait_psw: + .quad 0x0002000180000000,0x0000000000000000 + enabled_wait_psw: +@@ -124,6 +122,11 @@ external_new_mask: + io_new_mask: + .quad 0x0000000180000000 + ++.data ++ .balign 8 ++bss_start_literal: ++ .quad __bss_start ++ + .bss + .balign 8 + stack: +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch new file mode 100644 index 000000000..b513e7d8a --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch @@ -0,0 +1,426 @@ +From 41a56360a0f4124252180132e28c166792ee8853 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:46 -0400 +Subject: [PATCH 13/27] pc-bios/s390-ccw: Enable failed IPL to return after + error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [13/23] c86e8a72a631081348e88ac1df99c2eec8ca27dd (thuth/qemu-kvm-cs9) + +Remove panic-on-error from IPL functions such that a return code is propagated +back to the main IPL calling function (rather than terminating immediately), +which facilitates possible error recovery in the future. + +A select few panics remain, which indicate fatal non-devices errors that must +result in termination. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-13-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 0181e23713114fd4c33326c3372aaf48dcfb412a) +--- + pc-bios/s390-ccw/bootmap.c | 53 ++++++++++++++++++-------- + pc-bios/s390-ccw/cio.c | 3 +- + pc-bios/s390-ccw/jump2ipl.c | 5 ++- + pc-bios/s390-ccw/main.c | 32 +++++++++------- + pc-bios/s390-ccw/s390-ccw.h | 2 +- + pc-bios/s390-ccw/virtio-blkdev.c | 2 +- + pc-bios/s390-ccw/virtio.c | 65 +++++++++++++++++++++----------- + pc-bios/s390-ccw/virtio.h | 2 +- + 8 files changed, 108 insertions(+), 56 deletions(-) + +diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c +index 95ef9104d0..56f2f75640 100644 +--- a/pc-bios/s390-ccw/bootmap.c ++++ b/pc-bios/s390-ccw/bootmap.c +@@ -62,15 +62,34 @@ static void *s2_prev_blk = _s2; + static void *s2_cur_blk = _s2 + MAX_SECTOR_SIZE; + static void *s2_next_blk = _s2 + MAX_SECTOR_SIZE * 2; + +-static inline void verify_boot_info(BootInfo *bip) ++static inline int verify_boot_info(BootInfo *bip) + { +- IPL_assert(magic_match(bip->magic, ZIPL_MAGIC), "No zIPL sig in BootInfo"); +- IPL_assert(bip->version == BOOT_INFO_VERSION, "Wrong zIPL version"); +- IPL_assert(bip->bp_type == BOOT_INFO_BP_TYPE_IPL, "DASD is not for IPL"); +- IPL_assert(bip->dev_type == BOOT_INFO_DEV_TYPE_ECKD, "DASD is not ECKD"); +- IPL_assert(bip->flags == BOOT_INFO_FLAGS_ARCH, "Not for this arch"); +- IPL_assert(block_size_ok(bip->bp.ipl.bm_ptr.eckd.bptr.size), +- "Bad block size in zIPL section of the 1st record."); ++ if (!magic_match(bip->magic, ZIPL_MAGIC)) { ++ puts("No zIPL sig in BootInfo"); ++ return -EINVAL; ++ } ++ if (bip->version != BOOT_INFO_VERSION) { ++ puts("Wrong zIPL version"); ++ return -EINVAL; ++ } ++ if (bip->bp_type != BOOT_INFO_BP_TYPE_IPL) { ++ puts("DASD is not for IPL"); ++ return -ENODEV; ++ } ++ if (bip->dev_type != BOOT_INFO_DEV_TYPE_ECKD) { ++ puts("DASD is not ECKD"); ++ return -ENODEV; ++ } ++ if (bip->flags != BOOT_INFO_FLAGS_ARCH) { ++ puts("Not for this arch"); ++ return -EINVAL; ++ } ++ if (!block_size_ok(bip->bp.ipl.bm_ptr.eckd.bptr.size)) { ++ puts("Bad block size in zIPL section of 1st record"); ++ return -EINVAL; ++ } ++ ++ return 0; + } + + static void eckd_format_chs(ExtEckdBlockPtr *ptr, bool ldipl, +@@ -367,8 +386,8 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr, + puts("Unknown script entry type"); + return -EINVAL; + } +- write_reset_psw(bms->entry[i].address.load_address); /* no return */ +- jump_to_IPL_code(0); /* no return */ ++ write_reset_psw(bms->entry[i].address.load_address); ++ jump_to_IPL_code(0); + return -1; + } + +@@ -1067,16 +1086,19 @@ void zipl_load(void) + + if (vdev->is_cdrom) { + ipl_iso_el_torito(); +- panic("\n! Cannot IPL this ISO image !\n"); ++ puts("Failed to IPL this ISO image!"); ++ return; + } + + if (virtio_get_device_type() == VIRTIO_ID_NET) { + netmain(); +- panic("\n! Cannot IPL from this network !\n"); ++ puts("Failed to IPL from this network!"); ++ return; + } + + if (ipl_scsi()) { +- panic("\n! Cannot IPL this SCSI device !\n"); ++ puts("Failed to IPL from this SCSI device!"); ++ return; + } + + switch (virtio_get_device_type()) { +@@ -1087,8 +1109,9 @@ void zipl_load(void) + zipl_load_vscsi(); + break; + default: +- panic("\n! Unknown IPL device type !\n"); ++ puts("Unknown IPL device type!"); ++ return; + } + +- puts("zIPL load failed."); ++ puts("zIPL load failed!"); + } +diff --git a/pc-bios/s390-ccw/cio.c b/pc-bios/s390-ccw/cio.c +index 7b09a38c96..5d543da73f 100644 +--- a/pc-bios/s390-ccw/cio.c ++++ b/pc-bios/s390-ccw/cio.c +@@ -59,7 +59,8 @@ uint16_t cu_type(SubChannelId schid) + }; + + if (do_cio(schid, CU_TYPE_UNKNOWN, ptr2u32(&sense_id_ccw), CCW_FMT1)) { +- panic("Failed to run SenseID CCw\n"); ++ puts("Failed to run SenseID CCW"); ++ return CU_TYPE_UNKNOWN; + } + + return sense_data.cu_type; +diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c +index 80b7f6a1f3..8db1764ff3 100644 +--- a/pc-bios/s390-ccw/jump2ipl.c ++++ b/pc-bios/s390-ccw/jump2ipl.c +@@ -33,7 +33,7 @@ static void jump_to_IPL_addr(void) + /* should not return */ + } + +-void jump_to_IPL_code(uint64_t address) ++int jump_to_IPL_code(uint64_t address) + { + /* store the subsystem information _after_ the bootmap was loaded */ + write_subsystem_identification(); +@@ -68,7 +68,8 @@ void jump_to_IPL_code(uint64_t address) + asm volatile("lghi %%r1,1\n\t" + "diag %%r1,%%r1,0x308\n\t" + : : : "1", "memory"); +- panic("\n! IPL returns !\n"); ++ puts("IPL code jump failed"); ++ return -1; + } + + void jump_to_low_kernel(void) +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index fc44da3161..34ef27d7a6 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -77,6 +77,9 @@ static int is_dev_possibly_bootable(int dev_no, int sch_no) + + enable_subchannel(blk_schid); + cutype = cu_type(blk_schid); ++ if (cutype == CU_TYPE_UNKNOWN) { ++ return -EIO; ++ } + + /* + * Note: we always have to run virtio_is_supported() here to make +@@ -194,10 +197,10 @@ static void boot_setup(void) + have_iplb = store_iplb(&iplb); + } + +-static void find_boot_device(void) ++static bool find_boot_device(void) + { + VDev *vdev = virtio_get_device(); +- bool found; ++ bool found = false; + + switch (iplb.pbt) { + case S390_IPL_TYPE_CCW: +@@ -215,10 +218,10 @@ static void find_boot_device(void) + found = find_subch(iplb.scsi.devno); + break; + default: +- panic("List-directed IPL not supported yet!\n"); ++ puts("Unsupported IPLB"); + } + +- IPL_assert(found, "Boot device not found\n"); ++ return found; + } + + static int virtio_setup(void) +@@ -244,11 +247,13 @@ static int virtio_setup(void) + ret = virtio_scsi_setup_device(blk_schid); + break; + default: +- panic("\n! No IPL device available !\n"); ++ puts("\n! No IPL device available !\n"); ++ return -1; + } + +- if (!ret) { +- IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detected"); ++ if (!ret && !virtio_ipl_disk_is_valid()) { ++ puts("No valid IPL device detected"); ++ return -ENODEV; + } + + return ret; +@@ -259,16 +264,16 @@ static void ipl_boot_device(void) + switch (cutype) { + case CU_TYPE_DASD_3990: + case CU_TYPE_DASD_2107: +- dasd_ipl(blk_schid, cutype); /* no return */ ++ dasd_ipl(blk_schid, cutype); + break; + case CU_TYPE_VIRTIO: +- if (virtio_setup() == 0) { +- zipl_load(); /* Only returns in case of errors */ ++ if (virtio_setup()) { ++ return; /* Only returns in case of errors */ + } ++ zipl_load(); + break; + default: + printf("Attempting to boot from unexpected device type 0x%X\n", cutype); +- panic("\nBoot failed.\n"); + } + } + +@@ -301,12 +306,11 @@ void main(void) + sclp_setup(); + css_setup(); + boot_setup(); +- if (have_iplb) { +- find_boot_device(); ++ if (have_iplb && find_boot_device()) { + ipl_boot_device(); + } else { + probe_boot_device(); + } + +- panic("Failed to load OS from hard disk\n"); ++ panic("Failed to IPL. Halting..."); + } +diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h +index 344ad15655..6cdce3e5e5 100644 +--- a/pc-bios/s390-ccw/s390-ccw.h ++++ b/pc-bios/s390-ccw/s390-ccw.h +@@ -78,7 +78,7 @@ void zipl_load(void); + + /* jump2ipl.c */ + void write_reset_psw(uint64_t psw); +-void jump_to_IPL_code(uint64_t address); ++int jump_to_IPL_code(uint64_t address); + void jump_to_low_kernel(void); + + /* menu.c */ +diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c +index 1c585f034b..7b2d1e20f4 100644 +--- a/pc-bios/s390-ccw/virtio-blkdev.c ++++ b/pc-bios/s390-ccw/virtio-blkdev.c +@@ -59,7 +59,7 @@ int virtio_read_many(unsigned long sector, void *load_addr, int sec_num) + case VIRTIO_ID_SCSI: + return virtio_scsi_read_many(vdev, sector, load_addr, sec_num); + } +- panic("\n! No readable IPL device !\n"); ++ + return -1; + } + +diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c +index 8c6b0a8a92..8b5a370bb3 100644 +--- a/pc-bios/s390-ccw/virtio.c ++++ b/pc-bios/s390-ccw/virtio.c +@@ -217,16 +217,19 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd) + return 0; + } + +-void virtio_setup_ccw(VDev *vdev) ++int virtio_setup_ccw(VDev *vdev) + { +- int i, rc, cfg_size = 0; ++ int i, cfg_size = 0; + uint8_t status; + struct VirtioFeatureDesc { + uint32_t features; + uint8_t index; + } __attribute__((packed)) feats; + +- IPL_assert(virtio_is_supported(vdev->schid), "PE"); ++ if (!virtio_is_supported(vdev->schid)) { ++ puts("Virtio unsupported for this device ID"); ++ return -ENODEV; ++ } + /* device ID has been established now */ + + vdev->config.blk.blk_size = 0; /* mark "illegal" - setup started... */ +@@ -235,8 +238,10 @@ void virtio_setup_ccw(VDev *vdev) + run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false); + + status = VIRTIO_CONFIG_S_ACKNOWLEDGE; +- rc = run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false); +- IPL_assert(rc == 0, "Could not write ACKNOWLEDGE status to host"); ++ if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) { ++ puts("Could not write ACKNOWLEDGE status to host"); ++ return -EIO; ++ } + + switch (vdev->senseid.cu_model) { + case VIRTIO_ID_NET: +@@ -255,27 +260,37 @@ void virtio_setup_ccw(VDev *vdev) + cfg_size = sizeof(vdev->config.scsi); + break; + default: +- panic("Unsupported virtio device\n"); ++ puts("Unsupported virtio device"); ++ return -ENODEV; + } + + status |= VIRTIO_CONFIG_S_DRIVER; +- rc = run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false); +- IPL_assert(rc == 0, "Could not write DRIVER status to host"); ++ if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) { ++ puts("Could not write DRIVER status to host"); ++ return -EIO; ++ } + + /* Feature negotiation */ + for (i = 0; i < ARRAY_SIZE(vdev->guest_features); i++) { + feats.features = 0; + feats.index = i; +- rc = run_ccw(vdev, CCW_CMD_READ_FEAT, &feats, sizeof(feats), false); +- IPL_assert(rc == 0, "Could not get features bits"); ++ if (run_ccw(vdev, CCW_CMD_READ_FEAT, &feats, sizeof(feats), false)) { ++ puts("Could not get features bits"); ++ return -EIO; ++ } ++ + vdev->guest_features[i] &= bswap32(feats.features); + feats.features = bswap32(vdev->guest_features[i]); +- rc = run_ccw(vdev, CCW_CMD_WRITE_FEAT, &feats, sizeof(feats), false); +- IPL_assert(rc == 0, "Could not set features bits"); ++ if (run_ccw(vdev, CCW_CMD_WRITE_FEAT, &feats, sizeof(feats), false)) { ++ puts("Could not set features bits"); ++ return -EIO; ++ } + } + +- rc = run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false); +- IPL_assert(rc == 0, "Could not get virtio device configuration"); ++ if (run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false)) { ++ puts("Could not get virtio device configuration"); ++ return -EIO; ++ } + + for (i = 0; i < vdev->nr_vqs; i++) { + VqInfo info = { +@@ -289,19 +304,27 @@ void virtio_setup_ccw(VDev *vdev) + .num = 0, + }; + +- rc = run_ccw(vdev, CCW_CMD_READ_VQ_CONF, &config, sizeof(config), false); +- IPL_assert(rc == 0, "Could not get virtio device VQ configuration"); ++ if (run_ccw(vdev, CCW_CMD_READ_VQ_CONF, &config, sizeof(config), ++ false)) { ++ puts("Could not get virtio device VQ config"); ++ return -EIO; ++ } + info.num = config.num; + vring_init(&vdev->vrings[i], &info); + vdev->vrings[i].schid = vdev->schid; +- IPL_assert( +- run_ccw(vdev, CCW_CMD_SET_VQ, &info, sizeof(info), false) == 0, +- "Cannot set VQ info"); ++ if (run_ccw(vdev, CCW_CMD_SET_VQ, &info, sizeof(info), false)) { ++ puts("Cannot set VQ info"); ++ return -EIO; ++ } + } + + status |= VIRTIO_CONFIG_S_DRIVER_OK; +- rc = run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false); +- IPL_assert(rc == 0, "Could not write DRIVER_OK status to host"); ++ if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) { ++ puts("Could not write DRIVER_OK status to host"); ++ return -EIO; ++ } ++ ++ return 0; + } + + bool virtio_is_supported(SubChannelId schid) +diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h +index 6f9a558ff5..9faf3986b1 100644 +--- a/pc-bios/s390-ccw/virtio.h ++++ b/pc-bios/s390-ccw/virtio.h +@@ -274,7 +274,7 @@ void vring_send_buf(VRing *vr, void *p, int len, int flags); + int vr_poll(VRing *vr); + int vring_wait_reply(void); + int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd); +-void virtio_setup_ccw(VDev *vdev); ++int virtio_setup_ccw(VDev *vdev); + + int virtio_net_init(void *mac_addr); + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch new file mode 100644 index 000000000..6b5269f2e --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch @@ -0,0 +1,63 @@ +From 499df84ffe62c783d35d5e67cd0d0c35ba6bd44c Mon Sep 17 00:00:00 2001 +From: Marc Hartmayer +Date: Tue, 1 Oct 2024 17:36:18 +0200 +Subject: [PATCH 23/27] pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS` +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [23/23] e27a9f3997924573bbacc1a7cf48004b2daeaaaa (thuth/qemu-kvm-cs9) + +Some packaging tools want to override `LDFLAGS` when building QEMU, this will +result in a build error as most likely no `-nostdlib` flag is passed. Introduce +`EXTRA_LDFLAGS` so that the packager can override `LDFLAGS` without breaking the +build. + +Signed-off-by: Marc Hartmayer +Message-ID: <20241001153618.17791-4-mhartmay@linux.ibm.com> +Reviewed-by: Thomas Huth +[thuth: Drop the hunk to netbook.mak which is not necessary anymore] +Signed-off-by: Thomas Huth +(cherry picked from commit 694d79ffce996c0993cebccc07c2ab6fc281e7d0) +--- + pc-bios/s390-ccw/Makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile +index 38254e22df..dc69dd484f 100644 +--- a/pc-bios/s390-ccw/Makefile ++++ b/pc-bios/s390-ccw/Makefile +@@ -4,6 +4,7 @@ all: build-all + + include config-host.mak + CFLAGS = -O2 -g -I $(SRC_PATH)/../../include/hw/s390x/ipl ++LDFLAGS ?= + MAKEFLAGS += -rR + + GIT_SUBMODULES = roms/SLOF +@@ -46,7 +47,7 @@ EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables + EXTRA_CFLAGS += -msoft-float + EXTRA_CFLAGS += -std=gnu99 + EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) +-LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text ++EXTRA_LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text + + cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null + cc-option = if $(call cc-test, $1); then \ +@@ -111,7 +112,7 @@ libnet.a: $(LIBNETOBJS) + build-all: s390-ccw.img + + s390-ccw.elf: $(OBJECTS) libnet.a libc.a +- $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking) ++ $(call quiet-command,$(CC) $(EXTRA_LDFLAGS) $(LDFLAGS) -o $@ $^,Linking) + + s390-ccw.img: s390-ccw.elf + $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into) +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch new file mode 100644 index 000000000..1b243e542 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch @@ -0,0 +1,263 @@ +From 5dd12012ec95bbac035a7a8b22216082def604f3 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:37 -0400 +Subject: [PATCH 03/27] pc-bios/s390-ccw: Link the netboot code into the main + s390-ccw.img binary +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [3/23] d369fc67aa9e10ba97618182e8f9681d151bcc49 (thuth/qemu-kvm-cs9) + +We originally built a separate binary for the netboot code since it +was considered as experimental and we could not be sure that the +necessary SLOF module had been checked out. Time passed, the code +proved its usefulness, and the build system nowadays makes sure that +the SLOF module is checked out if you have a s390x compiler available +for building the s390-ccw bios. So there is no real compelling reason +anymore to keep the netboot code in a separate binary. Linking the +code together with the main s390-ccw.img will make future enhancements +much easier, like supporting more than one boot device. + +Co-authored by: Thomas Huth +Signed-off-by: Jared Rossi +Message-ID: <20241020012953.1380075-4-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 8e5739ce4b0b04d7121cb2b29521acde2a8f3a24) +--- + pc-bios/s390-ccw/Makefile | 13 +++++++------ + pc-bios/s390-ccw/bootmap.c | 2 +- + pc-bios/s390-ccw/cio.h | 2 ++ + pc-bios/s390-ccw/iplb.h | 4 ++-- + pc-bios/s390-ccw/main.c | 10 +++++++--- + pc-bios/s390-ccw/netboot.mak | 14 -------------- + pc-bios/s390-ccw/netmain.c | 15 ++------------- + pc-bios/s390-ccw/s390-ccw.h | 3 +++ + pc-bios/s390-ccw/virtio.h | 1 - + 9 files changed, 24 insertions(+), 40 deletions(-) + +diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile +index 3f4232636e..cf6859823a 100644 +--- a/pc-bios/s390-ccw/Makefile ++++ b/pc-bios/s390-ccw/Makefile +@@ -32,19 +32,20 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d + + .PHONY : all clean build-all distclean + +-OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ +- virtio.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o ++OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \ ++ virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o + + SLOF_DIR := $(SRC_PATH)/../../roms/SLOF + + LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include ++LIBNET_INC := -I$(SLOF_DIR)/lib/libnet + + EXTRA_CFLAGS += -Wall + EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE + EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables + EXTRA_CFLAGS += -msoft-float + EXTRA_CFLAGS += -std=gnu99 +-EXTRA_CFLAGS += $(LIBC_INC) ++EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) + LDFLAGS += -Wl,-pie -nostdlib -z noexecstack + + cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null +@@ -62,9 +63,9 @@ config-cc.mak: Makefile + + include $(SRC_PATH)/netboot.mak + +-build-all: s390-ccw.img s390-netboot.img ++build-all: s390-ccw.img + +-s390-ccw.elf: $(OBJECTS) libc.a ++s390-ccw.elf: $(OBJECTS) libnet.a libc.a + $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking) + + s390-ccw.img: s390-ccw.elf +@@ -72,7 +73,7 @@ s390-ccw.img: s390-ccw.elf + + $(OBJECTS): Makefile + +-ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS)) ++ALL_OBJS = $(sort $(OBJECTS) $(LIBCOBJS) $(LIBNETOBJS)) + -include $(ALL_OBJS:%.o=%.d) + + clean: +diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c +index 3cc79706be..414c3f1b47 100644 +--- a/pc-bios/s390-ccw/bootmap.c ++++ b/pc-bios/s390-ccw/bootmap.c +@@ -929,7 +929,7 @@ void zipl_load(void) + } + + if (virtio_get_device_type() == VIRTIO_ID_NET) { +- jump_to_IPL_code(vdev->netboot_start_addr); ++ netmain(); + } + + ipl_scsi(); +diff --git a/pc-bios/s390-ccw/cio.h b/pc-bios/s390-ccw/cio.h +index 8b18153deb..6a5e86ba01 100644 +--- a/pc-bios/s390-ccw/cio.h ++++ b/pc-bios/s390-ccw/cio.h +@@ -361,6 +361,8 @@ typedef struct CcwSearchIdData { + uint8_t record; + } __attribute__((packed)) CcwSearchIdData; + ++extern SubChannelId net_schid; ++ + int enable_mss_facility(void); + void enable_subchannel(SubChannelId schid); + uint16_t cu_type(SubChannelId schid); +diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h +index cb6ac8a880..3758698468 100644 +--- a/pc-bios/s390-ccw/iplb.h ++++ b/pc-bios/s390-ccw/iplb.h +@@ -87,9 +87,9 @@ extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); + struct QemuIplParameters { + uint8_t qipl_flags; + uint8_t reserved1[3]; +- uint64_t netboot_start_addr; ++ uint64_t reserved2; + uint32_t boot_menu_timeout; +- uint8_t reserved2[12]; ++ uint8_t reserved3[12]; + } __attribute__ ((packed)); + typedef struct QemuIplParameters QemuIplParameters; + +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index 203df20965..fc44da3161 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -38,8 +38,13 @@ LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */ + */ + void write_subsystem_identification(void) + { +- lowcore->subchannel_id = blk_schid.sch_id; +- lowcore->subchannel_nr = blk_schid.sch_no; ++ if (cutype == CU_TYPE_VIRTIO && virtio_get_device_type() == VIRTIO_ID_NET) { ++ lowcore->subchannel_id = net_schid.sch_id; ++ lowcore->subchannel_nr = net_schid.sch_no; ++ } else { ++ lowcore->subchannel_id = blk_schid.sch_id; ++ lowcore->subchannel_nr = blk_schid.sch_no; ++ } + lowcore->io_int_parm = 0; + } + +@@ -231,7 +236,6 @@ static int virtio_setup(void) + switch (vdev->senseid.cu_model) { + case VIRTIO_ID_NET: + puts("Network boot device detected"); +- vdev->netboot_start_addr = qipl.netboot_start_addr; + return 0; + case VIRTIO_ID_BLOCK: + ret = virtio_blk_setup_device(blk_schid); +diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak +index d2b3d8ee74..0a24257ff4 100644 +--- a/pc-bios/s390-ccw/netboot.mak ++++ b/pc-bios/s390-ccw/netboot.mak +@@ -1,18 +1,4 @@ + +-NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o +- +-LIBNET_INC := -I$(SLOF_DIR)/lib/libnet +- +-NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000 +- +-$(NETOBJS): EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) +- +-s390-netboot.elf: $(NETOBJS) libnet.a libc.a +- $(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $^,Linking) +- +-s390-netboot.img: s390-netboot.elf +- $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into) +- + # libc files: + + LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ +diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c +index 509119be15..bc6ad8695f 100644 +--- a/pc-bios/s390-ccw/netmain.c ++++ b/pc-bios/s390-ccw/netmain.c +@@ -41,7 +41,6 @@ + #define DEFAULT_TFTP_RETRIES 20 + + extern char _start[]; +-void write_iplb_location(void) {} + + #define KERNEL_ADDR ((void *)0L) + #define KERNEL_MAX_SIZE ((long)_start) +@@ -50,10 +49,9 @@ void write_iplb_location(void) {} + /* STSI 3.2.2 offset of first vmdb + offset of uuid inside vmdb */ + #define STSI322_VMDB_UUID_OFFSET ((8 + 12) * 4) + +-IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE))); + static char cfgbuf[2048]; + +-static SubChannelId net_schid = { .one = 1 }; ++SubChannelId net_schid = { .one = 1 }; + static uint8_t mac[6]; + static uint64_t dest_timer; + +@@ -438,15 +436,6 @@ static int net_try_direct_tftp_load(filename_ip_t *fn_ip) + return rc; + } + +-void write_subsystem_identification(void) +-{ +- SubChannelId *schid = (SubChannelId *) 184; +- uint32_t *zeroes = (uint32_t *) 188; +- +- *schid = net_schid; +- *zeroes = 0; +-} +- + static bool find_net_dev(Schib *schib, int dev_no) + { + int i, r; +@@ -509,7 +498,7 @@ static void virtio_setup(void) + IPL_assert(found, "No virtio net device found"); + } + +-void main(void) ++void netmain(void) + { + filename_ip_t fn_ip; + int rc, fnlen; +diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h +index 6f6d95d170..6abb34e563 100644 +--- a/pc-bios/s390-ccw/s390-ccw.h ++++ b/pc-bios/s390-ccw/s390-ccw.h +@@ -55,6 +55,9 @@ void write_iplb_location(void); + unsigned int get_loadparm_index(void); + void main(void); + ++/* netmain.c */ ++void netmain(void); ++ + /* sclp.c */ + void sclp_print(const char *string); + void sclp_set_write_mask(uint32_t receive_mask, uint32_t send_mask); +diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h +index 85bd9d1695..6f9a558ff5 100644 +--- a/pc-bios/s390-ccw/virtio.h ++++ b/pc-bios/s390-ccw/virtio.h +@@ -253,7 +253,6 @@ struct VDev { + uint8_t scsi_dev_heads; + bool scsi_device_selected; + ScsiDevice selected_scsi_device; +- uint64_t netboot_start_addr; + uint32_t max_transfer; + uint32_t guest_features[2]; + }; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch new file mode 100644 index 000000000..9e3583437 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch @@ -0,0 +1,141 @@ +From 053fe7407d61ea7f885ae3a75b8dff18712e97fc Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Fri, 21 Jun 2024 09:40:11 +0200 +Subject: [PATCH 06/27] pc-bios/s390-ccw: Merge netboot.mak into the main + Makefile +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [6/23] a0f3671677000e9bf00557df773fd72d9f9768a7 (thuth/qemu-kvm-cs9) + +Now that the netboot code has been merged into the main s390-ccw.img, +it also does not make sense to keep the build rules in a separate +file. Thus let's merge netboot.mak into the main Makefile. + +Message-Id: <20240621082422.136217-7-thuth@redhat.com> +Signed-off-by: Thomas Huth +(cherry picked from commit f1fdadda36f73c9a4a96f92deb3062528cd12acc) +--- + pc-bios/s390-ccw/Makefile | 47 +++++++++++++++++++++++++++++++++++- + pc-bios/s390-ccw/netboot.mak | 45 ---------------------------------- + 2 files changed, 46 insertions(+), 46 deletions(-) + delete mode 100644 pc-bios/s390-ccw/netboot.mak + +diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile +index cf6859823a..27cbb354af 100644 +--- a/pc-bios/s390-ccw/Makefile ++++ b/pc-bios/s390-ccw/Makefile +@@ -61,7 +61,52 @@ config-cc.mak: Makefile + $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak + -include config-cc.mak + +-include $(SRC_PATH)/netboot.mak ++# libc files: ++ ++LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ ++ -MMD -MP -MT $@ -MF $(@:%.o=%.d) ++ ++CTYPE_OBJS = isdigit.o isxdigit.o toupper.o ++%.o : $(SLOF_DIR)/lib/libc/ctype/%.c ++ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) ++ ++STRING_OBJS = strcat.o strchr.o strrchr.o strcpy.o strlen.o strncpy.o \ ++ strcmp.o strncmp.o strcasecmp.o strncasecmp.o strstr.o \ ++ memset.o memcpy.o memmove.o memcmp.o ++%.o : $(SLOF_DIR)/lib/libc/string/%.c ++ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) ++ ++STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o ++%.o : $(SLOF_DIR)/lib/libc/stdlib/%.c ++ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) ++ ++STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ ++ printf.o putc.o puts.o putchar.o stdchnls.o fileno.o ++%.o : $(SLOF_DIR)/lib/libc/stdio/%.c ++ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) ++ ++sbrk.o: $(SLOF_DIR)/slof/sbrk.c ++ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) ++ ++LIBCOBJS := $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) sbrk.o ++ ++libc.a: $(LIBCOBJS) ++ $(call quiet-command,$(AR) -rc $@ $^,Creating static library) ++ ++# libnet files: ++ ++LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ ++ dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o ++LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ ++ -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d) ++ ++%.o : $(SLOF_DIR)/lib/libnet/%.c ++ $(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,Compiling) ++ ++libnet.a: $(LIBNETOBJS) ++ $(call quiet-command,$(AR) -rc $@ $^,Creating static library) ++ ++# Main targets: + + build-all: s390-ccw.img + +diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak +deleted file mode 100644 +index 0a24257ff4..0000000000 +--- a/pc-bios/s390-ccw/netboot.mak ++++ /dev/null +@@ -1,45 +0,0 @@ +- +-# libc files: +- +-LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ +- -MMD -MP -MT $@ -MF $(@:%.o=%.d) +- +-CTYPE_OBJS = isdigit.o isxdigit.o toupper.o +-%.o : $(SLOF_DIR)/lib/libc/ctype/%.c +- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) +- +-STRING_OBJS = strcat.o strchr.o strrchr.o strcpy.o strlen.o strncpy.o \ +- strcmp.o strncmp.o strcasecmp.o strncasecmp.o strstr.o \ +- memset.o memcpy.o memmove.o memcmp.o +-%.o : $(SLOF_DIR)/lib/libc/string/%.c +- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) +- +-STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o +-%.o : $(SLOF_DIR)/lib/libc/stdlib/%.c +- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) +- +-STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ +- printf.o putc.o puts.o putchar.o stdchnls.o fileno.o +-%.o : $(SLOF_DIR)/lib/libc/stdio/%.c +- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) +- +-sbrk.o: $(SLOF_DIR)/slof/sbrk.c +- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) +- +-LIBCOBJS := $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) sbrk.o +- +-libc.a: $(LIBCOBJS) +- $(call quiet-command,$(AR) -rc $@ $^,Creating static library) +- +-# libnet files: +- +-LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ +- dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o +-LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ +- -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d) +- +-%.o : $(SLOF_DIR)/lib/libnet/%.c +- $(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,Compiling) +- +-libnet.a: $(LIBNETOBJS) +- $(call quiet-command,$(AR) -rc $@ $^,Creating static library) +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch new file mode 100644 index 000000000..8a5c675c0 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch @@ -0,0 +1,45 @@ +From 7e73d3ad9a7e3f047f8ef79131065e4386e1bc00 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Mon, 11 Nov 2024 14:11:20 +0100 +Subject: [PATCH 09/10] pc-bios/s390-ccw: Re-initialize receive queue index + before each boot attempt +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [8/8] 3337c7737fa2eb33f1a27230ae1d6e0f2580a539 (thuth/qemu-kvm-cs9) + +Now that we can boot from multiple boot devices, we have to make sure +to reinitialize static variables like rx_last_idx to avoid that they +contain garbage data during the second boot attempt (which can lead to +crashes when the code tries to access the wrong ring data). + +Message-ID: <20241111131120.317796-1-thuth@redhat.com> +Reviewed-by: Jared Rossi +Signed-off-by: Thomas Huth +(cherry picked from commit 6ba1f714c00f8839a8df9f643e0058f00da3fd25) +--- + pc-bios/s390-ccw/virtio-net.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/pc-bios/s390-ccw/virtio-net.c b/pc-bios/s390-ccw/virtio-net.c +index f9854a22c3..578c89d0c5 100644 +--- a/pc-bios/s390-ccw/virtio-net.c ++++ b/pc-bios/s390-ccw/virtio-net.c +@@ -51,6 +51,8 @@ int virtio_net_init(void *mac_addr) + void *buf; + int i; + ++ rx_last_idx = 0; ++ + vdev->guest_features[0] = VIRTIO_NET_F_MAC_BIT; + virtio_setup_ccw(vdev); + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch new file mode 100644 index 000000000..5e0fd945b --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch @@ -0,0 +1,177 @@ +From 032b512a919662ce65b173416815e29e8f5fb904 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:44 -0400 +Subject: [PATCH 11/27] pc-bios/s390-ccw: Remove panics from DASD IPL path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [11/23] 941e1e76db8d35a6ad6ca2e2a401e2ac122efd09 (thuth/qemu-kvm-cs9) + +Remove panic-on-error from DASD IPL specific functions so that error recovery +may be possible in the future. + +Functions that would previously panic now provide a return code. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-11-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 1d5c7f078e938e6844f404429dd70bc52b39dac6) +--- + pc-bios/s390-ccw/dasd-ipl.c | 66 ++++++++++++++++++++----------------- + pc-bios/s390-ccw/dasd-ipl.h | 2 +- + 2 files changed, 37 insertions(+), 31 deletions(-) + +diff --git a/pc-bios/s390-ccw/dasd-ipl.c b/pc-bios/s390-ccw/dasd-ipl.c +index ae751adec1..babece95ea 100644 +--- a/pc-bios/s390-ccw/dasd-ipl.c ++++ b/pc-bios/s390-ccw/dasd-ipl.c +@@ -111,38 +111,29 @@ static void make_readipl(void) + ccwIplRead->count = 0x18; /* Read 0x18 bytes of data */ + } + +-static void run_readipl(SubChannelId schid, uint16_t cutype) ++static int run_readipl(SubChannelId schid, uint16_t cutype) + { +- if (do_cio(schid, cutype, 0x00, CCW_FMT0)) { +- panic("dasd-ipl: Failed to run Read IPL channel program\n"); +- } ++ return do_cio(schid, cutype, 0x00, CCW_FMT0); + } + + /* + * The architecture states that IPL1 data should consist of a psw followed by + * format-0 READ and TIC CCWs. Let's sanity check. + */ +-static void check_ipl1(void) ++static bool check_ipl1(void) + { + Ccw0 *ccwread = (Ccw0 *)0x08; + Ccw0 *ccwtic = (Ccw0 *)0x10; + +- if (ccwread->cmd_code != CCW_CMD_DASD_READ || +- ccwtic->cmd_code != CCW_CMD_TIC) { +- panic("dasd-ipl: IPL1 data invalid. Is this disk really bootable?\n"); +- } ++ return (ccwread->cmd_code == CCW_CMD_DASD_READ && ++ ccwtic->cmd_code == CCW_CMD_TIC); + } + +-static void check_ipl2(uint32_t ipl2_addr) ++static bool check_ipl2(uint32_t ipl2_addr) + { + Ccw0 *ccw = u32toptr(ipl2_addr); + +- if (ipl2_addr == 0x00) { +- panic("IPL2 address invalid. Is this disk really bootable?\n"); +- } +- if (ccw->cmd_code == 0x00) { +- panic("IPL2 ccw data invalid. Is this disk really bootable?\n"); +- } ++ return (ipl2_addr != 0x00 && ccw->cmd_code != 0x00); + } + + static uint32_t read_ipl2_addr(void) +@@ -188,52 +179,67 @@ static void ipl1_fixup(void) + ccwSearchTic->cda = ptr2u32(ccwSearchID); + } + +-static void run_ipl1(SubChannelId schid, uint16_t cutype) ++static int run_ipl1(SubChannelId schid, uint16_t cutype) + { + uint32_t startAddr = 0x08; + +- if (do_cio(schid, cutype, startAddr, CCW_FMT0)) { +- panic("dasd-ipl: Failed to run IPL1 channel program\n"); +- } ++ return do_cio(schid, cutype, startAddr, CCW_FMT0); + } + +-static void run_ipl2(SubChannelId schid, uint16_t cutype, uint32_t addr) ++static int run_ipl2(SubChannelId schid, uint16_t cutype, uint32_t addr) + { +- if (run_dynamic_ccw_program(schid, cutype, addr)) { +- panic("dasd-ipl: Failed to run IPL2 channel program\n"); +- } ++ return run_dynamic_ccw_program(schid, cutype, addr); + } + + /* + * Limitations in vfio-ccw support complicate the IPL process. Details can + * be found in docs/devel/s390-dasd-ipl.rst + */ +-void dasd_ipl(SubChannelId schid, uint16_t cutype) ++int dasd_ipl(SubChannelId schid, uint16_t cutype) + { + PSWLegacy *pswl = (PSWLegacy *) 0x00; + uint32_t ipl2_addr; + + /* Construct Read IPL CCW and run it to read IPL1 from boot disk */ + make_readipl(); +- run_readipl(schid, cutype); ++ if (run_readipl(schid, cutype)) { ++ puts("Failed to run Read IPL channel program"); ++ return -EIO; ++ } ++ + ipl2_addr = read_ipl2_addr(); +- check_ipl1(); ++ ++ if (!check_ipl1()) { ++ puts("IPL1 invalid for DASD-IPL"); ++ return -EINVAL; ++ } + + /* + * Fixup IPL1 channel program to account for vfio-ccw limitations, then run + * it to read IPL2 channel program from boot disk. + */ + ipl1_fixup(); +- run_ipl1(schid, cutype); +- check_ipl2(ipl2_addr); ++ if (run_ipl1(schid, cutype)) { ++ puts("Failed to run IPL1 channel program"); ++ return -EIO; ++ } ++ ++ if (!check_ipl2(ipl2_addr)) { ++ puts("IPL2 invalid for DASD-IPL"); ++ return -EINVAL; ++ } + + /* + * Run IPL2 channel program to read operating system code from boot disk + */ +- run_ipl2(schid, cutype, ipl2_addr); ++ if (run_ipl2(schid, cutype, ipl2_addr)) { ++ puts("Failed to run IPL2 channel program"); ++ return -EIO; ++ } + + /* Transfer control to the guest operating system */ + pswl->mask |= PSW_MASK_EAMODE; /* Force z-mode */ + pswl->addr |= PSW_MASK_BAMODE; /* ... */ + jump_to_low_kernel(); ++ return -1; + } +diff --git a/pc-bios/s390-ccw/dasd-ipl.h b/pc-bios/s390-ccw/dasd-ipl.h +index c394828906..eb1898c84a 100644 +--- a/pc-bios/s390-ccw/dasd-ipl.h ++++ b/pc-bios/s390-ccw/dasd-ipl.h +@@ -11,6 +11,6 @@ + #ifndef DASD_IPL_H + #define DASD_IPL_H + +-void dasd_ipl(SubChannelId schid, uint16_t cutype); ++int dasd_ipl(SubChannelId schid, uint16_t cutype); + + #endif /* DASD_IPL_H */ +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch new file mode 100644 index 000000000..fa854a156 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch @@ -0,0 +1,475 @@ +From 237d714205394102a4cd60eeeddc12b98bfbfa3f Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:42 -0400 +Subject: [PATCH 09/27] pc-bios/s390-ccw: Remove panics from ECKD IPL path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [9/23] 1e6ecba95979a5bc12bd74c1b0bc631ccfbd57ec (thuth/qemu-kvm-cs9) + +Remove panic-on-error from ECKD block device IPL specific functions so that +error recovery may be possible in the future. + +Functions that would previously panic now provide a return code. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-9-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 806315279d5c629e1cc3a945bcfba3fe5482d84b) +--- + pc-bios/s390-ccw/bootmap.c | 187 +++++++++++++++++++++++++------------ + pc-bios/s390-ccw/bootmap.h | 1 + + 2 files changed, 130 insertions(+), 58 deletions(-) + +diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c +index af73254acb..b9596e28c7 100644 +--- a/pc-bios/s390-ccw/bootmap.c ++++ b/pc-bios/s390-ccw/bootmap.c +@@ -145,14 +145,17 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, + bool more_data; + + memset(_bprs, FREE_SPACE_FILLER, sizeof(_bprs)); +- read_block(blk, bprs, "BPRS read failed"); ++ if (virtio_read(blk, bprs)) { ++ puts("BPRS read failed"); ++ return ERROR_BLOCK_NR; ++ } + + do { + more_data = false; + for (j = 0;; j++) { + block_nr = gen_eckd_block_num(&bprs[j].xeckd, ldipl); + if (is_null_block_number(block_nr)) { /* end of chunk */ +- break; ++ return NULL_BLOCK_NR; + } + + /* we need the updated blockno for the next indirect entry +@@ -163,15 +166,20 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, + } + + /* List directed pointer does not store block size */ +- IPL_assert(ldipl || block_size_ok(bprs[j].xeckd.bptr.size), +- "bad chunk block size"); ++ if (!ldipl && !block_size_ok(bprs[j].xeckd.bptr.size)) { ++ puts("Bad chunk block size"); ++ return ERROR_BLOCK_NR; ++ } + + if (!eckd_valid_address(&bprs[j].xeckd, ldipl)) { + /* + * If an invalid address is found during LD-IPL then break and +- * retry as CCW ++ * retry as CCW-IPL, otherwise abort on error + */ +- IPL_assert(ldipl, "bad chunk ECKD addr"); ++ if (!ldipl) { ++ puts("Bad chunk ECKD address"); ++ return ERROR_BLOCK_NR; ++ } + break; + } + +@@ -189,7 +197,10 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, + * I.e. the next ptr must point to the unused memory area + */ + memset(_bprs, FREE_SPACE_FILLER, sizeof(_bprs)); +- read_block(block_nr, bprs, "BPRS continuation read failed"); ++ if (virtio_read(block_nr, bprs)) { ++ puts("BPRS continuation read failed"); ++ return ERROR_BLOCK_NR; ++ } + more_data = true; + break; + } +@@ -198,7 +209,10 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, + * to memory (address). + */ + rc = virtio_read_many(block_nr, (void *)(*address), count + 1); +- IPL_assert(rc == 0, "code chunk read failed"); ++ if (rc != 0) { ++ puts("Code chunk read failed"); ++ return ERROR_BLOCK_NR; ++ } + + *address += (count + 1) * virtio_get_block_size(); + } +@@ -232,7 +246,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) + + /* Get Stage1b data */ + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(s1b_block_nr, s1b, "Cannot read stage1b boot loader"); ++ if (virtio_read(s1b_block_nr, s1b)) { ++ puts("Cannot read stage1b boot loader"); ++ return -EIO; ++ } + + memset(_s2, FREE_SPACE_FILLER, sizeof(_s2)); + +@@ -244,7 +261,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) + break; + } + +- read_block(cur_block_nr, s2_cur_blk, "Cannot read stage2 boot loader"); ++ if (virtio_read(cur_block_nr, s2_cur_blk)) { ++ puts("Cannot read stage2 boot loader"); ++ return -EIO; ++ } + + if (find_zipl_boot_menu_banner(&banner_offset)) { + /* +@@ -252,8 +272,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) + * possibility of menu data spanning multiple blocks. + */ + if (prev_block_nr) { +- read_block(prev_block_nr, s2_prev_blk, +- "Cannot read stage2 boot loader"); ++ if (virtio_read(prev_block_nr, s2_prev_blk)) { ++ puts("Cannot read stage2 boot loader"); ++ return -EIO; ++ } + } + + if (i + 1 < STAGE2_BLK_CNT_MAX) { +@@ -261,8 +283,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) + } + + if (next_block_nr && !is_null_block_number(next_block_nr)) { +- read_block(next_block_nr, s2_next_blk, +- "Cannot read stage2 boot loader"); ++ if (virtio_read(next_block_nr, s2_next_blk)) { ++ puts("Cannot read stage2 boot loader"); ++ return -EIO; ++ } + } + + return menu_get_zipl_boot_index(s2_cur_blk + banner_offset); +@@ -275,7 +299,7 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) + return 0; + } + +-static void run_eckd_boot_script(block_number_t bmt_block_nr, ++static int run_eckd_boot_script(block_number_t bmt_block_nr, + block_number_t s1b_block_nr) + { + int i; +@@ -292,17 +316,28 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr, + } + + debug_print_int("loadparm", loadparm); +- IPL_assert(loadparm < MAX_BOOT_ENTRIES, "loadparm value greater than" +- " maximum number of boot entries allowed"); ++ if (loadparm >= MAX_BOOT_ENTRIES) { ++ puts("loadparm value greater than max number of boot entries allowed"); ++ return -EINVAL; ++ } + + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(bmt_block_nr, sec, "Cannot read Boot Map Table"); ++ if (virtio_read(bmt_block_nr, sec)) { ++ puts("Cannot read Boot Map Table"); ++ return -EIO; ++ } + + block_nr = gen_eckd_block_num(&bmt->entry[loadparm].xeckd, ldipl); +- IPL_assert(block_nr != -1, "Cannot find Boot Map Table Entry"); ++ if (block_nr == NULL_BLOCK_NR) { ++ puts("Cannot find Boot Map Table Entry"); ++ return -EIO; ++ } + + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(block_nr, sec, "Cannot read Boot Map Script"); ++ if (virtio_read(block_nr, sec)) { ++ puts("Cannot read Boot Map Script"); ++ return -EIO; ++ } + + for (i = 0; bms->entry[i].type == BOOT_SCRIPT_LOAD || + bms->entry[i].type == BOOT_SCRIPT_SIGNATURE; i++) { +@@ -317,21 +352,27 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr, + + do { + block_nr = load_eckd_segments(block_nr, ldipl, &address); +- } while (block_nr != -1); ++ if (block_nr == ERROR_BLOCK_NR) { ++ return ldipl ? 0 : -EIO; ++ } ++ } while (block_nr != NULL_BLOCK_NR); + } + + if (ldipl && bms->entry[i].type != BOOT_SCRIPT_EXEC) { + /* Abort LD-IPL and retry as CCW-IPL */ +- return; ++ return 0; + } + +- IPL_assert(bms->entry[i].type == BOOT_SCRIPT_EXEC, +- "Unknown script entry type"); ++ if (bms->entry[i].type != BOOT_SCRIPT_EXEC) { ++ puts("Unknown script entry type"); ++ return -EINVAL; ++ } + write_reset_psw(bms->entry[i].address.load_address); /* no return */ + jump_to_IPL_code(0); /* no return */ ++ return -1; + } + +-static void ipl_eckd_cdl(void) ++static int ipl_eckd_cdl(void) + { + XEckdMbr *mbr; + EckdCdlIpl2 *ipl2 = (void *)sec; +@@ -342,20 +383,23 @@ static void ipl_eckd_cdl(void) + puts("CDL"); + + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(1, ipl2, "Cannot read IPL2 record at block 1"); ++ if (virtio_read(1, ipl2)) { ++ puts("Cannot read IPL2 record at block 1"); ++ return -EIO; ++ } + + mbr = &ipl2->mbr; + if (!magic_match(mbr, ZIPL_MAGIC)) { + puts("No zIPL section in IPL2 record."); +- return; ++ return 0; + } + if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) { + puts("Bad block size in zIPL section of IPL2 record."); +- return; ++ return 0; + } + if (mbr->dev_type != DEV_TYPE_ECKD) { + puts("Non-ECKD device type in zIPL section of IPL2 record."); +- return; ++ return 0; + } + + /* save pointer to Boot Map Table */ +@@ -365,19 +409,21 @@ static void ipl_eckd_cdl(void) + s1b_block_nr = eckd_block_num(&ipl2->stage1.seek[0].chs); + + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(2, vlbl, "Cannot read Volume Label at block 2"); ++ if (virtio_read(2, vlbl)) { ++ puts("Cannot read Volume Label at block 2"); ++ return -EIO; ++ } + if (!magic_match(vlbl->key, VOL1_MAGIC)) { + puts("Invalid magic of volume label block."); +- return; ++ return 0; + } + if (!magic_match(vlbl->f.key, VOL1_MAGIC)) { + puts("Invalid magic of volser block."); +- return; ++ return 0; + } + print_volser(vlbl->f.volser); + +- run_eckd_boot_script(bmt_block_nr, s1b_block_nr); +- /* no return */ ++ return run_eckd_boot_script(bmt_block_nr, s1b_block_nr); + } + + static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) +@@ -403,7 +449,7 @@ static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) + print_volser(vlbl->volser); + } + +-static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) ++static int ipl_eckd_ldl(ECKD_IPL_mode_t mode) + { + block_number_t bmt_block_nr, s1b_block_nr; + EckdLdlIpl1 *ipl1 = (void *)sec; +@@ -415,10 +461,13 @@ static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) + /* DO NOT read BootMap pointer (only one, xECKD) at block #2 */ + + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(0, sec, "Cannot read block 0 to grab boot info."); ++ if (virtio_read(0, sec)) { ++ puts("Cannot read block 0 to grab boot info."); ++ return -EIO; ++ } + if (mode == ECKD_LDL_UNLABELED) { + if (!magic_match(ipl1->bip.magic, ZIPL_MAGIC)) { +- return; /* not applicable layout */ ++ return 0; /* not applicable layout */ + } + puts("unlabeled LDL."); + } +@@ -430,8 +479,7 @@ static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) + /* save pointer to Stage1b Data */ + s1b_block_nr = eckd_block_num(&ipl1->stage1.seek[0].chs); + +- run_eckd_boot_script(bmt_block_nr, s1b_block_nr); +- /* no return */ ++ return run_eckd_boot_script(bmt_block_nr, s1b_block_nr); + } + + static block_number_t eckd_find_bmt(ExtEckdBlockPtr *ptr) +@@ -441,7 +489,10 @@ static block_number_t eckd_find_bmt(ExtEckdBlockPtr *ptr) + BootRecord *br; + + blockno = gen_eckd_block_num(ptr, 0); +- read_block(blockno, tmp_sec, "Cannot read boot record"); ++ if (virtio_read(blockno, tmp_sec)) { ++ puts("Cannot read boot record"); ++ return ERROR_BLOCK_NR; ++ } + br = (BootRecord *)tmp_sec; + if (!magic_match(br->magic, ZIPL_MAGIC)) { + /* If the boot record is invalid, return and try CCW-IPL instead */ +@@ -470,7 +521,7 @@ static void print_eckd_msg(void) + printf("%s", msg); + } + +-static void ipl_eckd(void) ++static int ipl_eckd(void) + { + IplVolumeLabel *vlbl = (void *)sec; + LDL_VTOC *vtoc = (void *)sec; +@@ -480,7 +531,10 @@ static void ipl_eckd(void) + + /* Block 2 can contain either the CDL VOL1 label or the LDL VTOC */ + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(2, vlbl, "Cannot read block 2"); ++ if (virtio_read(2, vlbl)) { ++ puts("Cannot read block 2"); ++ return -EIO; ++ } + + /* + * First check for a list-directed-format pointer which would +@@ -488,36 +542,53 @@ static void ipl_eckd(void) + */ + if (eckd_valid_address((ExtEckdBlockPtr *)&vlbl->f.br, 0)) { + ldipl_bmt = eckd_find_bmt((ExtEckdBlockPtr *)&vlbl->f.br); +- if (ldipl_bmt) { ++ switch (ldipl_bmt) { ++ case ERROR_BLOCK_NR: ++ return -EIO; ++ case NULL_BLOCK_NR: ++ break; /* Invalid BMT but the device may still boot with CCW-IPL */ ++ default: + puts("List-Directed"); +- /* LD-IPL does not use the S1B bock, just make it NULL */ +- run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR); +- /* Only return in error, retry as CCW-IPL */ ++ /* ++ * LD-IPL does not use the S1B bock, just make it NULL_BLOCK_NR. ++ * In some failure cases retry IPL before aborting. ++ */ ++ if (run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR)) { ++ return -EIO; ++ } ++ /* Non-fatal error, retry as CCW-IPL */ + printf("Retrying IPL "); + print_eckd_msg(); + } + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(2, vtoc, "Cannot read block 2"); ++ if (virtio_read(2, vtoc)) { ++ puts("Cannot read block 2"); ++ return -EIO; ++ } + } + + /* Not list-directed */ + if (magic_match(vtoc->magic, VOL1_MAGIC)) { +- ipl_eckd_cdl(); /* may return in error */ ++ if (ipl_eckd_cdl()) { ++ return -1; ++ } + } + + if (magic_match(vtoc->magic, CMS1_MAGIC)) { +- ipl_eckd_ldl(ECKD_CMS); /* no return */ ++ return ipl_eckd_ldl(ECKD_CMS); + } + if (magic_match(vtoc->magic, LNX1_MAGIC)) { +- ipl_eckd_ldl(ECKD_LDL); /* no return */ ++ return ipl_eckd_ldl(ECKD_LDL); + } + +- ipl_eckd_ldl(ECKD_LDL_UNLABELED); /* it still may return */ ++ if (ipl_eckd_ldl(ECKD_LDL_UNLABELED)) { ++ return -1; ++ } + /* + * Ok, it is not a LDL by any means. + * It still might be a CDL with zero record keys for IPL1 and IPL2 + */ +- ipl_eckd_cdl(); ++ return ipl_eckd_cdl(); + } + + /*********************************************************************** +@@ -910,7 +981,7 @@ static bool has_iso_signature(void) + * Bus specific IPL sequences + */ + +-static void zipl_load_vblk(void) ++static int zipl_load_vblk(void) + { + int blksize = virtio_get_block_size(); + +@@ -919,7 +990,7 @@ static void zipl_load_vblk(void) + virtio_assume_iso9660(); + } + if (ipl_iso_el_torito()) { +- return; ++ return 0; + } + } + +@@ -927,21 +998,21 @@ static void zipl_load_vblk(void) + puts("Using guessed DASD geometry."); + virtio_assume_eckd(); + } +- ipl_eckd(); ++ return ipl_eckd(); + } + +-static void zipl_load_vscsi(void) ++static int zipl_load_vscsi(void) + { + if (virtio_get_block_size() == VIRTIO_ISO_BLOCK_SIZE) { + /* Is it an ISO image in non-CD drive? */ + if (ipl_iso_el_torito()) { +- return; ++ return 0; + } + } + + puts("Using guessed DASD geometry."); + virtio_assume_eckd(); +- ipl_eckd(); ++ return ipl_eckd(); + } + + /*********************************************************************** +diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h +index 3cb573b86b..95943441d3 100644 +--- a/pc-bios/s390-ccw/bootmap.h ++++ b/pc-bios/s390-ccw/bootmap.h +@@ -16,6 +16,7 @@ + + typedef uint64_t block_number_t; + #define NULL_BLOCK_NR 0xffffffffffffffffULL ++#define ERROR_BLOCK_NR 0xfffffffffffffffeULL + + #define FREE_SPACE_FILLER '\xAA' + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch new file mode 100644 index 000000000..0304180fa --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch @@ -0,0 +1,269 @@ +From b850578315ad498d581d8f09c9dfcd0d1dea1a5e Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:41 -0400 +Subject: [PATCH 08/27] pc-bios/s390-ccw: Remove panics from ISO IPL path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [8/23] 92ab09f2df4bcdc721aca11c4a75439ebd72212c (thuth/qemu-kvm-cs9) + +Remove panic-on-error from IPL ISO El Torito specific functions so that error +recovery may be possible in the future. + +Functions that would previously panic now provide a return code. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-8-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit bef2b8dd1a36fc79cabcda48e667f2cba476924c) +--- + pc-bios/s390-ccw/bootmap.c | 87 ++++++++++++++++++++++++------------- + pc-bios/s390-ccw/bootmap.h | 15 +++---- + pc-bios/s390-ccw/s390-ccw.h | 1 + + 3 files changed, 65 insertions(+), 38 deletions(-) + +diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c +index 414c3f1b47..af73254acb 100644 +--- a/pc-bios/s390-ccw/bootmap.c ++++ b/pc-bios/s390-ccw/bootmap.c +@@ -678,8 +678,10 @@ static bool is_iso_bc_entry_compatible(IsoBcSection *s) + if (s->unused || !s->sector_count) { + return false; + } +- read_iso_sector(bswap32(s->load_rba), magic_sec, +- "Failed to read image sector 0"); ++ if (virtio_read(bswap32(s->load_rba), magic_sec)) { ++ puts("Failed to read image sector 0"); ++ return false; ++ } + + /* Checking bytes 8 - 32 for S390 Linux magic */ + return !memcmp(magic_sec + 8, linux_s390_magic, 24); +@@ -692,28 +694,35 @@ static uint32_t sec_offset[ISO9660_MAX_DIR_DEPTH]; + /* Remained directory space in bytes */ + static uint32_t dir_rem[ISO9660_MAX_DIR_DEPTH]; + +-static inline uint32_t iso_get_file_size(uint32_t load_rba) ++static inline long iso_get_file_size(uint32_t load_rba) + { + IsoVolDesc *vd = (IsoVolDesc *)sec; + IsoDirHdr *cur_record = &vd->vd.primary.rootdir; + uint8_t *temp = sec + ISO_SECTOR_SIZE; + int level = 0; + +- read_iso_sector(ISO_PRIMARY_VD_SECTOR, sec, +- "Failed to read ISO primary descriptor"); ++ if (virtio_read(ISO_PRIMARY_VD_SECTOR, sec)) { ++ puts("Failed to read ISO primary descriptor"); ++ return -EIO; ++ } ++ + sec_loc[0] = iso_733_to_u32(cur_record->ext_loc); + dir_rem[0] = 0; + sec_offset[0] = 0; + + while (level >= 0) { +- IPL_assert(sec_offset[level] <= ISO_SECTOR_SIZE, +- "Directory tree structure violation"); ++ if (sec_offset[level] > ISO_SECTOR_SIZE) { ++ puts("Directory tree structure violation"); ++ return -EIO; ++ } + + cur_record = (IsoDirHdr *)(temp + sec_offset[level]); + + if (sec_offset[level] == 0) { +- read_iso_sector(sec_loc[level], temp, +- "Failed to read ISO directory"); ++ if (virtio_read(sec_loc[level], temp)) { ++ puts("Failed to read ISO directory"); ++ return -EIO; ++ } + if (dir_rem[level] == 0) { + /* Skip self and parent records */ + dir_rem[level] = iso_733_to_u32(cur_record->data_len) - +@@ -758,8 +767,10 @@ static inline uint32_t iso_get_file_size(uint32_t load_rba) + if (dir_rem[level] == 0) { + /* Nothing remaining */ + level--; +- read_iso_sector(sec_loc[level], temp, +- "Failed to read ISO directory"); ++ if (virtio_read(sec_loc[level], temp)) { ++ puts("Failed to read ISO directory"); ++ return -EIO; ++ } + } + } + +@@ -774,19 +785,24 @@ static void load_iso_bc_entry(IsoBcSection *load) + * is padded and ISO_SECTOR_SIZE bytes aligned + */ + uint32_t blks_to_load = bswap16(s.sector_count) >> ET_SECTOR_SHIFT; +- uint32_t real_size = iso_get_file_size(bswap32(s.load_rba)); ++ long real_size = iso_get_file_size(bswap32(s.load_rba)); + +- if (real_size) { ++ if (real_size > 0) { + /* Round up blocks to load */ + blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE; + puts("ISO boot image size verified"); + } else { + puts("ISO boot image size could not be verified"); ++ if (real_size < 0) { ++ return; ++ } + } + +- read_iso_boot_image(bswap32(s.load_rba), ++ if (read_iso_boot_image(bswap32(s.load_rba), + (void *)((uint64_t)bswap16(s.load_segment)), +- blks_to_load); ++ blks_to_load)) { ++ return; ++ } + + jump_to_low_kernel(); + } +@@ -809,17 +825,18 @@ static uint32_t find_iso_bc(void) + return bswap32(et->bc_offset); + } + } +- read_iso_sector(block_num++, sec, +- "Failed to read ISO volume descriptor"); ++ if (virtio_read(block_num++, sec)) { ++ puts("Failed to read ISO volume descriptor"); ++ return 0; ++ } + } + + return 0; + } + +-static IsoBcSection *find_iso_bc_entry(void) ++static IsoBcSection *find_iso_bc_entry(uint32_t offset) + { + IsoBcEntry *e = (IsoBcEntry *)sec; +- uint32_t offset = find_iso_bc(); + int i; + unsigned int loadparm = get_loadparm_index(); + +@@ -827,11 +844,13 @@ static IsoBcSection *find_iso_bc_entry(void) + return NULL; + } + +- read_iso_sector(offset, sec, "Failed to read El Torito boot catalog"); ++ if (virtio_read(offset, sec)) { ++ puts("Failed to read El Torito boot catalog"); ++ return NULL; ++ } + + if (!is_iso_bc_valid(e)) { + /* The validation entry is mandatory */ +- panic("No valid boot catalog found!\n"); + return NULL; + } + +@@ -851,19 +870,25 @@ static IsoBcSection *find_iso_bc_entry(void) + } + } + +- panic("No suitable boot entry found on ISO-9660 media!\n"); +- + return NULL; + } + +-static void ipl_iso_el_torito(void) ++static int ipl_iso_el_torito(void) + { +- IsoBcSection *s = find_iso_bc_entry(); ++ uint32_t offset = find_iso_bc(); ++ if (!offset) { ++ return 0; ++ } ++ ++ IsoBcSection *s = find_iso_bc_entry(offset); + + if (s) { +- load_iso_bc_entry(s); +- /* no return */ ++ load_iso_bc_entry(s); /* only return in error */ ++ return -1; + } ++ ++ puts("No suitable boot entry found on ISO-9660 media!"); ++ return -EIO; + } + + /** +@@ -893,7 +918,9 @@ static void zipl_load_vblk(void) + if (blksize != VIRTIO_ISO_BLOCK_SIZE) { + virtio_assume_iso9660(); + } +- ipl_iso_el_torito(); ++ if (ipl_iso_el_torito()) { ++ return; ++ } + } + + if (blksize != VIRTIO_DASD_DEFAULT_BLOCK_SIZE) { +@@ -907,7 +934,9 @@ static void zipl_load_vscsi(void) + { + if (virtio_get_block_size() == VIRTIO_ISO_BLOCK_SIZE) { + /* Is it an ISO image in non-CD drive? */ +- ipl_iso_el_torito(); ++ if (ipl_iso_el_torito()) { ++ return; ++ } + } + + puts("Using guessed DASD geometry."); +diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h +index 4a7d8a91f1..3cb573b86b 100644 +--- a/pc-bios/s390-ccw/bootmap.h ++++ b/pc-bios/s390-ccw/bootmap.h +@@ -385,17 +385,14 @@ static inline uint32_t iso_733_to_u32(uint64_t x) + + #define ISO_PRIMARY_VD_SECTOR 16 + +-static inline void read_iso_sector(uint32_t block_offset, void *buf, +- const char *errmsg) +-{ +- IPL_assert(virtio_read_many(block_offset, buf, 1) == 0, errmsg); +-} +- +-static inline void read_iso_boot_image(uint32_t block_offset, void *load_addr, ++static inline int read_iso_boot_image(uint32_t block_offset, void *load_addr, + uint32_t blks_to_load) + { +- IPL_assert(virtio_read_many(block_offset, load_addr, blks_to_load) == 0, +- "Failed to read boot image!"); ++ if (virtio_read_many(block_offset, load_addr, blks_to_load)) { ++ puts("Failed to read boot image!"); ++ return -1; ++ } ++ return 0; + } + + #define ISO9660_MAX_DIR_DEPTH 8 +diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h +index 6abb34e563..3e844abd71 100644 +--- a/pc-bios/s390-ccw/s390-ccw.h ++++ b/pc-bios/s390-ccw/s390-ccw.h +@@ -30,6 +30,7 @@ typedef unsigned long long u64; + #define EIO 1 + #define EBUSY 2 + #define ENODEV 3 ++#define EINVAL 4 + + #ifndef MIN + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch new file mode 100644 index 000000000..6507ce176 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch @@ -0,0 +1,130 @@ +From e572d55c45c5c84e386034b0f853476326a08197 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:45 -0400 +Subject: [PATCH 12/27] pc-bios/s390-ccw: Remove panics from Netboot IPL path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [12/23] dd193b7e37849dc338d66ac40786e22ff050ae20 (thuth/qemu-kvm-cs9) + +Remove panic-on-error from Netboot specific functions so that error recovery +may be possible in the future. + +Functions that would previously panic now provide a return code. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-12-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit f1a2a6e41ef76e02ddc5ede3dd042ef96b4fb8d2) +--- + pc-bios/s390-ccw/bootmap.c | 1 + + pc-bios/s390-ccw/netmain.c | 17 +++++++++++------ + pc-bios/s390-ccw/s390-ccw.h | 2 +- + pc-bios/s390-ccw/virtio-net.c | 7 +++++-- + 4 files changed, 18 insertions(+), 9 deletions(-) + +diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c +index 652807a16a..95ef9104d0 100644 +--- a/pc-bios/s390-ccw/bootmap.c ++++ b/pc-bios/s390-ccw/bootmap.c +@@ -1072,6 +1072,7 @@ void zipl_load(void) + + if (virtio_get_device_type() == VIRTIO_ID_NET) { + netmain(); ++ panic("\n! Cannot IPL from this network !\n"); + } + + if (ipl_scsi()) { +diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c +index bc6ad8695f..d1a6c9a91c 100644 +--- a/pc-bios/s390-ccw/netmain.c ++++ b/pc-bios/s390-ccw/netmain.c +@@ -464,7 +464,7 @@ static bool find_net_dev(Schib *schib, int dev_no) + return false; + } + +-static void virtio_setup(void) ++static bool virtio_setup(void) + { + Schib schib; + int ssid; +@@ -495,10 +495,10 @@ static void virtio_setup(void) + } + } + +- IPL_assert(found, "No virtio net device found"); ++ return found; + } + +-void netmain(void) ++int netmain(void) + { + filename_ip_t fn_ip; + int rc, fnlen; +@@ -506,11 +506,15 @@ void netmain(void) + sclp_setup(); + puts("Network boot starting..."); + +- virtio_setup(); ++ if (!virtio_setup()) { ++ puts("No virtio net device found."); ++ return -1; ++ } + + rc = net_init(&fn_ip); + if (rc) { +- panic("Network initialization failed. Halting."); ++ puts("Network initialization failed."); ++ return -1; + } + + fnlen = strlen(fn_ip.filename); +@@ -528,5 +532,6 @@ void netmain(void) + jump_to_low_kernel(); + } + +- panic("Failed to load OS from network."); ++ puts("Failed to load OS from network."); ++ return -1; + } +diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h +index 3e844abd71..344ad15655 100644 +--- a/pc-bios/s390-ccw/s390-ccw.h ++++ b/pc-bios/s390-ccw/s390-ccw.h +@@ -57,7 +57,7 @@ unsigned int get_loadparm_index(void); + void main(void); + + /* netmain.c */ +-void netmain(void); ++int netmain(void); + + /* sclp.c */ + void sclp_print(const char *string); +diff --git a/pc-bios/s390-ccw/virtio-net.c b/pc-bios/s390-ccw/virtio-net.c +index 2fcb0a58c5..f9854a22c3 100644 +--- a/pc-bios/s390-ccw/virtio-net.c ++++ b/pc-bios/s390-ccw/virtio-net.c +@@ -54,8 +54,11 @@ int virtio_net_init(void *mac_addr) + vdev->guest_features[0] = VIRTIO_NET_F_MAC_BIT; + virtio_setup_ccw(vdev); + +- IPL_assert(vdev->guest_features[0] & VIRTIO_NET_F_MAC_BIT, +- "virtio-net device does not support the MAC address feature"); ++ if (!(vdev->guest_features[0] & VIRTIO_NET_F_MAC_BIT)) { ++ puts("virtio-net device does not support the MAC address feature"); ++ return -1; ++ } ++ + memcpy(mac_addr, vdev->config.net.mac, ETH_ALEN); + + for (i = 0; i < 64; i++) { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch new file mode 100644 index 000000000..2d4fba44b --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch @@ -0,0 +1,554 @@ +From 23033a524625ad13448eda28d429d9265b213a7f Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:43 -0400 +Subject: [PATCH 10/27] pc-bios/s390-ccw: Remove panics from SCSI IPL path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [10/23] 4d8c58a0563e8977b045e7990deabe97c0614708 (thuth/qemu-kvm-cs9) + +Remove panic-on-error from virtio-scsi IPL specific functions so that error +recovery may be possible in the future. + +Functions that would previously panic now provide a return code. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-10-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit facd91ac1af75b657fc80189fe9cb026bb1abdbc) +--- + pc-bios/s390-ccw/bootmap.c | 88 ++++++++++++++----- + pc-bios/s390-ccw/virtio-blkdev.c | 4 +- + pc-bios/s390-ccw/virtio-scsi.c | 143 +++++++++++++++++++++---------- + 3 files changed, 164 insertions(+), 71 deletions(-) + +diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c +index b9596e28c7..652807a16a 100644 +--- a/pc-bios/s390-ccw/bootmap.c ++++ b/pc-bios/s390-ccw/bootmap.c +@@ -595,7 +595,7 @@ static int ipl_eckd(void) + * IPL a SCSI disk + */ + +-static void zipl_load_segment(ComponentEntry *entry) ++static int zipl_load_segment(ComponentEntry *entry) + { + const int max_entries = (MAX_SECTOR_SIZE / sizeof(ScsiBlockPtr)); + ScsiBlockPtr *bprs = (void *)sec; +@@ -615,7 +615,10 @@ static void zipl_load_segment(ComponentEntry *entry) + do { + memset(bprs, FREE_SPACE_FILLER, bprs_size); + fill_hex_val(blk_no, &blockno, sizeof(blockno)); +- read_block(blockno, bprs, err_msg); ++ if (virtio_read(blockno, bprs)) { ++ puts(err_msg); ++ return -EIO; ++ } + + for (i = 0;; i++) { + uint64_t *cur_desc = (void *)&bprs[i]; +@@ -643,23 +646,37 @@ static void zipl_load_segment(ComponentEntry *entry) + } + address = virtio_load_direct(cur_desc[0], cur_desc[1], 0, + (void *)address); +- IPL_assert(address != -1, "zIPL load segment failed"); ++ if (!address) { ++ puts("zIPL load segment failed"); ++ return -EIO; ++ } + } + } while (blockno); ++ ++ return 0; + } + + /* Run a zipl program */ +-static void zipl_run(ScsiBlockPtr *pte) ++static int zipl_run(ScsiBlockPtr *pte) + { + ComponentHeader *header; + ComponentEntry *entry; + uint8_t tmp_sec[MAX_SECTOR_SIZE]; + +- read_block(pte->blockno, tmp_sec, "Cannot read header"); ++ if (virtio_read(pte->blockno, tmp_sec)) { ++ puts("Cannot read header"); ++ return -EIO; ++ } + header = (ComponentHeader *)tmp_sec; + +- IPL_assert(magic_match(tmp_sec, ZIPL_MAGIC), "No zIPL magic in header"); +- IPL_assert(header->type == ZIPL_COMP_HEADER_IPL, "Bad header type"); ++ if (!magic_match(tmp_sec, ZIPL_MAGIC)) { ++ puts("No zIPL magic in header"); ++ return -EINVAL; ++ } ++ if (header->type != ZIPL_COMP_HEADER_IPL) { ++ puts("Bad header type"); ++ return -EINVAL; ++ } + + dputs("start loading images\n"); + +@@ -674,22 +691,30 @@ static void zipl_run(ScsiBlockPtr *pte) + continue; + } + +- zipl_load_segment(entry); ++ if (zipl_load_segment(entry)) { ++ return -1; ++ } + + entry++; + +- IPL_assert((uint8_t *)(&entry[1]) <= (tmp_sec + MAX_SECTOR_SIZE), +- "Wrong entry value"); ++ if ((uint8_t *)(&entry[1]) > (tmp_sec + MAX_SECTOR_SIZE)) { ++ puts("Wrong entry value"); ++ return -EINVAL; ++ } + } + +- IPL_assert(entry->component_type == ZIPL_COMP_ENTRY_EXEC, "No EXEC entry"); ++ if (entry->component_type != ZIPL_COMP_ENTRY_EXEC) { ++ puts("No EXEC entry"); ++ return -EINVAL; ++ } + + /* should not return */ + write_reset_psw(entry->compdat.load_psw); + jump_to_IPL_code(0); ++ return -1; + } + +-static void ipl_scsi(void) ++static int ipl_scsi(void) + { + ScsiMbr *mbr = (void *)sec; + int program_table_entries = 0; +@@ -700,10 +725,13 @@ static void ipl_scsi(void) + + /* Grab the MBR */ + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +- read_block(0, mbr, "Cannot read block 0"); ++ if (virtio_read(0, mbr)) { ++ puts("Cannot read block 0"); ++ return -EIO; ++ } + + if (!magic_match(mbr->magic, ZIPL_MAGIC)) { +- return; ++ return 0; + } + + puts("Using SCSI scheme."); +@@ -711,11 +739,20 @@ static void ipl_scsi(void) + IPL_check(mbr->version_id == 1, + "Unknown MBR layout version, assuming version 1"); + debug_print_int("program table", mbr->pt.blockno); +- IPL_assert(mbr->pt.blockno, "No Program Table"); ++ if (!mbr->pt.blockno) { ++ puts("No Program Table"); ++ return -EINVAL; ++ } + + /* Parse the program table */ +- read_block(mbr->pt.blockno, sec, "Error reading Program Table"); +- IPL_assert(magic_match(sec, ZIPL_MAGIC), "No zIPL magic in PT"); ++ if (virtio_read(mbr->pt.blockno, sec)) { ++ puts("Error reading Program Table"); ++ return -EIO; ++ } ++ if (!magic_match(sec, ZIPL_MAGIC)) { ++ puts("No zIPL magic in Program Table"); ++ return -EINVAL; ++ } + + for (i = 0; i < MAX_BOOT_ENTRIES; i++) { + if (prog_table->entry[i].scsi.blockno) { +@@ -725,17 +762,22 @@ static void ipl_scsi(void) + } + + debug_print_int("program table entries", program_table_entries); +- IPL_assert(program_table_entries != 0, "Empty Program Table"); ++ if (program_table_entries == 0) { ++ puts("Empty Program Table"); ++ return -EINVAL; ++ } + + if (menu_is_enabled_enum()) { + loadparm = menu_get_enum_boot_index(valid_entries); + } + + debug_print_int("loadparm", loadparm); +- IPL_assert(loadparm < MAX_BOOT_ENTRIES, "loadparm value greater than" +- " maximum number of boot entries allowed"); ++ if (loadparm >= MAX_BOOT_ENTRIES) { ++ puts("loadparm value greater than max number of boot entries allowed"); ++ return -EINVAL; ++ } + +- zipl_run(&prog_table->entry[loadparm].scsi); /* no return */ ++ return zipl_run(&prog_table->entry[loadparm].scsi); + } + + /*********************************************************************** +@@ -1032,7 +1074,9 @@ void zipl_load(void) + netmain(); + } + +- ipl_scsi(); ++ if (ipl_scsi()) { ++ panic("\n! Cannot IPL this SCSI device !\n"); ++ } + + switch (virtio_get_device_type()) { + case VIRTIO_ID_BLOCK: +diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c +index 2666326801..1c585f034b 100644 +--- a/pc-bios/s390-ccw/virtio-blkdev.c ++++ b/pc-bios/s390-ccw/virtio-blkdev.c +@@ -73,13 +73,13 @@ unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list + unsigned long addr = (unsigned long)load_addr; + + if (sec_len != virtio_get_block_size()) { +- return -1; ++ return 0; + } + + printf("."); + status = virtio_read_many(sec, (void *)addr, sec_num); + if (status) { +- panic("I/O Error"); ++ return 0; + } + addr += sec_num * virtio_get_block_size(); + +diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c +index 6b4a1caf8a..71db75ce7b 100644 +--- a/pc-bios/s390-ccw/virtio-scsi.c ++++ b/pc-bios/s390-ccw/virtio-scsi.c +@@ -26,7 +26,7 @@ static uint8_t scsi_inquiry_std_response[256]; + static ScsiInquiryEvpdPages scsi_inquiry_evpd_pages_response; + static ScsiInquiryEvpdBl scsi_inquiry_evpd_bl_response; + +-static inline void vs_assert(bool term, const char **msgs) ++static inline bool vs_assert(bool term, const char **msgs) + { + if (!term) { + int i = 0; +@@ -35,11 +35,13 @@ static inline void vs_assert(bool term, const char **msgs) + while (msgs[i]) { + printf("%s", msgs[i++]); + } +- panic(" !\n"); ++ puts(" !"); + } ++ ++ return term; + } + +-static void virtio_scsi_verify_response(VirtioScsiCmdResp *resp, ++static bool virtio_scsi_verify_response(VirtioScsiCmdResp *resp, + const char *title) + { + const char *mr[] = { +@@ -56,8 +58,8 @@ static void virtio_scsi_verify_response(VirtioScsiCmdResp *resp, + 0 + }; + +- vs_assert(resp->response == VIRTIO_SCSI_S_OK, mr); +- vs_assert(resp->status == CDB_STATUS_GOOD, ms); ++ return vs_assert(resp->response == VIRTIO_SCSI_S_OK, mr) && ++ vs_assert(resp->status == CDB_STATUS_GOOD, ms); + } + + static void prepare_request(VDev *vdev, const void *cdb, int cdb_size, +@@ -78,24 +80,31 @@ static void prepare_request(VDev *vdev, const void *cdb, int cdb_size, + } + } + +-static inline void vs_io_assert(bool term, const char *msg) ++static inline bool vs_io_assert(bool term, const char *msg) + { +- if (!term) { +- virtio_scsi_verify_response(&resp, msg); ++ if (!term && !virtio_scsi_verify_response(&resp, msg)) { ++ return false; + } ++ ++ return true; + } + +-static void vs_run(const char *title, VirtioCmd *cmd, VDev *vdev, ++static int vs_run(const char *title, VirtioCmd *cmd, VDev *vdev, + const void *cdb, int cdb_size, + void *data, uint32_t data_size) + { + prepare_request(vdev, cdb, cdb_size, data, data_size); +- vs_io_assert(virtio_run(vdev, VR_REQUEST, cmd) == 0, title); ++ if (!vs_io_assert(virtio_run(vdev, VR_REQUEST, cmd) == 0, title)) { ++ puts(title); ++ return -EIO; ++ } ++ ++ return 0; + } + + /* SCSI protocol implementation routines */ + +-static bool scsi_inquiry(VDev *vdev, uint8_t evpd, uint8_t page, ++static int scsi_inquiry(VDev *vdev, uint8_t evpd, uint8_t page, + void *data, uint32_t data_size) + { + ScsiCdbInquiry cdb = { +@@ -110,12 +119,13 @@ static bool scsi_inquiry(VDev *vdev, uint8_t evpd, uint8_t page, + { data, data_size, VRING_DESC_F_WRITE }, + }; + +- vs_run("inquiry", inquiry, vdev, &cdb, sizeof(cdb), data, data_size); ++ int ret = vs_run("inquiry", inquiry, ++ vdev, &cdb, sizeof(cdb), data, data_size); + +- return virtio_scsi_response_ok(&resp); ++ return ret ? ret : virtio_scsi_response_ok(&resp); + } + +-static bool scsi_test_unit_ready(VDev *vdev) ++static int scsi_test_unit_ready(VDev *vdev) + { + ScsiCdbTestUnitReady cdb = { + .command = 0x00, +@@ -131,7 +141,7 @@ static bool scsi_test_unit_ready(VDev *vdev) + return virtio_scsi_response_ok(&resp); + } + +-static bool scsi_report_luns(VDev *vdev, void *data, uint32_t data_size) ++static int scsi_report_luns(VDev *vdev, void *data, uint32_t data_size) + { + ScsiCdbReportLuns cdb = { + .command = 0xa0, +@@ -144,13 +154,13 @@ static bool scsi_report_luns(VDev *vdev, void *data, uint32_t data_size) + { data, data_size, VRING_DESC_F_WRITE }, + }; + +- vs_run("report luns", report_luns, ++ int ret = vs_run("report luns", report_luns, + vdev, &cdb, sizeof(cdb), data, data_size); + +- return virtio_scsi_response_ok(&resp); ++ return ret ? ret : virtio_scsi_response_ok(&resp); + } + +-static bool scsi_read_10(VDev *vdev, ++static int scsi_read_10(VDev *vdev, + unsigned long sector, int sectors, void *data, + unsigned int data_size) + { +@@ -168,12 +178,13 @@ static bool scsi_read_10(VDev *vdev, + debug_print_int("read_10 sector", sector); + debug_print_int("read_10 sectors", sectors); + +- vs_run("read(10)", read_10, vdev, &cdb, sizeof(cdb), data, data_size); ++ int ret = vs_run("read(10)", read_10, ++ vdev, &cdb, sizeof(cdb), data, data_size); + +- return virtio_scsi_response_ok(&resp); ++ return ret ? ret : virtio_scsi_response_ok(&resp); + } + +-static bool scsi_read_capacity(VDev *vdev, ++static int scsi_read_capacity(VDev *vdev, + void *data, uint32_t data_size) + { + ScsiCdbReadCapacity16 cdb = { +@@ -187,10 +198,10 @@ static bool scsi_read_capacity(VDev *vdev, + { data, data_size, VRING_DESC_F_WRITE }, + }; + +- vs_run("read capacity", read_capacity_16, ++ int ret = vs_run("read capacity", read_capacity_16, + vdev, &cdb, sizeof(cdb), data, data_size); + +- return virtio_scsi_response_ok(&resp); ++ return ret ? ret : virtio_scsi_response_ok(&resp); + } + + /* virtio-scsi routines */ +@@ -207,7 +218,7 @@ static int virtio_scsi_locate_device(VDev *vdev) + static uint8_t data[16 + 8 * 63]; + ScsiLunReport *r = (void *) data; + ScsiDevice *sdev = vdev->scsi_device; +- int i, luns; ++ int i, ret, luns; + + /* QEMU has hardcoded channel #0 in many places. + * If this hardcoded value is ever changed, we'll need to add code for +@@ -233,13 +244,21 @@ static int virtio_scsi_locate_device(VDev *vdev) + sdev->channel = channel; + sdev->target = target; + sdev->lun = 0; /* LUN has to be 0 for REPORT LUNS */ +- if (!scsi_report_luns(vdev, data, sizeof(data))) { ++ ret = scsi_report_luns(vdev, data, sizeof(data)); ++ if (ret < 0) { ++ return ret; ++ } ++ ++ else if (ret == 0) { + if (resp.response == VIRTIO_SCSI_S_BAD_TARGET) { + continue; + } + printf("target 0x%X\n", target); +- virtio_scsi_verify_response(&resp, "SCSI cannot report LUNs"); ++ if (!virtio_scsi_verify_response(&resp, "SCSI cannot report LUNs")) { ++ return -EIO; ++ } + } ++ + if (r->lun_list_len == 0) { + printf("no LUNs for target 0x%X\n", target); + continue; +@@ -283,7 +302,9 @@ int virtio_scsi_read_many(VDev *vdev, + data_size = sector_count * virtio_get_block_size() * f; + if (!scsi_read_10(vdev, sector * f, sector_count * f, load_addr, + data_size)) { +- virtio_scsi_verify_response(&resp, "virtio-scsi:read_many"); ++ if (!virtio_scsi_verify_response(&resp, "virtio-scsi:read_many")) { ++ return -1; ++ } + } + load_addr += data_size; + sector += sector_count; +@@ -352,11 +373,16 @@ static int virtio_scsi_setup(VDev *vdev) + uint8_t code = resp.sense[0] & SCSI_SENSE_CODE_MASK; + uint8_t sense_key = resp.sense[2] & SCSI_SENSE_KEY_MASK; + +- IPL_assert(resp.sense_len != 0, "virtio-scsi:setup: no SENSE data"); ++ if (resp.sense_len == 0) { ++ puts("virtio-scsi: setup: no SENSE data"); ++ return -EINVAL; ++ } + +- IPL_assert(retry_test_unit_ready && code == 0x70 && +- sense_key == SCSI_SENSE_KEY_UNIT_ATTENTION, +- "virtio-scsi:setup: cannot retry"); ++ if (!retry_test_unit_ready || code != 0x70 || ++ sense_key != SCSI_SENSE_KEY_UNIT_ATTENTION) { ++ puts("virtio-scsi:setup: cannot retry"); ++ return -EIO; ++ } + + /* retry on CHECK_CONDITION/UNIT_ATTENTION as it + * may not designate a real error, but it may be +@@ -367,16 +393,22 @@ static int virtio_scsi_setup(VDev *vdev) + continue; + } + +- virtio_scsi_verify_response(&resp, "virtio-scsi:setup"); ++ if (!virtio_scsi_verify_response(&resp, "virtio-scsi:setup")) { ++ return -1; ++ } + } + + /* read and cache SCSI INQUIRY response */ +- if (!scsi_inquiry(vdev, ++ ret = scsi_inquiry(vdev, + SCSI_INQUIRY_STANDARD, + SCSI_INQUIRY_STANDARD_NONE, + scsi_inquiry_std_response, +- sizeof(scsi_inquiry_std_response))) { +- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:inquiry"); ++ sizeof(scsi_inquiry_std_response)); ++ if (ret < 1) { ++ if (ret != 0 || !virtio_scsi_verify_response(&resp, ++ "virtio-scsi:setup:inquiry")) { ++ return -1; ++ } + } + + if (virtio_scsi_inquiry_response_is_cdrom(scsi_inquiry_std_response)) { +@@ -385,12 +417,16 @@ static int virtio_scsi_setup(VDev *vdev) + vdev->scsi_block_size = VIRTIO_ISO_BLOCK_SIZE; + } + +- if (!scsi_inquiry(vdev, ++ ret = scsi_inquiry(vdev, + SCSI_INQUIRY_EVPD, + SCSI_INQUIRY_EVPD_SUPPORTED_PAGES, + evpd, +- sizeof(*evpd))) { +- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:supported_pages"); ++ sizeof(*evpd)); ++ if (ret < 1) { ++ if (ret != 0 || !virtio_scsi_verify_response(&resp, ++ "virtio-scsi:setup:supported_pages")) { ++ return -1; ++ } + } + + debug_print_int("EVPD length", evpd->page_length); +@@ -402,12 +438,16 @@ static int virtio_scsi_setup(VDev *vdev) + continue; + } + +- if (!scsi_inquiry(vdev, ++ ret = scsi_inquiry(vdev, + SCSI_INQUIRY_EVPD, + SCSI_INQUIRY_EVPD_BLOCK_LIMITS, + evpd_bl, +- sizeof(*evpd_bl))) { +- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:blocklimits"); ++ sizeof(*evpd_bl)); ++ if (ret < 1) { ++ if (ret != 0 || !virtio_scsi_verify_response(&resp, ++ "virtio-scsi:setup:blocklimits")) { ++ return -1; ++ } + } + + debug_print_int("max transfer", evpd_bl->max_transfer); +@@ -423,8 +463,12 @@ static int virtio_scsi_setup(VDev *vdev) + vdev->max_transfer = MIN_NON_ZERO(VIRTIO_SCSI_MAX_SECTORS, + vdev->max_transfer); + +- if (!scsi_read_capacity(vdev, data, data_size)) { +- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:read_capacity"); ++ ret = scsi_read_capacity(vdev, data, data_size); ++ if (ret < 1) { ++ if (ret != 0 || !virtio_scsi_verify_response(&resp, ++ "virtio-scsi:setup:read_capacity")) { ++ return -1; ++ } + } + scsi_parse_capacity_report(data, &vdev->scsi_last_block, + (uint32_t *) &vdev->scsi_block_size); +@@ -439,10 +483,15 @@ int virtio_scsi_setup_device(SubChannelId schid) + vdev->schid = schid; + virtio_setup_ccw(vdev); + +- IPL_assert(vdev->config.scsi.sense_size == VIRTIO_SCSI_SENSE_SIZE, +- "Config: sense size mismatch"); +- IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE, +- "Config: CDB size mismatch"); ++ if (vdev->config.scsi.sense_size != VIRTIO_SCSI_SENSE_SIZE) { ++ puts("Config: sense size mismatch"); ++ return -EINVAL; ++ } ++ ++ if (vdev->config.scsi.cdb_size != VIRTIO_SCSI_CDB_SIZE) { ++ puts("Config: CDB size mismatch"); ++ return -EINVAL; ++ } + + puts("Using virtio-scsi."); + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch new file mode 100644 index 000000000..037d9876f --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch @@ -0,0 +1,1208 @@ +From 4207901122ef7ad3f08ed2e387bd133cc4a35baf Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:36 -0400 +Subject: [PATCH 02/27] pc-bios/s390-ccw: Use the libc from SLOF and remove + sclp prints +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [2/23] ee701f93051e2bfb79da5cbbd089b24490bca128 (thuth/qemu-kvm-cs9) + +We are already using the libc from SLOF for the s390-netboot.img, and +this libc implementation is way more complete and accurate than the +simple implementation that we currently use for the s390-ccw.img binary. +Since we are now always assuming that the SLOF submodule is available +when building the s390-ccw bios (see commit bf6903f6944f), we can drop +the simple implementation and use the SLOF libc for the s390-ccw.img +binary, too. + +Additionally replace sclp_print calls with puts/printf now that it is +available. + +Co-authored by: Thomas Huth +Signed-off-by: Jared Rossi +Message-ID: <20241020012953.1380075-3-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 9f4278837dc770266c8a026696dd91a525dd2682) +--- + pc-bios/s390-ccw/Makefile | 15 +++-- + pc-bios/s390-ccw/bootmap.c | 47 ++++++------- + pc-bios/s390-ccw/bootmap.h | 4 +- + pc-bios/s390-ccw/cio.c | 78 ++++++++++------------ + pc-bios/s390-ccw/dasd-ipl.c | 5 +- + pc-bios/s390-ccw/jump2ipl.c | 5 +- + pc-bios/s390-ccw/libc.c | 88 ------------------------ + pc-bios/s390-ccw/libc.h | 89 ------------------------- + pc-bios/s390-ccw/main.c | 14 ++-- + pc-bios/s390-ccw/menu.c | 51 +++++++------- + pc-bios/s390-ccw/netboot.mak | 3 - + pc-bios/s390-ccw/netmain.c | 10 +-- + pc-bios/s390-ccw/s390-ccw.h | 30 +++------ + pc-bios/s390-ccw/sclp.c | 7 +- + pc-bios/s390-ccw/virtio-blkdev.c | 6 +- + pc-bios/s390-ccw/virtio-scsi.c | 17 ++--- + pc-bios/s390-ccw/virtio.c | 2 +- + tests/tcg/s390x/Makefile.softmmu-target | 2 +- + tests/tcg/s390x/console.c | 3 + + 19 files changed, 140 insertions(+), 336 deletions(-) + delete mode 100644 pc-bios/s390-ccw/libc.c + delete mode 100644 pc-bios/s390-ccw/libc.h + +diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile +index 6207911b53..3f4232636e 100644 +--- a/pc-bios/s390-ccw/Makefile ++++ b/pc-bios/s390-ccw/Makefile +@@ -33,13 +33,18 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d + .PHONY : all clean build-all distclean + + OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ +- virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o ++ virtio.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o ++ ++SLOF_DIR := $(SRC_PATH)/../../roms/SLOF ++ ++LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include + + EXTRA_CFLAGS += -Wall + EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE + EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables + EXTRA_CFLAGS += -msoft-float + EXTRA_CFLAGS += -std=gnu99 ++EXTRA_CFLAGS += $(LIBC_INC) + LDFLAGS += -Wl,-pie -nostdlib -z noexecstack + + cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null +@@ -55,18 +60,18 @@ config-cc.mak: Makefile + $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak + -include config-cc.mak + ++include $(SRC_PATH)/netboot.mak ++ + build-all: s390-ccw.img s390-netboot.img + +-s390-ccw.elf: $(OBJECTS) +- $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking) ++s390-ccw.elf: $(OBJECTS) libc.a ++ $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking) + + s390-ccw.img: s390-ccw.elf + $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into) + + $(OBJECTS): Makefile + +-include $(SRC_PATH)/netboot.mak +- + ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS)) + -include $(ALL_OBJS:%.o=%.d) + +diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c +index a2137449dc..3cc79706be 100644 +--- a/pc-bios/s390-ccw/bootmap.c ++++ b/pc-bios/s390-ccw/bootmap.c +@@ -8,7 +8,8 @@ + * directory. + */ + +-#include "libc.h" ++#include ++#include + #include "s390-ccw.h" + #include "s390-arch.h" + #include "bootmap.h" +@@ -21,7 +22,7 @@ + + #ifdef DEBUG_FALLBACK + #define dputs(txt) \ +- do { sclp_print("zipl: " txt); } while (0) ++ do { printf("zipl: " txt); } while (0) + #else + #define dputs(fmt, ...) \ + do { } while (0) +@@ -270,7 +271,7 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) + prev_block_nr = cur_block_nr; + } + +- sclp_print("No zipl boot menu data found. Booting default entry."); ++ printf("No zipl boot menu data found. Booting default entry."); + return 0; + } + +@@ -338,22 +339,22 @@ static void ipl_eckd_cdl(void) + block_number_t bmt_block_nr, s1b_block_nr; + + /* we have just read the block #0 and recognized it as "IPL1" */ +- sclp_print("CDL\n"); ++ puts("CDL"); + + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); + read_block(1, ipl2, "Cannot read IPL2 record at block 1"); + + mbr = &ipl2->mbr; + if (!magic_match(mbr, ZIPL_MAGIC)) { +- sclp_print("No zIPL section in IPL2 record.\n"); ++ puts("No zIPL section in IPL2 record."); + return; + } + if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) { +- sclp_print("Bad block size in zIPL section of IPL2 record.\n"); ++ puts("Bad block size in zIPL section of IPL2 record."); + return; + } + if (mbr->dev_type != DEV_TYPE_ECKD) { +- sclp_print("Non-ECKD device type in zIPL section of IPL2 record.\n"); ++ puts("Non-ECKD device type in zIPL section of IPL2 record."); + return; + } + +@@ -366,11 +367,11 @@ static void ipl_eckd_cdl(void) + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); + read_block(2, vlbl, "Cannot read Volume Label at block 2"); + if (!magic_match(vlbl->key, VOL1_MAGIC)) { +- sclp_print("Invalid magic of volume label block.\n"); ++ puts("Invalid magic of volume label block."); + return; + } + if (!magic_match(vlbl->f.key, VOL1_MAGIC)) { +- sclp_print("Invalid magic of volser block.\n"); ++ puts("Invalid magic of volser block."); + return; + } + print_volser(vlbl->f.volser); +@@ -384,8 +385,8 @@ static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) + LDL_VTOC *vlbl = (void *)sec; /* already read, 3rd block */ + char msg[4] = { '?', '.', '\n', '\0' }; + +- sclp_print((mode == ECKD_CMS) ? "CMS" : "LDL"); +- sclp_print(" version "); ++ printf((mode == ECKD_CMS) ? "CMS" : "LDL"); ++ printf(" version "); + switch (vlbl->LDL_version) { + case LDL1_VERSION: + msg[0] = '1'; +@@ -398,7 +399,7 @@ static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) + msg[1] = '?'; + break; + } +- sclp_print(msg); ++ printf("%s", msg); + print_volser(vlbl->volser); + } + +@@ -419,7 +420,7 @@ static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) + if (!magic_match(ipl1->bip.magic, ZIPL_MAGIC)) { + return; /* not applicable layout */ + } +- sclp_print("unlabeled LDL.\n"); ++ puts("unlabeled LDL."); + } + verify_boot_info(&ipl1->bip); + +@@ -466,7 +467,7 @@ static void print_eckd_msg(void) + *p-- = ' '; + } + } +- sclp_print(msg); ++ printf("%s", msg); + } + + static void ipl_eckd(void) +@@ -488,11 +489,11 @@ static void ipl_eckd(void) + if (eckd_valid_address((ExtEckdBlockPtr *)&vlbl->f.br, 0)) { + ldipl_bmt = eckd_find_bmt((ExtEckdBlockPtr *)&vlbl->f.br); + if (ldipl_bmt) { +- sclp_print("List-Directed\n"); ++ puts("List-Directed"); + /* LD-IPL does not use the S1B bock, just make it NULL */ + run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR); + /* Only return in error, retry as CCW-IPL */ +- sclp_print("Retrying IPL "); ++ printf("Retrying IPL "); + print_eckd_msg(); + } + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); +@@ -634,7 +635,7 @@ static void ipl_scsi(void) + return; + } + +- sclp_print("Using SCSI scheme.\n"); ++ puts("Using SCSI scheme."); + debug_print_int("MBR Version", mbr->version_id); + IPL_check(mbr->version_id == 1, + "Unknown MBR layout version, assuming version 1"); +@@ -743,7 +744,7 @@ static inline uint32_t iso_get_file_size(uint32_t load_rba) + if (cur_record->file_flags & 0x2) { + /* Subdirectory */ + if (level == ISO9660_MAX_DIR_DEPTH - 1) { +- sclp_print("ISO-9660 directory depth limit exceeded\n"); ++ puts("ISO-9660 directory depth limit exceeded"); + } else { + level++; + sec_loc[level] = iso_733_to_u32(cur_record->ext_loc); +@@ -778,9 +779,9 @@ static void load_iso_bc_entry(IsoBcSection *load) + if (real_size) { + /* Round up blocks to load */ + blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE; +- sclp_print("ISO boot image size verified\n"); ++ puts("ISO boot image size verified"); + } else { +- sclp_print("ISO boot image size could not be verified\n"); ++ puts("ISO boot image size could not be verified"); + } + + read_iso_boot_image(bswap32(s.load_rba), +@@ -896,7 +897,7 @@ static void zipl_load_vblk(void) + } + + if (blksize != VIRTIO_DASD_DEFAULT_BLOCK_SIZE) { +- sclp_print("Using guessed DASD geometry.\n"); ++ puts("Using guessed DASD geometry."); + virtio_assume_eckd(); + } + ipl_eckd(); +@@ -909,7 +910,7 @@ static void zipl_load_vscsi(void) + ipl_iso_el_torito(); + } + +- sclp_print("Using guessed DASD geometry.\n"); ++ puts("Using guessed DASD geometry."); + virtio_assume_eckd(); + ipl_eckd(); + } +@@ -944,5 +945,5 @@ void zipl_load(void) + panic("\n! Unknown IPL device type !\n"); + } + +- sclp_print("zIPL load failed.\n"); ++ puts("zIPL load failed."); + } +diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h +index d4690a88c2..4a7d8a91f1 100644 +--- a/pc-bios/s390-ccw/bootmap.h ++++ b/pc-bios/s390-ccw/bootmap.h +@@ -336,9 +336,7 @@ static inline void print_volser(const void *volser) + + ebcdic_to_ascii((char *)volser, ascii, 6); + ascii[6] = '\0'; +- sclp_print("VOLSER=["); +- sclp_print(ascii); +- sclp_print("]\n"); ++ printf("VOLSER=[%s]\n", ascii); + } + + static inline bool unused_space(const void *p, size_t size) +diff --git a/pc-bios/s390-ccw/cio.c b/pc-bios/s390-ccw/cio.c +index 83ca27ab41..7b09a38c96 100644 +--- a/pc-bios/s390-ccw/cio.c ++++ b/pc-bios/s390-ccw/cio.c +@@ -11,7 +11,8 @@ + * directory. + */ + +-#include "libc.h" ++#include ++#include + #include "s390-ccw.h" + #include "s390-arch.h" + #include "helper.h" +@@ -90,9 +91,9 @@ static void print_eckd_dasd_sense_data(SenseDataEckdDasd *sd) + char msgline[512]; + + if (sd->config_info & 0x8000) { +- sclp_print("Eckd Dasd Sense Data (fmt 24-bytes):\n"); ++ puts("Eckd Dasd Sense Data (fmt 24-bytes):"); + } else { +- sclp_print("Eckd Dasd Sense Data (fmt 32-bytes):\n"); ++ puts("Eckd Dasd Sense Data (fmt 32-bytes):"); + } + + strcat(msgline, " Sense Condition Flags :"); +@@ -158,22 +159,21 @@ static void print_eckd_dasd_sense_data(SenseDataEckdDasd *sd) + if (sd->status[1] & SNS_STAT2_IMPRECISE_END) { + strcat(msgline, " [Imprecise-End]"); + } +- strcat(msgline, "\n"); +- sclp_print(msgline); +- +- print_int(" Residual Count =", sd->res_count); +- print_int(" Phys Drive ID =", sd->phys_drive_id); +- print_int(" low cyl address =", sd->low_cyl_addr); +- print_int(" head addr & hi cyl =", sd->head_high_cyl_addr); +- print_int(" format/message =", sd->fmt_msg); +- print_int(" fmt-dependent[0-7] =", sd->fmt_dependent_info[0]); +- print_int(" fmt-dependent[8-15]=", sd->fmt_dependent_info[1]); +- print_int(" prog action code =", sd->program_action_code); +- print_int(" Configuration info =", sd->config_info); +- print_int(" mcode / hi-cyl =", sd->mcode_hicyl); +- print_int(" cyl & head addr [0]=", sd->cyl_head_addr[0]); +- print_int(" cyl & head addr [1]=", sd->cyl_head_addr[1]); +- print_int(" cyl & head addr [2]=", sd->cyl_head_addr[2]); ++ puts(msgline); ++ ++ printf(" Residual Count = 0x%X\n", sd->res_count); ++ printf(" Phys Drive ID = 0x%X\n", sd->phys_drive_id); ++ printf(" low cyl address = 0x%X\n", sd->low_cyl_addr); ++ printf(" head addr & hi cyl = 0x%X\n", sd->head_high_cyl_addr); ++ printf(" format/message = 0x%X\n", sd->fmt_msg); ++ printf(" fmt-dependent[0-7] = 0x%llX\n", sd->fmt_dependent_info[0]); ++ printf(" fmt-dependent[8-15]= 0x%llX\n", sd->fmt_dependent_info[1]); ++ printf(" prog action code = 0x%X\n", sd->program_action_code); ++ printf(" Configuration info = 0x%X\n", sd->config_info); ++ printf(" mcode / hi-cyl = 0x%X\n", sd->mcode_hicyl); ++ printf(" cyl & head addr [0]= 0x%X\n", sd->cyl_head_addr[0]); ++ printf(" cyl & head addr [1]= 0x%X\n", sd->cyl_head_addr[1]); ++ printf(" cyl & head addr [2]= 0x%X\n", sd->cyl_head_addr[2]); + } + + static void print_irb_err(Irb *irb) +@@ -182,7 +182,7 @@ static void print_irb_err(Irb *irb) + uint64_t prev_ccw = *(uint64_t *)u32toptr(irb->scsw.cpa - 8); + char msgline[256]; + +- sclp_print("Interrupt Response Block Data:\n"); ++ puts("Interrupt Response Block Data:"); + + strcat(msgline, " Function Ctrl :"); + if (irb->scsw.ctrl & SCSW_FCTL_START_FUNC) { +@@ -194,8 +194,7 @@ static void print_irb_err(Irb *irb) + if (irb->scsw.ctrl & SCSW_FCTL_CLEAR_FUNC) { + strcat(msgline, " [Clear]"); + } +- strcat(msgline, "\n"); +- sclp_print(msgline); ++ puts(msgline); + + msgline[0] = '\0'; + strcat(msgline, " Activity Ctrl :"); +@@ -220,8 +219,7 @@ static void print_irb_err(Irb *irb) + if (irb->scsw.ctrl & SCSW_ACTL_SUSPENDED) { + strcat(msgline, " [Suspended]"); + } +- strcat(msgline, "\n"); +- sclp_print(msgline); ++ puts(msgline); + + msgline[0] = '\0'; + strcat(msgline, " Status Ctrl :"); +@@ -240,9 +238,7 @@ static void print_irb_err(Irb *irb) + if (irb->scsw.ctrl & SCSW_SCTL_STATUS_PEND) { + strcat(msgline, " [Status-Pending]"); + } +- +- strcat(msgline, "\n"); +- sclp_print(msgline); ++ puts(msgline); + + msgline[0] = '\0'; + strcat(msgline, " Device Status :"); +@@ -270,8 +266,7 @@ static void print_irb_err(Irb *irb) + if (irb->scsw.dstat & SCSW_DSTAT_UEXCP) { + strcat(msgline, " [Unit-Exception]"); + } +- strcat(msgline, "\n"); +- sclp_print(msgline); ++ puts(msgline); + + msgline[0] = '\0'; + strcat(msgline, " Channel Status :"); +@@ -299,12 +294,11 @@ static void print_irb_err(Irb *irb) + if (irb->scsw.cstat & SCSW_CSTAT_CHAINCHK) { + strcat(msgline, " [Chaining-Check]"); + } +- strcat(msgline, "\n"); +- sclp_print(msgline); ++ puts(msgline); + +- print_int(" cpa=", irb->scsw.cpa); +- print_int(" prev_ccw=", prev_ccw); +- print_int(" this_ccw=", this_ccw); ++ printf(" cpa= 0x%X\n", irb->scsw.cpa); ++ printf(" prev_ccw= 0x%llX\n", prev_ccw); ++ printf(" this_ccw= 0x%llX\n", this_ccw); + } + + /* +@@ -341,7 +335,7 @@ static int __do_cio(SubChannelId schid, uint32_t ccw_addr, int fmt, Irb *irb) + return -1; + } + if (rc) { +- print_int("ssch failed with cc=", rc); ++ printf("ssch failed with cc= 0x%x\n", rc); + return rc; + } + +@@ -350,7 +344,7 @@ static int __do_cio(SubChannelId schid, uint32_t ccw_addr, int fmt, Irb *irb) + /* collect status */ + rc = tsch(schid, irb); + if (rc) { +- print_int("tsch failed with cc=", rc); ++ printf("tsch failed with cc= 0x%X\n", rc); + } + + return rc; +@@ -406,12 +400,12 @@ int do_cio(SubChannelId schid, uint16_t cutype, uint32_t ccw_addr, int fmt) + continue; + } + +- sclp_print("cio device error\n"); +- print_int(" ssid ", schid.ssid); +- print_int(" cssid ", schid.cssid); +- print_int(" sch_no", schid.sch_no); +- print_int(" ctrl-unit type", cutype); +- sclp_print("\n"); ++ printf("cio device error\n"); ++ printf(" ssid 0x%X\n", schid.ssid); ++ printf(" cssid 0x%X\n", schid.cssid); ++ printf(" sch_no 0x%X\n", schid.sch_no); ++ printf(" ctrl-unit type 0x%X\n", cutype); ++ printf("\n"); + print_irb_err(&irb); + if (cutype == CU_TYPE_DASD_3990 || cutype == CU_TYPE_DASD_2107 || + cutype == CU_TYPE_UNKNOWN) { +diff --git a/pc-bios/s390-ccw/dasd-ipl.c b/pc-bios/s390-ccw/dasd-ipl.c +index 254bb1a15e..ae751adec1 100644 +--- a/pc-bios/s390-ccw/dasd-ipl.c ++++ b/pc-bios/s390-ccw/dasd-ipl.c +@@ -8,7 +8,8 @@ + * directory. + */ + +-#include "libc.h" ++#include ++#include + #include "s390-ccw.h" + #include "s390-arch.h" + #include "dasd-ipl.h" +@@ -82,7 +83,7 @@ static int run_dynamic_ccw_program(SubChannelId schid, uint16_t cutype, + do { + has_next = dynamic_cp_fixup(cpa, &next_cpa); + +- print_int("executing ccw chain at ", cpa); ++ printf("executing ccw chain at 0x%X\n", cpa); + enable_prefixing(); + rc = do_cio(schid, cutype, cpa, CCW_FMT0); + disable_prefixing(); +diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c +index 78f5f46533..80b7f6a1f3 100644 +--- a/pc-bios/s390-ccw/jump2ipl.c ++++ b/pc-bios/s390-ccw/jump2ipl.c +@@ -6,7 +6,8 @@ + * directory. + */ + +-#include "libc.h" ++#include ++#include + #include "s390-ccw.h" + #include "s390-arch.h" + +@@ -57,7 +58,7 @@ void jump_to_IPL_code(uint64_t address) + debug_print_int("set IPL addr to", address ?: *reset_psw & PSW_MASK_SHORT_ADDR); + + /* Ensure the guest output starts fresh */ +- sclp_print("\n"); ++ printf("\n"); + + /* + * HACK ALERT. +diff --git a/pc-bios/s390-ccw/libc.c b/pc-bios/s390-ccw/libc.c +deleted file mode 100644 +index 3187923950..0000000000 +--- a/pc-bios/s390-ccw/libc.c ++++ /dev/null +@@ -1,88 +0,0 @@ +-/* +- * libc-style definitions and functions +- * +- * Copyright 2018 IBM Corp. +- * Author(s): Collin L. Walling +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License as published by the +- * Free Software Foundation; either version 2 of the License, or (at your +- * option) any later version. +- */ +- +-#include "libc.h" +-#include "s390-ccw.h" +- +-/** +- * atoui: +- * @str: the string to be converted. +- * +- * Given a string @str, convert it to an integer. Leading spaces are +- * ignored. Any other non-numerical value will terminate the conversion +- * and return 0. This function only handles numbers between 0 and +- * UINT64_MAX inclusive. +- * +- * Returns: an integer converted from the string @str, or the number 0 +- * if an error occurred. +- */ +-uint64_t atoui(const char *str) +-{ +- int val = 0; +- +- if (!str || !str[0]) { +- return 0; +- } +- +- while (*str == ' ') { +- str++; +- } +- +- while (*str) { +- if (!isdigit(*(unsigned char *)str)) { +- break; +- } +- val = val * 10 + *str - '0'; +- str++; +- } +- +- return val; +-} +- +-/** +- * uitoa: +- * @num: an integer (base 10) to be converted. +- * @str: a pointer to a string to store the conversion. +- * @len: the length of the passed string. +- * +- * Given an integer @num, convert it to a string. The string @str must be +- * allocated beforehand. The resulting string will be null terminated and +- * returned. This function only handles numbers between 0 and UINT64_MAX +- * inclusive. +- * +- * Returns: the string @str of the converted integer @num +- */ +-char *uitoa(uint64_t num, char *str, size_t len) +-{ +- long num_idx = 1; /* account for NUL */ +- uint64_t tmp = num; +- +- IPL_assert(str != NULL, "uitoa: no space allocated to store string"); +- +- /* Count indices of num */ +- while ((tmp /= 10) != 0) { +- num_idx++; +- } +- +- /* Check if we have enough space for num and NUL */ +- IPL_assert(len > num_idx, "uitoa: array too small for conversion"); +- +- str[num_idx--] = '\0'; +- +- /* Convert int to string */ +- while (num_idx >= 0) { +- str[num_idx--] = num % 10 + '0'; +- num /= 10; +- } +- +- return str; +-} +diff --git a/pc-bios/s390-ccw/libc.h b/pc-bios/s390-ccw/libc.h +deleted file mode 100644 +index bcdc45732d..0000000000 +--- a/pc-bios/s390-ccw/libc.h ++++ /dev/null +@@ -1,89 +0,0 @@ +-/* +- * libc-style definitions and functions +- * +- * Copyright (c) 2013 Alexander Graf +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License as published by the +- * Free Software Foundation; either version 2 of the License, or (at your +- * option) any later version. +- */ +- +-#ifndef S390_CCW_LIBC_H +-#define S390_CCW_LIBC_H +- +-typedef unsigned long size_t; +-typedef int bool; +-typedef unsigned char uint8_t; +-typedef unsigned short uint16_t; +-typedef unsigned int uint32_t; +-typedef unsigned long long uint64_t; +- +-static inline void *memset(void *s, int c, size_t n) +-{ +- size_t i; +- unsigned char *p = s; +- +- for (i = 0; i < n; i++) { +- p[i] = c; +- } +- +- return s; +-} +- +-static inline void *memcpy(void *s1, const void *s2, size_t n) +-{ +- uint8_t *dest = s1; +- const uint8_t *src = s2; +- size_t i; +- +- for (i = 0; i < n; i++) { +- dest[i] = src[i]; +- } +- +- return s1; +-} +- +-static inline int memcmp(const void *s1, const void *s2, size_t n) +-{ +- size_t i; +- const uint8_t *p1 = s1, *p2 = s2; +- +- for (i = 0; i < n; i++) { +- if (p1[i] != p2[i]) { +- return p1[i] > p2[i] ? 1 : -1; +- } +- } +- +- return 0; +-} +- +-static inline size_t strlen(const char *str) +-{ +- size_t i; +- for (i = 0; *str; i++) { +- str++; +- } +- return i; +-} +- +-static inline char *strcat(char *dest, const char *src) +-{ +- int i; +- char *dest_end = dest + strlen(dest); +- +- for (i = 0; i <= strlen(src); i++) { +- dest_end[i] = src[i]; +- } +- return dest; +-} +- +-static inline int isdigit(int c) +-{ +- return (c >= '0') && (c <= '9'); +-} +- +-uint64_t atoui(const char *str); +-char *uitoa(uint64_t num, char *str, size_t len); +- +-#endif +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index 5506798098..203df20965 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -8,7 +8,9 @@ + * directory. + */ + +-#include "libc.h" ++#include ++#include ++#include + #include "helper.h" + #include "s390-arch.h" + #include "s390-ccw.h" +@@ -50,7 +52,7 @@ void write_iplb_location(void) + + unsigned int get_loadparm_index(void) + { +- return atoui(loadparm_str); ++ return atoi(loadparm_str); + } + + static int is_dev_possibly_bootable(int dev_no, int sch_no) +@@ -176,7 +178,7 @@ static void boot_setup(void) + + sclp_get_loadparm_ascii(loadparm_str); + memcpy(lpmsg + 10, loadparm_str, 8); +- sclp_print(lpmsg); ++ puts(lpmsg); + + /* + * Clear out any potential S390EP magic (see jump_to_low_kernel()), +@@ -228,7 +230,7 @@ static int virtio_setup(void) + + switch (vdev->senseid.cu_model) { + case VIRTIO_ID_NET: +- sclp_print("Network boot device detected\n"); ++ puts("Network boot device detected"); + vdev->netboot_start_addr = qipl.netboot_start_addr; + return 0; + case VIRTIO_ID_BLOCK: +@@ -261,7 +263,7 @@ static void ipl_boot_device(void) + } + break; + default: +- print_int("Attempting to boot from unexpected device type", cutype); ++ printf("Attempting to boot from unexpected device type 0x%X\n", cutype); + panic("\nBoot failed.\n"); + } + } +@@ -287,7 +289,7 @@ static void probe_boot_device(void) + } + } + +- sclp_print("Could not find a suitable boot device (none specified)\n"); ++ puts("Could not find a suitable boot device (none specified)"); + } + + void main(void) +diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c +index d601952d3e..84062e94af 100644 +--- a/pc-bios/s390-ccw/menu.c ++++ b/pc-bios/s390-ccw/menu.c +@@ -9,7 +9,10 @@ + * directory. + */ + +-#include "libc.h" ++#include ++#include ++#include ++#include + #include "s390-ccw.h" + #include "sclp.h" + #include "s390-time.h" +@@ -93,7 +96,7 @@ static int read_prompt(char *buf, size_t len) + case KEYCODE_BACKSP: + if (idx > 0) { + buf[--idx] = 0; +- sclp_print("\b \b"); ++ printf("\b \b"); + } + continue; + case KEYCODE_ENTER: +@@ -103,7 +106,7 @@ static int read_prompt(char *buf, size_t len) + /* Echo input and add to buffer */ + if (idx < len) { + buf[idx++] = inp[0]; +- sclp_print(inp); ++ printf("%s", inp); + } + } + } +@@ -140,22 +143,19 @@ static int get_index(void) + } + } + +- return atoui(buf); ++ return atoi(buf); + } + + static void boot_menu_prompt(bool retry) + { +- char tmp[11]; +- + if (retry) { +- sclp_print("\nError: undefined configuration" ++ printf("\nError: undefined configuration" + "\nPlease choose:\n"); + } else if (timeout > 0) { +- sclp_print("Please choose (default will boot in "); +- sclp_print(uitoa(timeout / 1000, tmp, sizeof(tmp))); +- sclp_print(" seconds):\n"); ++ printf("Please choose (default will boot in %d seconds):\n", ++ (int)(timeout / 1000)); + } else { +- sclp_print("Please choose:\n"); ++ puts("Please choose:"); + } + } + +@@ -163,7 +163,6 @@ static int get_boot_index(bool *valid_entries) + { + int boot_index; + bool retry = false; +- char tmp[5]; + + do { + boot_menu_prompt(retry); +@@ -172,8 +171,7 @@ static int get_boot_index(bool *valid_entries) + } while (boot_index < 0 || boot_index >= MAX_BOOT_ENTRIES || + !valid_entries[boot_index]); + +- sclp_print("\nBooting entry #"); +- sclp_print(uitoa(boot_index, tmp, sizeof(tmp))); ++ printf("\nBooting entry #%d", boot_index); + + return boot_index; + } +@@ -187,9 +185,9 @@ static int zipl_print_entry(const char *data, size_t len) + buf[len] = '\n'; + buf[len + 1] = '\0'; + +- sclp_print(buf); ++ printf("%s", buf); + +- return buf[0] == ' ' ? atoui(buf + 1) : atoui(buf); ++ return buf[0] == ' ' ? atoi(buf + 1) : atoi(buf); + } + + int menu_get_zipl_boot_index(const char *menu_data) +@@ -209,7 +207,7 @@ int menu_get_zipl_boot_index(const char *menu_data) + } + + /* Print banner */ +- sclp_print("s390-ccw zIPL Boot Menu\n\n"); ++ puts("s390-ccw zIPL Boot Menu\n"); + menu_data += strlen(menu_data) + 1; + + /* Print entries */ +@@ -221,37 +219,34 @@ int menu_get_zipl_boot_index(const char *menu_data) + valid_entries[entry] = true; + + if (entry == 0) { +- sclp_print("\n"); ++ printf("\n"); + } + } + +- sclp_print("\n"); ++ printf("\n"); + return get_boot_index(valid_entries); + } + + int menu_get_enum_boot_index(bool *valid_entries) + { +- char tmp[3]; + int i; + +- sclp_print("s390-ccw Enumerated Boot Menu.\n\n"); ++ puts("s390-ccw Enumerated Boot Menu.\n"); + + for (i = 0; i < MAX_BOOT_ENTRIES; i++) { + if (valid_entries[i]) { + if (i < 10) { +- sclp_print(" "); ++ printf(" "); + } +- sclp_print("["); +- sclp_print(uitoa(i, tmp, sizeof(tmp))); +- sclp_print("]"); ++ printf("[%d]", i); + if (i == 0) { +- sclp_print(" default\n"); ++ printf(" default\n"); + } +- sclp_print("\n"); ++ printf("\n"); + } + } + +- sclp_print("\n"); ++ printf("\n"); + return get_boot_index(valid_entries); + } + +diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak +index 046aa35587..d2b3d8ee74 100644 +--- a/pc-bios/s390-ccw/netboot.mak ++++ b/pc-bios/s390-ccw/netboot.mak +@@ -1,9 +1,6 @@ + +-SLOF_DIR := $(SRC_PATH)/../../roms/SLOF +- + NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o + +-LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include + LIBNET_INC := -I$(SLOF_DIR)/lib/libnet + + NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000 +diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c +index 5cd619b2d6..509119be15 100644 +--- a/pc-bios/s390-ccw/netmain.c ++++ b/pc-bios/s390-ccw/netmain.c +@@ -293,7 +293,7 @@ static int load_kernel_with_initrd(filename_ip_t *fn_ip, + printf("Loading pxelinux.cfg entry '%s'\n", entry->label); + + if (!entry->kernel) { +- printf("Kernel entry is missing!\n"); ++ puts("Kernel entry is missing!\n"); + return -1; + } + +@@ -515,13 +515,13 @@ void main(void) + int rc, fnlen; + + sclp_setup(); +- sclp_print("Network boot starting...\n"); ++ puts("Network boot starting..."); + + virtio_setup(); + + rc = net_init(&fn_ip); + if (rc) { +- panic("Network initialization failed. Halting.\n"); ++ panic("Network initialization failed. Halting."); + } + + fnlen = strlen(fn_ip.filename); +@@ -535,9 +535,9 @@ void main(void) + net_release(&fn_ip); + + if (rc > 0) { +- sclp_print("Network loading done, starting kernel...\n"); ++ puts("Network loading done, starting kernel..."); + jump_to_low_kernel(); + } + +- panic("Failed to load OS from network\n"); ++ panic("Failed to load OS from network."); + } +diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h +index c977a52b50..6f6d95d170 100644 +--- a/pc-bios/s390-ccw/s390-ccw.h ++++ b/pc-bios/s390-ccw/s390-ccw.h +@@ -13,6 +13,11 @@ + + /* #define DEBUG */ + ++#include ++#include ++#include ++#include ++ + typedef unsigned char u8; + typedef unsigned short u16; + typedef unsigned int u32; +@@ -26,9 +31,6 @@ typedef unsigned long long u64; + #define EBUSY 2 + #define ENODEV 3 + +-#ifndef NULL +-#define NULL 0 +-#endif + #ifndef MIN + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) + #endif +@@ -87,7 +89,7 @@ bool menu_is_enabled_enum(void); + __attribute__ ((__noreturn__)) + static inline void panic(const char *string) + { +- sclp_print(string); ++ printf("ERROR: %s\n ", string); + disabled_wait(); + } + +@@ -109,20 +111,10 @@ static inline void fill_hex_val(char *out, void *ptr, unsigned size) + } + } + +-static inline void print_int(const char *desc, u64 addr) +-{ +- char out[] = ": 0xffffffffffffffff\n"; +- +- fill_hex_val(&out[4], &addr, sizeof(addr)); +- +- sclp_print(desc); +- sclp_print(out); +-} +- + static inline void debug_print_int(const char *desc, u64 addr) + { + #ifdef DEBUG +- print_int(desc, addr); ++ printf("%s 0x%X\n", desc, addr); + #endif + } + +@@ -147,18 +139,14 @@ static inline void debug_print_addr(const char *desc, void *p) + static inline void IPL_assert(bool term, const char *message) + { + if (!term) { +- sclp_print("\n! "); +- sclp_print(message); +- panic(" !\n"); /* no return */ ++ panic(message); /* no return */ + } + } + + static inline void IPL_check(bool term, const char *message) + { + if (!term) { +- sclp_print("\n! WARNING: "); +- sclp_print(message); +- sclp_print(" !\n"); ++ printf("WARNING: %s\n", message); + } + } + +diff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c +index 7251f9af4d..4a07de018d 100644 +--- a/pc-bios/s390-ccw/sclp.c ++++ b/pc-bios/s390-ccw/sclp.c +@@ -8,7 +8,7 @@ + * directory. + */ + +-#include "libc.h" ++#include + #include "s390-ccw.h" + #include "sclp.h" + +@@ -101,11 +101,6 @@ long write(int fd, const void *str, size_t len) + return len; + } + +-void sclp_print(const char *str) +-{ +- write(1, str, strlen(str)); +-} +- + void sclp_get_loadparm_ascii(char *loadparm) + { + +diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c +index a81207b52e..2666326801 100644 +--- a/pc-bios/s390-ccw/virtio-blkdev.c ++++ b/pc-bios/s390-ccw/virtio-blkdev.c +@@ -8,7 +8,7 @@ + * directory. + */ + +-#include "libc.h" ++#include + #include "s390-ccw.h" + #include "virtio.h" + #include "virtio-scsi.h" +@@ -76,7 +76,7 @@ unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list + return -1; + } + +- sclp_print("."); ++ printf("."); + status = virtio_read_many(sec, (void *)addr, sec_num); + if (status) { + panic("I/O Error"); +@@ -230,7 +230,7 @@ int virtio_blk_setup_device(SubChannelId schid) + vdev->schid = schid; + virtio_setup_ccw(vdev); + +- sclp_print("Using virtio-blk.\n"); ++ puts("Using virtio-blk."); + + return 0; + } +diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c +index d1a84b937c..6b4a1caf8a 100644 +--- a/pc-bios/s390-ccw/virtio-scsi.c ++++ b/pc-bios/s390-ccw/virtio-scsi.c +@@ -9,7 +9,8 @@ + * directory. + */ + +-#include "libc.h" ++#include ++#include + #include "s390-ccw.h" + #include "virtio.h" + #include "scsi.h" +@@ -30,9 +31,9 @@ static inline void vs_assert(bool term, const char **msgs) + if (!term) { + int i = 0; + +- sclp_print("\n! "); ++ printf("\n! "); + while (msgs[i]) { +- sclp_print(msgs[i++]); ++ printf("%s", msgs[i++]); + } + panic(" !\n"); + } +@@ -236,11 +237,11 @@ static int virtio_scsi_locate_device(VDev *vdev) + if (resp.response == VIRTIO_SCSI_S_BAD_TARGET) { + continue; + } +- print_int("target", target); ++ printf("target 0x%X\n", target); + virtio_scsi_verify_response(&resp, "SCSI cannot report LUNs"); + } + if (r->lun_list_len == 0) { +- print_int("no LUNs for target", target); ++ printf("no LUNs for target 0x%X\n", target); + continue; + } + luns = r->lun_list_len / 8; +@@ -264,7 +265,7 @@ static int virtio_scsi_locate_device(VDev *vdev) + } + } + +- sclp_print("Warning: Could not locate a usable virtio-scsi device\n"); ++ puts("Warning: Could not locate a usable virtio-scsi device"); + return -ENODEV; + } + +@@ -379,7 +380,7 @@ static int virtio_scsi_setup(VDev *vdev) + } + + if (virtio_scsi_inquiry_response_is_cdrom(scsi_inquiry_std_response)) { +- sclp_print("SCSI CD-ROM detected.\n"); ++ puts("SCSI CD-ROM detected."); + vdev->is_cdrom = true; + vdev->scsi_block_size = VIRTIO_ISO_BLOCK_SIZE; + } +@@ -443,7 +444,7 @@ int virtio_scsi_setup_device(SubChannelId schid) + IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE, + "Config: CDB size mismatch"); + +- sclp_print("Using virtio-scsi.\n"); ++ puts("Using virtio-scsi."); + + return virtio_scsi_setup(vdev); + } +diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c +index 5edd058d88..8c6b0a8a92 100644 +--- a/pc-bios/s390-ccw/virtio.c ++++ b/pc-bios/s390-ccw/virtio.c +@@ -8,7 +8,7 @@ + * directory. + */ + +-#include "libc.h" ++#include + #include "s390-ccw.h" + #include "cio.h" + #include "virtio.h" +diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Makefile.softmmu-target +index f60f94b090..90964a2ccb 100644 +--- a/tests/tcg/s390x/Makefile.softmmu-target ++++ b/tests/tcg/s390x/Makefile.softmmu-target +@@ -2,7 +2,7 @@ S390X_SRC=$(SRC_PATH)/tests/tcg/s390x + VPATH+=$(S390X_SRC) + QEMU_OPTS+=-action panic=exit-failure -nographic $(EXTFLAGS) -kernel + LINK_SCRIPT=$(S390X_SRC)/softmmu.ld +-CFLAGS+=-ggdb -O0 ++CFLAGS+=-ggdb -O0 -I$(SRC_PATH)/include/hw/s390x/ipl/ + LDFLAGS=-nostdlib -static + + %.o: %.S +diff --git a/tests/tcg/s390x/console.c b/tests/tcg/s390x/console.c +index d43ce3f44b..6c26f04949 100644 +--- a/tests/tcg/s390x/console.c ++++ b/tests/tcg/s390x/console.c +@@ -4,7 +4,10 @@ + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ ++ + #include "../../../pc-bios/s390-ccw/sclp.c" ++#include "../../../roms/SLOF/lib/libc/string/memset.c" ++#include "../../../roms/SLOF/lib/libc/string/memcpy.c" + + void __sys_outc(char c) + { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch new file mode 100644 index 000000000..80006bf00 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch @@ -0,0 +1,227 @@ +From 4fcfb2ccd90ffc1e0b121b3e5dbab1cdcba8ce4e Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:51 -0400 +Subject: [PATCH 18/27] pc-bios/s390x: Enable multi-device boot loop +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [18/23] 2aa3154bfb1c73a6054b1161ae284925e6069c48 (thuth/qemu-kvm-cs9) + +Allow attempts to boot from multiple IPL devices. If the first device fails to +IPL, select the pre-built IPLB for the next device in the boot order and attempt +to IPL from it. Continue this process until IPL is successful or there are no +devices left to try. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-18-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit f697bed22f58eff9b2893ac2fe3d511847398400) +--- + pc-bios/s390-ccw/iplb.h | 24 ++++++++++++++++++++ + pc-bios/s390-ccw/jump2ipl.c | 7 +++--- + pc-bios/s390-ccw/main.c | 45 +++++++++++++++++++++++-------------- + pc-bios/s390-ccw/netmain.c | 2 +- + 4 files changed, 57 insertions(+), 21 deletions(-) + +diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h +index 16643f5879..08f259ff31 100644 +--- a/pc-bios/s390-ccw/iplb.h ++++ b/pc-bios/s390-ccw/iplb.h +@@ -17,9 +17,11 @@ + #endif + + #include ++#include + + extern QemuIplParameters qipl; + extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); ++extern bool have_iplb; + + #define S390_IPL_TYPE_FCP 0x00 + #define S390_IPL_TYPE_CCW 0x02 +@@ -49,4 +51,26 @@ static inline bool set_iplb(IplParameterBlock *iplb) + return manage_iplb(iplb, false); + } + ++/* ++ * The IPL started on the device, but failed in some way. If the IPLB chain ++ * still has more devices left to try, use the next device in order. ++ */ ++static inline bool load_next_iplb(void) ++{ ++ IplParameterBlock *next_iplb; ++ ++ if (qipl.chain_len < 1) { ++ return false; ++ } ++ ++ qipl.index++; ++ next_iplb = (IplParameterBlock *) qipl.next_iplb; ++ memcpy(&iplb, next_iplb, sizeof(IplParameterBlock)); ++ ++ qipl.chain_len--; ++ qipl.next_iplb = qipl.next_iplb + sizeof(IplParameterBlock); ++ ++ return true; ++} ++ + #endif /* IPLB_H */ +diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c +index 99d18947d1..86321d0f46 100644 +--- a/pc-bios/s390-ccw/jump2ipl.c ++++ b/pc-bios/s390-ccw/jump2ipl.c +@@ -45,9 +45,10 @@ int jump_to_IPL_code(uint64_t address) + */ + if (iplb.pbt == S390_IPL_TYPE_QEMU_SCSI) { + iplb.devno = qipl.index; +- if (!set_iplb(&iplb)) { +- panic("Failed to set IPLB"); +- } ++ } ++ ++ if (have_iplb && !set_iplb(&iplb)) { ++ panic("Failed to set IPLB"); + } + + /* +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index ab4709e16e..a4d1c05aac 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -23,7 +23,7 @@ static SubChannelId blk_schid = { .one = 1 }; + static char loadparm_str[LOADPARM_LEN + 1]; + QemuIplParameters qipl; + IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); +-static bool have_iplb; ++bool have_iplb; + static uint16_t cutype; + LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */ + +@@ -55,6 +55,12 @@ void write_iplb_location(void) + } + } + ++static void copy_qipl(void) ++{ ++ QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS; ++ memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); ++} ++ + unsigned int get_loadparm_index(void) + { + return atoi(loadparm_str); +@@ -152,6 +158,7 @@ static void menu_setup(void) + + /* If loadparm was set to any other value, then do not enable menu */ + if (memcmp(loadparm_str, LOADPARM_EMPTY, LOADPARM_LEN) != 0) { ++ menu_set_parms(qipl.qipl_flags & ~BOOT_MENU_FLAG_MASK, 0); + return; + } + +@@ -183,7 +190,6 @@ static void css_setup(void) + static void boot_setup(void) + { + char lpmsg[] = "LOADPARM=[________]\n"; +- have_iplb = store_iplb(&iplb); + + if (memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { + ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN); +@@ -191,6 +197,10 @@ static void boot_setup(void) + sclp_get_loadparm_ascii(loadparm_str); + } + ++ if (have_iplb) { ++ menu_setup(); ++ } ++ + memcpy(lpmsg + 10, loadparm_str, 8); + puts(lpmsg); + +@@ -208,6 +218,7 @@ static bool find_boot_device(void) + + switch (iplb.pbt) { + case S390_IPL_TYPE_CCW: ++ vdev->scsi_device_selected = false; + debug_print_int("device no. ", iplb.ccw.devno); + blk_schid.ssid = iplb.ccw.ssid & 0x3; + debug_print_int("ssid ", blk_schid.ssid); +@@ -231,15 +242,8 @@ static bool find_boot_device(void) + static int virtio_setup(void) + { + VDev *vdev = virtio_get_device(); +- QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS; + int ret; + +- memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); +- +- if (have_iplb) { +- menu_setup(); +- } +- + switch (vdev->senseid.cu_model) { + case VIRTIO_ID_NET: + puts("Network boot device detected"); +@@ -271,10 +275,9 @@ static void ipl_boot_device(void) + dasd_ipl(blk_schid, cutype); + break; + case CU_TYPE_VIRTIO: +- if (virtio_setup()) { +- return; /* Only returns in case of errors */ ++ if (virtio_setup() == 0) { ++ zipl_load(); + } +- zipl_load(); + break; + default: + printf("Attempting to boot from unexpected device type 0x%X\n", cutype); +@@ -307,14 +310,22 @@ static void probe_boot_device(void) + + void main(void) + { ++ copy_qipl(); + sclp_setup(); + css_setup(); +- boot_setup(); +- if (have_iplb && find_boot_device()) { +- ipl_boot_device(); +- } else { ++ have_iplb = store_iplb(&iplb); ++ if (!have_iplb) { + probe_boot_device(); + } + +- panic("Failed to IPL. Halting..."); ++ while (have_iplb) { ++ boot_setup(); ++ if (have_iplb && find_boot_device()) { ++ ipl_boot_device(); ++ } ++ have_iplb = load_next_iplb(); ++ } ++ ++ panic("No suitable device for IPL. Halting..."); ++ + } +diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c +index d1a6c9a91c..e46e470db4 100644 +--- a/pc-bios/s390-ccw/netmain.c ++++ b/pc-bios/s390-ccw/netmain.c +@@ -478,7 +478,7 @@ static bool virtio_setup(void) + */ + enable_mss_facility(); + +- if (store_iplb(&iplb)) { ++ if (have_iplb || store_iplb(&iplb)) { + IPL_assert(iplb.pbt == S390_IPL_TYPE_CCW, "IPL_TYPE_CCW expected"); + dev_no = iplb.ccw.devno; + debug_print_int("device no. ", dev_no); +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch new file mode 100644 index 000000000..ebf1a48d7 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch @@ -0,0 +1,43 @@ +From 32ddd9e68b04cb231fa0adcaeacbbe6373a1972f Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Fri, 8 Nov 2024 14:41:36 -0500 +Subject: [PATCH 07/10] pc-bios/s390x: Initialize cdrom type to false for each + IPL device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [6/8] 994d24c3292a38f5bc7fd87d7227e5beb8abc30b (thuth/qemu-kvm-cs9) + +Clear information about cdrom type so that current IPL device isn't tainted +by stale data from previous devices. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241108194136.2833932-1-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 8c797468116d19940fb758efa749eae414616e3a) +--- + pc-bios/s390-ccw/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index a4d1c05aac..7509755e36 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -242,6 +242,7 @@ static bool find_boot_device(void) + static int virtio_setup(void) + { + VDev *vdev = virtio_get_device(); ++ vdev->is_cdrom = false; + int ret; + + switch (vdev->senseid.cu_model) { +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch new file mode 100644 index 000000000..f0764e67a --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch @@ -0,0 +1,55 @@ +From d5fd6b575f36c09bb6ef11d3e1e4e698577637c3 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Thu, 14 Nov 2024 11:19:52 -0500 +Subject: [PATCH 08/10] pc-bios/s390x: Initialize machine loadparm before + probing IPL devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [7/8] 5f9bca4a83d6a1bde08504d2655f486708765e6e (thuth/qemu-kvm-cs9) + +Commit bb185de423 ("s390x: Add individual loadparm assignment to +CCW device") allowed boot devices to be assigned a loadparm value independent +of the machine value, however, when no boot devices are defined, the machine +loadparm becomes ignored. Therefore, let's check the machine loadparm +prior to probing the devices. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241114161952.3508554-1-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 1056ca1e70dc6e0458238141bcebfb7810cede6d) +--- + pc-bios/s390-ccw/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index 7509755e36..76bf743900 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -191,7 +191,7 @@ static void boot_setup(void) + { + char lpmsg[] = "LOADPARM=[________]\n"; + +- if (memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { ++ if (have_iplb && memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { + ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN); + } else { + sclp_get_loadparm_ascii(loadparm_str); +@@ -316,6 +316,7 @@ void main(void) + css_setup(); + have_iplb = store_iplb(&iplb); + if (!have_iplb) { ++ boot_setup(); + probe_boot_device(); + } + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch b/images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch new file mode 100644 index 000000000..32064ea65 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch @@ -0,0 +1,75 @@ +From d06f8670b9304c66d45e2270a4f5b462ed6cbe09 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Wed, 16 Oct 2024 17:21:34 +0530 +Subject: [PATCH 1/9] pc: q35: Bump max_cpus to 4096 vcpus +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Ani Sinha +RH-MergeRequest: 273: pc: q35: Bump max_cpus to 4096 vcpus +RH-Jira: RHEL-11043 +RH-Acked-by: Igor Mammedov +RH-Acked-by: Daniel P. Berrangé +RH-Acked-by: MST +RH-Commit: [1/1] 23caa8c9e4f34c3114701b7a5bb25002a9372b2e (anisinha/centos-qemu-kvm) + +This is the downstream change equivalent of the upstream QEMU commit +e4e98c7e ("pc: q35: Bump max_cpus to 4096 vcpus") + +Since upstream Linux kernel commit +f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") +Linux kernel can support upto a maximum number of 4096 vcpus when MAXSMP is +enabled in the kernel. This upstream change has been backported to c9s kernel +already. Please see JIRA https://issues.redhat.com/browse/RHEL-11579 and the +following commit authored by Vitaly Kuznetsov: +a85f846be686b0a ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") + +At present, QEMU has been tested to correctly boot a linux guest with 4096 +vcpus using edk2 that has the fixes corresponding to the following two upstream +edk2 PRs: + +https://github.com/tianocore/edk2/pull/5410 +https://github.com/tianocore/edk2/pull/5418 + +The changes corresponding to the above two upstream edk2 PRs has been included +in the downstream c9s edk2 with the following MR: +https://gitlab.com/redhat/centos-stream/src/edk2/-/merge_requests/59 + +So bump up the value max_cpus to 4096 for RHEL q35 machines versions 9.6 and +newer. Q35 RHEL machines versions 9.4 and older continue to support 710 maximum +vcpus as before for compatibility reasons. + +See also https://gitlab.com/redhat/centos-stream/src/qemu-kvm/-/merge_requests/236 + +Signed-off-by: Ani Sinha +--- + hw/i386/pc_q35.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 7606007bda..578f63524f 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -344,7 +344,7 @@ static void pc_q35_machine_options(MachineClass *m) + m->default_display = "std"; + m->default_nic = "e1000e"; + m->no_floppy = 1; +- m->max_cpus = 710; ++ m->max_cpus = 4096; + m->no_parallel = 1; + machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); + machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); +@@ -687,6 +687,9 @@ static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) + { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + pc_q35_rhel_machine_9_6_0_options(m); ++ ++ /* older RHEL machines continue to support 710 vcpus */ ++ m->max_cpus = 710; + m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; + m->alias = NULL; + pcmc->smbios_stream_product = "RHEL"; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch b/images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch new file mode 100644 index 000000000..3440acb61 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch @@ -0,0 +1,362 @@ +From 20a4a01fde02a619cee994af92721592e7d91716 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:48 -0400 +Subject: [PATCH 15/27] s390x: Add individual loadparm assignment to CCW device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [15/23] c4eaab72e6246db7295593b86f097773aa4f49b7 (thuth/qemu-kvm-cs9) + +Add a loadparm property to the VirtioCcwDevice object so that different +loadparms can be defined on a per-device basis for CCW boot devices. + +The machine/global loadparm is still supported. If both a global and per-device +loadparm are defined, the per-device value will override the global value for +that device, but any other devices that do not specify a per-device loadparm +will still use the global loadparm. + +It is invalid to assign a loadparm to a non-boot device. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-15-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit bb185de42339025db9bbd5aa11f3f644c2a077f8) +--- + hw/s390x/ccw-device.c | 46 +++++++++++++++++++++++++ + hw/s390x/ccw-device.h | 2 ++ + hw/s390x/ipl.c | 68 ++++++++++++++++++++++--------------- + hw/s390x/ipl.h | 3 +- + hw/s390x/s390-virtio-ccw.c | 18 +--------- + hw/s390x/sclp.c | 9 ++--- + include/hw/s390x/ipl/qipl.h | 1 + + pc-bios/s390-ccw/main.c | 10 ++++-- + 8 files changed, 102 insertions(+), 55 deletions(-) + +diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c +index a7d682e5af..4e54f34b1c 100644 +--- a/hw/s390x/ccw-device.c ++++ b/hw/s390x/ccw-device.c +@@ -13,6 +13,10 @@ + #include "ccw-device.h" + #include "hw/qdev-properties.h" + #include "qemu/module.h" ++#include "ipl.h" ++#include "qapi/visitor.h" ++#include "qemu/ctype.h" ++#include "qapi/error.h" + + static void ccw_device_refill_ids(CcwDevice *dev) + { +@@ -37,10 +41,52 @@ static bool ccw_device_realize(CcwDevice *dev, Error **errp) + return true; + } + ++static void ccw_device_get_loadparm(Object *obj, Visitor *v, ++ const char *name, void *opaque, ++ Error **errp) ++{ ++ CcwDevice *dev = CCW_DEVICE(obj); ++ char *str = g_strndup((char *) dev->loadparm, sizeof(dev->loadparm)); ++ ++ visit_type_str(v, name, &str, errp); ++ g_free(str); ++} ++ ++static void ccw_device_set_loadparm(Object *obj, Visitor *v, ++ const char *name, void *opaque, ++ Error **errp) ++{ ++ CcwDevice *dev = CCW_DEVICE(obj); ++ char *val; ++ int index; ++ ++ index = object_property_get_int(obj, "bootindex", NULL); ++ ++ if (index < 0) { ++ error_setg(errp, "LOADPARM is only valid for boot devices!"); ++ } ++ ++ if (!visit_type_str(v, name, &val, errp)) { ++ return; ++ } ++ ++ s390_ipl_fmt_loadparm(dev->loadparm, val, errp); ++} ++ ++static const PropertyInfo ccw_loadparm = { ++ .name = "ccw_loadparm", ++ .description = "Up to 8 chars in set of [A-Za-z0-9. ] to pass" ++ " to the guest loader/kernel", ++ .get = ccw_device_get_loadparm, ++ .set = ccw_device_set_loadparm, ++}; ++ + static Property ccw_device_properties[] = { + DEFINE_PROP_CSS_DEV_ID("devno", CcwDevice, devno), + DEFINE_PROP_CSS_DEV_ID_RO("dev_id", CcwDevice, dev_id), + DEFINE_PROP_CSS_DEV_ID_RO("subch_id", CcwDevice, subch_id), ++ DEFINE_PROP("loadparm", CcwDevice, loadparm, ccw_loadparm, ++ typeof(uint8_t[8])), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h +index 5feeb0ee7a..1e1737c0f3 100644 +--- a/hw/s390x/ccw-device.h ++++ b/hw/s390x/ccw-device.h +@@ -26,6 +26,8 @@ struct CcwDevice { + CssDevId dev_id; + /* The actual busid of the virtual subchannel. */ + CssDevId subch_id; ++ /* If set, use this loadparm value when device is boot target */ ++ uint8_t loadparm[8]; + }; + typedef struct CcwDevice CcwDevice; + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index 8a0a3e6961..d83832d975 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -34,6 +34,7 @@ + #include "qemu/config-file.h" + #include "qemu/cutils.h" + #include "qemu/option.h" ++#include "qemu/ctype.h" + #include "standard-headers/linux/virtio_ids.h" + + #define KERN_IMAGE_START 0x010000UL +@@ -397,12 +398,43 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype) + return ccw_dev; + } + ++void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) ++{ ++ int i; ++ ++ /* Initialize the loadparm with spaces */ ++ memset(loadparm, ' ', LOADPARM_LEN); ++ for (i = 0; i < LOADPARM_LEN && str[i]; i++) { ++ uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ ++ ++ if (qemu_isalnum(c) || c == '.' || c == ' ') { ++ loadparm[i] = c; ++ } else { ++ error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", ++ c, c); ++ return; ++ } ++ } ++} ++ ++void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) ++{ ++ int i; ++ ++ /* Initialize the loadparm with EBCDIC spaces (0x40) */ ++ memset(ebcdic_lp, '@', LOADPARM_LEN); ++ for (i = 0; i < LOADPARM_LEN && ascii_lp[i]; i++) { ++ ebcdic_lp[i] = ascii2ebcdic[(uint8_t) ascii_lp[i]]; ++ } ++} ++ + static bool s390_gen_initial_iplb(S390IPLState *ipl) + { + DeviceState *dev_st; + CcwDevice *ccw_dev = NULL; + SCSIDevice *sd; + int devtype; ++ uint8_t *lp; + + dev_st = get_boot_device(0); + if (dev_st) { +@@ -413,6 +445,8 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) + * Currently allow IPL only from CCW devices. + */ + if (ccw_dev) { ++ lp = ccw_dev->loadparm; ++ + switch (devtype) { + case CCW_DEVTYPE_SCSI: + sd = SCSI_DEVICE(dev_st); +@@ -445,40 +479,20 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) + break; + } + +- if (!s390_ipl_set_loadparm(ipl->iplb.loadparm)) { +- ipl->iplb.flags |= DIAG308_FLAGS_LP_VALID; ++ /* If the device loadparm is empty use the global machine loadparm */ ++ if (memcmp(lp, NO_LOADPARM, 8) == 0) { ++ lp = S390_CCW_MACHINE(qdev_get_machine())->loadparm; + } + ++ s390_ipl_convert_loadparm((char *)lp, ipl->iplb.loadparm); ++ ipl->iplb.flags |= DIAG308_FLAGS_LP_VALID; ++ + return true; + } + + return false; + } + +-int s390_ipl_set_loadparm(uint8_t *loadparm) +-{ +- MachineState *machine = MACHINE(qdev_get_machine()); +- char *lp = object_property_get_str(OBJECT(machine), "loadparm", NULL); +- +- if (lp) { +- int i; +- +- /* lp is an uppercase string without leading/embedded spaces */ +- for (i = 0; i < 8 && lp[i]; i++) { +- loadparm[i] = ascii2ebcdic[(uint8_t) lp[i]]; +- } +- +- if (i < 8) { +- memset(loadparm + i, 0x40, 8 - i); /* fill with EBCDIC spaces */ +- } +- +- g_free(lp); +- return 0; +- } +- +- return -1; +-} +- + static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, + int virtio_id) + { +@@ -534,7 +548,7 @@ static void update_machine_ipl_properties(IplParameterBlock *iplb) + ascii_loadparm[i] = 0; + object_property_set_str(machine, "loadparm", ascii_loadparm, &err); + } else { +- object_property_set_str(machine, "loadparm", "", &err); ++ object_property_set_str(machine, "loadparm", " ", &err); + } + if (err) { + warn_report_err(err); +diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h +index fa394c339d..b670bad551 100644 +--- a/hw/s390x/ipl.h ++++ b/hw/s390x/ipl.h +@@ -21,7 +21,8 @@ + + #define DIAG308_FLAGS_LP_VALID 0x80 + +-int s390_ipl_set_loadparm(uint8_t *loadparm); ++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_update_diag308(IplParameterBlock *iplb); + int s390_ipl_prepare_pv_header(Error **errp); + int s390_ipl_pv_unpack(void); +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index 5113313aa8..ef2a9687c7 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -722,28 +722,12 @@ static void machine_set_loadparm(Object *obj, Visitor *v, + { + S390CcwMachineState *ms = S390_CCW_MACHINE(obj); + char *val; +- int i; + + if (!visit_type_str(v, name, &val, errp)) { + return; + } + +- for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) { +- uint8_t c = qemu_toupper(val[i]); /* mimic HMC */ +- +- if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') || +- (c == ' ')) { +- ms->loadparm[i] = c; +- } else { +- error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", +- c, c); +- return; +- } +- } +- +- for (; i < sizeof(ms->loadparm); i++) { +- ms->loadparm[i] = ' '; /* pad right with spaces */ +- } ++ s390_ipl_fmt_loadparm(ms->loadparm, val, errp); + } + + static void ccw_machine_class_init(ObjectClass *oc, void *data) +diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c +index e725dcd5fd..8757626b5c 100644 +--- a/hw/s390x/sclp.c ++++ b/hw/s390x/sclp.c +@@ -110,7 +110,6 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) + MachineState *machine = MACHINE(qdev_get_machine()); + int cpu_count; + int rnsize, rnmax; +- IplParameterBlock *ipib = s390_ipl_get_iplb(); + 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) : +@@ -171,12 +170,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) + read_info->rnmax2 = cpu_to_be64(rnmax); + } + +- if (ipib && ipib->flags & DIAG308_FLAGS_LP_VALID) { +- memcpy(&read_info->loadparm, &ipib->loadparm, +- sizeof(read_info->loadparm)); +- } else { +- s390_ipl_set_loadparm(read_info->loadparm); +- } ++ s390_ipl_convert_loadparm((char *)S390_CCW_MACHINE(machine)->loadparm, ++ read_info->loadparm); + + sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION); + } +diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h +index 0ef04af027..b67d2ae061 100644 +--- a/include/hw/s390x/ipl/qipl.h ++++ b/include/hw/s390x/ipl/qipl.h +@@ -18,6 +18,7 @@ + + #define QIPL_ADDRESS 0xcc + #define LOADPARM_LEN 8 ++#define NO_LOADPARM "\0\0\0\0\0\0\0\0" + + /* + * The QEMU IPL Parameters will be stored at absolute address +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index 34ef27d7a6..ab4709e16e 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -183,8 +183,14 @@ static void css_setup(void) + static void boot_setup(void) + { + char lpmsg[] = "LOADPARM=[________]\n"; ++ have_iplb = store_iplb(&iplb); ++ ++ if (memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { ++ ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN); ++ } else { ++ sclp_get_loadparm_ascii(loadparm_str); ++ } + +- sclp_get_loadparm_ascii(loadparm_str); + memcpy(lpmsg + 10, loadparm_str, 8); + puts(lpmsg); + +@@ -193,8 +199,6 @@ static void boot_setup(void) + * so we don't taint our decision-making process during a reboot. + */ + memset((char *)S390EP, 0, 6); +- +- have_iplb = store_iplb(&iplb); + } + + static bool find_boot_device(void) +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch b/images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch new file mode 100644 index 000000000..059798ab8 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch @@ -0,0 +1,264 @@ +From 9d333e9e7614676aac3a39b0f4a5f5d67323b23d Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:50 -0400 +Subject: [PATCH 17/27] s390x: Rebuild IPLB for SCSI device directly from + DIAG308 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [17/23] d0326ad7958cc82496bf57fd09bbc877c5b8c0ac (thuth/qemu-kvm-cs9) + +Because virtio-scsi type devices use a non-architected IPLB pbt code they cannot +be set and stored normally. Instead, the IPLB must be rebuilt during re-ipl. + +As s390x does not natively support multiple boot devices, the devno field is +used to store the position in the boot order for the device. + +Handling the rebuild as part of DIAG308 removes the need to check the devices +for invalid IPLBs later in the IPL. + +Signed-off-by: Jared Rossi +Acked-by: Thomas Huth +Message-ID: <20241020012953.1380075-17-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 455e3bc3f74ee76964efec2e0c646db15095d0d2) +--- + hw/s390x/ipl.c | 74 ++++++------------------------------- + hw/s390x/ipl.h | 11 ++++-- + include/hw/s390x/ipl/qipl.h | 3 +- + pc-bios/s390-ccw/jump2ipl.c | 11 ++++-- + target/s390x/diag.c | 9 ++++- + 5 files changed, 38 insertions(+), 70 deletions(-) + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index f4576f8822..5fbd43c346 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -448,7 +448,6 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) + + static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + { +- S390IPLState *ipl = get_ipl_device(); + CcwDevice *ccw_dev = NULL; + SCSIDevice *sd; + int devtype; +@@ -481,9 +480,6 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + iplb->ccw.ssid = ccw_dev->sch->ssid & 3; + break; + case CCW_DEVTYPE_VIRTIO_NET: +- /* The S390IPLState netboot is true if ANY IPLB may use netboot */ +- ipl->netboot = true; +- /* Fall through to CCW_DEVTYPE_VIRTIO case */ + case CCW_DEVTYPE_VIRTIO: + iplb->len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); + iplb->blk0_len = +@@ -508,6 +504,16 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + return false; + } + ++void s390_rebuild_iplb(uint16_t dev_index, IplParameterBlock *iplb) ++{ ++ S390IPLState *ipl = get_ipl_device(); ++ uint16_t index; ++ index = ipl->rebuilt_iplb ? ipl->iplb_index : dev_index; ++ ++ ipl->rebuilt_iplb = s390_build_iplb(get_boot_device(index), iplb); ++ ipl->iplb_index = index; ++} ++ + static bool s390_init_all_iplbs(S390IPLState *ipl) + { + int iplb_num = 0; +@@ -564,44 +570,6 @@ static bool s390_init_all_iplbs(S390IPLState *ipl) + return iplb_num; + } + +-static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, +- int virtio_id) +-{ +- uint8_t cssid; +- uint8_t ssid; +- uint16_t devno; +- uint16_t schid; +- SubchDev *sch = NULL; +- +- if (iplb->pbt != S390_IPL_TYPE_CCW) { +- return false; +- } +- +- devno = be16_to_cpu(iplb->ccw.devno); +- ssid = iplb->ccw.ssid & 3; +- +- for (schid = 0; schid < MAX_SCHID; schid++) { +- for (cssid = 0; cssid < MAX_CSSID; cssid++) { +- sch = css_find_subch(1, cssid, ssid, schid); +- +- if (sch && sch->devno == devno) { +- return sch->id.cu_model == virtio_id; +- } +- } +- } +- return false; +-} +- +-static bool is_virtio_net_device(IplParameterBlock *iplb) +-{ +- return is_virtio_ccw_device_of_type(iplb, VIRTIO_ID_NET); +-} +- +-static bool is_virtio_scsi_device(IplParameterBlock *iplb) +-{ +- return is_virtio_ccw_device_of_type(iplb, VIRTIO_ID_SCSI); +-} +- + static void update_machine_ipl_properties(IplParameterBlock *iplb) + { + Object *machine = qdev_get_machine(); +@@ -641,7 +609,7 @@ void s390_ipl_update_diag308(IplParameterBlock *iplb) + ipl->iplb = *iplb; + ipl->iplb_valid = true; + } +- ipl->netboot = is_virtio_net_device(iplb); ++ + update_machine_ipl_properties(iplb); + } + +@@ -668,32 +636,14 @@ IplParameterBlock *s390_ipl_get_iplb(void) + void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) + { + S390IPLState *ipl = get_ipl_device(); +- + if (reset_type == S390_RESET_EXTERNAL || reset_type == S390_RESET_REIPL) { + /* use CPU 0 for full resets */ + ipl->reset_cpu_index = 0; + } else { + ipl->reset_cpu_index = cs->cpu_index; + } +- ipl->reset_type = reset_type; + +- if (reset_type == S390_RESET_REIPL && +- ipl->iplb_valid && +- !ipl->netboot && +- ipl->iplb.pbt == S390_IPL_TYPE_CCW && +- is_virtio_scsi_device(&ipl->iplb)) { +- CcwDevice *ccw_dev = s390_get_ccw_device(get_boot_device(0), NULL); +- +- if (ccw_dev && +- cpu_to_be16(ccw_dev->sch->devno) == ipl->iplb.ccw.devno && +- (ccw_dev->sch->ssid & 3) == ipl->iplb.ccw.ssid) { +- /* +- * this is the original boot device's SCSI +- * so restore IPL parameter info from it +- */ +- ipl->iplb_valid = s390_build_iplb(get_boot_device(0), &ipl->iplb); +- } +- } ++ ipl->reset_type = reset_type; + if (reset_type == S390_RESET_MODIFIED_CLEAR || + reset_type == S390_RESET_LOAD_NORMAL || + reset_type == S390_RESET_PV) { +diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h +index 54eb48fd6e..d7d0b7bfd2 100644 +--- a/hw/s390x/ipl.h ++++ b/hw/s390x/ipl.h +@@ -24,6 +24,7 @@ + + 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_rebuild_iplb(uint16_t index, IplParameterBlock *iplb); + void s390_ipl_update_diag308(IplParameterBlock *iplb); + int s390_ipl_prepare_pv_header(Error **errp); + int s390_ipl_pv_unpack(void); +@@ -65,7 +66,8 @@ struct S390IPLState { + bool enforce_bios; + bool iplb_valid; + bool iplb_valid_pv; +- bool netboot; ++ bool rebuilt_iplb; ++ uint16_t iplb_index; + /* reset related properties don't have to be migrated or reset */ + enum s390_reset reset_type; + int reset_cpu_index; +@@ -172,11 +174,14 @@ static inline bool iplb_valid_pv(IplParameterBlock *iplb) + + static inline bool iplb_valid(IplParameterBlock *iplb) + { ++ uint32_t len = be32_to_cpu(iplb->len); ++ + switch (iplb->pbt) { + case S390_IPL_TYPE_FCP: +- return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_FCP_LEN; ++ return len >= S390_IPLB_MIN_FCP_LEN; + case S390_IPL_TYPE_CCW: +- return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_CCW_LEN; ++ return len >= S390_IPLB_MIN_CCW_LEN; ++ case S390_IPL_TYPE_QEMU_SCSI: + default: + return false; + } +diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h +index 1da4f75aa8..6824391111 100644 +--- a/include/hw/s390x/ipl/qipl.h ++++ b/include/hw/s390x/ipl/qipl.h +@@ -29,7 +29,8 @@ + */ + struct QemuIplParameters { + uint8_t qipl_flags; +- uint8_t reserved1[3]; ++ uint8_t index; ++ uint8_t reserved1[2]; + uint64_t reserved2; + uint32_t boot_menu_timeout; + uint8_t reserved3[2]; +diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c +index 8db1764ff3..99d18947d1 100644 +--- a/pc-bios/s390-ccw/jump2ipl.c ++++ b/pc-bios/s390-ccw/jump2ipl.c +@@ -39,10 +39,15 @@ int jump_to_IPL_code(uint64_t address) + write_subsystem_identification(); + write_iplb_location(); + +- /* prevent unknown IPL types in the guest */ ++ /* ++ * The IPLB for QEMU SCSI type devices must be rebuilt during re-ipl. The ++ * iplb.devno is set to the boot position of the target SCSI device. ++ */ + if (iplb.pbt == S390_IPL_TYPE_QEMU_SCSI) { +- iplb.pbt = S390_IPL_TYPE_CCW; +- set_iplb(&iplb); ++ iplb.devno = qipl.index; ++ if (!set_iplb(&iplb)) { ++ panic("Failed to set IPLB"); ++ } + } + + /* +diff --git a/target/s390x/diag.c b/target/s390x/diag.c +index 27ffd48576..a1fd54ddac 100644 +--- a/target/s390x/diag.c ++++ b/target/s390x/diag.c +@@ -133,7 +133,14 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) + + valid = subcode == DIAG308_PV_SET ? iplb_valid_pv(iplb) : iplb_valid(iplb); + if (!valid) { +- env->regs[r1 + 1] = DIAG_308_RC_INVALID; ++ if (subcode == DIAG308_SET && iplb->pbt == S390_IPL_TYPE_QEMU_SCSI) { ++ s390_rebuild_iplb(iplb->devno, iplb); ++ s390_ipl_update_diag308(iplb); ++ env->regs[r1 + 1] = DIAG_308_RC_OK; ++ } else { ++ env->regs[r1 + 1] = DIAG_308_RC_INVALID; ++ } ++ + goto out; + } + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch b/images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch new file mode 100644 index 000000000..d2a98336f --- /dev/null +++ b/images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch @@ -0,0 +1,48 @@ +From 15f5e84210537514394b18e9dc6c710ad1218ecd Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Tue, 19 Nov 2024 22:31:22 +0100 +Subject: [PATCH 06/10] scsi: fix allocation for s390x loadparm +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [5/8] 6a0e420261eb0521d4f979d2a6c250ee4aae7606 (thuth/qemu-kvm-cs9) + +Coverity reports a possible buffer overrun due to a non-NUL-terminated +string in scsi_property_set_loadparm(). While things are not so easy, +because qdev_prop_sanitize_s390x_loadparm is designed to operate on a +buffer that is not NUL-terminated, in this case the string *does* have +to be NUL-terminated because it is read by scsi_property_get_loadparm +and s390_build_iplb. + +Reviewed-by: jrossi@linux.ibm.com +Cc: thuth@redhat.com +Fixes: 429442e52d9 ("hw: Add "loadparm" property to scsi disk devices for booting on s390x", 2024-11-18) +Signed-off-by: Paolo Bonzini +(cherry picked from commit b73d7eff1eedb2399cd594bc872d5db13506d951) +Signed-off-by: Thomas Huth +--- + hw/scsi/scsi-disk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c +index 7566a5f531..de0c295173 100644 +--- a/hw/scsi/scsi-disk.c ++++ b/hw/scsi/scsi-disk.c +@@ -3152,7 +3152,7 @@ static void scsi_property_set_loadparm(Object *obj, const char *value, + return; + } + +- lp_str = g_malloc0(strlen(value)); ++ lp_str = g_malloc0(strlen(value) + 1); + if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) { + g_free(lp_str); + return; +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch b/images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch new file mode 100644 index 000000000..d67b6f2c4 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch @@ -0,0 +1,176 @@ +From 1ed2fd718be2161f5ad6156dd2311a65b7f3a5e4 Mon Sep 17 00:00:00 2001 +From: Julia Suvorova +Date: Fri, 27 Sep 2024 12:47:41 +0200 +Subject: [PATCH 27/27] target/i386/kvm: Report which action failed in + kvm_arch_put/get_registers + +RH-Author: Julia Suvorova +RH-MergeRequest: 286: kvm: Allow kvm_arch_get/put_registers to accept Error** +RH-Jira: RHEL-60914 +RH-Acked-by: Juraj Marcin +RH-Acked-by: Peter Xu +RH-Commit: [2/2] b5d003dc2ccf869d7a810425baf21c783a96dcd1 + +To help debug and triage future failure reports (akin to [1,2]) that +may occur during kvm_arch_put/get_registers, the error path of each +action is accompanied by unique error message. + +[1] https://issues.redhat.com/browse/RHEL-7558 +[2] https://issues.redhat.com/browse/RHEL-21761 + +Signed-off-by: Julia Suvorova +Reviewed-by: Peter Xu +Link: https://lore.kernel.org/r/20240927104743.218468-3-jusual@redhat.com +Signed-off-by: Paolo Bonzini +(cherry picked from commit fc058618d1596d29e89016750a1aaf64c9fe8832) +--- + target/i386/kvm/kvm.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c +index 423e6922d8..814f93da19 100644 +--- a/target/i386/kvm/kvm.c ++++ b/target/i386/kvm/kvm.c +@@ -5136,6 +5136,7 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) + if (level >= KVM_PUT_RESET_STATE) { + ret = kvm_put_msr_feature_control(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set feature control MSR"); + return ret; + } + } +@@ -5143,12 +5144,14 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) + /* must be before kvm_put_nested_state so that EFER.SVME is set */ + ret = has_sregs2 ? kvm_put_sregs2(x86_cpu) : kvm_put_sregs(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set special registers"); + return ret; + } + + if (level >= KVM_PUT_RESET_STATE) { + ret = kvm_put_nested_state(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set nested state"); + return ret; + } + } +@@ -5166,6 +5169,7 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) + if (xen_mode == XEN_EMULATE && level == KVM_PUT_FULL_STATE) { + ret = kvm_put_xen_state(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set Xen state"); + return ret; + } + } +@@ -5173,37 +5177,45 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) + + ret = kvm_getput_regs(x86_cpu, 1); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set general purpose registers"); + return ret; + } + ret = kvm_put_xsave(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set XSAVE"); + return ret; + } + ret = kvm_put_xcrs(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set XCRs"); + return ret; + } + ret = kvm_put_msrs(x86_cpu, level); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set MSRs"); + return ret; + } + ret = kvm_put_vcpu_events(x86_cpu, level); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set vCPU events"); + return ret; + } + if (level >= KVM_PUT_RESET_STATE) { + ret = kvm_put_mp_state(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set MP state"); + return ret; + } + } + + ret = kvm_put_tscdeadline_msr(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set TSC deadline MSR"); + return ret; + } + ret = kvm_put_debugregs(x86_cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to set debug registers"); + return ret; + } + return 0; +@@ -5218,6 +5230,7 @@ int kvm_arch_get_registers(CPUState *cs, Error **errp) + + ret = kvm_get_vcpu_events(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get vCPU events"); + goto out; + } + /* +@@ -5226,44 +5239,54 @@ int kvm_arch_get_registers(CPUState *cs, Error **errp) + */ + ret = kvm_get_mp_state(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get MP state"); + goto out; + } + ret = kvm_getput_regs(cpu, 0); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get general purpose registers"); + goto out; + } + ret = kvm_get_xsave(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get XSAVE"); + goto out; + } + ret = kvm_get_xcrs(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get XCRs"); + goto out; + } + ret = has_sregs2 ? kvm_get_sregs2(cpu) : kvm_get_sregs(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get special registers"); + goto out; + } + ret = kvm_get_msrs(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get MSRs"); + goto out; + } + ret = kvm_get_apic(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get APIC"); + goto out; + } + ret = kvm_get_debugregs(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get debug registers"); + goto out; + } + ret = kvm_get_nested_state(cpu); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get nested state"); + goto out; + } + #ifdef CONFIG_XEN_EMU + if (xen_mode == XEN_EMULATE) { + ret = kvm_get_xen_state(cs); + if (ret < 0) { ++ error_setg_errno(errp, -ret, "Failed to get Xen state"); + goto out; + } + } +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch b/images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch new file mode 100644 index 000000000..4596afc0a --- /dev/null +++ b/images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch @@ -0,0 +1,74 @@ +From 0e5a728c1d46641bbf5c83289df56422efd374c8 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Sat, 19 Oct 2024 21:29:53 -0400 +Subject: [PATCH 20/27] tests/qtest: Add s390x boot order tests to cdrom-test.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] +RH-Jira: RHEL-11424 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [20/23] 6b8769f2fc5f8c8a6345a5961f54e52be62aae49 (thuth/qemu-kvm-cs9) + +Add two new qtests to verify that a valid IPL device can successfully boot after +failed IPL attempts from one or more invalid devices. + +cdrom-test/as-fallback-device: Defines the primary boot target as a device that +is invalid for IPL and a second boot target that is valid for IPL. Ensures that +the valid device will be selected after the initial failed IPL. + +cdrom-test/as-last-option: Defines the maximum number of boot devices (8) +where only the final entry in the boot order is valid. Ensures that a valid +device will be selected even after multiple failed IPL attempts from both +virtio-blk and virtio-scsi device types. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241020012953.1380075-20-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit f5aa2d9d4c6480fa73b89c935050afe57e5d8bd9) +--- + tests/qtest/cdrom-test.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c +index 5d89e62515..ecba648144 100644 +--- a/tests/qtest/cdrom-test.c ++++ b/tests/qtest/cdrom-test.c +@@ -206,6 +206,30 @@ static void add_s390x_tests(void) + "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " + "-device virtio-blk,drive=d2,bootindex=1 " + "-drive if=none,id=d2,media=cdrom,file=", test_cdboot); ++ qtest_add_data_func("cdrom/boot/as-fallback-device", ++ "-device virtio-serial -device virtio-scsi " ++ "-device virtio-blk,drive=d1,bootindex=1 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " ++ "-device virtio-blk,drive=d2,bootindex=2 " ++ "-drive if=none,id=d2,media=cdrom,file=", test_cdboot); ++ qtest_add_data_func("cdrom/boot/as-last-option", ++ "-device virtio-serial -device virtio-scsi " ++ "-device virtio-blk,drive=d1,bootindex=1 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " ++ "-device virtio-blk,drive=d2,bootindex=2 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d2 " ++ "-device virtio-blk,drive=d3,bootindex=3 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d3 " ++ "-device scsi-hd,drive=d4,bootindex=4 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d4 " ++ "-device scsi-hd,drive=d5,bootindex=5 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d5 " ++ "-device virtio-blk,drive=d6,bootindex=6 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d6 " ++ "-device scsi-hd,drive=d7,bootindex=7 " ++ "-drive driver=null-co,read-zeroes=on,if=none,id=d7 " ++ "-device scsi-cd,drive=d8,bootindex=8 " ++ "-drive if=none,id=d8,media=cdrom,file=", test_cdboot); + if (qtest_has_device("x-terminal3270")) { + qtest_add_data_func("cdrom/boot/without-bootindex", + "-device virtio-scsi -device virtio-serial " +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch b/images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch new file mode 100644 index 000000000..f82a59217 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch @@ -0,0 +1,61 @@ +From 18d64190c2bb43d42e02ea250ffe40b8ba4970f3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Mon, 18 Nov 2024 16:34:30 +0100 +Subject: [PATCH 1/2] vfio/container: Fix container object destruction +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Cédric Le Goater +RH-MergeRequest: 293: vfio/container: Fix container object destruction +RH-Jira: RHEL-67935 +RH-Acked-by: Eric Auger +RH-Acked-by: Alex Williamson +RH-Commit: [1/1] cddda9554b1a858a7265d4ed9b81fdac46772a2c (clegoate/qemu-kvm-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-67935 + +commit ebbf7c60bbd1ceedf9faf962e428ceda2388c248 +Author: Cédric Le Goater +Date: Fri Nov 15 09:34:40 2024 +0100 + + vfio/container: Fix container object destruction + + When commit 96b7af4388b3 intoduced a .instance_finalize() handler, + it did not take into account that the container was not necessarily + inserted into the container list of the address space. Hence, if + the container object is destroyed, by calling object_unref() for + example, before vfio_address_space_insert() is called, QEMU may + crash when removing the container from the list as done in + vfio_container_instance_finalize(). This was seen with an SEV-SNP + guest for which discarding of RAM fails. + + To resolve this issue, use the safe version of QLIST_REMOVE(). + + Cc: Zhenzhong Duan + Cc: Eric Auger + Fixes: 96b7af4388b3 ("vfio/container: Move vfio_container_destroy() to an instance_finalize() handler") + Reviewed-by: Zhenzhong Duan + Signed-off-by: Cédric Le Goater + +Signed-off-by: Cédric Le Goater +--- + hw/vfio/container-base.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c +index 809b157674..6f86c37d97 100644 +--- a/hw/vfio/container-base.c ++++ b/hw/vfio/container-base.c +@@ -103,7 +103,7 @@ static void vfio_container_instance_finalize(Object *obj) + VFIOContainerBase *bcontainer = VFIO_IOMMU(obj); + VFIOGuestIOMMU *giommu, *tmp; + +- QLIST_REMOVE(bcontainer, next); ++ QLIST_SAFE_REMOVE(bcontainer, next); + + QLIST_FOREACH_SAFE(giommu, &bcontainer->giommu_list, giommu_next, tmp) { + memory_region_unregister_iommu_notifier( +-- +2.45.1 + diff --git a/images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch b/images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch new file mode 100644 index 000000000..3dc09ccc9 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch @@ -0,0 +1,70 @@ +From 619ad79630f5ff2c634fa2785acdaa8dc2f66f62 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Wed, 6 Nov 2024 17:28:32 +0100 +Subject: [PATCH 25/27] vfio/migration: Change trace formats from hex to + decimal +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Cédric Le Goater +RH-MergeRequest: 282: vfio/migration: Report only stop-copy size in vfio_state_pending_exact() +RH-Jira: RHEL-64307 +RH-Acked-by: Peter Xu +RH-Acked-by: Alex Williamson +RH-Commit: [2/2] 04c78dea168c6b4edbbf0cbddadb0d760e7afeb5 (clegoate/qemu-kvm-c9s) + +JIRA: https://issues.redhat.com/browse/RHEL-64307 + +commit fa4e20defe239e42af0a1b5c030dec114f799f56 +Author: Avihai Horon +Date: Sun Oct 20 16:01:08 2024 +0300 + + vfio/migration: Change trace formats from hex to decimal + + Data sizes in VFIO migration trace events are printed in hex format + while in migration core trace events they are printed in decimal format. + + This inconsistency makes it less readable when using both trace event + types. Hence, change the data sizes print format to decimal in VFIO + migration trace events. + + Signed-off-by: Avihai Horon + Reviewed-by: Cédric Le Goater + +Signed-off-by: Cédric Le Goater +--- + hw/vfio/trace-events | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events +index 98bd4dccea..3756ff660e 100644 +--- a/hw/vfio/trace-events ++++ b/hw/vfio/trace-events +@@ -151,7 +151,7 @@ vfio_display_edid_write_error(void) "" + vfio_load_cleanup(const char *name) " (%s)" + vfio_load_device_config_state(const char *name) " (%s)" + vfio_load_state(const char *name, uint64_t data) " (%s) data 0x%"PRIx64 +-vfio_load_state_device_data(const char *name, uint64_t data_size, int ret) " (%s) size 0x%"PRIx64" ret %d" ++vfio_load_state_device_data(const char *name, uint64_t data_size, int ret) " (%s) size %"PRIu64" ret %d" + vfio_migration_realize(const char *name) " (%s)" + vfio_migration_set_device_state(const char *name, const char *state) " (%s) state %s" + vfio_migration_set_state(const char *name, const char *new_state, const char *recover_state) " (%s) new state %s, recover state %s" +@@ -160,10 +160,10 @@ vfio_save_block(const char *name, int data_size) " (%s) data_size %d" + vfio_save_cleanup(const char *name) " (%s)" + vfio_save_complete_precopy(const char *name, int ret) " (%s) ret %d" + vfio_save_device_config_state(const char *name) " (%s)" +-vfio_save_iterate(const char *name, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy initial size 0x%"PRIx64" precopy dirty size 0x%"PRIx64 +-vfio_save_setup(const char *name, uint64_t data_buffer_size) " (%s) data buffer size 0x%"PRIx64 +-vfio_state_pending_estimate(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" precopy initial size 0x%"PRIx64" precopy dirty size 0x%"PRIx64 +-vfio_state_pending_exact(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" stopcopy size 0x%"PRIx64" precopy initial size 0x%"PRIx64" precopy dirty size 0x%"PRIx64 ++vfio_save_iterate(const char *name, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy initial size %"PRIu64" precopy dirty size %"PRIu64 ++vfio_save_setup(const char *name, uint64_t data_buffer_size) " (%s) data buffer size %"PRIu64 ++vfio_state_pending_estimate(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy %"PRIu64" postcopy %"PRIu64" precopy initial size %"PRIu64" precopy dirty size %"PRIu64 ++vfio_state_pending_exact(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy %"PRIu64" postcopy %"PRIu64" stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size %"PRIu64 + vfio_vmstate_change(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" + vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" + +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch b/images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch new file mode 100644 index 000000000..2a2204c51 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch @@ -0,0 +1,66 @@ +From 4d37b5f77a60ea951c33ac715584bb6f5897006a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Wed, 6 Nov 2024 17:28:32 +0100 +Subject: [PATCH 24/27] vfio/migration: Report only stop-copy size in + vfio_state_pending_exact() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Cédric Le Goater +RH-MergeRequest: 282: vfio/migration: Report only stop-copy size in vfio_state_pending_exact() +RH-Jira: RHEL-64307 +RH-Acked-by: Peter Xu +RH-Acked-by: Alex Williamson +RH-Commit: [1/2] 5330acbef6f8a8ada56bd4c7f616138df1a94112 (clegoate/qemu-kvm-c9s) + +JIRA: https://issues.redhat.com/browse/RHEL-64307 + +commit 3b5948f808e3b99aedfa0aff45cffbe8b7ec07ed +Author: Avihai Horon +Date: Sun Oct 20 16:01:06 2024 +0300 + + vfio/migration: Report only stop-copy size in vfio_state_pending_exact() + + vfio_state_pending_exact() is used to update migration core how much + device data is left for the device migration. Currently, the sum of + pre-copy and stop-copy sizes of the VFIO device are reported. + + The pre-copy size is obtained via the VFIO_MIG_GET_PRECOPY_INFO ioctl, + which returns the amount of device data available to be transferred + while the device is in the PRE_COPY states. + + The stop-copy size is obtained via the VFIO_DEVICE_FEATURE_MIG_DATA_SIZE + ioctl, which returns the total amount of device data left to be + transferred in order to complete the device migration. + + According to the above, current implementation is wrong -- it reports + extra overlapping data because pre-copy size is already contained in + stop-copy size. Fix it by reporting only stop-copy size. + + Fixes: eda7362af959 ("vfio/migration: Add VFIO migration pre-copy support") + Signed-off-by: Avihai Horon + Reviewed-by: Cédric Le Goater + +Signed-off-by: Cédric Le Goater +--- + hw/vfio/migration.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c +index 262d42a46e..dd717e8d6c 100644 +--- a/hw/vfio/migration.c ++++ b/hw/vfio/migration.c +@@ -576,9 +576,6 @@ static void vfio_state_pending_exact(void *opaque, uint64_t *must_precopy, + + if (vfio_device_state_is_precopy(vbasedev)) { + vfio_query_precopy_size(migration); +- +- *must_precopy += +- migration->precopy_init_size + migration->precopy_dirty_size; + } + + trace_vfio_state_pending_exact(vbasedev->name, *must_precopy, *can_postcopy, +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch b/images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch new file mode 100644 index 000000000..0474c68a0 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch @@ -0,0 +1,94 @@ +From 873e57548d92eb916656b6304a780f63958aa9fe Mon Sep 17 00:00:00 2001 +From: Akihiko Odaki +Date: Tue, 22 Oct 2024 15:49:01 +0900 +Subject: [PATCH 01/10] virtio-net: Add queues before loading them +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: 小田喜陽彦 +RH-MergeRequest: 299: virtio-net: Add queues before loading them +RH-Jira: RHEL-69477 +RH-Acked-by: Laurent Vivier +RH-Acked-by: Jason Wang +RH-Commit: [1/1] 7bd06d5f9c0f0ce3d211204c404451d7002bb7fb (akihiko.odaki/qemu-kvm) + +Call virtio_net_set_multiqueue() to add queues before loading their +states. Otherwise the loaded queues will not have handlers and elements +in them will not be processed. + +Cc: qemu-stable@nongnu.org +Fixes: 8c49756825da ("virtio-net: Add only one queue pair when realizing") +Reported-by: Laurent Vivier +Signed-off-by: Akihiko Odaki +Acked-by: Michael S. Tsirkin +Signed-off-by: Jason Wang +(cherry picked from commit 9379ea9db3c0064fa2787db0794a23a30f7b2d2d) +--- + hw/net/virtio-net.c | 10 ++++++++++ + hw/virtio/virtio.c | 7 +++++++ + include/hw/virtio/virtio.h | 2 ++ + 3 files changed, 19 insertions(+) + +diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c +index ed33a32877..90d05f94d4 100644 +--- a/hw/net/virtio-net.c ++++ b/hw/net/virtio-net.c +@@ -3032,6 +3032,15 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue) + virtio_net_set_queue_pairs(n); + } + ++static int virtio_net_pre_load_queues(VirtIODevice *vdev) ++{ ++ virtio_net_set_multiqueue(VIRTIO_NET(vdev), ++ virtio_has_feature(vdev->guest_features, VIRTIO_NET_F_RSS) || ++ virtio_has_feature(vdev->guest_features, VIRTIO_NET_F_MQ)); ++ ++ return 0; ++} ++ + static int virtio_net_post_load_device(void *opaque, int version_id) + { + VirtIONet *n = opaque; +@@ -4010,6 +4019,7 @@ static void virtio_net_class_init(ObjectClass *klass, void *data) + vdc->guest_notifier_mask = virtio_net_guest_notifier_mask; + vdc->guest_notifier_pending = virtio_net_guest_notifier_pending; + vdc->legacy_features |= (0x1 << VIRTIO_NET_F_GSO); ++ vdc->pre_load_queues = virtio_net_pre_load_queues; + vdc->post_load = virtio_net_post_load_virtio; + vdc->vmsd = &vmstate_virtio_net_device; + vdc->primary_unplug_pending = primary_unplug_pending; +diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c +index 9e10cbc058..10f24a58dd 100644 +--- a/hw/virtio/virtio.c ++++ b/hw/virtio/virtio.c +@@ -3251,6 +3251,13 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) + config_len--; + } + ++ if (vdc->pre_load_queues) { ++ ret = vdc->pre_load_queues(vdev); ++ if (ret) { ++ return ret; ++ } ++ } ++ + num = qemu_get_be32(f); + + if (num > VIRTIO_QUEUE_MAX) { +diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h +index 0fcbc5c0c6..953dfca27c 100644 +--- a/include/hw/virtio/virtio.h ++++ b/include/hw/virtio/virtio.h +@@ -210,6 +210,8 @@ struct VirtioDeviceClass { + void (*guest_notifier_mask)(VirtIODevice *vdev, int n, bool mask); + int (*start_ioeventfd)(VirtIODevice *vdev); + void (*stop_ioeventfd)(VirtIODevice *vdev); ++ /* Called before loading queues. Useful to add queues before loading. */ ++ int (*pre_load_queues)(VirtIODevice *vdev); + /* Saving and loading of a device; trying to deprecate save/load + * use vmsd for new devices. + */ +-- +2.39.3 + diff --git a/images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch b/images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch new file mode 100644 index 000000000..39d808a18 --- /dev/null +++ b/images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch @@ -0,0 +1,61 @@ +From b38e94f0f0d45f8edd30828d4bb620430e604048 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Tue, 20 Aug 2024 17:11:12 +0400 +Subject: [PATCH 10/10] vnc: fix crash when no console attached +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Marc-André Lureau +RH-MergeRequest: 300: vnc: fix crash when no console attached +RH-Jira: RHEL-61633 +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 91fc70408701fa1e20ed8fefb8cdf424451dcc20 (marcandre.lureau-rh/qemu-kvm-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-61633 + +Since commit e99441a3793b5 ("ui/curses: Do not use console_select()") +qemu_text_console_put_keysym() no longer checks for NULL console +argument, which leads to a later crash: + +Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. +0x00005555559ee186 in qemu_text_console_handle_keysym (s=0x0, keysym=31) at ../ui/console-vc.c:332 +332 } else if (s->echo && (keysym == '\r' || keysym == '\n')) { +(gdb) bt + #0 0x00005555559ee186 in qemu_text_console_handle_keysym (s=0x0, keysym=31) at ../ui/console-vc.c:332 + #1 0x00005555559e18e5 in qemu_text_console_put_keysym (s=, keysym=) at ../ui/console.c:303 + #2 0x00005555559f2e88 in do_key_event (vs=vs@entry=0x5555579045c0, down=down@entry=1, keycode=keycode@entry=60, sym=sym@entry=65471) at ../ui/vnc.c:2034 + #3 0x00005555559f845c in ext_key_event (vs=0x5555579045c0, down=1, sym=65471, keycode=) at ../ui/vnc.c:2070 + #4 protocol_client_msg (vs=0x5555579045c0, data=, len=) at ../ui/vnc.c:2514 + #5 0x00005555559f515c in vnc_client_read (vs=0x5555579045c0) at ../ui/vnc.c:1607 + +Fixes: e99441a3793b5 ("ui/curses: Do not use console_select()") +Fixes: https://issues.redhat.com/browse/RHEL-50529 +Cc: qemu-stable@nongnu.org +Signed-off-by: Marc-André Lureau +Reviewed-by: Akihiko Odaki +Reviewed-by: Michael Tokarev +Signed-off-by: Michael Tokarev + +(cherry picked from commit 0e60fc80938d9ce84274a36ddfaaa640bdef2be8) +Signed-off-by: Marc-André Lureau +--- + ui/vnc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ui/vnc.c b/ui/vnc.c +index dae5d51210..5057ec8680 100644 +--- a/ui/vnc.c ++++ b/ui/vnc.c +@@ -1935,7 +1935,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) + } + + qkbd_state_key_event(vs->vd->kbd, qcode, down); +- if (!qemu_console_is_graphic(vs->vd->dcl.con)) { ++ if (QEMU_IS_TEXT_CONSOLE(vs->vd->dcl.con)) { + QemuTextConsole *con = QEMU_TEXT_CONSOLE(vs->vd->dcl.con); + bool numlock = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK); + bool control = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL); +-- +2.39.3 + diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 5e83e7ecc..3ac725133 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -1,5 +1,5 @@ --- -{{- $versionQemu := "9.2.0" }} +{{- $versionQemu := "9.1.0" }} {{- $gitRepoUrl := "https://github.com/qemu/qemu.git" }} {{- $gitRepoName := "qemu" }} @@ -14,6 +14,15 @@ git: stageDependencies: setup: - install-qemu.sh +- add: /images/{{ $.ImageName }} + to: / + stageDependencies: + install: + - '**/*' + includePaths: + - patches + excludePaths: + - patches/README.md shell: beforeInstall: - | @@ -116,6 +125,11 @@ shell: git clone --depth=1 --branch v{{ $versionQemu }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionQemu }} cd {{ $gitRepoName }}-{{ $versionQemu }} + + for p in /patches/*.patch ; do + echo -n "Apply ${p} ... " + git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1) + done ./configure \ --target-list="x86_64-softmmu" \ @@ -125,6 +139,7 @@ shell: --block-drv-rw-whitelist="qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress,virtio-blk-vhost-vdpa,virtio-blk-vfio-pci,virtio-blk-vhost-user,io_uring,nvme-io_uring" \ --block-drv-ro-whitelist="vdi,vmdk,vhdx,vpc,https" \ --disable-alsa \ + --disable-af-xdp \ --disable-attr \ --disable-auth-pam \ --disable-avx2 \ From 2e3e358fef749f9d2868af3552ec12bbb926c42c Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 28 Jan 2025 15:39:02 +0300 Subject: [PATCH 057/107] qemu: back to 9.2.0 Signed-off-by: Nikita Korolev --- .../patches/0004-Initial-redhat-build.patch | 331 ----- ...0005-Enable-disable-devices-for-RHEL.patch | 905 ------------ ...Machine-type-related-general-changes.patch | 749 ---------- ...temporarily-disable-Wunused-function.patch | 36 - ...machine-type-versions-for-aarch64-s3.patch | 139 -- ...rsioned-machine-type-macros-for-RHEL.patch | 195 --- ...ease-deletion-schedule-to-3-releases.patch | 33 - ...aarch64-versioned-virt-machine-types.patch | 368 ----- ...-ppc64-versioned-spapr-machine-types.patch | 529 -------- ...390x-versioned-s390-ccw-virtio-machi.patch | 327 ----- ...86_64-versioned-pc-q35-machine-types.patch | 925 ------------- ...temporarily-disable-Wunused-function.patch | 32 - .../patches/0016-Enable-make-check.patch | 280 ---- ...mber-of-devices-that-can-be-assigned.patch | 110 -- ...Add-support-statement-to-help-output.patch | 55 - ...documentation-instead-of-qemu-system.patch | 61 - ...on-warning-when-opening-v2-images-rw.patch | 77 -- ...-Update-the-logfile-path-of-qga-fsfr.patch | 43 - ...0023-Add-upstream-compatibility-bits.patch | 109 -- ...9.1-compat-handling-to-the-s390x-mac.patch | 37 - ...25-redhat-Add-rhel9.6.0-machine-type.patch | 55 - ...tibility-of-pc-q35-rhel9-and-pc-i440.patch | 43 - ...m-ensure-compatibility-of-virt-rhel9.patch | 27 - ...e-new-virt-machine-type-for-rhel-9.6.patch | 41 - ...new-pc-q35-machine-type-for-rhel-9.6.patch | 42 - ...Manufacturer-and-Product-Name-in-emu.patch | 90 -- ...-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch | 49 - ...KVM-Dynamic-sized-kvm-memslots-array.patch | 250 ---- ...moryListener.nr_used_slots-to-nr_slo.patch | 72 - ...me-KVMState-nr_slots-to-nr_slots_max.patch | 89 -- ...-accel-kvm-refactor-dirty-ring-setup.patch | 143 -- ...m-Update-documentation-for-s390x-IPL.patch | 76 -- ...index-Make-it-clear-that-s390x-can-a.patch | 45 - ...x-bootdevices-Update-loadparm-docume.patch | 65 - ...x-bootdevices-Update-the-documentati.patch | 66 - ...rge-property-after-the-memory-region.patch | 61 - ...property-to-scsi-disk-devices-for-bo.patch | 221 --- ...x-Build-an-IPLB-for-each-boot-device.patch | 270 ---- ...the-possibility-to-load-the-s390-net.patch | 201 --- ...t-loadparm-property-to-devices-that-.patch | 113 -- ...vide-more-memory-to-the-s390-ccw.img.patch | 61 - ...-Add-include-files-for-common-IPL-st.patch | 402 ------ ...ch_get-put_registers-to-accept-Error.patch | 287 ---- ...e-virtual-machine-creation-into-its-.patch | 143 -- ...ntf-with-error_report-printf-in-kvm_.patch | 131 -- ...pipes-to-keep-working-for-fd-migrati.patch | 116 -- ...ration-Ensure-vmstate_save-sets-errp.patch | 92 -- ...90-ccw-Clarify-alignment-is-in-bytes.patch | 60 - ...ios-s390-ccw-Don-t-generate-TEXTRELs.patch | 83 -- ...-Enable-failed-IPL-to-return-after-e.patch | 426 ------ ...ios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch | 63 - ...-Link-the-netboot-code-into-the-main.patch | 263 ---- ...-Merge-netboot.mak-into-the-main-Mak.patch | 141 -- ...-Re-initialize-receive-queue-index-b.patch | 45 - ...ccw-Remove-panics-from-DASD-IPL-path.patch | 177 --- ...ccw-Remove-panics-from-ECKD-IPL-path.patch | 475 ------- ...-ccw-Remove-panics-from-ISO-IPL-path.patch | 269 ---- ...-Remove-panics-from-Netboot-IPL-path.patch | 130 -- ...ccw-Remove-panics-from-SCSI-IPL-path.patch | 554 -------- ...-Use-the-libc-from-SLOF-and-remove-s.patch | 1208 ----------------- ...-s390x-Enable-multi-device-boot-loop.patch | 227 ---- ...itialize-cdrom-type-to-false-for-eac.patch | 43 - ...itialize-machine-loadparm-before-pro.patch | 55 - ...m-pc-q35-Bump-max_cpus-to-4096-vcpus.patch | 75 - ...dual-loadparm-assignment-to-CCW-devi.patch | 362 ----- ...LB-for-SCSI-device-directly-from-DIA.patch | 264 ---- ...si-fix-allocation-for-s390x-loadparm.patch | 48 - ...Report-which-action-failed-in-kvm_ar.patch | 176 --- ...s390x-boot-order-tests-to-cdrom-test.patch | 74 - ...ner-Fix-container-object-destruction.patch | 61 - ...hange-trace-formats-from-hex-to-deci.patch | 70 - ...eport-only-stop-copy-size-in-vfio_st.patch | 66 - ...o-net-Add-queues-before-loading-them.patch | 94 -- ...c-fix-crash-when-no-console-attached.patch | 61 - images/qemu-artifact/werf.inc.yaml | 17 +- 75 files changed, 1 insertion(+), 14178 deletions(-) delete mode 100644 images/qemu-artifact/patches/0004-Initial-redhat-build.patch delete mode 100644 images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch delete mode 100644 images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch delete mode 100644 images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch delete mode 100644 images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch delete mode 100644 images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch delete mode 100644 images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch delete mode 100644 images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch delete mode 100644 images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch delete mode 100644 images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch delete mode 100644 images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch delete mode 100644 images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch delete mode 100644 images/qemu-artifact/patches/0016-Enable-make-check.patch delete mode 100644 images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch delete mode 100644 images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch delete mode 100644 images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch delete mode 100644 images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch delete mode 100644 images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch delete mode 100644 images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch delete mode 100644 images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch delete mode 100644 images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch delete mode 100644 images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch delete mode 100644 images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch delete mode 100644 images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch delete mode 100644 images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch delete mode 100644 images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch delete mode 100644 images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch delete mode 100644 images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch delete mode 100644 images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch delete mode 100644 images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch delete mode 100644 images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch delete mode 100644 images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch delete mode 100644 images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch delete mode 100644 images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch delete mode 100644 images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch delete mode 100644 images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch delete mode 100644 images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch delete mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch delete mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch delete mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch delete mode 100644 images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch delete mode 100644 images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch delete mode 100644 images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch delete mode 100644 images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch delete mode 100644 images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch delete mode 100644 images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch delete mode 100644 images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch delete mode 100644 images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch delete mode 100644 images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch delete mode 100644 images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch delete mode 100644 images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch delete mode 100644 images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch delete mode 100644 images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch delete mode 100644 images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch delete mode 100644 images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch delete mode 100644 images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch delete mode 100644 images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch delete mode 100644 images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch diff --git a/images/qemu-artifact/patches/0004-Initial-redhat-build.patch b/images/qemu-artifact/patches/0004-Initial-redhat-build.patch deleted file mode 100644 index 6fae1c686..000000000 --- a/images/qemu-artifact/patches/0004-Initial-redhat-build.patch +++ /dev/null @@ -1,331 +0,0 @@ -From cbd36e2ba7f3e96ce441c7cfbf92017a7ba3bfe8 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina -Date: Wed, 26 May 2021 10:56:02 +0200 -Subject: Initial redhat build - -This patch introduces redhat build structure in redhat subdirectory. In addition, -several issues are fixed in QEMU tree: - -- Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm - - As we use qemu-kvm as name in all places, this is updated to be consistent -- Man page renamed from qemu to qemu-kvm - - man page is installed using make install so we have to fix it in qemu tree - -We disable make check due to issues with some of the tests. - -This rebase is based on qemu-kvm-9.0.0-10.el9 - -Signed-off-by: Miroslav Rezanina --- -Rebase changes (6.1.0): -- Move build to .distro -- Move changes for support file to related commit -- Added dependency for python3-sphinx-rtd_theme -- Removed --disable-sheepdog configure option -- Added new hw-display modules -- SASL initialization moved to ui/vnc-auth-sasl.c -- Add accel-qtest- and accel-tcg-x86_64 libraries -- Added hw-usb-host module -- Disable new configure options (bpf, nvmm, slirp-smbd) -- Use -pie for ksmctl build (annocheck complain fix) - -Rebase changes (6.2.0): -- removed --disable-jemalloc and --disable-tcmalloc configure options -- added audio-oss.so -- added fdt requirement for x86_64 -- tests/acceptance renamed to tests/avocado -- added multiboot_dma.bin -- Add -Wno-string-plus-int to extra flags -- Updated configure options - -Rebase changes (7.0.0): -- Do not use -mlittle CFLAG on ppc64le -- Used upstream handling issue with ui/clipboard.c -- Use -mlittle-endian on ppc64le instead of deleteing it in configure -- Drop --disable-libxml2 option for configure (upstream) -- Remove vof roms -- Disable AVX2 support -- Use internal meson -- Disable new configure options (dbus-display and qga-vss) -- Change permissions on installing tests/Makefile.include -- Remove ssh block driver - -Rebase changes (7.1.0): -- --disable-vnc-png renamed to --disable-png (upstream) -- removed --disable-vhost-vsock and --disable-vhost-scsi -- capstone submodule removed -- Temporary include capstone build - -Rebase changes (7.2.0): -- Switch --enable-slirp=system to --enable-slirp -- Added new configure options (blkio and sndio, both disabled) - -Rebase changes (7.2.0): -- Fix SRPM name generation to work on Fedora 37 -- Switch back to system meson - -Rebase changes (8.0.0): -- use enable-dtrace-backands instead of enable-dtrace-backend -- Removed qemu virtiofsd bits -- test/check-block.sh removed (upstream) -- Add new --disable-* options for configure - -Rebase changes (8.1.0): -- qmp-spec.txt installed by make -- Removed --meson configure option -- Add --disable-pypi -- Removed --with-git and -with-gitsubmodules -- Renamed --disable-pypi to --disable-downloads -- Minor updates in README.tests - -Rebase changes (8.2.0): -- Removed --disable-hax (upstream) -- Added --disable-plugins configure option -- Fixing frh.py strings - -Rebase notes (9.0.0): -- Fixed qemu-kvm binary location change -- Remove hppa-firmware64.img -- Package stp files for utilities -- Download subprojects on local build - -Rebase notes (9.1.0 rc0): -- Explicit BuildRequires for python3-tomli -- Removed --disable-avx512f configure option - -Merged patches (6.0.0): - - 605758c902 Limit build on Power to qemu-img and qemu-ga only - -Merged patches (6.1.0): -- f04f91751f Use cached tarballs -- 6581165c65 Remove message with running VM count -- 03c3cac9fc spec-file: build qemu-kvm without SPICE and QXL -- e0ae6c1f6c spec-file: Obsolete qemu-kvm-ui-spice -- 9d2e9f9ecf spec: Do not build qemu-kvm-block-gluster -- cf470b4234 spec: Do not link pcnet and ne2k_pci roms -- e981284a6b redhat: Install the s390-netboot.img that we've built -- 24ef557f33 spec: Remove usage of Group: tag -- c40d69b4f4 spec: Drop %defattr usage -- f8e98798ce spec: Clean up BuildRequires -- 47246b43ee spec: Remove iasl BuildRequires -- 170dc1cbe0 spec: Remove redundant 0 in conditionals -- 8718f6fa11 spec: Add more have_XXX conditionals -- a001269ce9 spec: Remove binutils versioned Requires -- 34545ee641 spec: Remove diffutils BuildRequires -- c2c82beac9 spec: Remove redundant Requires: -- 9314c231f4 spec: Add XXX_version macros -- c43db0bf0f spec: Add have_block_rbd -- 3ecb0c0319 qga: drop StandardError=syslog -- 018049dc80 Remove iscsi support -- a2edf18777 redhat: Replace the kvm-setup.service with a /etc/modules-load.d config file -- 387b5fbcfe redhat: Move qemu-kvm-docs dependency to qemu-kvm -- 4ead693178 redhat: introducting qemu-kvm-hw-usbredir -- 4dc6fc3035 redhat: use the standard vhost-user JSON path -- 84757178b4 Fix local build -- 8c394227dd spec: Restrict block drivers in tools -- b6aa7c1fae Move tools to separate package -- eafd82e509 Split qemu-pr-helper to separate package -- 2c0182e2aa spec: RPM_BUILD_ROOT -> %{buildroot} -- 91bd55ca13 spec: More use of %{name} instead of 'qemu-kvm' -- 50ba299c61 spec: Use qemu-pr-helper.service from qemu.git (partial) -- ee08d4e0a3 spec: Use %{_sourcedir} for referencing sources -- 039e7f7d02 spec: Add tools_only -- 884ba71617 spec: %build: Add run_configure helper -- 8ebd864d65 spec: %build: Disable more bits with %{disable_everything} (partial) -- f23fdb53f5 spec: %build: Add macros for some 'configure' parameters -- fe951a8bd8 spec: %files: Move qemu-guest-agent and qemu-img earlier -- 353b632e37 spec: %install: Remove redundant bits -- 9d2015b752 spec: %install: Add %{modprobe_kvm_conf} macro -- 6d05134e8c spec: %install: Remove qemu-guest-agent /etc/qemu-kvm usage -- 985b226467 spec: %install: clean up qemu-ga section -- dfaf9c600d spec: %install: Use a single %{tools_only} section -- f6978ddb46 spec: Make tools_only not cross spec sections -- 071c211098 spec: %install: Limit time spent in %{qemu_kvm_build} -- 1b65c674be spec: misc syntactic merges with Fedora -- 4da16294cf spec: Use Fedora's pattern for specifying rc version -- d7ee259a79 spec: %files: don't use fine grained -docs file list -- 64cad0c60f spec: %files: Add licenses to qemu-common too -- c3de4f080a spec: %install: Drop python3 shebang fixup -- 46fc216115 Update local build to work with spec file improvements -- bab9531548 spec: Remove buildldflags -- c8360ab6a9 spec: Use %make_build macro -- f6966c66e9 spec: Drop make install sharedir and datadir usage -- 86982421bc spec: use %make_install macro -- 191c405d22 spec: parallelize `make check` -- 251a1fb958 spec: Drop explicit --build-id -- 44c7dda6c3 spec: use %{build_ldflags} -- 0009a34354 Move virtiofsd to separate package -- 34d1b200b3 Utilize --firmware configure option -- 2800e1dd03 spec: Switch toolchain to Clang/LLVM (except process-patches.sh) -- e8a70f500f spec: Use safe-stack for x86_64 -- e29445d50d spec: Reenable write support for VMDK etc. in tools -- a4fe2a3e16 redhat: Disable LTO on non-x86 architectures - -Merged patches (6.2.0): -- 333452440b remove sgabios dependency -- 7d3633f184 enable pulseaudio -- bd898709b0 spec: disable use of gcrypt for crypto backends in favour of gnutls -- e4f0c6dee6 spec: Remove block-curl and block-ssh dependency -- 4dc13bfe63 spec: Build the VDI block driver -- d2f2ff3c74 spec: Explicitly include compress filter -- a7d047f9c2 Move ksmtuned files to separate package - -Merged patches (7.0.0): -- 098d4d08d0 spec: Rename qemu-kvm-hw-usbredir to qemu-kvm-device-usb-redirect -- c2bd0d6834 spec: Split qemu-kvm-ui-opengl -- 2c9cda805d spec: Introduce packages for virtio-gpu-* modules (changed as rhel device tree not set) -- d0414a3e0b spec: Introduce device-display-virtio-vga* packages -- 3534ec46d4 spec: Move usb-host module to separate package -- ddc14d4737 spec: Move qtest accel module to tests package -- 6f2c4befa6 spec: Extend qemu-kvm-core description -- 6f11866e4e (rhel/rhel-9.0.0) Update to qemu-kvm-6.2.0-6.el9 -- da0a28758f ui/clipboard: fix use-after-free regression -- 895d4d52eb spec: Remove qemu-virtiofsd -- c8c8c8bd84 spec: Fix obsolete for spice subpackages -- d46d2710b2 spec: Obsolete old usb redir subpackage -- 6f52a50b68 spec: Obsolete ssh driver - -Merged patches (7.2.0): -- 8c6834feb6 Remove opengl display device subpackages (C9S MR 124) -- 0ecc97f29e spec: Add requires for packages with additional virtio-gpu variants (C9S MR 124) - -Merged patches (8.0.0): -- 7754f6ba78 Minor packaging fixes -- 401af56187 spec: Disable VDUSE - -Merged patches (8.1.0): -- 0c2306676f Enable Linux io_uring -- b7fa6426d5 Enable libblkio block drivers -- 19f6d7a6f4 Fix virtio-blk-vhost-vdpa typo in spec file -- f356cae88f spec: Build DBUS display -- 77b763efd5 Provide elf2dmp binary in qemu-tools - -Merged patches (8.2.0): -- cd9efa221d Enable qemu-kvm-device-usb-redirec for aarch64 - -Merged patches (9.0.0 rc0): -- 25de053dbf spec: Enable zstd - -Signed-off-by: Miroslav Rezanina ---- - .distro/Makefile | 101 + - .distro/Makefile.common | 42 + - .distro/README.tests | 39 + - .distro/modules-load.conf | 4 + - .distro/qemu-guest-agent.service | 1 - - .distro/qemu-kvm.spec.template | 5351 +++++++++++++++++++++++ - .distro/rpminspect.yaml | 6 +- - .distro/scripts/extract_build_cmd.py | 12 + - .distro/scripts/frh.py | 4 +- - .distro/scripts/process-patches.sh | 6 +- - .gitignore | 1 + - README.systemtap | 43 + - scripts/qemu-guest-agent/fsfreeze-hook | 2 +- - scripts/systemtap/conf.d/qemu_kvm.conf | 4 + - scripts/systemtap/script.d/qemu_kvm.stp | 1 + - ui/vnc-auth-sasl.c | 2 +- - 16 files changed, 5612 insertions(+), 7 deletions(-) - create mode 100644 .distro/Makefile - create mode 100644 .distro/Makefile.common - create mode 100644 .distro/README.tests - create mode 100644 .distro/modules-load.conf - create mode 100644 .distro/qemu-kvm.spec.template - create mode 100644 README.systemtap - create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf - create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp - -diff --git a/README.systemtap b/README.systemtap -new file mode 100644 -index 0000000000..ad913fc990 ---- /dev/null -+++ b/README.systemtap -@@ -0,0 +1,43 @@ -+QEMU tracing using systemtap-initscript -+--------------------------------------- -+ -+You can capture QEMU trace data all the time using systemtap-initscript. This -+uses SystemTap's flight recorder mode to trace all running guests to a -+fixed-size buffer on the host. Old trace entries are overwritten by new -+entries when the buffer size wraps. -+ -+1. Install the systemtap-initscript package: -+ # yum install systemtap-initscript -+ -+2. Install the systemtap scripts and the conf file: -+ # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/ -+ # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/ -+ -+The set of trace events to enable is given in qemu_kvm.stp. This SystemTap -+script can be customized to add or remove trace events provided in -+/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp. -+ -+SystemTap customizations can be made to qemu_kvm.conf to control the flight -+recorder buffer size and whether to store traces in memory only or disk too. -+See stap(1) for option documentation. -+ -+3. Start the systemtap service. -+ # service systemtap start qemu_kvm -+ -+4. Make the service start at boot time. -+ # chkconfig systemtap on -+ -+5. Confirm that the service works. -+ # service systemtap status qemu_kvm -+ qemu_kvm is running... -+ -+When you want to inspect the trace buffer, perform the following steps: -+ -+1. Dump the trace buffer. -+ # staprun -A qemu_kvm >/tmp/trace.log -+ -+2. Start the systemtap service because the preceding step stops the service. -+ # service systemtap start qemu_kvm -+ -+3. Translate the trace record to readable format. -+ # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log -diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook -index 13aafd4845..e9b84ec028 100755 ---- a/scripts/qemu-guest-agent/fsfreeze-hook -+++ b/scripts/qemu-guest-agent/fsfreeze-hook -@@ -8,7 +8,7 @@ - # request, it is issued with "thaw" argument after filesystem is thawed. - - LOGFILE=/var/log/qga-fsfreeze-hook.log --FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d -+FSFREEZE_D=$(dirname -- "$(realpath $0)")/fsfreeze-hook.d - - # Check whether file $1 is a backup or rpm-generated file and should be ignored - is_ignored_file() { -diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf -new file mode 100644 -index 0000000000..372d8160a4 ---- /dev/null -+++ b/scripts/systemtap/conf.d/qemu_kvm.conf -@@ -0,0 +1,4 @@ -+# Force load uprobes (see BZ#1118352) -+stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true -+ -+qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes -diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp -new file mode 100644 -index 0000000000..c04abf9449 ---- /dev/null -+++ b/scripts/systemtap/script.d/qemu_kvm.stp -@@ -0,0 +1 @@ -+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {} -diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c -index 47fdae5b21..2a950caa2a 100644 ---- a/ui/vnc-auth-sasl.c -+++ b/ui/vnc-auth-sasl.c -@@ -42,7 +42,7 @@ - - bool vnc_sasl_server_init(Error **errp) - { -- int saslErr = sasl_server_init(NULL, "qemu"); -+ int saslErr = sasl_server_init(NULL, "qemu-kvm"); - - if (saslErr != SASL_OK) { - error_setg(errp, "Failed to initialize SASL auth: %s", --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch b/images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch deleted file mode 100644 index 0fdb3617b..000000000 --- a/images/qemu-artifact/patches/0005-Enable-disable-devices-for-RHEL.patch +++ /dev/null @@ -1,905 +0,0 @@ -From f9c7b0f1176bc2a0ddd97de6e0fbc1055eab7b57 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina -Date: Wed, 7 Dec 2022 03:05:48 -0500 -Subject: Enable/disable devices for RHEL - -This commit adds all changes related to changes in supported devices. - -Signed-off-by: Miroslav Rezanina --- -Rebase notes (6.1.0): -- Added CONFIG_TPM (except s390x) -- default-configs moved to configs -- Use --with-device- configure option to use rhel configs - -Rebase notes (6.2.0): -- Add CONFIG_ISA_FDC -- Do not remove -no-hpet documentation - -Rebase notes (7.0.0): -- Added CONFIG_ARM_GIC_TCG option for aarch64 -- Fixes necessary for layout change fixes -- Renamed CONFIG_ARM_GIC_TCG to CONFIG_ARM_GICV3_TCG -- Removed upstream devices - -Rebase notes (7.1.0): -- Added CONFIG_VHOST_VSOCK and CONFIG_VHOST_USER_VSOCK configs -- Added CONFIG_CXL and CONFIG_CXL_MEM_DEVICE for aarch64 and x86_64 -- Added CONFIG_VHOST_USER_FS option (all archs) - -Rebase notes (7.2.0): -- Removed disabling a15mpcore.c as no longer needed - -Rebase notes (8.0.0): -- Rename CONFIG_ACPI_X86_ICH to CONFIG_ACPI_ICH9 -- Inlude qemu/error-report.h in hw/display/cirrus_vga.c -- Change virtiofsd dependency version - -Rebase notes (8.1.0): -- Added CONFIG_PCIE_PCI_BRIDGE for x86_64 -- Disabling tcg cpus for aarch64 -- Disable CONFIG_ARM_V7M and remove related hack -- Moved aarch64 tcg cpu disabling from arm machine type commit - -Rebase notes (8.2.0): -- Disabled new a710 arm64 tcg cpu -- No longer needed hack for removal of i2c-echo -- Disable new neoverse-v2 -- Removed CONFIG_OPENGL from x86_64 config file - -Rebase notes (9.0.0 rc0): -- Split CONFIG_IDE_QDEV to CONFIG_IDE_DEV and CONFIG_IDE_BUS (upstream change) - -Rebase notes (9.0.0 rc1): -- Do not compile armv7 cpu types - -Rebase notes (9.1.0 rc0): -- Return value added for kvm_s390_apply_cpu_model -- Added new USB_HID and USB_HUB options - -Rebase notes (9.1.0 rc1): -- Fix disabling cpus in valid_cpy_types - -Merged patches (6.1.0): -- c51bf45304 Remove SPICE and QXL from x86_64-rh-devices.mak -- 02fc745601 aarch64-rh-devices: add CONFIG_PVPANIC_PCI -- f2fe835153 aarch64-rh-devices: add CONFIG_PXB -- b5431733ad disable CONFIG_USB_STORAGE_BOT -- 478ba0cdf6 Disable TPM passthrough -- 2504d68a7c aarch64: Add USB storage devices -- 51c2a3253c disable ac97 audio - -Merged patches (6.2.0): -- 9f2f9fa2ba disable sga device - -Merged patches (7.0.0): -- fd7c45a5a8 redhat: Enable virtio-mem as tech-preview on x86-64 -- c9e68ea451 Enable SGX -- RH Only - -Merged patches (7.1.0): -- 38b89dc245 pc: Move s3/s4 suspend disabling to compat (only hw/acpi/ich9.c chunk) -- 8f663466c6 configs/devices/aarch64-softmmu: Enable CONFIG_VIRTIO_MEM -- 1bf372717a Enable virtio-iommu-pci on aarch64 -- ae3f269458 Enable virtio-iommu-pci on x86_64 - -Merged patches (8.1.0): -- 8173d2eaba Disable unwanted new devices - -Merged patches (8.2.0): -- b29f66431f Enable igb on x86_64 - -Merged patches (9.0.0 rc0): -- 3889ede5d9 Compile IOMMUFD on x86_64 -- 0beb18451f Compile IOMMUFD on s390x -- 2b4b13f70d Compile IOMMUFD object on aarch64 ---- - .distro/qemu-kvm.spec.template | 18 +-- - .../aarch64-softmmu/aarch64-rh-devices.mak | 44 +++++++ - .../ppc64-softmmu/ppc64-rh-devices.mak | 37 ++++++ - configs/devices/rh-virtio.mak | 10 ++ - .../s390x-softmmu/s390x-rh-devices.mak | 19 +++ - .../x86_64-softmmu/x86_64-rh-devices.mak | 114 ++++++++++++++++++ - hw/arm/virt.c | 4 + - hw/block/fdc.c | 10 ++ - hw/cxl/meson.build | 3 +- - hw/display/cirrus_vga.c | 4 + - hw/ide/piix.c | 5 +- - hw/input/pckbd.c | 2 + - hw/net/e1000.c | 2 + - hw/ppc/spapr_cpu_core.c | 2 + - hw/usb/meson.build | 2 +- - hw/virtio/meson.build | 6 +- - target/arm/arm-qmp-cmds.c | 2 + - target/arm/cpu.c | 4 + - target/arm/cpu.h | 3 + - target/arm/cpu64.c | 12 +- - target/arm/tcg/cpu32.c | 2 + - target/arm/tcg/cpu64.c | 8 ++ - target/arm/tcg/meson.build | 4 +- - target/ppc/cpu-models.c | 9 ++ - target/s390x/cpu_models_sysemu.c | 3 + - target/s390x/kvm/kvm.c | 8 ++ - tests/qtest/arm-cpu-features.c | 4 + - 27 files changed, 325 insertions(+), 16 deletions(-) - create mode 100644 configs/devices/aarch64-softmmu/aarch64-rh-devices.mak - create mode 100644 configs/devices/ppc64-softmmu/ppc64-rh-devices.mak - create mode 100644 configs/devices/rh-virtio.mak - create mode 100644 configs/devices/s390x-softmmu/s390x-rh-devices.mak - create mode 100644 configs/devices/x86_64-softmmu/x86_64-rh-devices.mak - -diff --git a/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak -new file mode 100644 -index 0000000000..c7e4fdc25a ---- /dev/null -+++ b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak -@@ -0,0 +1,44 @@ -+include ../rh-virtio.mak -+ -+CONFIG_ARM_GIC_KVM=y -+CONFIG_ARM_GICV3_TCG=y -+CONFIG_ARM_GIC=y -+CONFIG_ARM_SMMUV3=y -+CONFIG_ARM_VIRT=y -+CONFIG_CXL=y -+CONFIG_CXL_MEM_DEVICE=y -+CONFIG_EDID=y -+CONFIG_PCIE_PORT=y -+CONFIG_PCIE_PCI_BRIDGE=y -+CONFIG_PCI_DEVICES=y -+CONFIG_PCI_TESTDEV=y -+CONFIG_PFLASH_CFI01=y -+CONFIG_SCSI=y -+CONFIG_SEMIHOSTING=y -+CONFIG_USB=y -+CONFIG_USB_XHCI=y -+CONFIG_USB_XHCI_PCI=y -+CONFIG_USB_STORAGE_CORE=y -+CONFIG_USB_STORAGE_CLASSIC=y -+CONFIG_USB_HUB=y -+CONFIG_USB_HID=y -+CONFIG_VFIO=y -+CONFIG_VFIO_PCI=y -+CONFIG_VIRTIO_MMIO=y -+CONFIG_VIRTIO_PCI=y -+CONFIG_VIRTIO_MEM=y -+CONFIG_VIRTIO_IOMMU=y -+CONFIG_XIO3130=y -+CONFIG_NVDIMM=y -+CONFIG_ACPI_APEI=y -+CONFIG_TPM=y -+CONFIG_TPM_EMULATOR=y -+CONFIG_TPM_TIS_SYSBUS=y -+CONFIG_PTIMER=y -+CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y -+CONFIG_PVPANIC_PCI=y -+CONFIG_PXB=y -+CONFIG_VHOST_VSOCK=y -+CONFIG_VHOST_USER_VSOCK=y -+CONFIG_VHOST_USER_FS=y -+CONFIG_IOMMUFD=y -diff --git a/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak b/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak -new file mode 100644 -index 0000000000..dbb7d30829 ---- /dev/null -+++ b/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak -@@ -0,0 +1,37 @@ -+include ../rh-virtio.mak -+ -+CONFIG_DIMM=y -+CONFIG_MEM_DEVICE=y -+CONFIG_NVDIMM=y -+CONFIG_PCI=y -+CONFIG_PCI_DEVICES=y -+CONFIG_PCI_TESTDEV=y -+CONFIG_PCI_EXPRESS=y -+CONFIG_PSERIES=y -+CONFIG_SCSI=y -+CONFIG_SPAPR_VSCSI=y -+CONFIG_TEST_DEVICES=y -+CONFIG_USB=y -+CONFIG_USB_OHCI=y -+CONFIG_USB_OHCI_PCI=y -+CONFIG_USB_SMARTCARD=y -+CONFIG_USB_STORAGE_CORE=y -+CONFIG_USB_STORAGE_CLASSIC=y -+CONFIG_USB_XHCI=y -+CONFIG_USB_XHCI_NEC=y -+CONFIG_USB_XHCI_PCI=y -+CONFIG_VFIO=y -+CONFIG_VFIO_PCI=y -+CONFIG_VGA=y -+CONFIG_VGA_PCI=y -+CONFIG_VHOST_USER=y -+CONFIG_VIRTIO_PCI=y -+CONFIG_VIRTIO_VGA=y -+CONFIG_WDT_IB6300ESB=y -+CONFIG_XICS=y -+CONFIG_XIVE=y -+CONFIG_TPM=y -+CONFIG_TPM_SPAPR=y -+CONFIG_TPM_EMULATOR=y -+CONFIG_VHOST_VSOCK=y -+CONFIG_VHOST_USER_VSOCK=y -diff --git a/configs/devices/rh-virtio.mak b/configs/devices/rh-virtio.mak -new file mode 100644 -index 0000000000..94ede1b5f6 ---- /dev/null -+++ b/configs/devices/rh-virtio.mak -@@ -0,0 +1,10 @@ -+CONFIG_VIRTIO=y -+CONFIG_VIRTIO_BALLOON=y -+CONFIG_VIRTIO_BLK=y -+CONFIG_VIRTIO_GPU=y -+CONFIG_VIRTIO_INPUT=y -+CONFIG_VIRTIO_INPUT_HOST=y -+CONFIG_VIRTIO_NET=y -+CONFIG_VIRTIO_RNG=y -+CONFIG_VIRTIO_SCSI=y -+CONFIG_VIRTIO_SERIAL=y -diff --git a/configs/devices/s390x-softmmu/s390x-rh-devices.mak b/configs/devices/s390x-softmmu/s390x-rh-devices.mak -new file mode 100644 -index 0000000000..24cf6dbd03 ---- /dev/null -+++ b/configs/devices/s390x-softmmu/s390x-rh-devices.mak -@@ -0,0 +1,19 @@ -+include ../rh-virtio.mak -+ -+CONFIG_PCI=y -+CONFIG_S390_CCW_VIRTIO=y -+CONFIG_S390_FLIC=y -+CONFIG_S390_FLIC_KVM=y -+CONFIG_SCLPCONSOLE=y -+CONFIG_SCSI=y -+CONFIG_VFIO=y -+CONFIG_VFIO_AP=y -+CONFIG_VFIO_CCW=y -+CONFIG_VFIO_PCI=y -+CONFIG_VHOST_USER=y -+CONFIG_VIRTIO_CCW=y -+CONFIG_WDT_DIAG288=y -+CONFIG_VHOST_VSOCK=y -+CONFIG_VHOST_USER_VSOCK=y -+CONFIG_VHOST_USER_FS=y -+CONFIG_IOMMUFD=y -diff --git a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak -new file mode 100644 -index 0000000000..3e5f693b62 ---- /dev/null -+++ b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak -@@ -0,0 +1,114 @@ -+include ../rh-virtio.mak -+ -+CONFIG_ACPI=y -+CONFIG_ACPI_PCI=y -+CONFIG_ACPI_CPU_HOTPLUG=y -+CONFIG_ACPI_MEMORY_HOTPLUG=y -+CONFIG_ACPI_NVDIMM=y -+CONFIG_ACPI_SMBUS=y -+CONFIG_ACPI_VMGENID=y -+CONFIG_ACPI_X86=y -+CONFIG_ACPI_ICH9=y -+CONFIG_AHCI=y -+CONFIG_APIC=y -+CONFIG_APM=y -+CONFIG_BOCHS_DISPLAY=y -+CONFIG_CXL=y -+CONFIG_CXL_MEM_DEVICE=y -+CONFIG_DIMM=y -+CONFIG_E1000E_PCI_EXPRESS=y -+CONFIG_E1000_PCI=y -+CONFIG_EDU=y -+CONFIG_FDC=y -+CONFIG_FDC_SYSBUS=y -+CONFIG_FDC_ISA=y -+CONFIG_FW_CFG_DMA=y -+CONFIG_HDA=y -+CONFIG_HYPERV=y -+CONFIG_HYPERV_TESTDEV=y -+CONFIG_I2C=y -+CONFIG_I440FX=y -+CONFIG_I8254=y -+CONFIG_I8257=y -+CONFIG_I8259=y -+CONFIG_I82801B11=y -+CONFIG_IDE_CORE=y -+CONFIG_IDE_PCI=y -+CONFIG_IDE_PIIX=y -+CONFIG_IDE_DEV=y -+CONFIG_IDE_BUS=y -+CONFIG_IGB_PCI_EXPRESS=y -+CONFIG_IOAPIC=y -+CONFIG_IOH3420=y -+CONFIG_ISA_BUS=y -+CONFIG_ISA_DEBUG=y -+CONFIG_ISA_TESTDEV=y -+CONFIG_LPC_ICH9=y -+CONFIG_MC146818RTC=y -+CONFIG_MEM_DEVICE=y -+CONFIG_NVDIMM=y -+CONFIG_PAM=y -+CONFIG_PC=y -+CONFIG_PCI=y -+CONFIG_PCIE_PORT=y -+CONFIG_PCI_DEVICES=y -+CONFIG_PCI_EXPRESS=y -+CONFIG_PCI_EXPRESS_Q35=y -+CONFIG_PCI_I440FX=y -+CONFIG_PCI_TESTDEV=y -+CONFIG_PCKBD=y -+CONFIG_PCSPK=y -+CONFIG_PC_ACPI=y -+CONFIG_PC_PCI=y -+CONFIG_PCIE_PCI_BRIDGE=y -+CONFIG_PFLASH_CFI01=y -+CONFIG_PVPANIC_ISA=y -+CONFIG_PXB=y -+CONFIG_Q35=y -+CONFIG_RTL8139_PCI=y -+CONFIG_SCSI=y -+CONFIG_SERIAL=y -+CONFIG_SERIAL_ISA=y -+CONFIG_SERIAL_PCI=y -+CONFIG_SEV=y -+CONFIG_SMBIOS=y -+CONFIG_SMBUS_EEPROM=y -+CONFIG_TEST_DEVICES=y -+CONFIG_USB=y -+CONFIG_USB_EHCI=y -+CONFIG_USB_EHCI_PCI=y -+CONFIG_USB_SMARTCARD=y -+CONFIG_USB_STORAGE_CORE=y -+CONFIG_USB_STORAGE_CLASSIC=y -+CONFIG_USB_UHCI=y -+CONFIG_USB_XHCI=y -+CONFIG_USB_XHCI_NEC=y -+CONFIG_USB_XHCI_PCI=y -+CONFIG_USB_HUB=y -+CONFIG_USB_HID=y -+CONFIG_VFIO=y -+CONFIG_VFIO_PCI=y -+CONFIG_VGA=y -+CONFIG_VGA_CIRRUS=y -+CONFIG_VGA_PCI=y -+CONFIG_VHOST_USER=y -+CONFIG_VHOST_USER_BLK=y -+CONFIG_VIRTIO_MEM=y -+CONFIG_VIRTIO_PCI=y -+CONFIG_VIRTIO_VGA=y -+CONFIG_VIRTIO_IOMMU=y -+CONFIG_VMMOUSE=y -+CONFIG_VMPORT=y -+CONFIG_VTD=y -+CONFIG_WDT_IB6300ESB=y -+CONFIG_WDT_IB700=y -+CONFIG_XIO3130=y -+CONFIG_TPM=y -+CONFIG_TPM_CRB=y -+CONFIG_TPM_TIS_ISA=y -+CONFIG_TPM_EMULATOR=y -+CONFIG_SGX=y -+CONFIG_VHOST_VSOCK=y -+CONFIG_VHOST_USER_VSOCK=y -+CONFIG_VHOST_USER_FS=y -+CONFIG_IOMMUFD=y -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 687fe0bb8b..eea7d2d038 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -3032,6 +3032,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - MachineClass *mc = MACHINE_CLASS(oc); - HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); - static const char * const valid_cpu_types[] = { -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - #ifdef CONFIG_TCG - ARM_CPU_TYPE_NAME("cortex-a7"), - ARM_CPU_TYPE_NAME("cortex-a15"), -@@ -3047,8 +3048,11 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - ARM_CPU_TYPE_NAME("neoverse-n2"), - #endif /* TARGET_AARCH64 */ - #endif /* CONFIG_TCG */ -+#endif /* disabled for RHEL */ - #ifdef TARGET_AARCH64 -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - ARM_CPU_TYPE_NAME("cortex-a53"), -+#endif /* disabled for RHEL */ - ARM_CPU_TYPE_NAME("cortex-a57"), - #if defined(CONFIG_KVM) || defined(CONFIG_HVF) - ARM_CPU_TYPE_NAME("host"), -diff --git a/hw/block/fdc.c b/hw/block/fdc.c -index 6dd94e98bc..a05757fc9a 100644 ---- a/hw/block/fdc.c -+++ b/hw/block/fdc.c -@@ -49,6 +49,8 @@ - #include "qom/object.h" - #include "fdc-internal.h" - -+#include "hw/boards.h" -+ - /********************************************************/ - /* debug Floppy devices */ - -@@ -2346,6 +2348,14 @@ void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, Error **errp) - FDrive *drive; - static int command_tables_inited = 0; - -+ /* Restricted for Red Hat Enterprise Linux: */ -+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); -+ if (!strstr(mc->name, "-rhel7.")) { -+ error_setg(errp, "Device %s is not supported with machine type %s", -+ object_get_typename(OBJECT(dev)), mc->name); -+ return; -+ } -+ - if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) { - error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'"); - return; -diff --git a/hw/cxl/meson.build b/hw/cxl/meson.build -index 3e375f61a9..613adb3ebb 100644 ---- a/hw/cxl/meson.build -+++ b/hw/cxl/meson.build -@@ -6,7 +6,8 @@ system_ss.add(when: 'CONFIG_CXL', - 'cxl-host.c', - 'cxl-cdat.c', - 'cxl-events.c', -- 'switch-mailbox-cci.c', -+# Disabled for 8.2.0 rebase for RHEL 9.4.0 -+# 'switch-mailbox-cci.c', - ), - if_false: files( - 'cxl-host-stubs.c', -diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c -index 150883a971..497365bd80 100644 ---- a/hw/display/cirrus_vga.c -+++ b/hw/display/cirrus_vga.c -@@ -36,6 +36,7 @@ - #include "qemu/module.h" - #include "qemu/units.h" - #include "qemu/log.h" -+#include "qemu/error-report.h" - #include "sysemu/reset.h" - #include "qapi/error.h" - #include "trace.h" -@@ -2946,6 +2947,9 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Error **errp) - PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); - int16_t device_id = pc->device_id; - -+ warn_report("'cirrus-vga' is deprecated, " -+ "please use a different VGA card instead"); -+ - /* - * Follow real hardware, cirrus card emulated has 4 MB video memory. - * Also accept 8 MB/16 MB for backward compatibility. -diff --git a/hw/ide/piix.c b/hw/ide/piix.c -index 80efc633d3..9cb82b8eea 100644 ---- a/hw/ide/piix.c -+++ b/hw/ide/piix.c -@@ -191,7 +191,8 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data) - k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1; - k->class_id = PCI_CLASS_STORAGE_IDE; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); -- dc->hotpluggable = false; -+ /* Disabled for Red Hat Enterprise Linux: */ -+ dc->user_creatable = false; - } - - static const TypeInfo piix3_ide_info = { -@@ -215,6 +216,8 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data) - k->class_id = PCI_CLASS_STORAGE_IDE; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->hotpluggable = false; -+ /* Disabled for Red Hat Enterprise Linux: */ -+ dc->user_creatable = false; - } - - static const TypeInfo piix4_ide_info = { -diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c -index 74f10b640f..2e85ecf476 100644 ---- a/hw/input/pckbd.c -+++ b/hw/input/pckbd.c -@@ -952,6 +952,8 @@ static void i8042_class_initfn(ObjectClass *klass, void *data) - dc->vmsd = &vmstate_kbd_isa; - adevc->build_dev_aml = i8042_build_aml; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -+ /* Disabled for Red Hat Enterprise Linux: */ -+ dc->user_creatable = false; - } - - static const TypeInfo i8042_info = { -diff --git a/hw/net/e1000.c b/hw/net/e1000.c -index 5012b96464..b435e54228 100644 ---- a/hw/net/e1000.c -+++ b/hw/net/e1000.c -@@ -1746,6 +1746,7 @@ static const E1000Info e1000_devices[] = { - .revision = 0x03, - .phy_id2 = E1000_PHY_ID2_8254xx_DEFAULT, - }, -+#if 0 /* Disabled for Red Hat Enterprise Linux 7 */ - { - .name = "e1000-82544gc", - .device_id = E1000_DEV_ID_82544GC_COPPER, -@@ -1758,6 +1759,7 @@ static const E1000Info e1000_devices[] = { - .revision = 0x03, - .phy_id2 = E1000_PHY_ID2_8254xx_DEFAULT, - }, -+#endif - }; - - static void e1000_register_types(void) -diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c -index 56090abcd1..0bf7c52077 100644 ---- a/hw/ppc/spapr_cpu_core.c -+++ b/hw/ppc/spapr_cpu_core.c -@@ -399,10 +399,12 @@ static const TypeInfo spapr_cpu_core_type_infos[] = { - .instance_size = sizeof(SpaprCpuCore), - .class_size = sizeof(SpaprCpuCoreClass), - }, -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - DEFINE_SPAPR_CPU_CORE_TYPE("970_v2.2"), - DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.0"), - DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.1"), - DEFINE_SPAPR_CPU_CORE_TYPE("power5p_v2.1"), -+#endif - DEFINE_SPAPR_CPU_CORE_TYPE("power7_v2.3"), - DEFINE_SPAPR_CPU_CORE_TYPE("power7p_v2.1"), - DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"), -diff --git a/hw/usb/meson.build b/hw/usb/meson.build -index d7de1003e3..1cdc0a1ba0 100644 ---- a/hw/usb/meson.build -+++ b/hw/usb/meson.build -@@ -55,7 +55,7 @@ system_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader - if cacard.found() - usbsmartcard_ss = ss.source_set() - usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD', -- if_true: [cacard, files('ccid-card-emulated.c', 'ccid-card-passthru.c')]) -+ if_true: [cacard, files('ccid-card-passthru.c')]) - hw_usb_modules += {'smartcard': usbsmartcard_ss} - endif - -diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build -index 621fc65454..c38bdd6fa4 100644 ---- a/hw/virtio/meson.build -+++ b/hw/virtio/meson.build -@@ -20,7 +20,8 @@ if have_vhost - system_virtio_ss.add(files('vhost-user-base.c')) - - # MMIO Stubs -- system_virtio_ss.add(files('vhost-user-device.c')) -+# Disabled for 8.2.0 rebase for RHEL 9.4.0 -+# system_virtio_ss.add(files('vhost-user-device.c')) - system_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) - system_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) - system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) -@@ -28,7 +29,8 @@ if have_vhost - system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c')) - - # PCI Stubs -- system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) -+# Disabled for 8.2.0 rebase for RHEL 9.4.0 -+# system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) - system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], - if_true: files('vhost-user-gpio-pci.c')) - system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], -diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c -index 3cc8cc738b..6f21fea1f5 100644 ---- a/target/arm/arm-qmp-cmds.c -+++ b/target/arm/arm-qmp-cmds.c -@@ -223,6 +223,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, - static void arm_cpu_add_definition(gpointer data, gpointer user_data) - { - ObjectClass *oc = data; -+ CPUClass *cc = CPU_CLASS(oc); - CpuDefinitionInfoList **cpu_list = user_data; - CpuDefinitionInfo *info; - const char *typename; -@@ -231,6 +232,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data) - info = g_malloc0(sizeof(*info)); - info->name = cpu_model_from_type(typename); - info->q_typename = g_strdup(typename); -+ info->deprecated = !!cc->deprecation_note; - - QAPI_LIST_PREPEND(*cpu_list, info); - } -diff --git a/target/arm/cpu.c b/target/arm/cpu.c -index 19191c2391..465f423d25 100644 ---- a/target/arm/cpu.c -+++ b/target/arm/cpu.c -@@ -2726,6 +2726,10 @@ static void cpu_register_class_init(ObjectClass *oc, void *data) - - acc->info = data; - cc->gdb_core_xml_file = "arm-core.xml"; -+ -+ if (acc->info->deprecation_note) { -+ cc->deprecation_note = acc->info->deprecation_note; -+ } - } - - void arm_cpu_register(const ARMCPUInfo *info) -diff --git a/target/arm/cpu.h b/target/arm/cpu.h -index 9a3fd59562..1261eae94d 100644 ---- a/target/arm/cpu.h -+++ b/target/arm/cpu.h -@@ -35,6 +35,8 @@ - #define KVM_HAVE_MCE_INJECTION 1 - #endif - -+#define RHEL_CPU_DEPRECATION "use 'host' / 'max'" -+ - #define EXCP_UDEF 1 /* undefined instruction */ - #define EXCP_SWI 2 /* software interrupt */ - #define EXCP_PREFETCH_ABORT 3 -@@ -1110,6 +1112,7 @@ typedef struct ARMCPUInfo { - const char *name; - void (*initfn)(Object *obj); - void (*class_init)(ObjectClass *oc, void *data); -+ const char *deprecation_note; - } ARMCPUInfo; - - /** -diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c -index 262a1d6c0b..800514d3fc 100644 ---- a/target/arm/cpu64.c -+++ b/target/arm/cpu64.c -@@ -653,6 +653,7 @@ static void aarch64_a57_initfn(Object *obj) - define_cortex_a72_a57_a53_cp_reginfo(cpu); - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void aarch64_a53_initfn(Object *obj) - { - ARMCPU *cpu = ARM_CPU(obj); -@@ -710,6 +711,7 @@ static void aarch64_a53_initfn(Object *obj) - cpu->gic_pribits = 5; - define_cortex_a72_a57_a53_cp_reginfo(cpu); - } -+#endif - - static void aarch64_host_initfn(Object *obj) - { -@@ -748,8 +750,11 @@ static void aarch64_max_initfn(Object *obj) - } - - static const ARMCPUInfo aarch64_cpus[] = { -- { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, -+ { .name = "cortex-a57", .initfn = aarch64_a57_initfn, -+ .deprecation_note = RHEL_CPU_DEPRECATION }, -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, -+#endif /* disabled for RHEL */ - { .name = "max", .initfn = aarch64_max_initfn }, - #if defined(CONFIG_KVM) || defined(CONFIG_HVF) - { .name = "host", .initfn = aarch64_host_initfn }, -@@ -820,8 +825,13 @@ static void aarch64_cpu_instance_init(Object *obj) - static void cpu_register_class_init(ObjectClass *oc, void *data) - { - ARMCPUClass *acc = ARM_CPU_CLASS(oc); -+ CPUClass *cc = CPU_CLASS(oc); - - acc->info = data; -+ -+ if (acc->info->deprecation_note) { -+ cc->deprecation_note = acc->info->deprecation_note; -+ } - } - - void aarch64_cpu_register(const ARMCPUInfo *info) -diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c -index 20c2737f17..7e66fb6f14 100644 ---- a/target/arm/tcg/cpu32.c -+++ b/target/arm/tcg/cpu32.c -@@ -120,6 +120,7 @@ void aa32_max_features(ARMCPU *cpu) - cpu->isar.id_dfr1 = t; - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - /* CPU models. These are not needed for the AArch64 linux-user build. */ - #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) - -@@ -1066,3 +1067,4 @@ static void arm_tcg_cpu_register_types(void) - type_init(arm_tcg_cpu_register_types) - - #endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */ -+#endif /* disabled for RHEL */ -diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c -index fe232eb306..2678047488 100644 ---- a/target/arm/tcg/cpu64.c -+++ b/target/arm/tcg/cpu64.c -@@ -29,6 +29,7 @@ - #include "cpu-features.h" - #include "cpregs.h" - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static uint64_t make_ccsidr64(unsigned assoc, unsigned linesize, - unsigned cachesize) - { -@@ -135,6 +136,7 @@ static void aarch64_a35_initfn(Object *obj) - /* These values are the same with A53/A57/A72. */ - define_cortex_a72_a57_a53_cp_reginfo(cpu); - } -+#endif - - static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -@@ -224,6 +226,7 @@ static void cpu_max_get_l0gptsz(Object *obj, Visitor *v, const char *name, - static Property arm_cpu_lpa2_property = - DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true); - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void aarch64_a55_initfn(Object *obj) - { - ARMCPU *cpu = ARM_CPU(obj); -@@ -1074,6 +1077,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj) - aarch64_add_pauth_properties(obj); - aarch64_add_sve_properties(obj); - } -+#endif - - /* - * -cpu max: a CPU with as many features enabled as our emulation supports. -@@ -1295,6 +1299,7 @@ void aarch64_max_tcg_initfn(Object *obj) - qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static const ARMCPUInfo aarch64_cpus[] = { - { .name = "cortex-a35", .initfn = aarch64_a35_initfn }, - { .name = "cortex-a55", .initfn = aarch64_a55_initfn }, -@@ -1306,14 +1311,17 @@ static const ARMCPUInfo aarch64_cpus[] = { - { .name = "neoverse-v1", .initfn = aarch64_neoverse_v1_initfn }, - { .name = "neoverse-n2", .initfn = aarch64_neoverse_n2_initfn }, - }; -+#endif - - static void aarch64_cpu_register_types(void) - { -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - size_t i; - - for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { - aarch64_cpu_register(&aarch64_cpus[i]); - } -+#endif - } - - type_init(aarch64_cpu_register_types) -diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build -index 508932a249..7a12d7bfba 100644 ---- a/target/arm/tcg/meson.build -+++ b/target/arm/tcg/meson.build -@@ -58,5 +58,5 @@ arm_system_ss.add(files( - 'psci.c', - )) - --arm_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c')) --arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files('cpu-v7m.c')) -+#arm_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c')) -+#arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files('cpu-v7m.c')) -diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c -index f2301b43f7..f77ebfcc81 100644 ---- a/target/ppc/cpu-models.c -+++ b/target/ppc/cpu-models.c -@@ -66,6 +66,7 @@ - #define POWERPC_DEF(_name, _pvr, _type, _desc) \ - POWERPC_DEF_SVR(_name, _desc, _pvr, POWERPC_SVR_NONE, _type) - -+#if 0 /* Embedded and 32-bit CPUs disabled for Red Hat Enterprise Linux */ - /* Embedded PowerPC */ - /* PowerPC 405 family */ - /* PowerPC 405 cores */ -@@ -698,8 +699,10 @@ - "PowerPC 7447A v1.2 (G4)") - POWERPC_DEF("7457a_v1.2", CPU_POWERPC_74x7A_v12, 7455, - "PowerPC 7457A v1.2 (G4)") -+#endif - /* 64 bits PowerPC */ - #if defined(TARGET_PPC64) -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - POWERPC_DEF("970_v2.2", CPU_POWERPC_970_v22, 970, - "PowerPC 970 v2.2") - POWERPC_DEF("970fx_v1.0", CPU_POWERPC_970FX_v10, 970, -@@ -718,6 +721,7 @@ - "PowerPC 970MP v1.1") - POWERPC_DEF("power5p_v2.1", CPU_POWERPC_POWER5P_v21, POWER5P, - "POWER5+ v2.1") -+#endif - POWERPC_DEF("power7_v2.3", CPU_POWERPC_POWER7_v23, POWER7, - "POWER7 v2.3") - POWERPC_DEF("power7p_v2.1", CPU_POWERPC_POWER7P_v21, POWER7, -@@ -894,13 +898,16 @@ PowerPCCPUAlias ppc_cpu_aliases[] = { - { "7447a", "7447a_v1.2" }, - { "7457a", "7457a_v1.2" }, - { "apollo7pm", "7457a_v1.0" }, -+#endif - #if defined(TARGET_PPC64) -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - { "970", "970_v2.2" }, - { "970fx", "970fx_v3.1" }, - { "970mp", "970mp_v1.1" }, - { "power5+", "power5p_v2.1" }, - { "power5+_v2.1", "power5p_v2.1" }, - { "power5gs", "power5+_v2.1" }, -+#endif - { "power7", "power7_v2.3" }, - { "power7+", "power7p_v2.1" }, - { "power7+_v2.1", "power7p_v2.1" }, -@@ -911,12 +918,14 @@ PowerPCCPUAlias ppc_cpu_aliases[] = { - { "power10", "power10_v2.0" }, - #endif - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - /* Generic PowerPCs */ - #if defined(TARGET_PPC64) - { "ppc64", "970fx_v3.1" }, - #endif - { "ppc32", "604" }, - { "ppc", "604" }, -+#endif - - { NULL, NULL } - }; -diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c -index f6df691b66..72572726b8 100644 ---- a/target/s390x/cpu_models_sysemu.c -+++ b/target/s390x/cpu_models_sysemu.c -@@ -34,6 +34,9 @@ static void check_unavailable_features(const S390CPUModel *max_model, - (max_model->def->gen == model->def->gen && - max_model->def->ec_ga < model->def->ec_ga)) { - list_add_feat("type", unavailable); -+ } else if (model->def->gen < 11 && kvm_enabled()) { -+ /* Older CPU models are not supported on Red Hat Enterprise Linux */ -+ list_add_feat("type", unavailable); - } - - /* detect missing features if any to properly report them */ -diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c -index 94181d9281..45c23758e7 100644 ---- a/target/s390x/kvm/kvm.c -+++ b/target/s390x/kvm/kvm.c -@@ -2566,6 +2566,14 @@ bool kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) - error_setg(errp, "KVM doesn't support CPU models"); - return false; - } -+ -+ /* Older CPU models are not supported on Red Hat Enterprise Linux */ -+ if (model->def->gen < 11) { -+ error_setg(errp, "KVM: Unsupported CPU type specified: %s", -+ MACHINE(qdev_get_machine())->cpu_type); -+ return false; -+ } -+ - prop.cpuid = s390_cpuid_from_cpu_model(model); - prop.ibc = s390_ibc_from_cpu_model(model); - /* configure cpu features indicated via STFL(e) */ -diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c -index cfd6f77353..3016e6233c 100644 ---- a/tests/qtest/arm-cpu-features.c -+++ b/tests/qtest/arm-cpu-features.c -@@ -452,8 +452,10 @@ static void test_query_cpu_model_expansion(const void *data) - assert_error(qts, "host", "The CPU type 'host' requires KVM", NULL); - - /* Test expected feature presence/absence for some cpu types */ -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - assert_has_feature_enabled(qts, "cortex-a15", "pmu"); - assert_has_not_feature(qts, "cortex-a15", "aarch64"); -+#endif /* disabled for RHEL */ - - /* Enabling and disabling pmu should always work. */ - assert_has_feature_enabled(qts, "max", "pmu"); -@@ -470,6 +472,7 @@ static void test_query_cpu_model_expansion(const void *data) - assert_has_feature_enabled(qts, "cortex-a57", "pmu"); - assert_has_feature_enabled(qts, "cortex-a57", "aarch64"); - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - assert_has_feature_enabled(qts, "a64fx", "pmu"); - assert_has_feature_enabled(qts, "a64fx", "aarch64"); - /* -@@ -482,6 +485,7 @@ static void test_query_cpu_model_expansion(const void *data) - "{ 'sve384': true }"); - assert_error(qts, "a64fx", "cannot enable sve640", - "{ 'sve640': true }"); -+#endif /* disabled for RHEL */ - - sve_tests_default(qts, "max"); - pauth_tests_default(qts, "max"); --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch b/images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch deleted file mode 100644 index 2d6ee37f9..000000000 --- a/images/qemu-artifact/patches/0006-Machine-type-related-general-changes.patch +++ /dev/null @@ -1,749 +0,0 @@ -From dc310c3f76c0d986ec4dc5a548a8ff37a85d61cf Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina -Date: Fri, 11 Jan 2019 09:54:45 +0100 -Subject: Machine type related general changes - -This patch is first part of original "Add RHEL machine types" patch we -split to allow easier review. It contains changes not related to any -architecture. - -Signed-off-by: Miroslav Rezanina --- -Rebase notes (6.2.0): -- Do not duplicate minimal_version_id for piix4_pm -- Remove empty line chunks in serial.c -- Remove migration.h include in serial.c -- Update hw_compat_rhel_8_5 (from MR 66) - -Rebase notes (7.0.0): -- Remove downstream changes leftovers in hw/rtc/mc146818rtc.c -- Remove unnecessary change in hw/usb/hcd-uhci.c - -Rebase notes (7.1.0): -- Moved adding rhel_old_machine_deprecation variable from s390x to general machine types commit -- Moved adding hw_compat_rhel_8_6 struct from x86_64 to general machine types commit - -Rebase notes (8.1.0): -- Do not modify unused vga-isa.c - -Rebase notes (9.0.0 rc0): -- Updated smsbios handling - -Rebase notes (9.0.0 rc4): -- Moving downstream compat changes - -Merged patches (6.1.0): -- f2fb42a3c6 redhat: add missing entries in hw_compat_rhel_8_4 -- 1949ec258e hw/arm/virt: Disable PL011 clock migration through hw_compat_rhel_8_3 -- a3995e2eff Remove RHEL 7.0.0 machine type (only generic changes) -- ad3190a79b Remove RHEL 7.1.0 machine type (only generic changes) -- 84bbe15d4e Remove RHEL 7.2.0 machine type (only generic changes) -- 0215eb3356 Remove RHEL 7.3.0 machine types (only generic changes) -- af69d1ca6e Remove RHEL 7.4.0 machine types (only generic changes) -- 8f7a74ab78 Remove RHEL 7.5.0 machine types (only generic changes) - -Merged patches (6.2.0): -- d687ac13d2 redhat: Define hw_compat_rhel_8_5 - -Merged patches (7.0.0): -- ef5afcc86d Fix virtio-net-pci* "vectors" compat -- 168f0d56e3 compat: Update hw_compat_rhel_8_5 with 6.2.0 RC2 changes - -Merged patches (7.1.0): -- 38b89dc245 pc: Move s3/s4 suspend disabling to compat (only hw/acpi/piix4.c chunk) -- 1d6439527a WRB: Introduce RHEL 9.0.0 hw compat structure (only hw/core/machine.c and include/hw/boards.h chunk) - -Merged patches (7.2.0): -- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) - -Merged patches (8.0.0): -- 21ed34787b Addd 7.2 compat bits for RHEL 9.1 machine type -- e5c8d5d603 virtio-rng-pci: fix migration compat for vectors -- 5a5fa77059 virtio-rng-pci: fix transitional migration compat for vectors - -Merged patches (8.1.0): -- bd5d81d286 Add RHEL 9.2.0 compat structure (general part) -- 1165e24c6b hw/pci: Disable PCI_ERR_UNCOR_MASK reg for machine type <= pc-q35-rhel9.2.0 - -Merged patches (8.2.0): -- 4ee284aca9 Add machine types compat bits. (partial) - -Merged patches (9.0.0 rc0): -- 4b8fe42abc virtio-mem: default-enable "dynamic-memslots" - -Merged patches (9.1.0 rc0): -- 043ad5ce97 Add upstream compatibility bits (partial) -- 770eeed61e rhel 9.4.0 machine type compat for virtio-gpu migration ---- - hw/acpi/piix4.c | 2 +- - hw/arm/virt.c | 3 +- - hw/core/machine.c | 281 +++++++++++++++++++++++++++++++++++ - hw/i386/fw_cfg.c | 3 +- - hw/net/rtl8139.c | 4 +- - hw/smbios/smbios.c | 46 +++++- - hw/timer/i8254_common.c | 2 +- - hw/usb/hcd-xhci-pci.c | 59 ++++++-- - hw/usb/hcd-xhci-pci.h | 1 + - hw/virtio/virtio-mem.c | 3 +- - include/hw/boards.h | 43 ++++++ - include/hw/firmware/smbios.h | 4 +- - include/hw/i386/pc.h | 3 + - 13 files changed, 430 insertions(+), 24 deletions(-) - -diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c -index debe1adb84..e8ddcd716e 100644 ---- a/hw/acpi/piix4.c -+++ b/hw/acpi/piix4.c -@@ -245,7 +245,7 @@ static bool vmstate_test_migrate_acpi_index(void *opaque, int version_id) - static const VMStateDescription vmstate_acpi = { - .name = "piix4_pm", - .version_id = 3, -- .minimum_version_id = 3, -+ .minimum_version_id = 2, - .post_load = vmstate_acpi_post_load, - .fields = (const VMStateField[]) { - VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState), -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index eea7d2d038..b2aa3f1355 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -1699,7 +1699,8 @@ static void virt_build_smbios(VirtMachineState *vms) - } - - smbios_set_defaults("QEMU", product, -- vmc->smbios_old_sys_ver ? "1.0" : mc->name); -+ vmc->smbios_old_sys_ver ? "1.0" : mc->name, -+ NULL, NULL); - - /* build the array of physical mem area from base_memmap */ - mem_array.address = vms->memmap[VIRT_MEM].base; -diff --git a/hw/core/machine.c b/hw/core/machine.c -index 27dcda0248..f7fed78e4b 100644 ---- a/hw/core/machine.c -+++ b/hw/core/machine.c -@@ -305,6 +305,287 @@ GlobalProperty hw_compat_2_1[] = { - }; - const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); - -+/* -+ * RHEL only: machine types for previous major releases are deprecated -+ */ -+const char *rhel_old_machine_deprecation = -+ "machine types for previous major releases are deprecated"; -+ -+GlobalProperty hw_compat_rhel_9_5[] = { -+ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ -+ { "migration", "zero-page-detection", "legacy"}, -+ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ -+ { TYPE_VIRTIO_IOMMU_PCI, "granule", "4k" }, -+ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ -+ { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "64" }, -+ /* hw_compat_rhel_9_5 from hw_compat_8_2 */ -+ { "virtio-gpu-device", "x-scanout-vmstate-version", "1" }, -+}; -+const size_t hw_compat_rhel_9_5_len = G_N_ELEMENTS(hw_compat_rhel_9_5); -+ -+GlobalProperty hw_compat_rhel_9_4[] = { -+ /* hw_compat_rhel_9_4 from hw_compat_8_0 */ -+ { TYPE_VIRTIO_NET, "host_uso", "off"}, -+ /* hw_compat_rhel_9_4 from hw_compat_8_0 */ -+ { TYPE_VIRTIO_NET, "guest_uso4", "off"}, -+ /* hw_compat_rhel_9_4 from hw_compat_8_0 */ -+ { TYPE_VIRTIO_NET, "guest_uso6", "off"}, -+ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ -+ { TYPE_PCI_BRIDGE, "x-pci-express-writeable-slt-bug", "true" }, -+ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ -+ { "ramfb", "x-migrate", "off" }, -+ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ -+ { "vfio-pci-nohotplug", "x-ramfb-migrate", "off" }, -+ /* hw_compat_rhel_9_4 from hw_compat_8_1 */ -+ { "igb", "x-pcie-flr-init", "off" }, -+ /* hw_compat_rhel_9_4 jira RHEL-24045 */ -+ { "virtio-mem", "dynamic-memslots", "off" }, -+}; -+const size_t hw_compat_rhel_9_4_len = G_N_ELEMENTS(hw_compat_rhel_9_4); -+ -+GlobalProperty hw_compat_rhel_9_3[] = { -+ /* hw_compat_rhel_9_3 from hw_compat_8_0 */ -+ { "migration", "multifd-flush-after-each-section", "on"}, -+ /* hw_compat_rhel_9_3 from hw_compat_8_0 */ -+ { TYPE_PCI_DEVICE, "x-pcie-ari-nextfn-1", "on" }, -+}; -+const size_t hw_compat_rhel_9_3_len = G_N_ELEMENTS(hw_compat_rhel_9_3); -+ -+GlobalProperty hw_compat_rhel_9_2[] = { -+ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ -+ { "e1000e", "migrate-timadj", "off" }, -+ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ -+ { "virtio-mem", "x-early-migration", "false" }, -+ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ -+ { "migration", "x-preempt-pre-7-2", "true" }, -+ /* hw_compat_rhel_9_2 from hw_compat_7_2 */ -+ { TYPE_PCI_DEVICE, "x-pcie-err-unc-mask", "off" }, -+}; -+const size_t hw_compat_rhel_9_2_len = G_N_ELEMENTS(hw_compat_rhel_9_2); -+ -+/* -+ * Mostly the same as hw_compat_7_0 -+ */ -+GlobalProperty hw_compat_rhel_9_1[] = { -+ /* hw_compat_rhel_9_1 from hw_compat_7_0 */ -+ { "arm-gicv3-common", "force-8-bit-prio", "on" }, -+ /* hw_compat_rhel_9_1 from hw_compat_7_0 */ -+ { "nvme-ns", "eui64-default", "on"}, -+ /* hw_compat_rhel_9_1 from hw_compat_7_1 */ -+ { "virtio-device", "queue_reset", "false" }, -+ /* hw_compat_rhel_9_1 bz 2155749 */ -+ { "virtio-rng-pci", "vectors", "0" }, -+ /* hw_compat_rhel_9_1 bz 2162569 */ -+ { "virtio-rng-pci-transitional", "vectors", "0" }, -+ { "virtio-rng-pci-non-transitional", "vectors", "0" }, -+}; -+const size_t hw_compat_rhel_9_1_len = G_N_ELEMENTS(hw_compat_rhel_9_1); -+ -+/* -+ * Mostly the same as hw_compat_6_2 -+ */ -+GlobalProperty hw_compat_rhel_9_0[] = { -+ /* hw_compat_rhel_9_0 from hw_compat_6_2 */ -+ { "PIIX4_PM", "x-not-migrate-acpi-index", "on"}, -+}; -+const size_t hw_compat_rhel_9_0_len = G_N_ELEMENTS(hw_compat_rhel_9_0); -+ -+GlobalProperty hw_compat_rhel_8_6[] = { -+ /* hw_compat_rhel_8_6 bz 2065589 */ -+ /* -+ * vhost-vsock device in RHEL 8 kernels doesn't support seqpacket, so -+ * we need do disable it downstream on the latest hw_compat_rhel_8. -+ */ -+ { "vhost-vsock-device", "seqpacket", "off" }, -+}; -+const size_t hw_compat_rhel_8_6_len = G_N_ELEMENTS(hw_compat_rhel_8_6); -+ -+/* -+ * Mostly the same as hw_compat_6_0 and hw_compat_6_1 -+ */ -+GlobalProperty hw_compat_rhel_8_5[] = { -+ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ -+ { "gpex-pcihost", "allow-unmapped-accesses", "false" }, -+ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ -+ { "i8042", "extended-state", "false"}, -+ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ -+ { "nvme-ns", "eui64-default", "off"}, -+ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ -+ { "e1000", "init-vet", "off" }, -+ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ -+ { "e1000e", "init-vet", "off" }, -+ /* hw_compat_rhel_8_5 from hw_compat_6_0 */ -+ { "vhost-vsock-device", "seqpacket", "off" }, -+ /* hw_compat_rhel_8_5 from hw_compat_6_1 */ -+ { "vhost-user-vsock-device", "seqpacket", "off" }, -+ /* hw_compat_rhel_8_5 from hw_compat_6_1 */ -+ { "nvme-ns", "shared", "off" }, -+}; -+const size_t hw_compat_rhel_8_5_len = G_N_ELEMENTS(hw_compat_rhel_8_5); -+ -+/* -+ * Mostly the same as hw_compat_5_2 -+ */ -+GlobalProperty hw_compat_rhel_8_4[] = { -+ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ -+ { "ICH9-LPC", "smm-compat", "on"}, -+ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ -+ { "PIIX4_PM", "smm-compat", "on"}, -+ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ -+ { "virtio-blk-device", "report-discard-granularity", "off" }, -+ /* hw_compat_rhel_8_4 from hw_compat_5_2 */ -+ /* -+ * Upstream incorrectly had "virtio-net-pci" instead of "virtio-net-pci-base", -+ * (https://bugzilla.redhat.com/show_bug.cgi?id=1999141) -+ */ -+ { "virtio-net-pci-base", "vectors", "3"}, -+}; -+const size_t hw_compat_rhel_8_4_len = G_N_ELEMENTS(hw_compat_rhel_8_4); -+ -+/* -+ * Mostly the same as hw_compat_5_1 -+ */ -+GlobalProperty hw_compat_rhel_8_3[] = { -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "vhost-scsi", "num_queues", "1"}, -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "vhost-user-blk", "num-queues", "1"}, -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "vhost-user-scsi", "num_queues", "1"}, -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "virtio-blk-device", "num-queues", "1"}, -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "virtio-scsi-device", "num_queues", "1"}, -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "nvme", "use-intel-id", "on"}, -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "pvpanic", "events", "1"}, /* PVPANIC_PANICKED */ -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "pl011", "migrate-clk", "off" }, -+ /* hw_compat_rhel_8_3 bz 1912846 */ -+ { "pci-xhci", "x-rh-late-msi-cap", "off" }, -+ /* hw_compat_rhel_8_3 from hw_compat_5_1 */ -+ { "virtio-pci", "x-ats-page-aligned", "off"}, -+}; -+const size_t hw_compat_rhel_8_3_len = G_N_ELEMENTS(hw_compat_rhel_8_3); -+ -+/* -+ * The same as hw_compat_4_2 + hw_compat_5_0 -+ */ -+GlobalProperty hw_compat_rhel_8_2[] = { -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "virtio-blk-device", "queue-size", "128"}, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "virtio-scsi-device", "virtqueue_size", "128"}, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "virtio-blk-device", "x-enable-wce-if-config-wce", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "virtio-blk-device", "seg-max-adjust", "off"}, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "virtio-scsi-device", "seg_max_adjust", "off"}, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "vhost-blk-device", "seg_max_adjust", "off"}, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "usb-host", "suppress-remote-wake", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "usb-redir", "suppress-remote-wake", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "qxl", "revision", "4" }, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "qxl-vga", "revision", "4" }, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "fw_cfg", "acpi-mr-restore", "false" }, -+ /* hw_compat_rhel_8_2 from hw_compat_4_2 */ -+ { "virtio-device", "use-disabled-flag", "false" }, -+ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ -+ { "pci-host-bridge", "x-config-reg-migration-enabled", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ -+ { "virtio-balloon-device", "page-poison", "false" }, -+ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ -+ { "vmport", "x-read-set-eax", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ -+ { "vmport", "x-signal-unsupported-cmd", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ -+ { "vmport", "x-report-vmx-type", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ -+ { "vmport", "x-cmds-v2", "off" }, -+ /* hw_compat_rhel_8_2 from hw_compat_5_0 */ -+ { "virtio-device", "x-disable-legacy-check", "true" }, -+}; -+const size_t hw_compat_rhel_8_2_len = G_N_ELEMENTS(hw_compat_rhel_8_2); -+ -+/* -+ * The same as hw_compat_4_1 -+ */ -+GlobalProperty hw_compat_rhel_8_1[] = { -+ /* hw_compat_rhel_8_1 from hw_compat_4_1 */ -+ { "virtio-pci", "x-pcie-flr-init", "off" }, -+}; -+const size_t hw_compat_rhel_8_1_len = G_N_ELEMENTS(hw_compat_rhel_8_1); -+ -+/* The same as hw_compat_3_1 -+ * format of array has been changed by: -+ * 6c36bddf5340 ("machine: Use shorter format for GlobalProperty arrays") -+ */ -+GlobalProperty hw_compat_rhel_8_0[] = { -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "pcie-root-port", "x-speed", "2_5" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "pcie-root-port", "x-width", "1" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "memory-backend-file", "x-use-canonical-path-for-ramblock-id", "true" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "memory-backend-memfd", "x-use-canonical-path-for-ramblock-id", "true" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "tpm-crb", "ppi", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "tpm-tis", "ppi", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "usb-kbd", "serial", "42" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "usb-mouse", "serial", "42" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "usb-tablet", "serial", "42" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "virtio-blk-device", "discard", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */ -+ { "virtio-blk-device", "write-zeroes", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ -+ { "VGA", "edid", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ -+ { "secondary-vga", "edid", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ -+ { "bochs-display", "edid", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ -+ { "virtio-vga", "edid", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ -+ { "virtio-gpu-device", "edid", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */ -+ { "virtio-device", "use-started", "false" }, -+ /* hw_compat_rhel_8_0 from hw_compat_3_1 - that was added in 4.1 */ -+ { "pcie-root-port-base", "disable-acs", "true" }, -+}; -+const size_t hw_compat_rhel_8_0_len = G_N_ELEMENTS(hw_compat_rhel_8_0); -+ -+/* The same as hw_compat_3_0 + hw_compat_2_12 -+ * except that -+ * there's nothing in 3_0 -+ * migration.decompress-error-check=off was in 7.5 from bz 1584139 -+ */ -+GlobalProperty hw_compat_rhel_7_6[] = { -+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ -+ { "hda-audio", "use-timer", "false" }, -+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ -+ { "cirrus-vga", "global-vmstate", "true" }, -+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ -+ { "VGA", "global-vmstate", "true" }, -+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ -+ { "vmware-svga", "global-vmstate", "true" }, -+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */ -+ { "qxl-vga", "global-vmstate", "true" }, -+}; -+const size_t hw_compat_rhel_7_6_len = G_N_ELEMENTS(hw_compat_rhel_7_6); -+ - MachineState *current_machine; - - static char *machine_get_kernel(Object *obj, Error **errp) -diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c -index 0e4494627c..33ef280420 100644 ---- a/hw/i386/fw_cfg.c -+++ b/hw/i386/fw_cfg.c -@@ -73,7 +73,8 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, - - if (pcmc->smbios_defaults) { - /* These values are guest ABI, do not change */ -- smbios_set_defaults("QEMU", mc->desc, mc->name); -+ smbios_set_defaults("QEMU", mc->desc, mc->name, -+ pcmc->smbios_stream_product, pcmc->smbios_stream_version); - } - - /* tell smbios about cpuid version and features */ -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c -index 03a204ef8a..f2fe057535 100644 ---- a/hw/net/rtl8139.c -+++ b/hw/net/rtl8139.c -@@ -3173,7 +3173,7 @@ static int rtl8139_pre_save(void *opaque) - - static const VMStateDescription vmstate_rtl8139 = { - .name = "rtl8139", -- .version_id = 5, -+ .version_id = 4, - .minimum_version_id = 3, - .post_load = rtl8139_post_load, - .pre_save = rtl8139_pre_save, -@@ -3254,7 +3254,9 @@ static const VMStateDescription vmstate_rtl8139 = { - VMSTATE_UINT32(tally_counters.TxMCol, RTL8139State), - VMSTATE_UINT64(tally_counters.RxOkPhy, RTL8139State), - VMSTATE_UINT64(tally_counters.RxOkBrd, RTL8139State), -+#if 0 /* Disabled for Red Hat Enterprise Linux bz 1420195 */ - VMSTATE_UINT32_V(tally_counters.RxOkMul, RTL8139State, 5), -+#endif - VMSTATE_UINT16(tally_counters.TxAbt, RTL8139State), - VMSTATE_UINT16(tally_counters.TxUndrn, RTL8139State), - -diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c -index a394514264..88642ccce0 100644 ---- a/hw/smbios/smbios.c -+++ b/hw/smbios/smbios.c -@@ -38,6 +38,10 @@ size_t usr_blobs_len; - static unsigned usr_table_max; - static unsigned usr_table_cnt; - -+/* Set to true for modern Windows 10 HardwareID-6 compat */ -+static bool smbios_type2_required; -+ -+ - uint8_t *smbios_tables; - size_t smbios_tables_len; - unsigned smbios_table_max; -@@ -626,7 +630,7 @@ static void smbios_build_type_1_table(void) - - static void smbios_build_type_2_table(void) - { -- SMBIOS_BUILD_TABLE_PRE(2, T2_BASE, false); /* optional */ -+ SMBIOS_BUILD_TABLE_PRE(2, T2_BASE, smbios_type2_required); - - SMBIOS_TABLE_SET_STR(2, manufacturer_str, type2.manufacturer); - SMBIOS_TABLE_SET_STR(2, product_str, type2.product); -@@ -1014,15 +1018,51 @@ void smbios_set_default_processor_family(uint16_t processor_family) - } - - void smbios_set_defaults(const char *manufacturer, const char *product, -- const char *version) -+ const char *version, -+ const char *stream_product, -+ const char *stream_version) - { - smbios_have_defaults = true; - -+ /* -+ * If @stream_product & @stream_version are non-NULL, then -+ * we're following rules for new Windows driver support. -+ * The data we have to report is defined in this doc: -+ * -+ * https://docs.microsoft.com/en-us/windows-hardware/drivers/install/specifying-hardware-ids-for-a-computer -+ * -+ * The Windows drivers are written to expect use of the -+ * scheme documented as "HardwareID-6" against Windows 10, -+ * which uses SMBIOS System (Type 1) and Base Board (Type 2) -+ * tables and will match on -+ * -+ * System Manufacturer = Red Hat (@manufacturer) -+ * System SKU Number = 8.2.0 (@stream_version) -+ * Baseboard Manufacturer = Red Hat (@manufacturer) -+ * Baseboard Product = RHEL-AV (@stream_product) -+ * -+ * NB, SKU must be changed with each RHEL-AV release -+ * -+ * Other fields can be freely used by applications using -+ * QEMU. For example apps can use the "System product" -+ * and "System version" to identify themselves. -+ * -+ * We get 'System Manufacturer' and 'Baseboard Manufacturer' -+ */ - SMBIOS_SET_DEFAULT(smbios_type1.manufacturer, manufacturer); - SMBIOS_SET_DEFAULT(smbios_type1.product, product); - SMBIOS_SET_DEFAULT(smbios_type1.version, version); -+ SMBIOS_SET_DEFAULT(smbios_type1.family, "Red Hat Enterprise Linux"); -+ if (stream_version != NULL) { -+ SMBIOS_SET_DEFAULT(smbios_type1.sku, stream_version); -+ } - SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer); -- SMBIOS_SET_DEFAULT(type2.product, product); -+ if (stream_product != NULL) { -+ SMBIOS_SET_DEFAULT(type2.product, stream_product); -+ smbios_type2_required = true; -+ } else { -+ SMBIOS_SET_DEFAULT(type2.product, product); -+ } - SMBIOS_SET_DEFAULT(type2.version, version); - SMBIOS_SET_DEFAULT(type3.manufacturer, manufacturer); - SMBIOS_SET_DEFAULT(type3.version, version); -diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c -index 28fdabc321..bad13ec224 100644 ---- a/hw/timer/i8254_common.c -+++ b/hw/timer/i8254_common.c -@@ -229,7 +229,7 @@ static const VMStateDescription vmstate_pit_common = { - .pre_save = pit_dispatch_pre_save, - .post_load = pit_dispatch_post_load, - .fields = (const VMStateField[]) { -- VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3), -+ VMSTATE_UINT32(channels[0].irq_disabled, PITCommonState), /* qemu-kvm's v2 had 'flags' here */ - VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2, - vmstate_pit_channel, PITChannelState), - VMSTATE_INT64(channels[0].next_transition_time, -diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c -index 264d7ebb77..2b9a3e06d4 100644 ---- a/hw/usb/hcd-xhci-pci.c -+++ b/hw/usb/hcd-xhci-pci.c -@@ -104,6 +104,33 @@ static int xhci_pci_vmstate_post_load(void *opaque, int version_id) - return 0; - } - -+/* RH bz 1912846 */ -+static bool usb_xhci_pci_add_msi(struct PCIDevice *dev, Error **errp) -+{ -+ int ret; -+ Error *err = NULL; -+ XHCIPciState *s = XHCI_PCI(dev); -+ -+ ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err); -+ /* -+ * Any error other than -ENOTSUP(board's MSI support is broken) -+ * is a programming error -+ */ -+ assert(!ret || ret == -ENOTSUP); -+ if (ret && s->msi == ON_OFF_AUTO_ON) { -+ /* Can't satisfy user's explicit msi=on request, fail */ -+ error_append_hint(&err, "You have to use msi=auto (default) or " -+ "msi=off with this machine type.\n"); -+ error_propagate(errp, err); -+ return true; -+ } -+ assert(!err || s->msi == ON_OFF_AUTO_AUTO); -+ /* With msi=auto, we fall back to MSI off silently */ -+ error_free(err); -+ -+ return false; -+} -+ - static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp) - { - int ret; -@@ -125,23 +152,12 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp) - s->xhci.nec_quirks = true; - } - -- if (s->msi != ON_OFF_AUTO_OFF) { -- ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err); -- /* -- * Any error other than -ENOTSUP(board's MSI support is broken) -- * is a programming error -- */ -- assert(!ret || ret == -ENOTSUP); -- if (ret && s->msi == ON_OFF_AUTO_ON) { -- /* Can't satisfy user's explicit msi=on request, fail */ -- error_append_hint(&err, "You have to use msi=auto (default) or " -- "msi=off with this machine type.\n"); -+ if (s->msi != ON_OFF_AUTO_OFF && s->rh_late_msi_cap) { -+ /* This gives the behaviour from 5.2.0 onwards, lspci shows 90,a0,70 */ -+ if (usb_xhci_pci_add_msi(dev, &err)) { - error_propagate(errp, err); - return; - } -- assert(!err || s->msi == ON_OFF_AUTO_AUTO); -- /* With msi=auto, we fall back to MSI off silently */ -- error_free(err); - } - pci_register_bar(dev, 0, - PCI_BASE_ADDRESS_SPACE_MEMORY | -@@ -153,6 +169,14 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp) - assert(ret > 0); - } - -+ /* RH bz 1912846 */ -+ if (s->msi != ON_OFF_AUTO_OFF && !s->rh_late_msi_cap) { -+ /* This gives the older RH machine behaviour, lspci shows 90,70,a0 */ -+ if (usb_xhci_pci_add_msi(dev, &err)) { -+ error_propagate(errp, err); -+ return; -+ } -+ } - if (s->msix != ON_OFF_AUTO_OFF) { - /* TODO check for errors, and should fail when msix=on */ - msix_init(dev, s->xhci.numintrs, -@@ -197,11 +221,18 @@ static void xhci_instance_init(Object *obj) - qdev_alias_all_properties(DEVICE(&s->xhci), obj); - } - -+static Property xhci_pci_properties[] = { -+ /* RH bz 1912846 */ -+ DEFINE_PROP_BOOL("x-rh-late-msi-cap", XHCIPciState, rh_late_msi_cap, true), -+ DEFINE_PROP_END_OF_LIST() -+}; -+ - static void xhci_class_init(ObjectClass *klass, void *data) - { - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - DeviceClass *dc = DEVICE_CLASS(klass); - -+ device_class_set_props(dc, xhci_pci_properties); - dc->reset = xhci_pci_reset; - dc->vmsd = &vmstate_xhci_pci; - set_bit(DEVICE_CATEGORY_USB, dc->categories); -diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h -index 08f70ce97c..1be7527c1b 100644 ---- a/hw/usb/hcd-xhci-pci.h -+++ b/hw/usb/hcd-xhci-pci.h -@@ -40,6 +40,7 @@ typedef struct XHCIPciState { - XHCIState xhci; - OnOffAuto msi; - OnOffAuto msix; -+ bool rh_late_msi_cap; /* bz 1912846 */ - } XHCIPciState; - - #endif -diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c -index ef64bf1b4a..ba11aa4646 100644 ---- a/hw/virtio/virtio-mem.c -+++ b/hw/virtio/virtio-mem.c -@@ -1694,8 +1694,9 @@ static Property virtio_mem_properties[] = { - #endif - DEFINE_PROP_BOOL(VIRTIO_MEM_EARLY_MIGRATION_PROP, VirtIOMEM, - early_migration, true), -+ /* RHEL: default-enable "dynamic-memslots" (jira RHEL-24045) */ - DEFINE_PROP_BOOL(VIRTIO_MEM_DYNAMIC_MEMSLOTS_PROP, VirtIOMEM, -- dynamic_memslots, false), -+ dynamic_memslots, true), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/include/hw/boards.h b/include/hw/boards.h -index 48ff6d8b93..ccfc3e10eb 100644 ---- a/include/hw/boards.h -+++ b/include/hw/boards.h -@@ -822,4 +822,47 @@ extern const size_t hw_compat_2_2_len; - extern GlobalProperty hw_compat_2_1[]; - extern const size_t hw_compat_2_1_len; - -+extern GlobalProperty hw_compat_rhel_9_5[]; -+extern const size_t hw_compat_rhel_9_5_len; -+ -+extern GlobalProperty hw_compat_rhel_9_4[]; -+extern const size_t hw_compat_rhel_9_4_len; -+ -+extern GlobalProperty hw_compat_rhel_9_3[]; -+extern const size_t hw_compat_rhel_9_3_len; -+ -+extern GlobalProperty hw_compat_rhel_9_2[]; -+extern const size_t hw_compat_rhel_9_2_len; -+ -+extern GlobalProperty hw_compat_rhel_9_1[]; -+extern const size_t hw_compat_rhel_9_1_len; -+ -+extern GlobalProperty hw_compat_rhel_9_0[]; -+extern const size_t hw_compat_rhel_9_0_len; -+ -+extern GlobalProperty hw_compat_rhel_8_6[]; -+extern const size_t hw_compat_rhel_8_6_len; -+ -+extern GlobalProperty hw_compat_rhel_8_5[]; -+extern const size_t hw_compat_rhel_8_5_len; -+ -+extern GlobalProperty hw_compat_rhel_8_4[]; -+extern const size_t hw_compat_rhel_8_4_len; -+ -+extern GlobalProperty hw_compat_rhel_8_3[]; -+extern const size_t hw_compat_rhel_8_3_len; -+ -+extern GlobalProperty hw_compat_rhel_8_2[]; -+extern const size_t hw_compat_rhel_8_2_len; -+ -+extern GlobalProperty hw_compat_rhel_8_1[]; -+extern const size_t hw_compat_rhel_8_1_len; -+ -+extern GlobalProperty hw_compat_rhel_8_0[]; -+extern const size_t hw_compat_rhel_8_0_len; -+ -+extern GlobalProperty hw_compat_rhel_7_6[]; -+extern const size_t hw_compat_rhel_7_6_len; -+ -+extern const char *rhel_old_machine_deprecation; - #endif -diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h -index f066ab7262..e805d25fbe 100644 ---- a/include/hw/firmware/smbios.h -+++ b/include/hw/firmware/smbios.h -@@ -331,7 +331,9 @@ void smbios_add_usr_blob_size(size_t size); - void smbios_entry_add(QemuOpts *opts, Error **errp); - void smbios_set_cpuid(uint32_t version, uint32_t features); - void smbios_set_defaults(const char *manufacturer, const char *product, -- const char *version); -+ const char *version, -+ const char *stream_product, -+ const char *stream_version); - void smbios_set_default_processor_family(uint16_t processor_family); - uint8_t *smbios_get_table_legacy(size_t *length, Error **errp); - void smbios_get_tables(MachineState *ms, -diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h -index 4e55d7ef6e..8776a3c937 100644 ---- a/include/hw/i386/pc.h -+++ b/include/hw/i386/pc.h -@@ -103,6 +103,9 @@ struct PCMachineClass { - bool smbios_defaults; - bool smbios_legacy_mode; - SmbiosEntryPointType default_smbios_ep_type; -+ /* New fields needed for Windows HardwareID-6 matching */ -+ const char *smbios_stream_product; -+ const char *smbios_stream_version; - - /* RAM / address space compat: */ - bool gigabyte_align; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch b/images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch deleted file mode 100644 index 071618810..000000000 --- a/images/qemu-artifact/patches/0007-meson-temporarily-disable-Wunused-function.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 8781d75adf542ea09e62a0cafd0c79875015a272 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 13:32:32 +0100 -Subject: meson: temporarily disable -Wunused-function -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Deleting the upstream versioned machine types will leave some functions -unused until RHEL machine types are added once again. Temporarily -disable the -Wunused-function warning to preserve bisectability with -fine grained patch splits. - -Signed-off-by: Daniel P. Berrangé - -Rebase notes (9.1.0 rc0) -- New patch ---- - meson.build | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/meson.build b/meson.build -index fbda17c987..161d496d55 100644 ---- a/meson.build -+++ b/meson.build -@@ -651,6 +651,7 @@ warn_flags = [ - '-Wno-string-plus-int', - '-Wno-tautological-type-limit-compare', - '-Wno-typedef-redefinition', -+ '-Wno-unused-function', - ] - - if host_os != 'darwin' --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch b/images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch deleted file mode 100644 index 2590cc4b4..000000000 --- a/images/qemu-artifact/patches/0008-Remove-upstream-machine-type-versions-for-aarch64-s3.patch +++ /dev/null @@ -1,139 +0,0 @@ -From c5e6c533f498a698ef6797f58f3f8aced62476fd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 13:25:13 +0100 -Subject: Remove upstream machine type versions for aarch64, s390x and x86_64 - architectures -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The upstream versions will later be replaced by RHEL machine type -definitions. - -Signed-off-by: Daniel P. Berrangé -Signed-off-by: Mirslav Rezanina - -Rebase notes (9.1.0 rc0) - - Split off from downstream machine type addition patch ---- - hw/arm/virt.c | 2 ++ - hw/i386/pc_piix.c | 2 ++ - hw/i386/pc_q35.c | 2 ++ - hw/ppc/spapr.c | 5 +++++ - hw/s390x/s390-virtio-ccw.c | 2 ++ - 5 files changed, 13 insertions(+) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index b2aa3f1355..5396e7cb24 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -3306,6 +3306,7 @@ static void machvirt_machine_init(void) - } - type_init(machvirt_machine_init); - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void virt_machine_9_1_options(MachineClass *mc) - { - } -@@ -3552,3 +3553,4 @@ static void virt_machine_2_6_options(MachineClass *mc) - vmc->no_pmu = true; - } - DEFINE_VIRT_MACHINE(2, 6) -+#endif /* disabled for RHEL */ -diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c -index 347afa4c37..67107b174a 100644 ---- a/hw/i386/pc_piix.c -+++ b/hw/i386/pc_piix.c -@@ -448,6 +448,7 @@ static void pc_i440fx_init(MachineState *machine) - #define DEFINE_I440FX_MACHINE(major, minor) \ - DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor); - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void pc_i440fx_machine_options(MachineClass *m) - { - PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -@@ -775,6 +776,7 @@ static void pc_i440fx_machine_2_4_options(MachineClass *m) - } - - DEFINE_I440FX_MACHINE(2, 4); -+#endif /* Disabled for Red Hat Enterprise Linux */ - - #ifdef CONFIG_ISAPC - static void isapc_machine_options(MachineClass *m) -diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c -index f2d8edfa84..5fb283f2df 100644 ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -356,6 +356,7 @@ static void pc_q35_machine_options(MachineClass *m) - pc_q35_compat_defaults, pc_q35_compat_defaults_len); - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void pc_q35_machine_9_1_options(MachineClass *m) - { - pc_q35_machine_options(m); -@@ -668,3 +669,4 @@ static void pc_q35_machine_2_4_options(MachineClass *m) - } - - DEFINE_Q35_MACHINE(2, 4); -+#endif /* Disabled for Red Hat Enterprise Linux */ -diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c -index 370d7c35d3..b48a2afc38 100644 ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -4837,6 +4837,7 @@ static void spapr_machine_latest_class_options(MachineClass *mc) - #define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, tag) \ - DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, _, tag) - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - /* - * pseries-9.1 - */ -@@ -5041,6 +5042,7 @@ static void spapr_machine_4_1_class_options(MachineClass *mc) - } - - DEFINE_SPAPR_MACHINE(4, 1); -+#endif /* disabled for RHEL */ - - /* - * pseries-4.0 -@@ -5056,6 +5058,8 @@ static bool phb_placement_4_0(SpaprMachineState *spapr, uint32_t index, - } - return true; - } -+ -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void spapr_machine_4_0_class_options(MachineClass *mc) - { - SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -@@ -5380,6 +5384,7 @@ static void spapr_machine_2_1_class_options(MachineClass *mc) - compat_props_add(mc->compat_props, hw_compat_2_1, hw_compat_2_1_len); - } - DEFINE_SPAPR_MACHINE(2, 1); -+#endif /* disabled for RHEL */ - - static void spapr_machine_register_types(void) - { -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index c483ff8064..86bfc9d2eb 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -871,6 +871,7 @@ static const TypeInfo ccw_machine_info = { - DEFINE_CCW_MACHINE_IMPL(false, major, minor) - - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static void ccw_machine_9_1_instance_options(MachineState *machine) - { - } -@@ -1305,6 +1306,7 @@ static void ccw_machine_2_4_class_options(MachineClass *mc) - DEFINE_CCW_MACHINE(2, 4); - - #endif -+#endif /* disabled for RHEL */ - - static void ccw_machine_register_types(void) - { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch b/images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch deleted file mode 100644 index e5b4b10f9..000000000 --- a/images/qemu-artifact/patches/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 3cb90f2fec9096ddde4038e037e82a9c44614791 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 15:27:03 +0100 -Subject: Adapt versioned machine type macros for RHEL -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The versioned machine type macros are changed thus: - - * All symbol names get 'rhel' inserted eg 'virt_rhel_macine_9_4_0_' - * All machine type names get 'rhel' inserted eg 'virt-rhel9.4.0-machine' - * Lifecycle is changed to deprecate after 1 major RHEL release, - force non-registration (effectively deletion) after 2 major releases - * Custom message to explain RHEL deprecation/deletion policy - * Remove upstream logic that temporarily disabled deletion since - the upstream constraints in this area don't apply to RHEL - * For automatic deprecation/deletion, RHEL_VERSION is defined - -Signed-off-by: Daniel P. Berrangé -Signed-off-by: Miroslav Rezanina ---- - .distro/Makefile.common | 1 + - .distro/qemu-kvm.spec.template | 1 + - include/hw/boards.h | 60 +++++++++++----------------------- - meson.build | 1 + - meson_options.txt | 2 ++ - scripts/meson-buildoptions.sh | 2 ++ - 6 files changed, 26 insertions(+), 41 deletions(-) - -diff --git a/include/hw/boards.h b/include/hw/boards.h -index ccfc3e10eb..7f7eb4ec40 100644 ---- a/include/hw/boards.h -+++ b/include/hw/boards.h -@@ -548,16 +548,16 @@ struct MachineState { - * "{prefix}-{major}.{minor}.{micro}-{tag}" - */ - #define _MACHINE_VER_TYPE_NAME2(prefix, major, minor) \ -- prefix "-" #major "." #minor TYPE_MACHINE_SUFFIX -+ prefix "-rhel" #major "." #minor TYPE_MACHINE_SUFFIX - - #define _MACHINE_VER_TYPE_NAME3(prefix, major, minor, micro) \ -- prefix "-" #major "." #minor "." #micro TYPE_MACHINE_SUFFIX -+ prefix "-rhel" #major "." #minor "." #micro TYPE_MACHINE_SUFFIX - - #define _MACHINE_VER_TYPE_NAME4(prefix, major, minor, _unused_, tag) \ -- prefix "-" #major "." #minor "-" #tag TYPE_MACHINE_SUFFIX -+ prefix "-rhel" #major "." #minor "-" #tag TYPE_MACHINE_SUFFIX - - #define _MACHINE_VER_TYPE_NAME5(prefix, major, minor, micro, _unused_, tag) \ -- prefix "-" #major "." #minor "." #micro "-" #tag TYPE_MACHINE_SUFFIX -+ prefix "-rhel" #major "." #minor "." #micro "-" #tag TYPE_MACHINE_SUFFIX - - #define MACHINE_VER_TYPE_NAME(prefix, ...) \ - _MACHINE_VER_PICK(__VA_ARGS__, \ -@@ -585,16 +585,16 @@ struct MachineState { - * {prefix}_machine_{major}_{minor}_{micro}_{tag}_{sym} - */ - #define _MACHINE_VER_SYM2(sym, prefix, major, minor) \ -- prefix ## _machine_ ## major ## _ ## minor ## _ ## sym -+ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## sym - - #define _MACHINE_VER_SYM3(sym, prefix, major, minor, micro) \ -- prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## sym -+ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## micro ## _ ## sym - - #define _MACHINE_VER_SYM4(sym, prefix, major, minor, _unused_, tag) \ -- prefix ## _machine_ ## major ## _ ## minor ## _ ## tag ## _ ## sym -+ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## tag ## _ ## sym - - #define _MACHINE_VER_SYM5(sym, prefix, major, minor, micro, _unused_, tag) \ -- prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym -+ prefix ## _rhel_machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym - - #define MACHINE_VER_SYM(sym, prefix, ...) \ - _MACHINE_VER_PICK(__VA_ARGS__, \ -@@ -605,26 +605,22 @@ struct MachineState { - - - /* -- * How many years/major releases for each phase -- * of the life cycle. Assumes use of versioning -- * scheme where major is bumped each year -+ * How many RHEL major releases for each phase -+ * of the life cycle. - */ --#define MACHINE_VER_DELETION_MAJOR 6 --#define MACHINE_VER_DEPRECATION_MAJOR 3 -+#define MACHINE_VER_DELETION_MAJOR 2 -+#define MACHINE_VER_DEPRECATION_MAJOR 1 - - /* - * Expands to a static string containing a deprecation - * message for a versioned machine type - */ - #define MACHINE_VER_DEPRECATION_MSG \ -- "machines more than " stringify(MACHINE_VER_DEPRECATION_MAJOR) \ -- " years old are subject to deletion after " \ -- stringify(MACHINE_VER_DELETION_MAJOR) " years" -+ "machines from the previous RHEL major release are " \ -+ "subject to deletion in the next RHEL major release" - - #define _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) \ -- (((QEMU_VERSION_MAJOR - major) > cutoff) || \ -- (((QEMU_VERSION_MAJOR - major) == cutoff) && \ -- (QEMU_VERSION_MINOR - minor) >= 0)) -+ ((RHEL_VERSION - major) >= cutoff) - - #define _MACHINE_VER_IS_EXPIRED2(cutoff, major, minor) \ - _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) -@@ -686,32 +682,14 @@ struct MachineState { - * This must be unconditionally used in the register - * method for all machine types which support versioning. - * -- * Inijtially it will effectively be a no-op, but after a -- * suitable period of time has passed, it will cause -- * execution of the method to return, avoiding registration -- * of the machine -- * -- * The new deprecation and deletion policy for versioned -- * machine types was introduced in QEMU 9.1.0. -- * -- * Under the new policy a number of old machine types (any -- * prior to 2.12) would be liable for immediate deletion -- * which would be a violation of our historical deprecation -- * and removal policy -- * -- * Thus deletions are temporarily gated on existance of -- * the env variable "QEMU_DELETE_MACHINES" / QEMU version -- * number >= 10.1.0. This gate can be deleted in the 10.1.0 -- * dev cycle -+ * It will automatically avoid registration of machines -+ * that should have been deleted at the start of this -+ * RHEL release - */ - #define MACHINE_VER_DELETION(...) \ - do { \ - if (MACHINE_VER_SHOULD_DELETE(__VA_ARGS__)) { \ -- if (getenv("QEMU_DELETE_MACHINES") || \ -- QEMU_VERSION_MAJOR > 10 || (QEMU_VERSION_MAJOR == 10 && \ -- QEMU_VERSION_MINOR >= 1)) { \ -- return; \ -- } \ -+ return; \ - } \ - } while (0) - -diff --git a/meson.build b/meson.build -index 161d496d55..2de5ab024f 100644 ---- a/meson.build -+++ b/meson.build -@@ -2440,6 +2440,7 @@ config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version())) - config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]) - config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) - config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) -+config_host_data.set('RHEL_VERSION', get_option('rhel_version').split('.')[0]) - - config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf) - config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) -diff --git a/meson_options.txt b/meson_options.txt -index 0269fa0f16..aa2ba0baef 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -2,6 +2,8 @@ - # on the configure script command line. If you add more, list them in - # scripts/meson-buildoptions.py's SKIP_OPTIONS constant too. - -+option('rhel_version', type: 'string', value: '0.0', -+ description: 'RHEL major/minor version') - option('qemu_suffix', type : 'string', value: 'qemu', - description: 'Suffix for QEMU data/modules/config directories (can be empty)') - option('docdir', type : 'string', value : 'share/doc', -diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh -index c97079a38c..5f0cbfc725 100644 ---- a/scripts/meson-buildoptions.sh -+++ b/scripts/meson-buildoptions.sh -@@ -71,6 +71,7 @@ meson_options_help() { - printf "%s\n" ' "manufacturer" name for qemu-ga registry entries' - printf "%s\n" ' [QEMU]' - printf "%s\n" ' --qemu-ga-version=VALUE version number for qemu-ga installer' -+ printf "%s\n" ' --rhel-version=VALUE RHEL major/minor version [0.0]' - printf "%s\n" ' --smbd=VALUE Path to smbd for slirp networking' - printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]' - printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string' -@@ -450,6 +451,7 @@ _meson_option_parse() { - --disable-relocatable) printf "%s" -Drelocatable=false ;; - --enable-replication) printf "%s" -Dreplication=enabled ;; - --disable-replication) printf "%s" -Dreplication=disabled ;; -+ --rhel-version=*) quote_sh "-Drhel_version=$2" ;; - --enable-rng-none) printf "%s" -Drng_none=true ;; - --disable-rng-none) printf "%s" -Drng_none=false ;; - --enable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=enabled ;; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch b/images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch deleted file mode 100644 index 09bebec65..000000000 --- a/images/qemu-artifact/patches/0010-Increase-deletion-schedule-to-3-releases.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f25d2c0298d8d6328cb0071926d477f647a512fc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 18:45:58 +0100 -Subject: Increase deletion schedule to 3 releases -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The RHEL-9 series still keeps the rhel 7.6.0 machine types as a -special exception to our normal rule of deleting machine types -after 2 releases. The exception will go away in RHEL-10. - -Signed-off-by: Daniel P. Berrangé ---- - include/hw/boards.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/hw/boards.h b/include/hw/boards.h -index 7f7eb4ec40..32c4642f5a 100644 ---- a/include/hw/boards.h -+++ b/include/hw/boards.h -@@ -608,7 +608,7 @@ struct MachineState { - * How many RHEL major releases for each phase - * of the life cycle. - */ --#define MACHINE_VER_DELETION_MAJOR 2 -+#define MACHINE_VER_DELETION_MAJOR 3 - #define MACHINE_VER_DEPRECATION_MAJOR 1 - - /* --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch b/images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch deleted file mode 100644 index df71e687f..000000000 --- a/images/qemu-artifact/patches/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch +++ /dev/null @@ -1,368 +0,0 @@ -From a2e5218bbe2e39712e06c5d8a51f836807c1cae9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 13:25:47 +0100 -Subject: Add downstream aarch64 versioned 'virt' machine types - -Adding changes to add RHEL machine types for aarch64 architecture. - -Signed-off-by: Miroslav Rezanina ---- -Rebase notes (6.1.0): -- Use CONFIG_TPM check when using TPM structures -- Add support for default_bus_bypass_iommu -- ea4c0b32d9 arm/virt: Register highmem and gic-version as class properties -- 895e1fa86a hw/arm/virt: Add 8.5 and 9.0 machine types and remove older ones - -Rebase notes (7.0.0): -- Added dtb-kaslr-seed option -- Set no_tcg_lpa2 to true - -Rebase notes (7.1.0): -- replace dtb_kaslr_seed by dtb_randomness -- Updated dtb_randomness comment - -Rebase notes (7.2.0): -- Disabled cortex-a35 - -Rebase notes (8.0.0): -- Moved changed code from target/arm/helper.c to target/arm/arm-qmp-cmds.c - -Rebase notes (8.1.0): -- Added setting default_nic - -Rebase notes (9.0.0 rc0): -- call arm_virt_compat_set on rhel type class_init - -Rebase notes (9.1.0 rc0): -- Merge copy+pasted base machine definition back with upstream - base machine definition to reduce RHEL delta, as is done with - other targets -- Convert to new DEFINE_VIRT_MACHINE macros - -Rebase notes (9.1.0 rc1): -- do not remove cpu_valid_types - -Rebase notes (9.1.0 rc2): -- Use preprocessing to remove unwanted code instead of removal - -Merged patches (6.2.0): -- 9a3d4fde0e hw/arm/virt: Remove 9.0 machine type -- f7d04d6695 hw: arm: virt: Add hw_compat_rhel_8_5 to 8.5 machine type - -Merged patches (7.0.0): -- 3b82be3dd3 redhat: virt-rhel8.5.0: Update machine type compatibility for QEMU 6.2.0 update -- c354a86c9b hw/arm/virt: Register "iommu" as a class property -- c1a2630dc9 hw/arm/virt: Register "its" as a class property -- 9d8c61dc93 hw/arm/virt: Rename default_bus_bypass_iommu -- a1d1b6eeb6 hw/arm/virt: Expose the 'RAS' option -- 47f8fe1b82 hw/arm/virt: Add 9.0 machine type and remove 8.5 one -- ed2346788f hw/arm/virt: Check no_tcg_its and minor style changes - -Merged patches (7.0.0): -- f79b31bdef hw/arm/virt: Remove the dtb-kaslr-seed machine option -- b6fca85f4a hw/arm/virt: Fix missing initialization in instance/class_init() - -Merged patches (7.1.0): -- ac97dd4f9f RHEL-only: AArch64: Drop unsupported CPU types -- e9c0a70664 target/arm: deprecate named CPU models - -Merged patches (7.2.0): -- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) - -Merged patches (8.0.0): -- c1a21266d8 redhat: aarch64: add rhel9.2.0 virt machine type -- d97cd7c513 redhat: fix virt-rhel9.2.0 compat props - -Merged patches (8.1.0): -- bd5d81d286 Add RHEL 9.2.0 compat structure (arm part) -- c07f666086 hw/arm/virt: Validate cluster and NUMA node boundary for RHEL machines - -Merged patches (8.2.0): -- 4ee284aca9 Add machine types compat bits. (partial) - -Merged patches (9.0.0 rc0): -- 117068376a hw/arm/virt: Fix compats -- 8bcccfabc4 hw/arm/virt: Add properties to disable high memory regions - 0005a8b93a hw/arm/virt: deprecate virt-rhel9.{0,2}.0 machine types - -Merged patches (9.1.0 rc0): -- 043ad5ce97 Add upstream compatibility bits (partial) -- 092cb319ea hw/arm/virt: Fix spurious call to arm_virt_compat_set() ---- - hw/arm/virt.c | 101 ++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 81 insertions(+), 20 deletions(-) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 5396e7cb24..903c0f2e9f 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -90,6 +90,22 @@ static GlobalProperty arm_virt_compat[] = { - }; - static const size_t arm_virt_compat_len = G_N_ELEMENTS(arm_virt_compat); - -+/* -+ * This variable is for changes to properties that are RHEL specific, -+ * different to the current upstream and to be applied to the latest -+ * machine type. They may be overriden by older machine compats. -+ * -+ * virtio-net-pci variant romfiles are not needed because edk2 does -+ * fully support the pxe boot. Besides virtio romfiles are not shipped -+ * on rhel/aarch64. -+ */ -+GlobalProperty arm_rhel_compat[] = { -+ {"virtio-net-pci", "romfile", "" }, -+ {"virtio-net-pci-transitional", "romfile", "" }, -+ {"virtio-net-pci-non-transitional", "romfile", "" }, -+}; -+const size_t arm_rhel_compat_len = G_N_ELEMENTS(arm_rhel_compat); -+ - /* - * This cannot be called from the virt_machine_class_init() because - * TYPE_VIRT_MACHINE is abstract and mc->compat_props g_ptr_array_new() -@@ -99,6 +115,8 @@ static void arm_virt_compat_set(MachineClass *mc) - { - compat_props_add(mc->compat_props, arm_virt_compat, - arm_virt_compat_len); -+ compat_props_add(mc->compat_props, arm_rhel_compat, -+ arm_rhel_compat_len); - } - - #define DEFINE_VIRT_MACHINE_IMPL(latest, ...) \ -@@ -109,10 +127,11 @@ static void arm_virt_compat_set(MachineClass *mc) - MachineClass *mc = MACHINE_CLASS(oc); \ - arm_virt_compat_set(mc); \ - MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ -- mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \ -+ mc->desc = "RHEL " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \ - MACHINE_VER_DEPRECATION(__VA_ARGS__); \ - if (latest) { \ - mc->alias = "virt"; \ -+ mc->is_default = 1; \ - } \ - } \ - static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \ -@@ -128,10 +147,10 @@ static void arm_virt_compat_set(MachineClass *mc) - } \ - type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); - --#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \ -- DEFINE_VIRT_MACHINE_IMPL(true, major, minor) --#define DEFINE_VIRT_MACHINE(major, minor) \ -- DEFINE_VIRT_MACHINE_IMPL(false, major, minor) -+#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor, micro) \ -+ DEFINE_VIRT_MACHINE_IMPL(true, major, minor, micro) -+#define DEFINE_VIRT_MACHINE(major, minor, micro) \ -+ DEFINE_VIRT_MACHINE_IMPL(false, major, minor, micro) - - - /* Number of external interrupt lines to configure the GIC with */ -@@ -2434,6 +2453,7 @@ static void machvirt_init(MachineState *machine) - qemu_add_machine_init_done_notifier(&vms->machine_done); - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static bool virt_get_secure(Object *obj, Error **errp) - { - VirtMachineState *vms = VIRT_MACHINE(obj); -@@ -2461,6 +2481,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp) - - vms->virt = value; - } -+#endif /* disabled for RHEL */ - - static bool virt_get_highmem(Object *obj, Error **errp) - { -@@ -2476,6 +2497,7 @@ static void virt_set_highmem(Object *obj, bool value, Error **errp) - vms->highmem = value; - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static bool virt_get_compact_highmem(Object *obj, Error **errp) - { - VirtMachineState *vms = VIRT_MACHINE(obj); -@@ -2489,6 +2511,7 @@ static void virt_set_compact_highmem(Object *obj, bool value, Error **errp) - - vms->highmem_compact = value; - } -+#endif /* disabled for RHEL */ - - static bool virt_get_highmem_redists(Object *obj, Error **errp) - { -@@ -2547,6 +2570,7 @@ static void virt_set_its(Object *obj, bool value, Error **errp) - vms->its = value; - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static bool virt_get_dtb_randomness(Object *obj, Error **errp) - { - VirtMachineState *vms = VIRT_MACHINE(obj); -@@ -2560,6 +2584,7 @@ static void virt_set_dtb_randomness(Object *obj, bool value, Error **errp) - - vms->dtb_randomness = value; - } -+#endif /* disabled for RHEL */ - - static char *virt_get_oem_id(Object *obj, Error **errp) - { -@@ -2643,6 +2668,7 @@ static void virt_set_ras(Object *obj, bool value, Error **errp) - vms->ras = value; - } - -+#if 0 /* Disabled for Red Hat Enterprise Linux */ - static bool virt_get_mte(Object *obj, Error **errp) - { - VirtMachineState *vms = VIRT_MACHINE(obj); -@@ -2656,6 +2682,7 @@ static void virt_set_mte(Object *obj, bool value, Error **errp) - - vms->mte = value; - } -+#endif /* disabled for RHEL */ - - static char *virt_get_gic_version(Object *obj, Error **errp) - { -@@ -3063,16 +3090,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - NULL - }; - -+ mc->family = "virt-rhel-Z"; - mc->init = machvirt_init; -- /* Start with max_cpus set to 512, which is the maximum supported by KVM. -- * The value may be reduced later when we have more information about the -- * configuration of the particular instance. -- */ -- mc->max_cpus = 512; -- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC); -- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE); -- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); -- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); -+ /* Maximum supported VCPU count for all virt-rhel* machines */ -+ mc->max_cpus = 384; - #ifdef CONFIG_TPM - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); - #endif -@@ -3083,11 +3104,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - mc->minimum_page_bits = 12; - mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; - mc->cpu_index_to_instance_props = virt_cpu_index_to_props; --#ifdef CONFIG_TCG -- mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); --#else -- mc->default_cpu_type = ARM_CPU_TYPE_NAME("max"); --#endif -+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57"); - mc->valid_cpu_types = valid_cpu_types; - mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; - mc->kvm_type = virt_kvm_type; -@@ -3111,6 +3128,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - NULL, NULL); - object_class_property_set_description(oc, "acpi", - "Enable ACPI"); -+#if 0 /* disabled for RHEL */ - object_class_property_add_bool(oc, "secure", virt_get_secure, - virt_set_secure); - object_class_property_set_description(oc, "secure", -@@ -3123,6 +3141,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - "Set on/off to enable/disable emulating a " - "guest CPU which implements the ARM " - "Virtualization Extensions"); -+#endif /* disabled for RHEL */ - - object_class_property_add_bool(oc, "highmem", virt_get_highmem, - virt_set_highmem); -@@ -3130,12 +3149,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - "Set on/off to enable/disable using " - "physical address space above 32 bits"); - -+#if 0 /* disabled for RHEL */ - object_class_property_add_bool(oc, "compact-highmem", - virt_get_compact_highmem, - virt_set_compact_highmem); - object_class_property_set_description(oc, "compact-highmem", - "Set on/off to enable/disable compact " - "layout for high memory regions"); -+#endif /* disabled for RHEL */ - - object_class_property_add_bool(oc, "highmem-redists", - virt_get_highmem_redists, -@@ -3163,7 +3184,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - virt_set_gic_version); - object_class_property_set_description(oc, "gic-version", - "Set GIC version. " -- "Valid values are 2, 3, 4, host and max"); -+ "Valid values are 2, 3, host and max"); - - object_class_property_add_str(oc, "iommu", virt_get_iommu, virt_set_iommu); - object_class_property_set_description(oc, "iommu", -@@ -3183,11 +3204,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - "Set on/off to enable/disable reporting host memory errors " - "to a KVM guest using ACPI and guest external abort exceptions"); - -+#if 0 /* disabled for RHEL */ - object_class_property_add_bool(oc, "mte", virt_get_mte, virt_set_mte); - object_class_property_set_description(oc, "mte", - "Set on/off to enable/disable emulating a " - "guest CPU which implements the ARM " - "Memory Tagging Extension"); -+#endif /* disabled for RHEL */ - - object_class_property_add_bool(oc, "its", virt_get_its, - virt_set_its); -@@ -3195,6 +3218,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - "Set on/off to enable/disable " - "ITS instantiation"); - -+#if 0 /* disabled for RHEL */ - object_class_property_add_bool(oc, "dtb-randomness", - virt_get_dtb_randomness, - virt_set_dtb_randomness); -@@ -3207,6 +3231,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) - virt_set_dtb_randomness); - object_class_property_set_description(oc, "dtb-kaslr-seed", - "Deprecated synonym of dtb-randomness"); -+#endif /* disabled for RHEL */ - - object_class_property_add_str(oc, "x-oem-id", - virt_get_oem_id, -@@ -3554,3 +3579,39 @@ static void virt_machine_2_6_options(MachineClass *mc) - } - DEFINE_VIRT_MACHINE(2, 6) - #endif /* disabled for RHEL */ -+ -+static void virt_rhel_machine_9_4_0_options(MachineClass *mc) -+{ -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); -+} -+DEFINE_VIRT_MACHINE_AS_LATEST(9, 4, 0) -+ -+static void virt_rhel_machine_9_2_0_options(MachineClass *mc) -+{ -+ virt_rhel_machine_9_4_0_options(mc); -+ -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_4, hw_compat_rhel_9_4_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_3, hw_compat_rhel_9_3_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_2, hw_compat_rhel_9_2_len); -+ -+ /* RHEL 9.4 is the first supported release */ -+ mc->deprecation_reason = -+ "machine types for versions prior to 9.4 are deprecated"; -+} -+DEFINE_VIRT_MACHINE(9, 2, 0) -+ -+static void virt_rhel_machine_9_0_0_options(MachineClass *mc) -+{ -+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); -+ -+ virt_rhel_machine_9_2_0_options(mc); -+ -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_1, hw_compat_rhel_9_1_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_0, hw_compat_rhel_9_0_len); -+ -+ /* Disable FEAT_LPA2 since old kernels (<= v5.12) don't boot with that feature */ -+ vmc->no_tcg_lpa2 = true; -+ /* Compact layout for high memory regions was introduced with 9.2.0 */ -+ vmc->no_highmem_compact = true; -+} -+DEFINE_VIRT_MACHINE(9, 0, 0) --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch b/images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch deleted file mode 100644 index fb5651424..000000000 --- a/images/qemu-artifact/patches/0012-Add-downstream-ppc64-versioned-spapr-machine-types.patch +++ /dev/null @@ -1,529 +0,0 @@ -From 676f3da2fc29ae71ed4189483b86e3c6496b8905 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 13:44:31 +0100 -Subject: Add downstream ppc64 versioned 'spapr' machine types - -Adding changes to add RHEL machine types for ppc64 architecture. - -Signed-off-by: Miroslav Rezanina - -Rebase notes (6.2.0): -- Fixed rebase conflict relicts -- Update machine type compat for 6.2 (from MR 66) - -Rebase notes (9.1.0 rc0) -- Don't call kvmppc_svm_allow() when !CONFIG_KVM -- Convert to new DEFINE_SPAPR_MACHINE macros - -Merged patches (6.1.0): -- c438c25ac3 redhat: Define pseries-rhel8.5.0 machine type -- a3995e2eff Remove RHEL 7.0.0 machine type (only ppc64 changes) -- ad3190a79b Remove RHEL 7.1.0 machine type (only ppc64 changes) -- 84bbe15d4e Remove RHEL 7.2.0 machine type (only ppc64 changes) -- 0215eb3356 Remove RHEL 7.3.0 machine types (only ppc64 changes) -- af69d1ca6e Remove RHEL 7.4.0 machine types (only ppc64 changes) -- 8f7a74ab78 Remove RHEL 7.5.0 machine types (only ppc64 changes) - -Merged patches (7.1.0): -- baa6790171 target/ppc/cpu-models: Fix ppc_cpu_aliases list for RHEL ---- - hw/ppc/spapr.c | 254 +++++++++++++++++++++++++++++++++++++++- - hw/ppc/spapr_cpu_core.c | 13 ++ - include/hw/ppc/spapr.h | 4 + - target/ppc/compat.c | 11 ++ - target/ppc/cpu.h | 1 + - target/ppc/kvm.c | 27 +++++ - target/ppc/kvm_ppc.h | 13 ++ - 7 files changed, 317 insertions(+), 6 deletions(-) - -diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c -index b48a2afc38..29e66f1b3f 100644 ---- a/hw/ppc/spapr.c -+++ b/hw/ppc/spapr.c -@@ -1746,6 +1746,13 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason) - } - spapr_caps_apply(spapr); - spapr_nested_reset(spapr); -+ if (spapr->svm_allowed) { -+#ifdef CONFIG_KVM -+ kvmppc_svm_allow(&error_fatal); -+#else -+ error_setg(&error_fatal, "No PEF support in tcg, try x-svm-allowed=off"); -+#endif -+ } - - first_ppc_cpu = POWERPC_CPU(first_cpu); - if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && -@@ -3452,6 +3459,20 @@ static void spapr_set_host_serial(Object *obj, const char *value, Error **errp) - spapr->host_serial = g_strdup(value); - } - -+static bool spapr_get_svm_allowed(Object *obj, Error **errp) -+{ -+ SpaprMachineState *spapr = SPAPR_MACHINE(obj); -+ -+ return spapr->svm_allowed; -+} -+ -+static void spapr_set_svm_allowed(Object *obj, bool value, Error **errp) -+{ -+ SpaprMachineState *spapr = SPAPR_MACHINE(obj); -+ -+ spapr->svm_allowed = value; -+} -+ - static void spapr_instance_init(Object *obj) - { - SpaprMachineState *spapr = SPAPR_MACHINE(obj); -@@ -3530,6 +3551,12 @@ static void spapr_instance_init(Object *obj) - spapr_get_host_serial, spapr_set_host_serial); - object_property_set_description(obj, "host-serial", - "Host serial number to advertise in guest device tree"); -+ object_property_add_bool(obj, "x-svm-allowed", -+ spapr_get_svm_allowed, -+ spapr_set_svm_allowed); -+ object_property_set_description(obj, "x-svm-allowed", -+ "Allow the guest to become a Secure Guest" -+ " (experimental only)"); - } - - static void spapr_machine_finalizefn(Object *obj) -@@ -4775,6 +4802,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) - vmc->client_architecture_support = spapr_vof_client_architecture_support; - vmc->quiesce = spapr_vof_quiesce; - vmc->setprop = spapr_vof_setprop; -+ smc->has_power9_support = true; - } - - static const TypeInfo spapr_machine_info = { -@@ -4830,12 +4858,12 @@ static void spapr_machine_latest_class_options(MachineClass *mc) - } \ - type_init(MACHINE_VER_SYM(register, spapr, __VA_ARGS__)) - --#define DEFINE_SPAPR_MACHINE_AS_LATEST(major, minor) \ -- DEFINE_SPAPR_MACHINE_IMPL(true, major, minor) --#define DEFINE_SPAPR_MACHINE(major, minor) \ -- DEFINE_SPAPR_MACHINE_IMPL(false, major, minor) --#define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, tag) \ -- DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, _, tag) -+#define DEFINE_SPAPR_MACHINE_AS_LATEST(major, minor, micro) \ -+ DEFINE_SPAPR_MACHINE_IMPL(true, major, minor, micro) -+#define DEFINE_SPAPR_MACHINE(major, minor, micro) \ -+ DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, micro) -+#define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, micro, tag) \ -+ DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, micro, _, tag) - - #if 0 /* Disabled for Red Hat Enterprise Linux */ - /* -@@ -5386,6 +5414,220 @@ static void spapr_machine_2_1_class_options(MachineClass *mc) - DEFINE_SPAPR_MACHINE(2, 1); - #endif /* disabled for RHEL */ - -+static void spapr_rhel_machine_default_class_options(MachineClass *mc) -+{ -+ /* -+ * Defaults for the latest behaviour inherited from the base class -+ * can be overriden here for all pseries-rhel* machines. -+ */ -+ -+ /* Maximum supported VCPU count */ -+ mc->max_cpus = 384; -+} -+ -+/* -+ * pseries-rhel8.5.0 -+ * like pseries-6.0 -+ */ -+ -+static void spapr_rhel_machine_8_5_0_class_options(MachineClass *mc) -+{ -+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -+ -+ /* The default machine type must apply the RHEL specific defaults */ -+ spapr_rhel_machine_default_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_5, -+ hw_compat_rhel_8_5_len); -+ smc->pre_6_2_numa_affinity = true; -+ mc->smp_props.prefer_sockets = true; -+} -+ -+DEFINE_SPAPR_MACHINE_AS_LATEST(8, 5, 0); -+ -+/* -+ * pseries-rhel8.4.0 -+ * like pseries-5.2 -+ */ -+ -+static void spapr_rhel_machine_8_4_0_class_options(MachineClass *mc) -+{ -+ spapr_rhel_machine_8_5_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_4, -+ hw_compat_rhel_8_4_len); -+} -+ -+DEFINE_SPAPR_MACHINE(8, 4, 0); -+ -+/* -+ * pseries-rhel8.3.0 -+ * like pseries-5.1 -+ */ -+ -+static void spapr_rhel_machine_8_3_0_class_options(MachineClass *mc) -+{ -+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -+ -+ spapr_rhel_machine_8_4_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_3, -+ hw_compat_rhel_8_3_len); -+ -+ /* from pseries-5.1 */ -+ smc->pre_5_2_numa_associativity = true; -+} -+ -+DEFINE_SPAPR_MACHINE(8, 3, 0); -+ -+/* -+ * pseries-rhel8.2.0 -+ * like pseries-4.2 + pseries-5.0 -+ * except SPAPR_CAP_CCF_ASSIST that has been backported to pseries-rhel8.1.0 -+ */ -+ -+static void spapr_rhel_machine_8_2_0_class_options(MachineClass *mc) -+{ -+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -+ /* from pseries-5.0 */ -+ static GlobalProperty compat[] = { -+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "pre-5.1-associativity", "on" }, -+ }; -+ -+ spapr_rhel_machine_8_3_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_2, -+ hw_compat_rhel_8_2_len); -+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); -+ -+ /* from pseries-4.2 */ -+ smc->default_caps.caps[SPAPR_CAP_FWNMI] = SPAPR_CAP_OFF; -+ smc->rma_limit = 16 * GiB; -+ mc->nvdimm_supported = false; -+ -+ /* from pseries-5.0 */ -+ mc->numa_mem_supported = true; -+ smc->pre_5_1_assoc_refpoints = true; -+} -+ -+DEFINE_SPAPR_MACHINE(8, 2, 0); -+ -+/* -+ * pseries-rhel8.1.0 -+ * like pseries-4.1 -+ */ -+ -+static void spapr_rhel_machine_8_1_0_class_options(MachineClass *mc) -+{ -+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -+ static GlobalProperty compat[] = { -+ /* Only allow 4kiB and 64kiB IOMMU pagesizes */ -+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "pgsz", "0x11000" }, -+ }; -+ -+ spapr_rhel_machine_8_2_0_class_options(mc); -+ -+ /* from pseries-4.1 */ -+ smc->linux_pci_probe = false; -+ smc->smp_threads_vsmt = false; -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_1, -+ hw_compat_rhel_8_1_len); -+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); -+ -+ /* from pseries-4.2 */ -+ smc->default_caps.caps[SPAPR_CAP_CCF_ASSIST] = SPAPR_CAP_OFF; -+} -+ -+DEFINE_SPAPR_MACHINE(8, 1, 0); -+ -+/* -+ * pseries-rhel8.0.0 -+ * like pseries-3.1 and pseries-4.0 -+ * except SPAPR_CAP_CFPC, SPAPR_CAP_SBBC and SPAPR_CAP_IBS -+ * that have been backported to pseries-rhel8.0.0 -+ */ -+ -+static void spapr_rhel_machine_8_0_0_class_options(MachineClass *mc) -+{ -+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -+ -+ spapr_rhel_machine_8_1_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_0, -+ hw_compat_rhel_8_0_len); -+ -+ /* pseries-4.0 */ -+ smc->phb_placement = phb_placement_4_0; -+ smc->irq = &spapr_irq_xics; -+ smc->pre_4_1_migration = true; -+ -+ /* pseries-3.1 */ -+ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0"); -+ smc->update_dt_enabled = false; -+ smc->dr_phb_enabled = false; -+ smc->broken_host_serial_model = true; -+ smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = SPAPR_CAP_OFF; -+} -+ -+DEFINE_SPAPR_MACHINE(8, 0, 0); -+ -+/* -+ * pseries-rhel7.6.0 -+ * like spapr_compat_2_12 and spapr_compat_3_0 -+ * spapr_compat_0 is empty -+ */ -+GlobalProperty spapr_compat_rhel7_6[] = { -+ { TYPE_POWERPC_CPU, "pre-3.0-migration", "on" }, -+ { TYPE_SPAPR_CPU_CORE, "pre-3.0-migration", "on" }, -+}; -+const size_t spapr_compat_rhel7_6_len = G_N_ELEMENTS(spapr_compat_rhel7_6); -+ -+ -+static void spapr_rhel_machine_7_6_0_class_options(MachineClass *mc) -+{ -+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -+ -+ spapr_rhel_machine_8_0_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); -+ compat_props_add(mc->compat_props, spapr_compat_rhel7_6, spapr_compat_rhel7_6_len); -+ -+ /* from spapr_machine_3_0_class_options() */ -+ smc->legacy_irq_allocation = true; -+ smc->nr_xirqs = 0x400; -+ smc->irq = &spapr_irq_xics_legacy; -+ -+ /* from spapr_machine_2_12_class_options() */ -+ /* We depend on kvm_enabled() to choose a default value for the -+ * hpt-max-page-size capability. Of course we can't do it here -+ * because this is too early and the HW accelerator isn't initialzed -+ * yet. Postpone this to machine init (see default_caps_with_cpu()). -+ */ -+ smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = 0; -+ -+ /* SPAPR_CAP_WORKAROUND enabled in pseries-rhel800 by -+ * f21757edc554 -+ * "Enable mitigations by default for pseries-4.0 machine type") -+ */ -+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN; -+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN; -+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN; -+} -+ -+DEFINE_SPAPR_MACHINE(7, 6, 0); -+ -+/* -+ * pseries-rhel7.6.0-sxxm -+ * -+ * pseries-rhel7.6.0 with speculative execution exploit mitigations enabled by default -+ */ -+ -+static void spapr_rhel_machine_7_6_0_sxxm_class_options(MachineClass *mc) -+{ -+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); -+ -+ spapr_rhel_machine_7_6_0_class_options(mc); -+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND; -+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND; -+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD; -+} -+ -+DEFINE_SPAPR_MACHINE_TAGGED(7, 6, 0, sxxm); -+ - static void spapr_machine_register_types(void) - { - type_register_static(&spapr_machine_info); -diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c -index 0bf7c52077..c845f4acef 100644 ---- a/hw/ppc/spapr_cpu_core.c -+++ b/hw/ppc/spapr_cpu_core.c -@@ -25,6 +25,7 @@ - #include "sysemu/reset.h" - #include "sysemu/hw_accel.h" - #include "qemu/error-report.h" -+#include "cpu-models.h" - - static void spapr_reset_vcpu(PowerPCCPU *cpu) - { -@@ -264,6 +265,7 @@ static bool spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr, - { - CPUPPCState *env = &cpu->env; - CPUState *cs = CPU(cpu); -+ SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); - - if (!qdev_realize(DEVICE(cpu), NULL, errp)) { - return false; -@@ -280,6 +282,17 @@ static bool spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr, - /* Set time-base frequency to 512 MHz. vhyp must be set first. */ - cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ); - -+ if (!smc->has_power9_support && -+ (((spapr->max_compat_pvr && -+ ppc_compat_cmp(spapr->max_compat_pvr, -+ CPU_POWERPC_LOGICAL_3_00) >= 0)) || -+ (!spapr->max_compat_pvr && -+ ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, 0)))) { -+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, -+ "POWER9 CPU is not supported by this machine class"); -+ return false; -+ } -+ - if (spapr_irq_cpu_intc_create(spapr, cpu, errp) < 0) { - qdev_unrealize(DEVICE(cpu)); - return false; -diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h -index f6de3e9972..fc48348747 100644 ---- a/include/hw/ppc/spapr.h -+++ b/include/hw/ppc/spapr.h -@@ -157,6 +157,7 @@ struct SpaprMachineClass { - bool pre_5_2_numa_associativity; - bool pre_6_2_numa_affinity; - -+ bool has_power9_support; - bool (*phb_placement)(SpaprMachineState *spapr, uint32_t index, - uint64_t *buid, hwaddr *pio, - hwaddr *mmio32, hwaddr *mmio64, -@@ -259,6 +260,9 @@ struct SpaprMachineState { - /* Set by -boot */ - char *boot_device; - -+ /* Secure Guest support via x-svm-allowed */ -+ bool svm_allowed; -+ - /*< public >*/ - char *kvm_type; - char *host_model; -diff --git a/target/ppc/compat.c b/target/ppc/compat.c -index ebef2cccec..ab7ed76806 100644 ---- a/target/ppc/compat.c -+++ b/target/ppc/compat.c -@@ -114,6 +114,17 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr) - return NULL; - } - -+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2) -+{ -+ const CompatInfo *compat1 = compat_by_pvr(pvr1); -+ const CompatInfo *compat2 = compat_by_pvr(pvr2); -+ -+ g_assert(compat1); -+ g_assert(compat2); -+ -+ return compat1 - compat2; -+} -+ - static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr, - uint32_t min_compat_pvr, uint32_t max_compat_pvr) - { -diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h -index 321ed2da75..e35a997628 100644 ---- a/target/ppc/cpu.h -+++ b/target/ppc/cpu.h -@@ -1673,6 +1673,7 @@ static inline int ppc_env_mmu_index(CPUPPCState *env, bool ifetch) - - /* Compatibility modes */ - #if defined(TARGET_PPC64) -+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2); - bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr, - uint32_t min_compat_pvr, uint32_t max_compat_pvr); - bool ppc_type_check_compat(const char *cputype, uint32_t compat_pvr, -diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c -index 907dba60d1..c942ff55b2 100644 ---- a/target/ppc/kvm.c -+++ b/target/ppc/kvm.c -@@ -92,6 +92,7 @@ static int cap_large_decr; - static int cap_fwnmi; - static int cap_rpt_invalidate; - static int cap_ail_mode_3; -+static int cap_ppc_secure_guest; - - #ifdef CONFIG_PSERIES - static int cap_papr; -@@ -150,6 +151,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) - cap_resize_hpt = kvm_vm_check_extension(s, KVM_CAP_SPAPR_RESIZE_HPT); - kvmppc_get_cpu_characteristics(s); - cap_ppc_nested_kvm_hv = kvm_vm_check_extension(s, KVM_CAP_PPC_NESTED_HV); -+ cap_ppc_secure_guest = kvm_vm_check_extension(s, KVM_CAP_PPC_SECURE_GUEST); - cap_large_decr = kvmppc_get_dec_bits(); - cap_fwnmi = kvm_vm_check_extension(s, KVM_CAP_PPC_FWNMI); - /* -@@ -2597,6 +2599,16 @@ bool kvmppc_supports_ail_3(void) - return cap_ail_mode_3; - } - -+bool kvmppc_has_cap_secure_guest(void) -+{ -+ return !!cap_ppc_secure_guest; -+} -+ -+int kvmppc_enable_cap_secure_guest(void) -+{ -+ return kvm_vm_enable_cap(kvm_state, KVM_CAP_PPC_SECURE_GUEST, 0, 1); -+} -+ - PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) - { - uint32_t host_pvr = mfpvr(); -@@ -3012,3 +3024,18 @@ static void kvm_cpu_accel_register_types(void) - type_register_static(&kvm_cpu_accel_type_info); - } - type_init(kvm_cpu_accel_register_types); -+ -+void kvmppc_svm_allow(Error **errp) -+{ -+ if (!kvm_enabled()) { -+ error_setg(errp, "No PEF support in tcg, try x-svm-allowed=off"); -+ return; -+ } -+ -+ if (!kvmppc_has_cap_secure_guest()) { -+ error_setg(errp, "KVM implementation does not support secure guests, " -+ "try x-svm-allowed=off"); -+ } else if (kvmppc_enable_cap_secure_guest() < 0) { -+ error_setg(errp, "Error enabling x-svm-allowed, try x-svm-allowed=off"); -+ } -+} -diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h -index 1975fb5ee6..d1017f98be 100644 ---- a/target/ppc/kvm_ppc.h -+++ b/target/ppc/kvm_ppc.h -@@ -46,6 +46,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu); - target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu, - bool radix, bool gtse, - uint64_t proc_tbl); -+void kvmppc_svm_allow(Error **errp); - bool kvmppc_spapr_use_multitce(void); - int kvmppc_spapr_enable_inkernel_multitce(void); - void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, -@@ -79,6 +80,8 @@ int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable); - int kvmppc_has_cap_rpt_invalidate(void); - bool kvmppc_supports_ail_3(void); - int kvmppc_enable_hwrng(void); -+bool kvmppc_has_cap_secure_guest(void); -+int kvmppc_enable_cap_secure_guest(void); - int kvmppc_put_books_sregs(PowerPCCPU *cpu); - PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void); - void kvmppc_check_papr_resize_hpt(Error **errp); -@@ -427,6 +430,16 @@ static inline bool kvmppc_supports_ail_3(void) - return false; - } - -+static inline bool kvmppc_has_cap_secure_guest(void) -+{ -+ return false; -+} -+ -+static inline int kvmppc_enable_cap_secure_guest(void) -+{ -+ return -1; -+} -+ - static inline int kvmppc_enable_hwrng(void) - { - return -1; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch b/images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch deleted file mode 100644 index adad3c72d..000000000 --- a/images/qemu-artifact/patches/0013-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch +++ /dev/null @@ -1,327 +0,0 @@ -From 450ae6631771593689f7f9c3eb2081e93d3e75c5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 13:44:36 +0100 -Subject: Add downstream s390x versioned 's390-ccw-virtio' machine types - -Adding changes to add RHEL machine types for s390x architecture. - -Signed-off-by: Miroslav Rezanina --- - -Rebase changes (7.1.0): -- Moved adding rhel_old_machine_deprecation variable to general machine types commit - -Rebase notes (9.1.0 rc0) -- Convert to new DEFINE_CCW_MACHINE macros - -Merged patches (6.1.0): -- 64a9a5c971 hw/s390x: Remove the RHEL7-only machine type -- 395516d62b redhat: s390x: add rhel-8.5.0 compat machine - -Merged patches (6.2.0): -- 3bf66f4520 redhat: Add s390x machine type compatibility update for 6.1 rebase - -Merged patches (7.0.0): -- e6ff4de4f7 redhat: Add s390x machine type compatibility handling for the rebase to v6.2 -- 4b0efa7e21 redhat: Add rhel8.6.0 and rhel9.0.0 machine types for s390x -- dcc64971bf RHEL: mark old machine types as deprecated (partialy) - -Merged patches (7.1.0): -- 1d6439527a WRB: Introduce RHEL 9.0.0 hw compat structure (only hw/s390x/s390-virtio-ccw.c chunk) -- c8ad21ca31 redhat: Update s390x machine type compatibility for rebase to QEMU 7.0.0 -- 5bcf8d874c target/s390x: deprecate CPUs older than z14 - -Merged patches (7.2.0): -- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) - -Merged patches (8.0.0): -- 27c188c6a4 redhat: Update s390x machine type compatibility for QEMU 7.2.0 update -- a932b8d429 redhat: Add new rhel-9.2.0 s390x machine type -- ac88104bad s390x/s390-virtio-ccw: Activate zPCI features on s390-ccw-virtio-rhel8.6.0 - -Merged patches (8.1.0): -- bd5d81d286 Add RHEL 9.2.0 compat structure (s390x part) - -Merged patches (8.2.0): -- 4ee284aca9 Add machine types compat bits. (partial) - -Merged patches (9.1.0 rc0): -- 043ad5ce97 Add upstream compatibility bits (partial) ---- - hw/s390x/s390-virtio-ccw.c | 164 ++++++++++++++++++++++++++++++- - target/s390x/cpu_models.c | 11 +++ - target/s390x/cpu_models.h | 2 + - target/s390x/cpu_models_sysemu.c | 2 + - 4 files changed, 174 insertions(+), 5 deletions(-) - -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index 86bfc9d2eb..72e1279db9 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -837,7 +837,7 @@ static const TypeInfo ccw_machine_info = { - { \ - MachineClass *mc = MACHINE_CLASS(oc); \ - MACHINE_VER_SYM(class_options, ccw, __VA_ARGS__)(mc); \ -- mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \ -+ mc->desc = "Virtual s390x machine (version rhel" MACHINE_VER_STR(__VA_ARGS__) ")"; \ - MACHINE_VER_DEPRECATION(__VA_ARGS__); \ - if (latest) { \ - mc->alias = "s390-ccw-virtio"; \ -@@ -864,11 +864,11 @@ static const TypeInfo ccw_machine_info = { - } \ - type_init(MACHINE_VER_SYM(register, ccw, __VA_ARGS__)) - --#define DEFINE_CCW_MACHINE_AS_LATEST(major, minor) \ -- DEFINE_CCW_MACHINE_IMPL(true, major, minor) -+#define DEFINE_CCW_MACHINE_AS_LATEST(major, minor, micro) \ -+ DEFINE_CCW_MACHINE_IMPL(true, major, minor, micro) - --#define DEFINE_CCW_MACHINE(major, minor) \ -- DEFINE_CCW_MACHINE_IMPL(false, major, minor) -+#define DEFINE_CCW_MACHINE(major, minor, micro) \ -+ DEFINE_CCW_MACHINE_IMPL(false, major, minor, micro) - - - #if 0 /* Disabled for Red Hat Enterprise Linux */ -@@ -1308,6 +1308,160 @@ DEFINE_CCW_MACHINE(2, 4); - #endif - #endif /* disabled for RHEL */ - -+static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) -+{ -+} -+ -+static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) -+{ -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); -+} -+DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); -+ -+static void ccw_rhel_machine_9_2_0_instance_options(MachineState *machine) -+{ -+ ccw_rhel_machine_9_4_0_instance_options(machine); -+} -+ -+static void ccw_rhel_machine_9_2_0_class_options(MachineClass *mc) -+{ -+ ccw_rhel_machine_9_4_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_4, hw_compat_rhel_9_4_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_3, hw_compat_rhel_9_3_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_2, hw_compat_rhel_9_2_len); -+ mc->smp_props.drawers_supported = false; /* from ccw_machine_8_1 */ -+ mc->smp_props.books_supported = false; /* from ccw_machine_8_1 */ -+} -+DEFINE_CCW_MACHINE(9, 2, 0); -+ -+static void ccw_rhel_machine_9_0_0_instance_options(MachineState *machine) -+{ -+ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_2 }; -+ -+ ccw_rhel_machine_9_2_0_instance_options(machine); -+ -+ s390_set_qemu_cpu_model(0x3906, 14, 2, qemu_cpu_feat); -+ s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE); -+} -+ -+static void ccw_rhel_machine_9_0_0_class_options(MachineClass *mc) -+{ -+ S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); -+ static GlobalProperty compat[] = { -+ { TYPE_S390_PCI_DEVICE, "interpret", "off", }, -+ { TYPE_S390_PCI_DEVICE, "forwarding-assist", "off", }, -+ }; -+ -+ ccw_rhel_machine_9_2_0_class_options(mc); -+ -+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_1, hw_compat_rhel_9_1_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_0, hw_compat_rhel_9_0_len); -+ s390mc->max_threads = S390_MAX_CPUS; -+} -+DEFINE_CCW_MACHINE(9, 0, 0); -+ -+static void ccw_rhel_machine_8_6_0_instance_options(MachineState *machine) -+{ -+ /* Note: The -rhel8.6.0 and -rhel9.0.0 machines are technically identical */ -+ ccw_rhel_machine_9_0_0_instance_options(machine); -+} -+ -+static void ccw_rhel_machine_8_6_0_class_options(MachineClass *mc) -+{ -+ static GlobalProperty compat[] = { -+ { TYPE_S390_PCI_DEVICE, "interpret", "on", }, -+ { TYPE_S390_PCI_DEVICE, "forwarding-assist", "on", }, -+ }; -+ -+ ccw_rhel_machine_9_0_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_6, hw_compat_rhel_8_6_len); -+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); -+} -+DEFINE_CCW_MACHINE(8, 6, 0); -+ -+static void ccw_rhel_machine_8_5_0_instance_options(MachineState *machine) -+{ -+ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_0 }; -+ -+ ccw_rhel_machine_8_6_0_instance_options(machine); -+ -+ s390_set_qemu_cpu_model(0x2964, 13, 2, qemu_cpu_feat); -+ -+ s390_cpudef_featoff_greater(16, 1, S390_FEAT_NNPA); -+ s390_cpudef_featoff_greater(16, 1, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2); -+ s390_cpudef_featoff_greater(16, 1, S390_FEAT_BEAR_ENH); -+ s390_cpudef_featoff_greater(16, 1, S390_FEAT_RDP); -+ s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAI); -+} -+ -+static void ccw_rhel_machine_8_5_0_class_options(MachineClass *mc) -+{ -+ static GlobalProperty compat[] = { -+ { TYPE_S390_PCI_DEVICE, "interpret", "off", }, -+ { TYPE_S390_PCI_DEVICE, "forwarding-assist", "off", }, -+ }; -+ -+ ccw_rhel_machine_8_6_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_5, hw_compat_rhel_8_5_len); -+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); -+ mc->smp_props.prefer_sockets = true; -+} -+DEFINE_CCW_MACHINE(8, 5, 0); -+ -+static void ccw_rhel_machine_8_4_0_instance_options(MachineState *machine) -+{ -+ ccw_rhel_machine_8_5_0_instance_options(machine); -+} -+ -+static void ccw_rhel_machine_8_4_0_class_options(MachineClass *mc) -+{ -+ ccw_rhel_machine_8_5_0_class_options(mc); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_4, hw_compat_rhel_8_4_len); -+} -+DEFINE_CCW_MACHINE(8, 4, 0); -+ -+static void ccw_rhel_machine_8_2_0_instance_options(MachineState *machine) -+{ -+ ccw_rhel_machine_8_4_0_instance_options(machine); -+} -+ -+static void ccw_rhel_machine_8_2_0_class_options(MachineClass *mc) -+{ -+ ccw_rhel_machine_8_4_0_class_options(mc); -+ mc->fixup_ram_size = s390_fixup_ram_size; -+ /* we did not publish a rhel8.3.0 machine */ -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_3, hw_compat_rhel_8_3_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_2, hw_compat_rhel_8_2_len); -+} -+DEFINE_CCW_MACHINE(8, 2, 0); -+ -+static void ccw_rhel_machine_7_6_0_instance_options(MachineState *machine) -+{ -+ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V3_1 }; -+ -+ ccw_rhel_machine_8_2_0_instance_options(machine); -+ -+ s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat); -+ -+ /* The multiple-epoch facility was not available with rhel7.6.0 on z14GA1 */ -+ s390_cpudef_featoff(14, 1, S390_FEAT_MULTIPLE_EPOCH); -+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QSIE); -+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QTOUE); -+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOE); -+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOUE); -+} -+ -+static void ccw_rhel_machine_7_6_0_class_options(MachineClass *mc) -+{ -+ ccw_rhel_machine_8_2_0_class_options(mc); -+ /* We never published the s390x version of RHEL-AV 8.0 and 8.1, so add this here */ -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len); -+ compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); -+} -+DEFINE_CCW_MACHINE(7, 6, 0); -+ - static void ccw_machine_register_types(void) - { - type_register_static(&ccw_machine_info); -diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c -index a27f4b6f79..9ee30310c6 100644 ---- a/target/s390x/cpu_models.c -+++ b/target/s390x/cpu_models.c -@@ -47,6 +47,9 @@ - * of a following release have been a superset of the previous release. With - * generation 15 one base feature and one optional feature have been deprecated. - */ -+ -+#define RHEL_CPU_DEPRECATION "use at least 'z14', or 'host' / 'qemu' / 'max'" -+ - static S390CPUDef s390_cpu_defs[] = { - /* - * Linux requires at least z10 nowadays, and IBM only supports recent CPUs -@@ -871,22 +874,30 @@ static void s390_host_cpu_model_class_init(ObjectClass *oc, void *data) - static void s390_base_cpu_model_class_init(ObjectClass *oc, void *data) - { - S390CPUClass *xcc = S390_CPU_CLASS(oc); -+ CPUClass *cc = CPU_CLASS(oc); - - /* all base models are migration safe */ - xcc->cpu_def = (const S390CPUDef *) data; - xcc->is_migration_safe = true; - xcc->is_static = true; - xcc->desc = xcc->cpu_def->desc; -+ if (xcc->cpu_def->gen < 14) { -+ cc->deprecation_note = RHEL_CPU_DEPRECATION; -+ } - } - - static void s390_cpu_model_class_init(ObjectClass *oc, void *data) - { - S390CPUClass *xcc = S390_CPU_CLASS(oc); -+ CPUClass *cc = CPU_CLASS(oc); - - /* model that can change between QEMU versions */ - xcc->cpu_def = (const S390CPUDef *) data; - xcc->is_migration_safe = true; - xcc->desc = xcc->cpu_def->desc; -+ if (xcc->cpu_def->gen < 14) { -+ cc->deprecation_note = RHEL_CPU_DEPRECATION; -+ } - } - - static void s390_qemu_cpu_model_class_init(ObjectClass *oc, void *data) -diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h -index 71d4bc2dd4..d6c7c2cb50 100644 ---- a/target/s390x/cpu_models.h -+++ b/target/s390x/cpu_models.h -@@ -38,6 +38,8 @@ typedef struct S390CPUDef { - S390FeatBitmap full_feat; - /* used to init full_feat from generated data */ - S390FeatInit full_init; -+ /* if deprecated, provides a suggestion */ -+ const char *deprecation_note; - } S390CPUDef; - - /* CPU model based on a CPU definition */ -diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c -index 72572726b8..707d546ca1 100644 ---- a/target/s390x/cpu_models_sysemu.c -+++ b/target/s390x/cpu_models_sysemu.c -@@ -59,6 +59,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque) - CpuDefinitionInfo *info; - char *name = g_strdup(object_class_get_name(klass)); - S390CPUClass *scc = S390_CPU_CLASS(klass); -+ CPUClass *cc = CPU_CLASS(klass); - - /* strip off the -s390x-cpu */ - g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0; -@@ -68,6 +69,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque) - info->migration_safe = scc->is_migration_safe; - info->q_static = scc->is_static; - info->q_typename = g_strdup(object_class_get_name(klass)); -+ info->deprecated = !!cc->deprecation_note; - /* check for unavailable features */ - if (cpu_list_data->model) { - Object *obj; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch b/images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch deleted file mode 100644 index 7959d6ddc..000000000 --- a/images/qemu-artifact/patches/0014-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch +++ /dev/null @@ -1,925 +0,0 @@ -From a7d5687a80eca95a1c39b73bebb9d478f3adfb0c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 13:44:41 +0100 -Subject: Add downstream x86_64 versioned 'pc' & 'q35' machine types - -Adding changes to add RHEL machine types for x86_64 architecture. - -Signed-off-by: Miroslav Rezanina - -Rebase notes (6.1.0): -- Update qemu64 cpu spec - -Rebase notes (7.0.0): -- Reset alias for all machine-types except latest one - -Rebase notes (8.0.0): -- remove legacy_no_rng_seed usage (removed upstream) - -Rebase notes (8.1.0): -- default_nic_model to default_nic - -Rebase notes (9.1.0 rc0) -- Merged pc_q35_machine_rhel_options back into - pc_q35_machine_options to reduce delta to upstream -- Convert to new DEFINE_(I440FX|Q35)_MACHINE macros - -Merged patches (6.1.0): -- 59c284ad3b x86: Add x86 rhel8.5 machine types -- a8868b42fe redhat: x86: Enable 'kvm-asyncpf-int' by default -- a3995e2eff Remove RHEL 7.0.0 machine type (only x86_64 changes) -- ad3190a79b Remove RHEL 7.1.0 machine type (only x86_64 changes) -- 84bbe15d4e Remove RHEL 7.2.0 machine type (only x86_64 changes) -- 0215eb3356 Remove RHEL 7.3.0 machine types (only x86_64 changes) -- af69d1ca6e Remove RHEL 7.4.0 machine types (only x86_64 changes) -- 8f7a74ab78 Remove RHEL 7.5.0 machine types (only x86_64 changes) - -Merged patches (7.0.0): -- eae7d8dd3c x86/rhel machine types: Add pc_rhel_8_5_compat -- 6762f56469 x86/rhel machine types: Wire compat into q35 and i440fx -- 5762101438 rhel machine types/x86: set prefer_sockets -- 9ba9ddc632 x86: Add q35 RHEL 8.6.0 machine type -- 6110d865e5 x86: Add q35 RHEL 9.0.0 machine type -- dcc64971bf RHEL: mark old machine types as deprecated (partialy) -- 6b396f182b RHEL: disable "seqpacket" for "vhost-vsock-device" in rhel8.6.0 - -Merged patches (7.1.0): -- 38b89dc245 pc: Move s3/s4 suspend disabling to compat (only hw/i386/pc.c chunk) -- 1d6439527a WRB: Introduce RHEL 9.0.0 hw compat structure (x86_64 specific changes) -- 35b5c8554f target/i386: deprecate CPUs older than x86_64-v2 ABI - -Merged patches (7.2.0): -- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts) - -Merged patches (8.0.0): -- f33ca8aed4 x86: rhel 9.2.0 machine type - -Merged patches (8.1.0): -- bd5d81d286 Add RHEL 9.2.0 compat structure (x86_64 part) -- c6eaf73add redhat: hw/i386/pc: Update x86 machine type compatibility for QEMU 8.0.0 update -- 6cbf496e5e hw/acpi: Mark acpi blobs as resizable on RHEL pc machines version 7.6 and above - -Merged patches (8.2.0): -- 4ee284aca9 Add machine types compat bits. (partial) -- 719e2ac147 Fix x86 machine type compatibility for qemu-kvm 8.1.0 - -Merged patches (9.0.0 rc0): -- 9149e2bc8f x86: rhel 9.2.0 machine type compat fix - -Merged patches (9.1.0 rc0): -- 043ad5ce97 Add upstream compatibility bits (partial) - -Merged patches (9.1.0 rc2): -- 06ee79be2b introduce pc_rhel_9_5_compat -- 5cfd133600 target/i386: add guest-phys-bits cpu property (partial) -- 46206b821b hw/i386/sev: Use legacy SEV VM types for older machine types (partial) -- 414fe1d14f hw/i386/pc_sysfw: Alias rather than copy isa-bios region (partial) -- 0b6825631a i386/sev: Don't allow automatic fallback to legacy KVM_SEV*_INIT (partial) ---- - hw/i386/fw_cfg.c | 2 +- - hw/i386/pc.c | 167 +++++++++++++++++++++++++++++- - hw/i386/pc_piix.c | 105 ++++++++++++++++++- - hw/i386/pc_q35.c | 207 +++++++++++++++++++++++++++++++++++-- - include/hw/boards.h | 2 + - include/hw/i386/pc.h | 36 +++++++ - target/i386/cpu.c | 21 ++++ - target/i386/kvm/kvm-cpu.c | 1 + - target/i386/kvm/kvm.c | 4 + - tests/qtest/pvpanic-test.c | 5 +- - 10 files changed, 537 insertions(+), 13 deletions(-) - -diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c -index 33ef280420..a322709ffa 100644 ---- a/hw/i386/fw_cfg.c -+++ b/hw/i386/fw_cfg.c -@@ -73,7 +73,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, - - if (pcmc->smbios_defaults) { - /* These values are guest ABI, do not change */ -- smbios_set_defaults("QEMU", mc->desc, mc->name, -+ smbios_set_defaults("Red Hat", "KVM", mc->desc, - pcmc->smbios_stream_product, pcmc->smbios_stream_version); - } - -diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index 7779c88a91..fa0e42d072 100644 ---- a/hw/i386/pc.c -+++ b/hw/i386/pc.c -@@ -276,6 +276,169 @@ const size_t pc_compat_2_4_len = G_N_ELEMENTS(pc_compat_2_4); - */ - #define PC_FW_DATA (0x20000 + 0x8000) - -+/* This macro is for changes to properties that are RHEL specific, -+ * different to the current upstream and to be applied to the latest -+ * machine type. -+ */ -+GlobalProperty pc_rhel_compat[] = { -+ /* we don't support s3/s4 suspend */ -+ { "PIIX4_PM", "disable_s3", "1" }, -+ { "PIIX4_PM", "disable_s4", "1" }, -+ { "ICH9-LPC", "disable_s3", "1" }, -+ { "ICH9-LPC", "disable_s4", "1" }, -+ -+ { TYPE_X86_CPU, "host-phys-bits", "on" }, -+ { TYPE_X86_CPU, "host-phys-bits-limit", "48" }, -+ { TYPE_X86_CPU, "vmx-entry-load-perf-global-ctrl", "off" }, -+ { TYPE_X86_CPU, "vmx-exit-load-perf-global-ctrl", "off" }, -+ /* bz 1508330 */ -+ { "vfio-pci", "x-no-geforce-quirks", "on" }, -+ /* bz 1941397 */ -+ { TYPE_X86_CPU, "kvm-asyncpf-int", "on" }, -+}; -+const size_t pc_rhel_compat_len = G_N_ELEMENTS(pc_rhel_compat); -+ -+GlobalProperty pc_rhel_9_5_compat[] = { -+ /* pc_rhel_9_5_compat from pc_compat_pc_9_0 (backported from 9.1) */ -+ { TYPE_X86_CPU, "guest-phys-bits", "0" }, -+ /* pc_rhel_9_5_compat from pc_compat_pc_9_0 (backported from 9.1) */ -+ { "sev-guest", "legacy-vm-type", "on" }, -+}; -+const size_t pc_rhel_9_5_compat_len = G_N_ELEMENTS(pc_rhel_9_5_compat); -+ -+GlobalProperty pc_rhel_9_3_compat[] = { -+ /* pc_rhel_9_3_compat from pc_compat_8_0 */ -+ { "virtio-mem", "unplugged-inaccessible", "auto" }, -+}; -+const size_t pc_rhel_9_3_compat_len = G_N_ELEMENTS(pc_rhel_9_3_compat); -+ -+GlobalProperty pc_rhel_9_2_compat[] = { -+ /* pc_rhel_9_2_compat from pc_compat_7_2 */ -+ { "ICH9-LPC", "noreboot", "true" }, -+}; -+const size_t pc_rhel_9_2_compat_len = G_N_ELEMENTS(pc_rhel_9_2_compat); -+ -+GlobalProperty pc_rhel_9_0_compat[] = { -+ /* pc_rhel_9_0_compat from pc_compat_6_2 */ -+ { "virtio-mem", "unplugged-inaccessible", "off" }, -+}; -+const size_t pc_rhel_9_0_compat_len = G_N_ELEMENTS(pc_rhel_9_0_compat); -+ -+GlobalProperty pc_rhel_8_5_compat[] = { -+ /* pc_rhel_8_5_compat from pc_compat_6_0 */ -+ { "qemu64" "-" TYPE_X86_CPU, "family", "6" }, -+ /* pc_rhel_8_5_compat from pc_compat_6_0 */ -+ { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, -+ /* pc_rhel_8_5_compat from pc_compat_6_0 */ -+ { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, -+ /* pc_rhel_8_5_compat from pc_compat_6_0 */ -+ { TYPE_X86_CPU, "x-vendor-cpuid-only", "off" }, -+ /* pc_rhel_8_5_compat from pc_compat_6_0 */ -+ { "ICH9-LPC", ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, "off" }, -+ -+ /* pc_rhel_8_5_compat from pc_compat_6_1 */ -+ { TYPE_X86_CPU, "hv-version-id-build", "0x1bbc" }, -+ /* pc_rhel_8_5_compat from pc_compat_6_1 */ -+ { TYPE_X86_CPU, "hv-version-id-major", "0x0006" }, -+ /* pc_rhel_8_5_compat from pc_compat_6_1 */ -+ { TYPE_X86_CPU, "hv-version-id-minor", "0x0001" }, -+}; -+const size_t pc_rhel_8_5_compat_len = G_N_ELEMENTS(pc_rhel_8_5_compat); -+ -+GlobalProperty pc_rhel_8_4_compat[] = { -+ /* pc_rhel_8_4_compat from pc_compat_5_2 */ -+ { "ICH9-LPC", "x-smi-cpu-hotunplug", "off" }, -+ { TYPE_X86_CPU, "kvm-asyncpf-int", "off" }, -+}; -+const size_t pc_rhel_8_4_compat_len = G_N_ELEMENTS(pc_rhel_8_4_compat); -+ -+GlobalProperty pc_rhel_8_3_compat[] = { -+ /* pc_rhel_8_3_compat from pc_compat_5_1 */ -+ { "ICH9-LPC", "x-smi-cpu-hotplug", "off" }, -+}; -+const size_t pc_rhel_8_3_compat_len = G_N_ELEMENTS(pc_rhel_8_3_compat); -+ -+GlobalProperty pc_rhel_8_2_compat[] = { -+ /* pc_rhel_8_2_compat from pc_compat_4_2 */ -+ { "mch", "smbase-smram", "off" }, -+}; -+const size_t pc_rhel_8_2_compat_len = G_N_ELEMENTS(pc_rhel_8_2_compat); -+ -+/* pc_rhel_8_1_compat is empty since pc_4_1_compat is */ -+GlobalProperty pc_rhel_8_1_compat[] = { }; -+const size_t pc_rhel_8_1_compat_len = G_N_ELEMENTS(pc_rhel_8_1_compat); -+ -+GlobalProperty pc_rhel_8_0_compat[] = { -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "intel-iommu", "dma-drain", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Opteron_G4" "-" TYPE_X86_CPU, "rdtscp", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Opteron_G4" "-" TYPE_X86_CPU, "npt", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Opteron_G4" "-" TYPE_X86_CPU, "nrip-save", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Opteron_G5" "-" TYPE_X86_CPU, "rdtscp", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Opteron_G5" "-" TYPE_X86_CPU, "npt", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Opteron_G5" "-" TYPE_X86_CPU, "nrip-save", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "EPYC" "-" TYPE_X86_CPU, "npt", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" }, -+ /** The mpx=on entries from pc_compat_3_1 are in pc_rhel_7_6_compat **/ -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { "Cascadelake-Server" "-" TYPE_X86_CPU, "stepping", "5" }, -+ /* pc_rhel_8_0_compat from pc_compat_3_1 */ -+ { TYPE_X86_CPU, "x-intel-pt-auto-level", "off" }, -+}; -+const size_t pc_rhel_8_0_compat_len = G_N_ELEMENTS(pc_rhel_8_0_compat); -+ -+/* Similar to PC_COMPAT_3_0 + PC_COMPAT_2_12, but: -+ * all of the 2_12 stuff was already in 7.6 from bz 1481253 -+ * x-migrate-smi-count comes from PC_COMPAT_2_11 but -+ * is really tied to kernel version so keep it off on 7.x -+ * machine types irrespective of host. -+ */ -+GlobalProperty pc_rhel_7_6_compat[] = { -+ /* pc_rhel_7_6_compat from pc_compat_3_0 */ -+ { TYPE_X86_CPU, "x-hv-synic-kvm-only", "on" }, -+ /* pc_rhel_7_6_compat from pc_compat_3_0 */ -+ { "Skylake-Server" "-" TYPE_X86_CPU, "pku", "off" }, -+ /* pc_rhel_7_6_compat from pc_compat_3_0 */ -+ { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "pku", "off" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { TYPE_X86_CPU, "x-migrate-smi-count", "off" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { "Cascadelake-Server" "-" TYPE_X86_CPU, "mpx", "on" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { "Icelake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, -+ /* pc_rhel_7_6_compat from pc_compat_2_11 */ -+ { "Icelake-Server" "-" TYPE_X86_CPU, "mpx", "on" }, -+}; -+const size_t pc_rhel_7_6_compat_len = G_N_ELEMENTS(pc_rhel_7_6_compat); -+ -+/* -+ * The PC_RHEL_*_COMPAT serve the same purpose for RHEL-7 machine -+ * types as the PC_COMPAT_* do for upstream types. -+ * PC_RHEL_7_*_COMPAT apply both to i440fx and q35 types. -+ */ -+ - GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled) - { - GSIState *s; -@@ -1767,6 +1930,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) - pcmc->kvmclock_create_always = true; - x86mc->apic_xrupt_override = true; - assert(!mc->get_hotplug_handler); -+ mc->async_pf_vmexit_disable = false; - mc->get_hotplug_handler = pc_get_hotplug_handler; - mc->hotplug_allowed = pc_hotplug_allowed; - mc->auto_enable_numa_with_memhp = true; -@@ -1774,7 +1938,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) - mc->has_hotpluggable_cpus = true; - mc->default_boot_order = "cad"; - mc->block_default_type = IF_IDE; -- mc->max_cpus = 255; -+ /* 240: max CPU count for RHEL */ -+ mc->max_cpus = 240; - mc->reset = pc_machine_reset; - mc->wakeup = pc_machine_wakeup; - hc->pre_plug = pc_machine_device_pre_plug_cb; -diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c -index 67107b174a..c93e78e896 100644 ---- a/hw/i386/pc_piix.c -+++ b/hw/i386/pc_piix.c -@@ -52,6 +52,7 @@ - #include "qapi/error.h" - #include "qemu/error-report.h" - #include "sysemu/xen.h" -+#include "migration/migration.h" - #ifdef CONFIG_XEN - #include - #include "hw/xen/xen_pt.h" -@@ -445,8 +446,8 @@ static void pc_i440fx_init(MachineState *machine) - pc_init1(machine, TYPE_I440FX_PCI_DEVICE); - } - --#define DEFINE_I440FX_MACHINE(major, minor) \ -- DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor); -+#define DEFINE_I440FX_MACHINE(major, minor, micro) \ -+ DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor, micro); - - #if 0 /* Disabled for Red Hat Enterprise Linux */ - static void pc_i440fx_machine_options(MachineClass *m) -@@ -826,3 +827,103 @@ static void xenfv_machine_3_1_options(MachineClass *m) - DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init, - xenfv_machine_3_1_options); - #endif -+ -+/* Red Hat Enterprise Linux machine types */ -+ -+/* Options for the latest rhel7 machine type */ -+static void pc_machine_rhel7_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ m->family = "pc_piix_Y"; -+ m->default_machine_opts = "firmware=bios-256k.bin,hpet=off"; -+ pcmc->pci_root_uid = 0; -+ m->default_nic = "e1000"; -+ m->default_display = "std"; -+ m->no_parallel = 1; -+ m->numa_mem_supported = true; -+ m->auto_enable_numa_with_memdev = false; -+ machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); -+ compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len); -+ m->alias = "pc"; -+ m->is_default = 1; -+ m->smp_props.prefer_sockets = true; -+ pcmc->isa_bios_alias = false; -+} -+ -+static void pc_i440fx_rhel_machine_7_6_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ ObjectClass *oc = OBJECT_CLASS(m); -+ pc_machine_rhel7_options(m); -+ m->desc = "RHEL 7.6.0 PC (i440FX + PIIX, 1996)"; -+ m->async_pf_vmexit_disable = true; -+ m->smbus_no_migration_support = true; -+ -+ pcmc->pvh_enabled = false; -+ pcmc->default_cpu_version = CPU_VERSION_LEGACY; -+ pcmc->kvmclock_create_always = false; -+ /* From pc_i440fx_5_1_machine_options() */ -+ pcmc->pci_root_uid = 1; -+ /* From pc_i440fx_7_0_machine_options() */ -+ pcmc->enforce_amd_1tb_hole = false; -+ /* From pc_i440fx_8_0_machine_options() */ -+ pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32; -+ /* From pc_i440fx_8_1_machine_options() */ -+ pcmc->broken_32bit_mem_addr_check = true; -+ /* Introduced in QEMU 8.2 */ -+ pcmc->default_south_bridge = TYPE_PIIX3_DEVICE; -+ -+ object_class_property_add_enum(oc, "x-south-bridge", "PCSouthBridgeOption", -+ &PCSouthBridgeOption_lookup, -+ pc_get_south_bridge, -+ pc_set_south_bridge); -+ object_class_property_set_description(oc, "x-south-bridge", -+ "Use a different south bridge than PIIX3"); -+ -+ compat_props_add(m->compat_props, pc_rhel_9_5_compat, -+ pc_rhel_9_5_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_5, -+ hw_compat_rhel_9_5_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_4, -+ hw_compat_rhel_9_4_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_3, -+ hw_compat_rhel_9_3_len); -+ compat_props_add(m->compat_props, pc_rhel_9_3_compat, -+ pc_rhel_9_3_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_2, -+ hw_compat_rhel_9_2_len); -+ compat_props_add(m->compat_props, pc_rhel_9_2_compat, -+ pc_rhel_9_2_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_1, -+ hw_compat_rhel_9_1_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_0, -+ hw_compat_rhel_9_0_len); -+ compat_props_add(m->compat_props, pc_rhel_9_0_compat, -+ pc_rhel_9_0_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_8_6, -+ hw_compat_rhel_8_6_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_8_5, -+ hw_compat_rhel_8_5_len); -+ compat_props_add(m->compat_props, pc_rhel_8_5_compat, -+ pc_rhel_8_5_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_8_4, -+ hw_compat_rhel_8_4_len); -+ compat_props_add(m->compat_props, pc_rhel_8_4_compat, -+ pc_rhel_8_4_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_8_3, -+ hw_compat_rhel_8_3_len); -+ compat_props_add(m->compat_props, pc_rhel_8_3_compat, -+ pc_rhel_8_3_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_8_2, -+ hw_compat_rhel_8_2_len); -+ compat_props_add(m->compat_props, pc_rhel_8_2_compat, -+ pc_rhel_8_2_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len); -+ compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len); -+ compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); -+ compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len); -+} -+ -+DEFINE_I440FX_MACHINE(7, 6, 0); -diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c -index 5fb283f2df..76f0ac1acd 100644 ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -338,20 +338,19 @@ static void pc_q35_machine_options(MachineClass *m) - pcmc->pci_root_uid = 0; - pcmc->default_cpu_version = 1; - -- m->family = "pc_q35"; -- m->desc = "Standard PC (Q35 + ICH9, 2009)"; -+ m->family = "pc_q35_Z"; - m->units_per_default_bus = 1; -- m->default_machine_opts = "firmware=bios-256k.bin"; -+ m->default_machine_opts = "firmware=bios-256k.bin,hpet=off"; - m->default_display = "std"; - m->default_nic = "e1000e"; -- m->default_kernel_irqchip_split = false; - m->no_floppy = 1; -- m->max_cpus = 4096; -- m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); -+ m->max_cpus = 710; -+ m->no_parallel = 1; - machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); - machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); - machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); -- machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); -+ m->alias = "q35"; -+ compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len); - compat_props_add(m->compat_props, - pc_q35_compat_defaults, pc_q35_compat_defaults_len); - } -@@ -670,3 +669,197 @@ static void pc_q35_machine_2_4_options(MachineClass *m) - - DEFINE_Q35_MACHINE(2, 4); - #endif /* Disabled for Red Hat Enterprise Linux */ -+ -+/* Red Hat Enterprise Linux machine types */ -+ -+static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_machine_options(m); -+ m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; -+ pcmc->smbios_stream_product = "RHEL"; -+ pcmc->smbios_stream_version = "9.4.0"; -+ pcmc->isa_bios_alias = false; -+ -+ compat_props_add(m->compat_props, pc_rhel_9_5_compat, -+ pc_rhel_9_5_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_5, -+ hw_compat_rhel_9_5_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(9, 4, 0); -+ -+static void pc_q35_rhel_machine_9_2_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_9_4_0_options(m); -+ m->desc = "RHEL-9.2.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ pcmc->smbios_stream_product = "RHEL"; -+ pcmc->smbios_stream_version = "9.2.0"; -+ -+ /* From pc_q35_8_0_machine_options() */ -+ pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32; -+ /* From pc_q35_8_1_machine_options() */ -+ pcmc->broken_32bit_mem_addr_check = true; -+ -+ compat_props_add(m->compat_props, hw_compat_rhel_9_4, -+ hw_compat_rhel_9_4_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_3, -+ hw_compat_rhel_9_3_len); -+ compat_props_add(m->compat_props, pc_rhel_9_3_compat, -+ pc_rhel_9_3_compat_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_2, -+ hw_compat_rhel_9_2_len); -+ compat_props_add(m->compat_props, pc_rhel_9_2_compat, -+ pc_rhel_9_2_compat_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(9, 2, 0); -+ -+static void pc_q35_rhel_machine_9_0_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_9_2_0_options(m); -+ m->desc = "RHEL-9.0.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ pcmc->smbios_stream_product = "RHEL"; -+ pcmc->smbios_stream_version = "9.0.0"; -+ pcmc->enforce_amd_1tb_hole = false; -+ compat_props_add(m->compat_props, hw_compat_rhel_9_1, -+ hw_compat_rhel_9_1_len); -+ compat_props_add(m->compat_props, hw_compat_rhel_9_0, -+ hw_compat_rhel_9_0_len); -+ compat_props_add(m->compat_props, pc_rhel_9_0_compat, -+ pc_rhel_9_0_compat_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(9, 0, 0); -+ -+static void pc_q35_rhel_machine_8_6_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_9_0_0_options(m); -+ m->desc = "RHEL-8.6.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ -+ pcmc->smbios_stream_product = "RHEL-AV"; -+ pcmc->smbios_stream_version = "8.6.0"; -+ compat_props_add(m->compat_props, hw_compat_rhel_8_6, -+ hw_compat_rhel_8_6_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(8, 6, 0); -+ -+static void pc_q35_rhel_machine_8_5_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_8_6_0_options(m); -+ m->desc = "RHEL-8.5.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ pcmc->smbios_stream_product = "RHEL-AV"; -+ pcmc->smbios_stream_version = "8.5.0"; -+ compat_props_add(m->compat_props, hw_compat_rhel_8_5, -+ hw_compat_rhel_8_5_len); -+ compat_props_add(m->compat_props, pc_rhel_8_5_compat, -+ pc_rhel_8_5_compat_len); -+ m->smp_props.prefer_sockets = true; -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(8, 5, 0); -+ -+static void pc_q35_rhel_machine_8_4_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_8_5_0_options(m); -+ m->desc = "RHEL-8.4.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ pcmc->smbios_stream_product = "RHEL-AV"; -+ pcmc->smbios_stream_version = "8.4.0"; -+ compat_props_add(m->compat_props, hw_compat_rhel_8_4, -+ hw_compat_rhel_8_4_len); -+ compat_props_add(m->compat_props, pc_rhel_8_4_compat, -+ pc_rhel_8_4_compat_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(8, 4, 0); -+ -+static void pc_q35_rhel_machine_8_3_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_8_4_0_options(m); -+ m->desc = "RHEL-8.3.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ pcmc->smbios_stream_product = "RHEL-AV"; -+ pcmc->smbios_stream_version = "8.3.0"; -+ compat_props_add(m->compat_props, hw_compat_rhel_8_3, -+ hw_compat_rhel_8_3_len); -+ compat_props_add(m->compat_props, pc_rhel_8_3_compat, -+ pc_rhel_8_3_compat_len); -+ /* From pc_q35_5_1_machine_options() */ -+ pcmc->kvmclock_create_always = false; -+ /* From pc_q35_5_1_machine_options() */ -+ pcmc->pci_root_uid = 1; -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(8, 3, 0); -+ -+static void pc_q35_rhel_machine_8_2_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_8_3_0_options(m); -+ m->desc = "RHEL-8.2.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ m->numa_mem_supported = true; -+ m->auto_enable_numa_with_memdev = false; -+ pcmc->smbios_stream_product = "RHEL-AV"; -+ pcmc->smbios_stream_version = "8.2.0"; -+ compat_props_add(m->compat_props, hw_compat_rhel_8_2, -+ hw_compat_rhel_8_2_len); -+ compat_props_add(m->compat_props, pc_rhel_8_2_compat, -+ pc_rhel_8_2_compat_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(8, 2, 0); -+ -+static void pc_q35_rhel_machine_8_1_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_8_2_0_options(m); -+ m->desc = "RHEL-8.1.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; -+ pcmc->smbios_stream_product = NULL; -+ pcmc->smbios_stream_version = NULL; -+ compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len); -+ compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(8, 1, 0); -+ -+static void pc_q35_rhel_machine_8_0_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_8_1_0_options(m); -+ m->desc = "RHEL-8.0.0 PC (Q35 + ICH9, 2009)"; -+ m->smbus_no_migration_support = true; -+ m->alias = NULL; -+ pcmc->pvh_enabled = false; -+ pcmc->default_cpu_version = CPU_VERSION_LEGACY; -+ compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len); -+ compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(8, 0, 0); -+ -+static void pc_q35_rhel_machine_7_6_0_options(MachineClass *m) -+{ -+ pc_q35_rhel_machine_8_0_0_options(m); -+ m->alias = NULL; -+ m->desc = "RHEL-7.6.0 PC (Q35 + ICH9, 2009)"; -+ m->async_pf_vmexit_disable = true; -+ compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len); -+ compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len); -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(7, 6, 0); -+ -diff --git a/include/hw/boards.h b/include/hw/boards.h -index 32c4642f5a..85b43e3d0d 100644 ---- a/include/hw/boards.h -+++ b/include/hw/boards.h -@@ -289,6 +289,8 @@ struct MachineClass { - strList *allowed_dynamic_sysbus_devices; - bool auto_enable_numa_with_memhp; - bool auto_enable_numa_with_memdev; -+ /* RHEL only */ -+ bool async_pf_vmexit_disable; - bool ignore_boot_device_suffixes; - bool smbus_no_migration_support; - bool nvdimm_supported; -diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h -index 8776a3c937..75c9271cdd 100644 ---- a/include/hw/i386/pc.h -+++ b/include/hw/i386/pc.h -@@ -302,6 +302,42 @@ extern const size_t pc_compat_2_4_len; - extern GlobalProperty pc_compat_2_3[]; - extern const size_t pc_compat_2_3_len; - -+extern GlobalProperty pc_rhel_compat[]; -+extern const size_t pc_rhel_compat_len; -+ -+extern GlobalProperty pc_rhel_9_5_compat[]; -+extern const size_t pc_rhel_9_5_compat_len; -+ -+extern GlobalProperty pc_rhel_9_3_compat[]; -+extern const size_t pc_rhel_9_3_compat_len; -+ -+extern GlobalProperty pc_rhel_9_2_compat[]; -+extern const size_t pc_rhel_9_2_compat_len; -+ -+extern GlobalProperty pc_rhel_9_0_compat[]; -+extern const size_t pc_rhel_9_0_compat_len; -+ -+extern GlobalProperty pc_rhel_8_5_compat[]; -+extern const size_t pc_rhel_8_5_compat_len; -+ -+extern GlobalProperty pc_rhel_8_4_compat[]; -+extern const size_t pc_rhel_8_4_compat_len; -+ -+extern GlobalProperty pc_rhel_8_3_compat[]; -+extern const size_t pc_rhel_8_3_compat_len; -+ -+extern GlobalProperty pc_rhel_8_2_compat[]; -+extern const size_t pc_rhel_8_2_compat_len; -+ -+extern GlobalProperty pc_rhel_8_1_compat[]; -+extern const size_t pc_rhel_8_1_compat_len; -+ -+extern GlobalProperty pc_rhel_8_0_compat[]; -+extern const size_t pc_rhel_8_0_compat_len; -+ -+extern GlobalProperty pc_rhel_7_6_compat[]; -+extern const size_t pc_rhel_7_6_compat_len; -+ - #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ - static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ - { \ -diff --git a/target/i386/cpu.c b/target/i386/cpu.c -index 85ef7452c0..ed278dd4a1 100644 ---- a/target/i386/cpu.c -+++ b/target/i386/cpu.c -@@ -2411,9 +2411,13 @@ static const CPUCaches epyc_genoa_cache_info = { - * PT in VMX operation - */ - -+#define RHEL_CPU_DEPRECATION \ -+ "use at least 'Nehalem' / 'Opteron_G4', or 'host' / 'max'" -+ - static const X86CPUDefinition builtin_x86_defs[] = { - { - .name = "qemu64", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 0xd, - .vendor = CPUID_VENDOR_AMD, - .family = 15, -@@ -2434,6 +2438,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "phenom", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 5, - .vendor = CPUID_VENDOR_AMD, - .family = 16, -@@ -2466,6 +2471,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "core2duo", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 10, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -2508,6 +2514,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "kvm64", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 0xd, - .vendor = CPUID_VENDOR_INTEL, - .family = 15, -@@ -2549,6 +2556,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "qemu32", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 4, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -2563,6 +2571,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "kvm32", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 5, - .vendor = CPUID_VENDOR_INTEL, - .family = 15, -@@ -2593,6 +2602,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "coreduo", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 10, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -2626,6 +2636,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "486", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 1, - .vendor = CPUID_VENDOR_INTEL, - .family = 4, -@@ -2638,6 +2649,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "pentium", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 1, - .vendor = CPUID_VENDOR_INTEL, - .family = 5, -@@ -2650,6 +2662,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "pentium2", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 2, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -2662,6 +2675,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "pentium3", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 3, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -2674,6 +2688,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "athlon", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 2, - .vendor = CPUID_VENDOR_AMD, - .family = 6, -@@ -2689,6 +2704,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "n270", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 10, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -2714,6 +2730,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "Conroe", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 10, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -2754,6 +2771,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "Penryn", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 10, - .vendor = CPUID_VENDOR_INTEL, - .family = 6, -@@ -4762,6 +4780,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "Opteron_G1", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 5, - .vendor = CPUID_VENDOR_AMD, - .family = 15, -@@ -4782,6 +4801,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "Opteron_G2", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 5, - .vendor = CPUID_VENDOR_AMD, - .family = 15, -@@ -4804,6 +4824,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { - }, - { - .name = "Opteron_G3", -+ .deprecation_note = RHEL_CPU_DEPRECATION, - .level = 5, - .vendor = CPUID_VENDOR_AMD, - .family = 16, -diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c -index 6bf8dcfc60..684e731cbc 100644 ---- a/target/i386/kvm/kvm-cpu.c -+++ b/target/i386/kvm/kvm-cpu.c -@@ -178,6 +178,7 @@ static PropValue kvm_default_props[] = { - { "acpi", "off" }, - { "monitor", "off" }, - { "svm", "off" }, -+ { "kvm-pv-unhalt", "on" }, - { NULL, NULL }, - }; - -diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c -index 2fa88ef1e3..2b28c18693 100644 ---- a/target/i386/kvm/kvm.c -+++ b/target/i386/kvm/kvm.c -@@ -4244,6 +4244,7 @@ static int kvm_get_msrs(X86CPU *cpu) - struct kvm_msr_entry *msrs = cpu->kvm_msr_buf->entries; - int ret, i; - uint64_t mtrr_top_bits; -+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); - - kvm_msr_buf_reset(cpu); - -@@ -4636,6 +4637,9 @@ static int kvm_get_msrs(X86CPU *cpu) - break; - case MSR_KVM_ASYNC_PF_EN: - env->async_pf_en_msr = msrs[i].data; -+ if (mc->async_pf_vmexit_disable) { -+ env->async_pf_en_msr &= ~(1ULL << 2); -+ } - break; - case MSR_KVM_ASYNC_PF_INT: - env->async_pf_int_msr = msrs[i].data; -diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c -index d49d2ba931..c18f63e255 100644 ---- a/tests/qtest/pvpanic-test.c -+++ b/tests/qtest/pvpanic-test.c -@@ -18,7 +18,7 @@ static void test_panic_nopause(void) - QDict *response, *data; - QTestState *qts; - -- qts = qtest_init("-device pvpanic -action panic=none"); -+ qts = qtest_init("-M q35 -device pvpanic -action panic=none"); - - val = qtest_inb(qts, 0x505); - g_assert_cmpuint(val, ==, PVPANIC_EVENTS); -@@ -41,7 +41,8 @@ static void test_panic(void) - QDict *response, *data; - QTestState *qts; - -- qts = qtest_init("-device pvpanic -action panic=pause"); -+ /* RHEL: Use q35 */ -+ qts = qtest_init("-M q35 -device pvpanic -action panic=pause"); - - val = qtest_inb(qts, 0x505); - g_assert_cmpuint(val, ==, PVPANIC_EVENTS); --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch b/images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch deleted file mode 100644 index e528ecf89..000000000 --- a/images/qemu-artifact/patches/0015-Revert-meson-temporarily-disable-Wunused-function.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 2698c3de00b8736553112a037c7ffb5f5d9086b1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Wed, 3 Jul 2024 13:47:04 +0100 -Subject: Revert "meson: temporarily disable -Wunused-function" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This reverts commit c682111eaa73d9b985187b8be330338f50b78a7a. - -No longer needed after introduction of downstream machines. - -Signed-off-by: Daniel P. Berrangé ---- - meson.build | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/meson.build b/meson.build -index 2de5ab024f..b3529aa0e1 100644 ---- a/meson.build -+++ b/meson.build -@@ -651,7 +651,6 @@ warn_flags = [ - '-Wno-string-plus-int', - '-Wno-tautological-type-limit-compare', - '-Wno-typedef-redefinition', -- '-Wno-unused-function', - ] - - if host_os != 'darwin' --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0016-Enable-make-check.patch b/images/qemu-artifact/patches/0016-Enable-make-check.patch deleted file mode 100644 index 0afff4ecf..000000000 --- a/images/qemu-artifact/patches/0016-Enable-make-check.patch +++ /dev/null @@ -1,280 +0,0 @@ -From b877c7926d84e264bcfa57e6797f997d400fb19d Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina -Date: Wed, 2 Sep 2020 09:39:41 +0200 -Subject: Enable make check - -Fixing tests after device disabling and machine types changes and enabling -make check run during build. - -Signed-off-by: Miroslav Rezanina ---- -Rebase changes (6.1.0): -- removed unnecessary test changes - -Rebase changes (6.2.0): -- new way of disabling bios-table-test - -Rebase changes (7.0.0): -- Disable testing virtio-iommu-pci -- Rename default_bus_bypass_iommu property to default-bus-bypass-iommu -- Disable qtest-bios-table for aarch64 -- Removed redhat chunks for boot-serial-test.c, cdrom-test.c and cpu-plug-test.c qtests -- Do not disable boot-order-test, prom-env-test and boot-serial-test qtests -- Use rhel machine type for new intel hda qtest -- Remove unnecessary changes in iotest 051 -- Remove changes in bios-tables-test.c and prom-env-test.c qtests - -Rebase changes (7.1.0): -- Disable bcm2835-dma-test (added upstream) - -Rebase changes (8.0.0): -- Removed chunks for disabling bios-table-test (protected upstream) -- Disable new qemu-iotests execution -- Revert change in tco qtest (blocking test run) - -Rebase changes (8.1.0): -- Do not disable device-plug-test for s390x - -Rebase changes (8.2.0 rc1): -- Remove unneeded hack in qtest/usb-hcd-xhci-test.c - -Rebase changes (9.1.0 rc0): -- use q35 for new pvpanic test - -Merged patches (6.1.0): -- 2f129df7d3 redhat: Enable the 'test-block-iothread' test again - -Merged patches (7.1.0): -- 64d736640e RHEL-only: tests/avocado: Switch aarch64 tests from a53 to a57 - -Merged patches (8.1.0): -- f468163234 iotests: Use alternative CPU type that is not deprecated in RHEL ---- - .distro/Makefile | 2 +- - .distro/qemu-kvm.spec.template | 4 ++-- - .distro/scripts/process-patches.sh | 3 +++ - tests/avocado/replay_kernel.py | 2 +- - tests/avocado/reverse_debugging.py | 2 +- - tests/avocado/tcg_plugins.py | 4 ++-- - tests/qemu-iotests/meson.build | 34 ++++++++++++++--------------- - tests/qemu-iotests/testenv.py | 3 +++ - tests/qtest/fuzz-e1000e-test.c | 2 +- - tests/qtest/fuzz-virtio-scsi-test.c | 2 +- - tests/qtest/intel-hda-test.c | 2 +- - tests/qtest/libqos/meson.build | 2 +- - tests/qtest/lpc-ich9-test.c | 2 +- - tests/qtest/meson.build | 1 - - tests/qtest/pvpanic-test.c | 2 +- - tests/qtest/virtio-net-failover.c | 1 + - 16 files changed, 37 insertions(+), 31 deletions(-) - -diff --git a/tests/avocado/replay_kernel.py b/tests/avocado/replay_kernel.py -index e22c200a36..cb7ca19b1b 100644 ---- a/tests/avocado/replay_kernel.py -+++ b/tests/avocado/replay_kernel.py -@@ -193,7 +193,7 @@ def test_aarch64_virt(self): - """ - :avocado: tags=arch:aarch64 - :avocado: tags=machine:virt -- :avocado: tags=cpu:cortex-a53 -+ :avocado: tags=cpu:cortex-a57 - """ - kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' - '/linux/releases/29/Everything/aarch64/os/images/pxeboot' -diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py -index f24287cd0a..3880b81df6 100644 ---- a/tests/avocado/reverse_debugging.py -+++ b/tests/avocado/reverse_debugging.py -@@ -228,7 +228,7 @@ def test_aarch64_virt(self): - """ - :avocado: tags=arch:aarch64 - :avocado: tags=machine:virt -- :avocado: tags=cpu:cortex-a53 -+ :avocado: tags=cpu:cortex-a57 - """ - kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' - '/linux/releases/29/Everything/aarch64/os/images/pxeboot' -diff --git a/tests/avocado/tcg_plugins.py b/tests/avocado/tcg_plugins.py -index a6ff457e27..5172ee9b9e 100644 ---- a/tests/avocado/tcg_plugins.py -+++ b/tests/avocado/tcg_plugins.py -@@ -66,7 +66,7 @@ def test_aarch64_virt_insn(self): - :avocado: tags=accel:tcg - :avocado: tags=arch:aarch64 - :avocado: tags=machine:virt -- :avocado: tags=cpu:cortex-a53 -+ :avocado: tags=cpu:cortex-a57 - """ - kernel_path = self._grab_aarch64_kernel() - kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + -@@ -96,7 +96,7 @@ def test_aarch64_virt_insn_icount(self): - :avocado: tags=accel:tcg - :avocado: tags=arch:aarch64 - :avocado: tags=machine:virt -- :avocado: tags=cpu:cortex-a53 -+ :avocado: tags=cpu:cortex-a57 - """ - kernel_path = self._grab_aarch64_kernel() - kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + -diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build -index fad340ad59..3c0d5241f6 100644 ---- a/tests/qemu-iotests/meson.build -+++ b/tests/qemu-iotests/meson.build -@@ -51,21 +51,21 @@ foreach format, speed: qemu_iotests_formats - check: true, - ) - -- foreach item: rc.stdout().strip().split() -- args = [qemu_iotests_check_cmd, -- '-tap', '-' + format, item, -- '--source-dir', meson.current_source_dir(), -- '--build-dir', meson.current_build_dir()] -- # Some individual tests take as long as 45 seconds -- # Bump the timeout to 3 minutes for some headroom -- # on slow machines to minimize spurious failures -- test('io-' + format + '-' + item, -- python, -- args: args, -- depends: qemu_iotests_binaries, -- env: qemu_iotests_env, -- protocol: 'tap', -- timeout: 180, -- suite: suites) -- endforeach -+# foreach item: rc.stdout().strip().split() -+# args = [qemu_iotests_check_cmd, -+# '-tap', '-' + format, item, -+# '--source-dir', meson.current_source_dir(), -+# '--build-dir', meson.current_build_dir()] -+# # Some individual tests take as long as 45 seconds -+# # Bump the timeout to 3 minutes for some headroom -+# # on slow machines to minimize spurious failures -+# test('io-' + format + '-' + item, -+# python, -+# args: args, -+# depends: qemu_iotests_binaries, -+# env: qemu_iotests_env, -+# protocol: 'tap', -+# timeout: 180, -+# suite: suites) -+# endforeach - endforeach -diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py -index c8848f2ec2..d515e5b8b0 100644 ---- a/tests/qemu-iotests/testenv.py -+++ b/tests/qemu-iotests/testenv.py -@@ -249,6 +249,9 @@ def __init__(self, source_dir: str, build_dir: str, - if self.qemu_prog.endswith(f'qemu-system-{suffix}'): - self.qemu_options += f' -machine {machine}' - -+ if self.qemu_prog.endswith('qemu-system-x86_64'): -+ self.qemu_options += ' -cpu Nehalem' -+ - # QEMU_DEFAULT_MACHINE - self.qemu_default_machine = get_default_machine(self.qemu_prog) - -diff --git a/tests/qtest/fuzz-e1000e-test.c b/tests/qtest/fuzz-e1000e-test.c -index 5052883fb6..b5286f4b12 100644 ---- a/tests/qtest/fuzz-e1000e-test.c -+++ b/tests/qtest/fuzz-e1000e-test.c -@@ -17,7 +17,7 @@ static void test_lp1879531_eth_get_rss_ex_dst_addr(void) - { - QTestState *s; - -- s = qtest_init("-nographic -monitor none -serial none -M pc-q35-5.0"); -+ s = qtest_init("-nographic -monitor none -serial none -M pc-q35-rhel8.4.0"); - - qtest_outl(s, 0xcf8, 0x80001010); - qtest_outl(s, 0xcfc, 0xe1020000); -diff --git a/tests/qtest/fuzz-virtio-scsi-test.c b/tests/qtest/fuzz-virtio-scsi-test.c -index e37b48b2cc..88647da054 100644 ---- a/tests/qtest/fuzz-virtio-scsi-test.c -+++ b/tests/qtest/fuzz-virtio-scsi-test.c -@@ -19,7 +19,7 @@ static void test_mmio_oob_from_memory_region_cache(void) - { - QTestState *s; - -- s = qtest_init("-M pc-q35-5.2 -m 512M " -+ s = qtest_init("-M pc-q35-rhel8.4.0 -m 512M " - "-device virtio-scsi,num_queues=8,addr=03.0 "); - - qtest_outl(s, 0xcf8, 0x80001811); -diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c -index 663bb6c485..2efc43e3f7 100644 ---- a/tests/qtest/intel-hda-test.c -+++ b/tests/qtest/intel-hda-test.c -@@ -42,7 +42,7 @@ static void test_issue542_ich6(void) - { - QTestState *s; - -- s = qtest_init("-nographic -nodefaults -M pc-q35-6.2 " -+ s = qtest_init("-nographic -nodefaults -M pc-q35-rhel9.0.0 " - AUDIODEV - "-device intel-hda,id=" HDA_ID CODEC_DEVICES); - -diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build -index 1b2b2dbb22..86afbddb58 100644 ---- a/tests/qtest/libqos/meson.build -+++ b/tests/qtest/libqos/meson.build -@@ -44,7 +44,7 @@ libqos_srcs = files( - 'virtio-rng.c', - 'virtio-scsi.c', - 'virtio-serial.c', -- 'virtio-iommu.c', -+# 'virtio-iommu.c', - 'virtio-gpio.c', - 'virtio-scmi.c', - 'generic-pcihost.c', -diff --git a/tests/qtest/lpc-ich9-test.c b/tests/qtest/lpc-ich9-test.c -index 8ac95b89f7..cd2102555c 100644 ---- a/tests/qtest/lpc-ich9-test.c -+++ b/tests/qtest/lpc-ich9-test.c -@@ -15,7 +15,7 @@ static void test_lp1878642_pci_bus_get_irq_level_assert(void) - { - QTestState *s; - -- s = qtest_init("-M pc-q35-5.0 " -+ s = qtest_init("-M pc-q35-rhel8.4.0 " - "-nographic -monitor none -serial none"); - - qtest_outl(s, 0xcf8, 0x8000f840); /* PMBASE */ -diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build -index 2f0d3ef080..44ee791508 100644 ---- a/tests/qtest/meson.build -+++ b/tests/qtest/meson.build -@@ -102,7 +102,6 @@ qtests_i386 = \ - 'drive_del-test', - 'tco-test', - 'cpu-plug-test', -- 'q35-test', - 'vmgenid-test', - 'migration-test', - 'test-x86-cpuid-compat', -diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c -index c18f63e255..57fb129ae4 100644 ---- a/tests/qtest/pvpanic-test.c -+++ b/tests/qtest/pvpanic-test.c -@@ -65,7 +65,7 @@ static void test_pvshutdown(void) - QDict *response, *data; - QTestState *qts; - -- qts = qtest_init("-device pvpanic"); -+ qts = qtest_init("-M q35 -device pvpanic"); - - val = qtest_inb(qts, 0x505); - g_assert_cmpuint(val, ==, PVPANIC_EVENTS); -diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c -index 73dfabc272..a9dd304781 100644 ---- a/tests/qtest/virtio-net-failover.c -+++ b/tests/qtest/virtio-net-failover.c -@@ -26,6 +26,7 @@ - #define PCI_SEL_BASE 0x0010 - - #define BASE_MACHINE "-M q35 -nodefaults " \ -+ "-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=on " \ - "-device pcie-root-port,id=root0,addr=0x1,bus=pcie.0,chassis=1 " \ - "-device pcie-root-port,id=root1,addr=0x2,bus=pcie.0,chassis=2 " - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch b/images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch deleted file mode 100644 index b18c2bd3d..000000000 --- a/images/qemu-artifact/patches/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch +++ /dev/null @@ -1,110 +0,0 @@ -From a30996377bd8b1316cd79ac482b4f9ae9a50c31d Mon Sep 17 00:00:00 2001 -From: Bandan Das -Date: Tue, 3 Dec 2013 20:05:13 +0100 -Subject: vfio: cap number of devices that can be assigned - -RH-Author: Bandan Das -Message-id: <1386101113-31560-3-git-send-email-bsd@redhat.com> -Patchwork-id: 55984 -O-Subject: [PATCH RHEL7 qemu-kvm v2 2/2] vfio: cap number of devices that can be assigned -Bugzilla: 678368 -RH-Acked-by: Alex Williamson -RH-Acked-by: Marcelo Tosatti -RH-Acked-by: Michael S. Tsirkin - -Go through all groups to get count of total number of devices -active to enforce limit - -Reasoning from Alex for the limit(32) - Assuming 3 slots per -device, with 125 slots (number of memory slots for RHEL 7), -we can support almost 40 devices and still have few slots left -for other uses. Stepping down a bit, the number 32 arbitrarily -matches the number of slots on a PCI bus and is also a nice power -of two. - -Count of slots increased to 509 later so we could increase limit -to 64 as some usecases require more than 32 devices. - -Signed-off-by: Bandan Das - -Rebase changes (8.2.0): -- Update to upstream changes ---- - hw/vfio/pci.c | 31 ++++++++++++++++++++++++++++++- - hw/vfio/pci.h | 1 + - 2 files changed, 31 insertions(+), 1 deletion(-) - -diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c -index 2407720c35..82a47edc89 100644 ---- a/hw/vfio/pci.c -+++ b/hw/vfio/pci.c -@@ -50,6 +50,9 @@ - /* Protected by BQL */ - static KVMRouteChange vfio_route_change; - -+/* RHEL only: Set once for the first assigned dev */ -+static uint16_t device_limit; -+ - static void vfio_disable_interrupts(VFIOPCIDevice *vdev); - static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled); - static void vfio_msi_disable_common(VFIOPCIDevice *vdev); -@@ -2963,10 +2966,33 @@ static void vfio_realize(PCIDevice *pdev, Error **errp) - ERRP_GUARD(); - VFIOPCIDevice *vdev = VFIO_PCI(pdev); - VFIODevice *vbasedev = &vdev->vbasedev; -- int i, ret; -+ int ret, i = 0; -+ VFIODevice *vbasedev_iter; -+ VFIOGroup *group; - char uuid[UUID_STR_LEN]; - g_autofree char *name = NULL; - -+ if (device_limit && device_limit != vdev->assigned_device_limit) { -+ error_setg(errp, "Assigned device limit has been redefined. " -+ "Old:%d, New:%d", -+ device_limit, vdev->assigned_device_limit); -+ return; -+ } else { -+ device_limit = vdev->assigned_device_limit; -+ } -+ -+ QLIST_FOREACH(group, &vfio_group_list, next) { -+ QLIST_FOREACH(vbasedev_iter, &group->device_list, next) { -+ i++; -+ } -+ } -+ -+ if (i >= vdev->assigned_device_limit) { -+ error_setg(errp, "Maximum supported vfio devices (%d) " -+ "already attached", vdev->assigned_device_limit); -+ return; -+ } -+ - if (vbasedev->fd < 0 && !vbasedev->sysfsdev) { - if (!(~vdev->host.domain || ~vdev->host.bus || - ~vdev->host.slot || ~vdev->host.function)) { -@@ -3388,6 +3414,9 @@ static Property vfio_pci_dev_properties[] = { - DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false), - DEFINE_PROP_BOOL("x-no-geforce-quirks", VFIOPCIDevice, - no_geforce_quirks, false), -+ /* RHEL only */ -+ DEFINE_PROP_UINT16("x-assigned-device-limit", VFIOPCIDevice, -+ assigned_device_limit, 64), - DEFINE_PROP_BOOL("x-no-kvm-ioeventfd", VFIOPCIDevice, no_kvm_ioeventfd, - false), - DEFINE_PROP_BOOL("x-no-vfio-ioeventfd", VFIOPCIDevice, no_vfio_ioeventfd, -diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h -index bf67df2fbc..0d3c93fb2e 100644 ---- a/hw/vfio/pci.h -+++ b/hw/vfio/pci.h -@@ -142,6 +142,7 @@ struct VFIOPCIDevice { - EventNotifier err_notifier; - EventNotifier req_notifier; - int (*resetfn)(struct VFIOPCIDevice *); -+ uint16_t assigned_device_limit; - uint32_t vendor_id; - uint32_t device_id; - uint32_t sub_vendor_id; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch b/images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch deleted file mode 100644 index a3ef6f66c..000000000 --- a/images/qemu-artifact/patches/0018-Add-support-statement-to-help-output.patch +++ /dev/null @@ -1,55 +0,0 @@ -From d2a73465e69118a37a2bbc487b6faa30c9b5a81f Mon Sep 17 00:00:00 2001 -From: Eduardo Habkost -Date: Wed, 4 Dec 2013 18:53:17 +0100 -Subject: Add support statement to -help output - -RH-Author: Eduardo Habkost -Message-id: <1386183197-27761-1-git-send-email-ehabkost@redhat.com> -Patchwork-id: 55994 -O-Subject: [qemu-kvm RHEL7 PATCH] Add support statement to -help output -Bugzilla: 972773 -RH-Acked-by: Miroslav Rezanina -RH-Acked-by: knoel@redhat.com -RH-Acked-by: Paolo Bonzini - -Add support statement to -help output, reporting direct qemu-kvm usage -as unsupported by Red Hat, and advising users to use libvirt instead. - -Signed-off-by: Eduardo Habkost ---- - system/vl.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/system/vl.c b/system/vl.c -index 01b8b8e77a..5359231bf5 100644 ---- a/system/vl.c -+++ b/system/vl.c -@@ -877,9 +877,17 @@ static void version(void) - QEMU_COPYRIGHT "\n"); - } - -+static void print_rh_warning(void) -+{ -+ printf("\nWARNING: Direct use of qemu-kvm from the command line is not supported by Red Hat.\n" -+ "WARNING: Use libvirt as the stable management interface.\n" -+ "WARNING: Some command line options listed here may not be available in future releases.\n\n"); -+} -+ - static void help(int exitcode) - { - version(); -+ print_rh_warning(); - printf("usage: %s [options] [disk_image]\n\n" - "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n", - g_get_prgname()); -@@ -905,6 +913,7 @@ static void help(int exitcode) - "\n" - QEMU_HELP_BOTTOM "\n"); - -+ print_rh_warning(); - exit(exitcode); - } - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch b/images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch deleted file mode 100644 index 4eb7d299d..000000000 --- a/images/qemu-artifact/patches/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch +++ /dev/null @@ -1,61 +0,0 @@ -From ca0507cfda11a73cb4311fc0b3a934ce8b40c5e9 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina -Date: Wed, 8 Jul 2020 08:35:50 +0200 -Subject: Use qemu-kvm in documentation instead of qemu-system- - -Patchwork-id: 62380 -O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCHv4] Use qemu-kvm in documentation instead of qemu-system-i386 -Bugzilla: 1140620 -RH-Acked-by: Laszlo Ersek -RH-Acked-by: Markus Armbruster -RH-Acked-by: Stefan Hajnoczi - -From: Miroslav Rezanina - -We change the name and location of qemu-kvm binaries. Update documentation -to reflect this change. Only architectures available in RHEL are updated. - -Signed-off-by: Miroslav Rezanina ---- - docs/defs.rst.inc | 4 ++-- - qemu-options.hx | 10 +++++----- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/docs/defs.rst.inc b/docs/defs.rst.inc -index 52d6454b93..d74dbdeca9 100644 ---- a/docs/defs.rst.inc -+++ b/docs/defs.rst.inc -@@ -9,7 +9,7 @@ - but the manpages will end up misrendered with following normal text - incorrectly in boldface. - --.. |qemu_system| replace:: qemu-system-x86_64 --.. |qemu_system_x86| replace:: qemu-system-x86_64 -+.. |qemu_system| replace:: qemu-kvm -+.. |qemu_system_x86| replace:: qemu-kvm - .. |I2C| replace:: I\ :sup:`2`\ C - .. |I2S| replace:: I\ :sup:`2`\ S -diff --git a/qemu-options.hx b/qemu-options.hx -index d94e2cbbae..a7444abc7f 100644 ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -3688,11 +3688,11 @@ SRST - - :: - -- qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ -- -numa node,memdev=mem \ -- -chardev socket,id=chr0,path=/path/to/socket \ -- -netdev type=vhost-user,id=net0,chardev=chr0 \ -- -device virtio-net-pci,netdev=net0 -+ qemu-kvm -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ -+ -numa node,memdev=mem \ -+ -chardev socket,id=chr0,path=/path/to/socket \ -+ -netdev type=vhost-user,id=net0,chardev=chr0 \ -+ -device virtio-net-pci,netdev=net0 - - ``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]`` - Establish a vhost-vdpa netdev. --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch b/images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch deleted file mode 100644 index f1414a2d3..000000000 --- a/images/qemu-artifact/patches/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 3fbdf1e92fe0dbabb59b611dfb3ad906edf80979 Mon Sep 17 00:00:00 2001 -From: Kevin Wolf -Date: Fri, 20 Aug 2021 18:25:12 +0200 -Subject: qcow2: Deprecation warning when opening v2 images rw -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Kevin Wolf -RH-MergeRequest: 37: qcow2: Deprecation warning when opening v2 images rw -RH-Commit: [1/1] f450d0ae32d35063b28c72c4f2d2ebb9e6d8db3e (kmwolf/centos-qemu-kvm) -RH-Bugzilla: 1951814 -RH-Acked-by: Stefan Hajnoczi -RH-Acked-by: Hanna Reitz -RH-Acked-by: Thomas Huth -RH-Acked-by: Philippe Mathieu-Daudé - -qcow2 v3 has been around for a long time (since QEMU 1.1/RHEL 7), so -there is no real reason any more to use it. People still using it might -do so unintentionally. Warn about it and suggest upgrading during the -RHEL 9 timeframe so that the code can possibly be disabled in RHEL 10. - -The warning is restricted to read-write mode and the system emulator. -The primary motivation for not having it in qemu-img is that 'qemu-img -amend' for upgrades would warn otherwise. It also avoids having to make -too many changes to the test suite. - -bdrv_uses_whitelist() is used as a proxy for deciding whether we are -running in a tool or the system emulator. This is not entirely clean, -but it's what is available and the same function qcow2_do_open() already -uses it this way for another warning. - -Signed-off-by: Kevin Wolf - -patch_name: kvm-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch -present_in_specfile: true -location_in_specfile: 116 ---- -Rebase notes (6.1.0): -- Replace bs->read_only with bdrv_is_read_only ---- - block/qcow2.c | 6 ++++++ - tests/qemu-iotests/common.filter | 1 + - 2 files changed, 7 insertions(+) - -diff --git a/block/qcow2.c b/block/qcow2.c -index 70b19730a3..a4cffb628c 100644 ---- a/block/qcow2.c -+++ b/block/qcow2.c -@@ -1358,6 +1358,12 @@ qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, - ret = -ENOTSUP; - goto fail; - } -+ if (header.version < 3 && !bdrv_is_read_only(bs) && bdrv_uses_whitelist()) { -+ warn_report_once("qcow2 v2 images are deprecated and may not be " -+ "supported in future versions. Please consider " -+ "upgrading the image with 'qemu-img amend " -+ "-o compat=v3'."); -+ } - - s->qcow_version = header.version; - -diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter -index fc3c64bcb8..4b238954d5 100644 ---- a/tests/qemu-iotests/common.filter -+++ b/tests/qemu-iotests/common.filter -@@ -83,6 +83,7 @@ _filter_qemu() - { - gsed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \ - -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \ -+ -e "/qcow2 v2 images are deprecated/d" \ - -e $'s#\r##' # QEMU monitor uses \r\n line endings - } - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch b/images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch deleted file mode 100644 index 96578428f..000000000 --- a/images/qemu-artifact/patches/0021-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8c62f120efeedfcdc43fece9f65b4c1b5b0a06e6 Mon Sep 17 00:00:00 2001 -From: Dehan Meng -Date: Wed, 21 Aug 2024 14:55:01 +0800 -Subject: qemu-guest-agent: Update the logfile path of qga-fsfreeze-hook.log - -RH-Author: 6-dehan -RH-MergeRequest: 265: qemu-guest-agent: Update the logfile path of qga-fsfreeze-hook.log -RH-Jira: RHEL-52250 -RH-Acked-by: Konstantin Kostiuk -RH-Acked-by: Miroslav Rezanina -RH-Commit: [1/1] 7c5cfb882dbc277becb7daa2c5d6b8eff3d601b2 (6-dehan/src_centosupstream_qemu-kvm) - -selinux context 'system_u:object_r:virt_qemu_ga_log_t:s0', it -should be changed to '/var/log/qemu-ga/qga-fsfreeze-hook.log'. And -it's worth to mention that this is RHEL-only change for matching -existing SELinux boolean and policy. - -Jira: https://issues.redhat.com/browse/RHEL-52250 -Signed-off-by: Dehan Meng - -Patch-name: kvm-qemu-guest-agent-Update-the-logfile-path-of-qga-fsfr.patch -Patch-id: 137 -Patch-present-in-specfile: True ---- - scripts/qemu-guest-agent/fsfreeze-hook | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook -index e9b84ec028..70536ba3e3 100755 ---- a/scripts/qemu-guest-agent/fsfreeze-hook -+++ b/scripts/qemu-guest-agent/fsfreeze-hook -@@ -7,7 +7,7 @@ - # "freeze" argument before the filesystem is frozen. And for fsfreeze-thaw - # request, it is issued with "thaw" argument after filesystem is thawed. - --LOGFILE=/var/log/qga-fsfreeze-hook.log -+LOGFILE=/var/log/qemu-ga/qga-fsfreeze-hook.log - FSFREEZE_D=$(dirname -- "$(realpath $0)")/fsfreeze-hook.d - - # Check whether file $1 is a backup or rpm-generated file and should be ignored --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch b/images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch deleted file mode 100644 index 8d7587458..000000000 --- a/images/qemu-artifact/patches/0023-Add-upstream-compatibility-bits.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 2b6f52a948d4ee1bbaadec56151a6c30782693a2 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina -Date: Wed, 15 May 2024 01:41:13 -0400 -Subject: Add upstream compatibility bits - ---- - hw/arm/virt.c | 1 + - hw/core/machine.c | 17 +++++++++++++++++ - hw/i386/pc_piix.c | 2 ++ - hw/i386/pc_q35.c | 2 ++ - hw/s390x/s390-virtio-ccw.c | 1 + - include/hw/boards.h | 3 +++ - 6 files changed, 26 insertions(+) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 903c0f2e9f..3c776b5011 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -3582,6 +3582,7 @@ DEFINE_VIRT_MACHINE(2, 6) - - static void virt_rhel_machine_9_4_0_options(MachineClass *mc) - { -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); - compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); - } - DEFINE_VIRT_MACHINE_AS_LATEST(9, 4, 0) -diff --git a/hw/core/machine.c b/hw/core/machine.c -index f7fed78e4b..add42660f8 100644 ---- a/hw/core/machine.c -+++ b/hw/core/machine.c -@@ -311,6 +311,23 @@ const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); - const char *rhel_old_machine_deprecation = - "machine types for previous major releases are deprecated"; - -+GlobalProperty hw_compat_rhel_9_6[] = { -+ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ -+ {"arm-cpu", "backcompat-cntfrq", "true" }, -+ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ -+ { "scsi-hd", "migrate-emulated-scsi-request", "false" }, -+ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ -+ { "scsi-cd", "migrate-emulated-scsi-request", "false" }, -+ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ -+ {"vfio-pci", "skip-vsc-check", "false" }, -+ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ -+ { "virtio-pci", "x-pcie-pm-no-soft-reset", "off" }, -+ /* hw_compat_rhel_9_6 from hw_compat_9_0 */ -+ {"sd-card", "spec_version", "2" }, -+}; -+const size_t hw_compat_rhel_9_6_len = G_N_ELEMENTS(hw_compat_rhel_9_6); -+ -+ - GlobalProperty hw_compat_rhel_9_5[] = { - /* hw_compat_rhel_9_5 from hw_compat_8_2 */ - { "migration", "zero-page-detection", "legacy"}, -diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c -index c93e78e896..80323cc08c 100644 ---- a/hw/i386/pc_piix.c -+++ b/hw/i386/pc_piix.c -@@ -880,6 +880,8 @@ static void pc_i440fx_rhel_machine_7_6_0_options(MachineClass *m) - object_class_property_set_description(oc, "x-south-bridge", - "Use a different south bridge than PIIX3"); - -+ compat_props_add(m->compat_props, hw_compat_rhel_9_6, -+ hw_compat_rhel_9_6_len); - compat_props_add(m->compat_props, pc_rhel_9_5_compat, - pc_rhel_9_5_compat_len); - compat_props_add(m->compat_props, hw_compat_rhel_9_5, -diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c -index 76f0ac1acd..4580b2266e 100644 ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -681,6 +681,8 @@ static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) - pcmc->smbios_stream_version = "9.4.0"; - pcmc->isa_bios_alias = false; - -+ compat_props_add(m->compat_props, hw_compat_rhel_9_6, -+ hw_compat_rhel_9_6_len); - compat_props_add(m->compat_props, pc_rhel_9_5_compat, - pc_rhel_9_5_compat_len); - compat_props_add(m->compat_props, hw_compat_rhel_9_5, -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index 72e1279db9..f884528639 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -1314,6 +1314,7 @@ static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) - - static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) - { -+ compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); - compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); - } - DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); -diff --git a/include/hw/boards.h b/include/hw/boards.h -index 85b43e3d0d..ffefc0a625 100644 ---- a/include/hw/boards.h -+++ b/include/hw/boards.h -@@ -802,6 +802,9 @@ extern const size_t hw_compat_2_2_len; - extern GlobalProperty hw_compat_2_1[]; - extern const size_t hw_compat_2_1_len; - -+extern GlobalProperty hw_compat_rhel_9_6[]; -+extern const size_t hw_compat_rhel_9_6_len; -+ - extern GlobalProperty hw_compat_rhel_9_5[]; - extern const size_t hw_compat_rhel_9_5_len; - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch b/images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch deleted file mode 100644 index 1f2c7961e..000000000 --- a/images/qemu-artifact/patches/0024-redhat-Add-QEMU-9.1-compat-handling-to-the-s390x-mac.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 492900c0b6a99f157249c2706c2f2ef5f67d20df Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Mon, 26 Aug 2024 14:27:49 +0200 -Subject: redhat: Add QEMU 9.1 compat handling to the s390x machine types - -JIRA: https://issues.redhat.com/browse/RHEL-52323 - -Upstream changed the amount of information that is migrated for -the S390 interrupt controller (FLIC), so we have to switch on -a compatibility property for older machine types. - -Signed-off-by: Thomas Huth ---- - hw/s390x/s390-virtio-ccw.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index f884528639..4b7290f7a8 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -1314,8 +1314,13 @@ static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) - - static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) - { -+ static GlobalProperty compat[] = { -+ { TYPE_QEMU_S390_FLIC, "migrate-all-state", "off", }, -+ }; -+ - compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); - compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); -+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); - } - DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch b/images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch deleted file mode 100644 index abaa414c3..000000000 --- a/images/qemu-artifact/patches/0025-redhat-Add-rhel9.6.0-machine-type.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 1ceaf6413ec7cb19ea2b6147ec91c776c7c5df40 Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Mon, 26 Aug 2024 14:42:24 +0200 -Subject: redhat: Add rhel9.6.0 machine type - -JIRA: https://issues.redhat.com/browse/RHEL-52323 - -Add a new machine type to enable the latest features by default. - -Signed-off-by: Thomas Huth ---- - hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index 4b7290f7a8..a4a6ffa053 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -1308,8 +1308,18 @@ DEFINE_CCW_MACHINE(2, 4); - #endif - #endif /* disabled for RHEL */ - -+static void ccw_rhel_machine_9_6_0_instance_options(MachineState *machine) -+{ -+} -+ -+static void ccw_rhel_machine_9_6_0_class_options(MachineClass *mc) -+{ -+} -+DEFINE_CCW_MACHINE_AS_LATEST(9, 6, 0); -+ - static void ccw_rhel_machine_9_4_0_instance_options(MachineState *machine) - { -+ ccw_rhel_machine_9_6_0_instance_options(machine); - } - - static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) -@@ -1318,11 +1328,13 @@ static void ccw_rhel_machine_9_4_0_class_options(MachineClass *mc) - { TYPE_QEMU_S390_FLIC, "migrate-all-state", "off", }, - }; - -+ ccw_rhel_machine_9_6_0_class_options(mc); -+ - compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); - compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); - } --DEFINE_CCW_MACHINE_AS_LATEST(9, 4, 0); -+DEFINE_CCW_MACHINE(9, 4, 0); - - static void ccw_rhel_machine_9_2_0_instance_options(MachineState *machine) - { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch b/images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch deleted file mode 100644 index e6f14b89b..000000000 --- a/images/qemu-artifact/patches/0026-x86-ensure-compatibility-of-pc-q35-rhel9-and-pc-i440.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f35f400c9255be5fbb0158c6885a96ef23e7fb86 Mon Sep 17 00:00:00 2001 -From: Sebastian Ott -Date: Thu, 5 Sep 2024 12:54:34 +0200 -Subject: x86: ensure compatibility of pc-q35-rhel9* and pc-i440fx-rhel7.6.0 - -Signed-off-by: Sebastian Ott ---- - hw/i386/pc_piix.c | 3 +++ - hw/i386/pc_q35.c | 3 +++ - 2 files changed, 6 insertions(+) - -diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c -index 80323cc08c..656abb5d39 100644 ---- a/hw/i386/pc_piix.c -+++ b/hw/i386/pc_piix.c -@@ -872,6 +872,9 @@ static void pc_i440fx_rhel_machine_7_6_0_options(MachineClass *m) - pcmc->broken_32bit_mem_addr_check = true; - /* Introduced in QEMU 8.2 */ - pcmc->default_south_bridge = TYPE_PIIX3_DEVICE; -+ /* From pc_i440fx_machine_9_0_options() */ -+ m->smbios_memory_device_size = 16 * GiB; -+ pcmc->isa_bios_alias = false; - - object_class_property_add_enum(oc, "x-south-bridge", "PCSouthBridgeOption", - &PCSouthBridgeOption_lookup, -diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c -index 4580b2266e..5cfed8b62f 100644 ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -679,7 +679,10 @@ static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) - m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; - pcmc->smbios_stream_product = "RHEL"; - pcmc->smbios_stream_version = "9.4.0"; -+ -+ /* From pc_q35_machine_9_0_options() */ - pcmc->isa_bios_alias = false; -+ m->smbios_memory_device_size = 16 * GiB; - - compat_props_add(m->compat_props, hw_compat_rhel_9_6, - hw_compat_rhel_9_6_len); --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch b/images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch deleted file mode 100644 index 2e09fa2a8..000000000 --- a/images/qemu-artifact/patches/0027-arm-ensure-compatibility-of-virt-rhel9.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 9c65a3e2e15c96b3b74d7c7846dbd60b13474370 Mon Sep 17 00:00:00 2001 -From: Sebastian Ott -Date: Thu, 5 Sep 2024 13:02:32 +0200 -Subject: arm: ensure compatibility of virt-rhel9* - -Signed-off-by: Sebastian Ott ---- - hw/arm/virt.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 3c776b5011..1af1c9e170 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -3582,6 +3582,9 @@ DEFINE_VIRT_MACHINE(2, 6) - - static void virt_rhel_machine_9_4_0_options(MachineClass *mc) - { -+ /* From virt_machine_9_0_options() */ -+ mc->smbios_memory_device_size = 16 * GiB; -+ - compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); - compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); - } --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch b/images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch deleted file mode 100644 index ff63e0ada..000000000 --- a/images/qemu-artifact/patches/0028-arm-create-new-virt-machine-type-for-rhel-9.6.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 005be8f390c038ab9674103e1644dc1549c434a9 Mon Sep 17 00:00:00 2001 -From: Sebastian Ott -Date: Thu, 5 Sep 2024 13:11:23 +0200 -Subject: arm: create new virt machine type for rhel 9.6 - -Signed-off-by: Sebastian Ott ---- - hw/arm/virt.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index 1af1c9e170..bf05499a12 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -3580,15 +3580,22 @@ static void virt_machine_2_6_options(MachineClass *mc) - DEFINE_VIRT_MACHINE(2, 6) - #endif /* disabled for RHEL */ - -+static void virt_rhel_machine_9_6_0_options(MachineClass *mc) -+{ -+} -+DEFINE_VIRT_MACHINE_AS_LATEST(9, 6, 0) -+ - static void virt_rhel_machine_9_4_0_options(MachineClass *mc) - { -+ virt_rhel_machine_9_6_0_options(mc); -+ - /* From virt_machine_9_0_options() */ - mc->smbios_memory_device_size = 16 * GiB; - - compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); - compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); - } --DEFINE_VIRT_MACHINE_AS_LATEST(9, 4, 0) -+DEFINE_VIRT_MACHINE(9, 4, 0) - - static void virt_rhel_machine_9_2_0_options(MachineClass *mc) - { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch b/images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch deleted file mode 100644 index e118d8eef..000000000 --- a/images/qemu-artifact/patches/0029-x86-create-new-pc-q35-machine-type-for-rhel-9.6.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 826f14b90a0ad2427e4e80232c0fbaea80600650 Mon Sep 17 00:00:00 2001 -From: Sebastian Ott -Date: Thu, 5 Sep 2024 13:31:12 +0200 -Subject: x86: create new pc-q35 machine type for rhel 9.6 - -Signed-off-by: Sebastian Ott ---- - hw/i386/pc_q35.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c -index 5cfed8b62f..7606007bda 100644 ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -672,11 +672,23 @@ DEFINE_Q35_MACHINE(2, 4); - - /* Red Hat Enterprise Linux machine types */ - --static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) -+static void pc_q35_rhel_machine_9_6_0_options(MachineClass *m) - { - PCMachineClass *pcmc = PC_MACHINE_CLASS(m); - pc_q35_machine_options(m); -+ m->desc = "RHEL-9.6.0 PC (Q35 + ICH9, 2009)"; -+ pcmc->smbios_stream_product = "RHEL"; -+ pcmc->smbios_stream_version = "9.6.0"; -+} -+ -+DEFINE_Q35_MACHINE_BUGFIX(9, 6, 0); -+ -+static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) -+{ -+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m); -+ pc_q35_rhel_machine_9_6_0_options(m); - m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; -+ m->alias = NULL; - pcmc->smbios_stream_product = "RHEL"; - pcmc->smbios_stream_version = "9.4.0"; - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch b/images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch deleted file mode 100644 index 141944575..000000000 --- a/images/qemu-artifact/patches/0030-hw-arm-virt-Fix-Manufacturer-and-Product-Name-in-emu.patch +++ /dev/null @@ -1,90 +0,0 @@ -From d6a415e7a62ca1bc21f1833f4251f512b2072a93 Mon Sep 17 00:00:00 2001 -From: Shaoqin Huang -Date: Wed, 22 May 2024 03:23:28 -0400 -Subject: hw/arm/virt: Fix Manufacturer and Product Name in emulated SMBIOS - mode - -Status: RHEL-only - -In vm, when run 'dmidecode -t system', it outputs different Manufacturer -and Product Name on x86_64 and aarch64 system. For example: - -For aarch64 vm: - Manufacturer: QEMU - Product Name: KVM Virtual Machine - -For x86_64 vm: - Manufacturer: Red Hat - Product Name: KVM - -Fixing this issue by changing Manufacturer to 'Red Hat' and Product -Name to 'KVM' on aarch64 platform. Thus the output is aligned on both -x86_64 and aarch64 platform. - -To keep the compatability, this only apply for the RHEL9.6 machine -type. For RHEL9.4 machine type, it still keep the old Manufacturer and -Product Name. - -Signed-off-by: Shaoqin Huang ---- - hw/arm/virt.c | 14 ++++++++++++-- - include/hw/arm/virt.h | 1 + - 2 files changed, 13 insertions(+), 2 deletions(-) - -diff --git a/hw/arm/virt.c b/hw/arm/virt.c -index bf05499a12..c50bff2a6c 100644 ---- a/hw/arm/virt.c -+++ b/hw/arm/virt.c -@@ -1711,14 +1711,21 @@ static void virt_build_smbios(VirtMachineState *vms) - uint8_t *smbios_tables, *smbios_anchor; - size_t smbios_tables_len, smbios_anchor_len; - struct smbios_phys_mem_area mem_array; -+ const char *manufacturer = "QEMU"; - const char *product = "QEMU Virtual Machine"; -+ const char *version = vmc->smbios_old_sys_ver ? "1.0" : mc->name; - - if (kvm_enabled()) { - product = "KVM Virtual Machine"; - } - -- smbios_set_defaults("QEMU", product, -- vmc->smbios_old_sys_ver ? "1.0" : mc->name, -+ if (!vmc->manufacturer_product_compat) { -+ manufacturer = "Red Hat"; -+ product = "KVM"; -+ version = mc->desc; -+ } -+ -+ smbios_set_defaults(manufacturer, product, version, - NULL, NULL); - - /* build the array of physical mem area from base_memmap */ -@@ -3587,10 +3594,13 @@ DEFINE_VIRT_MACHINE_AS_LATEST(9, 6, 0) - - static void virt_rhel_machine_9_4_0_options(MachineClass *mc) - { -+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); -+ - virt_rhel_machine_9_6_0_options(mc); - - /* From virt_machine_9_0_options() */ - mc->smbios_memory_device_size = 16 * GiB; -+ vmc->manufacturer_product_compat = true; - - compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); - compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); -diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h -index a4d937ed45..2fc30a7626 100644 ---- a/include/hw/arm/virt.h -+++ b/include/hw/arm/virt.h -@@ -134,6 +134,7 @@ struct VirtMachineClass { - bool no_cpu_topology; - bool no_tcg_lpa2; - bool no_ns_el2_virt_timer_irq; -+ bool manufacturer_product_compat; - }; - - struct VirtMachineState { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch b/images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch deleted file mode 100644 index 2670a2317..000000000 --- a/images/qemu-artifact/patches/kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch +++ /dev/null @@ -1,49 +0,0 @@ -From f9dfed0e5fd03ee6fa7364801db7d101bf085a79 Mon Sep 17 00:00:00 2001 -From: Peter Xu -Date: Tue, 17 Sep 2024 12:38:33 -0400 -Subject: [PATCH 6/9] KVM: Define KVM_MEMSLOTS_NUM_MAX_DEFAULT - -RH-Author: Peter Xu -RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array -RH-Jira: RHEL-57682 -RH-Acked-by: Juraj Marcin -RH-Commit: [5/7] c95bdaa406e76b943882fd75c4d345ca5fc397d4 (peterx/qemu-kvm) - -Make the default max nr_slots a macro, it's only used when KVM reports -nothing. - -Reviewed-by: David Hildenbrand -Signed-off-by: Peter Xu -Link: https://lore.kernel.org/r/20240917163835.194664-3-peterx@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit b34a908c8f24eedb0a8e5ff486b059b58fd793f4) -Signed-off-by: Peter Xu ---- - accel/kvm/kvm-all.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index 44bf4180fa..3900de8883 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -71,6 +71,8 @@ - - /* Default num of memslots to be allocated when VM starts */ - #define KVM_MEMSLOTS_NR_ALLOC_DEFAULT 16 -+/* Default max allowed memslots if kernel reported nothing */ -+#define KVM_MEMSLOTS_NR_MAX_DEFAULT 32 - - struct KVMParkedVcpu { - unsigned long vcpu_id; -@@ -2617,7 +2619,7 @@ static int kvm_init(MachineState *ms) - - /* If unspecified, use the default value */ - if (!s->nr_slots) { -- s->nr_slots = 32; -+ s->nr_slots_max = KVM_MEMSLOTS_NR_MAX_DEFAULT; - } - - s->nr_as = kvm_check_extension(s, KVM_CAP_MULTI_ADDRESS_SPACE); --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch b/images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch deleted file mode 100644 index f3f052261..000000000 --- a/images/qemu-artifact/patches/kvm-KVM-Dynamic-sized-kvm-memslots-array.patch +++ /dev/null @@ -1,250 +0,0 @@ -From 9813dc1d19a6afedbab382b79e72691190e42fcf Mon Sep 17 00:00:00 2001 -From: Peter Xu -Date: Tue, 17 Sep 2024 12:38:32 -0400 -Subject: [PATCH 5/9] KVM: Dynamic sized kvm memslots array - -RH-Author: Peter Xu -RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array -RH-Jira: RHEL-57682 -RH-Acked-by: Juraj Marcin -RH-Commit: [4/7] 04d74707873b28a50b1e1bc08e4788c79455518c (peterx/qemu-kvm) - -Zhiyi reported an infinite loop issue in VFIO use case. The cause of that -was a separate discussion, however during that I found a regression of -dirty sync slowness when profiling. - -Each KVMMemoryListerner maintains an array of kvm memslots. Currently it's -statically allocated to be the max supported by the kernel. However after -Linux commit 4fc096a99e ("KVM: Raise the maximum number of user memslots"), -the max supported memslots reported now grows to some number large enough -so that it may not be wise to always statically allocate with the max -reported. - -What's worse, QEMU kvm code still walks all the allocated memslots entries -to do any form of lookups. It can drastically slow down all memslot -operations because each of such loop can run over 32K times on the new -kernels. - -Fix this issue by making the memslots to be allocated dynamically. - -Here the initial size was set to 16 because it should cover the basic VM -usages, so that the hope is the majority VM use case may not even need to -grow at all (e.g. if one starts a VM with ./qemu-system-x86_64 by default -it'll consume 9 memslots), however not too large to waste memory. - -There can also be even better way to address this, but so far this is the -simplest and should be already better even than before we grow the max -supported memslots. For example, in the case of above issue when VFIO was -attached on a 32GB system, there are only ~10 memslots used. So it could -be good enough as of now. - -In the above VFIO context, measurement shows that the precopy dirty sync -shrinked from ~86ms to ~3ms after this patch applied. It should also apply -to any KVM enabled VM even without VFIO. - -NOTE: we don't have a FIXES tag for this patch because there's no real -commit that regressed this in QEMU. Such behavior existed for a long time, -but only start to be a problem when the kernel reports very large -nr_slots_max value. However that's pretty common now (the kernel change -was merged in 2021) so we attached cc:stable because we'll want this change -to be backported to stable branches. - -Cc: qemu-stable -Reported-by: Zhiyi Guo -Tested-by: Zhiyi Guo -Signed-off-by: Peter Xu -Acked-by: David Hildenbrand -Reviewed-by: Fabiano Rosas -Link: https://lore.kernel.org/r/20240917163835.194664-2-peterx@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit 5504a8126115d173687b37e657312a8ffe29fc0c) -Signed-off-by: Peter Xu ---- - accel/kvm/kvm-all.c | 87 +++++++++++++++++++++++++++++++++------- - accel/kvm/trace-events | 1 + - include/sysemu/kvm_int.h | 1 + - 3 files changed, 74 insertions(+), 15 deletions(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index de709fbc43..44bf4180fa 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -69,6 +69,9 @@ - #define KVM_GUESTDBG_BLOCKIRQ 0 - #endif - -+/* Default num of memslots to be allocated when VM starts */ -+#define KVM_MEMSLOTS_NR_ALLOC_DEFAULT 16 -+ - struct KVMParkedVcpu { - unsigned long vcpu_id; - int kvm_fd; -@@ -165,6 +168,57 @@ void kvm_resample_fd_notify(int gsi) - } - } - -+/** -+ * kvm_slots_grow(): Grow the slots[] array in the KVMMemoryListener -+ * -+ * @kml: The KVMMemoryListener* to grow the slots[] array -+ * @nr_slots_new: The new size of slots[] array -+ * -+ * Returns: True if the array grows larger, false otherwise. -+ */ -+static bool kvm_slots_grow(KVMMemoryListener *kml, unsigned int nr_slots_new) -+{ -+ unsigned int i, cur = kml->nr_slots_allocated; -+ KVMSlot *slots; -+ -+ if (nr_slots_new > kvm_state->nr_slots) { -+ nr_slots_new = kvm_state->nr_slots; -+ } -+ -+ if (cur >= nr_slots_new) { -+ /* Big enough, no need to grow, or we reached max */ -+ return false; -+ } -+ -+ if (cur == 0) { -+ slots = g_new0(KVMSlot, nr_slots_new); -+ } else { -+ assert(kml->slots); -+ slots = g_renew(KVMSlot, kml->slots, nr_slots_new); -+ /* -+ * g_renew() doesn't initialize extended buffers, however kvm -+ * memslots require fields to be zero-initialized. E.g. pointers, -+ * memory_size field, etc. -+ */ -+ memset(&slots[cur], 0x0, sizeof(slots[0]) * (nr_slots_new - cur)); -+ } -+ -+ for (i = cur; i < nr_slots_new; i++) { -+ slots[i].slot = i; -+ } -+ -+ kml->slots = slots; -+ kml->nr_slots_allocated = nr_slots_new; -+ trace_kvm_slots_grow(cur, nr_slots_new); -+ -+ return true; -+} -+ -+static bool kvm_slots_double(KVMMemoryListener *kml) -+{ -+ return kvm_slots_grow(kml, kml->nr_slots_allocated * 2); -+} -+ - unsigned int kvm_get_max_memslots(void) - { - KVMState *s = KVM_STATE(current_accel()); -@@ -193,15 +247,26 @@ unsigned int kvm_get_free_memslots(void) - /* Called with KVMMemoryListener.slots_lock held */ - static KVMSlot *kvm_get_free_slot(KVMMemoryListener *kml) - { -- KVMState *s = kvm_state; -+ unsigned int n; - int i; - -- for (i = 0; i < s->nr_slots; i++) { -+ for (i = 0; i < kml->nr_slots_allocated; i++) { - if (kml->slots[i].memory_size == 0) { - return &kml->slots[i]; - } - } - -+ /* -+ * If no free slots, try to grow first by doubling. Cache the old size -+ * here to avoid another round of search: if the grow succeeded, it -+ * means slots[] now must have the existing "n" slots occupied, -+ * followed by one or more free slots starting from slots[n]. -+ */ -+ n = kml->nr_slots_allocated; -+ if (kvm_slots_double(kml)) { -+ return &kml->slots[n]; -+ } -+ - return NULL; - } - -@@ -222,10 +287,9 @@ static KVMSlot *kvm_lookup_matching_slot(KVMMemoryListener *kml, - hwaddr start_addr, - hwaddr size) - { -- KVMState *s = kvm_state; - int i; - -- for (i = 0; i < s->nr_slots; i++) { -+ for (i = 0; i < kml->nr_slots_allocated; i++) { - KVMSlot *mem = &kml->slots[i]; - - if (start_addr == mem->start_addr && size == mem->memory_size) { -@@ -267,7 +331,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram, - int i, ret = 0; - - kvm_slots_lock(); -- for (i = 0; i < s->nr_slots; i++) { -+ for (i = 0; i < kml->nr_slots_allocated; i++) { - KVMSlot *mem = &kml->slots[i]; - - if (ram >= mem->ram && ram < mem->ram + mem->memory_size) { -@@ -1071,7 +1135,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml, - - kvm_slots_lock(); - -- for (i = 0; i < s->nr_slots; i++) { -+ for (i = 0; i < kml->nr_slots_allocated; i++) { - mem = &kml->slots[i]; - /* Discard slots that are empty or do not overlap the section */ - if (!mem->memory_size || -@@ -1719,12 +1783,8 @@ static void kvm_log_sync_global(MemoryListener *l, bool last_stage) - /* Flush all kernel dirty addresses into KVMSlot dirty bitmap */ - kvm_dirty_ring_flush(); - -- /* -- * TODO: make this faster when nr_slots is big while there are -- * only a few used slots (small VMs). -- */ - kvm_slots_lock(); -- for (i = 0; i < s->nr_slots; i++) { -+ for (i = 0; i < kml->nr_slots_allocated; i++) { - mem = &kml->slots[i]; - if (mem->memory_size && mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { - kvm_slot_sync_dirty_pages(mem); -@@ -1839,12 +1899,9 @@ void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml, - { - int i; - -- kml->slots = g_new0(KVMSlot, s->nr_slots); - kml->as_id = as_id; - -- for (i = 0; i < s->nr_slots; i++) { -- kml->slots[i].slot = i; -- } -+ kvm_slots_grow(kml, KVM_MEMSLOTS_NR_ALLOC_DEFAULT); - - QSIMPLEQ_INIT(&kml->transaction_add); - QSIMPLEQ_INIT(&kml->transaction_del); -diff --git a/accel/kvm/trace-events b/accel/kvm/trace-events -index 37626c1ac5..ad2ae6fca5 100644 ---- a/accel/kvm/trace-events -+++ b/accel/kvm/trace-events -@@ -36,3 +36,4 @@ kvm_io_window_exit(void) "" - kvm_run_exit_system_event(int cpu_index, uint32_t event_type) "cpu_index %d, system_even_type %"PRIu32 - kvm_convert_memory(uint64_t start, uint64_t size, const char *msg) "start 0x%" PRIx64 " size 0x%" PRIx64 " %s" - kvm_memory_fault(uint64_t start, uint64_t size, uint64_t flags) "start 0x%" PRIx64 " size 0x%" PRIx64 " flags 0x%" PRIx64 -+kvm_slots_grow(unsigned int old, unsigned int new) "%u -> %u" -diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h -index 1d8fb1473b..48e496b3d4 100644 ---- a/include/sysemu/kvm_int.h -+++ b/include/sysemu/kvm_int.h -@@ -46,6 +46,7 @@ typedef struct KVMMemoryListener { - MemoryListener listener; - KVMSlot *slots; - unsigned int nr_used_slots; -+ unsigned int nr_slots_allocated; - int as_id; - QSIMPLEQ_HEAD(, KVMMemoryUpdate) transaction_add; - QSIMPLEQ_HEAD(, KVMMemoryUpdate) transaction_del; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch b/images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch deleted file mode 100644 index 299831829..000000000 --- a/images/qemu-artifact/patches/kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 6c0a0d9734c507af2c84aa33eb1624f35e1f51fb Mon Sep 17 00:00:00 2001 -From: Peter Xu -Date: Tue, 17 Sep 2024 12:38:34 -0400 -Subject: [PATCH 7/9] KVM: Rename KVMMemoryListener.nr_used_slots to - nr_slots_used - -RH-Author: Peter Xu -RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array -RH-Jira: RHEL-57682 -RH-Acked-by: Juraj Marcin -RH-Commit: [6/7] 74e9576751e0adeb8113a5e8e495b4b1285b0d76 (peterx/qemu-kvm) - -This will make all nr_slots counters to be named in the same manner. - -Reviewed-by: David Hildenbrand -Signed-off-by: Peter Xu -Link: https://lore.kernel.org/r/20240917163835.194664-4-peterx@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit dbdc00ba5b136bba80d850f61cc79a9cafaae1cd) -Signed-off-by: Peter Xu ---- - accel/kvm/kvm-all.c | 6 +++--- - include/sysemu/kvm_int.h | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index 3900de8883..e414d015c9 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -239,7 +239,7 @@ unsigned int kvm_get_free_memslots(void) - if (!s->as[i].ml) { - continue; - } -- used_slots = MAX(used_slots, s->as[i].ml->nr_used_slots); -+ used_slots = MAX(used_slots, s->as[i].ml->nr_slots_used); - } - kvm_slots_unlock(); - -@@ -1516,7 +1516,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, - } - start_addr += slot_size; - size -= slot_size; -- kml->nr_used_slots--; -+ kml->nr_slots_used--; - } while (size); - return; - } -@@ -1555,7 +1555,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, - ram_start_offset += slot_size; - ram += slot_size; - size -= slot_size; -- kml->nr_used_slots++; -+ kml->nr_slots_used++; - } while (size); - } - -diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h -index 48e496b3d4..b705dfc9b4 100644 ---- a/include/sysemu/kvm_int.h -+++ b/include/sysemu/kvm_int.h -@@ -45,7 +45,7 @@ typedef struct KVMMemoryUpdate { - typedef struct KVMMemoryListener { - MemoryListener listener; - KVMSlot *slots; -- unsigned int nr_used_slots; -+ unsigned int nr_slots_used; - unsigned int nr_slots_allocated; - int as_id; - QSIMPLEQ_HEAD(, KVMMemoryUpdate) transaction_add; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch b/images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch deleted file mode 100644 index 1787c16a8..000000000 --- a/images/qemu-artifact/patches/kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 5b731abd3a932fe9a21f83f3849a3b3769906e19 Mon Sep 17 00:00:00 2001 -From: Peter Xu -Date: Tue, 17 Sep 2024 12:38:35 -0400 -Subject: [PATCH 8/9] KVM: Rename KVMState->nr_slots to nr_slots_max - -RH-Author: Peter Xu -RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array -RH-Jira: RHEL-57682 -RH-Acked-by: Juraj Marcin -RH-Commit: [7/7] 43471483e7380119ba6415bff6d8ee6c69aa9cd7 (peterx/qemu-kvm) - -This value used to reflect the maximum supported memslots from KVM kernel. -Rename it to be clearer. - -Reviewed-by: David Hildenbrand -Signed-off-by: Peter Xu -Link: https://lore.kernel.org/r/20240917163835.194664-5-peterx@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit 943c742868c739c0b14fd996bad3adf744156fec) -Signed-off-by: Peter Xu ---- - accel/kvm/kvm-all.c | 12 ++++++------ - include/sysemu/kvm_int.h | 4 ++-- - 2 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index e414d015c9..49dedda47e 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -183,8 +183,8 @@ static bool kvm_slots_grow(KVMMemoryListener *kml, unsigned int nr_slots_new) - unsigned int i, cur = kml->nr_slots_allocated; - KVMSlot *slots; - -- if (nr_slots_new > kvm_state->nr_slots) { -- nr_slots_new = kvm_state->nr_slots; -+ if (nr_slots_new > kvm_state->nr_slots_max) { -+ nr_slots_new = kvm_state->nr_slots_max; - } - - if (cur >= nr_slots_new) { -@@ -225,7 +225,7 @@ unsigned int kvm_get_max_memslots(void) - { - KVMState *s = KVM_STATE(current_accel()); - -- return s->nr_slots; -+ return s->nr_slots_max; - } - - unsigned int kvm_get_free_memslots(void) -@@ -243,7 +243,7 @@ unsigned int kvm_get_free_memslots(void) - } - kvm_slots_unlock(); - -- return s->nr_slots - used_slots; -+ return s->nr_slots_max - used_slots; - } - - /* Called with KVMMemoryListener.slots_lock held */ -@@ -2615,10 +2615,10 @@ static int kvm_init(MachineState *ms) - (kvm_supported_memory_attributes & KVM_MEMORY_ATTRIBUTE_PRIVATE); - - kvm_immediate_exit = kvm_check_extension(s, KVM_CAP_IMMEDIATE_EXIT); -- s->nr_slots = kvm_check_extension(s, KVM_CAP_NR_MEMSLOTS); -+ s->nr_slots_max = kvm_check_extension(s, KVM_CAP_NR_MEMSLOTS); - - /* If unspecified, use the default value */ -- if (!s->nr_slots) { -+ if (!s->nr_slots_max) { - s->nr_slots_max = KVM_MEMSLOTS_NR_MAX_DEFAULT; - } - -diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h -index b705dfc9b4..2c57194b6b 100644 ---- a/include/sysemu/kvm_int.h -+++ b/include/sysemu/kvm_int.h -@@ -103,8 +103,8 @@ struct KVMDirtyRingReaper { - struct KVMState - { - AccelState parent_obj; -- -- int nr_slots; -+ /* Max number of KVM slots supported */ -+ int nr_slots_max; - int fd; - int vmfd; - int coalesced_mmio; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch b/images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch deleted file mode 100644 index ec064f582..000000000 --- a/images/qemu-artifact/patches/kvm-accel-kvm-refactor-dirty-ring-setup.patch +++ /dev/null @@ -1,143 +0,0 @@ -From e27a9d1e5194243084efe4405fe50463442f0fe3 Mon Sep 17 00:00:00 2001 -From: Ani Sinha -Date: Thu, 12 Sep 2024 11:48:38 +0530 -Subject: [PATCH 4/9] accel/kvm: refactor dirty ring setup - -RH-Author: Peter Xu -RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array -RH-Jira: RHEL-57682 -RH-Acked-by: Juraj Marcin -RH-Commit: [3/7] 226ae9826237887fc55f75b9175524f12b4fa4a9 (peterx/qemu-kvm) - -Refactor setting up of dirty ring code in kvm_init() so that is can be -reused in the future patchsets. - -Signed-off-by: Ani Sinha -Link: https://lore.kernel.org/r/20240912061838.4501-1-anisinha@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit 28ed7f9761eb273e7dedcfdc0507d158106d0451) -Signed-off-by: Peter Xu ---- - accel/kvm/kvm-all.c | 88 +++++++++++++++++++++++++-------------------- - 1 file changed, 50 insertions(+), 38 deletions(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index 4f96d8b45e..de709fbc43 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -2439,6 +2439,55 @@ static int find_kvm_machine_type(MachineState *ms) - return type; - } - -+static int kvm_setup_dirty_ring(KVMState *s) -+{ -+ uint64_t dirty_log_manual_caps; -+ int ret; -+ -+ /* -+ * Enable KVM dirty ring if supported, otherwise fall back to -+ * dirty logging mode -+ */ -+ ret = kvm_dirty_ring_init(s); -+ if (ret < 0) { -+ return ret; -+ } -+ -+ /* -+ * KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is not needed when dirty ring is -+ * enabled. More importantly, KVM_DIRTY_LOG_INITIALLY_SET will assume no -+ * page is wr-protected initially, which is against how kvm dirty ring is -+ * usage - kvm dirty ring requires all pages are wr-protected at the very -+ * beginning. Enabling this feature for dirty ring causes data corruption. -+ * -+ * TODO: Without KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 and kvm clear dirty log, -+ * we may expect a higher stall time when starting the migration. In the -+ * future we can enable KVM_CLEAR_DIRTY_LOG to work with dirty ring too: -+ * instead of clearing dirty bit, it can be a way to explicitly wr-protect -+ * guest pages. -+ */ -+ if (!s->kvm_dirty_ring_size) { -+ dirty_log_manual_caps = -+ kvm_check_extension(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2); -+ dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | -+ KVM_DIRTY_LOG_INITIALLY_SET); -+ s->manual_dirty_log_protect = dirty_log_manual_caps; -+ if (dirty_log_manual_caps) { -+ ret = kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2, 0, -+ dirty_log_manual_caps); -+ if (ret) { -+ warn_report("Trying to enable capability %"PRIu64" of " -+ "KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 but failed. " -+ "Falling back to the legacy mode. ", -+ dirty_log_manual_caps); -+ s->manual_dirty_log_protect = 0; -+ } -+ } -+ } -+ -+ return 0; -+} -+ - static int kvm_init(MachineState *ms) - { - MachineClass *mc = MACHINE_GET_CLASS(ms); -@@ -2458,7 +2507,6 @@ static int kvm_init(MachineState *ms) - const KVMCapabilityInfo *missing_cap; - int ret; - int type; -- uint64_t dirty_log_manual_caps; - - qemu_mutex_init(&kml_slots_lock); - -@@ -2570,47 +2618,11 @@ static int kvm_init(MachineState *ms) - s->coalesced_pio = s->coalesced_mmio && - kvm_check_extension(s, KVM_CAP_COALESCED_PIO); - -- /* -- * Enable KVM dirty ring if supported, otherwise fall back to -- * dirty logging mode -- */ -- ret = kvm_dirty_ring_init(s); -+ ret = kvm_setup_dirty_ring(s); - if (ret < 0) { - goto err; - } - -- /* -- * KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is not needed when dirty ring is -- * enabled. More importantly, KVM_DIRTY_LOG_INITIALLY_SET will assume no -- * page is wr-protected initially, which is against how kvm dirty ring is -- * usage - kvm dirty ring requires all pages are wr-protected at the very -- * beginning. Enabling this feature for dirty ring causes data corruption. -- * -- * TODO: Without KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 and kvm clear dirty log, -- * we may expect a higher stall time when starting the migration. In the -- * future we can enable KVM_CLEAR_DIRTY_LOG to work with dirty ring too: -- * instead of clearing dirty bit, it can be a way to explicitly wr-protect -- * guest pages. -- */ -- if (!s->kvm_dirty_ring_size) { -- dirty_log_manual_caps = -- kvm_check_extension(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2); -- dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | -- KVM_DIRTY_LOG_INITIALLY_SET); -- s->manual_dirty_log_protect = dirty_log_manual_caps; -- if (dirty_log_manual_caps) { -- ret = kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2, 0, -- dirty_log_manual_caps); -- if (ret) { -- warn_report("Trying to enable capability %"PRIu64" of " -- "KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 but failed. " -- "Falling back to the legacy mode. ", -- dirty_log_manual_caps); -- s->manual_dirty_log_protect = 0; -- } -- } -- } -- - #ifdef KVM_CAP_VCPU_EVENTS - s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS); - #endif --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch b/images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch deleted file mode 100644 index 2b707e605..000000000 --- a/images/qemu-artifact/patches/kvm-docs-system-Update-documentation-for-s390x-IPL.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 38df1fff536527bf47e190d000d8c05679f0f220 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:52 -0400 -Subject: [PATCH 19/27] docs/system: Update documentation for s390x IPL -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [19/23] feefab248336e1744eeb6bdf86e9033fe8184b3a (thuth/qemu-kvm-cs9) - -Update docs to show that s390x PC BIOS can support more than one boot device. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-19-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 0bd107138ff0b171e3cd314dbc200950bcab2b05) ---- - docs/system/bootindex.rst | 7 ++++--- - docs/system/s390x/bootdevices.rst | 9 ++++++--- - 2 files changed, 10 insertions(+), 6 deletions(-) - -diff --git a/docs/system/bootindex.rst b/docs/system/bootindex.rst -index 8b057f812f..988f7b3beb 100644 ---- a/docs/system/bootindex.rst -+++ b/docs/system/bootindex.rst -@@ -49,10 +49,11 @@ Limitations - ----------- - - Some firmware has limitations on which devices can be considered for --booting. For instance, the PC BIOS boot specification allows only one --disk to be bootable. If boot from disk fails for some reason, the BIOS -+booting. For instance, the x86 PC BIOS boot specification allows only one -+disk to be bootable. If boot from disk fails for some reason, the x86 BIOS - won't retry booting from other disk. It can still try to boot from --floppy or net, though. -+floppy or net, though. In the case of s390x BIOS, the BIOS will try up to -+8 total devices, any number of which may be disks. - - Sometimes, firmware cannot map the device path QEMU wants firmware to - boot from to a boot method. It doesn't happen for devices the firmware -diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst -index c97efb8fc0..1a1a764c1c 100644 ---- a/docs/system/s390x/bootdevices.rst -+++ b/docs/system/s390x/bootdevices.rst -@@ -6,9 +6,7 @@ Booting with bootindex parameter - - For classical mainframe guests (i.e. LPAR or z/VM installations), you always - have to explicitly specify the disk where you want to boot from (or "IPL" from, --in s390x-speak -- IPL means "Initial Program Load"). In particular, there can --also be only one boot device according to the architecture specification, thus --specifying multiple boot devices is not possible (yet). -+in s390x-speak -- IPL means "Initial Program Load"). - - So for booting an s390x guest in QEMU, you should always mark the - device where you want to boot from with the ``bootindex`` property, for -@@ -17,6 +15,11 @@ example:: - qemu-system-s390x -drive if=none,id=dr1,file=guest.qcow2 \ - -device virtio-blk,drive=dr1,bootindex=1 - -+Multiple devices may have a bootindex. The lowest bootindex is assigned to the -+device to IPL first. If the IPL fails for the first, the device with the second -+lowest bootindex will be tried and so on until IPL is successful or there are no -+remaining boot devices to try. -+ - For booting from a CD-ROM ISO image (which needs to include El-Torito boot - information in order to be bootable), it is recommended to specify a ``scsi-cd`` - device, for example like this:: --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch b/images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch deleted file mode 100644 index 095614954..000000000 --- a/images/qemu-artifact/patches/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 5a0451f82a143dbaa0f75543a75c8e4560ac477f Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Mon, 11 Nov 2024 11:55:06 +0100 -Subject: [PATCH 03/10] docs/system/bootindex: Make it clear that s390x can - also boot from virtio-net -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [2/8] 2921f4532ad7b0891dea251a4d768776170c6271 (thuth/qemu-kvm-cs9) - -Let's make it clear that s390x can also boot from virtio-net, to avoid -that people think that s390x can only boot from disk devices. - -Reported-by: Boris Fiuczynski -Message-ID: <20241111105506.264640-1-thuth@redhat.com> -Reviewed-by: Prasad Pandit -Reviewed-by: Boris Fiuczynski -Signed-off-by: Thomas Huth -(cherry picked from commit b8c5fdc6588f82d95807be0eb2215d215a3ba16e) ---- - docs/system/bootindex.rst | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/docs/system/bootindex.rst b/docs/system/bootindex.rst -index 988f7b3beb..5e1b33ee22 100644 ---- a/docs/system/bootindex.rst -+++ b/docs/system/bootindex.rst -@@ -53,7 +53,7 @@ booting. For instance, the x86 PC BIOS boot specification allows only one - disk to be bootable. If boot from disk fails for some reason, the x86 BIOS - won't retry booting from other disk. It can still try to boot from - floppy or net, though. In the case of s390x BIOS, the BIOS will try up to --8 total devices, any number of which may be disks. -+8 total devices, any number of which may be disks or virtio-net devices. - - Sometimes, firmware cannot map the device path QEMU wants firmware to - boot from to a boot method. It doesn't happen for devices the firmware --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch b/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch deleted file mode 100644 index 900b9abfd..000000000 --- a/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 255d789ab8fbc5a79236e0943a222371ceded164 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Thu, 14 Nov 2024 19:27:42 -0500 -Subject: [PATCH 02/10] docs/system/s390x/bootdevices: Update loadparm - documentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [1/8] df997bcf56bad83b5d4832dbf6c3298abd15b249 (thuth/qemu-kvm-cs9) - -Update documentation to include per-device loadparm support. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241115002742.3576842-1-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 0271fdc650b212533b8aeaecbedfe8ccf6bbbef3) ---- - docs/system/s390x/bootdevices.rst | 24 +++++++++++++++++++++++- - 1 file changed, 23 insertions(+), 1 deletion(-) - -diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst -index 1a1a764c1c..97b3914785 100644 ---- a/docs/system/s390x/bootdevices.rst -+++ b/docs/system/s390x/bootdevices.rst -@@ -79,7 +79,29 @@ The second way to use this parameter is to use a number in the range from 0 - to 31. The numbers that can be used here correspond to the numbers that are - shown when using the ``PROMPT`` option, and the s390-ccw bios will then try - to automatically boot the kernel that is associated with the given number. --Note that ``0`` can be used to boot the default entry. -+Note that ``0`` can be used to boot the default entry. If the machine -+``loadparm`` is not assigned a value, then the default entry is used. -+ -+By default, the machine ``loadparm`` applies to all boot devices. If multiple -+devices are assigned a ``bootindex`` and the ``loadparm`` is to be different -+between them, an independent ``loadparm`` may be assigned on a per-device basis. -+ -+An example guest using per-device ``loadparm``:: -+ -+ qemu-system-s390x -drive if=none,id=dr1,file=primary.qcow2 \ -+ -device virtio-blk,drive=dr1,bootindex=1 \ -+ -drive if=none,id=dr2,file=secondary.qcow2 \ -+ -device virtio-blk,drive=dr2,bootindex=2,loadparm=3 -+ -+In this case, the primary boot device will attempt to IPL using the default -+entry (because no ``loadparm`` is specified for this device or for the -+machine). If that device fails to boot, the secondary device will attempt to -+IPL using entry number 3. -+ -+If a ``loadparm`` is specified on both the machine and a device, the per-device -+value will superseded the machine value. Per-device ``loadparm`` values are -+only used for devices with an assigned ``bootindex``. The machine ``loadparm`` -+is used when attempting to boot without a ``bootindex``. - - - Booting from a network device --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch b/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch deleted file mode 100644 index fdc7d4b9f..000000000 --- a/images/qemu-artifact/patches/kvm-docs-system-s390x-bootdevices-Update-the-documentati.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 63c705bdd8d8f17860988d22aa29a238e9fae631 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:40 -0400 -Subject: [PATCH 07/27] docs/system/s390x/bootdevices: Update the documentation - about network booting -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [7/23] 31b1f484e98304c385adbefb6eb50b501d179268 (thuth/qemu-kvm-cs9) - -Remove the information about the separate s390-netboot.img from -the documentation. - -Co-authored by: Thomas Huth -Signed-off-by: Jared Rossi -Message-ID: <20241020012953.1380075-7-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit ab2691b6c7ff360875e0af86ff463278f17786f5) ---- - docs/system/s390x/bootdevices.rst | 20 +++++++------------- - 1 file changed, 7 insertions(+), 13 deletions(-) - -diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst -index 1a7a18b43b..c97efb8fc0 100644 ---- a/docs/system/s390x/bootdevices.rst -+++ b/docs/system/s390x/bootdevices.rst -@@ -82,23 +82,17 @@ Note that ``0`` can be used to boot the default entry. - Booting from a network device - ----------------------------- - --Beside the normal guest firmware (which is loaded from the file ``s390-ccw.img`` --in the data directory of QEMU, or via the ``-bios`` option), QEMU ships with --a small TFTP network bootloader firmware for virtio-net-ccw devices, too. This --firmware is loaded from a file called ``s390-netboot.img`` in the QEMU data --directory. In case you want to load it from a different filename instead, --you can specify it via the ``-global s390-ipl.netboot_fw=filename`` --command line option. -- --The ``bootindex`` property is especially important for booting via the network. --If you don't specify the ``bootindex`` property here, the network bootloader --firmware code won't get loaded into the guest memory so that the network boot --will fail. For a successful network boot, try something like this:: -+The firmware that ships with QEMU includes a small TFTP network bootloader -+for virtio-net-ccw devices. The ``bootindex`` property is especially -+important for booting via the network. If you don't specify the ``bootindex`` -+property here, the network bootloader won't be taken into consideration and -+the network boot will fail. For a successful network boot, try something -+like this:: - - qemu-system-s390x -netdev user,id=n1,tftp=...,bootfile=... \ - -device virtio-net-ccw,netdev=n1,bootindex=1 - --The network bootloader firmware also has basic support for pxelinux.cfg-style -+The network bootloader also has basic support for pxelinux.cfg-style - configuration files. See the `PXELINUX Configuration page - `__ - for details how to set up the configuration file on your TFTP server. --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch b/images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch deleted file mode 100644 index 70e6bcc11..000000000 --- a/images/qemu-artifact/patches/kvm-hostmem-Apply-merge-property-after-the-memory-region.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 34266f76ec5c96aceee89d1dd25c338af81f99dc Mon Sep 17 00:00:00 2001 -From: Gavin Shan -Date: Wed, 20 Nov 2024 17:13:44 +1000 -Subject: [PATCH 2/2] hostmem: Apply merge property after the memory region is - initialized - -RH-Author: Gavin Shan -RH-MergeRequest: 296: hostmem: Apply merge property after the memory region is initialized -RH-Jira: RHEL-68289 -RH-Acked-by: David Hildenbrand -RH-Acked-by: Eric Auger -RH-Acked-by: Sebastian Ott -RH-Commit: [1/1] fc01302c3299a15fd523247e5a3df0957becba6a (gwshan/qemu-centos) - -JIRA: https://issues.redhat.com/browse/RHEL-68289 - -The semantic change has been introduced by commit 5becdc0ab0 ("hostmem: -simplify the code for merge and dump properties") even it clarifies that -no senmatic change has been introduced. After the commit, the merge -property can be applied even the corresponding memory region isn't -initialized yet. This leads to crash dump by the following command -lines. - - # /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ - -accel kvm -machine virt -cpu host \ - -object memory-backend-ram,id=mem-memN0,size=4096M,merge=off - : - qemu-system-aarch64: ../system/memory.c:2419: memory_region_get_ram_ptr: \ - Assertion `mr->ram_block' failed. - -Fix it by applying the merge property only when the memory region is -initialized. - -Message-ID: <20240915233117.478169-1-gshan@redhat.com> -Fixes: 5becdc0ab083 ("hostmem: simplify the code for merge and dump properties") -Reported-by: Zhenyu Zhang -Tested-by: Zhenyu Zhang -Signed-off-by: Gavin Shan -Signed-off-by: David Hildenbrand -(cherry picked from commit 78c8f780d3f0d6d17aa93d6f99ff72960080fdd7) -Signed-off-by: Gavin Shan ---- - backends/hostmem.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/backends/hostmem.c b/backends/hostmem.c -index 4e5576a4ad..181446626a 100644 ---- a/backends/hostmem.c -+++ b/backends/hostmem.c -@@ -178,7 +178,7 @@ static void host_memory_backend_set_merge(Object *obj, bool value, Error **errp) - return; - } - -- if (!host_memory_backend_mr_inited(backend) && -+ if (host_memory_backend_mr_inited(backend) && - value != backend->merge) { - void *ptr = memory_region_get_ram_ptr(&backend->mr); - uint64_t sz = memory_region_size(&backend->mr); --- -2.45.1 - diff --git a/images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch b/images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch deleted file mode 100644 index 14fe2f049..000000000 --- a/images/qemu-artifact/patches/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch +++ /dev/null @@ -1,221 +0,0 @@ -From 7aa02e169dde52b4a7f6ec832a3fe55027fbd5e2 Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Fri, 15 Nov 2024 15:12:02 +0100 -Subject: [PATCH 05/10] hw: Add "loadparm" property to scsi disk devices for - booting on s390x -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [4/8] 7e3444e1fda776ca3b6de246b2dd696edf4980dd (thuth/qemu-kvm-cs9) - -While adding the new flexible boot order feature on s390x recently, -we missed to add the "loadparm" property to the scsi-hd and scsi-cd -devices. This property is required on s390x to pass the information -to the boot loader about which kernel should be started or whether -the boot menu should be shown. But even more serious: The missing -property is now causing trouble with the corresponding libvirt patches -that assume that the "loadparm" property is either settable for all -bootable devices (when the "boot order" feature is implemented in -QEMU), or none (meaning the behaviour of older QEMUs that only allowed -one "loadparm" at the machine level). To fix this broken situation, -let's implement the "loadparm" property in for the SCSI devices, too. - -Message-ID: <20241115141202.1877294-1-thuth@redhat.com> -Acked-by: Eric Farman -Signed-off-by: Thomas Huth -(cherry picked from commit 429442e52d94f890fa194a151e8cd649b04e9e63) ---- - hw/core/qdev-properties-system.c | 26 +++++++++++++++++ - hw/s390x/ipl.c | 19 ++++--------- - hw/scsi/scsi-disk.c | 43 +++++++++++++++++++++++++++++ - include/hw/qdev-properties-system.h | 3 ++ - 4 files changed, 78 insertions(+), 13 deletions(-) - -diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c -index f13350b4fb..5cd527cdba 100644 ---- a/hw/core/qdev-properties-system.c -+++ b/hw/core/qdev-properties-system.c -@@ -58,6 +58,32 @@ static bool check_prop_still_unset(Object *obj, const char *name, - return false; - } - -+bool qdev_prop_sanitize_s390x_loadparm(uint8_t *loadparm, const char *str, -+ Error **errp) -+{ -+ int i, len; -+ -+ len = strlen(str); -+ if (len > 8) { -+ error_setg(errp, "'loadparm' can only contain up to 8 characters"); -+ return false; -+ } -+ -+ for (i = 0; i < len; i++) { -+ uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ -+ -+ if (qemu_isalnum(c) || c == '.' || c == ' ') { -+ loadparm[i] = c; -+ } else { -+ error_setg(errp, -+ "invalid character in 'loadparm': '%c' (ASCII 0x%02x)", -+ c, c); -+ return false; -+ } -+ } -+ -+ return true; -+} - - /* --- drive --- */ - -diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c -index 5fbd43c346..8101825dfe 100644 ---- a/hw/s390x/ipl.c -+++ b/hw/s390x/ipl.c -@@ -418,21 +418,9 @@ static uint64_t s390_ipl_map_iplb_chain(IplParameterBlock *iplb_chain) - - void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) - { -- int i; -- - /* Initialize the loadparm with spaces */ - memset(loadparm, ' ', LOADPARM_LEN); -- for (i = 0; i < LOADPARM_LEN && str[i]; i++) { -- uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ -- -- if (qemu_isalnum(c) || c == '.' || c == ' ') { -- loadparm[i] = c; -- } else { -- error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", -- c, c); -- return; -- } -- } -+ qdev_prop_sanitize_s390x_loadparm(loadparm, str, errp); - } - - void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) -@@ -452,6 +440,7 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) - SCSIDevice *sd; - int devtype; - uint8_t *lp; -+ g_autofree void *scsi_lp = NULL; - - /* - * Currently allow IPL only from CCW devices. -@@ -463,6 +452,10 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) - switch (devtype) { - case CCW_DEVTYPE_SCSI: - sd = SCSI_DEVICE(dev_st); -+ scsi_lp = object_property_get_str(OBJECT(sd), "loadparm", NULL); -+ if (scsi_lp && strlen(scsi_lp) > 0) { -+ lp = scsi_lp; -+ } - iplb->len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); - iplb->blk0_len = - cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); -diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c -index 4d94b2b816..7566a5f531 100644 ---- a/hw/scsi/scsi-disk.c -+++ b/hw/scsi/scsi-disk.c -@@ -32,6 +32,7 @@ - #include "migration/vmstate.h" - #include "hw/scsi/emulation.h" - #include "scsi/constants.h" -+#include "sysemu/arch_init.h" - #include "sysemu/block-backend.h" - #include "sysemu/blockdev.h" - #include "hw/block/block.h" -@@ -111,6 +112,7 @@ struct SCSIDiskState { - char *vendor; - char *product; - char *device_id; -+ char *loadparm; /* only for s390x */ - bool tray_open; - bool tray_locked; - /* -@@ -3135,6 +3137,43 @@ BlockAIOCB *scsi_dma_writev(int64_t offset, QEMUIOVector *iov, - return blk_aio_pwritev(s->qdev.conf.blk, offset, iov, 0, cb, cb_opaque); - } - -+static char *scsi_property_get_loadparm(Object *obj, Error **errp) -+{ -+ return g_strdup(SCSI_DISK_BASE(obj)->loadparm); -+} -+ -+static void scsi_property_set_loadparm(Object *obj, const char *value, -+ Error **errp) -+{ -+ void *lp_str; -+ -+ if (object_property_get_int(obj, "bootindex", NULL) < 0) { -+ error_setg(errp, "'loadparm' is only valid for boot devices"); -+ return; -+ } -+ -+ lp_str = g_malloc0(strlen(value)); -+ if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) { -+ g_free(lp_str); -+ return; -+ } -+ SCSI_DISK_BASE(obj)->loadparm = lp_str; -+} -+ -+static void scsi_property_add_specifics(DeviceClass *dc) -+{ -+ ObjectClass *oc = OBJECT_CLASS(dc); -+ -+ /* The loadparm property is only supported on s390x */ -+ if (arch_type & QEMU_ARCH_S390X) { -+ object_class_property_add_str(oc, "loadparm", -+ scsi_property_get_loadparm, -+ scsi_property_set_loadparm); -+ object_class_property_set_description(oc, "loadparm", -+ "load parameter (s390x only)"); -+ } -+} -+ - static void scsi_disk_base_class_initfn(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); -@@ -3218,6 +3257,8 @@ static void scsi_hd_class_initfn(ObjectClass *klass, void *data) - dc->desc = "virtual SCSI disk"; - device_class_set_props(dc, scsi_hd_properties); - dc->vmsd = &vmstate_scsi_disk_state; -+ -+ scsi_property_add_specifics(dc); - } - - static const TypeInfo scsi_hd_info = { -@@ -3258,6 +3299,8 @@ static void scsi_cd_class_initfn(ObjectClass *klass, void *data) - dc->desc = "virtual SCSI CD-ROM"; - device_class_set_props(dc, scsi_cd_properties); - dc->vmsd = &vmstate_scsi_disk_state; -+ -+ scsi_property_add_specifics(dc); - } - - static const TypeInfo scsi_cd_info = { -diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h -index 438f65389f..88e4257ad0 100644 ---- a/include/hw/qdev-properties-system.h -+++ b/include/hw/qdev-properties-system.h -@@ -3,6 +3,9 @@ - - #include "hw/qdev-properties.h" - -+bool qdev_prop_sanitize_s390x_loadparm(uint8_t *loadparm, const char *str, -+ Error **errp); -+ - extern const PropertyInfo qdev_prop_chr; - extern const PropertyInfo qdev_prop_macaddr; - extern const PropertyInfo qdev_prop_reserved_region; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch b/images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch deleted file mode 100644 index 2b89353ba..000000000 --- a/images/qemu-artifact/patches/kvm-hw-s390x-Build-an-IPLB-for-each-boot-device.patch +++ /dev/null @@ -1,270 +0,0 @@ -From ca648a6167953204a9ec55131e9aa836f63ab7e8 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:49 -0400 -Subject: [PATCH 16/27] hw/s390x: Build an IPLB for each boot device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [16/23] 4b87f66a28d9a34b0182e0a2c92af406d2e492a6 (thuth/qemu-kvm-cs9) - -Build an IPLB for any device with a bootindex (up to a maximum of 8 devices). - -The IPLB chain is placed immediately before the BIOS in memory. Because this -is not a fixed address, the location of the next IPLB and number of remaining -boot devices is stored in the QIPL global variable for possible later access by -the guest during IPL. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-16-jrossi@linux.ibm.com> -[thuth: Fix endianness problem when accessing the qipl structure] -Signed-off-by: Thomas Huth -(cherry picked from commit 0927875e704e93ace03bb7533c0877bf97e4bda9) ---- - hw/s390x/ipl.c | 129 ++++++++++++++++++++++++++++-------- - hw/s390x/ipl.h | 1 + - include/hw/s390x/ipl/qipl.h | 4 +- - 3 files changed, 105 insertions(+), 29 deletions(-) - -diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c -index d83832d975..f4576f8822 100644 ---- a/hw/s390x/ipl.c -+++ b/hw/s390x/ipl.c -@@ -56,6 +56,13 @@ static bool iplb_extended_needed(void *opaque) - return ipl->iplbext_migration; - } - -+/* Place the IPLB chain immediately before the BIOS in memory */ -+static uint64_t find_iplb_chain_addr(uint64_t bios_addr, uint16_t count) -+{ -+ return (bios_addr & TARGET_PAGE_MASK) -+ - (count * sizeof(IplParameterBlock)); -+} -+ - static const VMStateDescription vmstate_iplb_extended = { - .name = "ipl/iplb_extended", - .version_id = 0, -@@ -398,6 +405,17 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype) - return ccw_dev; - } - -+static uint64_t s390_ipl_map_iplb_chain(IplParameterBlock *iplb_chain) -+{ -+ S390IPLState *ipl = get_ipl_device(); -+ uint16_t count = be16_to_cpu(ipl->qipl.chain_len); -+ uint64_t len = sizeof(IplParameterBlock) * count; -+ uint64_t chain_addr = find_iplb_chain_addr(ipl->bios_start_addr, count); -+ -+ cpu_physical_memory_write(chain_addr, iplb_chain, len); -+ return chain_addr; -+} -+ - void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) - { - int i; -@@ -428,54 +446,51 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) - } - } - --static bool s390_gen_initial_iplb(S390IPLState *ipl) -+static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) - { -- DeviceState *dev_st; -+ S390IPLState *ipl = get_ipl_device(); - CcwDevice *ccw_dev = NULL; - SCSIDevice *sd; - int devtype; - uint8_t *lp; - -- dev_st = get_boot_device(0); -- if (dev_st) { -- ccw_dev = s390_get_ccw_device(dev_st, &devtype); -- } -- - /* - * Currently allow IPL only from CCW devices. - */ -+ ccw_dev = s390_get_ccw_device(dev_st, &devtype); - if (ccw_dev) { - lp = ccw_dev->loadparm; - - switch (devtype) { - case CCW_DEVTYPE_SCSI: - sd = SCSI_DEVICE(dev_st); -- ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); -- ipl->iplb.blk0_len = -+ iplb->len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); -+ iplb->blk0_len = - cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); -- ipl->iplb.pbt = S390_IPL_TYPE_QEMU_SCSI; -- ipl->iplb.scsi.lun = cpu_to_be32(sd->lun); -- ipl->iplb.scsi.target = cpu_to_be16(sd->id); -- ipl->iplb.scsi.channel = cpu_to_be16(sd->channel); -- ipl->iplb.scsi.devno = cpu_to_be16(ccw_dev->sch->devno); -- ipl->iplb.scsi.ssid = ccw_dev->sch->ssid & 3; -+ iplb->pbt = S390_IPL_TYPE_QEMU_SCSI; -+ iplb->scsi.lun = cpu_to_be32(sd->lun); -+ iplb->scsi.target = cpu_to_be16(sd->id); -+ iplb->scsi.channel = cpu_to_be16(sd->channel); -+ iplb->scsi.devno = cpu_to_be16(ccw_dev->sch->devno); -+ iplb->scsi.ssid = ccw_dev->sch->ssid & 3; - break; - case CCW_DEVTYPE_VFIO: -- ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); -- ipl->iplb.pbt = S390_IPL_TYPE_CCW; -- ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno); -- ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3; -+ iplb->len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); -+ iplb->pbt = S390_IPL_TYPE_CCW; -+ iplb->ccw.devno = cpu_to_be16(ccw_dev->sch->devno); -+ iplb->ccw.ssid = ccw_dev->sch->ssid & 3; - break; - case CCW_DEVTYPE_VIRTIO_NET: -+ /* The S390IPLState netboot is true if ANY IPLB may use netboot */ - ipl->netboot = true; - /* Fall through to CCW_DEVTYPE_VIRTIO case */ - case CCW_DEVTYPE_VIRTIO: -- ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); -- ipl->iplb.blk0_len = -+ iplb->len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); -+ iplb->blk0_len = - cpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN); -- ipl->iplb.pbt = S390_IPL_TYPE_CCW; -- ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno); -- ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3; -+ iplb->pbt = S390_IPL_TYPE_CCW; -+ iplb->ccw.devno = cpu_to_be16(ccw_dev->sch->devno); -+ iplb->ccw.ssid = ccw_dev->sch->ssid & 3; - break; - } - -@@ -484,8 +499,8 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) - lp = S390_CCW_MACHINE(qdev_get_machine())->loadparm; - } - -- s390_ipl_convert_loadparm((char *)lp, ipl->iplb.loadparm); -- ipl->iplb.flags |= DIAG308_FLAGS_LP_VALID; -+ s390_ipl_convert_loadparm((char *)lp, iplb->loadparm); -+ iplb->flags |= DIAG308_FLAGS_LP_VALID; - - return true; - } -@@ -493,6 +508,62 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) - return false; - } - -+static bool s390_init_all_iplbs(S390IPLState *ipl) -+{ -+ int iplb_num = 0; -+ IplParameterBlock iplb_chain[7]; -+ DeviceState *dev_st = get_boot_device(0); -+ Object *machine = qdev_get_machine(); -+ -+ /* -+ * Parse the boot devices. Generate an IPLB for only the first boot device -+ * which will later be set with DIAG308. -+ */ -+ if (!dev_st) { -+ ipl->qipl.chain_len = 0; -+ return false; -+ } -+ -+ /* If no machine loadparm was defined fill it with spaces */ -+ if (memcmp(S390_CCW_MACHINE(machine)->loadparm, NO_LOADPARM, 8) == 0) { -+ object_property_set_str(machine, "loadparm", " ", NULL); -+ } -+ -+ iplb_num = 1; -+ s390_build_iplb(dev_st, &ipl->iplb); -+ -+ /* Index any fallback boot devices */ -+ while (get_boot_device(iplb_num)) { -+ iplb_num++; -+ } -+ -+ if (iplb_num > MAX_BOOT_DEVS) { -+ warn_report("Excess boot devices defined! %d boot devices found, " -+ "but only the first %d will be considered.", -+ iplb_num, MAX_BOOT_DEVS); -+ -+ iplb_num = MAX_BOOT_DEVS; -+ } -+ -+ ipl->qipl.chain_len = cpu_to_be16(iplb_num - 1); -+ -+ /* -+ * Build fallback IPLBs for any boot devices above index 0, up to a -+ * maximum amount as defined in ipl.h -+ */ -+ if (iplb_num > 1) { -+ /* Start at 1 because the IPLB for boot index 0 is not chained */ -+ for (int i = 1; i < iplb_num; i++) { -+ dev_st = get_boot_device(i); -+ s390_build_iplb(dev_st, &iplb_chain[i - 1]); -+ } -+ -+ ipl->qipl.next_iplb = cpu_to_be64(s390_ipl_map_iplb_chain(iplb_chain)); -+ } -+ -+ return iplb_num; -+} -+ - static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, - int virtio_id) - { -@@ -620,7 +691,7 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) - * this is the original boot device's SCSI - * so restore IPL parameter info from it - */ -- ipl->iplb_valid = s390_gen_initial_iplb(ipl); -+ ipl->iplb_valid = s390_build_iplb(get_boot_device(0), &ipl->iplb); - } - } - if (reset_type == S390_RESET_MODIFIED_CLEAR || -@@ -714,7 +785,9 @@ void s390_ipl_prepare_cpu(S390CPU *cpu) - if (!ipl->kernel || ipl->iplb_valid) { - cpu->env.psw.addr = ipl->bios_start_addr; - if (!ipl->iplb_valid) { -- ipl->iplb_valid = s390_gen_initial_iplb(ipl); -+ ipl->iplb_valid = s390_init_all_iplbs(ipl); -+ } else { -+ ipl->qipl.chain_len = 0; - } - } - s390_ipl_set_boot_menu(ipl); -diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h -index b670bad551..54eb48fd6e 100644 ---- a/hw/s390x/ipl.h -+++ b/hw/s390x/ipl.h -@@ -20,6 +20,7 @@ - #include "qom/object.h" - - #define DIAG308_FLAGS_LP_VALID 0x80 -+#define MAX_BOOT_DEVS 8 /* Max number of devices that may have a bootindex */ - - void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp); - void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp); -diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h -index b67d2ae061..1da4f75aa8 100644 ---- a/include/hw/s390x/ipl/qipl.h -+++ b/include/hw/s390x/ipl/qipl.h -@@ -32,7 +32,9 @@ struct QemuIplParameters { - uint8_t reserved1[3]; - uint64_t reserved2; - uint32_t boot_menu_timeout; -- uint8_t reserved3[12]; -+ uint8_t reserved3[2]; -+ uint16_t chain_len; -+ uint64_t next_iplb; - } QEMU_PACKED; - typedef struct QemuIplParameters QemuIplParameters; - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch b/images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch deleted file mode 100644 index b5b820df1..000000000 --- a/images/qemu-artifact/patches/kvm-hw-s390x-Remove-the-possibility-to-load-the-s390-net.patch +++ /dev/null @@ -1,201 +0,0 @@ -From 99d6e739324ff1be46ad89a2682978cc1fa3a56c Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Thu, 20 Jun 2024 16:59:28 +0200 -Subject: [PATCH 05/27] hw/s390x: Remove the possibility to load the - s390-netboot.img binary -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [5/23] e4e037f24be08626c02f8e870992e8f0a5ed505e (thuth/qemu-kvm-cs9) - -Since the netboot code has now been merged into the main s390-ccw.img -binary, we don't need the separate s390-netboot.img anymore. Remove -it and the code that was responsible for loading it. - -Message-Id: <20240621082422.136217-6-thuth@redhat.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 188e255bf8ed68fa64bcb63577cb100eeb326254) ---- - hw/s390x/ipl.c | 55 -------------------------------------- - hw/s390x/ipl.h | 12 +++------ - hw/s390x/s390-virtio-ccw.c | 10 ++----- - pc-bios/meson.build | 1 - - 4 files changed, 6 insertions(+), 72 deletions(-) - -diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c -index 9362de0b6f..8a0a3e6961 100644 ---- a/hw/s390x/ipl.c -+++ b/hw/s390x/ipl.c -@@ -288,7 +288,6 @@ static Property s390_ipl_properties[] = { - DEFINE_PROP_STRING("initrd", S390IPLState, initrd), - DEFINE_PROP_STRING("cmdline", S390IPLState, cmdline), - DEFINE_PROP_STRING("firmware", S390IPLState, firmware), -- DEFINE_PROP_STRING("netboot_fw", S390IPLState, netboot_fw), - DEFINE_PROP_BOOL("enforce_bios", S390IPLState, enforce_bios, false), - DEFINE_PROP_BOOL("iplbext_migration", S390IPLState, iplbext_migration, - true), -@@ -480,56 +479,6 @@ int s390_ipl_set_loadparm(uint8_t *loadparm) - return -1; - } - --static int load_netboot_image(Error **errp) --{ -- MachineState *ms = MACHINE(qdev_get_machine()); -- S390IPLState *ipl = get_ipl_device(); -- char *netboot_filename; -- MemoryRegion *sysmem = get_system_memory(); -- MemoryRegion *mr = NULL; -- void *ram_ptr = NULL; -- int img_size = -1; -- -- mr = memory_region_find(sysmem, 0, 1).mr; -- if (!mr) { -- error_setg(errp, "Failed to find memory region at address 0"); -- return -1; -- } -- -- ram_ptr = memory_region_get_ram_ptr(mr); -- if (!ram_ptr) { -- error_setg(errp, "No RAM found"); -- goto unref_mr; -- } -- -- netboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->netboot_fw); -- if (netboot_filename == NULL) { -- error_setg(errp, "Could not find network bootloader '%s'", -- ipl->netboot_fw); -- goto unref_mr; -- } -- -- img_size = load_elf_ram(netboot_filename, NULL, NULL, NULL, -- &ipl->start_addr, -- NULL, NULL, NULL, 1, EM_S390, 0, 0, NULL, -- false); -- -- if (img_size < 0) { -- img_size = load_image_size(netboot_filename, ram_ptr, ms->ram_size); -- ipl->start_addr = KERN_IMAGE_START; -- } -- -- if (img_size < 0) { -- error_setg(errp, "Failed to load network bootloader"); -- } -- -- g_free(netboot_filename); -- --unref_mr: -- memory_region_unref(mr); -- return img_size; --} -- - static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, - int virtio_id) - { -@@ -754,10 +703,6 @@ void s390_ipl_prepare_cpu(S390CPU *cpu) - ipl->iplb_valid = s390_gen_initial_iplb(ipl); - } - } -- if (ipl->netboot) { -- load_netboot_image(&error_fatal); -- ipl->qipl.netboot_start_addr = cpu_to_be64(ipl->start_addr); -- } - s390_ipl_set_boot_menu(ipl); - s390_ipl_prepare_qipl(cpu); - } -diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h -index 57cd125769..b2105b616a 100644 ---- a/hw/s390x/ipl.h -+++ b/hw/s390x/ipl.h -@@ -134,11 +134,8 @@ void s390_ipl_clear_reset_request(void); - /* - * The QEMU IPL Parameters will be stored at absolute address - * 204 (0xcc) which means it is 32-bit word aligned but not -- * double-word aligned. -- * Placement of data fields in this area must account for -- * their alignment needs. E.g., netboot_start_address must -- * have an offset of 4 + n * 8 bytes within the struct in order -- * to keep it double-word aligned. -+ * double-word aligned. Placement of 64-bit data fields in this -+ * area must account for their alignment needs. - * The total size of the struct must never exceed 28 bytes. - * This definition must be kept in sync with the definition - * in pc-bios/s390-ccw/iplb.h. -@@ -146,9 +143,9 @@ void s390_ipl_clear_reset_request(void); - struct QemuIplParameters { - uint8_t qipl_flags; - uint8_t reserved1[3]; -- uint64_t netboot_start_addr; -+ uint64_t reserved2; - uint32_t boot_menu_timeout; -- uint8_t reserved2[12]; -+ uint8_t reserved3[12]; - } QEMU_PACKED; - typedef struct QemuIplParameters QemuIplParameters; - -@@ -178,7 +175,6 @@ struct S390IPLState { - char *initrd; - char *cmdline; - char *firmware; -- char *netboot_fw; - uint8_t cssid; - uint8_t ssid; - uint16_t devno; -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index a4a6ffa053..5113313aa8 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -197,11 +197,10 @@ static void s390_memory_init(MemoryRegion *ram) - static void s390_init_ipl_dev(const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename, const char *firmware, -- const char *netboot_fw, bool enforce_bios) -+ bool enforce_bios) - { - Object *new = object_new(TYPE_S390_IPL); - DeviceState *dev = DEVICE(new); -- char *netboot_fw_prop; - - if (kernel_filename) { - qdev_prop_set_string(dev, "kernel", kernel_filename); -@@ -212,11 +211,6 @@ static void s390_init_ipl_dev(const char *kernel_filename, - qdev_prop_set_string(dev, "cmdline", kernel_cmdline); - qdev_prop_set_string(dev, "firmware", firmware); - qdev_prop_set_bit(dev, "enforce_bios", enforce_bios); -- netboot_fw_prop = object_property_get_str(new, "netboot_fw", &error_abort); -- if (!strlen(netboot_fw_prop)) { -- qdev_prop_set_string(dev, "netboot_fw", netboot_fw); -- } -- g_free(netboot_fw_prop); - object_property_add_child(qdev_get_machine(), TYPE_S390_IPL, - new); - object_unref(new); -@@ -284,7 +278,7 @@ static void ccw_init(MachineState *machine) - s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline, - machine->initrd_filename, - machine->firmware ?: "s390-ccw.img", -- "s390-netboot.img", true); -+ true); - - dev = qdev_new(TYPE_S390_PCI_HOST_BRIDGE); - object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE, -diff --git a/pc-bios/meson.build b/pc-bios/meson.build -index 8602b45b9b..ea85c54c86 100644 ---- a/pc-bios/meson.build -+++ b/pc-bios/meson.build -@@ -66,7 +66,6 @@ blobs = [ - 'kvmvapic.bin', - 'pvh.bin', - 's390-ccw.img', -- 's390-netboot.img', - 'slof.bin', - 'skiboot.lid', - 'palcode-clipper', --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch b/images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch deleted file mode 100644 index 3395dec2d..000000000 --- a/images/qemu-artifact/patches/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch +++ /dev/null @@ -1,113 +0,0 @@ -From ffffba85b269096d25fef307b342b8f576610d34 Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Wed, 13 Nov 2024 12:47:41 +0100 -Subject: [PATCH 04/10] hw/s390x: Restrict "loadparm" property to devices that - can be used for booting -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [3/8] e381997b44f5b8c80a90ae99f5ae5d863f6d5aa5 (thuth/qemu-kvm-cs9) - -Commit bb185de423 ("s390x: Add individual loadparm assignment to -CCW device") added a "loadparm" property to all CCW devices. This -was a little bit unfortunate, since this property is only useful -for devices that can be used for booting, but certainly it is not -useful for devices like virtio-gpu or virtio-tablet. - -Thus let's restrict the property to CCW devices that we can boot from -(i.e. virtio-block, virtio-net and vfio-ccw devices). - -Message-ID: <20241113114741.681096-1-thuth@redhat.com> -Reviewed-by: Philippe Mathieu-Daudé -Reviewed-by: Jared Rossi -Signed-off-by: Thomas Huth -(cherry picked from commit 6e7c96ae61e0542e97d385084f1f2281a0331054) ---- - hw/s390x/ccw-device.c | 4 +--- - hw/s390x/ccw-device.h | 5 +++++ - hw/s390x/virtio-ccw-blk.c | 1 + - hw/s390x/virtio-ccw-net.c | 1 + - hw/vfio/ccw.c | 1 + - 5 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c -index 4e54f34b1c..d7bb364579 100644 ---- a/hw/s390x/ccw-device.c -+++ b/hw/s390x/ccw-device.c -@@ -73,7 +73,7 @@ static void ccw_device_set_loadparm(Object *obj, Visitor *v, - s390_ipl_fmt_loadparm(dev->loadparm, val, errp); - } - --static const PropertyInfo ccw_loadparm = { -+const PropertyInfo ccw_loadparm = { - .name = "ccw_loadparm", - .description = "Up to 8 chars in set of [A-Za-z0-9. ] to pass" - " to the guest loader/kernel", -@@ -85,8 +85,6 @@ static Property ccw_device_properties[] = { - DEFINE_PROP_CSS_DEV_ID("devno", CcwDevice, devno), - DEFINE_PROP_CSS_DEV_ID_RO("dev_id", CcwDevice, dev_id), - DEFINE_PROP_CSS_DEV_ID_RO("subch_id", CcwDevice, subch_id), -- DEFINE_PROP("loadparm", CcwDevice, loadparm, ccw_loadparm, -- typeof(uint8_t[8])), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h -index 1e1737c0f3..4439feb140 100644 ---- a/hw/s390x/ccw-device.h -+++ b/hw/s390x/ccw-device.h -@@ -51,4 +51,9 @@ static inline CcwDevice *to_ccw_dev_fast(DeviceState *d) - - OBJECT_DECLARE_TYPE(CcwDevice, CCWDeviceClass, CCW_DEVICE) - -+extern const PropertyInfo ccw_loadparm; -+ -+#define DEFINE_PROP_CCW_LOADPARM(_n, _s, _f) \ -+ DEFINE_PROP(_n, _s, _f, ccw_loadparm, typeof(uint8_t[8])) -+ - #endif -diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c -index 8e0e58b77d..2364432c6e 100644 ---- a/hw/s390x/virtio-ccw-blk.c -+++ b/hw/s390x/virtio-ccw-blk.c -@@ -48,6 +48,7 @@ static Property virtio_ccw_blk_properties[] = { - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), -+ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c -index 484e617659..a4a3f65c7e 100644 ---- a/hw/s390x/virtio-ccw-net.c -+++ b/hw/s390x/virtio-ccw-net.c -@@ -51,6 +51,7 @@ static Property virtio_ccw_net_properties[] = { - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), -+ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c -index 115862f430..99f16614ad 100644 ---- a/hw/vfio/ccw.c -+++ b/hw/vfio/ccw.c -@@ -662,6 +662,7 @@ static Property vfio_ccw_properties[] = { - DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd, - TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), - #endif -+ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), - DEFINE_PROP_END_OF_LIST(), - }; - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch b/images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch deleted file mode 100644 index 3e333d410..000000000 --- a/images/qemu-artifact/patches/kvm-hw-s390x-ipl-Provide-more-memory-to-the-s390-ccw.img.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 22693a98eca5872f87249006d873a95e71c448f2 Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Fri, 21 Jun 2024 10:24:17 +0200 -Subject: [PATCH 01/27] hw/s390x/ipl: Provide more memory to the s390-ccw.img - firmware -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [1/23] b54cc7784876becb9fcec189811f505c22119b72 (thuth/qemu-kvm-cs9) - -We are going to link the SLOF libc into the s390-ccw.img, and this -libc needs more memory for providing space for malloc() and friends. -Thus bump the memory size that we reserve for the bios to 3 MiB -instead of only 2 MiB. While we're at it, add a proper check that -there is really enough memory assigned to the machine before blindly -using it. - -Message-ID: <20240621082422.136217-3-thuth@redhat.com> -Signed-off-by: Thomas Huth -(cherry picked from commit abaabb2e601adfe296a64471746a997eabcc607f) ---- - hw/s390x/ipl.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c -index e934bf89d1..9362de0b6f 100644 ---- a/hw/s390x/ipl.c -+++ b/hw/s390x/ipl.c -@@ -45,6 +45,7 @@ - #define INITRD_PARM_START 0x010408UL - #define PARMFILE_START 0x001000UL - #define ZIPL_IMAGE_START 0x009000UL -+#define BIOS_MAX_SIZE 0x300000UL - #define IPL_PSW_MASK (PSW_MASK_32 | PSW_MASK_64) - - static bool iplb_extended_needed(void *opaque) -@@ -144,7 +145,14 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) - * even if an external kernel has been defined. - */ - if (!ipl->kernel || ipl->enforce_bios) { -- uint64_t fwbase = (MIN(ms->ram_size, 0x80000000U) - 0x200000) & ~0xffffUL; -+ uint64_t fwbase; -+ -+ if (ms->ram_size < BIOS_MAX_SIZE) { -+ error_setg(errp, "not enough RAM to load the BIOS file"); -+ return; -+ } -+ -+ fwbase = (MIN(ms->ram_size, 0x80000000U) - BIOS_MAX_SIZE) & ~0xffffUL; - - bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->firmware); - if (bios_filename == NULL) { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch b/images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch deleted file mode 100644 index 944c5499a..000000000 --- a/images/qemu-artifact/patches/kvm-include-hw-s390x-Add-include-files-for-common-IPL-st.patch +++ /dev/null @@ -1,402 +0,0 @@ -From 40b5689f28e6fef2dfdd0269639c8556200458a3 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:47 -0400 -Subject: [PATCH 14/27] include/hw/s390x: Add include files for common IPL - structs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [14/23] 632d18ef238ded324c962855edb77e3d3f0b4eae (thuth/qemu-kvm-cs9) - -Currently, structures defined in both hw/s390x/ipl.h and pc-bios/s390-ccw/iplb.h -must be kept in sync, which is prone to error. Instead, create a new directory -at include/hw/s390x/ipl/ to contain the definitions that must be shared. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-14-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit ba3658adc80a9370257a9c4e114829ec691311e3) ---- - hw/s390x/ipl.h | 104 +----------------------------- - include/hw/s390x/ipl/qipl.h | 123 ++++++++++++++++++++++++++++++++++++ - pc-bios/s390-ccw/Makefile | 2 +- - pc-bios/s390-ccw/iplb.h | 84 ++---------------------- - 4 files changed, 130 insertions(+), 183 deletions(-) - create mode 100644 include/hw/s390x/ipl/qipl.h - -diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h -index b2105b616a..fa394c339d 100644 ---- a/hw/s390x/ipl.h -+++ b/hw/s390x/ipl.h -@@ -16,95 +16,11 @@ - #include "cpu.h" - #include "exec/address-spaces.h" - #include "hw/qdev-core.h" -+#include "hw/s390x/ipl/qipl.h" - #include "qom/object.h" - --struct IPLBlockPVComp { -- uint64_t tweak_pref; -- uint64_t addr; -- uint64_t size; --} QEMU_PACKED; --typedef struct IPLBlockPVComp IPLBlockPVComp; -- --struct IPLBlockPV { -- uint8_t reserved18[87]; /* 0x18 */ -- uint8_t version; /* 0x6f */ -- uint32_t reserved70; /* 0x70 */ -- uint32_t num_comp; /* 0x74 */ -- uint64_t pv_header_addr; /* 0x78 */ -- uint64_t pv_header_len; /* 0x80 */ -- struct IPLBlockPVComp components[0]; --} QEMU_PACKED; --typedef struct IPLBlockPV IPLBlockPV; -- --struct IplBlockCcw { -- uint8_t reserved0[85]; -- uint8_t ssid; -- uint16_t devno; -- uint8_t vm_flags; -- uint8_t reserved3[3]; -- uint32_t vm_parm_len; -- uint8_t nss_name[8]; -- uint8_t vm_parm[64]; -- uint8_t reserved4[8]; --} QEMU_PACKED; --typedef struct IplBlockCcw IplBlockCcw; -- --struct IplBlockFcp { -- uint8_t reserved1[305 - 1]; -- uint8_t opt; -- uint8_t reserved2[3]; -- uint16_t reserved3; -- uint16_t devno; -- uint8_t reserved4[4]; -- uint64_t wwpn; -- uint64_t lun; -- uint32_t bootprog; -- uint8_t reserved5[12]; -- uint64_t br_lba; -- uint32_t scp_data_len; -- uint8_t reserved6[260]; -- uint8_t scp_data[0]; --} QEMU_PACKED; --typedef struct IplBlockFcp IplBlockFcp; -- --struct IplBlockQemuScsi { -- uint32_t lun; -- uint16_t target; -- uint16_t channel; -- uint8_t reserved0[77]; -- uint8_t ssid; -- uint16_t devno; --} QEMU_PACKED; --typedef struct IplBlockQemuScsi IplBlockQemuScsi; -- - #define DIAG308_FLAGS_LP_VALID 0x80 - --union IplParameterBlock { -- struct { -- uint32_t len; -- uint8_t reserved0[3]; -- uint8_t version; -- uint32_t blk0_len; -- uint8_t pbt; -- uint8_t flags; -- uint16_t reserved01; -- uint8_t loadparm[8]; -- union { -- IplBlockCcw ccw; -- IplBlockFcp fcp; -- IPLBlockPV pv; -- IplBlockQemuScsi scsi; -- }; -- } QEMU_PACKED; -- struct { -- uint8_t reserved1[110]; -- uint16_t devno; -- uint8_t reserved2[88]; -- uint8_t reserved_ext[4096 - 200]; -- } QEMU_PACKED; --} QEMU_PACKED; --typedef union IplParameterBlock IplParameterBlock; -- - int s390_ipl_set_loadparm(uint8_t *loadparm); - void s390_ipl_update_diag308(IplParameterBlock *iplb); - int s390_ipl_prepare_pv_header(Error **errp); -@@ -131,24 +47,6 @@ void s390_ipl_clear_reset_request(void); - #define QIPL_FLAG_BM_OPTS_CMD 0x80 - #define QIPL_FLAG_BM_OPTS_ZIPL 0x40 - --/* -- * The QEMU IPL Parameters will be stored at absolute address -- * 204 (0xcc) which means it is 32-bit word aligned but not -- * double-word aligned. Placement of 64-bit data fields in this -- * area must account for their alignment needs. -- * The total size of the struct must never exceed 28 bytes. -- * This definition must be kept in sync with the definition -- * in pc-bios/s390-ccw/iplb.h. -- */ --struct QemuIplParameters { -- uint8_t qipl_flags; -- uint8_t reserved1[3]; -- uint64_t reserved2; -- uint32_t boot_menu_timeout; -- uint8_t reserved3[12]; --} QEMU_PACKED; --typedef struct QemuIplParameters QemuIplParameters; -- - #define TYPE_S390_IPL "s390-ipl" - OBJECT_DECLARE_SIMPLE_TYPE(S390IPLState, S390_IPL) - -diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h -new file mode 100644 -index 0000000000..0ef04af027 ---- /dev/null -+++ b/include/hw/s390x/ipl/qipl.h -@@ -0,0 +1,123 @@ -+/* -+ * S/390 boot structures -+ * -+ * Copyright 2024 IBM Corp. -+ * Author(s): Jared Rossi -+ * -+ * This work is licensed under the terms of the GNU GPL, version 2 or (at -+ * your option) any later version. See the COPYING file in the top-level -+ * directory. -+ */ -+ -+#ifndef S390X_QIPL_H -+#define S390X_QIPL_H -+ -+/* Boot Menu flags */ -+#define QIPL_FLAG_BM_OPTS_CMD 0x80 -+#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 -+ -+#define QIPL_ADDRESS 0xcc -+#define LOADPARM_LEN 8 -+ -+/* -+ * The QEMU IPL Parameters will be stored at absolute address -+ * 204 (0xcc) which means it is 32-bit word aligned but not -+ * double-word aligned. Placement of 64-bit data fields in this -+ * area must account for their alignment needs. -+ * The total size of the struct must never exceed 28 bytes. -+ */ -+struct QemuIplParameters { -+ uint8_t qipl_flags; -+ uint8_t reserved1[3]; -+ uint64_t reserved2; -+ uint32_t boot_menu_timeout; -+ uint8_t reserved3[12]; -+} QEMU_PACKED; -+typedef struct QemuIplParameters QemuIplParameters; -+ -+struct IPLBlockPVComp { -+ uint64_t tweak_pref; -+ uint64_t addr; -+ uint64_t size; -+} QEMU_PACKED; -+typedef struct IPLBlockPVComp IPLBlockPVComp; -+ -+struct IPLBlockPV { -+ uint8_t reserved18[87]; /* 0x18 */ -+ uint8_t version; /* 0x6f */ -+ uint32_t reserved70; /* 0x70 */ -+ uint32_t num_comp; /* 0x74 */ -+ uint64_t pv_header_addr; /* 0x78 */ -+ uint64_t pv_header_len; /* 0x80 */ -+ struct IPLBlockPVComp components[0]; -+} QEMU_PACKED; -+typedef struct IPLBlockPV IPLBlockPV; -+ -+struct IplBlockCcw { -+ uint8_t reserved0[85]; -+ uint8_t ssid; -+ uint16_t devno; -+ uint8_t vm_flags; -+ uint8_t reserved3[3]; -+ uint32_t vm_parm_len; -+ uint8_t nss_name[8]; -+ uint8_t vm_parm[64]; -+ uint8_t reserved4[8]; -+} QEMU_PACKED; -+typedef struct IplBlockCcw IplBlockCcw; -+ -+struct IplBlockFcp { -+ uint8_t reserved1[305 - 1]; -+ uint8_t opt; -+ uint8_t reserved2[3]; -+ uint16_t reserved3; -+ uint16_t devno; -+ uint8_t reserved4[4]; -+ uint64_t wwpn; -+ uint64_t lun; -+ uint32_t bootprog; -+ uint8_t reserved5[12]; -+ uint64_t br_lba; -+ uint32_t scp_data_len; -+ uint8_t reserved6[260]; -+ uint8_t scp_data[0]; -+} QEMU_PACKED; -+typedef struct IplBlockFcp IplBlockFcp; -+ -+struct IplBlockQemuScsi { -+ uint32_t lun; -+ uint16_t target; -+ uint16_t channel; -+ uint8_t reserved0[77]; -+ uint8_t ssid; -+ uint16_t devno; -+} QEMU_PACKED; -+typedef struct IplBlockQemuScsi IplBlockQemuScsi; -+ -+union IplParameterBlock { -+ struct { -+ uint32_t len; -+ uint8_t reserved0[3]; -+ uint8_t version; -+ uint32_t blk0_len; -+ uint8_t pbt; -+ uint8_t flags; -+ uint16_t reserved01; -+ uint8_t loadparm[LOADPARM_LEN]; -+ union { -+ IplBlockCcw ccw; -+ IplBlockFcp fcp; -+ IPLBlockPV pv; -+ IplBlockQemuScsi scsi; -+ }; -+ } QEMU_PACKED; -+ struct { -+ uint8_t reserved1[110]; -+ uint16_t devno; -+ uint8_t reserved2[88]; -+ uint8_t reserved_ext[4096 - 200]; -+ } QEMU_PACKED; -+} QEMU_PACKED; -+typedef union IplParameterBlock IplParameterBlock; -+ -+#endif -diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile -index 27cbb354af..db9e8f0892 100644 ---- a/pc-bios/s390-ccw/Makefile -+++ b/pc-bios/s390-ccw/Makefile -@@ -3,7 +3,7 @@ all: build-all - @true - - include config-host.mak --CFLAGS = -O2 -g -+CFLAGS = -O2 -g -I $(SRC_PATH)/../../include/hw/s390x/ipl - MAKEFLAGS += -rR - - GIT_SUBMODULES = roms/SLOF -diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h -index 3758698468..16643f5879 100644 ---- a/pc-bios/s390-ccw/iplb.h -+++ b/pc-bios/s390-ccw/iplb.h -@@ -12,88 +12,14 @@ - #ifndef IPLB_H - #define IPLB_H - --#define LOADPARM_LEN 8 -+#ifndef QEMU_PACKED -+#define QEMU_PACKED __attribute__((packed)) -+#endif - --struct IplBlockCcw { -- uint8_t reserved0[85]; -- uint8_t ssid; -- uint16_t devno; -- uint8_t vm_flags; -- uint8_t reserved3[3]; -- uint32_t vm_parm_len; -- uint8_t nss_name[8]; -- uint8_t vm_parm[64]; -- uint8_t reserved4[8]; --} __attribute__ ((packed)); --typedef struct IplBlockCcw IplBlockCcw; -- --struct IplBlockFcp { -- uint8_t reserved1[305 - 1]; -- uint8_t opt; -- uint8_t reserved2[3]; -- uint16_t reserved3; -- uint16_t devno; -- uint8_t reserved4[4]; -- uint64_t wwpn; -- uint64_t lun; -- uint32_t bootprog; -- uint8_t reserved5[12]; -- uint64_t br_lba; -- uint32_t scp_data_len; -- uint8_t reserved6[260]; -- uint8_t scp_data[]; --} __attribute__ ((packed)); --typedef struct IplBlockFcp IplBlockFcp; -- --struct IplBlockQemuScsi { -- uint32_t lun; -- uint16_t target; -- uint16_t channel; -- uint8_t reserved0[77]; -- uint8_t ssid; -- uint16_t devno; --} __attribute__ ((packed)); --typedef struct IplBlockQemuScsi IplBlockQemuScsi; -- --struct IplParameterBlock { -- uint32_t len; -- uint8_t reserved0[3]; -- uint8_t version; -- uint32_t blk0_len; -- uint8_t pbt; -- uint8_t flags; -- uint16_t reserved01; -- uint8_t loadparm[LOADPARM_LEN]; -- union { -- IplBlockCcw ccw; -- IplBlockFcp fcp; -- IplBlockQemuScsi scsi; -- }; --} __attribute__ ((packed)); --typedef struct IplParameterBlock IplParameterBlock; -- --extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); -- --#define QIPL_ADDRESS 0xcc -- --/* Boot Menu flags */ --#define QIPL_FLAG_BM_OPTS_CMD 0x80 --#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 -- --/* -- * This definition must be kept in sync with the definition -- * in hw/s390x/ipl.h -- */ --struct QemuIplParameters { -- uint8_t qipl_flags; -- uint8_t reserved1[3]; -- uint64_t reserved2; -- uint32_t boot_menu_timeout; -- uint8_t reserved3[12]; --} __attribute__ ((packed)); --typedef struct QemuIplParameters QemuIplParameters; -+#include - - extern QemuIplParameters qipl; -+extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); - - #define S390_IPL_TYPE_FCP 0x00 - #define S390_IPL_TYPE_CCW 0x02 --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch b/images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch deleted file mode 100644 index 5432fd33a..000000000 --- a/images/qemu-artifact/patches/kvm-kvm-Allow-kvm_arch_get-put_registers-to-accept-Error.patch +++ /dev/null @@ -1,287 +0,0 @@ -From 07a472e19f11c6364e787e71c95c990b76aaf187 Mon Sep 17 00:00:00 2001 -From: Julia Suvorova -Date: Fri, 27 Sep 2024 12:47:40 +0200 -Subject: [PATCH 26/27] kvm: Allow kvm_arch_get/put_registers to accept Error** - -RH-Author: Julia Suvorova -RH-MergeRequest: 286: kvm: Allow kvm_arch_get/put_registers to accept Error** -RH-Jira: RHEL-60914 -RH-Acked-by: Juraj Marcin -RH-Acked-by: Peter Xu -RH-Commit: [1/2] 2ab30f24245a52c4254a5b9238b1b2e966a8c6a2 - -This is necessary to provide discernible error messages to the caller. - -Signed-off-by: Julia Suvorova -Reviewed-by: Peter Xu -Link: https://lore.kernel.org/r/20240927104743.218468-2-jusual@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit a1676bb3047f28b292ecbce3a378ccc0b4721d47) ---- - accel/kvm/kvm-all.c | 41 +++++++++++++++++++++++++++++--------- - include/sysemu/kvm.h | 4 ++-- - target/arm/kvm.c | 4 ++-- - target/i386/kvm/kvm.c | 4 ++-- - target/loongarch/kvm/kvm.c | 4 ++-- - target/mips/kvm.c | 4 ++-- - target/ppc/kvm.c | 4 ++-- - target/riscv/kvm/kvm-cpu.c | 4 ++-- - target/s390x/kvm/kvm.c | 4 ++-- - 9 files changed, 48 insertions(+), 25 deletions(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index 75d11a07b2..a220178822 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -2766,9 +2766,15 @@ void kvm_flush_coalesced_mmio_buffer(void) - static void do_kvm_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg) - { - if (!cpu->vcpu_dirty && !kvm_state->guest_state_protected) { -- int ret = kvm_arch_get_registers(cpu); -+ Error *err = NULL; -+ int ret = kvm_arch_get_registers(cpu, &err); - if (ret) { -- error_report("Failed to get registers: %s", strerror(-ret)); -+ if (err) { -+ error_reportf_err(err, "Failed to synchronize CPU state: "); -+ } else { -+ error_report("Failed to get registers: %s", strerror(-ret)); -+ } -+ - cpu_dump_state(cpu, stderr, CPU_DUMP_CODE); - vm_stop(RUN_STATE_INTERNAL_ERROR); - } -@@ -2786,9 +2792,15 @@ void kvm_cpu_synchronize_state(CPUState *cpu) - - static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg) - { -- int ret = kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE); -+ Error *err = NULL; -+ int ret = kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE, &err); - if (ret) { -- error_report("Failed to put registers after reset: %s", strerror(-ret)); -+ if (err) { -+ error_reportf_err(err, "Restoring resisters after reset: "); -+ } else { -+ error_report("Failed to put registers after reset: %s", -+ strerror(-ret)); -+ } - cpu_dump_state(cpu, stderr, CPU_DUMP_CODE); - vm_stop(RUN_STATE_INTERNAL_ERROR); - } -@@ -2803,9 +2815,15 @@ void kvm_cpu_synchronize_post_reset(CPUState *cpu) - - static void do_kvm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) - { -- int ret = kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE); -+ Error *err = NULL; -+ int ret = kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE, &err); - if (ret) { -- error_report("Failed to put registers after init: %s", strerror(-ret)); -+ if (err) { -+ error_reportf_err(err, "Putting registers after init: "); -+ } else { -+ error_report("Failed to put registers after init: %s", -+ strerror(-ret)); -+ } - exit(1); - } - -@@ -2995,10 +3013,15 @@ int kvm_cpu_exec(CPUState *cpu) - MemTxAttrs attrs; - - if (cpu->vcpu_dirty) { -- ret = kvm_arch_put_registers(cpu, KVM_PUT_RUNTIME_STATE); -+ Error *err = NULL; -+ ret = kvm_arch_put_registers(cpu, KVM_PUT_RUNTIME_STATE, &err); - if (ret) { -- error_report("Failed to put registers after init: %s", -- strerror(-ret)); -+ if (err) { -+ error_reportf_err(err, "Putting registers after init: "); -+ } else { -+ error_report("Failed to put registers after init: %s", -+ strerror(-ret)); -+ } - ret = -1; - break; - } -diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h -index 9cf14ca3d5..d9ad723f78 100644 ---- a/include/sysemu/kvm.h -+++ b/include/sysemu/kvm.h -@@ -359,7 +359,7 @@ int kvm_arch_handle_exit(CPUState *cpu, struct kvm_run *run); - - int kvm_arch_process_async_events(CPUState *cpu); - --int kvm_arch_get_registers(CPUState *cpu); -+int kvm_arch_get_registers(CPUState *cpu, Error **errp); - - /* state subset only touched by the VCPU itself during runtime */ - #define KVM_PUT_RUNTIME_STATE 1 -@@ -368,7 +368,7 @@ int kvm_arch_get_registers(CPUState *cpu); - /* full state set, modified during initialization or on vmload */ - #define KVM_PUT_FULL_STATE 3 - --int kvm_arch_put_registers(CPUState *cpu, int level); -+int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp); - - int kvm_arch_get_default_type(MachineState *ms); - -diff --git a/target/arm/kvm.c b/target/arm/kvm.c -index 849e2e21b3..f1f1b5b375 100644 ---- a/target/arm/kvm.c -+++ b/target/arm/kvm.c -@@ -2042,7 +2042,7 @@ static int kvm_arch_put_sve(CPUState *cs) - return 0; - } - --int kvm_arch_put_registers(CPUState *cs, int level) -+int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) - { - uint64_t val; - uint32_t fpr; -@@ -2226,7 +2226,7 @@ static int kvm_arch_get_sve(CPUState *cs) - return 0; - } - --int kvm_arch_get_registers(CPUState *cs) -+int kvm_arch_get_registers(CPUState *cs, Error **errp) - { - uint64_t val; - unsigned int el; -diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c -index 2b28c18693..423e6922d8 100644 ---- a/target/i386/kvm/kvm.c -+++ b/target/i386/kvm/kvm.c -@@ -5121,7 +5121,7 @@ static int kvm_get_nested_state(X86CPU *cpu) - return ret; - } - --int kvm_arch_put_registers(CPUState *cpu, int level) -+int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) - { - X86CPU *x86_cpu = X86_CPU(cpu); - int ret; -@@ -5209,7 +5209,7 @@ int kvm_arch_put_registers(CPUState *cpu, int level) - return 0; - } - --int kvm_arch_get_registers(CPUState *cs) -+int kvm_arch_get_registers(CPUState *cs, Error **errp) - { - X86CPU *cpu = X86_CPU(cs); - int ret; -diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c -index e1be6a6959..9204d4295d 100644 ---- a/target/loongarch/kvm/kvm.c -+++ b/target/loongarch/kvm/kvm.c -@@ -585,7 +585,7 @@ static int kvm_loongarch_put_cpucfg(CPUState *cs) - return ret; - } - --int kvm_arch_get_registers(CPUState *cs) -+int kvm_arch_get_registers(CPUState *cs, Error **errp) - { - int ret; - -@@ -613,7 +613,7 @@ int kvm_arch_get_registers(CPUState *cs) - return ret; - } - --int kvm_arch_put_registers(CPUState *cs, int level) -+int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) - { - int ret; - -diff --git a/target/mips/kvm.c b/target/mips/kvm.c -index a631ab544f..a98798c669 100644 ---- a/target/mips/kvm.c -+++ b/target/mips/kvm.c -@@ -1172,7 +1172,7 @@ static int kvm_mips_get_cp0_registers(CPUState *cs) - return ret; - } - --int kvm_arch_put_registers(CPUState *cs, int level) -+int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) - { - CPUMIPSState *env = cpu_env(cs); - struct kvm_regs regs; -@@ -1207,7 +1207,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) - return ret; - } - --int kvm_arch_get_registers(CPUState *cs) -+int kvm_arch_get_registers(CPUState *cs, Error **errp) - { - CPUMIPSState *env = cpu_env(cs); - int ret = 0; -diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c -index c942ff55b2..7daa097164 100644 ---- a/target/ppc/kvm.c -+++ b/target/ppc/kvm.c -@@ -902,7 +902,7 @@ int kvmppc_put_books_sregs(PowerPCCPU *cpu) - return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_SREGS, &sregs); - } - --int kvm_arch_put_registers(CPUState *cs, int level) -+int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) - { - PowerPCCPU *cpu = POWERPC_CPU(cs); - CPUPPCState *env = &cpu->env; -@@ -1207,7 +1207,7 @@ static int kvmppc_get_books_sregs(PowerPCCPU *cpu) - return 0; - } - --int kvm_arch_get_registers(CPUState *cs) -+int kvm_arch_get_registers(CPUState *cs, Error **errp) - { - PowerPCCPU *cpu = POWERPC_CPU(cs); - CPUPPCState *env = &cpu->env; -diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c -index f6e3156b8d..2bfb112be0 100644 ---- a/target/riscv/kvm/kvm-cpu.c -+++ b/target/riscv/kvm/kvm-cpu.c -@@ -1192,7 +1192,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { - KVM_CAP_LAST_INFO - }; - --int kvm_arch_get_registers(CPUState *cs) -+int kvm_arch_get_registers(CPUState *cs, Error **errp) - { - int ret = 0; - -@@ -1237,7 +1237,7 @@ int kvm_riscv_sync_mpstate_to_kvm(RISCVCPU *cpu, int state) - return 0; - } - --int kvm_arch_put_registers(CPUState *cs, int level) -+int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) - { - int ret = 0; - -diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c -index 45c23758e7..0d51a4ea6b 100644 ---- a/target/s390x/kvm/kvm.c -+++ b/target/s390x/kvm/kvm.c -@@ -472,7 +472,7 @@ static int can_sync_regs(CPUState *cs, int regs) - #define KVM_SYNC_REQUIRED_REGS (KVM_SYNC_GPRS | KVM_SYNC_ACRS | \ - KVM_SYNC_CRS | KVM_SYNC_PREFIX) - --int kvm_arch_put_registers(CPUState *cs, int level) -+int kvm_arch_put_registers(CPUState *cs, int level, Error **errp) - { - CPUS390XState *env = cpu_env(cs); - struct kvm_fpu fpu = {}; -@@ -598,7 +598,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) - return 0; - } - --int kvm_arch_get_registers(CPUState *cs) -+int kvm_arch_get_registers(CPUState *cs, Error **errp) - { - CPUS390XState *env = cpu_env(cs); - struct kvm_fpu fpu; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch b/images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch deleted file mode 100644 index b4ed91786..000000000 --- a/images/qemu-artifact/patches/kvm-kvm-refactor-core-virtual-machine-creation-into-its-.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 90a18a9e2e585413eba96ab96df4a878f6c405be Mon Sep 17 00:00:00 2001 -From: Ani Sinha -Date: Thu, 8 Aug 2024 17:08:38 +0530 -Subject: [PATCH 3/9] kvm: refactor core virtual machine creation into its own - function - -RH-Author: Peter Xu -RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array -RH-Jira: RHEL-57682 -RH-Acked-by: Juraj Marcin -RH-Commit: [2/7] 3db75ee31b109048ef2de5c7f193116ab8c185a7 (peterx/qemu-kvm) - -Refactoring the core logic around KVM_CREATE_VM into its own separate function -so that it can be called from other functions in subsequent patches. There is -no functional change in this patch. - -CC: pbonzini@redhat.com -CC: zhao1.liu@intel.com -Signed-off-by: Ani Sinha -Link: https://lore.kernel.org/r/20240808113838.1697366-1-anisinha@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit 67388078da1cf6dac89e5a7c748cca3444d49690) -Signed-off-by: Peter Xu ---- - accel/kvm/kvm-all.c | 89 ++++++++++++++++++++++++++++----------------- - 1 file changed, 56 insertions(+), 33 deletions(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index b51441523d..4f96d8b45e 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -2385,6 +2385,60 @@ uint32_t kvm_dirty_ring_size(void) - return kvm_state->kvm_dirty_ring_size; - } - -+static int do_kvm_create_vm(MachineState *ms, int type) -+{ -+ KVMState *s; -+ int ret; -+ -+ s = KVM_STATE(ms->accelerator); -+ -+ do { -+ ret = kvm_ioctl(s, KVM_CREATE_VM, type); -+ } while (ret == -EINTR); -+ -+ if (ret < 0) { -+ error_report("ioctl(KVM_CREATE_VM) failed: %s", strerror(-ret)); -+ -+#ifdef TARGET_S390X -+ if (ret == -EINVAL) { -+ error_printf("Host kernel setup problem detected." -+ " Please verify:\n"); -+ error_printf("- for kernels supporting the" -+ " switch_amode or user_mode parameters, whether"); -+ error_printf(" user space is running in primary address space\n"); -+ error_printf("- for kernels supporting the vm.allocate_pgste" -+ " sysctl, whether it is enabled\n"); -+ } -+#elif defined(TARGET_PPC) -+ if (ret == -EINVAL) { -+ error_printf("PPC KVM module is not loaded. Try modprobe kvm_%s.\n", -+ (type == 2) ? "pr" : "hv"); -+ } -+#endif -+ } -+ -+ return ret; -+} -+ -+static int find_kvm_machine_type(MachineState *ms) -+{ -+ MachineClass *mc = MACHINE_GET_CLASS(ms); -+ int type; -+ -+ if (object_property_find(OBJECT(current_machine), "kvm-type")) { -+ g_autofree char *kvm_type; -+ kvm_type = object_property_get_str(OBJECT(current_machine), -+ "kvm-type", -+ &error_abort); -+ type = mc->kvm_type(ms, kvm_type); -+ } else if (mc->kvm_type) { -+ type = mc->kvm_type(ms, NULL); -+ } else { -+ type = kvm_arch_get_default_type(ms); -+ } -+ return type; -+} -+ - static int kvm_init(MachineState *ms) - { - MachineClass *mc = MACHINE_GET_CLASS(ms); -@@ -2467,45 +2521,14 @@ static int kvm_init(MachineState *ms) - } - s->as = g_new0(struct KVMAs, s->nr_as); - -- if (object_property_find(OBJECT(current_machine), "kvm-type")) { -- g_autofree char *kvm_type = object_property_get_str(OBJECT(current_machine), -- "kvm-type", -- &error_abort); -- type = mc->kvm_type(ms, kvm_type); -- } else if (mc->kvm_type) { -- type = mc->kvm_type(ms, NULL); -- } else { -- type = kvm_arch_get_default_type(ms); -- } -- -+ type = find_kvm_machine_type(ms); - if (type < 0) { - ret = -EINVAL; - goto err; - } - -- do { -- ret = kvm_ioctl(s, KVM_CREATE_VM, type); -- } while (ret == -EINTR); -- -+ ret = do_kvm_create_vm(ms, type); - if (ret < 0) { -- error_report("ioctl(KVM_CREATE_VM) failed: %s", strerror(-ret)); -- --#ifdef TARGET_S390X -- if (ret == -EINVAL) { -- error_printf("Host kernel setup problem detected." -- " Please verify:\n"); -- error_printf("- for kernels supporting the" -- " switch_amode or user_mode parameters, whether"); -- error_printf(" user space is running in primary address space\n"); -- error_printf("- for kernels supporting the vm.allocate_pgste" -- " sysctl, whether it is enabled\n"); -- } --#elif defined(TARGET_PPC) -- if (ret == -EINVAL) { -- error_printf("PPC KVM module is not loaded. Try modprobe kvm_%s.\n", -- (type == 2) ? "pr" : "hv"); -- } --#endif - goto err; - } - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch b/images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch deleted file mode 100644 index 3ebe06d55..000000000 --- a/images/qemu-artifact/patches/kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 66c634c4749d58c0c3644ace27a656c507433288 Mon Sep 17 00:00:00 2001 -From: Ani Sinha -Date: Wed, 28 Aug 2024 18:15:39 +0530 -Subject: [PATCH 2/9] kvm: replace fprintf with error_report()/printf() in - kvm_init() - -RH-Author: Peter Xu -RH-MergeRequest: 284: KVM: Dynamic sized kvm memslots array -RH-Jira: RHEL-57682 -RH-Acked-by: Juraj Marcin -RH-Commit: [1/7] 3dd0b67d3b6662001eb35201ca41b15d0dd97994 (peterx/qemu-kvm) - -error_report() is more appropriate for error situations. Replace fprintf with -error_report() and error_printf() as appropriate. Some improvement in error -reporting also happens as a part of this change. For example: - -From: -$ ./qemu-system-x86_64 --accel kvm -Could not access KVM kernel module: No such file or directory - -To: -$ ./qemu-system-x86_64 --accel kvm -qemu-system-x86_64: --accel kvm: Could not access KVM kernel module: No such file or directory - -CC: qemu-trivial@nongnu.org -CC: zhao1.liu@intel.com -CC: armbru@redhat.com -Reviewed-by: Zhao Liu -Reviewed-by: Markus Armbruster -Signed-off-by: Ani Sinha -Link: https://lore.kernel.org/r/20240828124539.62672-1-anisinha@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit 804dfbe3ef5e950328b162ae85741be2e228544f) -Signed-off-by: Peter Xu ---- - accel/kvm/kvm-all.c | 40 ++++++++++++++++++---------------------- - 1 file changed, 18 insertions(+), 22 deletions(-) - -diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c -index a220178822..b51441523d 100644 ---- a/accel/kvm/kvm-all.c -+++ b/accel/kvm/kvm-all.c -@@ -2427,7 +2427,7 @@ static int kvm_init(MachineState *ms) - QLIST_INIT(&s->kvm_parked_vcpus); - s->fd = qemu_open_old(s->device ?: "/dev/kvm", O_RDWR); - if (s->fd == -1) { -- fprintf(stderr, "Could not access KVM kernel module: %m\n"); -+ error_report("Could not access KVM kernel module: %m"); - ret = -errno; - goto err; - } -@@ -2437,13 +2437,13 @@ static int kvm_init(MachineState *ms) - if (ret >= 0) { - ret = -EINVAL; - } -- fprintf(stderr, "kvm version too old\n"); -+ error_report("kvm version too old"); - goto err; - } - - if (ret > KVM_API_VERSION) { - ret = -EINVAL; -- fprintf(stderr, "kvm version not supported\n"); -+ error_report("kvm version not supported"); - goto err; - } - -@@ -2488,26 +2488,22 @@ static int kvm_init(MachineState *ms) - } while (ret == -EINTR); - - if (ret < 0) { -- fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -ret, -- strerror(-ret)); -+ error_report("ioctl(KVM_CREATE_VM) failed: %s", strerror(-ret)); - - #ifdef TARGET_S390X - if (ret == -EINVAL) { -- fprintf(stderr, -- "Host kernel setup problem detected. Please verify:\n"); -- fprintf(stderr, "- for kernels supporting the switch_amode or" -- " user_mode parameters, whether\n"); -- fprintf(stderr, -- " user space is running in primary address space\n"); -- fprintf(stderr, -- "- for kernels supporting the vm.allocate_pgste sysctl, " -- "whether it is enabled\n"); -+ error_printf("Host kernel setup problem detected." -+ " Please verify:\n"); -+ error_printf("- for kernels supporting the" -+ " switch_amode or user_mode parameters, whether"); -+ error_printf(" user space is running in primary address space\n"); -+ error_printf("- for kernels supporting the vm.allocate_pgste" -+ " sysctl, whether it is enabled\n"); - } - #elif defined(TARGET_PPC) - if (ret == -EINVAL) { -- fprintf(stderr, -- "PPC KVM module is not loaded. Try modprobe kvm_%s.\n", -- (type == 2) ? "pr" : "hv"); -+ error_printf("PPC KVM module is not loaded. Try modprobe kvm_%s.\n", -+ (type == 2) ? "pr" : "hv"); - } - #endif - goto err; -@@ -2526,9 +2522,9 @@ static int kvm_init(MachineState *ms) - nc->name, nc->num, soft_vcpus_limit); - - if (nc->num > hard_vcpus_limit) { -- fprintf(stderr, "Number of %s cpus requested (%d) exceeds " -- "the maximum cpus supported by KVM (%d)\n", -- nc->name, nc->num, hard_vcpus_limit); -+ error_report("Number of %s cpus requested (%d) exceeds " -+ "the maximum cpus supported by KVM (%d)", -+ nc->name, nc->num, hard_vcpus_limit); - exit(1); - } - } -@@ -2542,8 +2538,8 @@ static int kvm_init(MachineState *ms) - } - if (missing_cap) { - ret = -EINVAL; -- fprintf(stderr, "kvm does not support %s\n%s", -- missing_cap->name, upgrade_note); -+ error_report("kvm does not support %s", missing_cap->name); -+ error_printf("%s", upgrade_note); - goto err; - } - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch b/images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch deleted file mode 100644 index 45c09e0a5..000000000 --- a/images/qemu-artifact/patches/kvm-migration-Allow-pipes-to-keep-working-for-fd-migrati.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 090cdb81ce6913f1c5989853d0af0dbb2f1d3f9f Mon Sep 17 00:00:00 2001 -From: Peter Xu -Date: Wed, 20 Nov 2024 11:01:32 -0500 -Subject: [PATCH] migration: Allow pipes to keep working for fd migrations -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Peter Xu -RH-MergeRequest: 301: migration: Allow pipes to keep working for fd migrations -RH-Jira: RHEL-66089 -RH-Acked-by: Juraj Marcin -RH-Acked-by: Miroslav Rezanina -RH-Commit: [1/1] 8b62be63720f81e9d1633844917ab6992d99566f (peterx/qemu-kvm) - -Libvirt may still use pipes for old file migrations in fd: URI form, -especially when loading old images dumped from Libvirt's compression -algorithms. - -In that case, Libvirt needs to compress / uncompress the images on its own -over the migration binary stream, and pipes are passed over to QEMU for -outgoing / incoming migrations in "fd:" URIs. - -For future such use case, it should be suggested to use mapped-ram when -saving such VM image. However there can still be old images that was -compressed in such way, so libvirt needs to be able to load those images, -uncompress them and use the same pipe mechanism to pass that over to QEMU. - -It means, even if new file migrations can be gradually moved over to -mapped-ram (after Libvirt start supporting it), Libvirt still needs the -uncompressor for the old images to be able to load like before. - -Meanwhile since Libvirt currently exposes the compression capability to -guest images, it may needs its own lifecycle management to move that over -to mapped-ram, maybe can be done after mapped-ram saved the image, however -Dan and PeterK raised concern on temporary double disk space consumption. -I suppose for now the easiest is to enable pipes for both sides of "fd:" -migrations, until all things figured out from Libvirt side on how to move -on. - -And for "channels" QMP interface support on "migrate" / "migrate-incoming" -commands, we'll also need to move away from pipe. But let's leave that for -later too. - -So far, still allow pipes to happen like before on both save/load sides, -just like we would allow sockets to pass. - -Cc: qemu-stable -Cc: Fabiano Rosas -Cc: Peter Krempa -Cc: Daniel P. Berrangé -Fixes: c55deb860c ("migration: Deprecate fd: for file migration") -Reviewed-by: Fabiano Rosas -Link: https://lore.kernel.org/r/20241120160132.3659735-1-peterx@redhat.com -Signed-off-by: Peter Xu -(cherry picked from commit 87ae45e602e2943d58509e470e3a1d4ba084ab2f) -Signed-off-by: Peter Xu ---- - migration/fd.c | 27 +++++++++++++++++++++++++-- - 1 file changed, 25 insertions(+), 2 deletions(-) - -diff --git a/migration/fd.c b/migration/fd.c -index aab5189eac..9bf9be6acb 100644 ---- a/migration/fd.c -+++ b/migration/fd.c -@@ -25,6 +25,29 @@ - #include "io/channel-util.h" - #include "trace.h" - -+static bool fd_is_pipe(int fd) -+{ -+ struct stat statbuf; -+ -+ if (fstat(fd, &statbuf) == -1) { -+ return false; -+ } -+ -+ return S_ISFIFO(statbuf.st_mode); -+} -+ -+static bool migration_fd_valid(int fd) -+{ -+ if (fd_is_socket(fd)) { -+ return true; -+ } -+ -+ if (fd_is_pipe(fd)) { -+ return true; -+ } -+ -+ return false; -+} - - void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp) - { -@@ -34,7 +57,7 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error ** - return; - } - -- if (!fd_is_socket(fd)) { -+ if (!migration_fd_valid(fd)) { - warn_report("fd: migration to a file is deprecated." - " Use file: instead."); - } -@@ -68,7 +91,7 @@ void fd_start_incoming_migration(const char *fdname, Error **errp) - return; - } - -- if (!fd_is_socket(fd)) { -+ if (!migration_fd_valid(fd)) { - warn_report("fd: migration to a file is deprecated." - " Use file: instead."); - } --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch b/images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch deleted file mode 100644 index 6493c3e98..000000000 --- a/images/qemu-artifact/patches/kvm-migration-Ensure-vmstate_save-sets-errp.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 91f67a47a3fd31be578988d7ac11bb814314ec5a Mon Sep 17 00:00:00 2001 -From: Hanna Czenczek -Date: Tue, 15 Oct 2024 19:04:37 +0200 -Subject: [PATCH] migration: Ensure vmstate_save() sets errp - -RH-Author: Hanna Czenczek -RH-MergeRequest: 295: migration: Ensure vmstate_save() sets errp -RH-Jira: RHEL-67844 -RH-Acked-by: Stefano Garzarella -RH-Acked-by: Jon Maloy -RH-Commit: [1/1] df65f254fa6bf241b1fd4f4d2101f137d2a6e44b (hreitz/qemu-kvm-c-9-s) - -migration/savevm.c contains some calls to vmstate_save() that are -followed by migrate_set_error() if the integer return value indicates an -error. migrate_set_error() requires that the `Error *` object passed to -it is set. Therefore, vmstate_save() is assumed to always set *errp on -error. - -Right now, that assumption is not met: vmstate_save_state_v() (called -internally by vmstate_save()) will not set *errp if -vmstate_subsection_save() or vmsd->post_save() fail. Fix that by adding -an *errp parameter to vmstate_subsection_save(), and by generating a -generic error in case post_save() fails (as is already done for -pre_save()). - -Without this patch, qemu will crash after vmstate_subsection_save() or -post_save() have failed inside of a vmstate_save() call (unless -migrate_set_error() then happen to discard the new error because -s->error is already set). This happens e.g. when receiving the state -from a virtio-fs back-end (virtiofsd) fails. - -Signed-off-by: Hanna Czenczek -Link: https://lore.kernel.org/r/20241015170437.310358-1-hreitz@redhat.com -Signed-off-by: Peter Xu -(cherry picked from commit 37dfcba1a04989830c706f9cbc00450e5d3a7447) -Signed-off-by: Hanna Czenczek ---- - migration/vmstate.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/migration/vmstate.c b/migration/vmstate.c -index ef26f26ccd..d19b42630a 100644 ---- a/migration/vmstate.c -+++ b/migration/vmstate.c -@@ -22,7 +22,8 @@ - #include "trace.h" - - static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, -- void *opaque, JSONWriter *vmdesc); -+ void *opaque, JSONWriter *vmdesc, -+ Error **errp); - static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, - void *opaque); - -@@ -440,12 +441,13 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, - json_writer_end_array(vmdesc); - } - -- ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc); -+ ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc, errp); - - if (vmsd->post_save) { - int ps_ret = vmsd->post_save(opaque); -- if (!ret) { -+ if (!ret && ps_ret) { - ret = ps_ret; -+ error_setg(errp, "post-save failed: %s", vmsd->name); - } - } - return ret; -@@ -517,7 +519,8 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, - } - - static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, -- void *opaque, JSONWriter *vmdesc) -+ void *opaque, JSONWriter *vmdesc, -+ Error **errp) - { - const VMStateDescription * const *sub = vmsd->subsections; - bool vmdesc_has_subsections = false; -@@ -545,7 +548,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, - qemu_put_byte(f, len); - qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len); - qemu_put_be32(f, vmsdsub->version_id); -- ret = vmstate_save_state(f, vmsdsub, opaque, vmdesc); -+ ret = vmstate_save_state_with_err(f, vmsdsub, opaque, vmdesc, errp); - if (ret) { - return ret; - } --- -2.45.1 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch deleted file mode 100644 index 83c0a3c23..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Clarify-alignment-is-in-bytes.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 77dab9f12b3c4cdaacea1dff687cf1c49e95f304 Mon Sep 17 00:00:00 2001 -From: Jens Remus -Date: Tue, 1 Oct 2024 17:36:16 +0200 -Subject: [PATCH 21/27] pc-bios/s390-ccw: Clarify alignment is in bytes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [21/23] d00be9e7c87cb047d20b729f2ac539fe624f5ce0 (thuth/qemu-kvm-cs9) - -The assembler directive .align [1] has architecture-dependent behavior, -which may be ambiguous for the reader. Some architectures perform the -alignment in bytes, others in power of two. s390 does in bytes. - -Use the directive .balign [2] instead, to clarify that the alignment -request is in bytes. No functional change. - -[1] https://sourceware.org/binutils/docs/as/Align.html -[2] https://sourceware.org/binutils/docs/as/Balign.html - -Signed-off-by: Jens Remus -Reviewed-by: Marc Hartmayer -Message-ID: <20241001153618.17791-2-mhartmay@linux.ibm.com> -Reviewed-by: Thomas Huth -Signed-off-by: Thomas Huth -(cherry picked from commit c58df213af7ec8924d219025a593b8f3ac475f16) ---- - pc-bios/s390-ccw/start.S | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S -index 061b06591c..576fc12c06 100644 ---- a/pc-bios/s390-ccw/start.S -+++ b/pc-bios/s390-ccw/start.S -@@ -112,7 +112,7 @@ io_new_code: - lctlg %c6,%c6,0(%r15) - br %r14 - -- .align 8 -+ .balign 8 - bss_start_literal: - .quad __bss_start - disabled_wait_psw: -@@ -125,7 +125,7 @@ io_new_mask: - .quad 0x0000000180000000 - - .bss -- .align 8 -+ .balign 8 - stack: - .space STACK_SIZE - .size stack,STACK_SIZE --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch deleted file mode 100644 index 95d42fcfc..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Don-t-generate-TEXTRELs.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 7a5f9ea3bb8ff78bd93eb2cee9b8be876e745346 Mon Sep 17 00:00:00 2001 -From: Jens Remus -Date: Tue, 1 Oct 2024 17:36:17 +0200 -Subject: [PATCH 22/27] pc-bios/s390-ccw: Don't generate TEXTRELs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [22/23] 8d8b2959be6c798f24e1991252fe6c680a6c6025 (thuth/qemu-kvm-cs9) - -Commit 7cd50cbe4ca3 ("pc-bios/s390-ccw: Don't use __bss_start with the -"larl" instruction") introduced the address constant bss_start_literal -for __bss_start in the .text section, which introduced a relocation in -code (i.e. TEXTREL). The dedicated constant is required, as __bss_start -may not necessarily be aligned on a 2-byte boundary (see subject commit -for details). - -Move the constant to the .data section to get rid of the relocation in -the .text section. Add the linker option -z text to prevent TEXTRELs to -get introduced in the future. - -Note that the R_390_RELATIVE relocations are taken care of by function -glue() in include/hw/elf_ops.h.inc introduced by commit 5dce07e1cb67 -("elf-loader: Provide the possibility to relocate s390 ELF files"). - -Reported-by: Marc Hartmayer -Signed-off-by: Jens Remus -Reviewed-by: Marc Hartmayer -Message-ID: <20241001153618.17791-3-mhartmay@linux.ibm.com> -Reviewed-by: Thomas Huth -Signed-off-by: Thomas Huth -(cherry picked from commit 3259b4424a85d9cdfd1a33ed6030a6c51c1b9b8b) ---- - pc-bios/s390-ccw/Makefile | 2 +- - pc-bios/s390-ccw/start.S | 7 +++++-- - 2 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile -index db9e8f0892..38254e22df 100644 ---- a/pc-bios/s390-ccw/Makefile -+++ b/pc-bios/s390-ccw/Makefile -@@ -46,7 +46,7 @@ EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables - EXTRA_CFLAGS += -msoft-float - EXTRA_CFLAGS += -std=gnu99 - EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) --LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -+LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text - - cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null - cc-option = if $(call cc-test, $1); then \ -diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S -index 576fc12c06..b70213e412 100644 ---- a/pc-bios/s390-ccw/start.S -+++ b/pc-bios/s390-ccw/start.S -@@ -113,8 +113,6 @@ io_new_code: - br %r14 - - .balign 8 --bss_start_literal: -- .quad __bss_start - disabled_wait_psw: - .quad 0x0002000180000000,0x0000000000000000 - enabled_wait_psw: -@@ -124,6 +122,11 @@ external_new_mask: - io_new_mask: - .quad 0x0000000180000000 - -+.data -+ .balign 8 -+bss_start_literal: -+ .quad __bss_start -+ - .bss - .balign 8 - stack: --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch deleted file mode 100644 index b513e7d8a..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Enable-failed-IPL-to-return-after-e.patch +++ /dev/null @@ -1,426 +0,0 @@ -From 41a56360a0f4124252180132e28c166792ee8853 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:46 -0400 -Subject: [PATCH 13/27] pc-bios/s390-ccw: Enable failed IPL to return after - error -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [13/23] c86e8a72a631081348e88ac1df99c2eec8ca27dd (thuth/qemu-kvm-cs9) - -Remove panic-on-error from IPL functions such that a return code is propagated -back to the main IPL calling function (rather than terminating immediately), -which facilitates possible error recovery in the future. - -A select few panics remain, which indicate fatal non-devices errors that must -result in termination. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-13-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 0181e23713114fd4c33326c3372aaf48dcfb412a) ---- - pc-bios/s390-ccw/bootmap.c | 53 ++++++++++++++++++-------- - pc-bios/s390-ccw/cio.c | 3 +- - pc-bios/s390-ccw/jump2ipl.c | 5 ++- - pc-bios/s390-ccw/main.c | 32 +++++++++------- - pc-bios/s390-ccw/s390-ccw.h | 2 +- - pc-bios/s390-ccw/virtio-blkdev.c | 2 +- - pc-bios/s390-ccw/virtio.c | 65 +++++++++++++++++++++----------- - pc-bios/s390-ccw/virtio.h | 2 +- - 8 files changed, 108 insertions(+), 56 deletions(-) - -diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c -index 95ef9104d0..56f2f75640 100644 ---- a/pc-bios/s390-ccw/bootmap.c -+++ b/pc-bios/s390-ccw/bootmap.c -@@ -62,15 +62,34 @@ static void *s2_prev_blk = _s2; - static void *s2_cur_blk = _s2 + MAX_SECTOR_SIZE; - static void *s2_next_blk = _s2 + MAX_SECTOR_SIZE * 2; - --static inline void verify_boot_info(BootInfo *bip) -+static inline int verify_boot_info(BootInfo *bip) - { -- IPL_assert(magic_match(bip->magic, ZIPL_MAGIC), "No zIPL sig in BootInfo"); -- IPL_assert(bip->version == BOOT_INFO_VERSION, "Wrong zIPL version"); -- IPL_assert(bip->bp_type == BOOT_INFO_BP_TYPE_IPL, "DASD is not for IPL"); -- IPL_assert(bip->dev_type == BOOT_INFO_DEV_TYPE_ECKD, "DASD is not ECKD"); -- IPL_assert(bip->flags == BOOT_INFO_FLAGS_ARCH, "Not for this arch"); -- IPL_assert(block_size_ok(bip->bp.ipl.bm_ptr.eckd.bptr.size), -- "Bad block size in zIPL section of the 1st record."); -+ if (!magic_match(bip->magic, ZIPL_MAGIC)) { -+ puts("No zIPL sig in BootInfo"); -+ return -EINVAL; -+ } -+ if (bip->version != BOOT_INFO_VERSION) { -+ puts("Wrong zIPL version"); -+ return -EINVAL; -+ } -+ if (bip->bp_type != BOOT_INFO_BP_TYPE_IPL) { -+ puts("DASD is not for IPL"); -+ return -ENODEV; -+ } -+ if (bip->dev_type != BOOT_INFO_DEV_TYPE_ECKD) { -+ puts("DASD is not ECKD"); -+ return -ENODEV; -+ } -+ if (bip->flags != BOOT_INFO_FLAGS_ARCH) { -+ puts("Not for this arch"); -+ return -EINVAL; -+ } -+ if (!block_size_ok(bip->bp.ipl.bm_ptr.eckd.bptr.size)) { -+ puts("Bad block size in zIPL section of 1st record"); -+ return -EINVAL; -+ } -+ -+ return 0; - } - - static void eckd_format_chs(ExtEckdBlockPtr *ptr, bool ldipl, -@@ -367,8 +386,8 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr, - puts("Unknown script entry type"); - return -EINVAL; - } -- write_reset_psw(bms->entry[i].address.load_address); /* no return */ -- jump_to_IPL_code(0); /* no return */ -+ write_reset_psw(bms->entry[i].address.load_address); -+ jump_to_IPL_code(0); - return -1; - } - -@@ -1067,16 +1086,19 @@ void zipl_load(void) - - if (vdev->is_cdrom) { - ipl_iso_el_torito(); -- panic("\n! Cannot IPL this ISO image !\n"); -+ puts("Failed to IPL this ISO image!"); -+ return; - } - - if (virtio_get_device_type() == VIRTIO_ID_NET) { - netmain(); -- panic("\n! Cannot IPL from this network !\n"); -+ puts("Failed to IPL from this network!"); -+ return; - } - - if (ipl_scsi()) { -- panic("\n! Cannot IPL this SCSI device !\n"); -+ puts("Failed to IPL from this SCSI device!"); -+ return; - } - - switch (virtio_get_device_type()) { -@@ -1087,8 +1109,9 @@ void zipl_load(void) - zipl_load_vscsi(); - break; - default: -- panic("\n! Unknown IPL device type !\n"); -+ puts("Unknown IPL device type!"); -+ return; - } - -- puts("zIPL load failed."); -+ puts("zIPL load failed!"); - } -diff --git a/pc-bios/s390-ccw/cio.c b/pc-bios/s390-ccw/cio.c -index 7b09a38c96..5d543da73f 100644 ---- a/pc-bios/s390-ccw/cio.c -+++ b/pc-bios/s390-ccw/cio.c -@@ -59,7 +59,8 @@ uint16_t cu_type(SubChannelId schid) - }; - - if (do_cio(schid, CU_TYPE_UNKNOWN, ptr2u32(&sense_id_ccw), CCW_FMT1)) { -- panic("Failed to run SenseID CCw\n"); -+ puts("Failed to run SenseID CCW"); -+ return CU_TYPE_UNKNOWN; - } - - return sense_data.cu_type; -diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c -index 80b7f6a1f3..8db1764ff3 100644 ---- a/pc-bios/s390-ccw/jump2ipl.c -+++ b/pc-bios/s390-ccw/jump2ipl.c -@@ -33,7 +33,7 @@ static void jump_to_IPL_addr(void) - /* should not return */ - } - --void jump_to_IPL_code(uint64_t address) -+int jump_to_IPL_code(uint64_t address) - { - /* store the subsystem information _after_ the bootmap was loaded */ - write_subsystem_identification(); -@@ -68,7 +68,8 @@ void jump_to_IPL_code(uint64_t address) - asm volatile("lghi %%r1,1\n\t" - "diag %%r1,%%r1,0x308\n\t" - : : : "1", "memory"); -- panic("\n! IPL returns !\n"); -+ puts("IPL code jump failed"); -+ return -1; - } - - void jump_to_low_kernel(void) -diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c -index fc44da3161..34ef27d7a6 100644 ---- a/pc-bios/s390-ccw/main.c -+++ b/pc-bios/s390-ccw/main.c -@@ -77,6 +77,9 @@ static int is_dev_possibly_bootable(int dev_no, int sch_no) - - enable_subchannel(blk_schid); - cutype = cu_type(blk_schid); -+ if (cutype == CU_TYPE_UNKNOWN) { -+ return -EIO; -+ } - - /* - * Note: we always have to run virtio_is_supported() here to make -@@ -194,10 +197,10 @@ static void boot_setup(void) - have_iplb = store_iplb(&iplb); - } - --static void find_boot_device(void) -+static bool find_boot_device(void) - { - VDev *vdev = virtio_get_device(); -- bool found; -+ bool found = false; - - switch (iplb.pbt) { - case S390_IPL_TYPE_CCW: -@@ -215,10 +218,10 @@ static void find_boot_device(void) - found = find_subch(iplb.scsi.devno); - break; - default: -- panic("List-directed IPL not supported yet!\n"); -+ puts("Unsupported IPLB"); - } - -- IPL_assert(found, "Boot device not found\n"); -+ return found; - } - - static int virtio_setup(void) -@@ -244,11 +247,13 @@ static int virtio_setup(void) - ret = virtio_scsi_setup_device(blk_schid); - break; - default: -- panic("\n! No IPL device available !\n"); -+ puts("\n! No IPL device available !\n"); -+ return -1; - } - -- if (!ret) { -- IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detected"); -+ if (!ret && !virtio_ipl_disk_is_valid()) { -+ puts("No valid IPL device detected"); -+ return -ENODEV; - } - - return ret; -@@ -259,16 +264,16 @@ static void ipl_boot_device(void) - switch (cutype) { - case CU_TYPE_DASD_3990: - case CU_TYPE_DASD_2107: -- dasd_ipl(blk_schid, cutype); /* no return */ -+ dasd_ipl(blk_schid, cutype); - break; - case CU_TYPE_VIRTIO: -- if (virtio_setup() == 0) { -- zipl_load(); /* Only returns in case of errors */ -+ if (virtio_setup()) { -+ return; /* Only returns in case of errors */ - } -+ zipl_load(); - break; - default: - printf("Attempting to boot from unexpected device type 0x%X\n", cutype); -- panic("\nBoot failed.\n"); - } - } - -@@ -301,12 +306,11 @@ void main(void) - sclp_setup(); - css_setup(); - boot_setup(); -- if (have_iplb) { -- find_boot_device(); -+ if (have_iplb && find_boot_device()) { - ipl_boot_device(); - } else { - probe_boot_device(); - } - -- panic("Failed to load OS from hard disk\n"); -+ panic("Failed to IPL. Halting..."); - } -diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h -index 344ad15655..6cdce3e5e5 100644 ---- a/pc-bios/s390-ccw/s390-ccw.h -+++ b/pc-bios/s390-ccw/s390-ccw.h -@@ -78,7 +78,7 @@ void zipl_load(void); - - /* jump2ipl.c */ - void write_reset_psw(uint64_t psw); --void jump_to_IPL_code(uint64_t address); -+int jump_to_IPL_code(uint64_t address); - void jump_to_low_kernel(void); - - /* menu.c */ -diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c -index 1c585f034b..7b2d1e20f4 100644 ---- a/pc-bios/s390-ccw/virtio-blkdev.c -+++ b/pc-bios/s390-ccw/virtio-blkdev.c -@@ -59,7 +59,7 @@ int virtio_read_many(unsigned long sector, void *load_addr, int sec_num) - case VIRTIO_ID_SCSI: - return virtio_scsi_read_many(vdev, sector, load_addr, sec_num); - } -- panic("\n! No readable IPL device !\n"); -+ - return -1; - } - -diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c -index 8c6b0a8a92..8b5a370bb3 100644 ---- a/pc-bios/s390-ccw/virtio.c -+++ b/pc-bios/s390-ccw/virtio.c -@@ -217,16 +217,19 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd) - return 0; - } - --void virtio_setup_ccw(VDev *vdev) -+int virtio_setup_ccw(VDev *vdev) - { -- int i, rc, cfg_size = 0; -+ int i, cfg_size = 0; - uint8_t status; - struct VirtioFeatureDesc { - uint32_t features; - uint8_t index; - } __attribute__((packed)) feats; - -- IPL_assert(virtio_is_supported(vdev->schid), "PE"); -+ if (!virtio_is_supported(vdev->schid)) { -+ puts("Virtio unsupported for this device ID"); -+ return -ENODEV; -+ } - /* device ID has been established now */ - - vdev->config.blk.blk_size = 0; /* mark "illegal" - setup started... */ -@@ -235,8 +238,10 @@ void virtio_setup_ccw(VDev *vdev) - run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false); - - status = VIRTIO_CONFIG_S_ACKNOWLEDGE; -- rc = run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false); -- IPL_assert(rc == 0, "Could not write ACKNOWLEDGE status to host"); -+ if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) { -+ puts("Could not write ACKNOWLEDGE status to host"); -+ return -EIO; -+ } - - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_NET: -@@ -255,27 +260,37 @@ void virtio_setup_ccw(VDev *vdev) - cfg_size = sizeof(vdev->config.scsi); - break; - default: -- panic("Unsupported virtio device\n"); -+ puts("Unsupported virtio device"); -+ return -ENODEV; - } - - status |= VIRTIO_CONFIG_S_DRIVER; -- rc = run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false); -- IPL_assert(rc == 0, "Could not write DRIVER status to host"); -+ if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) { -+ puts("Could not write DRIVER status to host"); -+ return -EIO; -+ } - - /* Feature negotiation */ - for (i = 0; i < ARRAY_SIZE(vdev->guest_features); i++) { - feats.features = 0; - feats.index = i; -- rc = run_ccw(vdev, CCW_CMD_READ_FEAT, &feats, sizeof(feats), false); -- IPL_assert(rc == 0, "Could not get features bits"); -+ if (run_ccw(vdev, CCW_CMD_READ_FEAT, &feats, sizeof(feats), false)) { -+ puts("Could not get features bits"); -+ return -EIO; -+ } -+ - vdev->guest_features[i] &= bswap32(feats.features); - feats.features = bswap32(vdev->guest_features[i]); -- rc = run_ccw(vdev, CCW_CMD_WRITE_FEAT, &feats, sizeof(feats), false); -- IPL_assert(rc == 0, "Could not set features bits"); -+ if (run_ccw(vdev, CCW_CMD_WRITE_FEAT, &feats, sizeof(feats), false)) { -+ puts("Could not set features bits"); -+ return -EIO; -+ } - } - -- rc = run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false); -- IPL_assert(rc == 0, "Could not get virtio device configuration"); -+ if (run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false)) { -+ puts("Could not get virtio device configuration"); -+ return -EIO; -+ } - - for (i = 0; i < vdev->nr_vqs; i++) { - VqInfo info = { -@@ -289,19 +304,27 @@ void virtio_setup_ccw(VDev *vdev) - .num = 0, - }; - -- rc = run_ccw(vdev, CCW_CMD_READ_VQ_CONF, &config, sizeof(config), false); -- IPL_assert(rc == 0, "Could not get virtio device VQ configuration"); -+ if (run_ccw(vdev, CCW_CMD_READ_VQ_CONF, &config, sizeof(config), -+ false)) { -+ puts("Could not get virtio device VQ config"); -+ return -EIO; -+ } - info.num = config.num; - vring_init(&vdev->vrings[i], &info); - vdev->vrings[i].schid = vdev->schid; -- IPL_assert( -- run_ccw(vdev, CCW_CMD_SET_VQ, &info, sizeof(info), false) == 0, -- "Cannot set VQ info"); -+ if (run_ccw(vdev, CCW_CMD_SET_VQ, &info, sizeof(info), false)) { -+ puts("Cannot set VQ info"); -+ return -EIO; -+ } - } - - status |= VIRTIO_CONFIG_S_DRIVER_OK; -- rc = run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false); -- IPL_assert(rc == 0, "Could not write DRIVER_OK status to host"); -+ if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) { -+ puts("Could not write DRIVER_OK status to host"); -+ return -EIO; -+ } -+ -+ return 0; - } - - bool virtio_is_supported(SubChannelId schid) -diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h -index 6f9a558ff5..9faf3986b1 100644 ---- a/pc-bios/s390-ccw/virtio.h -+++ b/pc-bios/s390-ccw/virtio.h -@@ -274,7 +274,7 @@ void vring_send_buf(VRing *vr, void *p, int len, int flags); - int vr_poll(VRing *vr); - int vring_wait_reply(void); - int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd); --void virtio_setup_ccw(VDev *vdev); -+int virtio_setup_ccw(VDev *vdev); - - int virtio_net_init(void *mac_addr); - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch deleted file mode 100644 index 6b5269f2e..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Introduce-EXTRA_LDFLAGS.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 499df84ffe62c783d35d5e67cd0d0c35ba6bd44c Mon Sep 17 00:00:00 2001 -From: Marc Hartmayer -Date: Tue, 1 Oct 2024 17:36:18 +0200 -Subject: [PATCH 23/27] pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS` -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [23/23] e27a9f3997924573bbacc1a7cf48004b2daeaaaa (thuth/qemu-kvm-cs9) - -Some packaging tools want to override `LDFLAGS` when building QEMU, this will -result in a build error as most likely no `-nostdlib` flag is passed. Introduce -`EXTRA_LDFLAGS` so that the packager can override `LDFLAGS` without breaking the -build. - -Signed-off-by: Marc Hartmayer -Message-ID: <20241001153618.17791-4-mhartmay@linux.ibm.com> -Reviewed-by: Thomas Huth -[thuth: Drop the hunk to netbook.mak which is not necessary anymore] -Signed-off-by: Thomas Huth -(cherry picked from commit 694d79ffce996c0993cebccc07c2ab6fc281e7d0) ---- - pc-bios/s390-ccw/Makefile | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile -index 38254e22df..dc69dd484f 100644 ---- a/pc-bios/s390-ccw/Makefile -+++ b/pc-bios/s390-ccw/Makefile -@@ -4,6 +4,7 @@ all: build-all - - include config-host.mak - CFLAGS = -O2 -g -I $(SRC_PATH)/../../include/hw/s390x/ipl -+LDFLAGS ?= - MAKEFLAGS += -rR - - GIT_SUBMODULES = roms/SLOF -@@ -46,7 +47,7 @@ EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables - EXTRA_CFLAGS += -msoft-float - EXTRA_CFLAGS += -std=gnu99 - EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) --LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text -+EXTRA_LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text - - cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null - cc-option = if $(call cc-test, $1); then \ -@@ -111,7 +112,7 @@ libnet.a: $(LIBNETOBJS) - build-all: s390-ccw.img - - s390-ccw.elf: $(OBJECTS) libnet.a libc.a -- $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking) -+ $(call quiet-command,$(CC) $(EXTRA_LDFLAGS) $(LDFLAGS) -o $@ $^,Linking) - - s390-ccw.img: s390-ccw.elf - $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into) --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch deleted file mode 100644 index 1b243e542..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Link-the-netboot-code-into-the-main.patch +++ /dev/null @@ -1,263 +0,0 @@ -From 5dd12012ec95bbac035a7a8b22216082def604f3 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:37 -0400 -Subject: [PATCH 03/27] pc-bios/s390-ccw: Link the netboot code into the main - s390-ccw.img binary -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [3/23] d369fc67aa9e10ba97618182e8f9681d151bcc49 (thuth/qemu-kvm-cs9) - -We originally built a separate binary for the netboot code since it -was considered as experimental and we could not be sure that the -necessary SLOF module had been checked out. Time passed, the code -proved its usefulness, and the build system nowadays makes sure that -the SLOF module is checked out if you have a s390x compiler available -for building the s390-ccw bios. So there is no real compelling reason -anymore to keep the netboot code in a separate binary. Linking the -code together with the main s390-ccw.img will make future enhancements -much easier, like supporting more than one boot device. - -Co-authored by: Thomas Huth -Signed-off-by: Jared Rossi -Message-ID: <20241020012953.1380075-4-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 8e5739ce4b0b04d7121cb2b29521acde2a8f3a24) ---- - pc-bios/s390-ccw/Makefile | 13 +++++++------ - pc-bios/s390-ccw/bootmap.c | 2 +- - pc-bios/s390-ccw/cio.h | 2 ++ - pc-bios/s390-ccw/iplb.h | 4 ++-- - pc-bios/s390-ccw/main.c | 10 +++++++--- - pc-bios/s390-ccw/netboot.mak | 14 -------------- - pc-bios/s390-ccw/netmain.c | 15 ++------------- - pc-bios/s390-ccw/s390-ccw.h | 3 +++ - pc-bios/s390-ccw/virtio.h | 1 - - 9 files changed, 24 insertions(+), 40 deletions(-) - -diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile -index 3f4232636e..cf6859823a 100644 ---- a/pc-bios/s390-ccw/Makefile -+++ b/pc-bios/s390-ccw/Makefile -@@ -32,19 +32,20 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d - - .PHONY : all clean build-all distclean - --OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ -- virtio.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o -+OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \ -+ virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o - - SLOF_DIR := $(SRC_PATH)/../../roms/SLOF - - LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include -+LIBNET_INC := -I$(SLOF_DIR)/lib/libnet - - EXTRA_CFLAGS += -Wall - EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE - EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables - EXTRA_CFLAGS += -msoft-float - EXTRA_CFLAGS += -std=gnu99 --EXTRA_CFLAGS += $(LIBC_INC) -+EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) - LDFLAGS += -Wl,-pie -nostdlib -z noexecstack - - cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null -@@ -62,9 +63,9 @@ config-cc.mak: Makefile - - include $(SRC_PATH)/netboot.mak - --build-all: s390-ccw.img s390-netboot.img -+build-all: s390-ccw.img - --s390-ccw.elf: $(OBJECTS) libc.a -+s390-ccw.elf: $(OBJECTS) libnet.a libc.a - $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking) - - s390-ccw.img: s390-ccw.elf -@@ -72,7 +73,7 @@ s390-ccw.img: s390-ccw.elf - - $(OBJECTS): Makefile - --ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS)) -+ALL_OBJS = $(sort $(OBJECTS) $(LIBCOBJS) $(LIBNETOBJS)) - -include $(ALL_OBJS:%.o=%.d) - - clean: -diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c -index 3cc79706be..414c3f1b47 100644 ---- a/pc-bios/s390-ccw/bootmap.c -+++ b/pc-bios/s390-ccw/bootmap.c -@@ -929,7 +929,7 @@ void zipl_load(void) - } - - if (virtio_get_device_type() == VIRTIO_ID_NET) { -- jump_to_IPL_code(vdev->netboot_start_addr); -+ netmain(); - } - - ipl_scsi(); -diff --git a/pc-bios/s390-ccw/cio.h b/pc-bios/s390-ccw/cio.h -index 8b18153deb..6a5e86ba01 100644 ---- a/pc-bios/s390-ccw/cio.h -+++ b/pc-bios/s390-ccw/cio.h -@@ -361,6 +361,8 @@ typedef struct CcwSearchIdData { - uint8_t record; - } __attribute__((packed)) CcwSearchIdData; - -+extern SubChannelId net_schid; -+ - int enable_mss_facility(void); - void enable_subchannel(SubChannelId schid); - uint16_t cu_type(SubChannelId schid); -diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h -index cb6ac8a880..3758698468 100644 ---- a/pc-bios/s390-ccw/iplb.h -+++ b/pc-bios/s390-ccw/iplb.h -@@ -87,9 +87,9 @@ extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); - struct QemuIplParameters { - uint8_t qipl_flags; - uint8_t reserved1[3]; -- uint64_t netboot_start_addr; -+ uint64_t reserved2; - uint32_t boot_menu_timeout; -- uint8_t reserved2[12]; -+ uint8_t reserved3[12]; - } __attribute__ ((packed)); - typedef struct QemuIplParameters QemuIplParameters; - -diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c -index 203df20965..fc44da3161 100644 ---- a/pc-bios/s390-ccw/main.c -+++ b/pc-bios/s390-ccw/main.c -@@ -38,8 +38,13 @@ LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */ - */ - void write_subsystem_identification(void) - { -- lowcore->subchannel_id = blk_schid.sch_id; -- lowcore->subchannel_nr = blk_schid.sch_no; -+ if (cutype == CU_TYPE_VIRTIO && virtio_get_device_type() == VIRTIO_ID_NET) { -+ lowcore->subchannel_id = net_schid.sch_id; -+ lowcore->subchannel_nr = net_schid.sch_no; -+ } else { -+ lowcore->subchannel_id = blk_schid.sch_id; -+ lowcore->subchannel_nr = blk_schid.sch_no; -+ } - lowcore->io_int_parm = 0; - } - -@@ -231,7 +236,6 @@ static int virtio_setup(void) - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_NET: - puts("Network boot device detected"); -- vdev->netboot_start_addr = qipl.netboot_start_addr; - return 0; - case VIRTIO_ID_BLOCK: - ret = virtio_blk_setup_device(blk_schid); -diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak -index d2b3d8ee74..0a24257ff4 100644 ---- a/pc-bios/s390-ccw/netboot.mak -+++ b/pc-bios/s390-ccw/netboot.mak -@@ -1,18 +1,4 @@ - --NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o -- --LIBNET_INC := -I$(SLOF_DIR)/lib/libnet -- --NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000 -- --$(NETOBJS): EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) -- --s390-netboot.elf: $(NETOBJS) libnet.a libc.a -- $(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $^,Linking) -- --s390-netboot.img: s390-netboot.elf -- $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into) -- - # libc files: - - LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ -diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c -index 509119be15..bc6ad8695f 100644 ---- a/pc-bios/s390-ccw/netmain.c -+++ b/pc-bios/s390-ccw/netmain.c -@@ -41,7 +41,6 @@ - #define DEFAULT_TFTP_RETRIES 20 - - extern char _start[]; --void write_iplb_location(void) {} - - #define KERNEL_ADDR ((void *)0L) - #define KERNEL_MAX_SIZE ((long)_start) -@@ -50,10 +49,9 @@ void write_iplb_location(void) {} - /* STSI 3.2.2 offset of first vmdb + offset of uuid inside vmdb */ - #define STSI322_VMDB_UUID_OFFSET ((8 + 12) * 4) - --IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE))); - static char cfgbuf[2048]; - --static SubChannelId net_schid = { .one = 1 }; -+SubChannelId net_schid = { .one = 1 }; - static uint8_t mac[6]; - static uint64_t dest_timer; - -@@ -438,15 +436,6 @@ static int net_try_direct_tftp_load(filename_ip_t *fn_ip) - return rc; - } - --void write_subsystem_identification(void) --{ -- SubChannelId *schid = (SubChannelId *) 184; -- uint32_t *zeroes = (uint32_t *) 188; -- -- *schid = net_schid; -- *zeroes = 0; --} -- - static bool find_net_dev(Schib *schib, int dev_no) - { - int i, r; -@@ -509,7 +498,7 @@ static void virtio_setup(void) - IPL_assert(found, "No virtio net device found"); - } - --void main(void) -+void netmain(void) - { - filename_ip_t fn_ip; - int rc, fnlen; -diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h -index 6f6d95d170..6abb34e563 100644 ---- a/pc-bios/s390-ccw/s390-ccw.h -+++ b/pc-bios/s390-ccw/s390-ccw.h -@@ -55,6 +55,9 @@ void write_iplb_location(void); - unsigned int get_loadparm_index(void); - void main(void); - -+/* netmain.c */ -+void netmain(void); -+ - /* sclp.c */ - void sclp_print(const char *string); - void sclp_set_write_mask(uint32_t receive_mask, uint32_t send_mask); -diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h -index 85bd9d1695..6f9a558ff5 100644 ---- a/pc-bios/s390-ccw/virtio.h -+++ b/pc-bios/s390-ccw/virtio.h -@@ -253,7 +253,6 @@ struct VDev { - uint8_t scsi_dev_heads; - bool scsi_device_selected; - ScsiDevice selected_scsi_device; -- uint64_t netboot_start_addr; - uint32_t max_transfer; - uint32_t guest_features[2]; - }; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch deleted file mode 100644 index 9e3583437..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Merge-netboot.mak-into-the-main-Mak.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 053fe7407d61ea7f885ae3a75b8dff18712e97fc Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Fri, 21 Jun 2024 09:40:11 +0200 -Subject: [PATCH 06/27] pc-bios/s390-ccw: Merge netboot.mak into the main - Makefile -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [6/23] a0f3671677000e9bf00557df773fd72d9f9768a7 (thuth/qemu-kvm-cs9) - -Now that the netboot code has been merged into the main s390-ccw.img, -it also does not make sense to keep the build rules in a separate -file. Thus let's merge netboot.mak into the main Makefile. - -Message-Id: <20240621082422.136217-7-thuth@redhat.com> -Signed-off-by: Thomas Huth -(cherry picked from commit f1fdadda36f73c9a4a96f92deb3062528cd12acc) ---- - pc-bios/s390-ccw/Makefile | 47 +++++++++++++++++++++++++++++++++++- - pc-bios/s390-ccw/netboot.mak | 45 ---------------------------------- - 2 files changed, 46 insertions(+), 46 deletions(-) - delete mode 100644 pc-bios/s390-ccw/netboot.mak - -diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile -index cf6859823a..27cbb354af 100644 ---- a/pc-bios/s390-ccw/Makefile -+++ b/pc-bios/s390-ccw/Makefile -@@ -61,7 +61,52 @@ config-cc.mak: Makefile - $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak - -include config-cc.mak - --include $(SRC_PATH)/netboot.mak -+# libc files: -+ -+LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ -+ -MMD -MP -MT $@ -MF $(@:%.o=%.d) -+ -+CTYPE_OBJS = isdigit.o isxdigit.o toupper.o -+%.o : $(SLOF_DIR)/lib/libc/ctype/%.c -+ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -+ -+STRING_OBJS = strcat.o strchr.o strrchr.o strcpy.o strlen.o strncpy.o \ -+ strcmp.o strncmp.o strcasecmp.o strncasecmp.o strstr.o \ -+ memset.o memcpy.o memmove.o memcmp.o -+%.o : $(SLOF_DIR)/lib/libc/string/%.c -+ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -+ -+STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o -+%.o : $(SLOF_DIR)/lib/libc/stdlib/%.c -+ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -+ -+STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ -+ printf.o putc.o puts.o putchar.o stdchnls.o fileno.o -+%.o : $(SLOF_DIR)/lib/libc/stdio/%.c -+ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -+ -+sbrk.o: $(SLOF_DIR)/slof/sbrk.c -+ $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -+ -+LIBCOBJS := $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) sbrk.o -+ -+libc.a: $(LIBCOBJS) -+ $(call quiet-command,$(AR) -rc $@ $^,Creating static library) -+ -+# libnet files: -+ -+LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ -+ dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o -+LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ -+ -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d) -+ -+%.o : $(SLOF_DIR)/lib/libnet/%.c -+ $(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,Compiling) -+ -+libnet.a: $(LIBNETOBJS) -+ $(call quiet-command,$(AR) -rc $@ $^,Creating static library) -+ -+# Main targets: - - build-all: s390-ccw.img - -diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak -deleted file mode 100644 -index 0a24257ff4..0000000000 ---- a/pc-bios/s390-ccw/netboot.mak -+++ /dev/null -@@ -1,45 +0,0 @@ -- --# libc files: -- --LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ -- -MMD -MP -MT $@ -MF $(@:%.o=%.d) -- --CTYPE_OBJS = isdigit.o isxdigit.o toupper.o --%.o : $(SLOF_DIR)/lib/libc/ctype/%.c -- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -- --STRING_OBJS = strcat.o strchr.o strrchr.o strcpy.o strlen.o strncpy.o \ -- strcmp.o strncmp.o strcasecmp.o strncasecmp.o strstr.o \ -- memset.o memcpy.o memmove.o memcmp.o --%.o : $(SLOF_DIR)/lib/libc/string/%.c -- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -- --STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o --%.o : $(SLOF_DIR)/lib/libc/stdlib/%.c -- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -- --STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ -- printf.o putc.o puts.o putchar.o stdchnls.o fileno.o --%.o : $(SLOF_DIR)/lib/libc/stdio/%.c -- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -- --sbrk.o: $(SLOF_DIR)/slof/sbrk.c -- $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling) -- --LIBCOBJS := $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) sbrk.o -- --libc.a: $(LIBCOBJS) -- $(call quiet-command,$(AR) -rc $@ $^,Creating static library) -- --# libnet files: -- --LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ -- dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o --LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ -- -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d) -- --%.o : $(SLOF_DIR)/lib/libnet/%.c -- $(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,Compiling) -- --libnet.a: $(LIBNETOBJS) -- $(call quiet-command,$(AR) -rc $@ $^,Creating static library) --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch deleted file mode 100644 index 8a5c675c0..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 7e73d3ad9a7e3f047f8ef79131065e4386e1bc00 Mon Sep 17 00:00:00 2001 -From: Thomas Huth -Date: Mon, 11 Nov 2024 14:11:20 +0100 -Subject: [PATCH 09/10] pc-bios/s390-ccw: Re-initialize receive queue index - before each boot attempt -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [8/8] 3337c7737fa2eb33f1a27230ae1d6e0f2580a539 (thuth/qemu-kvm-cs9) - -Now that we can boot from multiple boot devices, we have to make sure -to reinitialize static variables like rx_last_idx to avoid that they -contain garbage data during the second boot attempt (which can lead to -crashes when the code tries to access the wrong ring data). - -Message-ID: <20241111131120.317796-1-thuth@redhat.com> -Reviewed-by: Jared Rossi -Signed-off-by: Thomas Huth -(cherry picked from commit 6ba1f714c00f8839a8df9f643e0058f00da3fd25) ---- - pc-bios/s390-ccw/virtio-net.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/pc-bios/s390-ccw/virtio-net.c b/pc-bios/s390-ccw/virtio-net.c -index f9854a22c3..578c89d0c5 100644 ---- a/pc-bios/s390-ccw/virtio-net.c -+++ b/pc-bios/s390-ccw/virtio-net.c -@@ -51,6 +51,8 @@ int virtio_net_init(void *mac_addr) - void *buf; - int i; - -+ rx_last_idx = 0; -+ - vdev->guest_features[0] = VIRTIO_NET_F_MAC_BIT; - virtio_setup_ccw(vdev); - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch deleted file mode 100644 index 5e0fd945b..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-DASD-IPL-path.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 032b512a919662ce65b173416815e29e8f5fb904 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:44 -0400 -Subject: [PATCH 11/27] pc-bios/s390-ccw: Remove panics from DASD IPL path -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [11/23] 941e1e76db8d35a6ad6ca2e2a401e2ac122efd09 (thuth/qemu-kvm-cs9) - -Remove panic-on-error from DASD IPL specific functions so that error recovery -may be possible in the future. - -Functions that would previously panic now provide a return code. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-11-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 1d5c7f078e938e6844f404429dd70bc52b39dac6) ---- - pc-bios/s390-ccw/dasd-ipl.c | 66 ++++++++++++++++++++----------------- - pc-bios/s390-ccw/dasd-ipl.h | 2 +- - 2 files changed, 37 insertions(+), 31 deletions(-) - -diff --git a/pc-bios/s390-ccw/dasd-ipl.c b/pc-bios/s390-ccw/dasd-ipl.c -index ae751adec1..babece95ea 100644 ---- a/pc-bios/s390-ccw/dasd-ipl.c -+++ b/pc-bios/s390-ccw/dasd-ipl.c -@@ -111,38 +111,29 @@ static void make_readipl(void) - ccwIplRead->count = 0x18; /* Read 0x18 bytes of data */ - } - --static void run_readipl(SubChannelId schid, uint16_t cutype) -+static int run_readipl(SubChannelId schid, uint16_t cutype) - { -- if (do_cio(schid, cutype, 0x00, CCW_FMT0)) { -- panic("dasd-ipl: Failed to run Read IPL channel program\n"); -- } -+ return do_cio(schid, cutype, 0x00, CCW_FMT0); - } - - /* - * The architecture states that IPL1 data should consist of a psw followed by - * format-0 READ and TIC CCWs. Let's sanity check. - */ --static void check_ipl1(void) -+static bool check_ipl1(void) - { - Ccw0 *ccwread = (Ccw0 *)0x08; - Ccw0 *ccwtic = (Ccw0 *)0x10; - -- if (ccwread->cmd_code != CCW_CMD_DASD_READ || -- ccwtic->cmd_code != CCW_CMD_TIC) { -- panic("dasd-ipl: IPL1 data invalid. Is this disk really bootable?\n"); -- } -+ return (ccwread->cmd_code == CCW_CMD_DASD_READ && -+ ccwtic->cmd_code == CCW_CMD_TIC); - } - --static void check_ipl2(uint32_t ipl2_addr) -+static bool check_ipl2(uint32_t ipl2_addr) - { - Ccw0 *ccw = u32toptr(ipl2_addr); - -- if (ipl2_addr == 0x00) { -- panic("IPL2 address invalid. Is this disk really bootable?\n"); -- } -- if (ccw->cmd_code == 0x00) { -- panic("IPL2 ccw data invalid. Is this disk really bootable?\n"); -- } -+ return (ipl2_addr != 0x00 && ccw->cmd_code != 0x00); - } - - static uint32_t read_ipl2_addr(void) -@@ -188,52 +179,67 @@ static void ipl1_fixup(void) - ccwSearchTic->cda = ptr2u32(ccwSearchID); - } - --static void run_ipl1(SubChannelId schid, uint16_t cutype) -+static int run_ipl1(SubChannelId schid, uint16_t cutype) - { - uint32_t startAddr = 0x08; - -- if (do_cio(schid, cutype, startAddr, CCW_FMT0)) { -- panic("dasd-ipl: Failed to run IPL1 channel program\n"); -- } -+ return do_cio(schid, cutype, startAddr, CCW_FMT0); - } - --static void run_ipl2(SubChannelId schid, uint16_t cutype, uint32_t addr) -+static int run_ipl2(SubChannelId schid, uint16_t cutype, uint32_t addr) - { -- if (run_dynamic_ccw_program(schid, cutype, addr)) { -- panic("dasd-ipl: Failed to run IPL2 channel program\n"); -- } -+ return run_dynamic_ccw_program(schid, cutype, addr); - } - - /* - * Limitations in vfio-ccw support complicate the IPL process. Details can - * be found in docs/devel/s390-dasd-ipl.rst - */ --void dasd_ipl(SubChannelId schid, uint16_t cutype) -+int dasd_ipl(SubChannelId schid, uint16_t cutype) - { - PSWLegacy *pswl = (PSWLegacy *) 0x00; - uint32_t ipl2_addr; - - /* Construct Read IPL CCW and run it to read IPL1 from boot disk */ - make_readipl(); -- run_readipl(schid, cutype); -+ if (run_readipl(schid, cutype)) { -+ puts("Failed to run Read IPL channel program"); -+ return -EIO; -+ } -+ - ipl2_addr = read_ipl2_addr(); -- check_ipl1(); -+ -+ if (!check_ipl1()) { -+ puts("IPL1 invalid for DASD-IPL"); -+ return -EINVAL; -+ } - - /* - * Fixup IPL1 channel program to account for vfio-ccw limitations, then run - * it to read IPL2 channel program from boot disk. - */ - ipl1_fixup(); -- run_ipl1(schid, cutype); -- check_ipl2(ipl2_addr); -+ if (run_ipl1(schid, cutype)) { -+ puts("Failed to run IPL1 channel program"); -+ return -EIO; -+ } -+ -+ if (!check_ipl2(ipl2_addr)) { -+ puts("IPL2 invalid for DASD-IPL"); -+ return -EINVAL; -+ } - - /* - * Run IPL2 channel program to read operating system code from boot disk - */ -- run_ipl2(schid, cutype, ipl2_addr); -+ if (run_ipl2(schid, cutype, ipl2_addr)) { -+ puts("Failed to run IPL2 channel program"); -+ return -EIO; -+ } - - /* Transfer control to the guest operating system */ - pswl->mask |= PSW_MASK_EAMODE; /* Force z-mode */ - pswl->addr |= PSW_MASK_BAMODE; /* ... */ - jump_to_low_kernel(); -+ return -1; - } -diff --git a/pc-bios/s390-ccw/dasd-ipl.h b/pc-bios/s390-ccw/dasd-ipl.h -index c394828906..eb1898c84a 100644 ---- a/pc-bios/s390-ccw/dasd-ipl.h -+++ b/pc-bios/s390-ccw/dasd-ipl.h -@@ -11,6 +11,6 @@ - #ifndef DASD_IPL_H - #define DASD_IPL_H - --void dasd_ipl(SubChannelId schid, uint16_t cutype); -+int dasd_ipl(SubChannelId schid, uint16_t cutype); - - #endif /* DASD_IPL_H */ --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch deleted file mode 100644 index fa854a156..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ECKD-IPL-path.patch +++ /dev/null @@ -1,475 +0,0 @@ -From 237d714205394102a4cd60eeeddc12b98bfbfa3f Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:42 -0400 -Subject: [PATCH 09/27] pc-bios/s390-ccw: Remove panics from ECKD IPL path -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [9/23] 1e6ecba95979a5bc12bd74c1b0bc631ccfbd57ec (thuth/qemu-kvm-cs9) - -Remove panic-on-error from ECKD block device IPL specific functions so that -error recovery may be possible in the future. - -Functions that would previously panic now provide a return code. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-9-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 806315279d5c629e1cc3a945bcfba3fe5482d84b) ---- - pc-bios/s390-ccw/bootmap.c | 187 +++++++++++++++++++++++++------------ - pc-bios/s390-ccw/bootmap.h | 1 + - 2 files changed, 130 insertions(+), 58 deletions(-) - -diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c -index af73254acb..b9596e28c7 100644 ---- a/pc-bios/s390-ccw/bootmap.c -+++ b/pc-bios/s390-ccw/bootmap.c -@@ -145,14 +145,17 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, - bool more_data; - - memset(_bprs, FREE_SPACE_FILLER, sizeof(_bprs)); -- read_block(blk, bprs, "BPRS read failed"); -+ if (virtio_read(blk, bprs)) { -+ puts("BPRS read failed"); -+ return ERROR_BLOCK_NR; -+ } - - do { - more_data = false; - for (j = 0;; j++) { - block_nr = gen_eckd_block_num(&bprs[j].xeckd, ldipl); - if (is_null_block_number(block_nr)) { /* end of chunk */ -- break; -+ return NULL_BLOCK_NR; - } - - /* we need the updated blockno for the next indirect entry -@@ -163,15 +166,20 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, - } - - /* List directed pointer does not store block size */ -- IPL_assert(ldipl || block_size_ok(bprs[j].xeckd.bptr.size), -- "bad chunk block size"); -+ if (!ldipl && !block_size_ok(bprs[j].xeckd.bptr.size)) { -+ puts("Bad chunk block size"); -+ return ERROR_BLOCK_NR; -+ } - - if (!eckd_valid_address(&bprs[j].xeckd, ldipl)) { - /* - * If an invalid address is found during LD-IPL then break and -- * retry as CCW -+ * retry as CCW-IPL, otherwise abort on error - */ -- IPL_assert(ldipl, "bad chunk ECKD addr"); -+ if (!ldipl) { -+ puts("Bad chunk ECKD address"); -+ return ERROR_BLOCK_NR; -+ } - break; - } - -@@ -189,7 +197,10 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, - * I.e. the next ptr must point to the unused memory area - */ - memset(_bprs, FREE_SPACE_FILLER, sizeof(_bprs)); -- read_block(block_nr, bprs, "BPRS continuation read failed"); -+ if (virtio_read(block_nr, bprs)) { -+ puts("BPRS continuation read failed"); -+ return ERROR_BLOCK_NR; -+ } - more_data = true; - break; - } -@@ -198,7 +209,10 @@ static block_number_t load_eckd_segments(block_number_t blk, bool ldipl, - * to memory (address). - */ - rc = virtio_read_many(block_nr, (void *)(*address), count + 1); -- IPL_assert(rc == 0, "code chunk read failed"); -+ if (rc != 0) { -+ puts("Code chunk read failed"); -+ return ERROR_BLOCK_NR; -+ } - - *address += (count + 1) * virtio_get_block_size(); - } -@@ -232,7 +246,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) - - /* Get Stage1b data */ - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(s1b_block_nr, s1b, "Cannot read stage1b boot loader"); -+ if (virtio_read(s1b_block_nr, s1b)) { -+ puts("Cannot read stage1b boot loader"); -+ return -EIO; -+ } - - memset(_s2, FREE_SPACE_FILLER, sizeof(_s2)); - -@@ -244,7 +261,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) - break; - } - -- read_block(cur_block_nr, s2_cur_blk, "Cannot read stage2 boot loader"); -+ if (virtio_read(cur_block_nr, s2_cur_blk)) { -+ puts("Cannot read stage2 boot loader"); -+ return -EIO; -+ } - - if (find_zipl_boot_menu_banner(&banner_offset)) { - /* -@@ -252,8 +272,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) - * possibility of menu data spanning multiple blocks. - */ - if (prev_block_nr) { -- read_block(prev_block_nr, s2_prev_blk, -- "Cannot read stage2 boot loader"); -+ if (virtio_read(prev_block_nr, s2_prev_blk)) { -+ puts("Cannot read stage2 boot loader"); -+ return -EIO; -+ } - } - - if (i + 1 < STAGE2_BLK_CNT_MAX) { -@@ -261,8 +283,10 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) - } - - if (next_block_nr && !is_null_block_number(next_block_nr)) { -- read_block(next_block_nr, s2_next_blk, -- "Cannot read stage2 boot loader"); -+ if (virtio_read(next_block_nr, s2_next_blk)) { -+ puts("Cannot read stage2 boot loader"); -+ return -EIO; -+ } - } - - return menu_get_zipl_boot_index(s2_cur_blk + banner_offset); -@@ -275,7 +299,7 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) - return 0; - } - --static void run_eckd_boot_script(block_number_t bmt_block_nr, -+static int run_eckd_boot_script(block_number_t bmt_block_nr, - block_number_t s1b_block_nr) - { - int i; -@@ -292,17 +316,28 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr, - } - - debug_print_int("loadparm", loadparm); -- IPL_assert(loadparm < MAX_BOOT_ENTRIES, "loadparm value greater than" -- " maximum number of boot entries allowed"); -+ if (loadparm >= MAX_BOOT_ENTRIES) { -+ puts("loadparm value greater than max number of boot entries allowed"); -+ return -EINVAL; -+ } - - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(bmt_block_nr, sec, "Cannot read Boot Map Table"); -+ if (virtio_read(bmt_block_nr, sec)) { -+ puts("Cannot read Boot Map Table"); -+ return -EIO; -+ } - - block_nr = gen_eckd_block_num(&bmt->entry[loadparm].xeckd, ldipl); -- IPL_assert(block_nr != -1, "Cannot find Boot Map Table Entry"); -+ if (block_nr == NULL_BLOCK_NR) { -+ puts("Cannot find Boot Map Table Entry"); -+ return -EIO; -+ } - - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(block_nr, sec, "Cannot read Boot Map Script"); -+ if (virtio_read(block_nr, sec)) { -+ puts("Cannot read Boot Map Script"); -+ return -EIO; -+ } - - for (i = 0; bms->entry[i].type == BOOT_SCRIPT_LOAD || - bms->entry[i].type == BOOT_SCRIPT_SIGNATURE; i++) { -@@ -317,21 +352,27 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr, - - do { - block_nr = load_eckd_segments(block_nr, ldipl, &address); -- } while (block_nr != -1); -+ if (block_nr == ERROR_BLOCK_NR) { -+ return ldipl ? 0 : -EIO; -+ } -+ } while (block_nr != NULL_BLOCK_NR); - } - - if (ldipl && bms->entry[i].type != BOOT_SCRIPT_EXEC) { - /* Abort LD-IPL and retry as CCW-IPL */ -- return; -+ return 0; - } - -- IPL_assert(bms->entry[i].type == BOOT_SCRIPT_EXEC, -- "Unknown script entry type"); -+ if (bms->entry[i].type != BOOT_SCRIPT_EXEC) { -+ puts("Unknown script entry type"); -+ return -EINVAL; -+ } - write_reset_psw(bms->entry[i].address.load_address); /* no return */ - jump_to_IPL_code(0); /* no return */ -+ return -1; - } - --static void ipl_eckd_cdl(void) -+static int ipl_eckd_cdl(void) - { - XEckdMbr *mbr; - EckdCdlIpl2 *ipl2 = (void *)sec; -@@ -342,20 +383,23 @@ static void ipl_eckd_cdl(void) - puts("CDL"); - - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(1, ipl2, "Cannot read IPL2 record at block 1"); -+ if (virtio_read(1, ipl2)) { -+ puts("Cannot read IPL2 record at block 1"); -+ return -EIO; -+ } - - mbr = &ipl2->mbr; - if (!magic_match(mbr, ZIPL_MAGIC)) { - puts("No zIPL section in IPL2 record."); -- return; -+ return 0; - } - if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) { - puts("Bad block size in zIPL section of IPL2 record."); -- return; -+ return 0; - } - if (mbr->dev_type != DEV_TYPE_ECKD) { - puts("Non-ECKD device type in zIPL section of IPL2 record."); -- return; -+ return 0; - } - - /* save pointer to Boot Map Table */ -@@ -365,19 +409,21 @@ static void ipl_eckd_cdl(void) - s1b_block_nr = eckd_block_num(&ipl2->stage1.seek[0].chs); - - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(2, vlbl, "Cannot read Volume Label at block 2"); -+ if (virtio_read(2, vlbl)) { -+ puts("Cannot read Volume Label at block 2"); -+ return -EIO; -+ } - if (!magic_match(vlbl->key, VOL1_MAGIC)) { - puts("Invalid magic of volume label block."); -- return; -+ return 0; - } - if (!magic_match(vlbl->f.key, VOL1_MAGIC)) { - puts("Invalid magic of volser block."); -- return; -+ return 0; - } - print_volser(vlbl->f.volser); - -- run_eckd_boot_script(bmt_block_nr, s1b_block_nr); -- /* no return */ -+ return run_eckd_boot_script(bmt_block_nr, s1b_block_nr); - } - - static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) -@@ -403,7 +449,7 @@ static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) - print_volser(vlbl->volser); - } - --static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) -+static int ipl_eckd_ldl(ECKD_IPL_mode_t mode) - { - block_number_t bmt_block_nr, s1b_block_nr; - EckdLdlIpl1 *ipl1 = (void *)sec; -@@ -415,10 +461,13 @@ static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) - /* DO NOT read BootMap pointer (only one, xECKD) at block #2 */ - - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(0, sec, "Cannot read block 0 to grab boot info."); -+ if (virtio_read(0, sec)) { -+ puts("Cannot read block 0 to grab boot info."); -+ return -EIO; -+ } - if (mode == ECKD_LDL_UNLABELED) { - if (!magic_match(ipl1->bip.magic, ZIPL_MAGIC)) { -- return; /* not applicable layout */ -+ return 0; /* not applicable layout */ - } - puts("unlabeled LDL."); - } -@@ -430,8 +479,7 @@ static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) - /* save pointer to Stage1b Data */ - s1b_block_nr = eckd_block_num(&ipl1->stage1.seek[0].chs); - -- run_eckd_boot_script(bmt_block_nr, s1b_block_nr); -- /* no return */ -+ return run_eckd_boot_script(bmt_block_nr, s1b_block_nr); - } - - static block_number_t eckd_find_bmt(ExtEckdBlockPtr *ptr) -@@ -441,7 +489,10 @@ static block_number_t eckd_find_bmt(ExtEckdBlockPtr *ptr) - BootRecord *br; - - blockno = gen_eckd_block_num(ptr, 0); -- read_block(blockno, tmp_sec, "Cannot read boot record"); -+ if (virtio_read(blockno, tmp_sec)) { -+ puts("Cannot read boot record"); -+ return ERROR_BLOCK_NR; -+ } - br = (BootRecord *)tmp_sec; - if (!magic_match(br->magic, ZIPL_MAGIC)) { - /* If the boot record is invalid, return and try CCW-IPL instead */ -@@ -470,7 +521,7 @@ static void print_eckd_msg(void) - printf("%s", msg); - } - --static void ipl_eckd(void) -+static int ipl_eckd(void) - { - IplVolumeLabel *vlbl = (void *)sec; - LDL_VTOC *vtoc = (void *)sec; -@@ -480,7 +531,10 @@ static void ipl_eckd(void) - - /* Block 2 can contain either the CDL VOL1 label or the LDL VTOC */ - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(2, vlbl, "Cannot read block 2"); -+ if (virtio_read(2, vlbl)) { -+ puts("Cannot read block 2"); -+ return -EIO; -+ } - - /* - * First check for a list-directed-format pointer which would -@@ -488,36 +542,53 @@ static void ipl_eckd(void) - */ - if (eckd_valid_address((ExtEckdBlockPtr *)&vlbl->f.br, 0)) { - ldipl_bmt = eckd_find_bmt((ExtEckdBlockPtr *)&vlbl->f.br); -- if (ldipl_bmt) { -+ switch (ldipl_bmt) { -+ case ERROR_BLOCK_NR: -+ return -EIO; -+ case NULL_BLOCK_NR: -+ break; /* Invalid BMT but the device may still boot with CCW-IPL */ -+ default: - puts("List-Directed"); -- /* LD-IPL does not use the S1B bock, just make it NULL */ -- run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR); -- /* Only return in error, retry as CCW-IPL */ -+ /* -+ * LD-IPL does not use the S1B bock, just make it NULL_BLOCK_NR. -+ * In some failure cases retry IPL before aborting. -+ */ -+ if (run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR)) { -+ return -EIO; -+ } -+ /* Non-fatal error, retry as CCW-IPL */ - printf("Retrying IPL "); - print_eckd_msg(); - } - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(2, vtoc, "Cannot read block 2"); -+ if (virtio_read(2, vtoc)) { -+ puts("Cannot read block 2"); -+ return -EIO; -+ } - } - - /* Not list-directed */ - if (magic_match(vtoc->magic, VOL1_MAGIC)) { -- ipl_eckd_cdl(); /* may return in error */ -+ if (ipl_eckd_cdl()) { -+ return -1; -+ } - } - - if (magic_match(vtoc->magic, CMS1_MAGIC)) { -- ipl_eckd_ldl(ECKD_CMS); /* no return */ -+ return ipl_eckd_ldl(ECKD_CMS); - } - if (magic_match(vtoc->magic, LNX1_MAGIC)) { -- ipl_eckd_ldl(ECKD_LDL); /* no return */ -+ return ipl_eckd_ldl(ECKD_LDL); - } - -- ipl_eckd_ldl(ECKD_LDL_UNLABELED); /* it still may return */ -+ if (ipl_eckd_ldl(ECKD_LDL_UNLABELED)) { -+ return -1; -+ } - /* - * Ok, it is not a LDL by any means. - * It still might be a CDL with zero record keys for IPL1 and IPL2 - */ -- ipl_eckd_cdl(); -+ return ipl_eckd_cdl(); - } - - /*********************************************************************** -@@ -910,7 +981,7 @@ static bool has_iso_signature(void) - * Bus specific IPL sequences - */ - --static void zipl_load_vblk(void) -+static int zipl_load_vblk(void) - { - int blksize = virtio_get_block_size(); - -@@ -919,7 +990,7 @@ static void zipl_load_vblk(void) - virtio_assume_iso9660(); - } - if (ipl_iso_el_torito()) { -- return; -+ return 0; - } - } - -@@ -927,21 +998,21 @@ static void zipl_load_vblk(void) - puts("Using guessed DASD geometry."); - virtio_assume_eckd(); - } -- ipl_eckd(); -+ return ipl_eckd(); - } - --static void zipl_load_vscsi(void) -+static int zipl_load_vscsi(void) - { - if (virtio_get_block_size() == VIRTIO_ISO_BLOCK_SIZE) { - /* Is it an ISO image in non-CD drive? */ - if (ipl_iso_el_torito()) { -- return; -+ return 0; - } - } - - puts("Using guessed DASD geometry."); - virtio_assume_eckd(); -- ipl_eckd(); -+ return ipl_eckd(); - } - - /*********************************************************************** -diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h -index 3cb573b86b..95943441d3 100644 ---- a/pc-bios/s390-ccw/bootmap.h -+++ b/pc-bios/s390-ccw/bootmap.h -@@ -16,6 +16,7 @@ - - typedef uint64_t block_number_t; - #define NULL_BLOCK_NR 0xffffffffffffffffULL -+#define ERROR_BLOCK_NR 0xfffffffffffffffeULL - - #define FREE_SPACE_FILLER '\xAA' - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch deleted file mode 100644 index 0304180fa..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-ISO-IPL-path.patch +++ /dev/null @@ -1,269 +0,0 @@ -From b850578315ad498d581d8f09c9dfcd0d1dea1a5e Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:41 -0400 -Subject: [PATCH 08/27] pc-bios/s390-ccw: Remove panics from ISO IPL path -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [8/23] 92ab09f2df4bcdc721aca11c4a75439ebd72212c (thuth/qemu-kvm-cs9) - -Remove panic-on-error from IPL ISO El Torito specific functions so that error -recovery may be possible in the future. - -Functions that would previously panic now provide a return code. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-8-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit bef2b8dd1a36fc79cabcda48e667f2cba476924c) ---- - pc-bios/s390-ccw/bootmap.c | 87 ++++++++++++++++++++++++------------- - pc-bios/s390-ccw/bootmap.h | 15 +++---- - pc-bios/s390-ccw/s390-ccw.h | 1 + - 3 files changed, 65 insertions(+), 38 deletions(-) - -diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c -index 414c3f1b47..af73254acb 100644 ---- a/pc-bios/s390-ccw/bootmap.c -+++ b/pc-bios/s390-ccw/bootmap.c -@@ -678,8 +678,10 @@ static bool is_iso_bc_entry_compatible(IsoBcSection *s) - if (s->unused || !s->sector_count) { - return false; - } -- read_iso_sector(bswap32(s->load_rba), magic_sec, -- "Failed to read image sector 0"); -+ if (virtio_read(bswap32(s->load_rba), magic_sec)) { -+ puts("Failed to read image sector 0"); -+ return false; -+ } - - /* Checking bytes 8 - 32 for S390 Linux magic */ - return !memcmp(magic_sec + 8, linux_s390_magic, 24); -@@ -692,28 +694,35 @@ static uint32_t sec_offset[ISO9660_MAX_DIR_DEPTH]; - /* Remained directory space in bytes */ - static uint32_t dir_rem[ISO9660_MAX_DIR_DEPTH]; - --static inline uint32_t iso_get_file_size(uint32_t load_rba) -+static inline long iso_get_file_size(uint32_t load_rba) - { - IsoVolDesc *vd = (IsoVolDesc *)sec; - IsoDirHdr *cur_record = &vd->vd.primary.rootdir; - uint8_t *temp = sec + ISO_SECTOR_SIZE; - int level = 0; - -- read_iso_sector(ISO_PRIMARY_VD_SECTOR, sec, -- "Failed to read ISO primary descriptor"); -+ if (virtio_read(ISO_PRIMARY_VD_SECTOR, sec)) { -+ puts("Failed to read ISO primary descriptor"); -+ return -EIO; -+ } -+ - sec_loc[0] = iso_733_to_u32(cur_record->ext_loc); - dir_rem[0] = 0; - sec_offset[0] = 0; - - while (level >= 0) { -- IPL_assert(sec_offset[level] <= ISO_SECTOR_SIZE, -- "Directory tree structure violation"); -+ if (sec_offset[level] > ISO_SECTOR_SIZE) { -+ puts("Directory tree structure violation"); -+ return -EIO; -+ } - - cur_record = (IsoDirHdr *)(temp + sec_offset[level]); - - if (sec_offset[level] == 0) { -- read_iso_sector(sec_loc[level], temp, -- "Failed to read ISO directory"); -+ if (virtio_read(sec_loc[level], temp)) { -+ puts("Failed to read ISO directory"); -+ return -EIO; -+ } - if (dir_rem[level] == 0) { - /* Skip self and parent records */ - dir_rem[level] = iso_733_to_u32(cur_record->data_len) - -@@ -758,8 +767,10 @@ static inline uint32_t iso_get_file_size(uint32_t load_rba) - if (dir_rem[level] == 0) { - /* Nothing remaining */ - level--; -- read_iso_sector(sec_loc[level], temp, -- "Failed to read ISO directory"); -+ if (virtio_read(sec_loc[level], temp)) { -+ puts("Failed to read ISO directory"); -+ return -EIO; -+ } - } - } - -@@ -774,19 +785,24 @@ static void load_iso_bc_entry(IsoBcSection *load) - * is padded and ISO_SECTOR_SIZE bytes aligned - */ - uint32_t blks_to_load = bswap16(s.sector_count) >> ET_SECTOR_SHIFT; -- uint32_t real_size = iso_get_file_size(bswap32(s.load_rba)); -+ long real_size = iso_get_file_size(bswap32(s.load_rba)); - -- if (real_size) { -+ if (real_size > 0) { - /* Round up blocks to load */ - blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE; - puts("ISO boot image size verified"); - } else { - puts("ISO boot image size could not be verified"); -+ if (real_size < 0) { -+ return; -+ } - } - -- read_iso_boot_image(bswap32(s.load_rba), -+ if (read_iso_boot_image(bswap32(s.load_rba), - (void *)((uint64_t)bswap16(s.load_segment)), -- blks_to_load); -+ blks_to_load)) { -+ return; -+ } - - jump_to_low_kernel(); - } -@@ -809,17 +825,18 @@ static uint32_t find_iso_bc(void) - return bswap32(et->bc_offset); - } - } -- read_iso_sector(block_num++, sec, -- "Failed to read ISO volume descriptor"); -+ if (virtio_read(block_num++, sec)) { -+ puts("Failed to read ISO volume descriptor"); -+ return 0; -+ } - } - - return 0; - } - --static IsoBcSection *find_iso_bc_entry(void) -+static IsoBcSection *find_iso_bc_entry(uint32_t offset) - { - IsoBcEntry *e = (IsoBcEntry *)sec; -- uint32_t offset = find_iso_bc(); - int i; - unsigned int loadparm = get_loadparm_index(); - -@@ -827,11 +844,13 @@ static IsoBcSection *find_iso_bc_entry(void) - return NULL; - } - -- read_iso_sector(offset, sec, "Failed to read El Torito boot catalog"); -+ if (virtio_read(offset, sec)) { -+ puts("Failed to read El Torito boot catalog"); -+ return NULL; -+ } - - if (!is_iso_bc_valid(e)) { - /* The validation entry is mandatory */ -- panic("No valid boot catalog found!\n"); - return NULL; - } - -@@ -851,19 +870,25 @@ static IsoBcSection *find_iso_bc_entry(void) - } - } - -- panic("No suitable boot entry found on ISO-9660 media!\n"); -- - return NULL; - } - --static void ipl_iso_el_torito(void) -+static int ipl_iso_el_torito(void) - { -- IsoBcSection *s = find_iso_bc_entry(); -+ uint32_t offset = find_iso_bc(); -+ if (!offset) { -+ return 0; -+ } -+ -+ IsoBcSection *s = find_iso_bc_entry(offset); - - if (s) { -- load_iso_bc_entry(s); -- /* no return */ -+ load_iso_bc_entry(s); /* only return in error */ -+ return -1; - } -+ -+ puts("No suitable boot entry found on ISO-9660 media!"); -+ return -EIO; - } - - /** -@@ -893,7 +918,9 @@ static void zipl_load_vblk(void) - if (blksize != VIRTIO_ISO_BLOCK_SIZE) { - virtio_assume_iso9660(); - } -- ipl_iso_el_torito(); -+ if (ipl_iso_el_torito()) { -+ return; -+ } - } - - if (blksize != VIRTIO_DASD_DEFAULT_BLOCK_SIZE) { -@@ -907,7 +934,9 @@ static void zipl_load_vscsi(void) - { - if (virtio_get_block_size() == VIRTIO_ISO_BLOCK_SIZE) { - /* Is it an ISO image in non-CD drive? */ -- ipl_iso_el_torito(); -+ if (ipl_iso_el_torito()) { -+ return; -+ } - } - - puts("Using guessed DASD geometry."); -diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h -index 4a7d8a91f1..3cb573b86b 100644 ---- a/pc-bios/s390-ccw/bootmap.h -+++ b/pc-bios/s390-ccw/bootmap.h -@@ -385,17 +385,14 @@ static inline uint32_t iso_733_to_u32(uint64_t x) - - #define ISO_PRIMARY_VD_SECTOR 16 - --static inline void read_iso_sector(uint32_t block_offset, void *buf, -- const char *errmsg) --{ -- IPL_assert(virtio_read_many(block_offset, buf, 1) == 0, errmsg); --} -- --static inline void read_iso_boot_image(uint32_t block_offset, void *load_addr, -+static inline int read_iso_boot_image(uint32_t block_offset, void *load_addr, - uint32_t blks_to_load) - { -- IPL_assert(virtio_read_many(block_offset, load_addr, blks_to_load) == 0, -- "Failed to read boot image!"); -+ if (virtio_read_many(block_offset, load_addr, blks_to_load)) { -+ puts("Failed to read boot image!"); -+ return -1; -+ } -+ return 0; - } - - #define ISO9660_MAX_DIR_DEPTH 8 -diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h -index 6abb34e563..3e844abd71 100644 ---- a/pc-bios/s390-ccw/s390-ccw.h -+++ b/pc-bios/s390-ccw/s390-ccw.h -@@ -30,6 +30,7 @@ typedef unsigned long long u64; - #define EIO 1 - #define EBUSY 2 - #define ENODEV 3 -+#define EINVAL 4 - - #ifndef MIN - #define MIN(a, b) (((a) < (b)) ? (a) : (b)) --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch deleted file mode 100644 index 6507ce176..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-Netboot-IPL-path.patch +++ /dev/null @@ -1,130 +0,0 @@ -From e572d55c45c5c84e386034b0f853476326a08197 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:45 -0400 -Subject: [PATCH 12/27] pc-bios/s390-ccw: Remove panics from Netboot IPL path -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [12/23] dd193b7e37849dc338d66ac40786e22ff050ae20 (thuth/qemu-kvm-cs9) - -Remove panic-on-error from Netboot specific functions so that error recovery -may be possible in the future. - -Functions that would previously panic now provide a return code. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-12-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit f1a2a6e41ef76e02ddc5ede3dd042ef96b4fb8d2) ---- - pc-bios/s390-ccw/bootmap.c | 1 + - pc-bios/s390-ccw/netmain.c | 17 +++++++++++------ - pc-bios/s390-ccw/s390-ccw.h | 2 +- - pc-bios/s390-ccw/virtio-net.c | 7 +++++-- - 4 files changed, 18 insertions(+), 9 deletions(-) - -diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c -index 652807a16a..95ef9104d0 100644 ---- a/pc-bios/s390-ccw/bootmap.c -+++ b/pc-bios/s390-ccw/bootmap.c -@@ -1072,6 +1072,7 @@ void zipl_load(void) - - if (virtio_get_device_type() == VIRTIO_ID_NET) { - netmain(); -+ panic("\n! Cannot IPL from this network !\n"); - } - - if (ipl_scsi()) { -diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c -index bc6ad8695f..d1a6c9a91c 100644 ---- a/pc-bios/s390-ccw/netmain.c -+++ b/pc-bios/s390-ccw/netmain.c -@@ -464,7 +464,7 @@ static bool find_net_dev(Schib *schib, int dev_no) - return false; - } - --static void virtio_setup(void) -+static bool virtio_setup(void) - { - Schib schib; - int ssid; -@@ -495,10 +495,10 @@ static void virtio_setup(void) - } - } - -- IPL_assert(found, "No virtio net device found"); -+ return found; - } - --void netmain(void) -+int netmain(void) - { - filename_ip_t fn_ip; - int rc, fnlen; -@@ -506,11 +506,15 @@ void netmain(void) - sclp_setup(); - puts("Network boot starting..."); - -- virtio_setup(); -+ if (!virtio_setup()) { -+ puts("No virtio net device found."); -+ return -1; -+ } - - rc = net_init(&fn_ip); - if (rc) { -- panic("Network initialization failed. Halting."); -+ puts("Network initialization failed."); -+ return -1; - } - - fnlen = strlen(fn_ip.filename); -@@ -528,5 +532,6 @@ void netmain(void) - jump_to_low_kernel(); - } - -- panic("Failed to load OS from network."); -+ puts("Failed to load OS from network."); -+ return -1; - } -diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h -index 3e844abd71..344ad15655 100644 ---- a/pc-bios/s390-ccw/s390-ccw.h -+++ b/pc-bios/s390-ccw/s390-ccw.h -@@ -57,7 +57,7 @@ unsigned int get_loadparm_index(void); - void main(void); - - /* netmain.c */ --void netmain(void); -+int netmain(void); - - /* sclp.c */ - void sclp_print(const char *string); -diff --git a/pc-bios/s390-ccw/virtio-net.c b/pc-bios/s390-ccw/virtio-net.c -index 2fcb0a58c5..f9854a22c3 100644 ---- a/pc-bios/s390-ccw/virtio-net.c -+++ b/pc-bios/s390-ccw/virtio-net.c -@@ -54,8 +54,11 @@ int virtio_net_init(void *mac_addr) - vdev->guest_features[0] = VIRTIO_NET_F_MAC_BIT; - virtio_setup_ccw(vdev); - -- IPL_assert(vdev->guest_features[0] & VIRTIO_NET_F_MAC_BIT, -- "virtio-net device does not support the MAC address feature"); -+ if (!(vdev->guest_features[0] & VIRTIO_NET_F_MAC_BIT)) { -+ puts("virtio-net device does not support the MAC address feature"); -+ return -1; -+ } -+ - memcpy(mac_addr, vdev->config.net.mac, ETH_ALEN); - - for (i = 0; i < 64; i++) { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch deleted file mode 100644 index 2d4fba44b..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Remove-panics-from-SCSI-IPL-path.patch +++ /dev/null @@ -1,554 +0,0 @@ -From 23033a524625ad13448eda28d429d9265b213a7f Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:43 -0400 -Subject: [PATCH 10/27] pc-bios/s390-ccw: Remove panics from SCSI IPL path -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [10/23] 4d8c58a0563e8977b045e7990deabe97c0614708 (thuth/qemu-kvm-cs9) - -Remove panic-on-error from virtio-scsi IPL specific functions so that error -recovery may be possible in the future. - -Functions that would previously panic now provide a return code. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-10-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit facd91ac1af75b657fc80189fe9cb026bb1abdbc) ---- - pc-bios/s390-ccw/bootmap.c | 88 ++++++++++++++----- - pc-bios/s390-ccw/virtio-blkdev.c | 4 +- - pc-bios/s390-ccw/virtio-scsi.c | 143 +++++++++++++++++++++---------- - 3 files changed, 164 insertions(+), 71 deletions(-) - -diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c -index b9596e28c7..652807a16a 100644 ---- a/pc-bios/s390-ccw/bootmap.c -+++ b/pc-bios/s390-ccw/bootmap.c -@@ -595,7 +595,7 @@ static int ipl_eckd(void) - * IPL a SCSI disk - */ - --static void zipl_load_segment(ComponentEntry *entry) -+static int zipl_load_segment(ComponentEntry *entry) - { - const int max_entries = (MAX_SECTOR_SIZE / sizeof(ScsiBlockPtr)); - ScsiBlockPtr *bprs = (void *)sec; -@@ -615,7 +615,10 @@ static void zipl_load_segment(ComponentEntry *entry) - do { - memset(bprs, FREE_SPACE_FILLER, bprs_size); - fill_hex_val(blk_no, &blockno, sizeof(blockno)); -- read_block(blockno, bprs, err_msg); -+ if (virtio_read(blockno, bprs)) { -+ puts(err_msg); -+ return -EIO; -+ } - - for (i = 0;; i++) { - uint64_t *cur_desc = (void *)&bprs[i]; -@@ -643,23 +646,37 @@ static void zipl_load_segment(ComponentEntry *entry) - } - address = virtio_load_direct(cur_desc[0], cur_desc[1], 0, - (void *)address); -- IPL_assert(address != -1, "zIPL load segment failed"); -+ if (!address) { -+ puts("zIPL load segment failed"); -+ return -EIO; -+ } - } - } while (blockno); -+ -+ return 0; - } - - /* Run a zipl program */ --static void zipl_run(ScsiBlockPtr *pte) -+static int zipl_run(ScsiBlockPtr *pte) - { - ComponentHeader *header; - ComponentEntry *entry; - uint8_t tmp_sec[MAX_SECTOR_SIZE]; - -- read_block(pte->blockno, tmp_sec, "Cannot read header"); -+ if (virtio_read(pte->blockno, tmp_sec)) { -+ puts("Cannot read header"); -+ return -EIO; -+ } - header = (ComponentHeader *)tmp_sec; - -- IPL_assert(magic_match(tmp_sec, ZIPL_MAGIC), "No zIPL magic in header"); -- IPL_assert(header->type == ZIPL_COMP_HEADER_IPL, "Bad header type"); -+ if (!magic_match(tmp_sec, ZIPL_MAGIC)) { -+ puts("No zIPL magic in header"); -+ return -EINVAL; -+ } -+ if (header->type != ZIPL_COMP_HEADER_IPL) { -+ puts("Bad header type"); -+ return -EINVAL; -+ } - - dputs("start loading images\n"); - -@@ -674,22 +691,30 @@ static void zipl_run(ScsiBlockPtr *pte) - continue; - } - -- zipl_load_segment(entry); -+ if (zipl_load_segment(entry)) { -+ return -1; -+ } - - entry++; - -- IPL_assert((uint8_t *)(&entry[1]) <= (tmp_sec + MAX_SECTOR_SIZE), -- "Wrong entry value"); -+ if ((uint8_t *)(&entry[1]) > (tmp_sec + MAX_SECTOR_SIZE)) { -+ puts("Wrong entry value"); -+ return -EINVAL; -+ } - } - -- IPL_assert(entry->component_type == ZIPL_COMP_ENTRY_EXEC, "No EXEC entry"); -+ if (entry->component_type != ZIPL_COMP_ENTRY_EXEC) { -+ puts("No EXEC entry"); -+ return -EINVAL; -+ } - - /* should not return */ - write_reset_psw(entry->compdat.load_psw); - jump_to_IPL_code(0); -+ return -1; - } - --static void ipl_scsi(void) -+static int ipl_scsi(void) - { - ScsiMbr *mbr = (void *)sec; - int program_table_entries = 0; -@@ -700,10 +725,13 @@ static void ipl_scsi(void) - - /* Grab the MBR */ - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -- read_block(0, mbr, "Cannot read block 0"); -+ if (virtio_read(0, mbr)) { -+ puts("Cannot read block 0"); -+ return -EIO; -+ } - - if (!magic_match(mbr->magic, ZIPL_MAGIC)) { -- return; -+ return 0; - } - - puts("Using SCSI scheme."); -@@ -711,11 +739,20 @@ static void ipl_scsi(void) - IPL_check(mbr->version_id == 1, - "Unknown MBR layout version, assuming version 1"); - debug_print_int("program table", mbr->pt.blockno); -- IPL_assert(mbr->pt.blockno, "No Program Table"); -+ if (!mbr->pt.blockno) { -+ puts("No Program Table"); -+ return -EINVAL; -+ } - - /* Parse the program table */ -- read_block(mbr->pt.blockno, sec, "Error reading Program Table"); -- IPL_assert(magic_match(sec, ZIPL_MAGIC), "No zIPL magic in PT"); -+ if (virtio_read(mbr->pt.blockno, sec)) { -+ puts("Error reading Program Table"); -+ return -EIO; -+ } -+ if (!magic_match(sec, ZIPL_MAGIC)) { -+ puts("No zIPL magic in Program Table"); -+ return -EINVAL; -+ } - - for (i = 0; i < MAX_BOOT_ENTRIES; i++) { - if (prog_table->entry[i].scsi.blockno) { -@@ -725,17 +762,22 @@ static void ipl_scsi(void) - } - - debug_print_int("program table entries", program_table_entries); -- IPL_assert(program_table_entries != 0, "Empty Program Table"); -+ if (program_table_entries == 0) { -+ puts("Empty Program Table"); -+ return -EINVAL; -+ } - - if (menu_is_enabled_enum()) { - loadparm = menu_get_enum_boot_index(valid_entries); - } - - debug_print_int("loadparm", loadparm); -- IPL_assert(loadparm < MAX_BOOT_ENTRIES, "loadparm value greater than" -- " maximum number of boot entries allowed"); -+ if (loadparm >= MAX_BOOT_ENTRIES) { -+ puts("loadparm value greater than max number of boot entries allowed"); -+ return -EINVAL; -+ } - -- zipl_run(&prog_table->entry[loadparm].scsi); /* no return */ -+ return zipl_run(&prog_table->entry[loadparm].scsi); - } - - /*********************************************************************** -@@ -1032,7 +1074,9 @@ void zipl_load(void) - netmain(); - } - -- ipl_scsi(); -+ if (ipl_scsi()) { -+ panic("\n! Cannot IPL this SCSI device !\n"); -+ } - - switch (virtio_get_device_type()) { - case VIRTIO_ID_BLOCK: -diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c -index 2666326801..1c585f034b 100644 ---- a/pc-bios/s390-ccw/virtio-blkdev.c -+++ b/pc-bios/s390-ccw/virtio-blkdev.c -@@ -73,13 +73,13 @@ unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list - unsigned long addr = (unsigned long)load_addr; - - if (sec_len != virtio_get_block_size()) { -- return -1; -+ return 0; - } - - printf("."); - status = virtio_read_many(sec, (void *)addr, sec_num); - if (status) { -- panic("I/O Error"); -+ return 0; - } - addr += sec_num * virtio_get_block_size(); - -diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c -index 6b4a1caf8a..71db75ce7b 100644 ---- a/pc-bios/s390-ccw/virtio-scsi.c -+++ b/pc-bios/s390-ccw/virtio-scsi.c -@@ -26,7 +26,7 @@ static uint8_t scsi_inquiry_std_response[256]; - static ScsiInquiryEvpdPages scsi_inquiry_evpd_pages_response; - static ScsiInquiryEvpdBl scsi_inquiry_evpd_bl_response; - --static inline void vs_assert(bool term, const char **msgs) -+static inline bool vs_assert(bool term, const char **msgs) - { - if (!term) { - int i = 0; -@@ -35,11 +35,13 @@ static inline void vs_assert(bool term, const char **msgs) - while (msgs[i]) { - printf("%s", msgs[i++]); - } -- panic(" !\n"); -+ puts(" !"); - } -+ -+ return term; - } - --static void virtio_scsi_verify_response(VirtioScsiCmdResp *resp, -+static bool virtio_scsi_verify_response(VirtioScsiCmdResp *resp, - const char *title) - { - const char *mr[] = { -@@ -56,8 +58,8 @@ static void virtio_scsi_verify_response(VirtioScsiCmdResp *resp, - 0 - }; - -- vs_assert(resp->response == VIRTIO_SCSI_S_OK, mr); -- vs_assert(resp->status == CDB_STATUS_GOOD, ms); -+ return vs_assert(resp->response == VIRTIO_SCSI_S_OK, mr) && -+ vs_assert(resp->status == CDB_STATUS_GOOD, ms); - } - - static void prepare_request(VDev *vdev, const void *cdb, int cdb_size, -@@ -78,24 +80,31 @@ static void prepare_request(VDev *vdev, const void *cdb, int cdb_size, - } - } - --static inline void vs_io_assert(bool term, const char *msg) -+static inline bool vs_io_assert(bool term, const char *msg) - { -- if (!term) { -- virtio_scsi_verify_response(&resp, msg); -+ if (!term && !virtio_scsi_verify_response(&resp, msg)) { -+ return false; - } -+ -+ return true; - } - --static void vs_run(const char *title, VirtioCmd *cmd, VDev *vdev, -+static int vs_run(const char *title, VirtioCmd *cmd, VDev *vdev, - const void *cdb, int cdb_size, - void *data, uint32_t data_size) - { - prepare_request(vdev, cdb, cdb_size, data, data_size); -- vs_io_assert(virtio_run(vdev, VR_REQUEST, cmd) == 0, title); -+ if (!vs_io_assert(virtio_run(vdev, VR_REQUEST, cmd) == 0, title)) { -+ puts(title); -+ return -EIO; -+ } -+ -+ return 0; - } - - /* SCSI protocol implementation routines */ - --static bool scsi_inquiry(VDev *vdev, uint8_t evpd, uint8_t page, -+static int scsi_inquiry(VDev *vdev, uint8_t evpd, uint8_t page, - void *data, uint32_t data_size) - { - ScsiCdbInquiry cdb = { -@@ -110,12 +119,13 @@ static bool scsi_inquiry(VDev *vdev, uint8_t evpd, uint8_t page, - { data, data_size, VRING_DESC_F_WRITE }, - }; - -- vs_run("inquiry", inquiry, vdev, &cdb, sizeof(cdb), data, data_size); -+ int ret = vs_run("inquiry", inquiry, -+ vdev, &cdb, sizeof(cdb), data, data_size); - -- return virtio_scsi_response_ok(&resp); -+ return ret ? ret : virtio_scsi_response_ok(&resp); - } - --static bool scsi_test_unit_ready(VDev *vdev) -+static int scsi_test_unit_ready(VDev *vdev) - { - ScsiCdbTestUnitReady cdb = { - .command = 0x00, -@@ -131,7 +141,7 @@ static bool scsi_test_unit_ready(VDev *vdev) - return virtio_scsi_response_ok(&resp); - } - --static bool scsi_report_luns(VDev *vdev, void *data, uint32_t data_size) -+static int scsi_report_luns(VDev *vdev, void *data, uint32_t data_size) - { - ScsiCdbReportLuns cdb = { - .command = 0xa0, -@@ -144,13 +154,13 @@ static bool scsi_report_luns(VDev *vdev, void *data, uint32_t data_size) - { data, data_size, VRING_DESC_F_WRITE }, - }; - -- vs_run("report luns", report_luns, -+ int ret = vs_run("report luns", report_luns, - vdev, &cdb, sizeof(cdb), data, data_size); - -- return virtio_scsi_response_ok(&resp); -+ return ret ? ret : virtio_scsi_response_ok(&resp); - } - --static bool scsi_read_10(VDev *vdev, -+static int scsi_read_10(VDev *vdev, - unsigned long sector, int sectors, void *data, - unsigned int data_size) - { -@@ -168,12 +178,13 @@ static bool scsi_read_10(VDev *vdev, - debug_print_int("read_10 sector", sector); - debug_print_int("read_10 sectors", sectors); - -- vs_run("read(10)", read_10, vdev, &cdb, sizeof(cdb), data, data_size); -+ int ret = vs_run("read(10)", read_10, -+ vdev, &cdb, sizeof(cdb), data, data_size); - -- return virtio_scsi_response_ok(&resp); -+ return ret ? ret : virtio_scsi_response_ok(&resp); - } - --static bool scsi_read_capacity(VDev *vdev, -+static int scsi_read_capacity(VDev *vdev, - void *data, uint32_t data_size) - { - ScsiCdbReadCapacity16 cdb = { -@@ -187,10 +198,10 @@ static bool scsi_read_capacity(VDev *vdev, - { data, data_size, VRING_DESC_F_WRITE }, - }; - -- vs_run("read capacity", read_capacity_16, -+ int ret = vs_run("read capacity", read_capacity_16, - vdev, &cdb, sizeof(cdb), data, data_size); - -- return virtio_scsi_response_ok(&resp); -+ return ret ? ret : virtio_scsi_response_ok(&resp); - } - - /* virtio-scsi routines */ -@@ -207,7 +218,7 @@ static int virtio_scsi_locate_device(VDev *vdev) - static uint8_t data[16 + 8 * 63]; - ScsiLunReport *r = (void *) data; - ScsiDevice *sdev = vdev->scsi_device; -- int i, luns; -+ int i, ret, luns; - - /* QEMU has hardcoded channel #0 in many places. - * If this hardcoded value is ever changed, we'll need to add code for -@@ -233,13 +244,21 @@ static int virtio_scsi_locate_device(VDev *vdev) - sdev->channel = channel; - sdev->target = target; - sdev->lun = 0; /* LUN has to be 0 for REPORT LUNS */ -- if (!scsi_report_luns(vdev, data, sizeof(data))) { -+ ret = scsi_report_luns(vdev, data, sizeof(data)); -+ if (ret < 0) { -+ return ret; -+ } -+ -+ else if (ret == 0) { - if (resp.response == VIRTIO_SCSI_S_BAD_TARGET) { - continue; - } - printf("target 0x%X\n", target); -- virtio_scsi_verify_response(&resp, "SCSI cannot report LUNs"); -+ if (!virtio_scsi_verify_response(&resp, "SCSI cannot report LUNs")) { -+ return -EIO; -+ } - } -+ - if (r->lun_list_len == 0) { - printf("no LUNs for target 0x%X\n", target); - continue; -@@ -283,7 +302,9 @@ int virtio_scsi_read_many(VDev *vdev, - data_size = sector_count * virtio_get_block_size() * f; - if (!scsi_read_10(vdev, sector * f, sector_count * f, load_addr, - data_size)) { -- virtio_scsi_verify_response(&resp, "virtio-scsi:read_many"); -+ if (!virtio_scsi_verify_response(&resp, "virtio-scsi:read_many")) { -+ return -1; -+ } - } - load_addr += data_size; - sector += sector_count; -@@ -352,11 +373,16 @@ static int virtio_scsi_setup(VDev *vdev) - uint8_t code = resp.sense[0] & SCSI_SENSE_CODE_MASK; - uint8_t sense_key = resp.sense[2] & SCSI_SENSE_KEY_MASK; - -- IPL_assert(resp.sense_len != 0, "virtio-scsi:setup: no SENSE data"); -+ if (resp.sense_len == 0) { -+ puts("virtio-scsi: setup: no SENSE data"); -+ return -EINVAL; -+ } - -- IPL_assert(retry_test_unit_ready && code == 0x70 && -- sense_key == SCSI_SENSE_KEY_UNIT_ATTENTION, -- "virtio-scsi:setup: cannot retry"); -+ if (!retry_test_unit_ready || code != 0x70 || -+ sense_key != SCSI_SENSE_KEY_UNIT_ATTENTION) { -+ puts("virtio-scsi:setup: cannot retry"); -+ return -EIO; -+ } - - /* retry on CHECK_CONDITION/UNIT_ATTENTION as it - * may not designate a real error, but it may be -@@ -367,16 +393,22 @@ static int virtio_scsi_setup(VDev *vdev) - continue; - } - -- virtio_scsi_verify_response(&resp, "virtio-scsi:setup"); -+ if (!virtio_scsi_verify_response(&resp, "virtio-scsi:setup")) { -+ return -1; -+ } - } - - /* read and cache SCSI INQUIRY response */ -- if (!scsi_inquiry(vdev, -+ ret = scsi_inquiry(vdev, - SCSI_INQUIRY_STANDARD, - SCSI_INQUIRY_STANDARD_NONE, - scsi_inquiry_std_response, -- sizeof(scsi_inquiry_std_response))) { -- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:inquiry"); -+ sizeof(scsi_inquiry_std_response)); -+ if (ret < 1) { -+ if (ret != 0 || !virtio_scsi_verify_response(&resp, -+ "virtio-scsi:setup:inquiry")) { -+ return -1; -+ } - } - - if (virtio_scsi_inquiry_response_is_cdrom(scsi_inquiry_std_response)) { -@@ -385,12 +417,16 @@ static int virtio_scsi_setup(VDev *vdev) - vdev->scsi_block_size = VIRTIO_ISO_BLOCK_SIZE; - } - -- if (!scsi_inquiry(vdev, -+ ret = scsi_inquiry(vdev, - SCSI_INQUIRY_EVPD, - SCSI_INQUIRY_EVPD_SUPPORTED_PAGES, - evpd, -- sizeof(*evpd))) { -- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:supported_pages"); -+ sizeof(*evpd)); -+ if (ret < 1) { -+ if (ret != 0 || !virtio_scsi_verify_response(&resp, -+ "virtio-scsi:setup:supported_pages")) { -+ return -1; -+ } - } - - debug_print_int("EVPD length", evpd->page_length); -@@ -402,12 +438,16 @@ static int virtio_scsi_setup(VDev *vdev) - continue; - } - -- if (!scsi_inquiry(vdev, -+ ret = scsi_inquiry(vdev, - SCSI_INQUIRY_EVPD, - SCSI_INQUIRY_EVPD_BLOCK_LIMITS, - evpd_bl, -- sizeof(*evpd_bl))) { -- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:blocklimits"); -+ sizeof(*evpd_bl)); -+ if (ret < 1) { -+ if (ret != 0 || !virtio_scsi_verify_response(&resp, -+ "virtio-scsi:setup:blocklimits")) { -+ return -1; -+ } - } - - debug_print_int("max transfer", evpd_bl->max_transfer); -@@ -423,8 +463,12 @@ static int virtio_scsi_setup(VDev *vdev) - vdev->max_transfer = MIN_NON_ZERO(VIRTIO_SCSI_MAX_SECTORS, - vdev->max_transfer); - -- if (!scsi_read_capacity(vdev, data, data_size)) { -- virtio_scsi_verify_response(&resp, "virtio-scsi:setup:read_capacity"); -+ ret = scsi_read_capacity(vdev, data, data_size); -+ if (ret < 1) { -+ if (ret != 0 || !virtio_scsi_verify_response(&resp, -+ "virtio-scsi:setup:read_capacity")) { -+ return -1; -+ } - } - scsi_parse_capacity_report(data, &vdev->scsi_last_block, - (uint32_t *) &vdev->scsi_block_size); -@@ -439,10 +483,15 @@ int virtio_scsi_setup_device(SubChannelId schid) - vdev->schid = schid; - virtio_setup_ccw(vdev); - -- IPL_assert(vdev->config.scsi.sense_size == VIRTIO_SCSI_SENSE_SIZE, -- "Config: sense size mismatch"); -- IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE, -- "Config: CDB size mismatch"); -+ if (vdev->config.scsi.sense_size != VIRTIO_SCSI_SENSE_SIZE) { -+ puts("Config: sense size mismatch"); -+ return -EINVAL; -+ } -+ -+ if (vdev->config.scsi.cdb_size != VIRTIO_SCSI_CDB_SIZE) { -+ puts("Config: CDB size mismatch"); -+ return -EINVAL; -+ } - - puts("Using virtio-scsi."); - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch deleted file mode 100644 index 037d9876f..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390-ccw-Use-the-libc-from-SLOF-and-remove-s.patch +++ /dev/null @@ -1,1208 +0,0 @@ -From 4207901122ef7ad3f08ed2e387bd133cc4a35baf Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:36 -0400 -Subject: [PATCH 02/27] pc-bios/s390-ccw: Use the libc from SLOF and remove - sclp prints -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [2/23] ee701f93051e2bfb79da5cbbd089b24490bca128 (thuth/qemu-kvm-cs9) - -We are already using the libc from SLOF for the s390-netboot.img, and -this libc implementation is way more complete and accurate than the -simple implementation that we currently use for the s390-ccw.img binary. -Since we are now always assuming that the SLOF submodule is available -when building the s390-ccw bios (see commit bf6903f6944f), we can drop -the simple implementation and use the SLOF libc for the s390-ccw.img -binary, too. - -Additionally replace sclp_print calls with puts/printf now that it is -available. - -Co-authored by: Thomas Huth -Signed-off-by: Jared Rossi -Message-ID: <20241020012953.1380075-3-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 9f4278837dc770266c8a026696dd91a525dd2682) ---- - pc-bios/s390-ccw/Makefile | 15 +++-- - pc-bios/s390-ccw/bootmap.c | 47 ++++++------- - pc-bios/s390-ccw/bootmap.h | 4 +- - pc-bios/s390-ccw/cio.c | 78 ++++++++++------------ - pc-bios/s390-ccw/dasd-ipl.c | 5 +- - pc-bios/s390-ccw/jump2ipl.c | 5 +- - pc-bios/s390-ccw/libc.c | 88 ------------------------ - pc-bios/s390-ccw/libc.h | 89 ------------------------- - pc-bios/s390-ccw/main.c | 14 ++-- - pc-bios/s390-ccw/menu.c | 51 +++++++------- - pc-bios/s390-ccw/netboot.mak | 3 - - pc-bios/s390-ccw/netmain.c | 10 +-- - pc-bios/s390-ccw/s390-ccw.h | 30 +++------ - pc-bios/s390-ccw/sclp.c | 7 +- - pc-bios/s390-ccw/virtio-blkdev.c | 6 +- - pc-bios/s390-ccw/virtio-scsi.c | 17 ++--- - pc-bios/s390-ccw/virtio.c | 2 +- - tests/tcg/s390x/Makefile.softmmu-target | 2 +- - tests/tcg/s390x/console.c | 3 + - 19 files changed, 140 insertions(+), 336 deletions(-) - delete mode 100644 pc-bios/s390-ccw/libc.c - delete mode 100644 pc-bios/s390-ccw/libc.h - -diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile -index 6207911b53..3f4232636e 100644 ---- a/pc-bios/s390-ccw/Makefile -+++ b/pc-bios/s390-ccw/Makefile -@@ -33,13 +33,18 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d - .PHONY : all clean build-all distclean - - OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ -- virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o -+ virtio.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o -+ -+SLOF_DIR := $(SRC_PATH)/../../roms/SLOF -+ -+LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include - - EXTRA_CFLAGS += -Wall - EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE - EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables - EXTRA_CFLAGS += -msoft-float - EXTRA_CFLAGS += -std=gnu99 -+EXTRA_CFLAGS += $(LIBC_INC) - LDFLAGS += -Wl,-pie -nostdlib -z noexecstack - - cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null -@@ -55,18 +60,18 @@ config-cc.mak: Makefile - $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak - -include config-cc.mak - -+include $(SRC_PATH)/netboot.mak -+ - build-all: s390-ccw.img s390-netboot.img - --s390-ccw.elf: $(OBJECTS) -- $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking) -+s390-ccw.elf: $(OBJECTS) libc.a -+ $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking) - - s390-ccw.img: s390-ccw.elf - $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into) - - $(OBJECTS): Makefile - --include $(SRC_PATH)/netboot.mak -- - ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS)) - -include $(ALL_OBJS:%.o=%.d) - -diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c -index a2137449dc..3cc79706be 100644 ---- a/pc-bios/s390-ccw/bootmap.c -+++ b/pc-bios/s390-ccw/bootmap.c -@@ -8,7 +8,8 @@ - * directory. - */ - --#include "libc.h" -+#include -+#include - #include "s390-ccw.h" - #include "s390-arch.h" - #include "bootmap.h" -@@ -21,7 +22,7 @@ - - #ifdef DEBUG_FALLBACK - #define dputs(txt) \ -- do { sclp_print("zipl: " txt); } while (0) -+ do { printf("zipl: " txt); } while (0) - #else - #define dputs(fmt, ...) \ - do { } while (0) -@@ -270,7 +271,7 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) - prev_block_nr = cur_block_nr; - } - -- sclp_print("No zipl boot menu data found. Booting default entry."); -+ printf("No zipl boot menu data found. Booting default entry."); - return 0; - } - -@@ -338,22 +339,22 @@ static void ipl_eckd_cdl(void) - block_number_t bmt_block_nr, s1b_block_nr; - - /* we have just read the block #0 and recognized it as "IPL1" */ -- sclp_print("CDL\n"); -+ puts("CDL"); - - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); - read_block(1, ipl2, "Cannot read IPL2 record at block 1"); - - mbr = &ipl2->mbr; - if (!magic_match(mbr, ZIPL_MAGIC)) { -- sclp_print("No zIPL section in IPL2 record.\n"); -+ puts("No zIPL section in IPL2 record."); - return; - } - if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) { -- sclp_print("Bad block size in zIPL section of IPL2 record.\n"); -+ puts("Bad block size in zIPL section of IPL2 record."); - return; - } - if (mbr->dev_type != DEV_TYPE_ECKD) { -- sclp_print("Non-ECKD device type in zIPL section of IPL2 record.\n"); -+ puts("Non-ECKD device type in zIPL section of IPL2 record."); - return; - } - -@@ -366,11 +367,11 @@ static void ipl_eckd_cdl(void) - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); - read_block(2, vlbl, "Cannot read Volume Label at block 2"); - if (!magic_match(vlbl->key, VOL1_MAGIC)) { -- sclp_print("Invalid magic of volume label block.\n"); -+ puts("Invalid magic of volume label block."); - return; - } - if (!magic_match(vlbl->f.key, VOL1_MAGIC)) { -- sclp_print("Invalid magic of volser block.\n"); -+ puts("Invalid magic of volser block."); - return; - } - print_volser(vlbl->f.volser); -@@ -384,8 +385,8 @@ static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) - LDL_VTOC *vlbl = (void *)sec; /* already read, 3rd block */ - char msg[4] = { '?', '.', '\n', '\0' }; - -- sclp_print((mode == ECKD_CMS) ? "CMS" : "LDL"); -- sclp_print(" version "); -+ printf((mode == ECKD_CMS) ? "CMS" : "LDL"); -+ printf(" version "); - switch (vlbl->LDL_version) { - case LDL1_VERSION: - msg[0] = '1'; -@@ -398,7 +399,7 @@ static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode) - msg[1] = '?'; - break; - } -- sclp_print(msg); -+ printf("%s", msg); - print_volser(vlbl->volser); - } - -@@ -419,7 +420,7 @@ static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) - if (!magic_match(ipl1->bip.magic, ZIPL_MAGIC)) { - return; /* not applicable layout */ - } -- sclp_print("unlabeled LDL.\n"); -+ puts("unlabeled LDL."); - } - verify_boot_info(&ipl1->bip); - -@@ -466,7 +467,7 @@ static void print_eckd_msg(void) - *p-- = ' '; - } - } -- sclp_print(msg); -+ printf("%s", msg); - } - - static void ipl_eckd(void) -@@ -488,11 +489,11 @@ static void ipl_eckd(void) - if (eckd_valid_address((ExtEckdBlockPtr *)&vlbl->f.br, 0)) { - ldipl_bmt = eckd_find_bmt((ExtEckdBlockPtr *)&vlbl->f.br); - if (ldipl_bmt) { -- sclp_print("List-Directed\n"); -+ puts("List-Directed"); - /* LD-IPL does not use the S1B bock, just make it NULL */ - run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR); - /* Only return in error, retry as CCW-IPL */ -- sclp_print("Retrying IPL "); -+ printf("Retrying IPL "); - print_eckd_msg(); - } - memset(sec, FREE_SPACE_FILLER, sizeof(sec)); -@@ -634,7 +635,7 @@ static void ipl_scsi(void) - return; - } - -- sclp_print("Using SCSI scheme.\n"); -+ puts("Using SCSI scheme."); - debug_print_int("MBR Version", mbr->version_id); - IPL_check(mbr->version_id == 1, - "Unknown MBR layout version, assuming version 1"); -@@ -743,7 +744,7 @@ static inline uint32_t iso_get_file_size(uint32_t load_rba) - if (cur_record->file_flags & 0x2) { - /* Subdirectory */ - if (level == ISO9660_MAX_DIR_DEPTH - 1) { -- sclp_print("ISO-9660 directory depth limit exceeded\n"); -+ puts("ISO-9660 directory depth limit exceeded"); - } else { - level++; - sec_loc[level] = iso_733_to_u32(cur_record->ext_loc); -@@ -778,9 +779,9 @@ static void load_iso_bc_entry(IsoBcSection *load) - if (real_size) { - /* Round up blocks to load */ - blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE; -- sclp_print("ISO boot image size verified\n"); -+ puts("ISO boot image size verified"); - } else { -- sclp_print("ISO boot image size could not be verified\n"); -+ puts("ISO boot image size could not be verified"); - } - - read_iso_boot_image(bswap32(s.load_rba), -@@ -896,7 +897,7 @@ static void zipl_load_vblk(void) - } - - if (blksize != VIRTIO_DASD_DEFAULT_BLOCK_SIZE) { -- sclp_print("Using guessed DASD geometry.\n"); -+ puts("Using guessed DASD geometry."); - virtio_assume_eckd(); - } - ipl_eckd(); -@@ -909,7 +910,7 @@ static void zipl_load_vscsi(void) - ipl_iso_el_torito(); - } - -- sclp_print("Using guessed DASD geometry.\n"); -+ puts("Using guessed DASD geometry."); - virtio_assume_eckd(); - ipl_eckd(); - } -@@ -944,5 +945,5 @@ void zipl_load(void) - panic("\n! Unknown IPL device type !\n"); - } - -- sclp_print("zIPL load failed.\n"); -+ puts("zIPL load failed."); - } -diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h -index d4690a88c2..4a7d8a91f1 100644 ---- a/pc-bios/s390-ccw/bootmap.h -+++ b/pc-bios/s390-ccw/bootmap.h -@@ -336,9 +336,7 @@ static inline void print_volser(const void *volser) - - ebcdic_to_ascii((char *)volser, ascii, 6); - ascii[6] = '\0'; -- sclp_print("VOLSER=["); -- sclp_print(ascii); -- sclp_print("]\n"); -+ printf("VOLSER=[%s]\n", ascii); - } - - static inline bool unused_space(const void *p, size_t size) -diff --git a/pc-bios/s390-ccw/cio.c b/pc-bios/s390-ccw/cio.c -index 83ca27ab41..7b09a38c96 100644 ---- a/pc-bios/s390-ccw/cio.c -+++ b/pc-bios/s390-ccw/cio.c -@@ -11,7 +11,8 @@ - * directory. - */ - --#include "libc.h" -+#include -+#include - #include "s390-ccw.h" - #include "s390-arch.h" - #include "helper.h" -@@ -90,9 +91,9 @@ static void print_eckd_dasd_sense_data(SenseDataEckdDasd *sd) - char msgline[512]; - - if (sd->config_info & 0x8000) { -- sclp_print("Eckd Dasd Sense Data (fmt 24-bytes):\n"); -+ puts("Eckd Dasd Sense Data (fmt 24-bytes):"); - } else { -- sclp_print("Eckd Dasd Sense Data (fmt 32-bytes):\n"); -+ puts("Eckd Dasd Sense Data (fmt 32-bytes):"); - } - - strcat(msgline, " Sense Condition Flags :"); -@@ -158,22 +159,21 @@ static void print_eckd_dasd_sense_data(SenseDataEckdDasd *sd) - if (sd->status[1] & SNS_STAT2_IMPRECISE_END) { - strcat(msgline, " [Imprecise-End]"); - } -- strcat(msgline, "\n"); -- sclp_print(msgline); -- -- print_int(" Residual Count =", sd->res_count); -- print_int(" Phys Drive ID =", sd->phys_drive_id); -- print_int(" low cyl address =", sd->low_cyl_addr); -- print_int(" head addr & hi cyl =", sd->head_high_cyl_addr); -- print_int(" format/message =", sd->fmt_msg); -- print_int(" fmt-dependent[0-7] =", sd->fmt_dependent_info[0]); -- print_int(" fmt-dependent[8-15]=", sd->fmt_dependent_info[1]); -- print_int(" prog action code =", sd->program_action_code); -- print_int(" Configuration info =", sd->config_info); -- print_int(" mcode / hi-cyl =", sd->mcode_hicyl); -- print_int(" cyl & head addr [0]=", sd->cyl_head_addr[0]); -- print_int(" cyl & head addr [1]=", sd->cyl_head_addr[1]); -- print_int(" cyl & head addr [2]=", sd->cyl_head_addr[2]); -+ puts(msgline); -+ -+ printf(" Residual Count = 0x%X\n", sd->res_count); -+ printf(" Phys Drive ID = 0x%X\n", sd->phys_drive_id); -+ printf(" low cyl address = 0x%X\n", sd->low_cyl_addr); -+ printf(" head addr & hi cyl = 0x%X\n", sd->head_high_cyl_addr); -+ printf(" format/message = 0x%X\n", sd->fmt_msg); -+ printf(" fmt-dependent[0-7] = 0x%llX\n", sd->fmt_dependent_info[0]); -+ printf(" fmt-dependent[8-15]= 0x%llX\n", sd->fmt_dependent_info[1]); -+ printf(" prog action code = 0x%X\n", sd->program_action_code); -+ printf(" Configuration info = 0x%X\n", sd->config_info); -+ printf(" mcode / hi-cyl = 0x%X\n", sd->mcode_hicyl); -+ printf(" cyl & head addr [0]= 0x%X\n", sd->cyl_head_addr[0]); -+ printf(" cyl & head addr [1]= 0x%X\n", sd->cyl_head_addr[1]); -+ printf(" cyl & head addr [2]= 0x%X\n", sd->cyl_head_addr[2]); - } - - static void print_irb_err(Irb *irb) -@@ -182,7 +182,7 @@ static void print_irb_err(Irb *irb) - uint64_t prev_ccw = *(uint64_t *)u32toptr(irb->scsw.cpa - 8); - char msgline[256]; - -- sclp_print("Interrupt Response Block Data:\n"); -+ puts("Interrupt Response Block Data:"); - - strcat(msgline, " Function Ctrl :"); - if (irb->scsw.ctrl & SCSW_FCTL_START_FUNC) { -@@ -194,8 +194,7 @@ static void print_irb_err(Irb *irb) - if (irb->scsw.ctrl & SCSW_FCTL_CLEAR_FUNC) { - strcat(msgline, " [Clear]"); - } -- strcat(msgline, "\n"); -- sclp_print(msgline); -+ puts(msgline); - - msgline[0] = '\0'; - strcat(msgline, " Activity Ctrl :"); -@@ -220,8 +219,7 @@ static void print_irb_err(Irb *irb) - if (irb->scsw.ctrl & SCSW_ACTL_SUSPENDED) { - strcat(msgline, " [Suspended]"); - } -- strcat(msgline, "\n"); -- sclp_print(msgline); -+ puts(msgline); - - msgline[0] = '\0'; - strcat(msgline, " Status Ctrl :"); -@@ -240,9 +238,7 @@ static void print_irb_err(Irb *irb) - if (irb->scsw.ctrl & SCSW_SCTL_STATUS_PEND) { - strcat(msgline, " [Status-Pending]"); - } -- -- strcat(msgline, "\n"); -- sclp_print(msgline); -+ puts(msgline); - - msgline[0] = '\0'; - strcat(msgline, " Device Status :"); -@@ -270,8 +266,7 @@ static void print_irb_err(Irb *irb) - if (irb->scsw.dstat & SCSW_DSTAT_UEXCP) { - strcat(msgline, " [Unit-Exception]"); - } -- strcat(msgline, "\n"); -- sclp_print(msgline); -+ puts(msgline); - - msgline[0] = '\0'; - strcat(msgline, " Channel Status :"); -@@ -299,12 +294,11 @@ static void print_irb_err(Irb *irb) - if (irb->scsw.cstat & SCSW_CSTAT_CHAINCHK) { - strcat(msgline, " [Chaining-Check]"); - } -- strcat(msgline, "\n"); -- sclp_print(msgline); -+ puts(msgline); - -- print_int(" cpa=", irb->scsw.cpa); -- print_int(" prev_ccw=", prev_ccw); -- print_int(" this_ccw=", this_ccw); -+ printf(" cpa= 0x%X\n", irb->scsw.cpa); -+ printf(" prev_ccw= 0x%llX\n", prev_ccw); -+ printf(" this_ccw= 0x%llX\n", this_ccw); - } - - /* -@@ -341,7 +335,7 @@ static int __do_cio(SubChannelId schid, uint32_t ccw_addr, int fmt, Irb *irb) - return -1; - } - if (rc) { -- print_int("ssch failed with cc=", rc); -+ printf("ssch failed with cc= 0x%x\n", rc); - return rc; - } - -@@ -350,7 +344,7 @@ static int __do_cio(SubChannelId schid, uint32_t ccw_addr, int fmt, Irb *irb) - /* collect status */ - rc = tsch(schid, irb); - if (rc) { -- print_int("tsch failed with cc=", rc); -+ printf("tsch failed with cc= 0x%X\n", rc); - } - - return rc; -@@ -406,12 +400,12 @@ int do_cio(SubChannelId schid, uint16_t cutype, uint32_t ccw_addr, int fmt) - continue; - } - -- sclp_print("cio device error\n"); -- print_int(" ssid ", schid.ssid); -- print_int(" cssid ", schid.cssid); -- print_int(" sch_no", schid.sch_no); -- print_int(" ctrl-unit type", cutype); -- sclp_print("\n"); -+ printf("cio device error\n"); -+ printf(" ssid 0x%X\n", schid.ssid); -+ printf(" cssid 0x%X\n", schid.cssid); -+ printf(" sch_no 0x%X\n", schid.sch_no); -+ printf(" ctrl-unit type 0x%X\n", cutype); -+ printf("\n"); - print_irb_err(&irb); - if (cutype == CU_TYPE_DASD_3990 || cutype == CU_TYPE_DASD_2107 || - cutype == CU_TYPE_UNKNOWN) { -diff --git a/pc-bios/s390-ccw/dasd-ipl.c b/pc-bios/s390-ccw/dasd-ipl.c -index 254bb1a15e..ae751adec1 100644 ---- a/pc-bios/s390-ccw/dasd-ipl.c -+++ b/pc-bios/s390-ccw/dasd-ipl.c -@@ -8,7 +8,8 @@ - * directory. - */ - --#include "libc.h" -+#include -+#include - #include "s390-ccw.h" - #include "s390-arch.h" - #include "dasd-ipl.h" -@@ -82,7 +83,7 @@ static int run_dynamic_ccw_program(SubChannelId schid, uint16_t cutype, - do { - has_next = dynamic_cp_fixup(cpa, &next_cpa); - -- print_int("executing ccw chain at ", cpa); -+ printf("executing ccw chain at 0x%X\n", cpa); - enable_prefixing(); - rc = do_cio(schid, cutype, cpa, CCW_FMT0); - disable_prefixing(); -diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c -index 78f5f46533..80b7f6a1f3 100644 ---- a/pc-bios/s390-ccw/jump2ipl.c -+++ b/pc-bios/s390-ccw/jump2ipl.c -@@ -6,7 +6,8 @@ - * directory. - */ - --#include "libc.h" -+#include -+#include - #include "s390-ccw.h" - #include "s390-arch.h" - -@@ -57,7 +58,7 @@ void jump_to_IPL_code(uint64_t address) - debug_print_int("set IPL addr to", address ?: *reset_psw & PSW_MASK_SHORT_ADDR); - - /* Ensure the guest output starts fresh */ -- sclp_print("\n"); -+ printf("\n"); - - /* - * HACK ALERT. -diff --git a/pc-bios/s390-ccw/libc.c b/pc-bios/s390-ccw/libc.c -deleted file mode 100644 -index 3187923950..0000000000 ---- a/pc-bios/s390-ccw/libc.c -+++ /dev/null -@@ -1,88 +0,0 @@ --/* -- * libc-style definitions and functions -- * -- * Copyright 2018 IBM Corp. -- * Author(s): Collin L. Walling -- * -- * This code is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License as published by the -- * Free Software Foundation; either version 2 of the License, or (at your -- * option) any later version. -- */ -- --#include "libc.h" --#include "s390-ccw.h" -- --/** -- * atoui: -- * @str: the string to be converted. -- * -- * Given a string @str, convert it to an integer. Leading spaces are -- * ignored. Any other non-numerical value will terminate the conversion -- * and return 0. This function only handles numbers between 0 and -- * UINT64_MAX inclusive. -- * -- * Returns: an integer converted from the string @str, or the number 0 -- * if an error occurred. -- */ --uint64_t atoui(const char *str) --{ -- int val = 0; -- -- if (!str || !str[0]) { -- return 0; -- } -- -- while (*str == ' ') { -- str++; -- } -- -- while (*str) { -- if (!isdigit(*(unsigned char *)str)) { -- break; -- } -- val = val * 10 + *str - '0'; -- str++; -- } -- -- return val; --} -- --/** -- * uitoa: -- * @num: an integer (base 10) to be converted. -- * @str: a pointer to a string to store the conversion. -- * @len: the length of the passed string. -- * -- * Given an integer @num, convert it to a string. The string @str must be -- * allocated beforehand. The resulting string will be null terminated and -- * returned. This function only handles numbers between 0 and UINT64_MAX -- * inclusive. -- * -- * Returns: the string @str of the converted integer @num -- */ --char *uitoa(uint64_t num, char *str, size_t len) --{ -- long num_idx = 1; /* account for NUL */ -- uint64_t tmp = num; -- -- IPL_assert(str != NULL, "uitoa: no space allocated to store string"); -- -- /* Count indices of num */ -- while ((tmp /= 10) != 0) { -- num_idx++; -- } -- -- /* Check if we have enough space for num and NUL */ -- IPL_assert(len > num_idx, "uitoa: array too small for conversion"); -- -- str[num_idx--] = '\0'; -- -- /* Convert int to string */ -- while (num_idx >= 0) { -- str[num_idx--] = num % 10 + '0'; -- num /= 10; -- } -- -- return str; --} -diff --git a/pc-bios/s390-ccw/libc.h b/pc-bios/s390-ccw/libc.h -deleted file mode 100644 -index bcdc45732d..0000000000 ---- a/pc-bios/s390-ccw/libc.h -+++ /dev/null -@@ -1,89 +0,0 @@ --/* -- * libc-style definitions and functions -- * -- * Copyright (c) 2013 Alexander Graf -- * -- * This code is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License as published by the -- * Free Software Foundation; either version 2 of the License, or (at your -- * option) any later version. -- */ -- --#ifndef S390_CCW_LIBC_H --#define S390_CCW_LIBC_H -- --typedef unsigned long size_t; --typedef int bool; --typedef unsigned char uint8_t; --typedef unsigned short uint16_t; --typedef unsigned int uint32_t; --typedef unsigned long long uint64_t; -- --static inline void *memset(void *s, int c, size_t n) --{ -- size_t i; -- unsigned char *p = s; -- -- for (i = 0; i < n; i++) { -- p[i] = c; -- } -- -- return s; --} -- --static inline void *memcpy(void *s1, const void *s2, size_t n) --{ -- uint8_t *dest = s1; -- const uint8_t *src = s2; -- size_t i; -- -- for (i = 0; i < n; i++) { -- dest[i] = src[i]; -- } -- -- return s1; --} -- --static inline int memcmp(const void *s1, const void *s2, size_t n) --{ -- size_t i; -- const uint8_t *p1 = s1, *p2 = s2; -- -- for (i = 0; i < n; i++) { -- if (p1[i] != p2[i]) { -- return p1[i] > p2[i] ? 1 : -1; -- } -- } -- -- return 0; --} -- --static inline size_t strlen(const char *str) --{ -- size_t i; -- for (i = 0; *str; i++) { -- str++; -- } -- return i; --} -- --static inline char *strcat(char *dest, const char *src) --{ -- int i; -- char *dest_end = dest + strlen(dest); -- -- for (i = 0; i <= strlen(src); i++) { -- dest_end[i] = src[i]; -- } -- return dest; --} -- --static inline int isdigit(int c) --{ -- return (c >= '0') && (c <= '9'); --} -- --uint64_t atoui(const char *str); --char *uitoa(uint64_t num, char *str, size_t len); -- --#endif -diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c -index 5506798098..203df20965 100644 ---- a/pc-bios/s390-ccw/main.c -+++ b/pc-bios/s390-ccw/main.c -@@ -8,7 +8,9 @@ - * directory. - */ - --#include "libc.h" -+#include -+#include -+#include - #include "helper.h" - #include "s390-arch.h" - #include "s390-ccw.h" -@@ -50,7 +52,7 @@ void write_iplb_location(void) - - unsigned int get_loadparm_index(void) - { -- return atoui(loadparm_str); -+ return atoi(loadparm_str); - } - - static int is_dev_possibly_bootable(int dev_no, int sch_no) -@@ -176,7 +178,7 @@ static void boot_setup(void) - - sclp_get_loadparm_ascii(loadparm_str); - memcpy(lpmsg + 10, loadparm_str, 8); -- sclp_print(lpmsg); -+ puts(lpmsg); - - /* - * Clear out any potential S390EP magic (see jump_to_low_kernel()), -@@ -228,7 +230,7 @@ static int virtio_setup(void) - - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_NET: -- sclp_print("Network boot device detected\n"); -+ puts("Network boot device detected"); - vdev->netboot_start_addr = qipl.netboot_start_addr; - return 0; - case VIRTIO_ID_BLOCK: -@@ -261,7 +263,7 @@ static void ipl_boot_device(void) - } - break; - default: -- print_int("Attempting to boot from unexpected device type", cutype); -+ printf("Attempting to boot from unexpected device type 0x%X\n", cutype); - panic("\nBoot failed.\n"); - } - } -@@ -287,7 +289,7 @@ static void probe_boot_device(void) - } - } - -- sclp_print("Could not find a suitable boot device (none specified)\n"); -+ puts("Could not find a suitable boot device (none specified)"); - } - - void main(void) -diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c -index d601952d3e..84062e94af 100644 ---- a/pc-bios/s390-ccw/menu.c -+++ b/pc-bios/s390-ccw/menu.c -@@ -9,7 +9,10 @@ - * directory. - */ - --#include "libc.h" -+#include -+#include -+#include -+#include - #include "s390-ccw.h" - #include "sclp.h" - #include "s390-time.h" -@@ -93,7 +96,7 @@ static int read_prompt(char *buf, size_t len) - case KEYCODE_BACKSP: - if (idx > 0) { - buf[--idx] = 0; -- sclp_print("\b \b"); -+ printf("\b \b"); - } - continue; - case KEYCODE_ENTER: -@@ -103,7 +106,7 @@ static int read_prompt(char *buf, size_t len) - /* Echo input and add to buffer */ - if (idx < len) { - buf[idx++] = inp[0]; -- sclp_print(inp); -+ printf("%s", inp); - } - } - } -@@ -140,22 +143,19 @@ static int get_index(void) - } - } - -- return atoui(buf); -+ return atoi(buf); - } - - static void boot_menu_prompt(bool retry) - { -- char tmp[11]; -- - if (retry) { -- sclp_print("\nError: undefined configuration" -+ printf("\nError: undefined configuration" - "\nPlease choose:\n"); - } else if (timeout > 0) { -- sclp_print("Please choose (default will boot in "); -- sclp_print(uitoa(timeout / 1000, tmp, sizeof(tmp))); -- sclp_print(" seconds):\n"); -+ printf("Please choose (default will boot in %d seconds):\n", -+ (int)(timeout / 1000)); - } else { -- sclp_print("Please choose:\n"); -+ puts("Please choose:"); - } - } - -@@ -163,7 +163,6 @@ static int get_boot_index(bool *valid_entries) - { - int boot_index; - bool retry = false; -- char tmp[5]; - - do { - boot_menu_prompt(retry); -@@ -172,8 +171,7 @@ static int get_boot_index(bool *valid_entries) - } while (boot_index < 0 || boot_index >= MAX_BOOT_ENTRIES || - !valid_entries[boot_index]); - -- sclp_print("\nBooting entry #"); -- sclp_print(uitoa(boot_index, tmp, sizeof(tmp))); -+ printf("\nBooting entry #%d", boot_index); - - return boot_index; - } -@@ -187,9 +185,9 @@ static int zipl_print_entry(const char *data, size_t len) - buf[len] = '\n'; - buf[len + 1] = '\0'; - -- sclp_print(buf); -+ printf("%s", buf); - -- return buf[0] == ' ' ? atoui(buf + 1) : atoui(buf); -+ return buf[0] == ' ' ? atoi(buf + 1) : atoi(buf); - } - - int menu_get_zipl_boot_index(const char *menu_data) -@@ -209,7 +207,7 @@ int menu_get_zipl_boot_index(const char *menu_data) - } - - /* Print banner */ -- sclp_print("s390-ccw zIPL Boot Menu\n\n"); -+ puts("s390-ccw zIPL Boot Menu\n"); - menu_data += strlen(menu_data) + 1; - - /* Print entries */ -@@ -221,37 +219,34 @@ int menu_get_zipl_boot_index(const char *menu_data) - valid_entries[entry] = true; - - if (entry == 0) { -- sclp_print("\n"); -+ printf("\n"); - } - } - -- sclp_print("\n"); -+ printf("\n"); - return get_boot_index(valid_entries); - } - - int menu_get_enum_boot_index(bool *valid_entries) - { -- char tmp[3]; - int i; - -- sclp_print("s390-ccw Enumerated Boot Menu.\n\n"); -+ puts("s390-ccw Enumerated Boot Menu.\n"); - - for (i = 0; i < MAX_BOOT_ENTRIES; i++) { - if (valid_entries[i]) { - if (i < 10) { -- sclp_print(" "); -+ printf(" "); - } -- sclp_print("["); -- sclp_print(uitoa(i, tmp, sizeof(tmp))); -- sclp_print("]"); -+ printf("[%d]", i); - if (i == 0) { -- sclp_print(" default\n"); -+ printf(" default\n"); - } -- sclp_print("\n"); -+ printf("\n"); - } - } - -- sclp_print("\n"); -+ printf("\n"); - return get_boot_index(valid_entries); - } - -diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak -index 046aa35587..d2b3d8ee74 100644 ---- a/pc-bios/s390-ccw/netboot.mak -+++ b/pc-bios/s390-ccw/netboot.mak -@@ -1,9 +1,6 @@ - --SLOF_DIR := $(SRC_PATH)/../../roms/SLOF -- - NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o - --LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include - LIBNET_INC := -I$(SLOF_DIR)/lib/libnet - - NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000 -diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c -index 5cd619b2d6..509119be15 100644 ---- a/pc-bios/s390-ccw/netmain.c -+++ b/pc-bios/s390-ccw/netmain.c -@@ -293,7 +293,7 @@ static int load_kernel_with_initrd(filename_ip_t *fn_ip, - printf("Loading pxelinux.cfg entry '%s'\n", entry->label); - - if (!entry->kernel) { -- printf("Kernel entry is missing!\n"); -+ puts("Kernel entry is missing!\n"); - return -1; - } - -@@ -515,13 +515,13 @@ void main(void) - int rc, fnlen; - - sclp_setup(); -- sclp_print("Network boot starting...\n"); -+ puts("Network boot starting..."); - - virtio_setup(); - - rc = net_init(&fn_ip); - if (rc) { -- panic("Network initialization failed. Halting.\n"); -+ panic("Network initialization failed. Halting."); - } - - fnlen = strlen(fn_ip.filename); -@@ -535,9 +535,9 @@ void main(void) - net_release(&fn_ip); - - if (rc > 0) { -- sclp_print("Network loading done, starting kernel...\n"); -+ puts("Network loading done, starting kernel..."); - jump_to_low_kernel(); - } - -- panic("Failed to load OS from network\n"); -+ panic("Failed to load OS from network."); - } -diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h -index c977a52b50..6f6d95d170 100644 ---- a/pc-bios/s390-ccw/s390-ccw.h -+++ b/pc-bios/s390-ccw/s390-ccw.h -@@ -13,6 +13,11 @@ - - /* #define DEBUG */ - -+#include -+#include -+#include -+#include -+ - typedef unsigned char u8; - typedef unsigned short u16; - typedef unsigned int u32; -@@ -26,9 +31,6 @@ typedef unsigned long long u64; - #define EBUSY 2 - #define ENODEV 3 - --#ifndef NULL --#define NULL 0 --#endif - #ifndef MIN - #define MIN(a, b) (((a) < (b)) ? (a) : (b)) - #endif -@@ -87,7 +89,7 @@ bool menu_is_enabled_enum(void); - __attribute__ ((__noreturn__)) - static inline void panic(const char *string) - { -- sclp_print(string); -+ printf("ERROR: %s\n ", string); - disabled_wait(); - } - -@@ -109,20 +111,10 @@ static inline void fill_hex_val(char *out, void *ptr, unsigned size) - } - } - --static inline void print_int(const char *desc, u64 addr) --{ -- char out[] = ": 0xffffffffffffffff\n"; -- -- fill_hex_val(&out[4], &addr, sizeof(addr)); -- -- sclp_print(desc); -- sclp_print(out); --} -- - static inline void debug_print_int(const char *desc, u64 addr) - { - #ifdef DEBUG -- print_int(desc, addr); -+ printf("%s 0x%X\n", desc, addr); - #endif - } - -@@ -147,18 +139,14 @@ static inline void debug_print_addr(const char *desc, void *p) - static inline void IPL_assert(bool term, const char *message) - { - if (!term) { -- sclp_print("\n! "); -- sclp_print(message); -- panic(" !\n"); /* no return */ -+ panic(message); /* no return */ - } - } - - static inline void IPL_check(bool term, const char *message) - { - if (!term) { -- sclp_print("\n! WARNING: "); -- sclp_print(message); -- sclp_print(" !\n"); -+ printf("WARNING: %s\n", message); - } - } - -diff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c -index 7251f9af4d..4a07de018d 100644 ---- a/pc-bios/s390-ccw/sclp.c -+++ b/pc-bios/s390-ccw/sclp.c -@@ -8,7 +8,7 @@ - * directory. - */ - --#include "libc.h" -+#include - #include "s390-ccw.h" - #include "sclp.h" - -@@ -101,11 +101,6 @@ long write(int fd, const void *str, size_t len) - return len; - } - --void sclp_print(const char *str) --{ -- write(1, str, strlen(str)); --} -- - void sclp_get_loadparm_ascii(char *loadparm) - { - -diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c -index a81207b52e..2666326801 100644 ---- a/pc-bios/s390-ccw/virtio-blkdev.c -+++ b/pc-bios/s390-ccw/virtio-blkdev.c -@@ -8,7 +8,7 @@ - * directory. - */ - --#include "libc.h" -+#include - #include "s390-ccw.h" - #include "virtio.h" - #include "virtio-scsi.h" -@@ -76,7 +76,7 @@ unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list - return -1; - } - -- sclp_print("."); -+ printf("."); - status = virtio_read_many(sec, (void *)addr, sec_num); - if (status) { - panic("I/O Error"); -@@ -230,7 +230,7 @@ int virtio_blk_setup_device(SubChannelId schid) - vdev->schid = schid; - virtio_setup_ccw(vdev); - -- sclp_print("Using virtio-blk.\n"); -+ puts("Using virtio-blk."); - - return 0; - } -diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c -index d1a84b937c..6b4a1caf8a 100644 ---- a/pc-bios/s390-ccw/virtio-scsi.c -+++ b/pc-bios/s390-ccw/virtio-scsi.c -@@ -9,7 +9,8 @@ - * directory. - */ - --#include "libc.h" -+#include -+#include - #include "s390-ccw.h" - #include "virtio.h" - #include "scsi.h" -@@ -30,9 +31,9 @@ static inline void vs_assert(bool term, const char **msgs) - if (!term) { - int i = 0; - -- sclp_print("\n! "); -+ printf("\n! "); - while (msgs[i]) { -- sclp_print(msgs[i++]); -+ printf("%s", msgs[i++]); - } - panic(" !\n"); - } -@@ -236,11 +237,11 @@ static int virtio_scsi_locate_device(VDev *vdev) - if (resp.response == VIRTIO_SCSI_S_BAD_TARGET) { - continue; - } -- print_int("target", target); -+ printf("target 0x%X\n", target); - virtio_scsi_verify_response(&resp, "SCSI cannot report LUNs"); - } - if (r->lun_list_len == 0) { -- print_int("no LUNs for target", target); -+ printf("no LUNs for target 0x%X\n", target); - continue; - } - luns = r->lun_list_len / 8; -@@ -264,7 +265,7 @@ static int virtio_scsi_locate_device(VDev *vdev) - } - } - -- sclp_print("Warning: Could not locate a usable virtio-scsi device\n"); -+ puts("Warning: Could not locate a usable virtio-scsi device"); - return -ENODEV; - } - -@@ -379,7 +380,7 @@ static int virtio_scsi_setup(VDev *vdev) - } - - if (virtio_scsi_inquiry_response_is_cdrom(scsi_inquiry_std_response)) { -- sclp_print("SCSI CD-ROM detected.\n"); -+ puts("SCSI CD-ROM detected."); - vdev->is_cdrom = true; - vdev->scsi_block_size = VIRTIO_ISO_BLOCK_SIZE; - } -@@ -443,7 +444,7 @@ int virtio_scsi_setup_device(SubChannelId schid) - IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE, - "Config: CDB size mismatch"); - -- sclp_print("Using virtio-scsi.\n"); -+ puts("Using virtio-scsi."); - - return virtio_scsi_setup(vdev); - } -diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c -index 5edd058d88..8c6b0a8a92 100644 ---- a/pc-bios/s390-ccw/virtio.c -+++ b/pc-bios/s390-ccw/virtio.c -@@ -8,7 +8,7 @@ - * directory. - */ - --#include "libc.h" -+#include - #include "s390-ccw.h" - #include "cio.h" - #include "virtio.h" -diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Makefile.softmmu-target -index f60f94b090..90964a2ccb 100644 ---- a/tests/tcg/s390x/Makefile.softmmu-target -+++ b/tests/tcg/s390x/Makefile.softmmu-target -@@ -2,7 +2,7 @@ S390X_SRC=$(SRC_PATH)/tests/tcg/s390x - VPATH+=$(S390X_SRC) - QEMU_OPTS+=-action panic=exit-failure -nographic $(EXTFLAGS) -kernel - LINK_SCRIPT=$(S390X_SRC)/softmmu.ld --CFLAGS+=-ggdb -O0 -+CFLAGS+=-ggdb -O0 -I$(SRC_PATH)/include/hw/s390x/ipl/ - LDFLAGS=-nostdlib -static - - %.o: %.S -diff --git a/tests/tcg/s390x/console.c b/tests/tcg/s390x/console.c -index d43ce3f44b..6c26f04949 100644 ---- a/tests/tcg/s390x/console.c -+++ b/tests/tcg/s390x/console.c -@@ -4,7 +4,10 @@ - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ -+ - #include "../../../pc-bios/s390-ccw/sclp.c" -+#include "../../../roms/SLOF/lib/libc/string/memset.c" -+#include "../../../roms/SLOF/lib/libc/string/memcpy.c" - - void __sys_outc(char c) - { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch deleted file mode 100644 index 80006bf00..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Enable-multi-device-boot-loop.patch +++ /dev/null @@ -1,227 +0,0 @@ -From 4fcfb2ccd90ffc1e0b121b3e5dbab1cdcba8ce4e Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:51 -0400 -Subject: [PATCH 18/27] pc-bios/s390x: Enable multi-device boot loop -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [18/23] 2aa3154bfb1c73a6054b1161ae284925e6069c48 (thuth/qemu-kvm-cs9) - -Allow attempts to boot from multiple IPL devices. If the first device fails to -IPL, select the pre-built IPLB for the next device in the boot order and attempt -to IPL from it. Continue this process until IPL is successful or there are no -devices left to try. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-18-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit f697bed22f58eff9b2893ac2fe3d511847398400) ---- - pc-bios/s390-ccw/iplb.h | 24 ++++++++++++++++++++ - pc-bios/s390-ccw/jump2ipl.c | 7 +++--- - pc-bios/s390-ccw/main.c | 45 +++++++++++++++++++++++-------------- - pc-bios/s390-ccw/netmain.c | 2 +- - 4 files changed, 57 insertions(+), 21 deletions(-) - -diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h -index 16643f5879..08f259ff31 100644 ---- a/pc-bios/s390-ccw/iplb.h -+++ b/pc-bios/s390-ccw/iplb.h -@@ -17,9 +17,11 @@ - #endif - - #include -+#include - - extern QemuIplParameters qipl; - extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); -+extern bool have_iplb; - - #define S390_IPL_TYPE_FCP 0x00 - #define S390_IPL_TYPE_CCW 0x02 -@@ -49,4 +51,26 @@ static inline bool set_iplb(IplParameterBlock *iplb) - return manage_iplb(iplb, false); - } - -+/* -+ * The IPL started on the device, but failed in some way. If the IPLB chain -+ * still has more devices left to try, use the next device in order. -+ */ -+static inline bool load_next_iplb(void) -+{ -+ IplParameterBlock *next_iplb; -+ -+ if (qipl.chain_len < 1) { -+ return false; -+ } -+ -+ qipl.index++; -+ next_iplb = (IplParameterBlock *) qipl.next_iplb; -+ memcpy(&iplb, next_iplb, sizeof(IplParameterBlock)); -+ -+ qipl.chain_len--; -+ qipl.next_iplb = qipl.next_iplb + sizeof(IplParameterBlock); -+ -+ return true; -+} -+ - #endif /* IPLB_H */ -diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c -index 99d18947d1..86321d0f46 100644 ---- a/pc-bios/s390-ccw/jump2ipl.c -+++ b/pc-bios/s390-ccw/jump2ipl.c -@@ -45,9 +45,10 @@ int jump_to_IPL_code(uint64_t address) - */ - if (iplb.pbt == S390_IPL_TYPE_QEMU_SCSI) { - iplb.devno = qipl.index; -- if (!set_iplb(&iplb)) { -- panic("Failed to set IPLB"); -- } -+ } -+ -+ if (have_iplb && !set_iplb(&iplb)) { -+ panic("Failed to set IPLB"); - } - - /* -diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c -index ab4709e16e..a4d1c05aac 100644 ---- a/pc-bios/s390-ccw/main.c -+++ b/pc-bios/s390-ccw/main.c -@@ -23,7 +23,7 @@ static SubChannelId blk_schid = { .one = 1 }; - static char loadparm_str[LOADPARM_LEN + 1]; - QemuIplParameters qipl; - IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); --static bool have_iplb; -+bool have_iplb; - static uint16_t cutype; - LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */ - -@@ -55,6 +55,12 @@ void write_iplb_location(void) - } - } - -+static void copy_qipl(void) -+{ -+ QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS; -+ memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); -+} -+ - unsigned int get_loadparm_index(void) - { - return atoi(loadparm_str); -@@ -152,6 +158,7 @@ static void menu_setup(void) - - /* If loadparm was set to any other value, then do not enable menu */ - if (memcmp(loadparm_str, LOADPARM_EMPTY, LOADPARM_LEN) != 0) { -+ menu_set_parms(qipl.qipl_flags & ~BOOT_MENU_FLAG_MASK, 0); - return; - } - -@@ -183,7 +190,6 @@ static void css_setup(void) - static void boot_setup(void) - { - char lpmsg[] = "LOADPARM=[________]\n"; -- have_iplb = store_iplb(&iplb); - - if (memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { - ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN); -@@ -191,6 +197,10 @@ static void boot_setup(void) - sclp_get_loadparm_ascii(loadparm_str); - } - -+ if (have_iplb) { -+ menu_setup(); -+ } -+ - memcpy(lpmsg + 10, loadparm_str, 8); - puts(lpmsg); - -@@ -208,6 +218,7 @@ static bool find_boot_device(void) - - switch (iplb.pbt) { - case S390_IPL_TYPE_CCW: -+ vdev->scsi_device_selected = false; - debug_print_int("device no. ", iplb.ccw.devno); - blk_schid.ssid = iplb.ccw.ssid & 0x3; - debug_print_int("ssid ", blk_schid.ssid); -@@ -231,15 +242,8 @@ static bool find_boot_device(void) - static int virtio_setup(void) - { - VDev *vdev = virtio_get_device(); -- QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS; - int ret; - -- memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); -- -- if (have_iplb) { -- menu_setup(); -- } -- - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_NET: - puts("Network boot device detected"); -@@ -271,10 +275,9 @@ static void ipl_boot_device(void) - dasd_ipl(blk_schid, cutype); - break; - case CU_TYPE_VIRTIO: -- if (virtio_setup()) { -- return; /* Only returns in case of errors */ -+ if (virtio_setup() == 0) { -+ zipl_load(); - } -- zipl_load(); - break; - default: - printf("Attempting to boot from unexpected device type 0x%X\n", cutype); -@@ -307,14 +310,22 @@ static void probe_boot_device(void) - - void main(void) - { -+ copy_qipl(); - sclp_setup(); - css_setup(); -- boot_setup(); -- if (have_iplb && find_boot_device()) { -- ipl_boot_device(); -- } else { -+ have_iplb = store_iplb(&iplb); -+ if (!have_iplb) { - probe_boot_device(); - } - -- panic("Failed to IPL. Halting..."); -+ while (have_iplb) { -+ boot_setup(); -+ if (have_iplb && find_boot_device()) { -+ ipl_boot_device(); -+ } -+ have_iplb = load_next_iplb(); -+ } -+ -+ panic("No suitable device for IPL. Halting..."); -+ - } -diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c -index d1a6c9a91c..e46e470db4 100644 ---- a/pc-bios/s390-ccw/netmain.c -+++ b/pc-bios/s390-ccw/netmain.c -@@ -478,7 +478,7 @@ static bool virtio_setup(void) - */ - enable_mss_facility(); - -- if (store_iplb(&iplb)) { -+ if (have_iplb || store_iplb(&iplb)) { - IPL_assert(iplb.pbt == S390_IPL_TYPE_CCW, "IPL_TYPE_CCW expected"); - dev_no = iplb.ccw.devno; - debug_print_int("device no. ", dev_no); --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch deleted file mode 100644 index ebf1a48d7..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 32ddd9e68b04cb231fa0adcaeacbbe6373a1972f Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Fri, 8 Nov 2024 14:41:36 -0500 -Subject: [PATCH 07/10] pc-bios/s390x: Initialize cdrom type to false for each - IPL device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [6/8] 994d24c3292a38f5bc7fd87d7227e5beb8abc30b (thuth/qemu-kvm-cs9) - -Clear information about cdrom type so that current IPL device isn't tainted -by stale data from previous devices. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241108194136.2833932-1-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 8c797468116d19940fb758efa749eae414616e3a) ---- - pc-bios/s390-ccw/main.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c -index a4d1c05aac..7509755e36 100644 ---- a/pc-bios/s390-ccw/main.c -+++ b/pc-bios/s390-ccw/main.c -@@ -242,6 +242,7 @@ static bool find_boot_device(void) - static int virtio_setup(void) - { - VDev *vdev = virtio_get_device(); -+ vdev->is_cdrom = false; - int ret; - - switch (vdev->senseid.cu_model) { --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch b/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch deleted file mode 100644 index f0764e67a..000000000 --- a/images/qemu-artifact/patches/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch +++ /dev/null @@ -1,55 +0,0 @@ -From d5fd6b575f36c09bb6ef11d3e1e4e698577637c3 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Thu, 14 Nov 2024 11:19:52 -0500 -Subject: [PATCH 08/10] pc-bios/s390x: Initialize machine loadparm before - probing IPL devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [7/8] 5f9bca4a83d6a1bde08504d2655f486708765e6e (thuth/qemu-kvm-cs9) - -Commit bb185de423 ("s390x: Add individual loadparm assignment to -CCW device") allowed boot devices to be assigned a loadparm value independent -of the machine value, however, when no boot devices are defined, the machine -loadparm becomes ignored. Therefore, let's check the machine loadparm -prior to probing the devices. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241114161952.3508554-1-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 1056ca1e70dc6e0458238141bcebfb7810cede6d) ---- - pc-bios/s390-ccw/main.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c -index 7509755e36..76bf743900 100644 ---- a/pc-bios/s390-ccw/main.c -+++ b/pc-bios/s390-ccw/main.c -@@ -191,7 +191,7 @@ static void boot_setup(void) - { - char lpmsg[] = "LOADPARM=[________]\n"; - -- if (memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { -+ if (have_iplb && memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { - ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN); - } else { - sclp_get_loadparm_ascii(loadparm_str); -@@ -316,6 +316,7 @@ void main(void) - css_setup(); - have_iplb = store_iplb(&iplb); - if (!have_iplb) { -+ boot_setup(); - probe_boot_device(); - } - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch b/images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch deleted file mode 100644 index 32064ea65..000000000 --- a/images/qemu-artifact/patches/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch +++ /dev/null @@ -1,75 +0,0 @@ -From d06f8670b9304c66d45e2270a4f5b462ed6cbe09 Mon Sep 17 00:00:00 2001 -From: Ani Sinha -Date: Wed, 16 Oct 2024 17:21:34 +0530 -Subject: [PATCH 1/9] pc: q35: Bump max_cpus to 4096 vcpus -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Ani Sinha -RH-MergeRequest: 273: pc: q35: Bump max_cpus to 4096 vcpus -RH-Jira: RHEL-11043 -RH-Acked-by: Igor Mammedov -RH-Acked-by: Daniel P. Berrangé -RH-Acked-by: MST -RH-Commit: [1/1] 23caa8c9e4f34c3114701b7a5bb25002a9372b2e (anisinha/centos-qemu-kvm) - -This is the downstream change equivalent of the upstream QEMU commit -e4e98c7e ("pc: q35: Bump max_cpus to 4096 vcpus") - -Since upstream Linux kernel commit -f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") -Linux kernel can support upto a maximum number of 4096 vcpus when MAXSMP is -enabled in the kernel. This upstream change has been backported to c9s kernel -already. Please see JIRA https://issues.redhat.com/browse/RHEL-11579 and the -following commit authored by Vitaly Kuznetsov: -a85f846be686b0a ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") - -At present, QEMU has been tested to correctly boot a linux guest with 4096 -vcpus using edk2 that has the fixes corresponding to the following two upstream -edk2 PRs: - -https://github.com/tianocore/edk2/pull/5410 -https://github.com/tianocore/edk2/pull/5418 - -The changes corresponding to the above two upstream edk2 PRs has been included -in the downstream c9s edk2 with the following MR: -https://gitlab.com/redhat/centos-stream/src/edk2/-/merge_requests/59 - -So bump up the value max_cpus to 4096 for RHEL q35 machines versions 9.6 and -newer. Q35 RHEL machines versions 9.4 and older continue to support 710 maximum -vcpus as before for compatibility reasons. - -See also https://gitlab.com/redhat/centos-stream/src/qemu-kvm/-/merge_requests/236 - -Signed-off-by: Ani Sinha ---- - hw/i386/pc_q35.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c -index 7606007bda..578f63524f 100644 ---- a/hw/i386/pc_q35.c -+++ b/hw/i386/pc_q35.c -@@ -344,7 +344,7 @@ static void pc_q35_machine_options(MachineClass *m) - m->default_display = "std"; - m->default_nic = "e1000e"; - m->no_floppy = 1; -- m->max_cpus = 710; -+ m->max_cpus = 4096; - m->no_parallel = 1; - machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); - machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); -@@ -687,6 +687,9 @@ static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) - { - PCMachineClass *pcmc = PC_MACHINE_CLASS(m); - pc_q35_rhel_machine_9_6_0_options(m); -+ -+ /* older RHEL machines continue to support 710 vcpus */ -+ m->max_cpus = 710; - m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; - m->alias = NULL; - pcmc->smbios_stream_product = "RHEL"; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch b/images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch deleted file mode 100644 index 3440acb61..000000000 --- a/images/qemu-artifact/patches/kvm-s390x-Add-individual-loadparm-assignment-to-CCW-devi.patch +++ /dev/null @@ -1,362 +0,0 @@ -From 20a4a01fde02a619cee994af92721592e7d91716 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:48 -0400 -Subject: [PATCH 15/27] s390x: Add individual loadparm assignment to CCW device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [15/23] c4eaab72e6246db7295593b86f097773aa4f49b7 (thuth/qemu-kvm-cs9) - -Add a loadparm property to the VirtioCcwDevice object so that different -loadparms can be defined on a per-device basis for CCW boot devices. - -The machine/global loadparm is still supported. If both a global and per-device -loadparm are defined, the per-device value will override the global value for -that device, but any other devices that do not specify a per-device loadparm -will still use the global loadparm. - -It is invalid to assign a loadparm to a non-boot device. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-15-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit bb185de42339025db9bbd5aa11f3f644c2a077f8) ---- - hw/s390x/ccw-device.c | 46 +++++++++++++++++++++++++ - hw/s390x/ccw-device.h | 2 ++ - hw/s390x/ipl.c | 68 ++++++++++++++++++++++--------------- - hw/s390x/ipl.h | 3 +- - hw/s390x/s390-virtio-ccw.c | 18 +--------- - hw/s390x/sclp.c | 9 ++--- - include/hw/s390x/ipl/qipl.h | 1 + - pc-bios/s390-ccw/main.c | 10 ++++-- - 8 files changed, 102 insertions(+), 55 deletions(-) - -diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c -index a7d682e5af..4e54f34b1c 100644 ---- a/hw/s390x/ccw-device.c -+++ b/hw/s390x/ccw-device.c -@@ -13,6 +13,10 @@ - #include "ccw-device.h" - #include "hw/qdev-properties.h" - #include "qemu/module.h" -+#include "ipl.h" -+#include "qapi/visitor.h" -+#include "qemu/ctype.h" -+#include "qapi/error.h" - - static void ccw_device_refill_ids(CcwDevice *dev) - { -@@ -37,10 +41,52 @@ static bool ccw_device_realize(CcwDevice *dev, Error **errp) - return true; - } - -+static void ccw_device_get_loadparm(Object *obj, Visitor *v, -+ const char *name, void *opaque, -+ Error **errp) -+{ -+ CcwDevice *dev = CCW_DEVICE(obj); -+ char *str = g_strndup((char *) dev->loadparm, sizeof(dev->loadparm)); -+ -+ visit_type_str(v, name, &str, errp); -+ g_free(str); -+} -+ -+static void ccw_device_set_loadparm(Object *obj, Visitor *v, -+ const char *name, void *opaque, -+ Error **errp) -+{ -+ CcwDevice *dev = CCW_DEVICE(obj); -+ char *val; -+ int index; -+ -+ index = object_property_get_int(obj, "bootindex", NULL); -+ -+ if (index < 0) { -+ error_setg(errp, "LOADPARM is only valid for boot devices!"); -+ } -+ -+ if (!visit_type_str(v, name, &val, errp)) { -+ return; -+ } -+ -+ s390_ipl_fmt_loadparm(dev->loadparm, val, errp); -+} -+ -+static const PropertyInfo ccw_loadparm = { -+ .name = "ccw_loadparm", -+ .description = "Up to 8 chars in set of [A-Za-z0-9. ] to pass" -+ " to the guest loader/kernel", -+ .get = ccw_device_get_loadparm, -+ .set = ccw_device_set_loadparm, -+}; -+ - static Property ccw_device_properties[] = { - DEFINE_PROP_CSS_DEV_ID("devno", CcwDevice, devno), - DEFINE_PROP_CSS_DEV_ID_RO("dev_id", CcwDevice, dev_id), - DEFINE_PROP_CSS_DEV_ID_RO("subch_id", CcwDevice, subch_id), -+ DEFINE_PROP("loadparm", CcwDevice, loadparm, ccw_loadparm, -+ typeof(uint8_t[8])), - DEFINE_PROP_END_OF_LIST(), - }; - -diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h -index 5feeb0ee7a..1e1737c0f3 100644 ---- a/hw/s390x/ccw-device.h -+++ b/hw/s390x/ccw-device.h -@@ -26,6 +26,8 @@ struct CcwDevice { - CssDevId dev_id; - /* The actual busid of the virtual subchannel. */ - CssDevId subch_id; -+ /* If set, use this loadparm value when device is boot target */ -+ uint8_t loadparm[8]; - }; - typedef struct CcwDevice CcwDevice; - -diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c -index 8a0a3e6961..d83832d975 100644 ---- a/hw/s390x/ipl.c -+++ b/hw/s390x/ipl.c -@@ -34,6 +34,7 @@ - #include "qemu/config-file.h" - #include "qemu/cutils.h" - #include "qemu/option.h" -+#include "qemu/ctype.h" - #include "standard-headers/linux/virtio_ids.h" - - #define KERN_IMAGE_START 0x010000UL -@@ -397,12 +398,43 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype) - return ccw_dev; - } - -+void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) -+{ -+ int i; -+ -+ /* Initialize the loadparm with spaces */ -+ memset(loadparm, ' ', LOADPARM_LEN); -+ for (i = 0; i < LOADPARM_LEN && str[i]; i++) { -+ uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ -+ -+ if (qemu_isalnum(c) || c == '.' || c == ' ') { -+ loadparm[i] = c; -+ } else { -+ error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", -+ c, c); -+ return; -+ } -+ } -+} -+ -+void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) -+{ -+ int i; -+ -+ /* Initialize the loadparm with EBCDIC spaces (0x40) */ -+ memset(ebcdic_lp, '@', LOADPARM_LEN); -+ for (i = 0; i < LOADPARM_LEN && ascii_lp[i]; i++) { -+ ebcdic_lp[i] = ascii2ebcdic[(uint8_t) ascii_lp[i]]; -+ } -+} -+ - static bool s390_gen_initial_iplb(S390IPLState *ipl) - { - DeviceState *dev_st; - CcwDevice *ccw_dev = NULL; - SCSIDevice *sd; - int devtype; -+ uint8_t *lp; - - dev_st = get_boot_device(0); - if (dev_st) { -@@ -413,6 +445,8 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) - * Currently allow IPL only from CCW devices. - */ - if (ccw_dev) { -+ lp = ccw_dev->loadparm; -+ - switch (devtype) { - case CCW_DEVTYPE_SCSI: - sd = SCSI_DEVICE(dev_st); -@@ -445,40 +479,20 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) - break; - } - -- if (!s390_ipl_set_loadparm(ipl->iplb.loadparm)) { -- ipl->iplb.flags |= DIAG308_FLAGS_LP_VALID; -+ /* If the device loadparm is empty use the global machine loadparm */ -+ if (memcmp(lp, NO_LOADPARM, 8) == 0) { -+ lp = S390_CCW_MACHINE(qdev_get_machine())->loadparm; - } - -+ s390_ipl_convert_loadparm((char *)lp, ipl->iplb.loadparm); -+ ipl->iplb.flags |= DIAG308_FLAGS_LP_VALID; -+ - return true; - } - - return false; - } - --int s390_ipl_set_loadparm(uint8_t *loadparm) --{ -- MachineState *machine = MACHINE(qdev_get_machine()); -- char *lp = object_property_get_str(OBJECT(machine), "loadparm", NULL); -- -- if (lp) { -- int i; -- -- /* lp is an uppercase string without leading/embedded spaces */ -- for (i = 0; i < 8 && lp[i]; i++) { -- loadparm[i] = ascii2ebcdic[(uint8_t) lp[i]]; -- } -- -- if (i < 8) { -- memset(loadparm + i, 0x40, 8 - i); /* fill with EBCDIC spaces */ -- } -- -- g_free(lp); -- return 0; -- } -- -- return -1; --} -- - static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, - int virtio_id) - { -@@ -534,7 +548,7 @@ static void update_machine_ipl_properties(IplParameterBlock *iplb) - ascii_loadparm[i] = 0; - object_property_set_str(machine, "loadparm", ascii_loadparm, &err); - } else { -- object_property_set_str(machine, "loadparm", "", &err); -+ object_property_set_str(machine, "loadparm", " ", &err); - } - if (err) { - warn_report_err(err); -diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h -index fa394c339d..b670bad551 100644 ---- a/hw/s390x/ipl.h -+++ b/hw/s390x/ipl.h -@@ -21,7 +21,8 @@ - - #define DIAG308_FLAGS_LP_VALID 0x80 - --int s390_ipl_set_loadparm(uint8_t *loadparm); -+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_update_diag308(IplParameterBlock *iplb); - int s390_ipl_prepare_pv_header(Error **errp); - int s390_ipl_pv_unpack(void); -diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c -index 5113313aa8..ef2a9687c7 100644 ---- a/hw/s390x/s390-virtio-ccw.c -+++ b/hw/s390x/s390-virtio-ccw.c -@@ -722,28 +722,12 @@ static void machine_set_loadparm(Object *obj, Visitor *v, - { - S390CcwMachineState *ms = S390_CCW_MACHINE(obj); - char *val; -- int i; - - if (!visit_type_str(v, name, &val, errp)) { - return; - } - -- for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) { -- uint8_t c = qemu_toupper(val[i]); /* mimic HMC */ -- -- if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') || -- (c == ' ')) { -- ms->loadparm[i] = c; -- } else { -- error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", -- c, c); -- return; -- } -- } -- -- for (; i < sizeof(ms->loadparm); i++) { -- ms->loadparm[i] = ' '; /* pad right with spaces */ -- } -+ s390_ipl_fmt_loadparm(ms->loadparm, val, errp); - } - - static void ccw_machine_class_init(ObjectClass *oc, void *data) -diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c -index e725dcd5fd..8757626b5c 100644 ---- a/hw/s390x/sclp.c -+++ b/hw/s390x/sclp.c -@@ -110,7 +110,6 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) - MachineState *machine = MACHINE(qdev_get_machine()); - int cpu_count; - int rnsize, rnmax; -- IplParameterBlock *ipib = s390_ipl_get_iplb(); - 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) : -@@ -171,12 +170,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) - read_info->rnmax2 = cpu_to_be64(rnmax); - } - -- if (ipib && ipib->flags & DIAG308_FLAGS_LP_VALID) { -- memcpy(&read_info->loadparm, &ipib->loadparm, -- sizeof(read_info->loadparm)); -- } else { -- s390_ipl_set_loadparm(read_info->loadparm); -- } -+ s390_ipl_convert_loadparm((char *)S390_CCW_MACHINE(machine)->loadparm, -+ read_info->loadparm); - - sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION); - } -diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h -index 0ef04af027..b67d2ae061 100644 ---- a/include/hw/s390x/ipl/qipl.h -+++ b/include/hw/s390x/ipl/qipl.h -@@ -18,6 +18,7 @@ - - #define QIPL_ADDRESS 0xcc - #define LOADPARM_LEN 8 -+#define NO_LOADPARM "\0\0\0\0\0\0\0\0" - - /* - * The QEMU IPL Parameters will be stored at absolute address -diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c -index 34ef27d7a6..ab4709e16e 100644 ---- a/pc-bios/s390-ccw/main.c -+++ b/pc-bios/s390-ccw/main.c -@@ -183,8 +183,14 @@ static void css_setup(void) - static void boot_setup(void) - { - char lpmsg[] = "LOADPARM=[________]\n"; -+ have_iplb = store_iplb(&iplb); -+ -+ if (memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { -+ ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN); -+ } else { -+ sclp_get_loadparm_ascii(loadparm_str); -+ } - -- sclp_get_loadparm_ascii(loadparm_str); - memcpy(lpmsg + 10, loadparm_str, 8); - puts(lpmsg); - -@@ -193,8 +199,6 @@ static void boot_setup(void) - * so we don't taint our decision-making process during a reboot. - */ - memset((char *)S390EP, 0, 6); -- -- have_iplb = store_iplb(&iplb); - } - - static bool find_boot_device(void) --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch b/images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch deleted file mode 100644 index 059798ab8..000000000 --- a/images/qemu-artifact/patches/kvm-s390x-Rebuild-IPLB-for-SCSI-device-directly-from-DIA.patch +++ /dev/null @@ -1,264 +0,0 @@ -From 9d333e9e7614676aac3a39b0f4a5f5d67323b23d Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:50 -0400 -Subject: [PATCH 17/27] s390x: Rebuild IPLB for SCSI device directly from - DIAG308 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [17/23] d0326ad7958cc82496bf57fd09bbc877c5b8c0ac (thuth/qemu-kvm-cs9) - -Because virtio-scsi type devices use a non-architected IPLB pbt code they cannot -be set and stored normally. Instead, the IPLB must be rebuilt during re-ipl. - -As s390x does not natively support multiple boot devices, the devno field is -used to store the position in the boot order for the device. - -Handling the rebuild as part of DIAG308 removes the need to check the devices -for invalid IPLBs later in the IPL. - -Signed-off-by: Jared Rossi -Acked-by: Thomas Huth -Message-ID: <20241020012953.1380075-17-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit 455e3bc3f74ee76964efec2e0c646db15095d0d2) ---- - hw/s390x/ipl.c | 74 ++++++------------------------------- - hw/s390x/ipl.h | 11 ++++-- - include/hw/s390x/ipl/qipl.h | 3 +- - pc-bios/s390-ccw/jump2ipl.c | 11 ++++-- - target/s390x/diag.c | 9 ++++- - 5 files changed, 38 insertions(+), 70 deletions(-) - -diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c -index f4576f8822..5fbd43c346 100644 ---- a/hw/s390x/ipl.c -+++ b/hw/s390x/ipl.c -@@ -448,7 +448,6 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) - - static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) - { -- S390IPLState *ipl = get_ipl_device(); - CcwDevice *ccw_dev = NULL; - SCSIDevice *sd; - int devtype; -@@ -481,9 +480,6 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) - iplb->ccw.ssid = ccw_dev->sch->ssid & 3; - break; - case CCW_DEVTYPE_VIRTIO_NET: -- /* The S390IPLState netboot is true if ANY IPLB may use netboot */ -- ipl->netboot = true; -- /* Fall through to CCW_DEVTYPE_VIRTIO case */ - case CCW_DEVTYPE_VIRTIO: - iplb->len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); - iplb->blk0_len = -@@ -508,6 +504,16 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) - return false; - } - -+void s390_rebuild_iplb(uint16_t dev_index, IplParameterBlock *iplb) -+{ -+ S390IPLState *ipl = get_ipl_device(); -+ uint16_t index; -+ index = ipl->rebuilt_iplb ? ipl->iplb_index : dev_index; -+ -+ ipl->rebuilt_iplb = s390_build_iplb(get_boot_device(index), iplb); -+ ipl->iplb_index = index; -+} -+ - static bool s390_init_all_iplbs(S390IPLState *ipl) - { - int iplb_num = 0; -@@ -564,44 +570,6 @@ static bool s390_init_all_iplbs(S390IPLState *ipl) - return iplb_num; - } - --static bool is_virtio_ccw_device_of_type(IplParameterBlock *iplb, -- int virtio_id) --{ -- uint8_t cssid; -- uint8_t ssid; -- uint16_t devno; -- uint16_t schid; -- SubchDev *sch = NULL; -- -- if (iplb->pbt != S390_IPL_TYPE_CCW) { -- return false; -- } -- -- devno = be16_to_cpu(iplb->ccw.devno); -- ssid = iplb->ccw.ssid & 3; -- -- for (schid = 0; schid < MAX_SCHID; schid++) { -- for (cssid = 0; cssid < MAX_CSSID; cssid++) { -- sch = css_find_subch(1, cssid, ssid, schid); -- -- if (sch && sch->devno == devno) { -- return sch->id.cu_model == virtio_id; -- } -- } -- } -- return false; --} -- --static bool is_virtio_net_device(IplParameterBlock *iplb) --{ -- return is_virtio_ccw_device_of_type(iplb, VIRTIO_ID_NET); --} -- --static bool is_virtio_scsi_device(IplParameterBlock *iplb) --{ -- return is_virtio_ccw_device_of_type(iplb, VIRTIO_ID_SCSI); --} -- - static void update_machine_ipl_properties(IplParameterBlock *iplb) - { - Object *machine = qdev_get_machine(); -@@ -641,7 +609,7 @@ void s390_ipl_update_diag308(IplParameterBlock *iplb) - ipl->iplb = *iplb; - ipl->iplb_valid = true; - } -- ipl->netboot = is_virtio_net_device(iplb); -+ - update_machine_ipl_properties(iplb); - } - -@@ -668,32 +636,14 @@ IplParameterBlock *s390_ipl_get_iplb(void) - void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) - { - S390IPLState *ipl = get_ipl_device(); -- - if (reset_type == S390_RESET_EXTERNAL || reset_type == S390_RESET_REIPL) { - /* use CPU 0 for full resets */ - ipl->reset_cpu_index = 0; - } else { - ipl->reset_cpu_index = cs->cpu_index; - } -- ipl->reset_type = reset_type; - -- if (reset_type == S390_RESET_REIPL && -- ipl->iplb_valid && -- !ipl->netboot && -- ipl->iplb.pbt == S390_IPL_TYPE_CCW && -- is_virtio_scsi_device(&ipl->iplb)) { -- CcwDevice *ccw_dev = s390_get_ccw_device(get_boot_device(0), NULL); -- -- if (ccw_dev && -- cpu_to_be16(ccw_dev->sch->devno) == ipl->iplb.ccw.devno && -- (ccw_dev->sch->ssid & 3) == ipl->iplb.ccw.ssid) { -- /* -- * this is the original boot device's SCSI -- * so restore IPL parameter info from it -- */ -- ipl->iplb_valid = s390_build_iplb(get_boot_device(0), &ipl->iplb); -- } -- } -+ ipl->reset_type = reset_type; - if (reset_type == S390_RESET_MODIFIED_CLEAR || - reset_type == S390_RESET_LOAD_NORMAL || - reset_type == S390_RESET_PV) { -diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h -index 54eb48fd6e..d7d0b7bfd2 100644 ---- a/hw/s390x/ipl.h -+++ b/hw/s390x/ipl.h -@@ -24,6 +24,7 @@ - - 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_rebuild_iplb(uint16_t index, IplParameterBlock *iplb); - void s390_ipl_update_diag308(IplParameterBlock *iplb); - int s390_ipl_prepare_pv_header(Error **errp); - int s390_ipl_pv_unpack(void); -@@ -65,7 +66,8 @@ struct S390IPLState { - bool enforce_bios; - bool iplb_valid; - bool iplb_valid_pv; -- bool netboot; -+ bool rebuilt_iplb; -+ uint16_t iplb_index; - /* reset related properties don't have to be migrated or reset */ - enum s390_reset reset_type; - int reset_cpu_index; -@@ -172,11 +174,14 @@ static inline bool iplb_valid_pv(IplParameterBlock *iplb) - - static inline bool iplb_valid(IplParameterBlock *iplb) - { -+ uint32_t len = be32_to_cpu(iplb->len); -+ - switch (iplb->pbt) { - case S390_IPL_TYPE_FCP: -- return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_FCP_LEN; -+ return len >= S390_IPLB_MIN_FCP_LEN; - case S390_IPL_TYPE_CCW: -- return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_CCW_LEN; -+ return len >= S390_IPLB_MIN_CCW_LEN; -+ case S390_IPL_TYPE_QEMU_SCSI: - default: - return false; - } -diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h -index 1da4f75aa8..6824391111 100644 ---- a/include/hw/s390x/ipl/qipl.h -+++ b/include/hw/s390x/ipl/qipl.h -@@ -29,7 +29,8 @@ - */ - struct QemuIplParameters { - uint8_t qipl_flags; -- uint8_t reserved1[3]; -+ uint8_t index; -+ uint8_t reserved1[2]; - uint64_t reserved2; - uint32_t boot_menu_timeout; - uint8_t reserved3[2]; -diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c -index 8db1764ff3..99d18947d1 100644 ---- a/pc-bios/s390-ccw/jump2ipl.c -+++ b/pc-bios/s390-ccw/jump2ipl.c -@@ -39,10 +39,15 @@ int jump_to_IPL_code(uint64_t address) - write_subsystem_identification(); - write_iplb_location(); - -- /* prevent unknown IPL types in the guest */ -+ /* -+ * The IPLB for QEMU SCSI type devices must be rebuilt during re-ipl. The -+ * iplb.devno is set to the boot position of the target SCSI device. -+ */ - if (iplb.pbt == S390_IPL_TYPE_QEMU_SCSI) { -- iplb.pbt = S390_IPL_TYPE_CCW; -- set_iplb(&iplb); -+ iplb.devno = qipl.index; -+ if (!set_iplb(&iplb)) { -+ panic("Failed to set IPLB"); -+ } - } - - /* -diff --git a/target/s390x/diag.c b/target/s390x/diag.c -index 27ffd48576..a1fd54ddac 100644 ---- a/target/s390x/diag.c -+++ b/target/s390x/diag.c -@@ -133,7 +133,14 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) - - valid = subcode == DIAG308_PV_SET ? iplb_valid_pv(iplb) : iplb_valid(iplb); - if (!valid) { -- env->regs[r1 + 1] = DIAG_308_RC_INVALID; -+ if (subcode == DIAG308_SET && iplb->pbt == S390_IPL_TYPE_QEMU_SCSI) { -+ s390_rebuild_iplb(iplb->devno, iplb); -+ s390_ipl_update_diag308(iplb); -+ env->regs[r1 + 1] = DIAG_308_RC_OK; -+ } else { -+ env->regs[r1 + 1] = DIAG_308_RC_INVALID; -+ } -+ - goto out; - } - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch b/images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch deleted file mode 100644 index d2a98336f..000000000 --- a/images/qemu-artifact/patches/kvm-scsi-fix-allocation-for-s390x-loadparm.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 15f5e84210537514394b18e9dc6c710ad1218ecd Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Tue, 19 Nov 2024 22:31:22 +0100 -Subject: [PATCH 06/10] scsi: fix allocation for s390x loadparm -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature -RH-Jira: RHEL-68440 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [5/8] 6a0e420261eb0521d4f979d2a6c250ee4aae7606 (thuth/qemu-kvm-cs9) - -Coverity reports a possible buffer overrun due to a non-NUL-terminated -string in scsi_property_set_loadparm(). While things are not so easy, -because qdev_prop_sanitize_s390x_loadparm is designed to operate on a -buffer that is not NUL-terminated, in this case the string *does* have -to be NUL-terminated because it is read by scsi_property_get_loadparm -and s390_build_iplb. - -Reviewed-by: jrossi@linux.ibm.com -Cc: thuth@redhat.com -Fixes: 429442e52d9 ("hw: Add "loadparm" property to scsi disk devices for booting on s390x", 2024-11-18) -Signed-off-by: Paolo Bonzini -(cherry picked from commit b73d7eff1eedb2399cd594bc872d5db13506d951) -Signed-off-by: Thomas Huth ---- - hw/scsi/scsi-disk.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c -index 7566a5f531..de0c295173 100644 ---- a/hw/scsi/scsi-disk.c -+++ b/hw/scsi/scsi-disk.c -@@ -3152,7 +3152,7 @@ static void scsi_property_set_loadparm(Object *obj, const char *value, - return; - } - -- lp_str = g_malloc0(strlen(value)); -+ lp_str = g_malloc0(strlen(value) + 1); - if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) { - g_free(lp_str); - return; --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch b/images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch deleted file mode 100644 index d67b6f2c4..000000000 --- a/images/qemu-artifact/patches/kvm-target-i386-kvm-Report-which-action-failed-in-kvm_ar.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 1ed2fd718be2161f5ad6156dd2311a65b7f3a5e4 Mon Sep 17 00:00:00 2001 -From: Julia Suvorova -Date: Fri, 27 Sep 2024 12:47:41 +0200 -Subject: [PATCH 27/27] target/i386/kvm: Report which action failed in - kvm_arch_put/get_registers - -RH-Author: Julia Suvorova -RH-MergeRequest: 286: kvm: Allow kvm_arch_get/put_registers to accept Error** -RH-Jira: RHEL-60914 -RH-Acked-by: Juraj Marcin -RH-Acked-by: Peter Xu -RH-Commit: [2/2] b5d003dc2ccf869d7a810425baf21c783a96dcd1 - -To help debug and triage future failure reports (akin to [1,2]) that -may occur during kvm_arch_put/get_registers, the error path of each -action is accompanied by unique error message. - -[1] https://issues.redhat.com/browse/RHEL-7558 -[2] https://issues.redhat.com/browse/RHEL-21761 - -Signed-off-by: Julia Suvorova -Reviewed-by: Peter Xu -Link: https://lore.kernel.org/r/20240927104743.218468-3-jusual@redhat.com -Signed-off-by: Paolo Bonzini -(cherry picked from commit fc058618d1596d29e89016750a1aaf64c9fe8832) ---- - target/i386/kvm/kvm.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c -index 423e6922d8..814f93da19 100644 ---- a/target/i386/kvm/kvm.c -+++ b/target/i386/kvm/kvm.c -@@ -5136,6 +5136,7 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) - if (level >= KVM_PUT_RESET_STATE) { - ret = kvm_put_msr_feature_control(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set feature control MSR"); - return ret; - } - } -@@ -5143,12 +5144,14 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) - /* must be before kvm_put_nested_state so that EFER.SVME is set */ - ret = has_sregs2 ? kvm_put_sregs2(x86_cpu) : kvm_put_sregs(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set special registers"); - return ret; - } - - if (level >= KVM_PUT_RESET_STATE) { - ret = kvm_put_nested_state(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set nested state"); - return ret; - } - } -@@ -5166,6 +5169,7 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) - if (xen_mode == XEN_EMULATE && level == KVM_PUT_FULL_STATE) { - ret = kvm_put_xen_state(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set Xen state"); - return ret; - } - } -@@ -5173,37 +5177,45 @@ int kvm_arch_put_registers(CPUState *cpu, int level, Error **errp) - - ret = kvm_getput_regs(x86_cpu, 1); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set general purpose registers"); - return ret; - } - ret = kvm_put_xsave(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set XSAVE"); - return ret; - } - ret = kvm_put_xcrs(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set XCRs"); - return ret; - } - ret = kvm_put_msrs(x86_cpu, level); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set MSRs"); - return ret; - } - ret = kvm_put_vcpu_events(x86_cpu, level); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set vCPU events"); - return ret; - } - if (level >= KVM_PUT_RESET_STATE) { - ret = kvm_put_mp_state(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set MP state"); - return ret; - } - } - - ret = kvm_put_tscdeadline_msr(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set TSC deadline MSR"); - return ret; - } - ret = kvm_put_debugregs(x86_cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to set debug registers"); - return ret; - } - return 0; -@@ -5218,6 +5230,7 @@ int kvm_arch_get_registers(CPUState *cs, Error **errp) - - ret = kvm_get_vcpu_events(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get vCPU events"); - goto out; - } - /* -@@ -5226,44 +5239,54 @@ int kvm_arch_get_registers(CPUState *cs, Error **errp) - */ - ret = kvm_get_mp_state(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get MP state"); - goto out; - } - ret = kvm_getput_regs(cpu, 0); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get general purpose registers"); - goto out; - } - ret = kvm_get_xsave(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get XSAVE"); - goto out; - } - ret = kvm_get_xcrs(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get XCRs"); - goto out; - } - ret = has_sregs2 ? kvm_get_sregs2(cpu) : kvm_get_sregs(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get special registers"); - goto out; - } - ret = kvm_get_msrs(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get MSRs"); - goto out; - } - ret = kvm_get_apic(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get APIC"); - goto out; - } - ret = kvm_get_debugregs(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get debug registers"); - goto out; - } - ret = kvm_get_nested_state(cpu); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get nested state"); - goto out; - } - #ifdef CONFIG_XEN_EMU - if (xen_mode == XEN_EMULATE) { - ret = kvm_get_xen_state(cs); - if (ret < 0) { -+ error_setg_errno(errp, -ret, "Failed to get Xen state"); - goto out; - } - } --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch b/images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch deleted file mode 100644 index 4596afc0a..000000000 --- a/images/qemu-artifact/patches/kvm-tests-qtest-Add-s390x-boot-order-tests-to-cdrom-test.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0e5a728c1d46641bbf5c83289df56422efd374c8 Mon Sep 17 00:00:00 2001 -From: Jared Rossi -Date: Sat, 19 Oct 2024 21:29:53 -0400 -Subject: [PATCH 20/27] tests/qtest: Add s390x boot order tests to cdrom-test.c -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Thomas Huth -RH-MergeRequest: 277: Full boot order support for s390x [CentOS 9] -RH-Jira: RHEL-11424 -RH-Acked-by: Cédric Le Goater -RH-Acked-by: Miroslav Rezanina -RH-Commit: [20/23] 6b8769f2fc5f8c8a6345a5961f54e52be62aae49 (thuth/qemu-kvm-cs9) - -Add two new qtests to verify that a valid IPL device can successfully boot after -failed IPL attempts from one or more invalid devices. - -cdrom-test/as-fallback-device: Defines the primary boot target as a device that -is invalid for IPL and a second boot target that is valid for IPL. Ensures that -the valid device will be selected after the initial failed IPL. - -cdrom-test/as-last-option: Defines the maximum number of boot devices (8) -where only the final entry in the boot order is valid. Ensures that a valid -device will be selected even after multiple failed IPL attempts from both -virtio-blk and virtio-scsi device types. - -Signed-off-by: Jared Rossi -Reviewed-by: Thomas Huth -Message-ID: <20241020012953.1380075-20-jrossi@linux.ibm.com> -Signed-off-by: Thomas Huth -(cherry picked from commit f5aa2d9d4c6480fa73b89c935050afe57e5d8bd9) ---- - tests/qtest/cdrom-test.c | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c -index 5d89e62515..ecba648144 100644 ---- a/tests/qtest/cdrom-test.c -+++ b/tests/qtest/cdrom-test.c -@@ -206,6 +206,30 @@ static void add_s390x_tests(void) - "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " - "-device virtio-blk,drive=d2,bootindex=1 " - "-drive if=none,id=d2,media=cdrom,file=", test_cdboot); -+ qtest_add_data_func("cdrom/boot/as-fallback-device", -+ "-device virtio-serial -device virtio-scsi " -+ "-device virtio-blk,drive=d1,bootindex=1 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " -+ "-device virtio-blk,drive=d2,bootindex=2 " -+ "-drive if=none,id=d2,media=cdrom,file=", test_cdboot); -+ qtest_add_data_func("cdrom/boot/as-last-option", -+ "-device virtio-serial -device virtio-scsi " -+ "-device virtio-blk,drive=d1,bootindex=1 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " -+ "-device virtio-blk,drive=d2,bootindex=2 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d2 " -+ "-device virtio-blk,drive=d3,bootindex=3 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d3 " -+ "-device scsi-hd,drive=d4,bootindex=4 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d4 " -+ "-device scsi-hd,drive=d5,bootindex=5 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d5 " -+ "-device virtio-blk,drive=d6,bootindex=6 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d6 " -+ "-device scsi-hd,drive=d7,bootindex=7 " -+ "-drive driver=null-co,read-zeroes=on,if=none,id=d7 " -+ "-device scsi-cd,drive=d8,bootindex=8 " -+ "-drive if=none,id=d8,media=cdrom,file=", test_cdboot); - if (qtest_has_device("x-terminal3270")) { - qtest_add_data_func("cdrom/boot/without-bootindex", - "-device virtio-scsi -device virtio-serial " --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch b/images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch deleted file mode 100644 index f82a59217..000000000 --- a/images/qemu-artifact/patches/kvm-vfio-container-Fix-container-object-destruction.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 18d64190c2bb43d42e02ea250ffe40b8ba4970f3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= -Date: Mon, 18 Nov 2024 16:34:30 +0100 -Subject: [PATCH 1/2] vfio/container: Fix container object destruction -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Cédric Le Goater -RH-MergeRequest: 293: vfio/container: Fix container object destruction -RH-Jira: RHEL-67935 -RH-Acked-by: Eric Auger -RH-Acked-by: Alex Williamson -RH-Commit: [1/1] cddda9554b1a858a7265d4ed9b81fdac46772a2c (clegoate/qemu-kvm-centos) - -JIRA: https://issues.redhat.com/browse/RHEL-67935 - -commit ebbf7c60bbd1ceedf9faf962e428ceda2388c248 -Author: Cédric Le Goater -Date: Fri Nov 15 09:34:40 2024 +0100 - - vfio/container: Fix container object destruction - - When commit 96b7af4388b3 intoduced a .instance_finalize() handler, - it did not take into account that the container was not necessarily - inserted into the container list of the address space. Hence, if - the container object is destroyed, by calling object_unref() for - example, before vfio_address_space_insert() is called, QEMU may - crash when removing the container from the list as done in - vfio_container_instance_finalize(). This was seen with an SEV-SNP - guest for which discarding of RAM fails. - - To resolve this issue, use the safe version of QLIST_REMOVE(). - - Cc: Zhenzhong Duan - Cc: Eric Auger - Fixes: 96b7af4388b3 ("vfio/container: Move vfio_container_destroy() to an instance_finalize() handler") - Reviewed-by: Zhenzhong Duan - Signed-off-by: Cédric Le Goater - -Signed-off-by: Cédric Le Goater ---- - hw/vfio/container-base.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c -index 809b157674..6f86c37d97 100644 ---- a/hw/vfio/container-base.c -+++ b/hw/vfio/container-base.c -@@ -103,7 +103,7 @@ static void vfio_container_instance_finalize(Object *obj) - VFIOContainerBase *bcontainer = VFIO_IOMMU(obj); - VFIOGuestIOMMU *giommu, *tmp; - -- QLIST_REMOVE(bcontainer, next); -+ QLIST_SAFE_REMOVE(bcontainer, next); - - QLIST_FOREACH_SAFE(giommu, &bcontainer->giommu_list, giommu_next, tmp) { - memory_region_unregister_iommu_notifier( --- -2.45.1 - diff --git a/images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch b/images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch deleted file mode 100644 index 3dc09ccc9..000000000 --- a/images/qemu-artifact/patches/kvm-vfio-migration-Change-trace-formats-from-hex-to-deci.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 619ad79630f5ff2c634fa2785acdaa8dc2f66f62 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= -Date: Wed, 6 Nov 2024 17:28:32 +0100 -Subject: [PATCH 25/27] vfio/migration: Change trace formats from hex to - decimal -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Cédric Le Goater -RH-MergeRequest: 282: vfio/migration: Report only stop-copy size in vfio_state_pending_exact() -RH-Jira: RHEL-64307 -RH-Acked-by: Peter Xu -RH-Acked-by: Alex Williamson -RH-Commit: [2/2] 04c78dea168c6b4edbbf0cbddadb0d760e7afeb5 (clegoate/qemu-kvm-c9s) - -JIRA: https://issues.redhat.com/browse/RHEL-64307 - -commit fa4e20defe239e42af0a1b5c030dec114f799f56 -Author: Avihai Horon -Date: Sun Oct 20 16:01:08 2024 +0300 - - vfio/migration: Change trace formats from hex to decimal - - Data sizes in VFIO migration trace events are printed in hex format - while in migration core trace events they are printed in decimal format. - - This inconsistency makes it less readable when using both trace event - types. Hence, change the data sizes print format to decimal in VFIO - migration trace events. - - Signed-off-by: Avihai Horon - Reviewed-by: Cédric Le Goater - -Signed-off-by: Cédric Le Goater ---- - hw/vfio/trace-events | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events -index 98bd4dccea..3756ff660e 100644 ---- a/hw/vfio/trace-events -+++ b/hw/vfio/trace-events -@@ -151,7 +151,7 @@ vfio_display_edid_write_error(void) "" - vfio_load_cleanup(const char *name) " (%s)" - vfio_load_device_config_state(const char *name) " (%s)" - vfio_load_state(const char *name, uint64_t data) " (%s) data 0x%"PRIx64 --vfio_load_state_device_data(const char *name, uint64_t data_size, int ret) " (%s) size 0x%"PRIx64" ret %d" -+vfio_load_state_device_data(const char *name, uint64_t data_size, int ret) " (%s) size %"PRIu64" ret %d" - vfio_migration_realize(const char *name) " (%s)" - vfio_migration_set_device_state(const char *name, const char *state) " (%s) state %s" - vfio_migration_set_state(const char *name, const char *new_state, const char *recover_state) " (%s) new state %s, recover state %s" -@@ -160,10 +160,10 @@ vfio_save_block(const char *name, int data_size) " (%s) data_size %d" - vfio_save_cleanup(const char *name) " (%s)" - vfio_save_complete_precopy(const char *name, int ret) " (%s) ret %d" - vfio_save_device_config_state(const char *name) " (%s)" --vfio_save_iterate(const char *name, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy initial size 0x%"PRIx64" precopy dirty size 0x%"PRIx64 --vfio_save_setup(const char *name, uint64_t data_buffer_size) " (%s) data buffer size 0x%"PRIx64 --vfio_state_pending_estimate(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" precopy initial size 0x%"PRIx64" precopy dirty size 0x%"PRIx64 --vfio_state_pending_exact(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" stopcopy size 0x%"PRIx64" precopy initial size 0x%"PRIx64" precopy dirty size 0x%"PRIx64 -+vfio_save_iterate(const char *name, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy initial size %"PRIu64" precopy dirty size %"PRIu64 -+vfio_save_setup(const char *name, uint64_t data_buffer_size) " (%s) data buffer size %"PRIu64 -+vfio_state_pending_estimate(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy %"PRIu64" postcopy %"PRIu64" precopy initial size %"PRIu64" precopy dirty size %"PRIu64 -+vfio_state_pending_exact(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size) " (%s) precopy %"PRIu64" postcopy %"PRIu64" stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size %"PRIu64 - vfio_vmstate_change(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" - vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" - --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch b/images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch deleted file mode 100644 index 2a2204c51..000000000 --- a/images/qemu-artifact/patches/kvm-vfio-migration-Report-only-stop-copy-size-in-vfio_st.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 4d37b5f77a60ea951c33ac715584bb6f5897006a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= -Date: Wed, 6 Nov 2024 17:28:32 +0100 -Subject: [PATCH 24/27] vfio/migration: Report only stop-copy size in - vfio_state_pending_exact() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Cédric Le Goater -RH-MergeRequest: 282: vfio/migration: Report only stop-copy size in vfio_state_pending_exact() -RH-Jira: RHEL-64307 -RH-Acked-by: Peter Xu -RH-Acked-by: Alex Williamson -RH-Commit: [1/2] 5330acbef6f8a8ada56bd4c7f616138df1a94112 (clegoate/qemu-kvm-c9s) - -JIRA: https://issues.redhat.com/browse/RHEL-64307 - -commit 3b5948f808e3b99aedfa0aff45cffbe8b7ec07ed -Author: Avihai Horon -Date: Sun Oct 20 16:01:06 2024 +0300 - - vfio/migration: Report only stop-copy size in vfio_state_pending_exact() - - vfio_state_pending_exact() is used to update migration core how much - device data is left for the device migration. Currently, the sum of - pre-copy and stop-copy sizes of the VFIO device are reported. - - The pre-copy size is obtained via the VFIO_MIG_GET_PRECOPY_INFO ioctl, - which returns the amount of device data available to be transferred - while the device is in the PRE_COPY states. - - The stop-copy size is obtained via the VFIO_DEVICE_FEATURE_MIG_DATA_SIZE - ioctl, which returns the total amount of device data left to be - transferred in order to complete the device migration. - - According to the above, current implementation is wrong -- it reports - extra overlapping data because pre-copy size is already contained in - stop-copy size. Fix it by reporting only stop-copy size. - - Fixes: eda7362af959 ("vfio/migration: Add VFIO migration pre-copy support") - Signed-off-by: Avihai Horon - Reviewed-by: Cédric Le Goater - -Signed-off-by: Cédric Le Goater ---- - hw/vfio/migration.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c -index 262d42a46e..dd717e8d6c 100644 ---- a/hw/vfio/migration.c -+++ b/hw/vfio/migration.c -@@ -576,9 +576,6 @@ static void vfio_state_pending_exact(void *opaque, uint64_t *must_precopy, - - if (vfio_device_state_is_precopy(vbasedev)) { - vfio_query_precopy_size(migration); -- -- *must_precopy += -- migration->precopy_init_size + migration->precopy_dirty_size; - } - - trace_vfio_state_pending_exact(vbasedev->name, *must_precopy, *can_postcopy, --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch b/images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch deleted file mode 100644 index 0474c68a0..000000000 --- a/images/qemu-artifact/patches/kvm-virtio-net-Add-queues-before-loading-them.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 873e57548d92eb916656b6304a780f63958aa9fe Mon Sep 17 00:00:00 2001 -From: Akihiko Odaki -Date: Tue, 22 Oct 2024 15:49:01 +0900 -Subject: [PATCH 01/10] virtio-net: Add queues before loading them -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: 小田喜陽彦 -RH-MergeRequest: 299: virtio-net: Add queues before loading them -RH-Jira: RHEL-69477 -RH-Acked-by: Laurent Vivier -RH-Acked-by: Jason Wang -RH-Commit: [1/1] 7bd06d5f9c0f0ce3d211204c404451d7002bb7fb (akihiko.odaki/qemu-kvm) - -Call virtio_net_set_multiqueue() to add queues before loading their -states. Otherwise the loaded queues will not have handlers and elements -in them will not be processed. - -Cc: qemu-stable@nongnu.org -Fixes: 8c49756825da ("virtio-net: Add only one queue pair when realizing") -Reported-by: Laurent Vivier -Signed-off-by: Akihiko Odaki -Acked-by: Michael S. Tsirkin -Signed-off-by: Jason Wang -(cherry picked from commit 9379ea9db3c0064fa2787db0794a23a30f7b2d2d) ---- - hw/net/virtio-net.c | 10 ++++++++++ - hw/virtio/virtio.c | 7 +++++++ - include/hw/virtio/virtio.h | 2 ++ - 3 files changed, 19 insertions(+) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index ed33a32877..90d05f94d4 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -3032,6 +3032,15 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue) - virtio_net_set_queue_pairs(n); - } - -+static int virtio_net_pre_load_queues(VirtIODevice *vdev) -+{ -+ virtio_net_set_multiqueue(VIRTIO_NET(vdev), -+ virtio_has_feature(vdev->guest_features, VIRTIO_NET_F_RSS) || -+ virtio_has_feature(vdev->guest_features, VIRTIO_NET_F_MQ)); -+ -+ return 0; -+} -+ - static int virtio_net_post_load_device(void *opaque, int version_id) - { - VirtIONet *n = opaque; -@@ -4010,6 +4019,7 @@ static void virtio_net_class_init(ObjectClass *klass, void *data) - vdc->guest_notifier_mask = virtio_net_guest_notifier_mask; - vdc->guest_notifier_pending = virtio_net_guest_notifier_pending; - vdc->legacy_features |= (0x1 << VIRTIO_NET_F_GSO); -+ vdc->pre_load_queues = virtio_net_pre_load_queues; - vdc->post_load = virtio_net_post_load_virtio; - vdc->vmsd = &vmstate_virtio_net_device; - vdc->primary_unplug_pending = primary_unplug_pending; -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 9e10cbc058..10f24a58dd 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -3251,6 +3251,13 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) - config_len--; - } - -+ if (vdc->pre_load_queues) { -+ ret = vdc->pre_load_queues(vdev); -+ if (ret) { -+ return ret; -+ } -+ } -+ - num = qemu_get_be32(f); - - if (num > VIRTIO_QUEUE_MAX) { -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index 0fcbc5c0c6..953dfca27c 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -210,6 +210,8 @@ struct VirtioDeviceClass { - void (*guest_notifier_mask)(VirtIODevice *vdev, int n, bool mask); - int (*start_ioeventfd)(VirtIODevice *vdev); - void (*stop_ioeventfd)(VirtIODevice *vdev); -+ /* Called before loading queues. Useful to add queues before loading. */ -+ int (*pre_load_queues)(VirtIODevice *vdev); - /* Saving and loading of a device; trying to deprecate save/load - * use vmsd for new devices. - */ --- -2.39.3 - diff --git a/images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch b/images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch deleted file mode 100644 index 39d808a18..000000000 --- a/images/qemu-artifact/patches/kvm-vnc-fix-crash-when-no-console-attached.patch +++ /dev/null @@ -1,61 +0,0 @@ -From b38e94f0f0d45f8edd30828d4bb620430e604048 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= -Date: Tue, 20 Aug 2024 17:11:12 +0400 -Subject: [PATCH 10/10] vnc: fix crash when no console attached -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -RH-Author: Marc-André Lureau -RH-MergeRequest: 300: vnc: fix crash when no console attached -RH-Jira: RHEL-61633 -RH-Acked-by: Miroslav Rezanina -RH-Commit: [1/1] 91fc70408701fa1e20ed8fefb8cdf424451dcc20 (marcandre.lureau-rh/qemu-kvm-centos) - -JIRA: https://issues.redhat.com/browse/RHEL-61633 - -Since commit e99441a3793b5 ("ui/curses: Do not use console_select()") -qemu_text_console_put_keysym() no longer checks for NULL console -argument, which leads to a later crash: - -Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. -0x00005555559ee186 in qemu_text_console_handle_keysym (s=0x0, keysym=31) at ../ui/console-vc.c:332 -332 } else if (s->echo && (keysym == '\r' || keysym == '\n')) { -(gdb) bt - #0 0x00005555559ee186 in qemu_text_console_handle_keysym (s=0x0, keysym=31) at ../ui/console-vc.c:332 - #1 0x00005555559e18e5 in qemu_text_console_put_keysym (s=, keysym=) at ../ui/console.c:303 - #2 0x00005555559f2e88 in do_key_event (vs=vs@entry=0x5555579045c0, down=down@entry=1, keycode=keycode@entry=60, sym=sym@entry=65471) at ../ui/vnc.c:2034 - #3 0x00005555559f845c in ext_key_event (vs=0x5555579045c0, down=1, sym=65471, keycode=) at ../ui/vnc.c:2070 - #4 protocol_client_msg (vs=0x5555579045c0, data=, len=) at ../ui/vnc.c:2514 - #5 0x00005555559f515c in vnc_client_read (vs=0x5555579045c0) at ../ui/vnc.c:1607 - -Fixes: e99441a3793b5 ("ui/curses: Do not use console_select()") -Fixes: https://issues.redhat.com/browse/RHEL-50529 -Cc: qemu-stable@nongnu.org -Signed-off-by: Marc-André Lureau -Reviewed-by: Akihiko Odaki -Reviewed-by: Michael Tokarev -Signed-off-by: Michael Tokarev - -(cherry picked from commit 0e60fc80938d9ce84274a36ddfaaa640bdef2be8) -Signed-off-by: Marc-André Lureau ---- - ui/vnc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui/vnc.c b/ui/vnc.c -index dae5d51210..5057ec8680 100644 ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -1935,7 +1935,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) - } - - qkbd_state_key_event(vs->vd->kbd, qcode, down); -- if (!qemu_console_is_graphic(vs->vd->dcl.con)) { -+ if (QEMU_IS_TEXT_CONSOLE(vs->vd->dcl.con)) { - QemuTextConsole *con = QEMU_TEXT_CONSOLE(vs->vd->dcl.con); - bool numlock = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK); - bool control = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL); --- -2.39.3 - diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 3ac725133..5e83e7ecc 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -1,5 +1,5 @@ --- -{{- $versionQemu := "9.1.0" }} +{{- $versionQemu := "9.2.0" }} {{- $gitRepoUrl := "https://github.com/qemu/qemu.git" }} {{- $gitRepoName := "qemu" }} @@ -14,15 +14,6 @@ git: stageDependencies: setup: - install-qemu.sh -- add: /images/{{ $.ImageName }} - to: / - stageDependencies: - install: - - '**/*' - includePaths: - - patches - excludePaths: - - patches/README.md shell: beforeInstall: - | @@ -125,11 +116,6 @@ shell: git clone --depth=1 --branch v{{ $versionQemu }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionQemu }} cd {{ $gitRepoName }}-{{ $versionQemu }} - - for p in /patches/*.patch ; do - echo -n "Apply ${p} ... " - git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1) - done ./configure \ --target-list="x86_64-softmmu" \ @@ -139,7 +125,6 @@ shell: --block-drv-rw-whitelist="qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress,virtio-blk-vhost-vdpa,virtio-blk-vfio-pci,virtio-blk-vhost-user,io_uring,nvme-io_uring" \ --block-drv-ro-whitelist="vdi,vmdk,vhdx,vpc,https" \ --disable-alsa \ - --disable-af-xdp \ --disable-attr \ --disable-auth-pam \ --disable-avx2 \ From 72e84fb186408bbead73dac6faf064defca05749 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 28 Jan 2025 16:03:05 +0300 Subject: [PATCH 058/107] edk2: try whiout enroll Signed-off-by: Nikita Korolev --- images/edk2-artifact/build.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/images/edk2-artifact/build.sh b/images/edk2-artifact/build.sh index 9a806e3f1..cfba576e8 100755 --- a/images/edk2-artifact/build.sh +++ b/images/edk2-artifact/build.sh @@ -173,12 +173,15 @@ enroll() { # --distro-keys altlinux } -enroll +# enroll -# cp -p $FIRMWARE/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.secboot.fd -# cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd -# cp -p $FIRMWARE/OVMF.inteltdx.fd $FIRMWARE/OVMF.inteltdx.secboot.fd +no_enroll() { + cp -p $FIRMWARE/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.secboot.fd + cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd + cp -p $FIRMWARE/OVMF.inteltdx.fd $FIRMWARE/OVMF.inteltdx.secboot.fd +} +no_enroll # build microvm echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc" From 9d5dd476def25f683745c6a1c9e6ead00661159f Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 28 Jan 2025 23:47:02 +0300 Subject: [PATCH 059/107] edk2: change symlinks OVMF Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 98939d6f6..51eb7fbd2 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -58,15 +58,18 @@ import: before: install includePaths: - usr + - image: edk2-artifact add: /FIRMWARE/ - to: /usr/share/OVMF + to: /usr/share/edk2/ovmf + # to: /usr/share/OVMF before: install includePaths: - '*.fd' - '*.bin' - '*.efi' - '*.iso' + - image: edk2-artifact add: /FIRMWARE/ to: /usr/share/qemu/firmware @@ -148,9 +151,16 @@ shell: # Link to dir OVMF - | - mkdir -p /usr/share/edk2 - ln -s /usr/share/OVMF /usr/share/edk2/ovmf - ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd + mkdir -p /usr/share/OVMF + # mkdir -p /usr/share/edk2 + # ln -s /usr/share/OVMF /usr/share/edk2/ovmf + # ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd + + ln -s /usr/share/edk2/ovmf/OVMF_CODE.secboot.fd /usr/share/OVMF + ln -s /usr/share/edk2/ovmf/OVMF_VARS.fd /usr/share/OVMF + ln -s /usr/share/edk2/ovmf/OVMF_VARS.secboot.fd /usr/share/OVMF + ln -s /usr/share/edk2/ovmf/UefiShell.iso /usr/share/OVMF + ln -s /usr/share/edk2/ovmf/OVMF_CODE.fd /usr/share/edk2/ovmf/OVMF_CODE.cc.fd # Create symlinc for libvirt - | From 6aa981aaf3df767c9ffce21e1ecc62aa1bb82366 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 00:10:34 +0300 Subject: [PATCH 060/107] virt-launcher: add docker env lang posix Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 51eb7fbd2..132bbf1e2 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -37,6 +37,10 @@ shell: # delete docs echo "Delete docs" rm -rf /usr/share/doc/* +docker: + ENV: + LANG: "" + LC_ALL: POSIX --- {{- $versionLibvirt := "10.10.0" }} @@ -156,6 +160,7 @@ shell: # ln -s /usr/share/OVMF /usr/share/edk2/ovmf # ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd + echo "Create symlinks for OVMF" ln -s /usr/share/edk2/ovmf/OVMF_CODE.secboot.fd /usr/share/OVMF ln -s /usr/share/edk2/ovmf/OVMF_VARS.fd /usr/share/OVMF ln -s /usr/share/edk2/ovmf/OVMF_VARS.secboot.fd /usr/share/OVMF From 602635f98d889200fc3b853b378fa459dcfda0ac Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 00:34:48 +0300 Subject: [PATCH 061/107] edk2: build only 4m ovmf Signed-off-by: Nikita Korolev --- images/edk2-artifact/build.sh | 51 +++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/images/edk2-artifact/build.sh b/images/edk2-artifact/build.sh index cfba576e8..d0282b7a1 100755 --- a/images/edk2-artifact/build.sh +++ b/images/edk2-artifact/build.sh @@ -105,42 +105,53 @@ build_iso() { # Build with neither SB nor SMM; include UEFI shell. # mkdir -p OVMF -echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" -build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.fd -cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd +# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" +# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc +# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.fd +# cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd # Build 4MB with neither SB nor SMM; include UEFI shell. echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.fd -cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS_4M.fd +cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.fd +cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd +# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.fd +# cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS_4M.fd # Build with SB and SMM; exclude UEFI shell. -echo_dbg "build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" -build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd +# echo_dbg "build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" +# build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc +# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd # Build 4MB with SB and SMM; exclude UEFI shell. echo_dbg "build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.secboot.fd +cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd +# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.secboot.fd # Build AmdSev and IntelTdx variants touch OvmfPkg/AmdSev/Grub/grub.efi # dummy -echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc" -build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc +echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc" +build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc cp -p Build/AmdSev/*/FV/OVMF.fd $FIRMWARE/OVMF.amdsev.fd +# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc" +# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc +# cp -p Build/AmdSev/*/FV/OVMF.fd $FIRMWARE/OVMF.amdsev.fd -echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc" -build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc +echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc" +build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc cp -p Build/IntelTdx/*/FV/OVMF.fd $FIRMWARE/OVMF.inteltdx.fd +# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc" +# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc +# cp -p Build/IntelTdx/*/FV/OVMF.fd $FIRMWARE/OVMF.inteltdx.fd # build shell echo_dbg "build shell" -build ${OVMF_2M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc -build ${OVMF_2M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc +build ${OVMF_4M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc +build ${OVMF_4M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc +# build ${OVMF_2M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc +# build ${OVMF_2M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc # build ovmf (x64) shell iso with EnrollDefaultKeys #cp Build/Ovmf3264/*/X64/Shell.efi $FIRMWARE/ @@ -177,13 +188,13 @@ enroll() { no_enroll() { cp -p $FIRMWARE/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.secboot.fd - cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd + # cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd cp -p $FIRMWARE/OVMF.inteltdx.fd $FIRMWARE/OVMF.inteltdx.secboot.fd } no_enroll # build microvm -echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc" -build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc -cp -p Build/MicrovmX64/*/FV/MICROVM.fd $FIRMWARE +# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc" +# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc +# cp -p Build/MicrovmX64/*/FV/MICROVM.fd $FIRMWARE From af6d743030a8c1b3b9c424d5cc311fd8c6802690 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 00:59:16 +0300 Subject: [PATCH 062/107] edk2: add json for ovmf (different) Signed-off-by: Nikita Korolev --- .../json/40-edk2-ovmf-x64-sb.json | 35 +++++++++++++++++++ .../json/50-edk2-aarch64-qcow2.json | 32 +++++++++++++++++ .../json/50-edk2-ovmf-x64-nosb.json | 35 +++++++++++++++++++ .../json/51-edk2-aarch64-raw.json | 32 +++++++++++++++++ .../json/52-edk2-aarch64-verbose-qcow2.json | 32 +++++++++++++++++ .../json/53-edk2-aarch64-verbose-raw.json | 32 +++++++++++++++++ .../json/60-edk2-ovmf-x64-amdsev.json | 2 +- .../json/60-edk2-ovmf-x64-inteltdx.json | 2 +- ...30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json | 0 .../30-edk2-ovmf-ia32-sb-enrolled.json | 0 .../31-edk2-ovmf-2m-raw-x64-sb-enrolled.json | 0 .../40-edk2-ovmf-4m-qcow2-x64-sb.json | 0 .../40-edk2-ovmf-ia32-sb.json | 0 .../41-edk2-ovmf-2m-raw-x64-sb.json | 0 .../50-edk2-ovmf-4m-qcow2-x64-nosb.json | 0 .../50-edk2-ovmf-ia32-nosb.json | 0 .../50-edk2-ovmf-x64-microvm.json | 0 .../51-edk2-ovmf-2m-raw-x64-nosb.json | 0 .../json_old/60-edk2-ovmf-x64-amdsev.json | 31 ++++++++++++++++ .../json_old/60-edk2-ovmf-x64-inteltdx.json | 27 ++++++++++++++ 20 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 images/edk2-artifact/json/40-edk2-ovmf-x64-sb.json create mode 100644 images/edk2-artifact/json/50-edk2-aarch64-qcow2.json create mode 100644 images/edk2-artifact/json/50-edk2-ovmf-x64-nosb.json create mode 100644 images/edk2-artifact/json/51-edk2-aarch64-raw.json create mode 100644 images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json create mode 100644 images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json rename images/edk2-artifact/{json => json_old}/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json (100%) rename images/edk2-artifact/{json => json_old}/30-edk2-ovmf-ia32-sb-enrolled.json (100%) rename images/edk2-artifact/{json => json_old}/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json (100%) rename images/edk2-artifact/{json => json_old}/40-edk2-ovmf-4m-qcow2-x64-sb.json (100%) rename images/edk2-artifact/{json => json_old}/40-edk2-ovmf-ia32-sb.json (100%) rename images/edk2-artifact/{json => json_old}/41-edk2-ovmf-2m-raw-x64-sb.json (100%) rename images/edk2-artifact/{json => json_old}/50-edk2-ovmf-4m-qcow2-x64-nosb.json (100%) rename images/edk2-artifact/{json => json_old}/50-edk2-ovmf-ia32-nosb.json (100%) rename images/edk2-artifact/{json => json_old}/50-edk2-ovmf-x64-microvm.json (100%) rename images/edk2-artifact/{json => json_old}/51-edk2-ovmf-2m-raw-x64-nosb.json (100%) create mode 100644 images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json create mode 100644 images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json diff --git a/images/edk2-artifact/json/40-edk2-ovmf-x64-sb.json b/images/edk2-artifact/json/40-edk2-ovmf-x64-sb.json new file mode 100644 index 000000000..02a762233 --- /dev/null +++ b/images/edk2-artifact/json/40-edk2-ovmf-x64-sb.json @@ -0,0 +1,35 @@ +{ + "description": "OVMF with SB+SMM, empty varstore", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "mode": "split", + "executable": { + "filename": "/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ovmf/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "requires-smm", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/images/edk2-artifact/json/50-edk2-aarch64-qcow2.json b/images/edk2-artifact/json/50-edk2-aarch64-qcow2.json new file mode 100644 index 000000000..937d2953e --- /dev/null +++ b/images/edk2-artifact/json/50-edk2-aarch64-qcow2.json @@ -0,0 +1,32 @@ +{ + "description": "UEFI firmware for ARM64 virtual machines", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "mode": "split", + "executable": { + "filename": "/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.qcow2", + "format": "qcow2" + }, + "nvram-template": { + "filename": "/usr/share/edk2/aarch64/vars-template-pflash.qcow2", + "format": "qcow2" + } + }, + "targets": [ + { + "architecture": "aarch64", + "machines": [ + "virt-*" + ] + } + ], + "features": [ + + ], + "tags": [ + + ] +} diff --git a/images/edk2-artifact/json/50-edk2-ovmf-x64-nosb.json b/images/edk2-artifact/json/50-edk2-ovmf-x64-nosb.json new file mode 100644 index 000000000..c660e0c46 --- /dev/null +++ b/images/edk2-artifact/json/50-edk2-ovmf-x64-nosb.json @@ -0,0 +1,35 @@ +{ + "description": "OVMF without SB+SMM, empty varstore", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "mode": "split", + "executable": { + "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ovmf/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "amd-sev", + "amd-sev-es", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/images/edk2-artifact/json/51-edk2-aarch64-raw.json b/images/edk2-artifact/json/51-edk2-aarch64-raw.json new file mode 100644 index 000000000..506bbe69c --- /dev/null +++ b/images/edk2-artifact/json/51-edk2-aarch64-raw.json @@ -0,0 +1,32 @@ +{ + "description": "UEFI firmware for ARM64 virtual machines", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "mode": "split", + "executable": { + "filename": "/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/aarch64/vars-template-pflash.raw", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "aarch64", + "machines": [ + "virt-*" + ] + } + ], + "features": [ + + ], + "tags": [ + + ] +} diff --git a/images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json b/images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json new file mode 100644 index 000000000..976f2a6c2 --- /dev/null +++ b/images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json @@ -0,0 +1,32 @@ +{ + "description": "UEFI firmware for ARM64 virtual machines, verbose logs", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "mode": "split", + "executable": { + "filename": "/usr/share/edk2/aarch64/QEMU_EFI-pflash.qcow2", + "format": "qcow2" + }, + "nvram-template": { + "filename": "/usr/share/edk2/aarch64/vars-template-pflash.qcow2", + "format": "qcow2" + } + }, + "targets": [ + { + "architecture": "aarch64", + "machines": [ + "virt-*" + ] + } + ], + "features": [ + "verbose-static" + ], + "tags": [ + + ] +} diff --git a/images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json b/images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json new file mode 100644 index 000000000..fa0ed91ea --- /dev/null +++ b/images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json @@ -0,0 +1,32 @@ +{ + "description": "UEFI firmware for ARM64 virtual machines, verbose logs", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "mode": "split", + "executable": { + "filename": "/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/aarch64/vars-template-pflash.raw", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "aarch64", + "machines": [ + "virt-*" + ] + } + ], + "features": [ + "verbose-static" + ], + "tags": [ + + ] +} diff --git a/images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json b/images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json index 0a2d59681..9a561bc7e 100644 --- a/images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json +++ b/images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json @@ -7,7 +7,7 @@ "device": "flash", "mode": "stateless", "executable": { - "filename": "/usr/share/OVMF/OVMF.amdsev.fd", + "filename": "/usr/share/edk2/ovmf/OVMF.amdsev.fd", "format": "raw" } }, diff --git a/images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json b/images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json index 6b4f4e59e..445eb70e0 100644 --- a/images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json +++ b/images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json @@ -5,7 +5,7 @@ ], "mapping": { "device": "memory", - "filename": "/usr/share/OVMF/OVMF.inteltdx.secboot.fd" + "filename": "/usr/share/edk2/ovmf/OVMF.inteltdx.secboot.fd" }, "targets": [ { diff --git a/images/edk2-artifact/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json b/images/edk2-artifact/json_old/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json similarity index 100% rename from images/edk2-artifact/json/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json rename to images/edk2-artifact/json_old/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json diff --git a/images/edk2-artifact/json/30-edk2-ovmf-ia32-sb-enrolled.json b/images/edk2-artifact/json_old/30-edk2-ovmf-ia32-sb-enrolled.json similarity index 100% rename from images/edk2-artifact/json/30-edk2-ovmf-ia32-sb-enrolled.json rename to images/edk2-artifact/json_old/30-edk2-ovmf-ia32-sb-enrolled.json diff --git a/images/edk2-artifact/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json b/images/edk2-artifact/json_old/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json similarity index 100% rename from images/edk2-artifact/json/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json rename to images/edk2-artifact/json_old/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json diff --git a/images/edk2-artifact/json/40-edk2-ovmf-4m-qcow2-x64-sb.json b/images/edk2-artifact/json_old/40-edk2-ovmf-4m-qcow2-x64-sb.json similarity index 100% rename from images/edk2-artifact/json/40-edk2-ovmf-4m-qcow2-x64-sb.json rename to images/edk2-artifact/json_old/40-edk2-ovmf-4m-qcow2-x64-sb.json diff --git a/images/edk2-artifact/json/40-edk2-ovmf-ia32-sb.json b/images/edk2-artifact/json_old/40-edk2-ovmf-ia32-sb.json similarity index 100% rename from images/edk2-artifact/json/40-edk2-ovmf-ia32-sb.json rename to images/edk2-artifact/json_old/40-edk2-ovmf-ia32-sb.json diff --git a/images/edk2-artifact/json/41-edk2-ovmf-2m-raw-x64-sb.json b/images/edk2-artifact/json_old/41-edk2-ovmf-2m-raw-x64-sb.json similarity index 100% rename from images/edk2-artifact/json/41-edk2-ovmf-2m-raw-x64-sb.json rename to images/edk2-artifact/json_old/41-edk2-ovmf-2m-raw-x64-sb.json diff --git a/images/edk2-artifact/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json b/images/edk2-artifact/json_old/50-edk2-ovmf-4m-qcow2-x64-nosb.json similarity index 100% rename from images/edk2-artifact/json/50-edk2-ovmf-4m-qcow2-x64-nosb.json rename to images/edk2-artifact/json_old/50-edk2-ovmf-4m-qcow2-x64-nosb.json diff --git a/images/edk2-artifact/json/50-edk2-ovmf-ia32-nosb.json b/images/edk2-artifact/json_old/50-edk2-ovmf-ia32-nosb.json similarity index 100% rename from images/edk2-artifact/json/50-edk2-ovmf-ia32-nosb.json rename to images/edk2-artifact/json_old/50-edk2-ovmf-ia32-nosb.json diff --git a/images/edk2-artifact/json/50-edk2-ovmf-x64-microvm.json b/images/edk2-artifact/json_old/50-edk2-ovmf-x64-microvm.json similarity index 100% rename from images/edk2-artifact/json/50-edk2-ovmf-x64-microvm.json rename to images/edk2-artifact/json_old/50-edk2-ovmf-x64-microvm.json diff --git a/images/edk2-artifact/json/51-edk2-ovmf-2m-raw-x64-nosb.json b/images/edk2-artifact/json_old/51-edk2-ovmf-2m-raw-x64-nosb.json similarity index 100% rename from images/edk2-artifact/json/51-edk2-ovmf-2m-raw-x64-nosb.json rename to images/edk2-artifact/json_old/51-edk2-ovmf-2m-raw-x64-nosb.json diff --git a/images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json b/images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json new file mode 100644 index 000000000..0a2d59681 --- /dev/null +++ b/images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json @@ -0,0 +1,31 @@ +{ + "description": "OVMF with SEV-ES support", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "mode": "stateless", + "executable": { + "filename": "/usr/share/OVMF/OVMF.amdsev.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "amd-sev", + "amd-sev-es", + "amd-sev-snp", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json b/images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json new file mode 100644 index 000000000..6b4f4e59e --- /dev/null +++ b/images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json @@ -0,0 +1,27 @@ +{ + "description": "OVMF with TDX support", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "memory", + "filename": "/usr/share/OVMF/OVMF.inteltdx.secboot.fd" + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "enrolled-keys", + "intel-tdx", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} From a9c0db09edaae338fe58376d4453102b3ccc69f5 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 01:00:01 +0300 Subject: [PATCH 063/107] virt-launcher: comment docker section Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 132bbf1e2..7a6be586c 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -37,10 +37,10 @@ shell: # delete docs echo "Delete docs" rm -rf /usr/share/doc/* -docker: - ENV: - LANG: "" - LC_ALL: POSIX +# docker: +# ENV: +# LANG: "" +# LC_ALL: POSIX --- {{- $versionLibvirt := "10.10.0" }} From 25f61188ce9daa5cf8639d2bef3d14662b284a05 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 01:29:03 +0300 Subject: [PATCH 064/107] virt-launcher: fix ovmf links Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 7a6be586c..1acf01fe6 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -161,11 +161,15 @@ shell: # ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd echo "Create symlinks for OVMF" + ln -sf /usr/share/edk2/ovmf/OVMF_CODE.fd /usr/share/edk2/ovmf/OVMF_CODE.cc.fd + ln -sf /usr/share/edk2/ovmf/OVMF_CODE.cc.fd /usr/share/OVMF/OVMF_CODE.cc.fd + ln -s /usr/share/edk2/ovmf/OVMF_CODE.secboot.fd /usr/share/OVMF ln -s /usr/share/edk2/ovmf/OVMF_VARS.fd /usr/share/OVMF ln -s /usr/share/edk2/ovmf/OVMF_VARS.secboot.fd /usr/share/OVMF ln -s /usr/share/edk2/ovmf/UefiShell.iso /usr/share/OVMF - ln -s /usr/share/edk2/ovmf/OVMF_CODE.fd /usr/share/edk2/ovmf/OVMF_CODE.cc.fd + + # ln -s /usr/share/edk2/ovmf/OVMF_CODE.cc.fd /usr/share/edk2/ovmf/OVMF_CODE.fd # Create symlinc for libvirt - | From 0e36800868c9c7709ec44640655d4180a0a0ab81 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 02:19:26 +0300 Subject: [PATCH 065/107] libvirt: change to 10.9.0 Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 98d6ded46..87b0599bd 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -1,5 +1,5 @@ --- -{{- $versionLibvirt := "10.10.0" }} +{{- $versionLibvirt := "10.9.0" }} {{- $gitRepoUrl := "https://github.com/libvirt/libvirt.git" }} {{- $gitRepoName := "libvirt" }} From cfa09181564ed9d7772590d8639d19651f0f21b6 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 02:24:14 +0300 Subject: [PATCH 066/107] qemu,libvirt: fix regex in script Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 2 +- images/qemu-artifact/install-qemu.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 1b1fc98a5..2d23a475f 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -601,7 +601,7 @@ copy_file() { # Copy the file # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml) ]];then + if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml|target|socket) ]];then strip "$SOURCE_PATH" fi cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index e406c7ca3..3fdca3e17 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -273,7 +273,7 @@ copy_file() { # Copy the file # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml) ]];then + if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml|target|socket) ]];then strip "$SOURCE_PATH" fi cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" From 181358c5dbde7670ec8dbadf55a9563107f9d754 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 02:33:08 +0300 Subject: [PATCH 067/107] qemu,libvirt: add param version-num in stage setup Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 3 ++- images/qemu-artifact/werf.inc.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 87b0599bd..68a33752b 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -241,6 +241,7 @@ shell: */}} setup: - | - /install-libvirt.sh -s /{{ $gitRepoName }}-{{ $versionLibvirt }} \ + /install-libvirt.sh --version-num "{{ $versionLibvirt }}" \ + -s /{{ $gitRepoName }}-{{ $versionLibvirt }} \ -d /BINS \ -b build diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 5e83e7ecc..4783896f0 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -308,6 +308,7 @@ shell: setup: - | - /install-qemu.sh -s /{{ $gitRepoName }}-{{ $versionQemu }} \ + /install-qemu.sh --version-num "{{ $versionQemu }}" \ + -s /{{ $gitRepoName }}-{{ $versionQemu }} \ -d /BINS \ -b build From 5d55cfa848cf0de4b0682320f21c4846d0551e2b Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 02:35:46 +0300 Subject: [PATCH 068/107] qemu,libvirt: fix regex in install script Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 2 +- images/qemu-artifact/install-qemu.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 2d23a475f..0bb8b23d8 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -601,7 +601,7 @@ copy_file() { # Copy the file # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml|target|socket) ]];then + if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml|target|socket|bin|json|img|png|fd|dtb|rom) ]];then strip "$SOURCE_PATH" fi cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 3fdca3e17..378a9d5e5 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -273,7 +273,7 @@ copy_file() { # Copy the file # install -s "$SOURCE_PATH" "$DEST_BASE$dest_dir" - if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml|target|socket) ]];then + if ! [[ "$SOURCE_PATH" =~ \.(txt|log|sh|service|conf|xml|target|socket|bin|json|img|png|fd|dtb|rom) ]];then strip "$SOURCE_PATH" fi cp -p "$SOURCE_PATH" "$DEST_BASE$dest_dir" From bc78fac36d47634a0c141f7c3c9d074a251246fc Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 29 Jan 2025 02:42:43 +0300 Subject: [PATCH 069/107] virt-launcher: change version libvirt to 10.9.0 Signed-off-by: Nikita Korolev virt-launcher: remove unnecessary code Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 1acf01fe6..026cd257f 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -42,7 +42,7 @@ shell: # LANG: "" # LC_ALL: POSIX --- -{{- $versionLibvirt := "10.10.0" }} +{{- $versionLibvirt := "10.9.0" }} image: {{ $.ImageName }}-prepared final: false @@ -156,9 +156,6 @@ shell: # Link to dir OVMF - | mkdir -p /usr/share/OVMF - # mkdir -p /usr/share/edk2 - # ln -s /usr/share/OVMF /usr/share/edk2/ovmf - # ln -s /usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.cc.fd echo "Create symlinks for OVMF" ln -sf /usr/share/edk2/ovmf/OVMF_CODE.fd /usr/share/edk2/ovmf/OVMF_CODE.cc.fd @@ -168,8 +165,6 @@ shell: ln -s /usr/share/edk2/ovmf/OVMF_VARS.fd /usr/share/OVMF ln -s /usr/share/edk2/ovmf/OVMF_VARS.secboot.fd /usr/share/OVMF ln -s /usr/share/edk2/ovmf/UefiShell.iso /usr/share/OVMF - - # ln -s /usr/share/edk2/ovmf/OVMF_CODE.cc.fd /usr/share/edk2/ovmf/OVMF_CODE.fd # Create symlinc for libvirt - | @@ -209,7 +204,7 @@ shell: - chmod +x /usr/bin/virt-launcher-monitor - | - # [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp + [[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp - mkdir -p /init/usr/bin && ln -s /usr/bin/container-disk /init/usr/bin/container-disk # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel From 58bdbb2ae4d68fb859e827293a1413dd232d7efc Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Thu, 30 Jan 2025 14:38:23 +0300 Subject: [PATCH 070/107] libvirt: remove unnecessary code Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 70 --------------------------- 1 file changed, 70 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 68a33752b..10a195e40 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -169,76 +169,6 @@ shell: ninja -C build -j$(nproc) -{{/* - # -Ddriver_qemu=enabled \ - # -Ddriver_openvz=disabled \ - # -Ddriver_lxc=disabled -Dlogin_shell=disabled \ - # -Ddriver_vbox=disabled \ - # -Ddriver_libxl=disabled \ - # -Dsasl=enabled \ - # -Dpolkit=enabled \ - # -Ddriver_libvirtd=enabled \ - # -Ddriver_remote=enabled \ - # -Ddriver_test=disabled \ - # -Ddriver_esx=disabled -Dcurl=disabled \ - # -Ddriver_hyperv=disabled -Dopenwsman=disabled \ - # -Ddriver_vmware=disabled \ - # -Ddriver_vz=disabled \ - # -Ddriver_bhyve=disabled \ - # -Ddriver_ch=disabled \ - # -Dremote_default_mode=direct \ - # -Ddriver_interface=enabled \ - # -Ddriver_network=enabled \ - # -Dstorage_fs=disabled \ - # -Dstorage_lvm=disabled \ - # -Dstorage_iscsi=disabled \ - # -Dstorage_iscsi_direct=disabled -Dlibiscsi=disabled \ - # -Dstorage_scsi=disabled \ - # -Dstorage_disk=disabled \ - # -Dstorage_mpath=disabled \ - # -Dstorage_rbd=disabled \ - # -Dstorage_gluster=disabled -Dglusterfs=disabled \ - # -Dstorage_zfs=disabled \ - # -Dstorage_vstorage=disabled \ - # -Dnumactl=enabled \ - # -Dcapng=enabled \ - # -Dfuse=enabled \ - # -Dnetcf=disabled \ - # -Dnls=enabled \ - # -Dapparmor=disabled \ - # -Dapparmor_profiles=disabled \ - # -Dsecdriver_apparmor=disabled \ - # -Dudev=enabled \ - # -Djson_c=enabled \ - # -Dsanlock=disabled \ - # -Dlibpcap=enabled \ - # -Dnbdkit=disabled -Dnbdkit_config_default=disabled \ - # -Dlibnl=enabled \ - # -Daudit=enabled \ - # -Ddtrace=disabled \ - # -Dfirewalld=disabled \ - # -Dfirewalld_zone=disabled \ - # -Dwireshark_dissector=disabled \ - # -Dlibssh=enabled -Dlibssh2=enabled \ - # -Dpm_utils=disabled \ - # -Dnss=enabled \ - # -Dqemu_user="qemu" \ - # -Dqemu_group="qemu" \ - # -Dsysctl_config=enabled \ - # -Dssh_proxy=enabled \ - # -Dinit_script=systemd \ - # -Dfirewall_backend_priority="iptables,nftables" \ - # -Ddocs=disabled \ - # -Dtests=disabled \ - # -Drpath=disabled -*/}} - -{{/* - # -Dselinux=enabled -Dselinux_mount="/sys/fs/selinux" \ - # -Dtls_priority="@LIBVIRT,SYSTEM" \ - # -Duserfaultfd_sysctl=disabled \ - # -Dnumad=disabled \ -*/}} setup: - | /install-libvirt.sh --version-num "{{ $versionLibvirt }}" \ From 0f27c05b28d72c7f079ab763635424ea112512da Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 31 Jan 2025 12:45:07 +0300 Subject: [PATCH 071/107] edk2: rm old json cgfs ovmf Signed-off-by: Nikita Korolev --- ...30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json | 36 ------------------- .../30-edk2-ovmf-ia32-sb-enrolled.json | 36 ------------------- .../31-edk2-ovmf-2m-raw-x64-sb-enrolled.json | 36 ------------------- .../40-edk2-ovmf-4m-qcow2-x64-sb.json | 35 ------------------ .../json_old/40-edk2-ovmf-ia32-sb.json | 35 ------------------ .../json_old/41-edk2-ovmf-2m-raw-x64-sb.json | 35 ------------------ .../50-edk2-ovmf-4m-qcow2-x64-nosb.json | 36 ------------------- .../json_old/50-edk2-ovmf-ia32-nosb.json | 34 ------------------ .../json_old/50-edk2-ovmf-x64-microvm.json | 22 ------------ .../51-edk2-ovmf-2m-raw-x64-nosb.json | 36 ------------------- .../json_old/60-edk2-ovmf-x64-amdsev.json | 31 ---------------- .../json_old/60-edk2-ovmf-x64-inteltdx.json | 27 -------------- 12 files changed, 399 deletions(-) delete mode 100644 images/edk2-artifact/json_old/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json delete mode 100644 images/edk2-artifact/json_old/30-edk2-ovmf-ia32-sb-enrolled.json delete mode 100644 images/edk2-artifact/json_old/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json delete mode 100644 images/edk2-artifact/json_old/40-edk2-ovmf-4m-qcow2-x64-sb.json delete mode 100644 images/edk2-artifact/json_old/40-edk2-ovmf-ia32-sb.json delete mode 100644 images/edk2-artifact/json_old/41-edk2-ovmf-2m-raw-x64-sb.json delete mode 100644 images/edk2-artifact/json_old/50-edk2-ovmf-4m-qcow2-x64-nosb.json delete mode 100644 images/edk2-artifact/json_old/50-edk2-ovmf-ia32-nosb.json delete mode 100644 images/edk2-artifact/json_old/50-edk2-ovmf-x64-microvm.json delete mode 100644 images/edk2-artifact/json_old/51-edk2-ovmf-2m-raw-x64-nosb.json delete mode 100644 images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json delete mode 100644 images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json diff --git a/images/edk2-artifact/json_old/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json b/images/edk2-artifact/json_old/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json deleted file mode 100644 index 021e26c8a..000000000 --- a/images/edk2-artifact/json_old/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "OVMF with SB+SMM, SB enabled, MS certs enrolled", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/OVMF/OVMF_CODE_4M.secboot.qcow2", - "format": "qcow2" - }, - "nvram-template": { - "filename": "/usr/share/OVMF/OVMF_VARS_4M.secboot.qcow2", - "format": "qcow2" - } - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "enrolled-keys", - "requires-smm", - "secure-boot", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/30-edk2-ovmf-ia32-sb-enrolled.json b/images/edk2-artifact/json_old/30-edk2-ovmf-ia32-sb-enrolled.json deleted file mode 100644 index 33f970d0a..000000000 --- a/images/edk2-artifact/json_old/30-edk2-ovmf-ia32-sb-enrolled.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "OVMF for i386, with SB+SMM, SB enabled, MS certs enrolled", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/edk2/ovmf-ia32/OVMF_CODE.secboot.fd", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/edk2/ovmf-ia32/OVMF_VARS.secboot.fd", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "i386", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "enrolled-keys", - "requires-smm", - "secure-boot", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json b/images/edk2-artifact/json_old/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json deleted file mode 100644 index c9ea22ce9..000000000 --- a/images/edk2-artifact/json_old/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "OVMF with SB+SMM, SB enabled, MS certs enrolled", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/OVMF/OVMF_CODE.secboot.fd", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/OVMF/OVMF_VARS.secboot.fd", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "enrolled-keys", - "requires-smm", - "secure-boot", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/40-edk2-ovmf-4m-qcow2-x64-sb.json b/images/edk2-artifact/json_old/40-edk2-ovmf-4m-qcow2-x64-sb.json deleted file mode 100644 index 78239c837..000000000 --- a/images/edk2-artifact/json_old/40-edk2-ovmf-4m-qcow2-x64-sb.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "description": "OVMF with SB+SMM, empty varstore", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/OVMF/OVMF_CODE_4M.secboot.qcow2", - "format": "qcow2" - }, - "nvram-template": { - "filename": "/usr/share/OVMF/OVMF_VARS_4M.qcow2", - "format": "qcow2" - } - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "requires-smm", - "secure-boot", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/40-edk2-ovmf-ia32-sb.json b/images/edk2-artifact/json_old/40-edk2-ovmf-ia32-sb.json deleted file mode 100644 index 1e80e588a..000000000 --- a/images/edk2-artifact/json_old/40-edk2-ovmf-ia32-sb.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "description": "OVMF for i386, with SB+SMM, empty varstore", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/edk2/ovmf-ia32/OVMF_CODE.secboot.fd", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/edk2/ovmf-ia32/OVMF_VARS.fd", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "i386", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "requires-smm", - "secure-boot", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/41-edk2-ovmf-2m-raw-x64-sb.json b/images/edk2-artifact/json_old/41-edk2-ovmf-2m-raw-x64-sb.json deleted file mode 100644 index 6cfe99ece..000000000 --- a/images/edk2-artifact/json_old/41-edk2-ovmf-2m-raw-x64-sb.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "description": "OVMF with SB+SMM, empty varstore", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/OVMF/OVMF_CODE.secboot.fd", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/OVMF/OVMF_VARS.fd", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "requires-smm", - "secure-boot", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/50-edk2-ovmf-4m-qcow2-x64-nosb.json b/images/edk2-artifact/json_old/50-edk2-ovmf-4m-qcow2-x64-nosb.json deleted file mode 100644 index a0466b41a..000000000 --- a/images/edk2-artifact/json_old/50-edk2-ovmf-4m-qcow2-x64-nosb.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "OVMF without SB+SMM, empty varstore", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/OVMF/OVMF_CODE_4M.qcow2", - "format": "qcow2" - }, - "nvram-template": { - "filename": "/usr/share/OVMF/OVMF_VARS_4M.qcow2", - "format": "qcow2" - } - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-i440fx-*", - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "amd-sev", - "amd-sev-es", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/50-edk2-ovmf-ia32-nosb.json b/images/edk2-artifact/json_old/50-edk2-ovmf-ia32-nosb.json deleted file mode 100644 index 544f824ce..000000000 --- a/images/edk2-artifact/json_old/50-edk2-ovmf-ia32-nosb.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "OVMF for i386, without SB+SMM, empty varstore", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/edk2/ovmf-ia32/OVMF_CODE.fd", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/edk2/ovmf-ia32/OVMF_VARS.fd", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "i386", - "machines": [ - "pc-i440fx-*", - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/50-edk2-ovmf-x64-microvm.json b/images/edk2-artifact/json_old/50-edk2-ovmf-x64-microvm.json deleted file mode 100644 index f5c73a2fc..000000000 --- a/images/edk2-artifact/json_old/50-edk2-ovmf-x64-microvm.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "description": "OVMF for microvm", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "memory", - "filename": "/usr/share/OVMF/MICROVM.fd" - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "microvm" - ] - } - ], - "features": [ - ], - "tags": [ - ] -} diff --git a/images/edk2-artifact/json_old/51-edk2-ovmf-2m-raw-x64-nosb.json b/images/edk2-artifact/json_old/51-edk2-ovmf-2m-raw-x64-nosb.json deleted file mode 100644 index 3fa7f68a6..000000000 --- a/images/edk2-artifact/json_old/51-edk2-ovmf-2m-raw-x64-nosb.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "OVMF without SB+SMM, empty varstore", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode" : "split", - "executable": { - "filename": "/usr/share/OVMF/OVMF_CODE.fd", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/OVMF/OVMF_VARS.fd", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-i440fx-*", - "pc-q35-*" - ] - } - ], - "features": [ - "acpi-s3", - "amd-sev", - "amd-sev-es", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json b/images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json deleted file mode 100644 index 0a2d59681..000000000 --- a/images/edk2-artifact/json_old/60-edk2-ovmf-x64-amdsev.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "description": "OVMF with SEV-ES support", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode": "stateless", - "executable": { - "filename": "/usr/share/OVMF/OVMF.amdsev.fd", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "amd-sev", - "amd-sev-es", - "amd-sev-snp", - "verbose-dynamic" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json b/images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json deleted file mode 100644 index 6b4f4e59e..000000000 --- a/images/edk2-artifact/json_old/60-edk2-ovmf-x64-inteltdx.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "OVMF with TDX support", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "memory", - "filename": "/usr/share/OVMF/OVMF.inteltdx.secboot.fd" - }, - "targets": [ - { - "architecture": "x86_64", - "machines": [ - "pc-q35-*" - ] - } - ], - "features": [ - "enrolled-keys", - "intel-tdx", - "secure-boot", - "verbose-dynamic" - ], - "tags": [ - - ] -} From be1bf2637a7c1a0f96ee032543d8d9d99d27ec70 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 31 Jan 2025 15:08:42 +0300 Subject: [PATCH 072/107] add versions in yaml file Signed-off-by: Nikita Korolev --- candi/version_map.yml | 4 ++++ werf.yaml | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 candi/version_map.yml diff --git a/candi/version_map.yml b/candi/version_map.yml new file mode 100644 index 000000000..ab918d98f --- /dev/null +++ b/candi/version_map.yml @@ -0,0 +1,4 @@ +hypervisor: + qemu: 9.2.0 + libvirt: 10.9.0 + edk2: stable202411 \ No newline at end of file diff --git a/werf.yaml b/werf.yaml index d9bcc91d6..ab336289e 100644 --- a/werf.yaml +++ b/werf.yaml @@ -46,6 +46,10 @@ configVersion: 1 # Edition module settings {{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION") }} +# Versions modules +{{- $versions_ctx := (.Files.Get "candi/version_map.yml" | fromYaml) }} +{{ printf "%s" $versions_ctx }} + # Modules_images {{- define "module_image_template" }} From 1c590a332eecd50bd47ecb51ee093053b3c27ebe Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 31 Jan 2025 16:52:43 +0300 Subject: [PATCH 073/107] qemu,libvirt: set versions from file version_map Signed-off-by: Nikita Korolev --- images/libvirt-artifact/werf.inc.yaml | 12 ++++++------ images/qemu-artifact/werf.inc.yaml | 12 ++++++------ werf.yaml | 10 +++++++++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt-artifact/werf.inc.yaml index 10a195e40..b1b7a328d 100644 --- a/images/libvirt-artifact/werf.inc.yaml +++ b/images/libvirt-artifact/werf.inc.yaml @@ -1,7 +1,7 @@ --- -{{- $versionLibvirt := "10.9.0" }} -{{- $gitRepoUrl := "https://github.com/libvirt/libvirt.git" }} {{- $gitRepoName := "libvirt" }} +{{- $version := get $.Version $gitRepoName }} +{{- $gitRepoUrl := cat $.SOURCE_REPO "/libvirt/libvirt.git" | nospace }} image: {{ $.ImageName }} final: false @@ -119,9 +119,9 @@ shell: export NINJA="/usr/bin/ninja" export PYTHON="/usr/bin/python3" - git clone --depth=1 --branch v{{ $versionLibvirt }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionLibvirt }} + git clone --depth=1 --branch v{{ $version }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $version }} - cd {{ $gitRepoName }}-{{ $versionLibvirt }} + cd {{ $gitRepoName }}-{{ $version }} CFLAGS="-Wframe-larger-than=262144" meson setup build \ -Dinit_script=systemd \ @@ -171,7 +171,7 @@ shell: setup: - | - /install-libvirt.sh --version-num "{{ $versionLibvirt }}" \ - -s /{{ $gitRepoName }}-{{ $versionLibvirt }} \ + /install-libvirt.sh --version-num "{{ $version }}" \ + -s /{{ $gitRepoName }}-{{ $version }} \ -d /BINS \ -b build diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index 4783896f0..59cc31bc4 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -1,7 +1,7 @@ --- -{{- $versionQemu := "9.2.0" }} -{{- $gitRepoUrl := "https://github.com/qemu/qemu.git" }} {{- $gitRepoName := "qemu" }} +{{- $version := get $.Version $gitRepoName }} +{{- $gitRepoUrl := cat $.SOURCE_REPO "/libvirt/libvirt.git" | nospace }} image: {{ $.ImageName }} final: false @@ -113,9 +113,9 @@ shell: export NINJA="/usr/bin/ninja" export PYTHON="/usr/bin/python3" - git clone --depth=1 --branch v{{ $versionQemu }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $versionQemu }} + git clone --depth=1 --branch v{{ $version }} {{ $gitRepoUrl }} {{ $gitRepoName }}-{{ $version }} - cd {{ $gitRepoName }}-{{ $versionQemu }} + cd {{ $gitRepoName }}-{{ $version }} ./configure \ --target-list="x86_64-softmmu" \ @@ -308,7 +308,7 @@ shell: setup: - | - /install-qemu.sh --version-num "{{ $versionQemu }}" \ - -s /{{ $gitRepoName }}-{{ $versionQemu }} \ + /install-qemu.sh --version-num "{{ $version }}" \ + -s /{{ $gitRepoName }}-{{ $version }} \ -d /BINS \ -b build diff --git a/werf.yaml b/werf.yaml index ab336289e..136048fba 100644 --- a/werf.yaml +++ b/werf.yaml @@ -47,8 +47,15 @@ configVersion: 1 {{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION") }} # Versions modules +{{ $_ := set . "version" dict }} {{- $versions_ctx := (.Files.Get "candi/version_map.yml" | fromYaml) }} -{{ printf "%s" $versions_ctx }} +{{- range $k, $v := $versions_ctx.hypervisor }} + {{- $_ := set $.version $k $v}} +{{- end }} + +{{/* +# {{printf "%s%s" $k $v }} +*/}} # Modules_images {{- define "module_image_template" }} @@ -83,6 +90,7 @@ dockerfile: Dockerfile {{- $_ := set $ctx "Images" $Root.Images }} {{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }} {{- $_ := set $ctx "MODULE_EDITION" $Root.MODULE_EDITION }} + {{- $_ := set $ctx "Version" $Root.version }} {{- include "module_image_template" $ctx }} {{- range $ImageYamlMainfest := regexSplit "\n?---[ \t]*\n" (include "module_image_template" $ctx) -1 }} From 3dcf383f6b08f5e781968e14ae3a78b3160b33d8 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 31 Jan 2025 16:57:27 +0300 Subject: [PATCH 074/107] edk2: add params to script, add revocation list files for x86 x64 Signed-off-by: Nikita Korolev --- .../edk2-artifact/DBXUpdate-20230509.x64.bin | Bin 0 -> 21170 bytes .../edk2-artifact/DBXUpdate-20230509.x86.bin | Bin 0 -> 7634 bytes images/edk2-artifact/build.sh | 78 ++++++++++++++---- images/edk2-artifact/werf.inc.yaml | 15 ++-- 4 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 images/edk2-artifact/DBXUpdate-20230509.x64.bin create mode 100644 images/edk2-artifact/DBXUpdate-20230509.x86.bin diff --git a/images/edk2-artifact/DBXUpdate-20230509.x64.bin b/images/edk2-artifact/DBXUpdate-20230509.x64.bin new file mode 100644 index 0000000000000000000000000000000000000000..e2f6b0259ae03528a2c84eacf0977f64bafef036 GIT binary patch literal 21170 zcmd74byOT**QSlT1`QHCI5Y&;;10n81b26L_u%eMaCZsr79>a@xVt-H@_TKbsh;_|5avG{ z2v|sJ`i^GiHl|LtHY^w*w0|Ci$AVWfHnO(0F=BZKBKqeMBrF^`b3+GPM_UsoQW0AR zJ6i{RC-cA0paaqTvmY9Z?0>tTR7OmOR78lB6~w{m#ykyKSoT#8i2*qv0&&CpEW#?<(q4Nw3i z`M(~%zb61X01_SI@8d{N0g#XonciLWRIh1^gM&c`UE-giw{kLH+M~5Z-g5`Pz3*yw z823fr{mxeCC{#5|8EqqFV&6lkNSCfOL^)=ElIyQSkuh;|?;UY}LvukvLJ{N$Z#$Ua z_1h5Vs}6-9rhj@Gz+Bz)#DIcC>1y|4&9LX9>l}6lN9?`&bttw5zRl(-!Y1mIafqn zs?{kcLUVaf_?c|BeyM0U5aP#q`O=^Lw&%TGTK|=qg%YMPwbd`mZk>8n;&OyG4`xX% zVlNTv-orS)(VzDNjuFz1>kPwgs0gxttkB9*X`|r^urh-BJCrRnyAYmW_I29m4 z#Q!{s27?QO{YI_(tAdMo8>r&OBM|LkJ)O1?5+wG|ZcG>f5MLn=i0ePo4EeuHGu(fB z6&P47R904QZVncDb`Xe#ivvXRj|>G2J_y$j+u&JbB3Gbr%=FES=8|fK=Xg_uE=c(w zfCNSsBn^_x70(q75jJyjvg2W9c6D`Svi{GMW-_$3X1235x3zO*HgvFJ{+lR&ll*V) ziU|Faxw`-SU<7e6va&J#-3`)%L-_kfVPWARAz@TNN}x~wxebB}5&b{v8#_2T{(rxM z6A0y>u(2Q^Utyp?5dWHse~0qlT!e(svVbFDAdE*?4(1u*^Sf?r4rIh>V@%bR^GDY8 zT$^Fe!g`BPZz8-P8m!H*jIIiqR7NQ5D|Wo5?s!vEpR}Z%X_1V6>K6}r5;GC=?cZiNVeZ(}Bsq=yn=6m_O{iJE(I~H6<3DcfiTF9m81&J3#c=s0pL??!7i<(kp}y z%E%{vwyxm#RK~KHD3dC*a3`h7h5eS$y0QJ}Xxm5Hn;*ONBNJB;{F&bgR(?ah)@D#= zipVxGr{Za;lyDDH*N)?Wf)ot4pMDW;ntkTr%CvQIxRfDB-PnjDOWC*0mYNE(I0_r6 zK!S0uhe zzo+Q0@3H<*Q~4KPBvmmpcQ7LTr0?M5PAaGGU}@}RXQgjwOsZsS>-3Ki{M)*SzmL+>O;3oDKiWl>Vmf-@N^sw10E; zALj!x{{05A|NnD7X2XB6z5o6doB+cYI^gfYoC^xO!A``78l~fVqKhX&S;(Ef*jF+s zIn8f$_K1ZjV=Q#}a_HXN%4wnKiD7iRVRQ*)`u(ni(5-A~YC<1>5ztl9clp?l8ti2Y_$Oy)-4(fPcH51V`qUo2do>-vK5 z_R{|IcuojKVdz-#i@ML8xhYPZkN>4F)(&c91Yc;-(biiy9=)244~+$3)5dR+2=*$x3VQ-V<+*B^Q3tR?ZC|38I=GwmcKg=1 zC#ZwY5{1ubBV)ydc>M`Y7av44jK@$rULfKXuAOw^A9~pX3PyQ^v`m|4Z7OkZsZIWFBhDDiLLN%8J~*vi7_KI$vC`v>(2g zEa2kha^Ia*uWPZQh#XsHv}aM~$Xig2y>3^*xuHf6nq0Xm&YgHZLx=?Ek%#_-2EuOjz~KnwhHe= zBuoG#1h@DB6^cRt{EGQ(0Qc9R$ZqLh`S&QXD-C`b2eM&k{oj9m?vga*hFxs^fb=6a zop?FI1ll#gl6c%G?wSBq1<3~nf~}izq`Kr=oK26d=e9)zi1QI<-(^fxRx;d`p#GAV zR$<#=1WsC()359cC^1>nrA)X5F+t`9sn&6wHF_E=)-BoXN-}PWPb@8P`J;(|V2D^B z%j6c}TLT}cx24e!icV$mSKkqL4SFb>&gv{r>I~j=P7~8&li2F8S#_MijaKk6ZA_S%E`E$r+hz0)N24? z+aUXU-2NWfPw^isN`)Rc5=3Y!#Qtr{h5-Hj)tUb2ssYU^*QrNyy%*yqMNI?FEIk4a{^JzXF-GPR3c^g`cZALQ~p3;&x z$-BaaaMA-7&}`oSC{?1fipM0(pYtpcWY`G%QUun8HYN1iCTA#Xg;N;D96+$xxxBE#rs}tk- zi86`_kXL_7BsfdT*AS_H(xt-4T@&1vRUgqoYJmx*bv7$cu?OxaPty5Au=dRTvOnHX3v#&)cMJni6-QUf1PUL?cfiA{-~ z*BRgAM%y1uV`r_)UF;xfQ6L}tw1;Ls|KVel03M1N>vG);;yN`I^;#3Z)J&2?@wF_F z$FQw9oH~Ay2k|;x`{nwjZvOD2Pq2+1a+)N&!VNLY1oC+DJjj|NgT?UevmX^;+1~L_ zaT}OUCf+xqF;SHMibnzR^l4M?g_+|2aOif)^r2ECSY>a>c-X#*J~3OyLYk*>19>L9 zIMa~gJ4Z#5Z}=qT=)`u7YJ;pyr4)4~v#s=s)!sl}a55ujP2fCBMXBaNXWPHG`P|xx z$I;zhHQEl#Vp6~n$V-eP=u>aPrH8EZSe`M=VcZXVv9?_1AT#SDWZ0tnvIgYsFJo$&zx$yra(SoUQ**CsqrSNx-1ddLf^Dv-XqK=Mm)g?&w*?}L#!3ZM@8p{PwgQQ z!IwK4kI|eep3L%HezM*Vd#apA>++K%0`gTyRV<3sZyZmO%9u5$Bv-W<$2So{IU*NqZn_o?7;Dxp2f0$pXng6EDn;x?<>nT;Hf-^i*8>}Im1!BU?)nkIIo zXt+5Ggx?=^&RaZCy`?tqc>ec%a z7Bont@1N~&$-Jke+L(d*G9hL~bH*LN|CWPM&#%HT3S&R2CRv~DFiQmD^!9TQfqeMY z^zC+VAKL_M7Gl!Y#7j4imK%1$`g#O0@dN4XDcjAq!I2~EM z26~NVug2~hFh5zY&W5$-*W_vnRt8CTga!C?K-{CW4sE1Nbf}Y0uvh{0jjy_M34@?! z4O$(TQtxzh(%xC&+axG>(lc4^t`0*S19?r#=s14+V1E9hs^3xRG6NoQ_V3lW@Sb$X z7(?c>&X=`N&1VdX2 z3g~Yow*0TjIYD7K-D)y#dKW_fj0ggGlyx$QTQ8q`UHKD^7^p70crGM9iqW_i-?t*D zi8Uy1fqW874w?|>P;AYNi+$3Lt)rj!8=jT>+r2JExin&sZa9#K+9k6XJu`y*NK&MF z{C(+TZPDfD^pp4`eaM53(ktM5Je;EXHg}MgDjpX;|1MY)%B+m^$S` zTMdxUf~b<6^AH*eT#>vI?sn}`e?LW%fSQ!j99vA0!f8TC1Iu#dj92&g5 z!P}-q#@5Q#;z%kW6h3RbDFo_Yx>hS>ti(m^=M-r5)XTG_%EDBo7_&0))kvwyaeM-s zPf>eiosS64KDS=*w65xH9_RHdLa=Sdw%1$TBB^9hfX&x|>i(BSYK(Rojl+hY@KtHz z55x>?F?B~q;VbSs_tn7SXUH~DJkHaKx)#aBCVP*7k_|4R}hJFd zWVTBxG^UJJK90CRUSN`Xto~S(YkY^ImAe02cSTEshtp&^RaQsDL-01w63CmKin9)V zCo&lp2>+dMc={$0C%sFop?8SUdq^rhKUW0EZ_2QIQN^{FYkHb_UkBewI{TF4v5cDd9y|+}d+dFP3qv8VcE8~0{-Dul2 zwJ@Qx4!MsKH@&uM1sdNysr}wz%U87Z19>R5S9^3i-0kpsr-W`7m~RuM`m~EBFJ?1M z)rQ(N`lRL!+v@9LMySRL_=(kei-}W7p`U*9Yk%4>~BYXO{qPy@JvsPKm zR>?1xM7tseH752KBw>}l;E7e=&LY9n@^O8GF2A6kB&nlqRp!x^}IC( z*!i7x=>Bp2GIGO|O+xYf`P4y38t>}UkICX*3-;nZG7l`EzLq-dTZ`ZW&Tuh1yt#)X zGn!T}p|OnO*%gv;OkE`pu=x)9R+=_3BJBI?GPDjd;x|r|DU_v2%c*E16f$_0nDS7d zKJ20ojy;=-zO5$OLQr~Rk3C(B0u)=K+c6#2gIzZ^nBT%3X;#kIC{!6g6jG?Ko_XQ# zFm&s-`wp49>}C8=3QNuoIzS#paUs^W zKLJz9MY|*()0Qk6w_U{zDP8@JI7{M#I=};)FQ#V{+Lz zK8AS$9g~z|I*`Y91vM~Z{*e+qfNG+8mohV*!zvN79 z6pBuwzxoD;WH*q1K<$=ckwvG~w*Hn4sy6~^fMyu?E1n6p z{Hp|zryVa;kuLzvpGfqWE`P)%U?{A0^@SDvagO0($iiMA7u039CUUrEBx8L^ITA>zf5q>a~MZ*}=eg zIGARMNo&`k<7wWol-eR8O|3%dhb!+Ujhr#nwDmcE0^>bcb^^m#DjDF#CBiJM)-LgO zYun@((Vvl z*&pT<@@1p}s}DaS4O(k7*Cdv1Aww2-Lh`&4gVfLi_cWM=iNEV!x5WVUg@OY}tjje^ z*gW0x>2=eQob5)n628evM7Z+@w)LmNg7MR*wXWT)@_4_E)vkheSXWVQ2q4o%Eg{e9 z6+5W1T!Fk;sHNPZ{+uRHq942yl!tc17s0K9bv$4Oz#YWE&3q z@ECtM&AmO(%NHc+7sJXJ>;UVxXunGzYnS$hk}*?SgVM0uoSe74B|nAC{Bh#DC^TLP zw*J+h>@RTb(tzszQ?+Hs)|K+J!v+p#lZR-nZFlSDi4UwkG$cV#Yrq%dV2B+|MV7(n zZ=%`c|4!L-VD%~BCY-Ql+^|thd8$i*wdJSU)Ba`UFa3`qCkB?iB{)?efHsE-SfJ%`1`q)GqZawD&2i!)jgkFlMBg-a5A}BjGMvs}{RFqbz`~&q?V&SWil+QS0`Y4&<=%=b z_MfS%T+OVbD8SY)ZVe}+<-<#e0;HRGehgI&=h+km+_KW+Hlh1h%1JEfz<7M6#_JJT zd5Jt~i4sOsTZTl>^P9C;NThV|WA*GlK~MwvfQmNBpA=S8cgE?@*cx)DvGnr@Ocw=6 z$QhqPXr|b}##gwU8#hM`YwCF1mwhLuE6_r|N!qoB#Mes(dds?CNU(nOS7@mP1T})4 zGO`{lLrDr&c-E9fv&&fZIAhwg0n#(DdN?X!9>x5vhB3Cw&WgCq23_!@l3&veCh z^T-d$DX{t~*6`+OV8^3r)haOzTaR?Zq1NSRx!T-t4!Ry1-XF$I;QNg;wkSN4;^m^u zZGO)xxxG2BRx~Ub6^7EJ3F(N)`lJlTrx0PMbVX|p260#PM;RWqJeI$>$c^nY^Om}f z4o_JC`9wRn2QU5PJ} zTR{DkA_7EFQ3KSguZx3<3>C5I&MzV!8{0Fqw0pW~L%MtXRp?ih%woCZO@P^fNU`0lR?%kXgn*Z9Vy*)i zuaZ}qrMh1mUQReFBolX=i}#kq>SKwet-zJp?+^$UAfHjK;Id$OGhdR@)u}6-ktYYU z9x2&(8s(CJ6cF>u1-2f~q{*l~%JCAUmA!TKAWKQP}PEUID5 z{&B7*>anAvJ@;?8eYwrA!_tCEDV-bu#{XSJ`)-1!jLs{n;o09&Leq7p{3`y=(#z#h z(EMvN0a!fW?@V}i4&}NQ&1@*`-a*^SLO=OVm=+J1oFq;n_KSk~Rj+u8Mo*#-_H~o4 zL+MR@b)>D0gQrcu(4DIeoJ;*mYsmTjXH<%rQ0y%<3alr~aa_dYiUFp=4Zy{h3FK_!F3y91@l0Xmi}Xw|@qIn=vBQ84 zog8}#gr#bK_|c5wUU{`IL<8g((=n&5B%|h@I#h^d;2-ZzQB4pNC1ZAENV+cVTe>JkK$nciZ!URhQQF$jk!T38idTI@{Q!->-yxO?e@N;RV;JYTcG}0 zTt#rH!UW2bziOw~_s0tCmVr~pls^o^8bM;&OnG4S%(`N8*m2uQ5lDOp&Egg|CW)K@ zMqjO^zo)f#YEV~v2dKYg{cN8_hTXfBei#;%O(Ry$YHRDeCy%C_;iIxh!U5)=Td8r^ zksSjGEhiz90h1=SJ=mH#V=wgZZ9hsfu7|q1fcm?^wphOIX^bNZ`PZx|$E-6;-)ud1 z^|1%@1fF>(Zia#U;p^AnUW7I|O-n!Vn|TC0i3RtzU#@1mQa>bKGe}Ip*5jvvMJ7`E zh~E?}2DdTRAlhm3W7nZ@aI1JDC}^U6n84l!k~D*A-gjwnEL+IU zFYqe1RY(q|z<4eiZWVb^Riw?Luqu1w&PoPygi(rC>I9I#z&-k)BJczG%RFoLMiq0R z&~K<8N6lz8uCKHh)(=}=jP5GvT5o!#f&3N8oc_Q;62?ct5ijEW#nQ1&I}LBvwzZgf zOIIn~s6-%t9c{g6ADzUjm#@I^y%;HpY_-aCnMzpGn`e?w(R&H3|33_?$ET3Xc zfde!#kmoG){r2TczZi!?1UYym}mxALYt->}<=OTNJ<*Gq$qFHGUwaj#gIwOd&YNl7^i zpFTx-JX@{e&eMh5ghb?oabP?&VQv>pk(pLww~#~py7H-773f#bHNEnp*m3j%tt2== zo~dxmg5+K8?8-i)%FCwp2_A`7w+nKL4xXjl}zDj%UjFvmb z|FN-@oK;DAiTaaz*E>gf60#pHV@ zqaR`n6#DBr8xvstpZU|M=724$>L}y$Yqzis+^S0AONv=GTM46xjr{z=~O1!m*<}@H5=Rokyz@)LA*$?poKNzFHMy2|vO|oO?p*J$7 zoEs@vzkMa*)we8*0HR=v>8vX}1Eeulk5w2M@R%8uK=L!DDGR8drg0(}zhX#cr1m+wx)Iz^=#neGF>}FU^=xcExzvX-NjP^>})zht4*!4L~ z=iQ5H$-yL_uB5rBY{hFOGLV=3wH1$~$dCz37b)Eqo1C111ewx=4gF5msAw^D3=zx^ zHN!8;DA{xQ@t5kLr+piq3h!^=tu7u~=9gODlasT9U9X4ml}&o1hE@9pQGm=ufRSRW zrz&&1aTQfPKji}jNB$x(o^`!nh@T18QKxEMvTUM*%*^r*(p74ui+-5p(0rU6Tm$lw z*XnW`1INZFRJ(%|hFTktodNp3{Sb3F=t!p&stuz+zS_O^qmdqAcdEC9MD@EkY4WeI z^W>AipqmSC?Xdssfz7`In%nus6>8F1;ujkOvK6#5SreYIAGxya)!JG6HHc(^`Ui`S zW0R{KZ0m*fMly;U!@0SV)U@$KT#5o6$rAz}^nkp{4?h8_PfL5T0qGl!_c#*c8Be)nn!lYk9CrTGLz?*$$j4R<^rwAxDv|1$<`Ol$s-gc1-(@ux|^3k)~Je-3q9cF9U{2gA<+ox}kWs9p|^(S7~qIB`Q zRa>UysS$`uqH-e5ePhl`hd2AZar2d1wFkg>EYJePRhlK@lwiN!aTU1j(n@kUH7(Ek zpnm;8UH4pJ1mxdU%`-@M)G3LJY&Zy7RF1QJlfIsz(dNYpL+O_#UjX;o({RdzVU8PTkoid}3S?{?$*C6QDj7(t2A6s ztxCupNvbB0=g!G0p866Rn9SLzYtYUxSSnal?Ymd$(ol_FPdWnLuiyps?UquEHBT8g zazp99sU5~x5cRv%>KaS;d@&S+1B*xS;C}kuO2IRJ8U{?zs%-Dz`||oo$J8&PgkC(T z+@mVMc*GLb`lAWOP-Do0W1hH~N8Q?O+e@*JrlFtESKsxZ+q7%^CA5L9 zPpgPWBg(yGev=K9y)B@)N$JG@B&zLVu2mO@GTwM$2zLFhYqSts>=Id}s`%3nelPB3 zuSGf!>;SoeFGZpK-FLzT!1()Uec1a-&-%L+?JUY&XVTyAGNyB_Qdz$qx#pe@n}GG- zhMlV-q8ddB)a)HX(&Y#Dh%5F=oUiGa+Y1|+Y1z_Nf%?nuwDgtoqXe32s}C!soUV+e z2cN#XWQ8KNJDu#Zwt}s{mK!L?B4%}VgT)cwi}jmj=~0*Zo?H!72hk@vTu_^X^|v<& zm!B#mIO4uaxu(vaK*lJgyf3Z|msvNCB20R#97zt0XO|O#>ODDOACrWWYAth!0%@I> zsA)Qr+s=S>-s@zf5RkuKJe=>Nf`;XqMr-FjKU-l|s0QncOxXPKG8WRyi2NZiL+JK*R6nR3$ zlmX%s6#ln9@m4?{%c!|kx~^2feJ17Tb`lA6m*%5EyNz&$%B!t1DDN2y-zNkzz(iHVagXJfeUh~kat;~eFaS$(4NZoPKt3r)^S`HcQ z+>kS`pDi0uU*fLlD&S2>>7eVa)gQW`pQDLmwmnDt8>u#NCqKV_{{ZBb3P$BxDY}g! zx@GpQ))_l2c*=%ZC`@YMNVSh`81k2ZyqY<4ZwsnlI`1}OgQ)ZG69=jx+uyq9+42js zprX(ZML^z-LtJz1anJ0mYNf5D(ap13vCf?i3e9gzsNkORH2`e>^?*ujgU_$pGKzRc zt!8>rve0y4%N~Kdf7{L5i$~?c1=J6wQiBLbWEp5Ca9lgjE_$Q20Ci}5t@%-ku1)n#c*%pQLqxYQ*fby$Ho8%1!WHlXtIwks%b?$8?fn!QZwDdf z*S@MLy)|KsqN_OrHSF{_|5WBhU%ln5T zZy=xkKqa&*P|=|l)GoSg^3VkT9#28O$8B(u_3&2Wv?CwL7uNsTqMXrEe$r|P0j>D` z_SySNQ1LbDw3M3LJY|b_63CYZ?g^-Mo@0;XC$P|>?R#JOrVJBz^z&II2yT*QB7@EE z4Wys4P|fQS4Fwmf7&z)0rRKg^ga}-iiR58gV7~GF4Ah_eD!LK;SO%SxdC5wv=caPz z!(#KpmEUCHyAF~h95I-m>?0I#o|t2veI}wFZ5!>9FP`5-Z$?+aswJzSBIxKr0qP$N z5qkYBTthC5VknHZ5|1`^P`eW}f%M+i!9R7fSpbXw1!TY;jYizxR}AfUMz}UNKqBhc zqKC-2M7Acu+?8Pr)HgQxg3V8kmKU`AbK;3GJCk?GSUB-8zcqxWgIb^izY)m$!B9*# zZ#yTG6*D+wln;~qy}>By&Pa`1dLB}R-t+w&kcXzZ`~9X->FitSdY~iphZbEy`M}wP z&}U_Q!v^v@EwKI)^qLq1HJ=E6eDZmgqm=7#KrX^FtgT2NV(Sb$35z?}dIwHBvGovw z+k@_Rv&6=FO0?W=7oIY=YfNj63;HoXuRbsy#5?n3mY%4ZKDM|c89w8dOLvN|x&vF~ z$VJqg%boAR`r$}?qz-2aon0_G_%8dZ?GZnJBOu;dOpB6pfBV}_kBtWEBN@QMS6uSQ zTdlBrV5e~pv&`7xd z4E<3J$g?QdZ^5dmaL0+mF1bwERDSt{rt+hye4^}ma=JreT>;2*G*2{rmQ^293D>k{ zaJ-MAMd;`>=Y65#7VBi$I`!`W^4#SowCv&U&XPBqKeP`f5m#3d$Xb3vWz3-IQ)mBT z0akBFOF9<3Eht!JKV((2Uwdw6ImT8+l84GX|I<2QX8AQ9sQ)PxQ%EeG?6Hl%{g%I| zY&b-)V6ilu1fOYviN~o)0n9&DhL(Cm9P&UmA}7A5vyrsA(Z|&BiVw+;w1Q^OR!?t$ z`Z{$(W+HXU6&=UzK`t&SZ(<-&@Y%n*4YXab7o}N2gY^@P16IZ&K{|hs+pAZGW|E3a zx`@xYeF!3kI1Uga=#0Sf#}qVzxx0jcD2z(V+;o-rIRdUM<={#XG;}~$X8(cF3>c5C z@`UC!TWy9s_UIcg4O1oftkj(G)OK&LE1b`7kJ-Td*}e(#lvDhdy{m(Di-M+*R|=Ur zKVw*Bu;-Ook;0wjBT(OUVrs-lA;$0Zqt_~nMKAmB>B`c+rlPVW(Pc)X<{Ys4+zWBB z71^P=cl@FdYm2>iI$ztlJy__W1Gk}n)AE;@Dp21ySpqcG+%lOTw7HK##{5uoicjuq zBy8Jb*uQ{g(O<#Y9Aawb@46L`Nsx0`-qMTQJ{V(o(0aH zNhh3A^b&!-BoQy)s_|(OrV8}K>)>p@wa5=3|Fz+zD(w0?zQQWh-UN!n`l2F;Tqd}j zkz4AfYA^Hb2*}441}a$!a}8(?tj>fl^vt?oWMt_IBq(M7a_*l~R08Yo#eG7Yp2{+7 z-2oY`2Fx`htIwQc=W@Z0e>9?=rC54q2kPfyczl*mNX=A(QJ9V>(L8#ijzQ43bi09k z!9Zl}*g+5E3qUWsT5uk^$j-y4NFaFAKFA~I^{EW`&5!5v$ovD)K)zP0E;|5oQ8}Bw+P?kBZj=lo}L#skw}0 zG`rw7_S1RBj7*S>W*?#pHK4Xya*DfpUZG|0rh{SiBQ`+B_pGH3!)n9 zyIeU4%$)PYDn=ghS&`C*jbj7(!%T;s$q*eq(ehU{+l4oCYl4c{ETPJ0Q)ef3r|M=w zK>lKMwgN&^ZGMxf$TR!w&*C^U}zFT=;sg&60K5u!Y(H0e&yrPYbAz zg5nnF`_1$SM$vg;yl4y-97|X`f4fQ}CYdJqi;^jME1m&NtqcFp-8;cKKbMc=(cUPjtjVe-r`4w@I zAP<9=&gi$a_9Mc_aoDD&K**`xuG@|ewJ~`>{sZNwaP-WW zSDzj&<#@tN2kP?dTuU?}e{27oXtJqBT_DfvlDuZ%u?lL(=^U68ulmjt z+A8+P8@~}CuL4JMgBnL`%PhKB&sBBu^gU!vYFT@~P%*Bol;x%a?D~$nS?VClt8#|R z41X6x{5FQJg|pO#pz=(DU8Fl-DJmmS|BFOTEiv=b#NU4tGQHa+{bxy!AWz#uJLn1H zDn)f>mIBD@n08Sj6T{x#;>U)W6($ZKfy${g;q-IzgD{WYqnk1eM73ldS8*7%UeIw238L^T0CiAW{(U9vwqJsK)XkT?4sCXW@HO%R;#}7ag+vI zA34=$l3EYv5ltumOpBsTZmN{1QCt@oThQHMZnk{cE+@ zhW%v%-T+F6Qe*V<;wseC4{wt90x5FiX+ig&y;xS<7h?jDon8xQ?kBXKX zwsqlT-IW2Gf5#n@r~BY4pSQE^7JgkZBJ#vAA8l5^y0isz+HDXDfaTjH!Nc>U#dIdb zB84SI4c|SV2A_UVZh*;7%z>6wnH&}{o;kd37$q&wMrVpZ1GmWy(ianK_rNyChziJe zl;53q!R{yAoC+g4w@(rigN5;S@<&@p-$Z>u$4RJeKM$}g4Cw~z&+ILAb__;po@k)Z zHZzXWC%a}un$^-ttp0Fnxu|E3`3{WdA|=m0H@)d&Sw#P<_u6ovYe~*>{hxL0@>WFe zcr{J1>o2bhX3^gCU-?)*HsI{hwC|blsciDjguOCc>$|Zd#Bc-k#n4`dsYjK+xc}^b z6(A7Qmo0r`$r=BUG8-B<>X^m~)_*8JRicT1#Hb@jXqZ-k4AS=;3DwGm-eKoexOP$V zj*A59U#cLuioY~2EgkNzi3J5a(;uNv(Q0wbI4Tl~-AO`)0{Jv6V$~$=CyvyRj1@XN zG|O=pN;7*)tS`T4DmTq$5YQ!^!( zyd8VO3eq;zt5;?ho(Q&&K>ob`$J~IJo8RVAvqN-~%uHD0T)xe4 z;8k}bal~a-BG~=O`~D#&&Fk1r+W|2fK|{K7;xB{nb~6ql3k59s5F!fvyXCXDzlUUHu$B zn=2&2m>=}hK>g@dS5_Lia_NE~J*!;L&1{F46GX9;_XNyFj#APQqhR?z<(ut|h(VE; z*LO2^_q*b*HU_%zhr9kA4&0xtYp&>1pguhrR8H;(C2Qh|?9j@vgono5@X$VL!iW%i tGvig|C3PT=m3QTN@}z>-)XceA;BOW4Gju^N&>Xw2?quY}ssK&>e*iiP*IteM&S{k_lLv*&q!d(Q+e77hhD6~>>B10wV%%pH=9 zk7X(|Hk&u23Wfc|^ehX2V4?|32t*cbpI4nB9da`+)J1Q(JW zOt1k2Lr;KUti^0BOb8|>g%CO%-=@W(s46Xl{EtES&LjN&76>6aLQtRpA%KsAr3=NO zz|_?ipa96v8+a51cTC-FY@Mu;&Q1bk0LghLE(NZZrG=xjlZC()fd0IPfPzZR*4)k6 z-PsDsgm89qadtCB+M@5^1~|{JV^J{w)9XyCimFTqIVM3sKmfQxLo6r+2nvV_0)l|B zumQR$3#ook>?w=_Zq^C5lP$fw_&TleOh} z0|K^ z@ts?50O?YLaGtx|t6|nyr<+!;%`i>wG_4NS9@mZRAY+#FzWpP=sH1((9TrBGP`C!iH-NOF@jwcID>I2yrRO;t|^L*fj+$1$(>VAzuwk*zK1tKj16&NLOC& zZHA6}vCjxcw}afi{d{vTPbEY@9?z3iT{M050ipB{r3j-ZnypjYjrhm-wtAz7e25~C zlBnG~71~Ky;(mRBR`az6C2v;bWT;LIS~F>z*-cVg_iXI6$mKa4CRm${D|H!)@#?(c z%7zTS2*;MycM{UJ69q+xcFtH#QklbL16?#R?07~@gGO$63&y$n~2Lgozi>X5Z zhVxz$C^eMw(w(M9>Yhq#@G{@!n_M5})4csQZBSIlu_L z1*ibZ*-F_8;qo>}q>CgR?&amh@Azj*^P4+6!d>ibon74F=57vfbfTb>9G$xex%14u zfBwP;i1G;v^P?{VCOCNLFN%$g3xPm&04+e{&o+P=uJCW;Te>0L|L+ly0MYrhDIkzD zC?_tk<3@B7SrglACD;#FG7 zk12#1@lKNJLY@@C9N#qyzy#4G3@z@nDoM9u{`WHdOeG3ve$>~M&wVOp@=`chXq0{s)Ay(jn&sr=?e zCLJ4FHwz{WQ#T}vNzK&F-V*8JU}|p3q~+|4JQpEahoXYQXblPoN}P*O^lwd(^X7kp ztN)z>TbHY%8cXl6m$QFZ{r2mQw*saSF7brQB9eQloOIoBZ9Sm&tAV+oFFB1m$ydSx zajL}F_Wjw=*J_)GCQ2B)*zeMO?btA!HY6%*-wl4%-BZF|eF8&CikUnF>hue56ozlghZ z`G}HPNVk;g<>JmdcDtLi_9|iPK!hT&9dmu*es6|n-y=Z43_#GYkZV9NMDj(kF$U zhY1Hr|MCDffQ8n<{}P^}l@?;oU!S~j^mZnTE}oR+RlApf;rShmP+dS9(9BlPRts1C zyO7Z0x+uIqZ0F+UY~f-4mz2<{i_Tkg(xP+q+e6fPj zi#ZY+u}_(F8MB*P`WJTsJ<(Y9(9W`!)yvJCDi7~Cj3T}~PlHudO|6)nrVp9L!JNe| zrgg*NOW1?=b^Q_g7DS_WI%#w7V~`v4MXZ zk!HndVa;R-(nVvv@ypoB-*NNhE3>^$@Mw2k^?I|yS@ItCOr*9^YdID4Mmf}PAGWQ)4ysbv zoW--g#{Y~$J^f%yQj<&1gq?EKP5BCAtaY!6lFY+iI2%@#YO-fo-gf7<=tsfO#!P`= zNGrO`n$Ra>An56TfgS(lf&2F(`)}uO^Z^nY48btpsLtbhv*ZMM-q5o|66fb#EPLam z0F_&`r{~i|c(+De!u)f?bx6LEa62 zalNAs>qu|^PYI&~ACr{VWYu`g`<%w8^OVZ_j)8mS8BE8M|a468}8|_pIKF^ zF1|9Q_AtMSo5ypVWu8a%j{A|TUA&{W!Z>8hNQWD~-=cQm-GjjV+;hea4Z0CsSxMKA z$LJn+xh~mgly`)47xI>(;H$dSBu>3fN~ zcefILZEI|3w9eyc;q3Tz*v1?whPdtTUcYl|eBWt(v+IaVu(s!F-kal_gPg z#!?&X7%6-)EV|}eq8=I?ZVCEso3hCTVqGv_>x~zQ{S52=&L>sJDk<_>Pb-_xKXh4r zF{3%f#QWe-_2S(Ltb7lMw!RvA1B^?Z-ljC6ibf7|Th(A@; zQQ3&s)!HrUh1T8BQp5Z!9@JMEanmS8!MqgaL+xus9|qUyUb6IT7s?flyHTNrT2ll0 zhCbwrzAXgviD{eP_kU{63tj)PyAY?`AK|8DcXFupp%XvGWC$VA1NHGS?FLm3j$SIknZOhuW968xF0RJo(3+a)97I*e;R41fpMDw$J!)L9g)p@uDsMH`NnAfYEaJ#z(TUVe>^KV49pT_e(UTIWeDljE7PH(D) z^nrN>L#qBUamAVyn?}igt+sZPBEJ0Tt=)bL#cb6G1JX-iUOX~h( zi|JOb+0A3*+*4b$$Y$jT0`u2|WS0GyFWsmp#=w^@RzASVaE&_QT8a0Txo@)Uai<#0 z>-|C%RXD8-&UTBz-`YjLxm!}NVMI`AY-i3bb3bCL63o{Oe{C%U&WHFxwOJS93zO5GD{-z2giTf z8y$bz#s)WAzKr<%X}p9R&L)`~q*cjcr;)%!@-Ys~zmH(iZM2~nh*&2KsiqK(CnHtH z3M#?TrkA;kKfqYc4(4N9bci;l@A8}4eHV8uTs^eW-6BBovmaBY3$AF6IfQ|E;;@M# zWf*K3!8FIC@c^ZklgwH2M#{D`E`tkJ`=r|q%)`@St2^gn{mG+F)6rEh9^2tSlB0LV z$Q{ZfNmBUzg0JLyXOERU@w-K%H|i8y5_TJ4X7JhusQZBCw?d~SJuPtj+Y1KFKH@K% z#k^+lOm^6ewd(c;GH|usztWA(cN+6fg85A1IOL9!5@TBbw~qn5e&Y?_u2pll^Bx6Y zHO#hZT5^Ktb;ywMTm8Ow?eW2L2-S&E|_2BV_93CBVk4VDB*fM{6S&tg$rS!4||4 zm}lpDMft{h!suva&6#eBE=!{zre2!W%(YXSm{=s$`xcnz@%C0L`(S)?P`bhO@=~2* z@bxP+p0&+UY$_^@(Tpo!sJj*);Rsh8eza%2s=@GCcH%<4 ztCSFA;$BL*x1*3Vr2>Dr}q}vDQT0`ec{mw2Sc|+a0u0tf*!SAmLwJv4oDP(*gw6*NNCbvIk8Ta+|`l%T>{^3H$FES5Ss5p{lmq@eQ0t6FaKI#Sj zFC}{XG-+6%BPZRJOCDZVCJ0Gn{hrJ=!=!11*TDSCT!2IuIHLkF!UO?Xq!(sp*lX@lSVbA zI3xuyKy#ytzu*X5>4MdM~xz zv3yBFQg0|xDy~FU%7HvmrqFK>0=;m4IB9TD+?7*c*5eD}ulBv4Juo;zaLT*gH)V{E zttL439D(3|ttJr*}8?}7OiYRY-s*QpFLjz{ts zDVHtzSm|OCoUX#c25omtjX83_{8+MPkt8&JSPF&Oe?u#JRI*i<`tCUi_KCC3eAu(L zNHBkm&V;$L9mgr@aNBOIB2(n``^<&pU~evxU+Ld+e2vV(yv7e<%xY7Pai1g?>lK@f z{fbI^HgTb|xuyPYoBOZ$F6{3w7Cc+)_{X;%0lPQ$<|Ka_`b!!-;a3e|Yk>HDszObL}iE&h^q~i5=Y{XOrKUZdD`pM>FT6MS89YK!gR(g2h|AifO zY3?bJj?H$SY{h;`9$Y4u`BB7XQ2JpiIniN3x&wGVEZI9>pj+0lW^@X1*9SB+rbJPv zI$iU#k$$JVfx}Z5e122ONM#IS!RymwyhnhCo7;zodc$)x%4dW1NVcaT92*=zSM4P8{4I0Jh$c9HsF%#Ea*kA6vD%PIF z>>c`wTPn54x~AcWCGn2CSgNa98!y@)McNCFFMxlu=7hbBgr94!3$uha47r^=q%SJw z5PfZTnz3r94a~Rn#_Q_Q(9ros?fY$Nr7K9vJ^wj8g2ng#E#<^$i%l$;ze$wfCf{qu d(Tzy+Pb(aAEmflq-~7TTME}mgcBKL7^grXTLp1;Z literal 0 HcmV?d00001 diff --git a/images/edk2-artifact/build.sh b/images/edk2-artifact/build.sh index d0282b7a1..a1fd556af 100755 --- a/images/edk2-artifact/build.sh +++ b/images/edk2-artifact/build.sh @@ -14,29 +14,74 @@ # See the License for the specific language governing permissions and # limitations under the License. -# set -e +# UEFI Revocation List File can be downloaded from https://uefi.org + +set -e +usage() { + cat <&1 > /dev/null + /build.sh --repo-name {{ $gitRepoName }} --branch {{ $version }} 2>&1 > /dev/null - ls -lah /FIRMWARE From 4d9bb7ec1f79d9e400b1254bef8fb9393baf4b78 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 31 Jan 2025 17:00:50 +0300 Subject: [PATCH 075/107] qemu,libvirt: add version-num as requare param Signed-off-by: Nikita Korolev --- candi/version_map.yml | 2 +- images/edk2-artifact/build.sh | 1 - images/edk2-artifact/werf.inc.yaml | 9 +++++++-- images/libvirt-artifact/install-libvirt.sh | 10 ++++++---- images/qemu-artifact/install-qemu.sh | 10 ++++++---- images/qemu-artifact/werf.inc.yaml | 2 +- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/candi/version_map.yml b/candi/version_map.yml index ab918d98f..0881c84b8 100644 --- a/candi/version_map.yml +++ b/candi/version_map.yml @@ -1,4 +1,4 @@ hypervisor: qemu: 9.2.0 libvirt: 10.9.0 - edk2: stable202411 \ No newline at end of file + edk2: stable202411 diff --git a/images/edk2-artifact/build.sh b/images/edk2-artifact/build.sh index a1fd556af..0cade0d21 100755 --- a/images/edk2-artifact/build.sh +++ b/images/edk2-artifact/build.sh @@ -16,7 +16,6 @@ # UEFI Revocation List File can be downloaded from https://uefi.org -set -e usage() { cat < 10010, 10.0.5 -> 10005 lib_version=$(convert_version $VERSION_NUM) diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 378a9d5e5..58a9d4473 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -81,14 +81,16 @@ parse_args() { else SRC_BUILD="$SRC_BASE" fi - - if [ -z $VERSION_NUM ]; then - VERSION_NUM="9.2.0" - fi } parse_args $@ +if [ -z $VERSION_NUM ]; then + echo "Error: Option '--version-num' is missed but required" + usage + exit 1 +fi + FILE_LIST=$(cat < Date: Fri, 31 Jan 2025 18:23:18 +0300 Subject: [PATCH 076/107] edk2: change build script Signed-off-by: Nikita Korolev edk2 change build script Signed-off-by: Nikita Korolev --- images/edk2-artifact/build.sh | 121 ++++++++++++++--------------- images/edk2-artifact/werf.inc.yaml | 6 +- 2 files changed, 60 insertions(+), 67 deletions(-) diff --git a/images/edk2-artifact/build.sh b/images/edk2-artifact/build.sh index 0cade0d21..2c4f24f98 100755 --- a/images/edk2-artifact/build.sh +++ b/images/edk2-artifact/build.sh @@ -78,8 +78,12 @@ EDK2_DIR="/${gitRepoName}-${edk2Branch}" FIRMWARE="/FIRMWARE" cp -f Logo.bmp $EDK2_DIR/MdeModulePkg/Logo/ +echo "=== cd $EDK2_DIR ===" cd $EDK2_DIR +echo "= pwd =" +pwd + mkdir -p ${FIRMWARE} echo_dbg() { @@ -109,10 +113,16 @@ OVMF_SB_FLAGS="${OVMF_SB_FLAGS} -D SECURE_BOOT_ENABLE=TRUE" OVMF_SB_FLAGS="${OVMF_SB_FLAGS} -D SMM_REQUIRE=TRUE" OVMF_SB_FLAGS="${OVMF_SB_FLAGS} -D EXCLUDE_SHELL_FROM_FD=TRUE -D BUILD_SHELL=FALSE" -unset MAKEFLAGS - +# unset MAKEFLAGS +echo "run source edksetup.sh" +source ./edksetup.sh . edksetup.sh +ls -lah + +echo "build -h" +build -h + build_iso() { dir="$1" UEFI_SHELL_BINARY=${dir}/Shell.efi @@ -147,62 +157,46 @@ build_iso() { -o "$ISO_IMAGE" "$UEFI_SHELL_IMAGE" } -# Build with neither SB nor SMM; include UEFI shell. -# mkdir -p OVMF -# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" -# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.fd -# cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd - -# Build 4MB with neither SB nor SMM; include UEFI shell. -echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" -build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.fd -cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd -# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.fd -# cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS_4M.fd - -# Build with SB and SMM; exclude UEFI shell. -# echo_dbg "build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" -# build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd - -# Build 4MB with SB and SMM; exclude UEFI shell. -echo_dbg "build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" -build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc -cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd -# cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.secboot.fd - -# Build AmdSev and IntelTdx variants -touch OvmfPkg/AmdSev/Grub/grub.efi # dummy - -echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc" -build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc -cp -p Build/AmdSev/*/FV/OVMF.fd $FIRMWARE/OVMF.amdsev.fd -# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc" -# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc -# cp -p Build/AmdSev/*/FV/OVMF.fd $FIRMWARE/OVMF.amdsev.fd - -echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc" -build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc -cp -p Build/IntelTdx/*/FV/OVMF.fd $FIRMWARE/OVMF.inteltdx.fd -# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc" -# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc -# cp -p Build/IntelTdx/*/FV/OVMF.fd $FIRMWARE/OVMF.inteltdx.fd - -# build shell -echo_dbg "build shell" -build ${OVMF_4M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc -build ${OVMF_4M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc -# build ${OVMF_2M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc -# build ${OVMF_2M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc - -# build ovmf (x64) shell iso with EnrollDefaultKeys -#cp Build/Ovmf3264/*/X64/Shell.efi $FIRMWARE/ -cp -p Build/Shell/*/X64/ShellPkg/Application/Shell/Shell/OUTPUT/Shell.efi $FIRMWARE/ -cp -p Build/OvmfX64/*/X64/EnrollDefaultKeys.efi $FIRMWARE/ -build_iso $FIRMWARE +build_ovmf() { + echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" + build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc + cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.fd + cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd +} + +build_ovmf_secboot() { + # Build with SB and SMM; exclude UEFI shell. + echo_dbg "build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" + build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc + cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd +} + +build_ovmf_amdsev() { + # Build AmdSev and IntelTdx variants + touch OvmfPkg/AmdSev/Grub/grub.efi # dummy + + echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc" + build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc + cp -p Build/AmdSev/*/FV/OVMF.fd $FIRMWARE/OVMF.amdsev.fd + + echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc" + build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc + cp -p Build/IntelTdx/*/FV/OVMF.fd $FIRMWARE/OVMF.inteltdx.fd +} + +build_shell() { + # build shell + echo_dbg "build shell" + build ${OVMF_4M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc + build ${OVMF_4M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc + + # build ovmf (x64) shell iso with EnrollDefaultKeys + #cp Build/Ovmf3264/*/X64/Shell.efi $FIRMWARE/ + cp -p Build/Shell/*/X64/ShellPkg/Application/Shell/Shell/OUTPUT/Shell.efi $FIRMWARE/ + cp -p Build/OvmfX64/*/X64/EnrollDefaultKeys.efi $FIRMWARE/ +} + enroll() { virt-fw-vars --input $FIRMWARE/OVMF_VARS.fd \ @@ -227,17 +221,16 @@ enroll() { # --distro-keys altlinux } -# enroll - no_enroll() { cp -p $FIRMWARE/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.secboot.fd # cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd cp -p $FIRMWARE/OVMF.inteltdx.fd $FIRMWARE/OVMF.inteltdx.secboot.fd } -no_enroll +build_ovmf 2>&1 > /dev/null +build_ovmf_secboot 2>&1 > /dev/null +build_ovmf_amdsev 2>&1 > /dev/null +build_shell 2>&1 > /dev/null -# build microvm -# echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc" -# build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc -# cp -p Build/MicrovmX64/*/FV/MICROVM.fd $FIRMWARE +build_iso $FIRMWARE +no_enroll diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml index 2be4e9f90..a62da18ed 100644 --- a/images/edk2-artifact/werf.inc.yaml +++ b/images/edk2-artifact/werf.inc.yaml @@ -26,10 +26,10 @@ git: - add: /images/{{ $.ImageName }} to: /FIRMWARE includePaths: - - '*.bin' + - 'DBXUpdate-20230509.x64.bin' stageDependencies: setup: - - '*.bin' + - 'DBXUpdate-20230509.x64.bin' shell: beforeInstall: - | @@ -77,5 +77,5 @@ shell: setup: - | - /build.sh --repo-name {{ $gitRepoName }} --branch {{ $version }} 2>&1 > /dev/null + /build.sh --repo-name {{ $gitRepoName }} --branch {{ $version }} From 9c9a181f6d07c254a9703734f7e25fa3b4db9ae5 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 31 Jan 2025 20:27:01 +0300 Subject: [PATCH 077/107] edk2: change script, source ./edksetup.sh BaseTools to build script Signed-off-by: Nikita Korolev --- images/edk2-artifact/build.sh | 10 ++-------- images/edk2-artifact/werf.inc.yaml | 4 ---- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/images/edk2-artifact/build.sh b/images/edk2-artifact/build.sh index 2c4f24f98..ca312f9e8 100755 --- a/images/edk2-artifact/build.sh +++ b/images/edk2-artifact/build.sh @@ -115,8 +115,9 @@ OVMF_SB_FLAGS="${OVMF_SB_FLAGS} -D EXCLUDE_SHELL_FROM_FD=TRUE -D BUILD_SHELL=FAL # unset MAKEFLAGS echo "run source edksetup.sh" +source ./edksetup.sh BaseTools source ./edksetup.sh -. edksetup.sh + ls -lah @@ -203,27 +204,20 @@ enroll() { --output $FIRMWARE/OVMF_VARS.secboot.fd \ --set-dbx $FIRMWARE/DBXUpdate-$DBXDATE.x64.bin \ --secure-boot -# --enroll-altlinux -# --distro-keys altlinux virt-fw-vars --input $FIRMWARE/OVMF_VARS_4M.fd \ --output $FIRMWARE/OVMF_VARS_4M.secboot.fd \ --set-dbx $FIRMWARE/DBXUpdate-$DBXDATE.x64.bin \ --secure-boot -# --enroll-altlinux -# --distro-keys altlinux virt-fw-vars --input $FIRMWARE/OVMF.inteltdx.fd \ --output $FIRMWARE/OVMF.inteltdx.secboot.fd \ --set-dbx $FIRMWARE/DBXUpdate-$DBXDATE.x64.bin \ --secure-boot -# --enroll-altlinux -# --distro-keys altlinux } no_enroll() { cp -p $FIRMWARE/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.secboot.fd - # cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd cp -p $FIRMWARE/OVMF.inteltdx.fd $FIRMWARE/OVMF.inteltdx.secboot.fd } diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml index a62da18ed..2f5194921 100644 --- a/images/edk2-artifact/werf.inc.yaml +++ b/images/edk2-artifact/werf.inc.yaml @@ -70,10 +70,6 @@ shell: echo "Building BaseTools..." ln /usr/bin/python3 /usr/bin/python make -C BaseTools -j$(nproc) - - # Set up the build environment - echo "Setting up the build environment..." - source ./edksetup.sh BaseTools setup: - | From 6154034b6a7f746fe2d4b315a6fa25313647e1a0 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 3 Feb 2025 10:12:00 +0300 Subject: [PATCH 078/107] libvirt: remove unecessary commented lines, add description for list of files Signed-off-by: Nikita Korolev --- images/libvirt-artifact/install-libvirt.sh | 51 ++-------------------- 1 file changed, 4 insertions(+), 47 deletions(-) diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt-artifact/install-libvirt.sh index 21882df42..9c79e6618 100755 --- a/images/libvirt-artifact/install-libvirt.sh +++ b/images/libvirt-artifact/install-libvirt.sh @@ -30,8 +30,8 @@ convert_version() { local version="$1" # Split the version string into major, minor, and patch parts + # and construct the compact version by combining major and zero-padded minor IFS='.' read -r major minor patch <<< "$version" - # Construct the compact version by combining major and zero-padded minor printf "%d%03d\n" "$major" "$minor" } @@ -102,7 +102,9 @@ fi # 10.10.0 -> 10010, 10.0.5 -> 10005 lib_version=$(convert_version $VERSION_NUM) -# List of files and destinations +# List of files and destinations of libvirt +# Commented lines - binary for additional features. +# When building with support for a new feature, uncomment the necessary files FILE_LIST=$(cat < Date: Mon, 3 Feb 2025 10:19:50 +0300 Subject: [PATCH 079/107] qemu: remove unecessary commented lines, add description for list of files Signed-off-by: Nikita Korolev --- images/qemu-artifact/install-qemu.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu-artifact/install-qemu.sh index 58a9d4473..a7f479a19 100755 --- a/images/qemu-artifact/install-qemu.sh +++ b/images/qemu-artifact/install-qemu.sh @@ -90,7 +90,9 @@ if [ -z $VERSION_NUM ]; then usage exit 1 fi - +# List of files and destinations of qemu +# Commented lines - binary for additional features. +# When building with support for a new feature, uncomment the necessary files FILE_LIST=$(cat < Date: Mon, 3 Feb 2025 10:36:05 +0300 Subject: [PATCH 080/107] werf.yml: change name of folder with version_map Signed-off-by: Nikita Korolev --- cv/README.md | 9 +++++++++ {candi => cv}/version_map.yml | 0 werf.yaml | 12 ++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 cv/README.md rename {candi => cv}/version_map.yml (100%) diff --git a/cv/README.md b/cv/README.md new file mode 100644 index 000000000..56638134a --- /dev/null +++ b/cv/README.md @@ -0,0 +1,9 @@ + +# Component versions +**permalink: /cv/** + +Component Versions contains the following components: +Hypeervisor: +- qemu: 9.2.0 +- libvirt: 10.9.0 +- edk2: stable202411 \ No newline at end of file diff --git a/candi/version_map.yml b/cv/version_map.yml similarity index 100% rename from candi/version_map.yml rename to cv/version_map.yml diff --git a/werf.yaml b/werf.yaml index 136048fba..d3e05af48 100644 --- a/werf.yaml +++ b/werf.yaml @@ -46,17 +46,13 @@ configVersion: 1 # Edition module settings {{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION") }} -# Versions modules -{{ $_ := set . "version" dict }} -{{- $versions_ctx := (.Files.Get "candi/version_map.yml" | fromYaml) }} +# Component versions +{{ $_ := set . "Version" dict }} +{{- $versions_ctx := (.Files.Get "cv/version_map.yml" | fromYaml) }} {{- range $k, $v := $versions_ctx.hypervisor }} {{- $_ := set $.version $k $v}} {{- end }} -{{/* -# {{printf "%s%s" $k $v }} -*/}} - # Modules_images {{- define "module_image_template" }} @@ -90,7 +86,7 @@ dockerfile: Dockerfile {{- $_ := set $ctx "Images" $Root.Images }} {{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }} {{- $_ := set $ctx "MODULE_EDITION" $Root.MODULE_EDITION }} - {{- $_ := set $ctx "Version" $Root.version }} + {{- $_ := set $ctx "Version" $Root.Version }} {{- include "module_image_template" $ctx }} {{- range $ImageYamlMainfest := regexSplit "\n?---[ \t]*\n" (include "module_image_template" $ctx) -1 }} From cad86dbf90e2a227ea89e0ab8e10c699342e5080 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 3 Feb 2025 10:37:27 +0300 Subject: [PATCH 081/107] edk2: remove unecessary ovmf json cfgs Signed-off-by: Nikita Korolev --- .../json/50-edk2-aarch64-qcow2.json | 32 ------------------- .../json/51-edk2-aarch64-raw.json | 32 ------------------- .../json/52-edk2-aarch64-verbose-qcow2.json | 32 ------------------- .../json/53-edk2-aarch64-verbose-raw.json | 32 ------------------- 4 files changed, 128 deletions(-) delete mode 100644 images/edk2-artifact/json/50-edk2-aarch64-qcow2.json delete mode 100644 images/edk2-artifact/json/51-edk2-aarch64-raw.json delete mode 100644 images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json delete mode 100644 images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json diff --git a/images/edk2-artifact/json/50-edk2-aarch64-qcow2.json b/images/edk2-artifact/json/50-edk2-aarch64-qcow2.json deleted file mode 100644 index 937d2953e..000000000 --- a/images/edk2-artifact/json/50-edk2-aarch64-qcow2.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "UEFI firmware for ARM64 virtual machines", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode": "split", - "executable": { - "filename": "/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.qcow2", - "format": "qcow2" - }, - "nvram-template": { - "filename": "/usr/share/edk2/aarch64/vars-template-pflash.qcow2", - "format": "qcow2" - } - }, - "targets": [ - { - "architecture": "aarch64", - "machines": [ - "virt-*" - ] - } - ], - "features": [ - - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json/51-edk2-aarch64-raw.json b/images/edk2-artifact/json/51-edk2-aarch64-raw.json deleted file mode 100644 index 506bbe69c..000000000 --- a/images/edk2-artifact/json/51-edk2-aarch64-raw.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "UEFI firmware for ARM64 virtual machines", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode": "split", - "executable": { - "filename": "/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/edk2/aarch64/vars-template-pflash.raw", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "aarch64", - "machines": [ - "virt-*" - ] - } - ], - "features": [ - - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json b/images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json deleted file mode 100644 index 976f2a6c2..000000000 --- a/images/edk2-artifact/json/52-edk2-aarch64-verbose-qcow2.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "UEFI firmware for ARM64 virtual machines, verbose logs", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode": "split", - "executable": { - "filename": "/usr/share/edk2/aarch64/QEMU_EFI-pflash.qcow2", - "format": "qcow2" - }, - "nvram-template": { - "filename": "/usr/share/edk2/aarch64/vars-template-pflash.qcow2", - "format": "qcow2" - } - }, - "targets": [ - { - "architecture": "aarch64", - "machines": [ - "virt-*" - ] - } - ], - "features": [ - "verbose-static" - ], - "tags": [ - - ] -} diff --git a/images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json b/images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json deleted file mode 100644 index fa0ed91ea..000000000 --- a/images/edk2-artifact/json/53-edk2-aarch64-verbose-raw.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "UEFI firmware for ARM64 virtual machines, verbose logs", - "interface-types": [ - "uefi" - ], - "mapping": { - "device": "flash", - "mode": "split", - "executable": { - "filename": "/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw", - "format": "raw" - }, - "nvram-template": { - "filename": "/usr/share/edk2/aarch64/vars-template-pflash.raw", - "format": "raw" - } - }, - "targets": [ - { - "architecture": "aarch64", - "machines": [ - "virt-*" - ] - } - ], - "features": [ - "verbose-static" - ], - "tags": [ - - ] -} From eefc96f8b5111af487944bce8406defebdde67e6 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 3 Feb 2025 10:40:38 +0300 Subject: [PATCH 082/107] edk2: fix comment in script build.sh Signed-off-by: Nikita Korolev --- images/edk2-artifact/build.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/images/edk2-artifact/build.sh b/images/edk2-artifact/build.sh index ca312f9e8..1a309b1bc 100755 --- a/images/edk2-artifact/build.sh +++ b/images/edk2-artifact/build.sh @@ -158,7 +158,7 @@ build_iso() { -o "$ISO_IMAGE" "$UEFI_SHELL_IMAGE" } - +# Build with SB and SMM; exclude UEFI shell. build_ovmf() { echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc @@ -166,16 +166,16 @@ build_ovmf() { cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd } +# Build with SB and SMM with secure boot; exclude UEFI shell. build_ovmf_secboot() { - # Build with SB and SMM; exclude UEFI shell. echo_dbg "build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc" build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd } +# Build AmdSev and IntelTdx variants build_ovmf_amdsev() { - # Build AmdSev and IntelTdx variants - touch OvmfPkg/AmdSev/Grub/grub.efi # dummy + touch OvmfPkg/AmdSev/Grub/grub.efi echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc" build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc @@ -186,14 +186,12 @@ build_ovmf_amdsev() { cp -p Build/IntelTdx/*/FV/OVMF.fd $FIRMWARE/OVMF.inteltdx.fd } +# Build ovmf (x64) shell iso with EnrollDefaultKeys build_shell() { - # build shell echo_dbg "build shell" build ${OVMF_4M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc build ${OVMF_4M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc - # build ovmf (x64) shell iso with EnrollDefaultKeys - #cp Build/Ovmf3264/*/X64/Shell.efi $FIRMWARE/ cp -p Build/Shell/*/X64/ShellPkg/Application/Shell/Shell/OUTPUT/Shell.efi $FIRMWARE/ cp -p Build/OvmfX64/*/X64/EnrollDefaultKeys.efi $FIRMWARE/ } From 6ff7520b788425f848dc8d107fde1b702c9a241b Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 3 Feb 2025 10:59:22 +0300 Subject: [PATCH 083/107] werf.yaml: fix var Signed-off-by: Nikita Korolev --- werf.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/werf.yaml b/werf.yaml index d3e05af48..e1abe7482 100644 --- a/werf.yaml +++ b/werf.yaml @@ -50,7 +50,7 @@ configVersion: 1 {{ $_ := set . "Version" dict }} {{- $versions_ctx := (.Files.Get "cv/version_map.yml" | fromYaml) }} {{- range $k, $v := $versions_ctx.hypervisor }} - {{- $_ := set $.version $k $v}} + {{- $_ := set $.Version $k $v}} {{- end }} # Modules_images From 33d8a8bdf9a759a9e52a027d9c93c752023277cb Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Mon, 3 Feb 2025 13:03:26 +0300 Subject: [PATCH 084/107] edk2: move creation logo to bmp to edk2-artifact Signed-off-by: Nikita Korolev --- images/edk2-artifact/{ => logo}/Logo.bmp | Bin .../edk2 => edk2-artifact/logo}/README.md | 0 .../edk2 => edk2-artifact/logo}/bmp-info.py | 0 images/edk2-artifact/werf.inc.yaml | 7 ++++++- images/virt-launcher/edk2/Logo.bmp | Bin 300138 -> 0 bytes 5 files changed, 6 insertions(+), 1 deletion(-) rename images/edk2-artifact/{ => logo}/Logo.bmp (100%) rename images/{virt-launcher/edk2 => edk2-artifact/logo}/README.md (100%) rename images/{virt-launcher/edk2 => edk2-artifact/logo}/bmp-info.py (100%) delete mode 100644 images/virt-launcher/edk2/Logo.bmp diff --git a/images/edk2-artifact/Logo.bmp b/images/edk2-artifact/logo/Logo.bmp similarity index 100% rename from images/edk2-artifact/Logo.bmp rename to images/edk2-artifact/logo/Logo.bmp diff --git a/images/virt-launcher/edk2/README.md b/images/edk2-artifact/logo/README.md similarity index 100% rename from images/virt-launcher/edk2/README.md rename to images/edk2-artifact/logo/README.md diff --git a/images/virt-launcher/edk2/bmp-info.py b/images/edk2-artifact/logo/bmp-info.py similarity index 100% rename from images/virt-launcher/edk2/bmp-info.py rename to images/edk2-artifact/logo/bmp-info.py diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml index 2f5194921..021132f44 100644 --- a/images/edk2-artifact/werf.inc.yaml +++ b/images/edk2-artifact/werf.inc.yaml @@ -11,10 +11,15 @@ git: to: / includePaths: - build.sh - - Logo.bmp stageDependencies: setup: - build.sh +- add: /images/{{ $.ImageName }}/logo + to: / + includePaths: + - Logo.bmp + stageDependencies: + setup: - Logo.bmp - add: /images/{{ $.ImageName }}/json to: /FIRMWARE diff --git a/images/virt-launcher/edk2/Logo.bmp b/images/virt-launcher/edk2/Logo.bmp deleted file mode 100644 index 00e4821ceca1086427ea8635d6ba36fb5b0f0daa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 300138 zcmeI5v9IOEb;h3&!$A@R5MTsIQaEa2xJV&bja|eR3>Ybb0J0jp2qG1Ri!>6DHh|Qm zNwW(ijVtLt(3a^0#S7Pv4Mpd3i}L-`kIPdK!{5XU_R?&c_*E z-nT#dyMO%mZ{I!N{+0j!ng1St>+bIV`2V-={*>Q$cmMrw-@g0qAKkt9@5O-^znWky`skylPoJJjvJk5;zx)!%b__eFLm&k1A%QQx z_~O~KXXlZuCRVtFWA_l}jxKXgIooaJY%c9cKc-JW0CD*0tFI6TwlhdpiB)rn-4j5X zb>ZE2-~CiJc4w=0C*FDI9clV0yIqy%2M~l0KKP*BQyLR~v-`;>pENiW%Fd*Pb`bko zlO}Jy^;VrK3l!!&DdSZ5?6c1pE#(hG2$z@-&s{H~&@Kj`9zT9uH6J~CRGqd0_UkMK z$XJEt9a+Qd-U|YZy&82CUae#?8d(OaKZAjN2D~VMddu!|ugEoR+ov9;IH^$pLx1V}l-d)hjb@muYghcNMCt0NUzWy<$|%nNqWq zdpTMzBiaRJizs?!Kwh_99Ue96IC!vRO^Ox%^dt6E7sw=~&(ndo<5>-}l)4%t~!(X0N_~5ul`AEr{6RYM=J!ZK!x&!K)8f>Lk0MS)mZc zK03ft9ebQr7p@Pvw?kW&QEYWf8Y^eB+4qP)ctTqqTTPxV`&fux^_M0`t|h=otD)W( zj*+afSmD)~-)h)NugvTugbzRbu)kzB0PKE*c1?=^MZKbx_4V<`A6s82l4&E7SaqUT zg(8L31p3>e4a>bH>!MiU4^FNQaPNjDEbK1tai9`*UFOUp8g{*`chi|Uk^@hgK?`%C z9R^SN6TK=FDXb$fx#+O*&+dMbwM49%Kf1D57wk^0ERp#bj@;L6az4|Xp_wx$(aLt#R6-{_T65q@t7acBVpf}L+59Qb&67C=#*|v1ti~zZjIobsc}HeB zyC)}LS5}9;l^HghE5>rM!WqrwQ&Ba&GHz`b!I@mr&Z&f@BrkXjLbjQh)wE08XLqYV z=Sf*p4I!vfp{h`YIb}0XqE|&Mg@pwAHyI|=tsR`qxP=`}RwSvUiIj5WK6&Y zp$_}Ly!rgfva;_{kKpP!mREIlxn2>D&6MU;0$J18t(8S;uh-gHQ;F4jWwW@!V6d9C z95zq5SDLG}tHZLt?lx@th^(W5FjkK#oS%SQcTJGK+z*>g0<^K+_p3)3hnsY|t&ywr zif}Z2=JW~=?Sr<;dUL+Nh*rUpx6kfYf8a^0KtsJ2bCYe9);zB%rFk-#G^$?FsYPTV z_jW861#YIYdyfb(!h9?FNFu zKfmuC0j{qNp202yV7~w@3kGg*s)qD_{#qAcC~k#VzruF3y4`t zs*z^FENg{p%XBxkIp>c~uCRb^jJvMzCx-;01jflzm<0%Ddnx01Ntv=u`F;_&>bq&& zl=q8nGAri>b`9zM{JGZh61}n&O3lGcRV+Hhc`iNY_;9@WPm-=^J82d>#iV~db+QQu zX=OK;8}(|kqk(R>`h~heNZ~#bund|U40W*P1A9bz9_3sY-4eaB`+o5p>lOZx^8FL4 zx-P9?6)K8#a%aZbRlUOa63ObtiiWCJ7%{i$sN|aFqllHrpEbP## z-^{*N>$4vJwMQK)ST5O7Pbe1$jJGR@^VF~A)vyk-#G@fm^xaX1g6W+^pdm-n@KP17shmLxH2 zV;*b3*)1QqA{7*cO4zEP1#A*B%V#z^)xU{HVuGS=+JrJQ5OsitR-x^hC-gO0O%Ku? ztuTl`hy%WjTa}Y0BiO-7+EQrtDYQ*%a)d7Ej;-&AnjCy_@)NwGvbvh`eIdX_BxU-! zx2DOs%ox}^SjOSlhrwCyvjj+(I=1(ASnb1S;9h@Qqr4`t%QyUg^#XWa5&68db zHuNW^LO=;{b7A=6ISgp9+$28&I!L+cpSFWPRM4euaA+Vohao0a4gw~5KjxMUu!U_?qBQIk5 z3W19Rc9Jaauot`DumVvml%VC+B32t-pqL7Qtq5!`S%mf3cZr27R=~)O=yz`SrMyK4bC_d0zHA%lErL_SFd@3goWPh@ke;%%bV)B zH2Dd8W>&{vk@Oe>dl0xvvY3SMR?@-GsjiJ0_n7Z3Un*v1buHo44}n)m;G$%);5yG# zYB?z4V$y~4gGpD!YB|r;41tpn=q0O7rFe~;rPeJ@zWK*@%YSa^XwbI3Ak(zYn?`x4P^vDkwXcRh9b!BBst0 zqqeobHc6t@Sp!&ZQ>X7`?uap`?I2Q&pg%}iS)1cL8M1~}7AVkT1yu!P$70tel;^Np z_=Tk`Q!sRRt7l)g^5%N=)jvGIPYg|b7=e>RO9ziN(Nmi8n3~HYZGy;H3bb8wW3HOD zog4Gxq%$MzYEt8^HD97vv}%8azBk?>=}(vRd~fP-_nb@(&Bs2N4fTqSCLJIVRIdirDrKsmx!;_h%iL@ekS`L4jZ@WWUyaoeGcNqpWl{5A^AQV{ z6s-=eh@IvA9g%Wg&W1C>9p>&?}}`n0+wY+zphx7{q8n)wUIkz-qms3v)ny(-DA*OJrI^Q zT6E}Aw!x_}TLS8-tMrPb&`vd9)TWL6$!g{jp*0KE1>Myt?Se81rOs@qSLVN2RyS-) zGgs3L;&!iBswAkriC%T8AuCwBj+~mb(0fwV>{Rrsn9mh<(kosceHfc987yHZ2UrW- z#6fA;IPddFD=!(+)Hhw7bj&in`sI^HP02Y0pcm#XgPOO@uP|XizS^{63hH5(f&0Igx|&iTCL;@XwX{EFq<=0ChU`T#cWgSyC~YzeEQ*W!J(dNnz! z=XBDJPqwY-6o@I?je14$E)fu0#MNA-JgkDn)eGQ~?yxqeR~E0Wpvw&kAXOvfN%Tr7 zEh+Cbzj_#t+__`wFynp-QWK)N_xG%tUWK z%8P2&R(mlEgLMS0mJDgCEg99;FT2evTMy1fL}ey3n!KCq63A!{|8U$x<3ZQHJ`9E-eNT;ti=F1fOkoj%BeJL%Pv`~Srp8z-!T+5oVe zoy;j}T3YGgG2IyG1FdXG&s8>WC+A4kZ)Hut$emkc**wAW%ko#H#@w5Wf_TlDz9vUh zKn7osu}e_#*0s1%uZ%|TYIUTGXq+#NwTr7_SZ(d9OD2@He9-QRI!-KQ z`b1#ZShDCqvJuEA)zsFSlx;}QC4~usdRqpqUv*nEmxO97-)h(jcw%|ChhEXw7_UX4 z>8}n$KxK`x#@lLY)RS7#s;M2VX3|Qv$%g|rkm|;Val5#aPFnNvY+MOE$ns8lh1q+( zF~P9hL=Y+>TR`yyxK34Jxn40!$pXe9X6dDFzRi>k>7Ded|56P8Yse%!PU5O=o9Gqs z(vfbaNGcJHiFv}6LY-<(2r--KHJ>-vE1a>bOh@Voq4l2Vt;8-a%?S+@Elhs*lBj2^ z+Urx;L$CM>;Tzw%-v}*bEHR1A)Qo{=0ozE{vu0cspp956+rhcrk}rm_*3qP>uB~6q zU;H-_Xx0dG@_0LISS&Y{iMdy9>09pZ{N% znQDYCiYEoE>DemJdBXA1)j@OafFQz+GS~_@ti8X6R-0M z=xvJ^xxm`R${LzhZdXU6?x&_&U(4XNDCXo&TWR?>1ldFCbuJ^e_#8uvbt1Vzix%i^@@Kt=e}=DPIRcujT0O5 z_NY98VYHYc+W$6CtQStGNnUIC%c zccM1V#fm7XU#L0WoNr-rs(@D$Eof+Zyj`7UM1Ny&&J&t&efwJ;&1qG}+uVs;#-trx zpK8CaTX|c(dKh2BseEi>X>JluM$}-VpxtF^}eJ|)g-$SJz^wNAb=YcLf?BkHPEX;*JbTup&YORIgW?;iMRO7jRRAyj`mAg z8&XFli|LIzpq2G_Syoe3rj>HT8Rb^hv{1(FV6%e-3gb?-;e#)4s8?V9;@&@I=W;W^ zRE5wk9lAOmtR}7Y7+2U-e@IF7;Z)^;UY*L%at5|_Z_)`>RY>7%1h&$vhapy69h;4h zhq2zEQ59~5b$#pp$Ssnsj$d1N7`bF(H{gA1*m&rP;BbSb6= z1UAvDj~~jvKgd){Co`1C^Lbkm>Wf&WdxJ|bKJ_s4%I2b{nk6DxT5!Ovel@;` zIlC2s8}*7mef*IAeP`~ZIyeW5!N$K0b#20tb}D*>($*+FvtHpOAIuFNXzTTjUez_d zSm5r@9h^j9QmTXDV#7g&6?(-R3p`inbHJUHiqKe05hi0}t1t%y^c3q9x~^?JxoQoo zaw}}ESL)u$%Y)}vC)cYn*yz=m&*a%AR)&u67BLd$9tcm`v4i}h%*f92A8WqhE`c!M z(I|`YV9DAlB0k6?mfE&5duBVRy*}#EVadfU6ci@EpLp8P)bqiz@wEOQ?^rKZn$#>? zww-hx7GRr7k=pHBeAQISJlEYwR#8nM1kOfaE3vASC*O~ckxt8j+Y6DbQR zMF%#iz#8y&jWP?7tW7RWjD)~e1a=ZD693?D6VRQh%_h5%tgS{`?1aFL1ojgvwBq2m zN9b-7f$EJ!vTht^X&wT%6WCR(TGk)-E)%f~-m2;)=-MNZtlP(1EQG)<1o#ruwP|~8 zeZDqwi-*hG@{-lHzFk|N7fqM@lbRtA0-F1WrN#wPB`l%j|`f+TO9;@+JeJv1mO&RQHB3X}|qJ z41TZMZfw4;)7x9MKLE1Y&g$mJH(VX#gKx+j23cUWceDNS+Rzt$w{6{z5C`J ze}{1H=kbr9|LrgSZrD{D^*{UR-P2#)J^S_7Kl~Z7&wswu&IjLr{x`>HQq7gUF^LPJZglo_*Jq|e25GBvHApzD<%T;36w;Ir&<(}9-gS8=$)ut?GEm>@L zJd!V}O|wR(^jVMpOsfWITb@idud@_XuMiVUOr|2WS?nwHYGKHD_1RCV+iw(*4t0L6 zjH|ZwIy~7Hsba3@QxR=q6Yp!KUXXthut zn~`4Yjv12=ua|3AVfzud>Ur9!R)UR*<*beNxm||6ZG9rNCr)G;S;;>tWTrT)Td#E_ z8a6-p%R82Dy_8uhsqxCtUJcA`i~U-?vgY_e*TjX-bVQ+d+a8hiQPYaH{7jxIVip?x zmYPvuSAkSq%r?!XFW-AUt;H*T=+qjj+3Grlbp)<@%DvMEaF|`b7{uXqk?z{cl8#;7 z82k)lMzxNA$_)ETkXGLkp>m|Gkr8I3ELiqY&Hm9eo>_hRlW#O9m2^|f?Nq-KP z7JKhA^-VX*=RWtbUuRoK?3w~#tu`#E+mzq`=GyJUZmCFgPH#2XKZ!NgE-J5!bk|lkhE1=k>qp%qWgYD%IC`oqP(ZS% zSwEG1_K3cohihBPmP#rwnx0LsY$eFS>aNUM>}s&;%;^=Ct<&B=HM$vnaV3^H@5A5A4qPo#-N(<78Q(r*^~WSu#^ zGChRA+-B-gb0I$6QztRlZ`RAChqM9()(FSEZT1@|=xKM|+%`edycm?9yj-AZoi;nVHX^ma%)$Jeo3L5zlWJfJ0ED(# z$dhebO%wA{He0n#k~a?vc=6$g1*<41cXH7u4WlAnKk7S3q2j=B{-J6T4zwMRMI-P>y=ugJTPdnPioHXdNrp@bH|G|1@ln# z3KXkWf1XzStN6n4Qulh@K z{E_jjrk&kGtXibYCF_K5GPDqE*pKzf?$I@MAvH8#K7M=p*@$Imt&HrcvL#v#Dvl#@ z_4Cf3*O_nhj#uUnMRr=l$5Is1lCl)*X)<*!X-(D8fAGJ@p#H8v_ur74= zc#B>caEp$!u&tl+$JVxpTff;Q=F()_kihsM(%xd#0=Xzz=X{f)Id2Iy)+Vr1Nf}WygvuRCgI`{nai_KiZ2ob585YXk;&#-Q$-1zmYy1*#clzrP0GDUHh_GI=3>bB&}-d|dPVOS z6@HS{63Lo$xW${_HxjTf@x3asYEkr(b=o%>n!}c}n$C4y7~y>`Pu8RfmFMz^<2J{r zE~>zst?#Qz2hIDeZw*yjRIfP85=qZeu6GYCc4|)QEe35SS>Cn+UfCm~>JcepRW<4M z?RrJ;DAJ@_j(tYP2Ms4x&O*-aEd=V1B)nR&Y9W|po%T(J=B?!{Pe0mYkoKENg*^{x znMgYHlPkS~WCZ!hC+uV^zp*o!v)V+<^iGr391oF;ar4p#3Z_?>rLF$pTiYylI&E9) zowNMddg|*MQ~zrr)1-w=p$tw{e?Fg_^hzr)tb>!w`z`wz$HNs3%R&n42=I?n@CfS+ zV%7XF$vX3!49!)Bt0w!BGB@;#)1-CRadj(oyVt8ZvljbUUgnJCcnDlefHl{7#Hu;p zB Date: Mon, 3 Feb 2025 22:07:59 +0300 Subject: [PATCH 085/107] virt-launcher: rm unnecessary comments Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 026cd257f..672ac9f94 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -37,10 +37,7 @@ shell: # delete docs echo "Delete docs" rm -rf /usr/share/doc/* -# docker: -# ENV: -# LANG: "" -# LC_ALL: POSIX + --- {{- $versionLibvirt := "10.9.0" }} From b2536b7e4d3cdbf564a36e9b875ed992f1c41e99 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 11:07:57 +0300 Subject: [PATCH 086/107] ci: rm test branch and selfhosted runner Signed-off-by: Nikita Korolev --- .github/workflows/dev_module_build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/dev_module_build.yml b/.github/workflows/dev_module_build.yml index 7792dd424..552fccd6f 100644 --- a/.github/workflows/dev_module_build.yml +++ b/.github/workflows/dev_module_build.yml @@ -32,9 +32,6 @@ on: type: number pull_request: types: [opened, reopened, synchronize, labeled, unlabeled] - branches: - - main - - chore/ci/build-libvirt push: branches: - main From 4b4b32c90925258bc4f82977a0aab43d64cfdd42 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 19:27:10 +0300 Subject: [PATCH 087/107] virt-launcher: fix variable libvirt_version Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 672ac9f94..ad017547f 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -39,7 +39,8 @@ shell: rm -rf /usr/share/doc/* --- -{{- $versionLibvirt := "10.9.0" }} +{{- $gitRepoName := "libvirt" }} +{{- $version := get $.Version $gitRepoName }} image: {{ $.ImageName }}-prepared final: false @@ -171,7 +172,7 @@ shell: printf "%d%03d\n" "$major" "$minor" } - libvirt_version=$(convert_version {{ $versionLibvirt }}) + libvirt_version=$(convert_version {{ $version }}) echo "libvirt_version: $libvirt_version" From 64b8aaffbc53eba9df5ce998b16cef29b1d8b39e Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 19:40:35 +0300 Subject: [PATCH 088/107] qemu: tyr ccache Signed-off-by: Nikita Korolev --- images/qemu-artifact/werf.inc.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu-artifact/werf.inc.yaml index c74b36b75..f9d8cc948 100644 --- a/images/qemu-artifact/werf.inc.yaml +++ b/images/qemu-artifact/werf.inc.yaml @@ -105,10 +105,10 @@ shell: install: - | - # export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" - # export PATH="$CCACHE_WRAPPERSDIR:$PATH" - # export CCACHE_BASEDIR="$(pwd)" - # export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" + export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + export CCACHE_BASEDIR="$(pwd)" + export PATH="$CCACHE_WRAPPERSDIR:$PATH" export MAKE="/usr/bin/make" export NINJA="/usr/bin/ninja" export PYTHON="/usr/bin/python3" From 285e2d90de4078358bed71fd40593022b8253385 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 19:49:22 +0300 Subject: [PATCH 089/107] edk2: rm DBXUpdate-20230509.x86.bin Signed-off-by: Nikita Korolev --- images/edk2-artifact/DBXUpdate-20230509.x86.bin | Bin 7634 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 images/edk2-artifact/DBXUpdate-20230509.x86.bin diff --git a/images/edk2-artifact/DBXUpdate-20230509.x86.bin b/images/edk2-artifact/DBXUpdate-20230509.x86.bin deleted file mode 100644 index 6dbb7028d6d35cbfcc41ac1bf825fd85b6421dea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7634 zcmd6qcQl;cy1)&i_h?}VqStx#9$^q6qKgQk_im8Udz26@1W|$zErcLMwCG(3qC^Rz z*CIteM&S{k_lLv*&q!d(Q+e77hhD6~>>B10wV%%pH=9 zk7X(|Hk&u23Wfc|^ehX2V4?|32t*cbpI4nB9da`+)J1Q(JW zOt1k2Lr;KUti^0BOb8|>g%CO%-=@W(s46Xl{EtES&LjN&76>6aLQtRpA%KsAr3=NO zz|_?ipa96v8+a51cTC-FY@Mu;&Q1bk0LghLE(NZZrG=xjlZC()fd0IPfPzZR*4)k6 z-PsDsgm89qadtCB+M@5^1~|{JV^J{w)9XyCimFTqIVM3sKmfQxLo6r+2nvV_0)l|B zumQR$3#ook>?w=_Zq^C5lP$fw_&TleOh} z0|K^ z@ts?50O?YLaGtx|t6|nyr<+!;%`i>wG_4NS9@mZRAY+#FzWpP=sH1((9TrBGP`C!iH-NOF@jwcID>I2yrRO;t|^L*fj+$1$(>VAzuwk*zK1tKj16&NLOC& zZHA6}vCjxcw}afi{d{vTPbEY@9?z3iT{M050ipB{r3j-ZnypjYjrhm-wtAz7e25~C zlBnG~71~Ky;(mRBR`az6C2v;bWT;LIS~F>z*-cVg_iXI6$mKa4CRm${D|H!)@#?(c z%7zTS2*;MycM{UJ69q+xcFtH#QklbL16?#R?07~@gGO$63&y$n~2Lgozi>X5Z zhVxz$C^eMw(w(M9>Yhq#@G{@!n_M5})4csQZBSIlu_L z1*ibZ*-F_8;qo>}q>CgR?&amh@Azj*^P4+6!d>ibon74F=57vfbfTb>9G$xex%14u zfBwP;i1G;v^P?{VCOCNLFN%$g3xPm&04+e{&o+P=uJCW;Te>0L|L+ly0MYrhDIkzD zC?_tk<3@B7SrglACD;#FG7 zk12#1@lKNJLY@@C9N#qyzy#4G3@z@nDoM9u{`WHdOeG3ve$>~M&wVOp@=`chXq0{s)Ay(jn&sr=?e zCLJ4FHwz{WQ#T}vNzK&F-V*8JU}|p3q~+|4JQpEahoXYQXblPoN}P*O^lwd(^X7kp ztN)z>TbHY%8cXl6m$QFZ{r2mQw*saSF7brQB9eQloOIoBZ9Sm&tAV+oFFB1m$ydSx zajL}F_Wjw=*J_)GCQ2B)*zeMO?btA!HY6%*-wl4%-BZF|eF8&CikUnF>hue56ozlghZ z`G}HPNVk;g<>JmdcDtLi_9|iPK!hT&9dmu*es6|n-y=Z43_#GYkZV9NMDj(kF$U zhY1Hr|MCDffQ8n<{}P^}l@?;oU!S~j^mZnTE}oR+RlApf;rShmP+dS9(9BlPRts1C zyO7Z0x+uIqZ0F+UY~f-4mz2<{i_Tkg(xP+q+e6fPj zi#ZY+u}_(F8MB*P`WJTsJ<(Y9(9W`!)yvJCDi7~Cj3T}~PlHudO|6)nrVp9L!JNe| zrgg*NOW1?=b^Q_g7DS_WI%#w7V~`v4MXZ zk!HndVa;R-(nVvv@ypoB-*NNhE3>^$@Mw2k^?I|yS@ItCOr*9^YdID4Mmf}PAGWQ)4ysbv zoW--g#{Y~$J^f%yQj<&1gq?EKP5BCAtaY!6lFY+iI2%@#YO-fo-gf7<=tsfO#!P`= zNGrO`n$Ra>An56TfgS(lf&2F(`)}uO^Z^nY48btpsLtbhv*ZMM-q5o|66fb#EPLam z0F_&`r{~i|c(+De!u)f?bx6LEa62 zalNAs>qu|^PYI&~ACr{VWYu`g`<%w8^OVZ_j)8mS8BE8M|a468}8|_pIKF^ zF1|9Q_AtMSo5ypVWu8a%j{A|TUA&{W!Z>8hNQWD~-=cQm-GjjV+;hea4Z0CsSxMKA z$LJn+xh~mgly`)47xI>(;H$dSBu>3fN~ zcefILZEI|3w9eyc;q3Tz*v1?whPdtTUcYl|eBWt(v+IaVu(s!F-kal_gPg z#!?&X7%6-)EV|}eq8=I?ZVCEso3hCTVqGv_>x~zQ{S52=&L>sJDk<_>Pb-_xKXh4r zF{3%f#QWe-_2S(Ltb7lMw!RvA1B^?Z-ljC6ibf7|Th(A@; zQQ3&s)!HrUh1T8BQp5Z!9@JMEanmS8!MqgaL+xus9|qUyUb6IT7s?flyHTNrT2ll0 zhCbwrzAXgviD{eP_kU{63tj)PyAY?`AK|8DcXFupp%XvGWC$VA1NHGS?FLm3j$SIknZOhuW968xF0RJo(3+a)97I*e;R41fpMDw$J!)L9g)p@uDsMH`NnAfYEaJ#z(TUVe>^KV49pT_e(UTIWeDljE7PH(D) z^nrN>L#qBUamAVyn?}igt+sZPBEJ0Tt=)bL#cb6G1JX-iUOX~h( zi|JOb+0A3*+*4b$$Y$jT0`u2|WS0GyFWsmp#=w^@RzASVaE&_QT8a0Txo@)Uai<#0 z>-|C%RXD8-&UTBz-`YjLxm!}NVMI`AY-i3bb3bCL63o{Oe{C%U&WHFxwOJS93zO5GD{-z2giTf z8y$bz#s)WAzKr<%X}p9R&L)`~q*cjcr;)%!@-Ys~zmH(iZM2~nh*&2KsiqK(CnHtH z3M#?TrkA;kKfqYc4(4N9bci;l@A8}4eHV8uTs^eW-6BBovmaBY3$AF6IfQ|E;;@M# zWf*K3!8FIC@c^ZklgwH2M#{D`E`tkJ`=r|q%)`@St2^gn{mG+F)6rEh9^2tSlB0LV z$Q{ZfNmBUzg0JLyXOERU@w-K%H|i8y5_TJ4X7JhusQZBCw?d~SJuPtj+Y1KFKH@K% z#k^+lOm^6ewd(c;GH|usztWA(cN+6fg85A1IOL9!5@TBbw~qn5e&Y?_u2pll^Bx6Y zHO#hZT5^Ktb;ywMTm8Ow?eW2L2-S&E|_2BV_93CBVk4VDB*fM{6S&tg$rS!4||4 zm}lpDMft{h!suva&6#eBE=!{zre2!W%(YXSm{=s$`xcnz@%C0L`(S)?P`bhO@=~2* z@bxP+p0&+UY$_^@(Tpo!sJj*);Rsh8eza%2s=@GCcH%<4 ztCSFA;$BL*x1*3Vr2>Dr}q}vDQT0`ec{mw2Sc|+a0u0tf*!SAmLwJv4oDP(*gw6*NNCbvIk8Ta+|`l%T>{^3H$FES5Ss5p{lmq@eQ0t6FaKI#Sj zFC}{XG-+6%BPZRJOCDZVCJ0Gn{hrJ=!=!11*TDSCT!2IuIHLkF!UO?Xq!(sp*lX@lSVbA zI3xuyKy#ytzu*X5>4MdM~xz zv3yBFQg0|xDy~FU%7HvmrqFK>0=;m4IB9TD+?7*c*5eD}ulBv4Juo;zaLT*gH)V{E zttL439D(3|ttJr*}8?}7OiYRY-s*QpFLjz{ts zDVHtzSm|OCoUX#c25omtjX83_{8+MPkt8&JSPF&Oe?u#JRI*i<`tCUi_KCC3eAu(L zNHBkm&V;$L9mgr@aNBOIB2(n``^<&pU~evxU+Ld+e2vV(yv7e<%xY7Pai1g?>lK@f z{fbI^HgTb|xuyPYoBOZ$F6{3w7Cc+)_{X;%0lPQ$<|Ka_`b!!-;a3e|Yk>HDszObL}iE&h^q~i5=Y{XOrKUZdD`pM>FT6MS89YK!gR(g2h|AifO zY3?bJj?H$SY{h;`9$Y4u`BB7XQ2JpiIniN3x&wGVEZI9>pj+0lW^@X1*9SB+rbJPv zI$iU#k$$JVfx}Z5e122ONM#IS!RymwyhnhCo7;zodc$)x%4dW1NVcaT92*=zSM4P8{4I0Jh$c9HsF%#Ea*kA6vD%PIF z>>c`wTPn54x~AcWCGn2CSgNa98!y@)McNCFFMxlu=7hbBgr94!3$uha47r^=q%SJw z5PfZTnz3r94a~Rn#_Q_Q(9ros?fY$Nr7K9vJ^wj8g2ng#E#<^$i%l$;ze$wfCf{qu d(Tzy+Pb(aAEmflq-~7TTME}mgcBKL7^grXTLp1;Z From 4665c0d3dba93ba6b3f87c8d5a389a9248cc71fd Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 22:42:07 +0300 Subject: [PATCH 090/107] edk2: change git add, virt-launcher: Delete unnecessary locales to prepared image Signed-off-by: Nikita Korolev --- .../DBXUpdate-20230509.x64.bin | Bin images/edk2-artifact/werf.inc.yaml | 47 ++++++++++-------- images/virt-launcher/werf.inc.yaml | 21 ++++---- 3 files changed, 38 insertions(+), 30 deletions(-) rename images/edk2-artifact/{ => uefi-revocation-list}/DBXUpdate-20230509.x64.bin (100%) diff --git a/images/edk2-artifact/DBXUpdate-20230509.x64.bin b/images/edk2-artifact/uefi-revocation-list/DBXUpdate-20230509.x64.bin similarity index 100% rename from images/edk2-artifact/DBXUpdate-20230509.x64.bin rename to images/edk2-artifact/uefi-revocation-list/DBXUpdate-20230509.x64.bin diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml index 021132f44..440c5fbf7 100644 --- a/images/edk2-artifact/werf.inc.yaml +++ b/images/edk2-artifact/werf.inc.yaml @@ -8,33 +8,39 @@ final: false fromImage: base-alt-p11 git: - add: /images/{{ $.ImageName }}/ - to: / - includePaths: - - build.sh - stageDependencies: - setup: - - build.sh -- add: /images/{{ $.ImageName }}/logo - to: / - includePaths: - - Logo.bmp - stageDependencies: - setup: - - Logo.bmp -- add: /images/{{ $.ImageName }}/json to: /FIRMWARE includePaths: - - '*.json' + - logo/Logo.bmp + - json + - uefi-revocation-list stageDependencies: setup: - - '*.json' -- add: /images/{{ $.ImageName }} - to: /FIRMWARE + - '**/*' +- add: /images/{{ $.ImageName }}/ + to: / includePaths: - - 'DBXUpdate-20230509.x64.bin' + - build.sh stageDependencies: setup: - - 'DBXUpdate-20230509.x64.bin' + - build.sh + +{{/* +# - add: /images/{{ $.ImageName }}/json +# to: /FIRMWARE +# includePaths: +# - '*.json' +# stageDependencies: +# setup: +# - '*.json' +# - add: /images/{{ $.ImageName }} +# to: /FIRMWARE +# includePaths: +# - 'DBXUpdate-20230509.x64.bin' +# stageDependencies: +# setup: +# - 'DBXUpdate-20230509.x64.bin' +*/}} + shell: beforeInstall: - | @@ -78,5 +84,6 @@ shell: setup: - | + ls -lah /FIRMWARE /build.sh --repo-name {{ $gitRepoName }} --branch {{ $version }} diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index ad017547f..4438ac618 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -27,16 +27,6 @@ shell: setup: # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - mv /etc/ld.so.preload.in /etc/ld.so.preload - - | - # Delete unnecessary locales - KEEP_LOCALES=("ru" "en_US" "en_GB") - EXCLUDE_PATTERN=$(printf "! -name %s " "${KEEP_LOCALES[@]}") - echo "Delete unnecessary locales" - find /usr/share/locale -mindepth 1 -maxdepth 1 -type d ${EXCLUDE_PATTERN} -exec rm -rf {} + - - # delete docs - echo "Delete docs" - rm -rf /usr/share/doc/* --- {{- $gitRepoName := "libvirt" }} @@ -146,6 +136,17 @@ shell: - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin + + - | + # Delete unnecessary locales + KEEP_LOCALES=("ru" "en_US" "en_GB") + EXCLUDE_PATTERN=$(printf "! -name %s " "${KEEP_LOCALES[@]}") + echo "Delete unnecessary locales" + find /usr/share/locale -mindepth 1 -maxdepth 1 -type d ${EXCLUDE_PATTERN} -exec rm -rf {} + + + # delete docs + echo "Delete docs" + rm -rf /usr/share/doc/* install: # Create qemu group and user. From 42d27642bccbb4f0750ba94590ee05dfdd5008f3 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 22:47:06 +0300 Subject: [PATCH 091/107] edk2: strip output for make -C BaseTools Signed-off-by: Nikita Korolev --- images/edk2-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml index 440c5fbf7..eb29d2721 100644 --- a/images/edk2-artifact/werf.inc.yaml +++ b/images/edk2-artifact/werf.inc.yaml @@ -80,7 +80,7 @@ shell: echo "Building BaseTools..." ln /usr/bin/python3 /usr/bin/python - make -C BaseTools -j$(nproc) + make -C BaseTools -j$(nproc) 2>&1 > /dev/null setup: - | From bcce785af7b813d2d3667a63646741fafaa3d330 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:01:12 +0300 Subject: [PATCH 092/107] edk2: fix git add Signed-off-by: Nikita Korolev --- images/edk2-artifact/werf.inc.yaml | 36 +++++++++++------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2-artifact/werf.inc.yaml index eb29d2721..57e13ebab 100644 --- a/images/edk2-artifact/werf.inc.yaml +++ b/images/edk2-artifact/werf.inc.yaml @@ -7,40 +7,30 @@ image: {{ $.ImageName }} final: false fromImage: base-alt-p11 git: -- add: /images/{{ $.ImageName }}/ +- add: /images/{{ $.ImageName }}/logo to: /FIRMWARE includePaths: - - logo/Logo.bmp - - json - - uefi-revocation-list + - Logo.bmp stageDependencies: setup: - '**/*' -- add: /images/{{ $.ImageName }}/ +- add: /images/{{ $.ImageName }}/json + to: /FIRMWARE + stageDependencies: + setup: + - '*.json' +- add: /images/{{ $.ImageName }}/uefi-revocation-list + to: /FIRMWARE + stageDependencies: + setup: + - '*.bin' +- add: /images/{{ $.ImageName }} to: / includePaths: - build.sh stageDependencies: setup: - build.sh - -{{/* -# - add: /images/{{ $.ImageName }}/json -# to: /FIRMWARE -# includePaths: -# - '*.json' -# stageDependencies: -# setup: -# - '*.json' -# - add: /images/{{ $.ImageName }} -# to: /FIRMWARE -# includePaths: -# - 'DBXUpdate-20230509.x64.bin' -# stageDependencies: -# setup: -# - 'DBXUpdate-20230509.x64.bin' -*/}} - shell: beforeInstall: - | From 35bef1e66687ed78ea6e202ee7e3891d84b22d1d Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:03:48 +0300 Subject: [PATCH 093/107] edk,qemu,libvirt: rename, remove 'artifact' Signed-off-by: Nikita Korolev --- images/{edk2-artifact => edk2}/build.sh | 0 .../json/40-edk2-ovmf-x64-sb.json | 0 .../json/50-edk2-ovmf-x64-nosb.json | 0 .../json/60-edk2-ovmf-x64-amdsev.json | 0 .../json/60-edk2-ovmf-x64-inteltdx.json | 0 images/{edk2-artifact => edk2}/logo/Logo.bmp | Bin images/{edk2-artifact => edk2}/logo/README.md | 0 images/{edk2-artifact => edk2}/logo/bmp-info.py | 0 .../uefi-revocation-list/DBXUpdate-20230509.x64.bin | Bin images/{edk2-artifact => edk2}/werf.inc.yaml | 0 .../install-libvirt.sh | 0 images/{libvirt-artifact => libvirt}/werf.inc.yaml | 0 images/{qemu-artifact => qemu}/install-qemu.sh | 0 images/{qemu-artifact => qemu}/werf.inc.yaml | 0 images/virt-launcher/werf.inc.yaml | 8 ++++---- 15 files changed, 4 insertions(+), 4 deletions(-) rename images/{edk2-artifact => edk2}/build.sh (100%) rename images/{edk2-artifact => edk2}/json/40-edk2-ovmf-x64-sb.json (100%) rename images/{edk2-artifact => edk2}/json/50-edk2-ovmf-x64-nosb.json (100%) rename images/{edk2-artifact => edk2}/json/60-edk2-ovmf-x64-amdsev.json (100%) rename images/{edk2-artifact => edk2}/json/60-edk2-ovmf-x64-inteltdx.json (100%) rename images/{edk2-artifact => edk2}/logo/Logo.bmp (100%) rename images/{edk2-artifact => edk2}/logo/README.md (100%) rename images/{edk2-artifact => edk2}/logo/bmp-info.py (100%) rename images/{edk2-artifact => edk2}/uefi-revocation-list/DBXUpdate-20230509.x64.bin (100%) rename images/{edk2-artifact => edk2}/werf.inc.yaml (100%) rename images/{libvirt-artifact => libvirt}/install-libvirt.sh (100%) rename images/{libvirt-artifact => libvirt}/werf.inc.yaml (100%) rename images/{qemu-artifact => qemu}/install-qemu.sh (100%) rename images/{qemu-artifact => qemu}/werf.inc.yaml (100%) diff --git a/images/edk2-artifact/build.sh b/images/edk2/build.sh similarity index 100% rename from images/edk2-artifact/build.sh rename to images/edk2/build.sh diff --git a/images/edk2-artifact/json/40-edk2-ovmf-x64-sb.json b/images/edk2/json/40-edk2-ovmf-x64-sb.json similarity index 100% rename from images/edk2-artifact/json/40-edk2-ovmf-x64-sb.json rename to images/edk2/json/40-edk2-ovmf-x64-sb.json diff --git a/images/edk2-artifact/json/50-edk2-ovmf-x64-nosb.json b/images/edk2/json/50-edk2-ovmf-x64-nosb.json similarity index 100% rename from images/edk2-artifact/json/50-edk2-ovmf-x64-nosb.json rename to images/edk2/json/50-edk2-ovmf-x64-nosb.json diff --git a/images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json b/images/edk2/json/60-edk2-ovmf-x64-amdsev.json similarity index 100% rename from images/edk2-artifact/json/60-edk2-ovmf-x64-amdsev.json rename to images/edk2/json/60-edk2-ovmf-x64-amdsev.json diff --git a/images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json b/images/edk2/json/60-edk2-ovmf-x64-inteltdx.json similarity index 100% rename from images/edk2-artifact/json/60-edk2-ovmf-x64-inteltdx.json rename to images/edk2/json/60-edk2-ovmf-x64-inteltdx.json diff --git a/images/edk2-artifact/logo/Logo.bmp b/images/edk2/logo/Logo.bmp similarity index 100% rename from images/edk2-artifact/logo/Logo.bmp rename to images/edk2/logo/Logo.bmp diff --git a/images/edk2-artifact/logo/README.md b/images/edk2/logo/README.md similarity index 100% rename from images/edk2-artifact/logo/README.md rename to images/edk2/logo/README.md diff --git a/images/edk2-artifact/logo/bmp-info.py b/images/edk2/logo/bmp-info.py similarity index 100% rename from images/edk2-artifact/logo/bmp-info.py rename to images/edk2/logo/bmp-info.py diff --git a/images/edk2-artifact/uefi-revocation-list/DBXUpdate-20230509.x64.bin b/images/edk2/uefi-revocation-list/DBXUpdate-20230509.x64.bin similarity index 100% rename from images/edk2-artifact/uefi-revocation-list/DBXUpdate-20230509.x64.bin rename to images/edk2/uefi-revocation-list/DBXUpdate-20230509.x64.bin diff --git a/images/edk2-artifact/werf.inc.yaml b/images/edk2/werf.inc.yaml similarity index 100% rename from images/edk2-artifact/werf.inc.yaml rename to images/edk2/werf.inc.yaml diff --git a/images/libvirt-artifact/install-libvirt.sh b/images/libvirt/install-libvirt.sh similarity index 100% rename from images/libvirt-artifact/install-libvirt.sh rename to images/libvirt/install-libvirt.sh diff --git a/images/libvirt-artifact/werf.inc.yaml b/images/libvirt/werf.inc.yaml similarity index 100% rename from images/libvirt-artifact/werf.inc.yaml rename to images/libvirt/werf.inc.yaml diff --git a/images/qemu-artifact/install-qemu.sh b/images/qemu/install-qemu.sh similarity index 100% rename from images/qemu-artifact/install-qemu.sh rename to images/qemu/install-qemu.sh diff --git a/images/qemu-artifact/werf.inc.yaml b/images/qemu/werf.inc.yaml similarity index 100% rename from images/qemu-artifact/werf.inc.yaml rename to images/qemu/werf.inc.yaml diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 4438ac618..bd5cc3fee 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -51,7 +51,7 @@ import: includePaths: - usr -- image: edk2-artifact +- image: edk2 add: /FIRMWARE/ to: /usr/share/edk2/ovmf # to: /usr/share/OVMF @@ -62,7 +62,7 @@ import: - '*.efi' - '*.iso' -- image: edk2-artifact +- image: edk2 add: /FIRMWARE/ to: /usr/share/qemu/firmware before: install @@ -215,11 +215,11 @@ image: {{ $.ImageName }}-merge-qemu-libvirt-binaries final: false fromImage: base-alt-p11 import: -- image: libvirt-artifact +- image: libvirt add: /BINS to: /libvirt-bins before: install -- image: qemu-artifact +- image: qemu add: /BINS to: /qemu-bins before: install From 2bd6fd8bdcdb22dd8fe5bbaa49e1b1ad15f49ff2 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:07:46 +0300 Subject: [PATCH 094/107] edk2: fix git add json,uefi Signed-off-by: Nikita Korolev --- images/edk2/werf.inc.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index 57e13ebab..900813f36 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -14,13 +14,17 @@ git: stageDependencies: setup: - '**/*' -- add: /images/{{ $.ImageName }}/json +- add: /images/{{ $.ImageName }} to: /FIRMWARE + includePaths: + - json stageDependencies: setup: - '*.json' -- add: /images/{{ $.ImageName }}/uefi-revocation-list +- add: /images/{{ $.ImageName }} to: /FIRMWARE + includePaths: + - uefi-revocation-list stageDependencies: setup: - '*.bin' From ee15ca7bb735da65a2742dff2cd265938ec68e43 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:18:39 +0300 Subject: [PATCH 095/107] edk2: fix scrip and git add Signed-off-by: Nikita Korolev --- images/edk2/build.sh | 6 +++++- images/edk2/werf.inc.yaml | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/images/edk2/build.sh b/images/edk2/build.sh index 1a309b1bc..c097c3cc7 100755 --- a/images/edk2/build.sh +++ b/images/edk2/build.sh @@ -31,6 +31,10 @@ EOF parse_args() { while [[ $# -gt 0 ]]; do case "$1" in + --debug) + set -x + shift + ;; --branch) if [[ -n "$2" && "$2" != "-"* ]]; then edk2Branch="$2" @@ -77,7 +81,7 @@ fi EDK2_DIR="/${gitRepoName}-${edk2Branch}" FIRMWARE="/FIRMWARE" -cp -f Logo.bmp $EDK2_DIR/MdeModulePkg/Logo/ +mv -f Logo.bmp $EDK2_DIR/MdeModulePkg/Logo/ echo "=== cd $EDK2_DIR ===" cd $EDK2_DIR diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index 900813f36..99b062735 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -7,34 +7,34 @@ image: {{ $.ImageName }} final: false fromImage: base-alt-p11 git: +- add: /images/{{ $.ImageName }} + to: / + includePaths: + - build.sh + stageDependencies: + setup: + - build.sh - add: /images/{{ $.ImageName }}/logo - to: /FIRMWARE + to: / includePaths: - Logo.bmp stageDependencies: setup: - '**/*' -- add: /images/{{ $.ImageName }} +- add: /images/{{ $.ImageName }}/json to: /FIRMWARE includePaths: - - json + - '*.json' stageDependencies: setup: - '*.json' -- add: /images/{{ $.ImageName }} +- add: /images/{{ $.ImageName }}/uefi-revocation-list to: /FIRMWARE includePaths: - - uefi-revocation-list + - '*.bin' stageDependencies: setup: - '*.bin' -- add: /images/{{ $.ImageName }} - to: / - includePaths: - - build.sh - stageDependencies: - setup: - - build.sh shell: beforeInstall: - | From 6eddc581a16b61da2c0c68180eadb6395bd19d35 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:27:14 +0300 Subject: [PATCH 096/107] libvirt: add ccache env Signed-off-by: Nikita Korolev --- images/libvirt/werf.inc.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/images/libvirt/werf.inc.yaml b/images/libvirt/werf.inc.yaml index b1b7a328d..7fb2bb7cf 100644 --- a/images/libvirt/werf.inc.yaml +++ b/images/libvirt/werf.inc.yaml @@ -113,8 +113,10 @@ shell: install: - | - # export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" - # export PATH="$CCACHE_WRAPPERSDIR:$PATH" + export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" + export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + export CCACHE_BASEDIR="$(pwd)" + export PATH="$CCACHE_WRAPPERSDIR:$PATH" export MAKE="/usr/bin/make" export NINJA="/usr/bin/ninja" export PYTHON="/usr/bin/python3" From 21144581d684f942ef246ccaec76220ac0cc3d65 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:38:59 +0300 Subject: [PATCH 097/107] docs: update README.md in '/cv/' Signed-off-by: Nikita Korolev --- cv/README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cv/README.md b/cv/README.md index 56638134a..ee6113024 100644 --- a/cv/README.md +++ b/cv/README.md @@ -1,9 +1,14 @@ - # Component versions **permalink: /cv/** -Component Versions contains the following components: -Hypeervisor: -- qemu: 9.2.0 -- libvirt: 10.9.0 -- edk2: stable202411 \ No newline at end of file +The `version_map.yaml` file appears to be a configuration file that maps specific software components to their respective versions. This type of file is commonly used to manage and track the versions of dependencies or tools used in a project. + +## Purpose of version_map.yaml: +### Version Management: +It specifies the exact versions of software components that are required or recommended for a particular setup. This ensures consistency and reproducibility. + +### Dependency Tracking: +Keep track of the versions of critical tools or libraries that their project depends on. + +### Documentation: +It serves as a reference for anyone working on the project, making it clear which versions of the software components are being used. From eb8d6839a0b1be36169c4fdba3d5d390719eba9d Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:42:53 +0300 Subject: [PATCH 098/107] virt-launcher: add env for locale Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index bd5cc3fee..068cbd813 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -27,6 +27,10 @@ shell: setup: # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - mv /etc/ld.so.preload.in /etc/ld.so.preload +docker: + ENV: + LANG: en_US.UTF-8 + LC_ALL: en_US.UTF-8 --- {{- $gitRepoName := "libvirt" }} From c39363b43a8a08b870b1c1cab9f72b22d4ba0b85 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:51:15 +0300 Subject: [PATCH 099/107] virt-launcher: merge images vl-lib-builder vl-liboverride-builder Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 068cbd813..3b2e7672e 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -279,9 +279,17 @@ shell: ./reloclibs.sh -i "$LIST" -o /VBINS --- -image: {{ $.ImageName }}-lib-builder +image: {{ $.ImageName }}-liboverride-builder final: false fromImage: base-alt-p11 +git: + - add: /images/{{ $.ImageName }}/liboverride + to: /liboverride + includePaths: + - '*.c' + stageDependencies: + install: + - '*.c' shell: beforeInstall: # Install build packages. Pin only GCC to detect gcc updates later. @@ -299,20 +307,6 @@ shell: gcc-c++==13-alt1 - apt-get clean - rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin - ---- -image: {{ $.ImageName }}-liboverride-builder -final: false -fromImage: {{ $.ImageName }}-lib-builder -git: - - add: /images/{{ $.ImageName }}/liboverride - to: /liboverride - includePaths: - - '*.c' - stageDependencies: - install: - - '*.c' -shell: install: # Build liboverride. - cd /liboverride From cde4c92671c745530d365ce09c86ab9329ad102c Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Tue, 4 Feb 2025 23:57:21 +0300 Subject: [PATCH 100/107] qemu: remove unnecessary files that are copied through the installation script Signed-off-by: Nikita Korolev --- images/qemu/install-qemu.sh | 43 ------------------------------------- 1 file changed, 43 deletions(-) diff --git a/images/qemu/install-qemu.sh b/images/qemu/install-qemu.sh index a7f479a19..734c20d38 100755 --- a/images/qemu/install-qemu.sh +++ b/images/qemu/install-qemu.sh @@ -126,50 +126,14 @@ $SRC_BUILD/contrib/vhost-user-gpu/vhost-user-gpu to /usr/libexec $SRC_BUILD/qemu-bridge-helper to /usr/libexec $SRC_BUILD/qemu-pr-helper to /usr/bin $SRC_BUILD/qemu-vmsr-helper to /usr/bin -# $SRC_BUILD/pc-bios/edk2-aarch64-code.fd to /usr/share/qemu -# $SRC_BUILD/pc-bios/edk2-arm-code.fd to /usr/share/qemu -# $SRC_BUILD/pc-bios/edk2-arm-vars.fd to /usr/share/qemu -# $SRC_BUILD/pc-bios/edk2-riscv-code.fd to /usr/share/qemu -# $SRC_BUILD/pc-bios/edk2-riscv-vars.fd to /usr/share/qemu $SRC_BUILD/pc-bios/edk2-i386-code.fd to /usr/share/qemu $SRC_BUILD/pc-bios/edk2-i386-secure-code.fd to /usr/share/qemu $SRC_BUILD/pc-bios/edk2-i386-vars.fd to /usr/share/qemu $SRC_BUILD/pc-bios/edk2-x86_64-code.fd to /usr/share/qemu $SRC_BUILD/pc-bios/edk2-x86_64-secure-code.fd to /usr/share/qemu -# $SRC_BUILD/pc-bios/edk2-loongarch64-code.fd to /usr/share/qemu -# $SRC_BUILD/pc-bios/edk2-loongarch64-vars.fd to /usr/share/qemu -# $SRC_BUILD/pc-bios/keymaps/ar to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/bepo to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/cz to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/da to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/de to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/de-ch to /usr/share/qemu/keymaps $SRC_BUILD/pc-bios/keymaps/en-gb to /usr/share/qemu/keymaps $SRC_BUILD/pc-bios/keymaps/en-us to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/es to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/et to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/fi to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/fo to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/fr to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/fr-be to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/fr-ca to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/fr-ch to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/hr to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/hu to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/is to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/it to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/ja to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/lt to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/lv to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/mk to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/nl to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/no to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/pl to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/pt to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/pt-br to /usr/share/qemu/keymaps $SRC_BUILD/pc-bios/keymaps/ru to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/th to /usr/share/qemu/keymaps -# $SRC_BUILD/pc-bios/keymaps/tr to /usr/share/qemu/keymaps $SRC_BASE/include/qemu/qemu-plugin.h to /usr/include $SRC_BASE/ui/icons/qemu_16x16.png to /usr/share/icons/hicolor/16x16/apps $SRC_BASE/ui/icons/qemu_24x24.png to /usr/share/icons/hicolor/24x24/apps @@ -232,8 +196,6 @@ $SRC_BASE/pc-bios/qemu_vga.ndrv to /usr/share/qemu $SRC_BASE/pc-bios/edk2-licenses.txt to /usr/share/qemu $SRC_BASE/pc-bios/hppa-firmware.img to /usr/share/qemu $SRC_BASE/pc-bios/hppa-firmware64.img to /usr/share/qemu -# $SRC_BASE/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin to /usr/share/qemu -# $SRC_BASE/pc-bios/opensbi-riscv64-generic-fw_dynamic.bin to /usr/share/qemu $SRC_BASE/pc-bios/npcm7xx_bootrom.bin to /usr/share/qemu $SRC_BASE/pc-bios/vof.bin to /usr/share/qemu $SRC_BASE/pc-bios/vof-nvram.bin to /usr/share/qemu @@ -243,13 +205,8 @@ $SRC_BASE/pc-bios/petalogix-s3adsp1800.dtb to /usr/share/qemu $SRC_BASE/pc-bios/petalogix-ml605.dtb to /usr/share/qemu $SRC_BUILD/pc-bios/descriptors/50-edk2-i386-secure.json to /usr/share/qemu/firmware $SRC_BUILD/pc-bios/descriptors/50-edk2-x86_64-secure.json to /usr/share/qemu/firmware -# $SRC_BUILD/pc-bios/descriptors/60-edk2-aarch64.json to /usr/share/qemu/firmware -# $SRC_BUILD/pc-bios/descriptors/60-edk2-arm.json to /usr/share/qemu/firmware $SRC_BUILD/pc-bios/descriptors/60-edk2-i386.json to /usr/share/qemu/firmware $SRC_BUILD/pc-bios/descriptors/60-edk2-x86_64.json to /usr/share/qemu/firmware -# $SRC_BUILD/pc-bios/descriptors/60-edk2-loongarch64.json to /usr/share/qemu/firmware -# $SRC_BASE/pc-bios/keymaps/sl to /usr/share/qemu/keymaps -# $SRC_BASE/pc-bios/keymaps/sv to /usr/share/qemu/keymaps EOF ) From 607f2f9a32cf471de322dbb8168a635975e39e46 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 5 Feb 2025 00:02:40 +0300 Subject: [PATCH 101/107] qemu: add comment for list of files format Signed-off-by: Nikita Korolev --- images/qemu/install-qemu.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/images/qemu/install-qemu.sh b/images/qemu/install-qemu.sh index 734c20d38..4a8b18b92 100755 --- a/images/qemu/install-qemu.sh +++ b/images/qemu/install-qemu.sh @@ -92,7 +92,9 @@ if [ -z $VERSION_NUM ]; then fi # List of files and destinations of qemu # Commented lines - binary for additional features. -# When building with support for a new feature, uncomment the necessary files +# +# The specific format of the list, 'SOURCE_FILE to DESTINATION', +# is due to the output of the installation scripts. To make it easier to add them to this list. FILE_LIST=$(cat < Date: Wed, 5 Feb 2025 00:04:16 +0300 Subject: [PATCH 102/107] libvirt: add comment for list of files format Signed-off-by: Nikita Korolev --- images/libvirt/install-libvirt.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/images/libvirt/install-libvirt.sh b/images/libvirt/install-libvirt.sh index 9c79e6618..1c5b29323 100755 --- a/images/libvirt/install-libvirt.sh +++ b/images/libvirt/install-libvirt.sh @@ -104,7 +104,10 @@ lib_version=$(convert_version $VERSION_NUM) # List of files and destinations of libvirt # Commented lines - binary for additional features. -# When building with support for a new feature, uncomment the necessary files +# +# The specific format of the list, 'SOURCE_FILE to DESTINATION', +# is due to the output of the installation scripts. To make it easier to add them to this list. + FILE_LIST=$(cat < Date: Wed, 5 Feb 2025 00:10:20 +0300 Subject: [PATCH 103/107] vl: docker env vl-prep Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index 3b2e7672e..cefca5ff2 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -27,10 +27,6 @@ shell: setup: # Configure liboverride globally. It should be done in the last stage (setup) to not break stapel commands. - mv /etc/ld.so.preload.in /etc/ld.so.preload -docker: - ENV: - LANG: en_US.UTF-8 - LC_ALL: en_US.UTF-8 --- {{- $gitRepoName := "libvirt" }} @@ -213,6 +209,10 @@ shell: # Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-launcher/BUILD.bazel #docker: # ENTRYPOINT: ["/usr/bin/virt-launcher"] +docker: + ENV: + LANG: "" + LC_ALL: POSIX --- image: {{ $.ImageName }}-merge-qemu-libvirt-binaries From 4ff061caebbc2eb344334b3d50a823ef74b78bbe Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 5 Feb 2025 09:36:42 +0300 Subject: [PATCH 104/107] virt-launcher: add comment for build virt-launcher-monitor Signed-off-by: Nikita Korolev --- images/virt-artifact/werf.inc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index 1e6a64c21..4ff2b8470 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -95,6 +95,7 @@ shell: - CGO_ENABLED=1 go build -ldflags="-s -w" -o /kubevirt-binaries/virt-handler ./cmd/virt-handler/ - echo ============== Build virt-launcher-monitor ============ + # virt-launcher-monitor is wrapped in the final image. Add suffix here to prevent image size increasing as effect of file renaming. - go build -ldflags="-s -w" -o /kubevirt-binaries/virt-launcher-monitor-orig ./cmd/virt-launcher-monitor/ - echo ============== Build virt-tail ======================== From 1d5eb92cc649adb289535356d7aa6e3aeada3d4e Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 5 Feb 2025 10:32:03 +0300 Subject: [PATCH 105/107] chnage hypervison to firmware Signed-off-by: Nikita Korolev --- cv/version_map.yml | 2 +- werf.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cv/version_map.yml b/cv/version_map.yml index 0881c84b8..7319b6102 100644 --- a/cv/version_map.yml +++ b/cv/version_map.yml @@ -1,4 +1,4 @@ -hypervisor: +firmware: qemu: 9.2.0 libvirt: 10.9.0 edk2: stable202411 diff --git a/werf.yaml b/werf.yaml index e1abe7482..013438029 100644 --- a/werf.yaml +++ b/werf.yaml @@ -49,7 +49,7 @@ configVersion: 1 # Component versions {{ $_ := set . "Version" dict }} {{- $versions_ctx := (.Files.Get "cv/version_map.yml" | fromYaml) }} -{{- range $k, $v := $versions_ctx.hypervisor }} +{{- range $k, $v := $versions_ctx.firmware }} {{- $_ := set $.Version $k $v}} {{- end }} From 274e1aedd9d9f4bf0d471d9d57ea3c0d97319507 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 5 Feb 2025 15:39:51 +0300 Subject: [PATCH 106/107] edk2: rm ls in install stage Signed-off-by: Nikita Korolev --- images/edk2/werf.inc.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index 99b062735..c86d8e418 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -78,6 +78,5 @@ shell: setup: - | - ls -lah /FIRMWARE /build.sh --repo-name {{ $gitRepoName }} --branch {{ $version }} From 22b4686c2785e3b75f316f91c44f06dab4b1f9da Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Wed, 5 Feb 2025 17:10:50 +0300 Subject: [PATCH 107/107] virt-launcher: fix creating symlink Signed-off-by: Nikita Korolev --- images/virt-launcher/werf.inc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/virt-launcher/werf.inc.yaml b/images/virt-launcher/werf.inc.yaml index cefca5ff2..1352b62cb 100644 --- a/images/virt-launcher/werf.inc.yaml +++ b/images/virt-launcher/werf.inc.yaml @@ -191,8 +191,8 @@ shell: while IFS= read -r LINE; do echo "Create symlinc for $LINE" - TARGET=$(echo $LINE | awk -F' to ' '{print $1}') - SYMLINK=$(echo $LINE | awk -F' to ' '{print $2}') + TARGET=$(echo $LINE | awk -F' ' '{print $1}') + SYMLINK=$(echo $LINE | awk -F' ' '{print $2}') ln -s $TARGET $SYMLINK done <<< "$SYMLINC_LIST" cd /