From nobody Tue Feb 10 20:07:19 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1682610429; cv=none; d=zohomail.com; s=zohoarc; b=h5r3Tqmk5HbjRVPOpwr++BDkRIBxhjlG04vQE0TlvtZ6dTzhgdc6hwaFoR4MZakgsl9OlUC7hMIywaiDGs8D1O+KLCeg3iFxRI2qs3fc9SmM8c9YsMPZ/oqgkaG7a3qxfM4KNdkwAgzCFmGEZroEde+DUaJDgaBvKXn9vz4TMP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682610429; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m3zAanYebbZhFO73oDp9ANAxrPZGnhSnFIhjJ3ZsGEU=; b=clWHLksRQprLOCjGFgKOEJgT+Y/74FG+MWxDIw6GBJNQNJxmI1MLyrRvnyyx/K9qcgGoW9bQFsdfX3X/UuHb/DNfgZUD2udOM27bEwx42a/6Azvhf9Pocl5KhDorNXVm9bIhZ0LPti84/KKc0uX3nXMuuTfaw0H5QJcBJ+J/iuo= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682610429733659.6953683746254; Thu, 27 Apr 2023 08:47:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3oL-0001vu-6s; Thu, 27 Apr 2023 11:45:34 -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 1ps3o6-0001pH-Lo for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:45:18 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ps3o2-0004j0-Hh for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:45:17 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f19a80a330so41743735e9.2 for ; Thu, 27 Apr 2023 08:45:14 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id t14-20020a05600c450e00b003f0a6a1f969sm25272355wmo.46.2023.04.27.08.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 08:45:11 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0C35D1FFBB; Thu, 27 Apr 2023 16:45:11 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682610313; x=1685202313; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m3zAanYebbZhFO73oDp9ANAxrPZGnhSnFIhjJ3ZsGEU=; b=k25iDfa8qX/wTq6JpIISVl6gD01rxrFSoEX1SnovYzC0SUzx36qrPA0yBzpz7V0Vdt LCAtm0nUdFqXu+ljsWtbYqhRAugGfaNV2Cc2xh4wXY/umI91pXLmDniuVDEimCd7BPmI eZz3nh9ZUPEV/9HU/nyJlxtOQb3eRY39sdVqbAhAwyj5ksWZ33AISqOWFdCgawdgCgRo wGp4MHbzewDP3Vkj3TZhpKHhgLi4J4B7ZpMJXZkK7dujfRzjQ58IWfxdMGvOekFW6aIs wY1M0kGpM4l6fHUl/FX4oszzyt3Kz73977/+2gYhGtHTUAQLxC73diuNphBcBXDS/Joc 6jgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682610313; x=1685202313; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m3zAanYebbZhFO73oDp9ANAxrPZGnhSnFIhjJ3ZsGEU=; b=XM7OnL3RzcB+mqfuqCVJKF+z5udbNqksXyPTz/csUzJBTRPOGFV72axYYfynwo+BNS YUjuYIhvda+vWyrPAhrtry+s8i5I0wvUFNsv3vH3tjPej663YUuJw2UVRbLmKqUmVc42 WucU8OPLwxQznxi/NXBoPQlQ9xaXho/zGcf0baE3n/vaTFQ/T9RpFwq2zOYK0IyfUYbl 0Op15o+Pm3Id01iWc6LNXwU+rdXua7nOBbU1qQBY5erV3YLgKEEszXW+fwNHiUPb9/K2 5ty+L5+mg1r3DbS9z6GF27XTxert2hVh04NmMLR9130uBHbF1vOPu06ahEJh9l3oOJII 12Fg== X-Gm-Message-State: AC+VfDzlTCxpAOwSVSV4gxgM6TqxD9RaHdx0k5Hkq5uAzXXUIaOjGEpP BtiXf5TLM2xL99XHVeRR/4b/Cg== X-Google-Smtp-Source: ACHHUZ4KCY9TJsyYfIyGg73BJceTxOOg3HB2KkeRXbD/INWZbtFKLXSatad63fFuU8LBKzx98wRaXw== X-Received: by 2002:a05:600c:2155:b0:3ef:df3:1693 with SMTP id v21-20020a05600c215500b003ef0df31693mr1697370wml.32.1682610312892; Thu, 27 Apr 2023 08:45:12 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcin Juszkiewicz , Leif Lindholm , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Radoslaw Biernacki , Peter Maydell , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , qemu-arm@nongnu.org (open list:SBSA-REF) Subject: [PULL 03/18] tests/avocado: Add set of boot tests on SBSA-ref Date: Thu, 27 Apr 2023 16:44:55 +0100 Message-Id: <20230427154510.1791273-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427154510.1791273-1-alex.bennee@linaro.org> References: <20230427154510.1791273-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @linaro.org) X-ZM-MESSAGEID: 1682610431355100003 From: Philippe Mathieu-Daud=C3=A9 This change adds set of boot tests on SBSA-ref machine: 1. boot firmware up to the EDK2 banner 2. boot Alpine Linux Prebuilt flash volumes are included, built using upstream documentation. To unify tests for AArch64/virt and AArch64/sbsa-ref we boot the same Alpine Linux image on both. Signed-off-by: Marcin Juszkiewicz Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230323082813.971535-1-marcin.juszkiewicz@linaro.org> Reviewed-by: Leif Lindholm Message-Id: <20230328171426.14258-1-philmd@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230424092249.58552-4-alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index a8b942dea4..214124c84c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -943,6 +943,7 @@ L: qemu-arm@nongnu.org S: Maintained F: hw/arm/sbsa-ref.c F: docs/system/arm/sbsa.rst +F: tests/avocado/machine_aarch64_sbsaref.py =20 Sharp SL-5500 (Collie) PDA M: Peter Maydell diff --git a/tests/avocado/machine_aarch64_sbsaref.py b/tests/avocado/machi= ne_aarch64_sbsaref.py new file mode 100644 index 0000000000..0a79fa7ab6 --- /dev/null +++ b/tests/avocado/machine_aarch64_sbsaref.py @@ -0,0 +1,158 @@ +# Functional test that boots a Linux kernel and checks the console +# +# SPDX-FileCopyrightText: 2023 Linaro Ltd. +# SPDX-FileContributor: Philippe Mathieu-Daud=C3=A9 +# SPDX-FileContributor: Marcin Juszkiewicz +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os + +from avocado import skip +from avocado import skipUnless +from avocado.utils import archive + +from avocado_qemu import QemuSystemTest +from avocado_qemu import wait_for_console_pattern +from avocado_qemu import interrupt_interactive_console_until_pattern + + +class Aarch64SbsarefMachine(QemuSystemTest): + """ + :avocado: tags=3Darch:aarch64 + :avocado: tags=3Dmachine:sbsa-ref + """ + + timeout =3D 180 + + def fetch_firmware(self): + """ + Flash volumes generated using: + + - Fedora GNU Toolchain version 12.2.1 20220819 (Red Hat Cross 12.2= .1-2) + + - Trusted Firmware-A + https://github.com/ARM-software/arm-trusted-firmware/tree/5fdb2e= 54 + + - Tianocore EDK II + https://github.com/tianocore/edk2/tree/494127613b + https://github.com/tianocore/edk2-non-osi/tree/41876073 + https://github.com/tianocore/edk2-platforms/tree/8efa4f42 + """ + + # Secure BootRom (TF-A code) + fs0_xz_url =3D ( + "https://fileserver.linaro.org/s/ATnSmq6k8SoXgbH/" + "download/SBSA_FLASH0.fd.xz" + ) + fs0_xz_hash =3D "a210a09692bcbe0a3743ffd0df44e80e0c7ad8ab" + tar_xz_path =3D self.fetch_asset(fs0_xz_url, asset_hash=3Dfs0_xz_h= ash) + archive.extract(tar_xz_path, self.workdir) + fs0_path =3D os.path.join(self.workdir, "SBSA_FLASH0.fd") + + # Non-secure rom (UEFI and EFI variables) + fs1_xz_url =3D ( + "https://fileserver.linaro.org/s/t8foNnMPz74DZZy/" + "download/SBSA_FLASH1.fd.xz" + ) + fs1_xz_hash =3D "13a9a262953787c7fc5a9155dfaa26e703631e02" + tar_xz_path =3D self.fetch_asset(fs1_xz_url, asset_hash=3Dfs1_xz_h= ash) + archive.extract(tar_xz_path, self.workdir) + fs1_path =3D os.path.join(self.workdir, "SBSA_FLASH1.fd") + + for path in [fs0_path, fs1_path]: + with open(path, "ab+") as fd: + fd.truncate(256 << 20) # Expand volumes to 256MiB + + self.vm.set_console() + self.vm.add_args( + "-drive", + f"if=3Dpflash,file=3D{fs0_path},format=3Draw", + "-drive", + f"if=3Dpflash,file=3D{fs1_path},format=3Draw", + "-smp", + "1", + "-machine", + "sbsa-ref", + ) + + def test_sbsaref_edk2_firmware(self): + """ + :avocado: tags=3Dcpu:cortex-a57 + """ + + self.fetch_firmware() + self.vm.launch() + + # TF-A boot sequence: + # + # https://github.com/ARM-software/arm-trusted-firmware/blob/v2.8.0= /\ + # docs/design/trusted-board-boot.rst#trusted-board-boot-sequen= ce + # https://trustedfirmware-a.readthedocs.io/en/v2.8/\ + # design/firmware-design.html#cold-boot + + # AP Trusted ROM + wait_for_console_pattern(self, "Booting Trusted Firmware") + wait_for_console_pattern(self, "BL1: v2.8(release):v2.8") + wait_for_console_pattern(self, "BL1: Booting BL2") + + # Trusted Boot Firmware + wait_for_console_pattern(self, "BL2: v2.8(release)") + wait_for_console_pattern(self, "Booting BL31") + + # EL3 Runtime Software + wait_for_console_pattern(self, "BL31: v2.8(release)") + + # Non-trusted Firmware + wait_for_console_pattern(self, "UEFI firmware (version 1.0") + interrupt_interactive_console_until_pattern(self, "QEMU SBSA-REF M= achine") + + # This tests the whole boot chain from EFI to Userspace + # We only boot a whole OS for the current top level CPU and GIC + # Other test profiles should use more minimal boots + def boot_alpine_linux(self, cpu): + self.fetch_firmware() + + iso_url =3D ( + "https://dl-cdn.alpinelinux.org/" + "alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.= iso" + ) + + iso_hash =3D "5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e= 19c4bd9dc027" + iso_path =3D self.fetch_asset(iso_url, algorithm=3D"sha256", asset= _hash=3Diso_hash) + + self.vm.set_console() + self.vm.add_args( + "-cpu", + cpu, + "-drive", + f"file=3D{iso_path},format=3Draw", + "-device", + "virtio-rng-pci,rng=3Drng0", + "-object", + "rng-random,id=3Drng0,filename=3D/dev/urandom", + ) + + self.vm.launch() + wait_for_console_pattern(self, "Welcome to Alpine Linux 3.17") + + @skipUnless(os.getenv("AVOCADO_TIMEOUT_EXPECTED"), "Test might timeout= ") + def test_sbsaref_alpine_linux_cortex_a57(self): + """ + :avocado: tags=3Dcpu:cortex-a57 + """ + self.boot_alpine_linux("cortex-a57") + + @skipUnless(os.getenv("AVOCADO_TIMEOUT_EXPECTED"), "Test might timeout= ") + def test_sbsaref_alpine_linux_neoverse_n1(self): + """ + :avocado: tags=3Dcpu:max + """ + self.boot_alpine_linux("neoverse-n1") + + @skip("requires TF-A update to handle FEAT_FGT") + def test_sbsaref_alpine_linux_max(self): + """ + :avocado: tags=3Dcpu:max + """ + self.boot_alpine_linux("max,pauth-impdef=3Don") --=20 2.39.2