Revert "Consolidate QEMU backend arch patch, extend to s390x"

This reverts commit 12ca18128e.
This commit is contained in:
Andrew Lukoshko 2026-04-24 09:59:24 +02:00
parent 12ca18128e
commit 081c5642d7
3 changed files with 92 additions and 263 deletions

View File

@ -0,0 +1,88 @@
From dffd32bb5418f6eb183bf8518dd1d82d70463c94 Mon Sep 17 00:00:00 2001
From: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
Date: Thu, 2 Nov 2023 16:09:37 +0400
Subject: [PATCH 1/1] Add AArch64 and ppc64le support to QEMU backend
Disable audio device support since it's not available
in the QEMU of Enterprise Linux on AArch64 and ppc64le
AArch64:
- Use XHCI (qemu-xhci) as USB controller.
It's more modern than nec-usb-xhci
which is not available in the QEMU of Enterprise Linux
ppc64le:
- Use VirtIO Keyboard as a keyboard device.
- Use VirtIO Tablet as a tablet device.
- Do not remove floppy drive device since it's not supported.
Note: originally this patch also disabled boot-order (`-boot once=d` /
`-boot order=`). That turned out to be wrong - QEMU spapr (pseries)
does honor these flags, and without them install tests that supply
both an ISO and an HDD_1 boot the HDD instead of the installer CD on
ppc64le. The boot-order disable has been dropped so ppc64le behaves
like x86_64.
Signed-off-by: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
---
backend/qemu.pm | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/backend/qemu.pm b/backend/qemu.pm
index 0a6275f4..904ec7bf 100644
--- a/backend/qemu.pm
+++ b/backend/qemu.pm
@@ -746,6 +746,7 @@ sub start_qemu ($self) {
$arch = 'arm' if ($arch =~ /armv6|armv7/);
my $is_arm = $arch eq 'aarch64' || $arch eq 'arm';
my $is_s390x = $arch eq 's390x';
+ my $is_ppc64le = $arch eq 'ppc64le';
$self->_set_graphics_backend($is_arm);
@@ -762,7 +763,10 @@ sub start_qemu ($self) {
$arch_supports_boot_order = 0;
$use_virtio_kbd = 1;
}
- elsif ($vars->{OFW}) {
+ elsif ($is_ppc64le) {
+ $use_virtio_kbd = 1;
+ }
+ elsif ($vars->{OFW} && !$is_ppc64le) {
$use_usb_kbd = $self->qemu_params_ofw;
}
@@ -851,7 +856,7 @@ sub start_qemu ($self) {
sp('chardev', 'ringbuf,id=serial0,logfile=serial0,logappend=on');
sp('serial', 'chardev:serial0');
- if (!$is_s390x) {
+ if (!$is_s390x && !$is_arm && !$is_ppc64le) {
if ($self->requires_audiodev) {
my $audiodev = $vars->{QEMU_AUDIODEV} // 'intel-hda';
my $audiobackend = $vars->{QEMU_AUDIOBACKEND} // 'none';
@@ -869,7 +874,7 @@ sub start_qemu ($self) {
}
{
# Remove floppy drive device on architectures
- sp('global', 'isa-fdc.fdtypeA=none') unless ($is_arm || $is_s390x || $vars->{QEMU_NO_FDC_SET});
+ sp('global', 'isa-fdc.fdtypeA=none') unless ($is_arm || $is_s390x || $is_ppc64le || $vars->{QEMU_NO_FDC_SET});
sp('m', $vars->{QEMURAM}) if $vars->{QEMURAM};
sp('machine', $vars->{QEMUMACHINE}) if $vars->{QEMUMACHINE};
@@ -952,8 +957,8 @@ sub start_qemu ($self) {
}
unless ($vars->{QEMU_NO_TABLET}) {
- sp('device', ($vars->{OFW} || $arch eq 'aarch64') ? 'nec-usb-xhci' : $is_s390x ? 'virtio-tablet' : 'qemu-xhci');
- sp('device', 'usb-tablet') unless $is_s390x;
+ sp('device', ($vars->{OFW} && !$is_ppc64le) ? 'nec-usb-xhci' : ($is_s390x || $is_ppc64le) ? 'virtio-tablet' : 'qemu-xhci');
+ sp('device', 'usb-tablet') unless ($is_s390x || $is_ppc64le);
}
sp('device', 'usb-kbd') if $use_usb_kbd;
--
2.41.0

View File

@ -1,248 +0,0 @@
From: Andrew Lukoshko <alukoshko@almalinux.org>
Subject: [PATCH] Add AArch64, ppc64le, and s390x support to QEMU backend
Consolidated replacement for 0001-Add-AArch64-and-ppc64le-support-to-QEMU-
backend.patch. Adds s390x-specific hunks on top of the existing AArch64/
ppc64le support, including:
- virtio-keyboard device for both s390x and ppc64le (via $use_virtio_kbd)
- virtio-rng (CCW) instead of virtio-rng-pci on s390x
- virtio-tablet + no usb-tablet on s390x and ppc64le
- Gate audio and floppy devices out on s390x as well
- PXE bootindex on NIC devices when PXEBOOT is set
- BOOTFROM=n/net parsing for network boot
- virtio-gpu added to EDID-capable device list
- Drop unused save_storage_drives sub
- Default _serialdev to ttysclp0 on ARCH=s390x+BACKEND=qemu (testapi.pm)
The ppc64le branch intentionally does NOT disable arch_supports_boot_order
(pseries/SLOF honors -boot once=d); this preserves the behavior introduced
by the recent revision of the AArch64/ppc64le patch.
Signed-off-by: Andrew Lukoshko <alukoshko@almalinux.org>
---
diff -urN a/backend/qemu.pm b/backend/qemu.pm
--- a/backend/qemu.pm 2023-07-28 12:33:57.000000000 +0200
+++ b/backend/qemu.pm 2026-04-24 09:52:10.297403944 +0200
@@ -696,6 +696,7 @@
$arch = 'arm' if ($arch =~ /armv6|armv7/);
my $is_arm = $arch eq 'aarch64' || $arch eq 'arm';
my $is_s390x = $arch eq 's390x';
+ my $is_ppc64le = $arch eq 'ppc64le';
$self->_set_graphics_backend($is_arm);
@@ -712,7 +713,10 @@
$arch_supports_boot_order = 0;
$use_virtio_kbd = 1;
}
- elsif ($vars->{OFW}) {
+ elsif ($is_ppc64le) {
+ $use_virtio_kbd = 1;
+ }
+ elsif ($vars->{OFW} && !$is_ppc64le) {
$use_usb_kbd = $self->qemu_params_ofw;
}
@@ -801,7 +805,7 @@
sp('chardev', 'ringbuf,id=serial0,logfile=serial0,logappend=on');
sp('serial', 'chardev:serial0');
- if (!$is_s390x) {
+ if (!$is_s390x && !$is_arm && !$is_ppc64le) {
if ($self->requires_audiodev) {
my $audiodev = $vars->{QEMU_AUDIODEV} // 'intel-hda';
my $audiobackend = $vars->{QEMU_AUDIOBACKEND} // 'none';
@@ -902,8 +906,8 @@
}
unless ($vars->{QEMU_NO_TABLET}) {
- sp('device', ($vars->{OFW} || $arch eq 'aarch64') ? 'nec-usb-xhci' : $is_s390x ? 'virtio-tablet' : 'qemu-xhci');
- sp('device', 'usb-tablet') unless $is_s390x;
+ sp('device', ($vars->{OFW} && !$is_arm && !$is_ppc64le) ? 'nec-usb-xhci' : ($is_s390x || $is_ppc64le) ? 'virtio-tablet' : 'qemu-xhci');
+ sp('device', 'usb-tablet') unless ($is_s390x || $is_ppc64le);
}
sp('device', 'usb-kbd') if $use_usb_kbd;
diff -urN a/testapi.pm b/testapi.pm
--- a/testapi.pm 2023-07-28 12:33:57.000000000 +0200
+++ b/testapi.pm 2026-04-24 09:52:10.294187810 +0200
@@ -53,7 +53,7 @@
become_root x11_start_program ensure_installed eject_cd power
switch_network
- save_memory_dump freeze_vm resume_vm
+ save_memory_dump save_storage_drives freeze_vm resume_vm
diag hashed_string
@@ -446,7 +446,7 @@
=head2 assert_and_click
- assert_and_click($mustmatch [, timeout => $timeout] [, button => $button] [, clicktime => $clicktime ] [, dclick => 1 ] [, mousehide => 1 ] [, point_id => $id ]);
+ assert_and_click($mustmatch [, timeout => $timeout] [, button => $button] [, clicktime => $clicktime ] [, dclick => 1 ] [, mousehide => 1 ]);
Wait for needle with C<$mustmatch> tag to appear on SUT screen. Then click
C<$button> at the "click_point" position as defined in the needle JSON file,
@@ -455,9 +455,7 @@
be string or C<ARRAYREF> of strings (C<['tag1', 'tag2']>). C<$button> is by
default C<'left'>. C<'left'> and C<'right'> is supported. If C<$mousehide> is
true then always move mouse to the 'hidden' position after clicking to prevent
-to hide the area where the user wants to assert/click in the second step. If
-C<$point_id> is specified, the clickpoint used will be the one with a matching
-ID.
+to hide the area where user wants to assert/click in second step.
Throws C<FailedNeedle> exception if C<$timeout> timeout is hit. Default timeout is 30s.
@@ -469,23 +467,22 @@
$last_matched_needle = assert_screen($mustmatch, $args{timeout});
bmwqemu::log_call(mustmatch => $mustmatch, %args);
- my %click_args = map { $_ => $args{$_} } qw(button clicktime dclick mousehide point_id);
+ my %click_args = map { $_ => $args{$_} } qw(button clicktime dclick mousehide);
return click_lastmatch(%click_args);
}
=head2 click_lastmatch
- click_lastmatch([, button => $button] [, clicktime => $clicktime ] [, dclick => 1 ] [, mousehide => 1 ] [, point_id => $id ]);
+ click_lastmatch([, button => $button] [, clicktime => $clicktime ] [, dclick => 1 ] [, mousehide => 1 ]);
Click C<$button> at the "click_point" position as defined in the needle JSON file
of the last matched needle, or - if the JSON has not explicit "click_point" -
in the middle of the last match area. If C<$dclick> is set, do double click
instead. Supported values for C<$button> are C<'left'> and C<'right'>, C<'left'>
is the default. If C<$mousehide> is true then always move mouse to the 'hidden'
-position after clicking to prevent to disturb the area where the user wants to
-assert/click in the second step, otherwise move the mouse back to its previous
-position. If C<$point_id> is specified, the clickpoint used will be the one
-with a matching ID.
+position after clicking to prevent to disturb the area where user wants to
+assert/click in second step, otherwise move the mouse back to its previous
+position.
=cut
@@ -493,7 +490,6 @@
$args{button} //= 'left';
$args{dclick} //= 0;
$args{mousehide} //= 0;
- $args{point_id} //= undef;
return unless $last_matched_needle;
@@ -504,7 +500,6 @@
my $relative_click_point;
for my $area (reverse @{$last_matched_needle->{area}}) {
next unless ($relative_click_point = $area->{click_point});
- next if defined $args{point_id} && $relative_click_point->{id} ne $args{point_id};
$relevant_area = $area;
last;
}
@@ -929,7 +924,7 @@
=head2 script_run
- script_run($cmd [, timeout => $timeout] [, output => ''] [, quiet => $quiet] [, die_on_timeout => 1]);
+ script_run($cmd [, timeout => $timeout] [, output => ''] [, quiet => $quiet] [, die_on_timeout => -1]);
Deprecated mode
@@ -942,10 +937,9 @@
C<$output> can be used as an explanatory text that will be displayed with the execution of
the command.
-By default C<script_run> will throw an exception if the timeout has expired.
-This is equivalent to use of C<die_on_timeout> equal to 1. To use the
-deprecated behaviour of not throwing an error on timeout set the value to 0.
-This option will be removed in the near future.
+With C<die_on_timeout> -1 (default) a warning will be printed to log. To avoid
+this warning, set it explicit to 0. With C<die_on_timeout> equal to 1, this command
+throw an exception, if timeout expires.
<Returns> exit code received from I<$cmd> or undef if C<$timeout> is 0 or timeout
expired and C<die_on_timeout> is not C<1>.
@@ -969,20 +963,23 @@
}, ['timeout'], @_);
bmwqemu::log_call(cmd => $cmd, %args);
- my $die_on_timeout = delete $args{die_on_timeout} // 1;
+ my $die_on_timeout = delete $args{die_on_timeout};
my $ret = $distri->script_run($cmd, %args);
if ($args{timeout} > 0) {
- if ($die_on_timeout == 0) {
- # This is to warn users of deprecated behaviour of script_run()
- my ($package, $filename, $line) = caller;
- my $casedir = testapi::get_var(CASEDIR => '');
- $filename =~ s%^\Q$casedir\E/%%;
- bmwqemu::fctwarn("DEPRECATED call of script_run() in $filename:$line " .
- 'requested by `die_on_timeout => 0` or set
- $distri->{script_run_die_on_timeout}. Adapt the test code to work
- with the default. This workaround will be removed in the near future');
- } else {
+ if ($die_on_timeout > 0) {
croak("command '$cmd' timed out") if !defined($ret);
+ } else {
+ # This is to warn users of script_run(), if they do not use
+ # die_on_timeout => 0 explicit.
+ if ($die_on_timeout < 0) {
+ my ($package, $filename, $line) = caller;
+ my $casedir = testapi::get_var(CASEDIR => '');
+ $filename =~ s%^\Q$casedir\E/%%;
+ bmwqemu::fctwarn("DEPRECATED call of script_run() in $filename:$line " .
+ 'add `die_on_timeout => ?` to the call or set
+ $distri->{script_run_die_on_timeout} to avoid this
+ warning');
+ }
}
}
return $ret;
@@ -1929,6 +1926,36 @@
query_isotovideo('backend_save_memory_dump', \%nargs);
}
+=head2 save_storage_drives
+
+ save_storage_drives([$filename]);
+
+Saves all of the SUT drives using C<$filename> as part of the final filename,
+the default will be the current test's name. The disk number will be always present.
+
+This method must be called within a post_fail_hook.
+
+I<Currently only qemu backend is supported.>
+
+=cut
+
+sub save_storage_drives ($filename = undef) {
+ $filename //= $autotest::current_test->{name};
+ die "save_storage_drives should be called within a post_fail_hook" unless ((caller(1))[3]) =~ /post_fail_hook/;
+
+ bmwqemu::log_call();
+ bmwqemu::diag("Trying to save machine drives");
+ bmwqemu::load_vars();
+
+ # Right now, we're saving all the disks
+ # sometimes we might not want to. This could be improved.
+ if (my $nd = $bmwqemu::vars{NUMDISKS}) {
+ for my $i (1 .. $nd) {
+ query_isotovideo('backend_save_storage_drives', {disk => $i, filename => $filename});
+ }
+ }
+}
+
=head2 freeze_vm
freeze_vm;
@@ -2137,7 +2164,7 @@
$cmd .= autoinst_url("/uploadlog/$basename");
if ($failok) {
# just use script_run so we don't care if the upload fails
- script_run($cmd, $timeout);
+ script_run($cmd, $timeout, die_on_timeout => 1);
}
else {
assert_script_run($cmd, $timeout);

View File

@ -37,7 +37,7 @@
Name: os-autoinst
Version: %{github_version}%{?github_date:^%{github_date}git%{shortcommit}}
Release: 5%{?dist}
Release: 4%{?dist}
Summary: OS-level test automation
License: GPLv2+
URL: https://os-autoinst.github.io/openQA/
@ -49,10 +49,9 @@ Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{gith
Patch0: os-autoinst-enable-multifd-support.patch
# AlmaLinux-specific: adjust the QEMU backend for the QEMU build shipped
# in Enterprise Linux on AArch64, ppc64le, and s390x (USB/keyboard/tablet
# wiring, disable audio, gate floppy handling, add virtio devices, PXE
# bootindex, BOOTFROM=n, ttysclp0 default serial device on s390x)
Patch1: 0001-Add-AArch64-ppc64le-s390x-support.patch
# in Enterprise Linux on AArch64 and ppc64le (USB/keyboard/tablet wiring,
# disable audio, drop unsupported boot order and floppy handling)
Patch1: 0001-Add-AArch64-and-ppc64le-support-to-QEMU-backend.patch
# on SUSE this is conditional, for us it doesn't have to be but we
# still use a macro just to keep build_requires similar for ease of
@ -256,16 +255,6 @@ rm tools/lib/perlcritic/Perl/Critic/Policy/*.pm
%files devel
%changelog
* Fri Apr 24 2026 Andrew Lukoshko <alukoshko@almalinux.org> - 4.6^20230731git6c17e24-5
- Replace 0001-Add-AArch64-and-ppc64le-support-to-QEMU-backend.patch with
a consolidated 0001-Add-AArch64-ppc64le-s390x-support.patch that also
covers s390x: virtio-keyboard on s390x and ppc64le, virtio-rng (CCW)
and virtio-tablet on s390x, gate audio and floppy devices out on s390x,
PXE bootindex on NIC, BOOTFROM=n/net parsing, virtio-gpu added to EDID
list, drop unused save_storage_drives sub, default _serialdev to
ttysclp0 for ARCH=s390x with BACKEND=qemu (testapi.pm). Keeps the
ppc64le arch_supports_boot_order fix from -4.
* Thu Apr 23 2026 Andrew Lukoshko <alukoshko@almalinux.org> - 4.6^20230731git6c17e24-4
- Drop the ppc64le "disable arch_supports_boot_order" bit from the
AArch64/ppc64le QEMU backend patch. QEMU spapr supports -boot