1 # Test that Linux kernel boots on ppc powernv machines and check the console
3 # Copyright (c) 2018, 2020 Red Hat, Inc.
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.
8 from avocado
.utils
import archive
9 from avocado_qemu
import QemuSystemTest
10 from avocado_qemu
import wait_for_console_pattern
12 class powernvMachine(QemuSystemTest
):
15 KERNEL_COMMON_COMMAND_LINE
= 'printk.time=0 '
16 panic_message
= 'Kernel panic - not syncing'
17 good_message
= 'VFS: Cannot open root device'
19 def do_test_linux_boot(self
):
20 self
.require_accelerator("tcg")
21 kernel_url
= ('https://archives.fedoraproject.org/pub/archive'
22 '/fedora-secondary/releases/29/Everything/ppc64le/os'
24 kernel_hash
= '3fe04abfc852b66653b8c3c897a59a689270bc77'
25 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
)
28 kernel_command_line
= self
.KERNEL_COMMON_COMMAND_LINE
+ 'console=hvc0'
29 self
.vm
.add_args('-kernel', kernel_path
,
30 '-append', kernel_command_line
)
33 def test_linux_boot(self
):
35 :avocado: tags=arch:ppc64
36 :avocado: tags=machine:powernv
37 :avocado: tags=accel:tcg
40 self
.do_test_linux_boot()
41 console_pattern
= 'VFS: Cannot open root device'
42 wait_for_console_pattern(self
, console_pattern
, self
.panic_message
)
44 def test_linux_smp_boot(self
):
46 :avocado: tags=arch:ppc64
47 :avocado: tags=machine:powernv
48 :avocado: tags=accel:tcg
51 self
.vm
.add_args('-smp', '4')
52 self
.do_test_linux_boot()
53 console_pattern
= 'smp: Brought up 1 node, 4 CPUs'
54 wait_for_console_pattern(self
, console_pattern
, self
.panic_message
)
55 wait_for_console_pattern(self
, self
.good_message
, self
.panic_message
)
57 def test_linux_smt_boot(self
):
59 :avocado: tags=arch:ppc64
60 :avocado: tags=machine:powernv
61 :avocado: tags=accel:tcg
64 self
.vm
.add_args('-smp', '4,threads=4')
65 self
.do_test_linux_boot()
66 console_pattern
= 'CPU maps initialized for 4 threads per core'
67 wait_for_console_pattern(self
, console_pattern
, self
.panic_message
)
68 console_pattern
= 'smp: Brought up 1 node, 4 CPUs'
69 wait_for_console_pattern(self
, console_pattern
, self
.panic_message
)
70 wait_for_console_pattern(self
, self
.good_message
, self
.panic_message
)
72 def test_linux_big_boot(self
):
74 :avocado: tags=arch:ppc64
75 :avocado: tags=machine:powernv
76 :avocado: tags=accel:tcg
79 self
.vm
.add_args('-smp', '16,threads=4,cores=2,sockets=2')
81 # powernv does not support NUMA
82 self
.do_test_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
)