1# Test that Linux kernel boots on ppc machines and check the console 2# 3# Copyright (c) 2018, 2020 Red Hat, Inc. 4# 5# This work is licensed under the terms of the GNU GPL, version 2 or 6# later. See the COPYING file in the top-level directory. 7 8from avocado.utils import archive 9from avocado_qemu import QemuSystemTest 10from avocado_qemu import wait_for_console_pattern 11 12class pseriesMachine(QemuSystemTest): 13 14 timeout = 90 15 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 ' 16 panic_message = 'Kernel panic - not syncing' 17 good_message = 'VFS: Cannot open root device' 18 19 def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE): 20 kernel_url = ('https://archives.fedoraproject.org/pub/archive' 21 '/fedora-secondary/releases/29/Everything/ppc64le/os' 22 '/ppc/ppc64/vmlinuz') 23 kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77' 24 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 25 26 self.vm.set_console() 27 self.vm.add_args('-kernel', kernel_path, 28 '-append', kernel_command_line) 29 self.vm.launch() 30 31 def test_ppc64_vof_linux_boot(self): 32 """ 33 :avocado: tags=arch:ppc64 34 :avocado: tags=machine:pseries 35 """ 36 37 self.vm.add_args('-machine', 'x-vof=on') 38 self.do_test_ppc64_linux_boot() 39 console_pattern = 'VFS: Cannot open root device' 40 wait_for_console_pattern(self, console_pattern, self.panic_message) 41 42 def test_ppc64_linux_boot(self): 43 """ 44 :avocado: tags=arch:ppc64 45 :avocado: tags=machine:pseries 46 """ 47 48 self.do_test_ppc64_linux_boot() 49 console_pattern = 'VFS: Cannot open root device' 50 wait_for_console_pattern(self, console_pattern, self.panic_message) 51 52 def test_ppc64_linux_smp_boot(self): 53 """ 54 :avocado: tags=arch:ppc64 55 :avocado: tags=machine:pseries 56 """ 57 58 self.vm.add_args('-smp', '4') 59 self.do_test_ppc64_linux_boot() 60 console_pattern = 'smp: Brought up 1 node, 4 CPUs' 61 wait_for_console_pattern(self, console_pattern, self.panic_message) 62 wait_for_console_pattern(self, self.good_message, self.panic_message) 63 64 def test_ppc64_linux_hpt_smp_boot(self): 65 """ 66 :avocado: tags=arch:ppc64 67 :avocado: tags=machine:pseries 68 """ 69 70 self.vm.add_args('-smp', '4') 71 self.do_test_ppc64_linux_boot(self.KERNEL_COMMON_COMMAND_LINE + 72 'disable_radix') 73 console_pattern = 'smp: Brought up 1 node, 4 CPUs' 74 wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu', 75 self.panic_message) 76 wait_for_console_pattern(self, console_pattern, self.panic_message) 77 wait_for_console_pattern(self, self.good_message, self.panic_message) 78 79 def test_ppc64_linux_smt_boot(self): 80 """ 81 :avocado: tags=arch:ppc64 82 :avocado: tags=machine:pseries 83 """ 84 85 self.vm.add_args('-smp', '4,threads=4') 86 self.do_test_ppc64_linux_boot() 87 console_pattern = 'CPU maps initialized for 4 threads per core' 88 wait_for_console_pattern(self, console_pattern, self.panic_message) 89 console_pattern = 'smp: Brought up 1 node, 4 CPUs' 90 wait_for_console_pattern(self, console_pattern, self.panic_message) 91 wait_for_console_pattern(self, self.good_message, self.panic_message) 92 93 def test_ppc64_linux_big_boot(self): 94 """ 95 :avocado: tags=arch:ppc64 96 :avocado: tags=machine:pseries 97 """ 98 99 self.vm.add_args('-smp', '16,threads=4,cores=2,sockets=2') 100 self.vm.add_args('-m', '512M', 101 '-object', 'memory-backend-ram,size=256M,id=m0', 102 '-object', 'memory-backend-ram,size=256M,id=m1') 103 self.vm.add_args('-numa', 'node,nodeid=0,memdev=m0') 104 self.vm.add_args('-numa', 'node,nodeid=1,memdev=m1') 105 self.do_test_ppc64_linux_boot() 106 console_pattern = 'CPU maps initialized for 4 threads per core' 107 wait_for_console_pattern(self, console_pattern, self.panic_message) 108 console_pattern = 'smp: Brought up 2 nodes, 16 CPUs' 109 wait_for_console_pattern(self, console_pattern, self.panic_message) 110 wait_for_console_pattern(self, self.good_message, self.panic_message) 111