xref: /qemu/tests/functional/test_ppc64_powernv.py (revision 2bef5b9452b2c6239c1e8512461ae900d5e8ebe6)
1*2bef5b94SNicholas Piggin# Test that Linux kernel boots on ppc powernv machines and check the console
2*2bef5b94SNicholas Piggin#
3*2bef5b94SNicholas Piggin# Copyright (c) 2018, 2020 Red Hat, Inc.
4*2bef5b94SNicholas Piggin#
5*2bef5b94SNicholas Piggin# This work is licensed under the terms of the GNU GPL, version 2 or
6*2bef5b94SNicholas Piggin# later.  See the COPYING file in the top-level directory.
7*2bef5b94SNicholas Piggin
8*2bef5b94SNicholas Pigginfrom avocado.utils import archive
9*2bef5b94SNicholas Pigginfrom avocado_qemu import QemuSystemTest
10*2bef5b94SNicholas Pigginfrom avocado_qemu import wait_for_console_pattern
11*2bef5b94SNicholas Piggin
12*2bef5b94SNicholas Pigginclass powernvMachine(QemuSystemTest):
13*2bef5b94SNicholas Piggin
14*2bef5b94SNicholas Piggin    timeout = 90
15*2bef5b94SNicholas Piggin    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
16*2bef5b94SNicholas Piggin    panic_message = 'Kernel panic - not syncing'
17*2bef5b94SNicholas Piggin    good_message = 'VFS: Cannot open root device'
18*2bef5b94SNicholas Piggin
19*2bef5b94SNicholas Piggin    def do_test_linux_boot(self):
20*2bef5b94SNicholas Piggin        self.require_accelerator("tcg")
21*2bef5b94SNicholas Piggin        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
22*2bef5b94SNicholas Piggin                      '/fedora-secondary/releases/29/Everything/ppc64le/os'
23*2bef5b94SNicholas Piggin                      '/ppc/ppc64/vmlinuz')
24*2bef5b94SNicholas Piggin        kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
25*2bef5b94SNicholas Piggin        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
26*2bef5b94SNicholas Piggin
27*2bef5b94SNicholas Piggin        self.vm.set_console()
28*2bef5b94SNicholas Piggin        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
29*2bef5b94SNicholas Piggin        self.vm.add_args('-kernel', kernel_path,
30*2bef5b94SNicholas Piggin                         '-append', kernel_command_line)
31*2bef5b94SNicholas Piggin        self.vm.launch()
32*2bef5b94SNicholas Piggin
33*2bef5b94SNicholas Piggin    def test_linux_boot(self):
34*2bef5b94SNicholas Piggin        """
35*2bef5b94SNicholas Piggin        :avocado: tags=arch:ppc64
36*2bef5b94SNicholas Piggin        :avocado: tags=machine:powernv
37*2bef5b94SNicholas Piggin        :avocado: tags=accel:tcg
38*2bef5b94SNicholas Piggin        """
39*2bef5b94SNicholas Piggin
40*2bef5b94SNicholas Piggin        self.do_test_linux_boot()
41*2bef5b94SNicholas Piggin        console_pattern = 'VFS: Cannot open root device'
42*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, console_pattern, self.panic_message)
43*2bef5b94SNicholas Piggin
44*2bef5b94SNicholas Piggin    def test_linux_smp_boot(self):
45*2bef5b94SNicholas Piggin        """
46*2bef5b94SNicholas Piggin        :avocado: tags=arch:ppc64
47*2bef5b94SNicholas Piggin        :avocado: tags=machine:powernv
48*2bef5b94SNicholas Piggin        :avocado: tags=accel:tcg
49*2bef5b94SNicholas Piggin        """
50*2bef5b94SNicholas Piggin
51*2bef5b94SNicholas Piggin        self.vm.add_args('-smp', '4')
52*2bef5b94SNicholas Piggin        self.do_test_linux_boot()
53*2bef5b94SNicholas Piggin        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
54*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, console_pattern, self.panic_message)
55*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, self.good_message, self.panic_message)
56*2bef5b94SNicholas Piggin
57*2bef5b94SNicholas Piggin    def test_linux_smt_boot(self):
58*2bef5b94SNicholas Piggin        """
59*2bef5b94SNicholas Piggin        :avocado: tags=arch:ppc64
60*2bef5b94SNicholas Piggin        :avocado: tags=machine:powernv
61*2bef5b94SNicholas Piggin        :avocado: tags=accel:tcg
62*2bef5b94SNicholas Piggin        """
63*2bef5b94SNicholas Piggin
64*2bef5b94SNicholas Piggin        self.vm.add_args('-smp', '4,threads=4')
65*2bef5b94SNicholas Piggin        self.do_test_linux_boot()
66*2bef5b94SNicholas Piggin        console_pattern = 'CPU maps initialized for 4 threads per core'
67*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, console_pattern, self.panic_message)
68*2bef5b94SNicholas Piggin        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
69*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, console_pattern, self.panic_message)
70*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, self.good_message, self.panic_message)
71*2bef5b94SNicholas Piggin
72*2bef5b94SNicholas Piggin    def test_linux_big_boot(self):
73*2bef5b94SNicholas Piggin        """
74*2bef5b94SNicholas Piggin        :avocado: tags=arch:ppc64
75*2bef5b94SNicholas Piggin        :avocado: tags=machine:powernv
76*2bef5b94SNicholas Piggin        :avocado: tags=accel:tcg
77*2bef5b94SNicholas Piggin        """
78*2bef5b94SNicholas Piggin
79*2bef5b94SNicholas Piggin        self.vm.add_args('-smp', '16,threads=4,cores=2,sockets=2')
80*2bef5b94SNicholas Piggin
81*2bef5b94SNicholas Piggin        # powernv does not support NUMA
82*2bef5b94SNicholas Piggin        self.do_test_linux_boot()
83*2bef5b94SNicholas Piggin        console_pattern = 'CPU maps initialized for 4 threads per core'
84*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, console_pattern, self.panic_message)
85*2bef5b94SNicholas Piggin        console_pattern = 'smp: Brought up 2 nodes, 16 CPUs'
86*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, console_pattern, self.panic_message)
87*2bef5b94SNicholas Piggin        wait_for_console_pattern(self, self.good_message, self.panic_message)
88