From: Nicholas Piggin <npiggin@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
qemu-ppc@nongnu.org,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Warner Losh" <imp@bsdimp.com>
Subject: [PULL 09/49] tests/avocado: Add FreeBSD distro boot tests for ppc
Date: Mon, 19 Feb 2024 18:28:58 +1000 [thread overview]
Message-ID: <20240219082938.238302-10-npiggin@gmail.com> (raw)
In-Reply-To: <20240219082938.238302-1-npiggin@gmail.com>
FreeBSD project provides qcow2 images that work well for testing QEMU.
Add pseries tests for HPT and Radix, KVM and TCG. This uses a short
term VM image, because FreeBSD has not set up long term builds for
ppc64 at present.
Other architectures could be added so this does not get a ppc_ prefix
but is instead named similarly to boot_linux.
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Unfortunately the latest stable (14.0) x86-64 VM image does not seem to
output to console by default and I've not been able to find a reliable
way to edit the filesystem to change the boot loader options, or use
console input in the test case to change it on the fly.
---
tests/avocado/boot_freebsd.py | 174 ++++++++++++++++++++++++++++++++++
1 file changed, 174 insertions(+)
create mode 100644 tests/avocado/boot_freebsd.py
diff --git a/tests/avocado/boot_freebsd.py b/tests/avocado/boot_freebsd.py
new file mode 100644
index 0000000000..c01cd06cca
--- /dev/null
+++ b/tests/avocado/boot_freebsd.py
@@ -0,0 +1,174 @@
+# Functional tests that boot FreeBSD in various configurations
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# 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 subprocess
+
+from avocado import skipUnless
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+from avocado_qemu import exec_command
+from avocado.utils import archive
+from avocado.utils import process
+from avocado.utils.path import find_command
+
+@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
+@skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
+class BootFreeBSDPPC64(QemuSystemTest):
+ """
+ :avocado: tags=arch:ppc64
+ """
+
+ timeout = 360
+
+ def setUp(self):
+ super().setUp()
+
+ # We need zstd for all the tests
+ # See https://github.com/avocado-framework/avocado/issues/5609
+ zstd = find_command('zstd', False)
+ if zstd is False:
+ self.cancel('Could not find "zstd", which is required to '
+ 'decompress rootfs')
+ tar = find_command('tar', False)
+ if tar is False:
+ self.cancel('Could not find "tar", which is required to '
+ 'decompress rootfs')
+
+ drive_url = ('https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/disk.qcow2.zst')
+ drive_hash = '95d863dbbc4b60f4899d1ef21d6489fca05bf03d'
+ drive_path_zstd = self.fetch_asset(drive_url, asset_hash=drive_hash)
+ self.drive_path = os.path.join(self.workdir, 'disk.qcow2')
+
+ cmd = f"{zstd} -d {drive_path_zstd} -o {self.drive_path}"
+ process.run(cmd)
+
+ kernel_url = ('https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/kernel.txz')
+ kernel_hash = '31d14c2dc658858830a7acab5128a5b91ea548cf'
+ kernel_path_txz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+ self.kernel_path = os.path.join(self.workdir, 'kernel')
+
+ with open(self.kernel_path, "w") as outfile:
+ cmd = f"{tar} OJxf {kernel_path_txz} ./boot/kernel/kernel"
+ subprocess.run(cmd.split(), stdout=outfile)
+
+ def set_pseries_devices(self):
+ self.vm.add_args('-drive', f"file={self.drive_path},format=qcow2,if=virtio")
+ self.vm.add_args('-net', 'nic,model=virtio')
+
+ def set_powernv_devices(self):
+ self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
+ '-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
+ '-netdev', 'user,id=net0,hostfwd=::20022-:22,hostname=freebsd')
+ self.vm.add_args("-drive", f"file={self.drive_path},format=qcow2,if=none,id=drive0")
+ self.vm.add_args("-kernel", self.kernel_path)
+
+ def run_pseries_test(self, force_HPT=False):
+ if force_HPT:
+ self.vm.add_args('-m', '4g')
+ else:
+ self.vm.add_args('-m', '1g')
+ self.vm.add_args('-smp', '4')
+ self.set_pseries_devices()
+ self.vm.set_console()
+ self.vm.launch()
+
+ wait_for_console_pattern(self, 'Hit [Enter] to boot immediately, or any other key for command prompt.')
+ if force_HPT:
+ exec_command(self, 'x')
+ wait_for_console_pattern(self, 'OK')
+ exec_command(self, 'set radix_mmu=0')
+ exec_command(self, 'boot')
+ wait_for_console_pattern(self, 'cas: selected hash MMU', 'panic:')
+ else:
+ exec_command(self, '')
+ wait_for_console_pattern(self, 'cas: selected radix MMU', 'panic:')
+
+ wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT', 'panic:')
+ wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs', 'panic:')
+ wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)', 'panic:')
+ exec_command(self, 'root')
+ wait_for_console_pattern(self, 'resizewin: timeout reading from terminal')
+ exec_command(self, 'poweroff')
+ wait_for_console_pattern(self, 'Uptime:', 'panic:')
+ self.vm.wait()
+
+ # powernv does not have a bootloader so must load the kernel directly
+ # and work around manual specification of the root device. Also can't
+ # specify options like radix_mmu the same way (todo: work out how it
+ # is done, and add HPT test).
+ def run_powernv_test(self, force_HPT=False):
+ self.vm.add_args('-m', '8g')
+ self.vm.add_args('-smp', '4')
+ self.set_powernv_devices()
+ self.vm.set_console()
+ self.vm.launch()
+
+ wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT', 'panic:')
+ wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs', 'panic:')
+ wait_for_console_pattern(self, '<empty line> Abort manual input')
+ exec_command(self, 'ufs:diskid/DISK-1234s3')
+
+ wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)', 'panic:')
+ exec_command(self, 'root')
+ wait_for_console_pattern(self, 'resizewin: timeout reading from terminal')
+ exec_command(self, 'poweroff')
+ wait_for_console_pattern(self, 'Uptime:', 'panic:')
+ wait_for_console_pattern(self, 'OPAL: Shutdown request', 'panic:')
+ self.vm.wait()
+
+ def test_pseries_tcg(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:tcg
+ """
+ self.require_accelerator("tcg")
+ self.vm.add_args("-cpu", "power10")
+ self.vm.add_args("-accel", "tcg,thread=multi")
+ self.run_pseries_test()
+
+ def test_pseries_hpt_tcg(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:tcg
+ """
+ self.require_accelerator("tcg")
+ self.vm.add_args("-accel", "tcg,thread=multi")
+ self.run_pseries_test(force_HPT=True)
+
+ def test_pseries_kvm(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:kvm
+ """
+ self.require_accelerator("kvm")
+ self.vm.add_args("-accel", "kvm")
+ self.run_pseries_test()
+
+ def test_pseries_hpt_kvm(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:kvm
+ """
+ self.require_accelerator("kvm")
+ self.vm.add_args("-accel", "kvm")
+ self.run_pseries_test(force_HPT=True)
+
+ # powernv9 works, powernv10 fails
+ def test_powernv(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:powernv9
+ :avocado: tags=accel:tcg
+ """
+ self.require_accelerator("tcg")
+ self.vm.add_args("-accel", "tcg,thread=multi")
+ self.run_powernv_test()
--
2.42.0
next prev parent reply other threads:[~2024-02-19 8:32 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 8:28 [PULL 00/49] ppc-for-9.0 queue Nicholas Piggin
2024-02-19 8:28 ` [PULL 01/49] target/ppc: Fix lxv/stxv MSR facility check Nicholas Piggin
2024-02-19 8:28 ` [PULL 02/49] target/ppc: Fix crash on machine check caused by ifetch Nicholas Piggin
2024-02-19 8:28 ` [PULL 03/49] tests/avocado: mark boot_linux.py long runtime instead of flaky Nicholas Piggin
2024-02-19 8:28 ` [PULL 04/49] tests/avocado: improve flaky ppc/pnv boot_linux_console.py test Nicholas Piggin
2024-02-19 8:28 ` [PULL 05/49] tests/avocado: ppc add powernv10 boot_linux_console test Nicholas Piggin
2024-02-19 8:28 ` [PULL 06/49] tests/avocado: Add ppc pseries and powernv hash MMU tests Nicholas Piggin
2024-02-19 8:28 ` [PULL 07/49] tests/avocado: Add pseries KVM boot_linux test Nicholas Piggin
2024-02-19 8:28 ` [PULL 08/49] tests/avocado: ppc add hypervisor tests Nicholas Piggin
2024-02-19 8:28 ` Nicholas Piggin [this message]
2024-02-19 14:49 ` [PULL 09/49] tests/avocado: Add FreeBSD distro boot tests for ppc BALATON Zoltan
2024-02-20 1:16 ` Nicholas Piggin
2024-02-19 8:28 ` [PULL 10/49] tests/avocado: Use default CPU for pseries machine Nicholas Piggin
2024-02-19 8:29 ` [PULL 11/49] ppc/pnv: Update skiboot to v7.1 Nicholas Piggin
2024-02-19 8:29 ` [PULL 12/49] target/ppc: Rename registers to match ISA Nicholas Piggin
2024-02-19 8:29 ` [PULL 13/49] hw/ppc/spapr: Add missing license Nicholas Piggin
2024-02-19 8:29 ` [PULL 14/49] hw/ppc/spapr_hcall: Allow elision of softmmu_resize_hpt_prep Nicholas Piggin
2024-02-19 8:29 ` [PULL 15/49] hw/ppc/spapr_hcall: Rename {softmmu -> vhyp_mmu}_resize_hpt_pr Nicholas Piggin
2024-02-19 8:29 ` [PULL 16/49] hw/ppc/spapr: Rename 'softmmu' -> 'vhyp_mmu' Nicholas Piggin
2024-02-19 8:29 ` [PULL 17/49] ppc/spapr: Introduce SPAPR_IRQ_NR_IPIS to refer IRQ range for CPU IPIs Nicholas Piggin
2024-02-19 8:29 ` [PULL 18/49] ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS Nicholas Piggin
2024-02-19 8:29 ` [PULL 19/49] ppc/spapr: change pseries machine default to POWER10 CPU Nicholas Piggin
2024-02-19 8:29 ` [PULL 20/49] spapr: Tag pseries-2.1 - 2.11 machines as deprecated Nicholas Piggin
2024-09-16 13:14 ` Cédric Le Goater
2024-09-17 4:37 ` Harsh Prateek Bora
2024-02-19 8:29 ` [PULL 21/49] ppc/pnv: Change powernv default to powernv10 Nicholas Piggin
2024-02-19 8:29 ` [PULL 22/49] hw/pci-host/raven.c: Mark raven_io_ops as implementing unaligned accesses Nicholas Piggin
2024-02-19 14:49 ` BALATON Zoltan
2024-02-19 14:53 ` Cédric Le Goater
2024-02-19 14:55 ` Peter Maydell
2024-02-19 15:09 ` Cédric Le Goater
2024-02-19 8:29 ` [PULL 23/49] misc/pca9552: Fix inverted input status Nicholas Piggin
2024-02-19 8:29 ` [PULL 24/49] misc/pca9552: Let external devices set pca9552 inputs Nicholas Piggin
2024-02-19 8:29 ` [PULL 25/49] ppc/pnv: New powernv10-rainier machine type Nicholas Piggin
2024-02-19 8:29 ` [PULL 26/49] ppc/pnv: Add pca9552 to powernv10-rainier for PCIe hotplug power control Nicholas Piggin
2024-02-19 8:29 ` [PULL 27/49] ppc/pnv: Wire up pca9552 GPIO pins " Nicholas Piggin
2024-02-19 8:29 ` [PULL 28/49] ppc/pnv: Use resettable interface to reset child I2C buses Nicholas Piggin
2024-02-19 8:29 ` [PULL 29/49] misc: Add a pca9554 GPIO device model Nicholas Piggin
2024-02-19 8:29 ` [PULL 30/49] ppc/pnv: Add a pca9554 I2C device to powernv10-rainier Nicholas Piggin
2024-02-19 8:29 ` [PULL 31/49] ppc/pnv: Test pnv i2c master and connected devices Nicholas Piggin
2024-02-19 8:29 ` [PULL 32/49] hw/ppc: Add pnv nest pervasive common chiplet model Nicholas Piggin
2024-02-19 8:29 ` [PULL 33/49] hw/ppc: Add N1 " Nicholas Piggin
2024-02-19 8:29 ` [PULL 34/49] hw/ppc: N1 chiplet wiring Nicholas Piggin
2024-02-19 8:29 ` [PULL 35/49] target/ppc: Update gdbstub to read SPR's CFAR, DEC, HDEC, TB-L/U Nicholas Piggin
2024-02-19 8:29 ` [PULL 36/49] target/ppc: Rename TBL to TB on 64-bit Nicholas Piggin
2024-02-19 8:29 ` [PULL 37/49] target/ppc: Improve timebase register defines naming Nicholas Piggin
2024-02-19 8:29 ` [PULL 38/49] target/ppc: Fix move-to timebase SPR access permissions Nicholas Piggin
2024-02-19 8:29 ` [PULL 39/49] ppc/pnv: Add POWER9/10 chiptod model Nicholas Piggin
2024-02-19 8:29 ` [PULL 40/49] ppc/pnv: Wire ChipTOD model to powernv9 and powernv10 machines Nicholas Piggin
2024-02-19 8:29 ` [PULL 41/49] ppc/pnv: Implement the ChipTOD to Core transfer Nicholas Piggin
2024-02-19 8:29 ` [PULL 42/49] target/ppc: Implement core timebase state machine and TFMR Nicholas Piggin
2024-02-19 8:29 ` [PULL 43/49] target/ppc: Add SMT support to time facilities Nicholas Piggin
2024-02-19 8:29 ` [PULL 44/49] target/ppc: Fix 440 tlbwe TLB invalidation gaps Nicholas Piggin
2024-02-19 8:29 ` [PULL 45/49] target/ppc: Factor out 4xx ppcemb_tlb_t flushing Nicholas Piggin
2024-02-19 8:29 ` [PULL 46/49] target/ppc: 4xx don't flush TLB for a newly written software TLB entry Nicholas Piggin
2024-02-19 8:29 ` [PULL 47/49] target/ppc: 4xx optimise tlbwe_lo TLB flushing Nicholas Piggin
2024-02-19 8:29 ` [PULL 48/49] target/ppc: 440 optimise tlbwe " Nicholas Piggin
2024-02-19 8:29 ` [PULL 49/49] target/ppc: optimise ppcemb_tlb_t flushing Nicholas Piggin
2024-02-19 17:06 ` [PULL 00/49] ppc-for-9.0 queue Peter Maydell
2024-02-20 1:15 ` Nicholas Piggin
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=20240219082938.238302-10-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=harshpb@linux.ibm.com \
--cc=imp@bsdimp.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.