1#!/usr/bin/env python3 2# 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 10from qemu_test import QemuSystemTest, Asset 11from qemu_test import wait_for_console_pattern 12 13class pseriesMachine(QemuSystemTest): 14 15 timeout = 90 16 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 ' 17 panic_message = 'Kernel panic - not syncing' 18 good_message = 'VFS: Cannot open root device' 19 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 25 def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE): 26 kernel_path = self.ASSET_KERNEL.fetch() 27 28 self.vm.set_console() 29 self.vm.add_args('-kernel', kernel_path, 30 '-append', kernel_command_line) 31 self.vm.launch() 32 33 def test_ppc64_vof_linux_boot(self): 34 self.set_machine('pseries') 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 40 def test_ppc64_linux_boot(self): 41 self.set_machine('pseries') 42 self.do_test_ppc64_linux_boot() 43 console_pattern = 'VFS: Cannot open root device' 44 wait_for_console_pattern(self, console_pattern, self.panic_message) 45 46 def test_ppc64_linux_smp_boot(self): 47 self.set_machine('pseries') 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 54 def test_ppc64_linux_hpt_smp_boot(self): 55 self.set_machine('pseries') 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 65 def test_ppc64_linux_smt_boot(self): 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): 75 self.set_machine('pseries') 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) 88 89if __name__ == '__main__': 90 QemuSystemTest.main() 91