Thomas Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | # |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 3 | # 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 Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 10 | from qemu_test import QemuSystemTest, Asset |
| 11 | from qemu_test import wait_for_console_pattern |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 12 | |
Philippe Mathieu-Daudé | 2283b62 | 2021-09-27 18:14:33 +0200 | [diff] [blame] | 13 | class pseriesMachine(QemuSystemTest): |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 14 | |
| 15 | timeout = 90 |
Nicholas Piggin | 8d07a8a | 2023-10-05 19:28:08 +1000 | [diff] [blame] | 16 | KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 ' |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 17 | panic_message = 'Kernel panic - not syncing' |
Nicholas Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 18 | good_message = 'VFS: Cannot open root device' |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 19 | |
Thomas Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 20 | 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 Piggin | 8d07a8a | 2023-10-05 19:28:08 +1000 | [diff] [blame] | 25 | def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE): |
Thomas Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 26 | kernel_path = self.ASSET_KERNEL.fetch() |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 27 | |
| 28 | self.vm.set_console() |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 29 | self.vm.add_args('-kernel', kernel_path, |
| 30 | '-append', kernel_command_line) |
| 31 | self.vm.launch() |
Nicholas Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 32 | |
Nicholas Piggin | 5eb63b8 | 2023-06-23 22:21:35 +1000 | [diff] [blame] | 33 | def test_ppc64_vof_linux_boot(self): |
Thomas Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 34 | self.set_machine('pseries') |
Nicholas Piggin | 5eb63b8 | 2023-06-23 22:21:35 +1000 | [diff] [blame] | 35 | 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 Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 40 | def test_ppc64_linux_boot(self): |
Thomas Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 41 | self.set_machine('pseries') |
Nicholas Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 42 | self.do_test_ppc64_linux_boot() |
Nicholas Piggin | 8f4c627 | 2023-06-22 19:33:56 +1000 | [diff] [blame] | 43 | console_pattern = 'VFS: Cannot open root device' |
David Gibson | c5f0a81 | 2021-09-27 14:48:02 +1000 | [diff] [blame] | 44 | wait_for_console_pattern(self, console_pattern, self.panic_message) |
Nicholas Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 45 | |
| 46 | def test_ppc64_linux_smp_boot(self): |
Thomas Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 47 | self.set_machine('pseries') |
Nicholas Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 48 | 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 Piggin | 8d07a8a | 2023-10-05 19:28:08 +1000 | [diff] [blame] | 54 | def test_ppc64_linux_hpt_smp_boot(self): |
Thomas Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 55 | self.set_machine('pseries') |
Nicholas Piggin | 8d07a8a | 2023-10-05 19:28:08 +1000 | [diff] [blame] | 56 | 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 Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 65 | def test_ppc64_linux_smt_boot(self): |
Nicholas Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 66 | 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 Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 75 | self.set_machine('pseries') |
Nicholas Piggin | 242e8b4 | 2023-06-22 19:33:57 +1000 | [diff] [blame] | 76 | 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 Huth | 407a688 | 2024-08-30 15:38:19 +0200 | [diff] [blame] | 88 | |
| 89 | if __name__ == '__main__': |
| 90 | QemuSystemTest.main() |