1*407a6883SThomas Huth#!/usr/bin/env python3 2*407a6883SThomas Huth# 32bef5b94SNicholas Piggin# Test that Linux kernel boots on ppc powernv machines and check the console 42bef5b94SNicholas Piggin# 52bef5b94SNicholas Piggin# Copyright (c) 2018, 2020 Red Hat, Inc. 62bef5b94SNicholas Piggin# 72bef5b94SNicholas Piggin# This work is licensed under the terms of the GNU GPL, version 2 or 82bef5b94SNicholas Piggin# later. See the COPYING file in the top-level directory. 92bef5b94SNicholas Piggin 10*407a6883SThomas Huthfrom qemu_test import QemuSystemTest, Asset 11*407a6883SThomas Huthfrom qemu_test import wait_for_console_pattern 122bef5b94SNicholas Piggin 132bef5b94SNicholas Pigginclass powernvMachine(QemuSystemTest): 142bef5b94SNicholas Piggin 152bef5b94SNicholas Piggin timeout = 90 168d07a8aeSNicholas Piggin KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 ' 172bef5b94SNicholas Piggin panic_message = 'Kernel panic - not syncing' 182bef5b94SNicholas Piggin good_message = 'VFS: Cannot open root device' 192bef5b94SNicholas Piggin 20*407a6883SThomas Huth ASSET_KERNEL = Asset( 21*407a6883SThomas Huth ('https://archives.fedoraproject.org/pub/archive/fedora-secondary/' 22*407a6883SThomas Huth 'releases/29/Everything/ppc64le/os/ppc/ppc64/vmlinuz'), 23*407a6883SThomas Huth '383c2f5c23bc0d9d32680c3924d3fd7ee25cc5ef97091ac1aa5e1d853422fc5f') 24*407a6883SThomas Huth 258d07a8aeSNicholas Piggin def do_test_linux_boot(self, command_line = KERNEL_COMMON_COMMAND_LINE): 262bef5b94SNicholas Piggin self.require_accelerator("tcg") 27*407a6883SThomas Huth kernel_path = self.ASSET_KERNEL.fetch() 282bef5b94SNicholas Piggin 292bef5b94SNicholas Piggin self.vm.set_console() 302bef5b94SNicholas Piggin self.vm.add_args('-kernel', kernel_path, 318d07a8aeSNicholas Piggin '-append', command_line) 322bef5b94SNicholas Piggin self.vm.launch() 332bef5b94SNicholas Piggin 342bef5b94SNicholas Piggin def test_linux_boot(self): 35*407a6883SThomas Huth self.set_machine('powernv') 362bef5b94SNicholas Piggin self.do_test_linux_boot() 372bef5b94SNicholas Piggin console_pattern = 'VFS: Cannot open root device' 382bef5b94SNicholas Piggin wait_for_console_pattern(self, console_pattern, self.panic_message) 392bef5b94SNicholas Piggin 402bef5b94SNicholas Piggin def test_linux_smp_boot(self): 41*407a6883SThomas Huth self.set_machine('powernv') 422bef5b94SNicholas Piggin self.vm.add_args('-smp', '4') 432bef5b94SNicholas Piggin self.do_test_linux_boot() 442bef5b94SNicholas Piggin console_pattern = 'smp: Brought up 1 node, 4 CPUs' 452bef5b94SNicholas Piggin wait_for_console_pattern(self, console_pattern, self.panic_message) 462bef5b94SNicholas Piggin wait_for_console_pattern(self, self.good_message, self.panic_message) 472bef5b94SNicholas Piggin 488d07a8aeSNicholas Piggin def test_linux_smp_hpt_boot(self): 49*407a6883SThomas Huth self.set_machine('powernv') 508d07a8aeSNicholas Piggin self.vm.add_args('-smp', '4') 518d07a8aeSNicholas Piggin self.do_test_linux_boot(self.KERNEL_COMMON_COMMAND_LINE + 528d07a8aeSNicholas Piggin 'disable_radix') 538d07a8aeSNicholas Piggin console_pattern = 'smp: Brought up 1 node, 4 CPUs' 548d07a8aeSNicholas Piggin wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu', 558d07a8aeSNicholas Piggin self.panic_message) 568d07a8aeSNicholas Piggin wait_for_console_pattern(self, console_pattern, self.panic_message) 578d07a8aeSNicholas Piggin wait_for_console_pattern(self, self.good_message, self.panic_message) 588d07a8aeSNicholas Piggin 592bef5b94SNicholas Piggin def test_linux_smt_boot(self): 60*407a6883SThomas Huth self.set_machine('powernv') 612bef5b94SNicholas Piggin self.vm.add_args('-smp', '4,threads=4') 622bef5b94SNicholas Piggin self.do_test_linux_boot() 632bef5b94SNicholas Piggin console_pattern = 'CPU maps initialized for 4 threads per core' 642bef5b94SNicholas Piggin wait_for_console_pattern(self, console_pattern, self.panic_message) 652bef5b94SNicholas Piggin console_pattern = 'smp: Brought up 1 node, 4 CPUs' 662bef5b94SNicholas Piggin wait_for_console_pattern(self, console_pattern, self.panic_message) 672bef5b94SNicholas Piggin wait_for_console_pattern(self, self.good_message, self.panic_message) 682bef5b94SNicholas Piggin 692bef5b94SNicholas Piggin def test_linux_big_boot(self): 70*407a6883SThomas Huth self.set_machine('powernv') 712bef5b94SNicholas Piggin self.vm.add_args('-smp', '16,threads=4,cores=2,sockets=2') 722bef5b94SNicholas Piggin 732bef5b94SNicholas Piggin # powernv does not support NUMA 742bef5b94SNicholas Piggin self.do_test_linux_boot() 752bef5b94SNicholas Piggin console_pattern = 'CPU maps initialized for 4 threads per core' 762bef5b94SNicholas Piggin wait_for_console_pattern(self, console_pattern, self.panic_message) 772bef5b94SNicholas Piggin console_pattern = 'smp: Brought up 2 nodes, 16 CPUs' 782bef5b94SNicholas Piggin wait_for_console_pattern(self, console_pattern, self.panic_message) 792bef5b94SNicholas Piggin wait_for_console_pattern(self, self.good_message, self.panic_message) 80*407a6883SThomas Huth 81*407a6883SThomas Huthif __name__ == '__main__': 82*407a6883SThomas Huth QemuSystemTest.main() 83