From nobody Sun Apr 5 18:10:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774286113; cv=none; d=zohomail.com; s=zohoarc; b=j9lHYHkjg6tBfGNgjmGIea9ZyeekrNZjYO7WTEAKcXAeuthU6AXfnVLaqPwYtZQCrKzJHSUpvdOXpj3Si6WTYLGzSo05yjZ5efZH2ZLp+FufI7X0WuuupH/FUM3/uDjDL/SK3nDQcRXSoDrfTtHyZ9Eb091PdpwZAKZ1APGvvqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774286113; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZKcLN44a5EAqDQUK5Jp0uNYlSQIpUPtUV/cyjAqIGFE=; b=IsVHKWel+MHKWHUCkFbpPIHac36fl2UPd9nYUCvNsFUryv+PrQEnjYYKw0NQWcJGYBr6L5f9RPa5ghEnzyCMoQmbsh8y5groa7XG+H6tQ7nzYjEqpHjDE7gF+XywwWDWebg8txr5uLli6vk8DrAd1hmzARHV8cxlQor1oj4A7GU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774286113292711.4040893721356; Mon, 23 Mar 2026 10:15:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4irn-0002cw-Aj; Mon, 23 Mar 2026 13:15:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4irV-0002aN-Af for qemu-devel@nongnu.org; Mon, 23 Mar 2026 13:14:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4irT-0003It-9e for qemu-devel@nongnu.org; Mon, 23 Mar 2026 13:14:45 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-426-sfNDIbcYMAii6tAZ7o1dgg-1; Mon, 23 Mar 2026 13:14:39 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1A06E19560B1; Mon, 23 Mar 2026 17:14:38 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1B153300019F; Mon, 23 Mar 2026 17:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774286082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZKcLN44a5EAqDQUK5Jp0uNYlSQIpUPtUV/cyjAqIGFE=; b=eH8l5b4yxiDB8UxW+xOJnjDNlZP33PdJFke7V0G7kps/oHY8wbHMeoerUhDy85RpMvPWfq x8C+wleLrJla0U73IVVFkbn4DB6Qu+PQi5fNwG62+LnMpc80rOhTk5uhykb8zvPTfWEi0D GfKkhj49uxnItW3NDtxjARaHEs1d8fk= X-MC-Unique: sfNDIbcYMAii6tAZ7o1dgg-1 X-Mimecast-MFC-AGG-ID: sfNDIbcYMAii6tAZ7o1dgg_1774286078 From: Thomas Huth To: qemu-devel@nongnu.org, Cornelia Huck , Eric Farman Cc: qemu-s390x@nongnu.org, Matthew Rosato , Thomas Huth Subject: [PATCH] tests/functional/s390x: Add test for booting from a disk with 4k sectors Date: Mon, 23 Mar 2026 18:14:23 +0100 Message-ID: <20260323171423.112205-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774286115420154100 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The DASD disks on s390x have a different sector size (4k) and use a different layout of the boot loader data compared to the usual "SCSI"-style disks with 512 sectors that are used with most modern guests. To make sure that there are no regressions with 4k disk booting, add a test case that uses a disk image with these 4k sectors and check that we can successfully show the boot menu and and load the right kernel in all supported cases. Signed-off-by: Thomas Huth Reviewed-by: Eric Farman --- tests/functional/s390x/meson.build | 1 + tests/functional/s390x/test_boot_4k.py | 138 +++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100755 tests/functional/s390x/test_boot_4k.py diff --git a/tests/functional/s390x/meson.build b/tests/functional/s390x/me= son.build index 0f03e1c9db8..b065b666bc2 100644 --- a/tests/functional/s390x/meson.build +++ b/tests/functional/s390x/meson.build @@ -10,6 +10,7 @@ tests_s390x_system_quick =3D [ ] =20 tests_s390x_system_thorough =3D [ + 'boot_4k', 'ccw_virtio', 'pxelinux', 'replay', diff --git a/tests/functional/s390x/test_boot_4k.py b/tests/functional/s390= x/test_boot_4k.py new file mode 100755 index 00000000000..965123ebd31 --- /dev/null +++ b/tests/functional/s390x/test_boot_4k.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright 2026 Red Hat, Inc. +# +# Author: +# Thomas Huth +''' +Functional test that boots from a (incomplete) disk with 4k sectors +(DASD/ECKD geometry) and multiple kernels installed, so we can check +the boot menu and various LOADPARM options. +''' + +from qemu_test import QemuSystemTest, Asset, skipFlakyTest +from qemu_test import wait_for_console_pattern + + +class S390Boot4k(QemuSystemTest): + + # This disk image has been taken from a DASD with 4k sectors. + # Note: It's incomplete (to keep it small), it contains just enough + # data for booting the kernels that are installed on the disk image + ASSET_DISK =3D Asset( + ('https://github.com/huth/qemu-paddock/raw/refs/heads/main/s390x/' + 'f32-4k-bootmenu.raw.xz'), + 'f4e2c91b4ec50a4756e8816b7a7c8ca01cc0d929f7a711cfd8124640c304ea41') + + def wait_for_pattern(self, success_message, vm=3DNone): + wait_for_console_pattern(self, success_message, vm=3Dvm, + failure_message=3D'panic') + + def basic_machine_setup(self): + self.set_machine('s390-ccw-virtio') + disk_path =3D self.uncompress(self.ASSET_DISK, format=3D"xz") + + self.vm.set_console() + self.vm.add_args("-nographic", "-no-shutdown", "-blockdev", + f"driver=3Dfile,filename=3D{disk_path},node-name= =3Dd1") + + def test_default(self): + ''' + Check that the default kernel boots up correctly from a ccw device + ''' + self.basic_machine_setup() + self.vm.add_args("-device", "virtio-blk-ccw,drive=3Dd1") + self.vm.launch() + self.wait_for_pattern("Linux version 5.8.15-301.fc33.s390x") + self.wait_for_pattern("Trying to unpack rootfs image as initramfs") + + def test_loadparm_machine(self): + ''' + Check that we can select a kernel via "-machine loadparm=3D..." + ''' + self.basic_machine_setup() + self.vm.add_args("-device", "virtio-blk-ccw,drive=3Dd1", + "-machine", "loadparm=3D2") + self.vm.launch() + self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x") + + def test_loadparm_device(self): + ''' + Check that we can select a kernel via "-device ...,loadparm=3D..." + ''' + self.basic_machine_setup() + self.vm.add_args("-device", + "virtio-blk-ccw,drive=3Dd1,bootindex=3D1,loadparm= =3D3") + self.vm.launch() + self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x") + + @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/work_items/3350= ") + def test_loadparm_pci(self): + ''' + Check that we can select a kernel via "-device ...-pci,loadparm= =3D..." + ''' + self.require_device('virtio-blk-pci') + self.basic_machine_setup() + self.vm.add_args("-device", + "virtio-blk-pci,drive=3Dd1,bootindex=3D1,loadparm= =3D2") + self.vm.launch() + self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x") + + def test_scsi_default(self): + ''' + Check that we can boot via SCSI, too (need to set logical block si= ze + here to avoid that the auto-detection in the bios fails) + ''' + self.basic_machine_setup() + self.vm.add_args("-device", "virtio-scsi", "-device", + "scsi-hd,drive=3Dd1,physical_block_size=3D4096,logical_block_s= ize=3D4096") + self.vm.launch() + self.wait_for_pattern("Linux version 5.8.15-301.fc33.s390x") + + def test_scsi_loadparm(self): + ''' + Check that we can boot via SCSI with loadparm + ''' + self.basic_machine_setup() + self.vm.add_args("-device", "virtio-scsi", "-device", + ("scsi-hd,drive=3Dd1,bootindex=3D1,loadparm=3D3," + "physical_block_size=3D4096,logical_block_size= =3D4096")) + self.vm.launch() + self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x") + + def test_menu(self): + ''' + Check that boot menu shows up correctly + ''' + self.basic_machine_setup() + self.vm.add_args("-device", "virtio-blk-ccw,drive=3Dd1,bootindex= =3D1", + "-boot", "menu=3Don") + self.vm.launch() + self.wait_for_pattern("1. Fedora (5.8.15-301.fc33.s390x) 33") + self.wait_for_pattern("2. Fedora (5.6.6-300.fc32.s390x) 32") + self.wait_for_pattern("3. Fedora (0-rescue-b7218f0092704c5a9") + self.wait_for_pattern("Please choose:") + # For some unknown reason, sending a key to the bios does not work + # in the testing framework yet: + # exec_command_and_wait_for_pattern(self, '2', + # "Linux version 5.6.6-300.fc32.s390x= ") + + def test_menu_timeout(self): + ''' + Check that boot menu shows up and boot continues automatically + when a timeout has been specified + ''' + self.basic_machine_setup() + self.vm.add_args("-device", "virtio-blk-ccw,drive=3Dd1,bootindex= =3D1", + "-boot", "menu=3Don,splash-time=3D1") + self.vm.launch() + self.wait_for_pattern("s390-ccw zIPL Boot Menu") + self.wait_for_pattern("0. default (Fedora (5.8.15-301.fc33.s390x)") + self.wait_for_pattern("(default will boot in 0 seconds)") + self.wait_for_pattern("Linux version 5.8.15-301.fc33.s390x") + + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.53.0