From: Claudio Fontana <cfontana@suse.de>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Cleber Rosa Junior" <crosa@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Claudio Fontana <cfontana@suse.de>,
Eduardo Habkost <ehabkost@redhat.com>,
qemu-devel@nongnu.org
Subject: [PATCH v1 2/2] tests/acceptance: add OVMF firmware test to cover x86_64 "host" cpu bug
Date: Fri, 4 Jun 2021 20:09:45 +0200 [thread overview]
Message-ID: <20210604180945.9330-3-cfontana@suse.de> (raw)
In-Reply-To: <20210604180945.9330-1-cfontana@suse.de>
recent refactoring of i386 broke OVMF firmware with a wrong initialization
order for host cpu. This test covers this issue for potential regressions.
For the actual fixes, see:
commit ("i386: run accel_cpu_instance_init as post_init"),
commit ("i386: reorder call to cpu_exec_realizefn"),
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
tests/acceptance/boot_ovmf_fc33.py | 75 ++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100644 tests/acceptance/boot_ovmf_fc33.py
diff --git a/tests/acceptance/boot_ovmf_fc33.py b/tests/acceptance/boot_ovmf_fc33.py
new file mode 100644
index 0000000000..c0c4e0e394
--- /dev/null
+++ b/tests/acceptance/boot_ovmf_fc33.py
@@ -0,0 +1,75 @@
+# Functional test that boots OVMF firmware with cpu host.
+#
+# This test was added to capture x86 "host" cpu initialization and realization
+# ordering problems.
+#
+# Copyright (c) 2021 SUSE LLC
+#
+# Author:
+# Claudio Fontana <cfontana@suse.de>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import os
+import time
+
+from avocado_qemu import Test
+from avocado_qemu import extract_from_rpm
+from avocado_qemu import wait_for_console_pattern
+from avocado.utils import process
+from avocado.utils.path import find_command, CmdNotFoundError
+
+class FirmwareTest(Test):
+ def wait_for_firmware_message(self, success_message):
+ wait_for_console_pattern(self, success_message, failure_message=None)
+
+class BootOVMF(FirmwareTest):
+ """
+ Boots OVMF secureboot and checks for a specific message.
+ If we do not see the message, it's an ERROR that we express via a timeout.
+ """
+ timeout = 10
+
+ def test_cpu_host_x86(self):
+ """
+ :avocado: tags=arch:x86_64
+ :avocado: tags=machine:q35
+ :avocado: tags=cpu:host
+ :avocado: tags=accel:kvm
+ """
+ self.require_accelerator("kvm")
+
+ rpm_url = ('https://download-ib01.fedoraproject.org/'
+ 'pub/fedora/linux/updates/33/Everything/x86_64/Packages/e/'
+ 'edk2-ovmf-20200801stable-3.fc33.noarch.rpm')
+ rpm_hash = '45e1001313dc2deed9b41a532ef090682a11ccd1'
+ rpm_path = self.fetch_asset(rpm_url, asset_hash=rpm_hash)
+
+ # Note the use of "./" at the beginning of the paths in the rpm,
+ # it is not an accident, see extract_from_rpm in avocado_qemu/
+
+ ovmf_code_sec = extract_from_rpm(self, rpm_path,
+ './usr/share/edk2/ovmf/OVMF_CODE.secboot.fd')
+ ovmf_vars_sec = extract_from_rpm(self, rpm_path,
+ './usr/share/edk2/ovmf/OVMF_VARS.secboot.fd')
+
+ # at this point the ovmf code should be reachable in the tmp dir; we
+ # can use this sleep to debug issues with the extraction above.
+ #time.sleep(3600)
+
+ self.vm.set_console()
+ self.vm.add_args(
+ '-accel', 'kvm',
+ '-cpu', 'host',
+ '-machine', 'q35,smm=on',
+ '-m', '4G',
+ '-drive',
+ 'if=pflash,format=raw,readonly=on,unit=0,file=' + ovmf_code_sec,
+ '-drive',
+ 'if=pflash,format=raw,unit=1,file=' + ovmf_vars_sec,
+ '-display', 'none',
+ '-serial', 'stdio')
+ self.vm.launch()
+ console_pattern = 'BdsDxe: failed to load Boot0001'
+ self.wait_for_firmware_message(success_message=console_pattern);
--
2.26.2
next prev parent reply other threads:[~2021-06-04 18:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 18:09 [PATCH v1 0/2] add x86 acceptance test for the "host" cpu bug Claudio Fontana
2021-06-04 18:09 ` [PATCH v1 1/2] tests/acceptance: move pkg extraction to avocado_qemu/ Claudio Fontana
2021-07-13 18:05 ` Cleber Rosa
2021-07-14 7:39 ` Claudio Fontana
2021-06-04 18:09 ` Claudio Fontana [this message]
2021-06-04 19:12 ` [PATCH v1 2/2] tests/acceptance: add OVMF firmware test to cover x86_64 "host" cpu bug Eduardo Habkost
2021-06-22 6:47 ` Claudio Fontana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210604180945.9330-3-cfontana@suse.de \
--to=cfontana@suse.de \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vkuznets@redhat.com \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).