blob: fdc404ed033d4e01d86d132f7e80c108518e1258 [file] [log] [blame]
Thomas Huth407a6882024-08-30 15:38:19 +02001#!/usr/bin/env python3
2#
David Gibsonc5f0a812021-09-27 14:48:02 +10003# Test that Linux kernel boots on ppc machines and check the console
4#
5# Copyright (c) 2018, 2020 Red Hat, Inc.
6#
7# This work is licensed under the terms of the GNU GPL, version 2 or
8# later. See the COPYING file in the top-level directory.
9
Thomas Huth407a6882024-08-30 15:38:19 +020010from qemu_test import QemuSystemTest, Asset
11from qemu_test import wait_for_console_pattern
David Gibsonc5f0a812021-09-27 14:48:02 +100012
Philippe Mathieu-Daudé2283b622021-09-27 18:14:33 +020013class pseriesMachine(QemuSystemTest):
David Gibsonc5f0a812021-09-27 14:48:02 +100014
15 timeout = 90
Nicholas Piggin8d07a8a2023-10-05 19:28:08 +100016 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
David Gibsonc5f0a812021-09-27 14:48:02 +100017 panic_message = 'Kernel panic - not syncing'
Nicholas Piggin242e8b42023-06-22 19:33:57 +100018 good_message = 'VFS: Cannot open root device'
David Gibsonc5f0a812021-09-27 14:48:02 +100019
Thomas Huth407a6882024-08-30 15:38:19 +020020 ASSET_KERNEL = Asset(
21 ('https://archives.fedoraproject.org/pub/archive/fedora-secondary/'
22 'releases/29/Everything/ppc64le/os/ppc/ppc64/vmlinuz'),
23 '383c2f5c23bc0d9d32680c3924d3fd7ee25cc5ef97091ac1aa5e1d853422fc5f')
24
Nicholas Piggin8d07a8a2023-10-05 19:28:08 +100025 def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE):
Thomas Huth407a6882024-08-30 15:38:19 +020026 kernel_path = self.ASSET_KERNEL.fetch()
David Gibsonc5f0a812021-09-27 14:48:02 +100027
28 self.vm.set_console()
David Gibsonc5f0a812021-09-27 14:48:02 +100029 self.vm.add_args('-kernel', kernel_path,
30 '-append', kernel_command_line)
31 self.vm.launch()
Nicholas Piggin242e8b42023-06-22 19:33:57 +100032
Nicholas Piggin5eb63b82023-06-23 22:21:35 +100033 def test_ppc64_vof_linux_boot(self):
Thomas Huth407a6882024-08-30 15:38:19 +020034 self.set_machine('pseries')
Nicholas Piggin5eb63b82023-06-23 22:21:35 +100035 self.vm.add_args('-machine', 'x-vof=on')
36 self.do_test_ppc64_linux_boot()
37 console_pattern = 'VFS: Cannot open root device'
38 wait_for_console_pattern(self, console_pattern, self.panic_message)
39
Nicholas Piggin242e8b42023-06-22 19:33:57 +100040 def test_ppc64_linux_boot(self):
Thomas Huth407a6882024-08-30 15:38:19 +020041 self.set_machine('pseries')
Nicholas Piggin242e8b42023-06-22 19:33:57 +100042 self.do_test_ppc64_linux_boot()
Nicholas Piggin8f4c6272023-06-22 19:33:56 +100043 console_pattern = 'VFS: Cannot open root device'
David Gibsonc5f0a812021-09-27 14:48:02 +100044 wait_for_console_pattern(self, console_pattern, self.panic_message)
Nicholas Piggin242e8b42023-06-22 19:33:57 +100045
46 def test_ppc64_linux_smp_boot(self):
Thomas Huth407a6882024-08-30 15:38:19 +020047 self.set_machine('pseries')
Nicholas Piggin242e8b42023-06-22 19:33:57 +100048 self.vm.add_args('-smp', '4')
49 self.do_test_ppc64_linux_boot()
50 console_pattern = 'smp: Brought up 1 node, 4 CPUs'
51 wait_for_console_pattern(self, console_pattern, self.panic_message)
52 wait_for_console_pattern(self, self.good_message, self.panic_message)
53
Nicholas Piggin8d07a8a2023-10-05 19:28:08 +100054 def test_ppc64_linux_hpt_smp_boot(self):
Thomas Huth407a6882024-08-30 15:38:19 +020055 self.set_machine('pseries')
Nicholas Piggin8d07a8a2023-10-05 19:28:08 +100056 self.vm.add_args('-smp', '4')
57 self.do_test_ppc64_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
58 'disable_radix')
59 console_pattern = 'smp: Brought up 1 node, 4 CPUs'
60 wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
61 self.panic_message)
62 wait_for_console_pattern(self, console_pattern, self.panic_message)
63 wait_for_console_pattern(self, self.good_message, self.panic_message)
64
Nicholas Piggin242e8b42023-06-22 19:33:57 +100065 def test_ppc64_linux_smt_boot(self):
Nicholas Piggin242e8b42023-06-22 19:33:57 +100066 self.vm.add_args('-smp', '4,threads=4')
67 self.do_test_ppc64_linux_boot()
68 console_pattern = 'CPU maps initialized for 4 threads per core'
69 wait_for_console_pattern(self, console_pattern, self.panic_message)
70 console_pattern = 'smp: Brought up 1 node, 4 CPUs'
71 wait_for_console_pattern(self, console_pattern, self.panic_message)
72 wait_for_console_pattern(self, self.good_message, self.panic_message)
73
74 def test_ppc64_linux_big_boot(self):
Thomas Huth407a6882024-08-30 15:38:19 +020075 self.set_machine('pseries')
Nicholas Piggin242e8b42023-06-22 19:33:57 +100076 self.vm.add_args('-smp', '16,threads=4,cores=2,sockets=2')
77 self.vm.add_args('-m', '512M',
78 '-object', 'memory-backend-ram,size=256M,id=m0',
79 '-object', 'memory-backend-ram,size=256M,id=m1')
80 self.vm.add_args('-numa', 'node,nodeid=0,memdev=m0')
81 self.vm.add_args('-numa', 'node,nodeid=1,memdev=m1')
82 self.do_test_ppc64_linux_boot()
83 console_pattern = 'CPU maps initialized for 4 threads per core'
84 wait_for_console_pattern(self, console_pattern, self.panic_message)
85 console_pattern = 'smp: Brought up 2 nodes, 16 CPUs'
86 wait_for_console_pattern(self, console_pattern, self.panic_message)
87 wait_for_console_pattern(self, self.good_message, self.panic_message)
Thomas Huth407a6882024-08-30 15:38:19 +020088
89if __name__ == '__main__':
90 QemuSystemTest.main()