Skip to contentSkip to conversation

ppc: avocado test additions and new defaults

RFC PATCH In review Nicholas Piggin 8 participants 38 messages Oct 10, 2023 – Oct 16, 2023 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

cover ppc: avocado test additions and new defaults

Sorry for going missing for a while, had a few things on but have been working on figuring out testing and git setup to get some things merged.

To start with I'd like to add a few more tests. Since most of my own tests for missing bits (like KVM backend) are mostly just ad hoc scripts, I thought adding them to avocado is a better idea. Comments on those in particular from CI gurus would be welcome,

patch 4, because it boots a Alpine distro image and installs a QEMU package via its package manager.

patch 5, because it grabs some Linux kernel images I put up on another gitlab page.

patch 6, because it adds a FreeBSD boot test.

patch 7/8, because they add tests for non-public images (flames welcome).

Thanks,
Nick

Nicholas Piggin (11):
tests/avocado: ppc add powernv10 boot_linux_console test tests/avocado: Add ppc pseries and powernv Hash MMU tests tests/avocado: Add pseries KVM boot_linux test tests/avocado: ppc add hypervisor tests testing/avocado: ppc add new BookE boot_linux_console.py tests tests/avocado: Add FreeBSD distro boot tests for ppc tests/avocado: Add ppc boot tests for non-free AIX images tests/avocado: Add ppc MacOS tests
tests/avocado: Use default CPU for pseries machine ppc/spapr: change pseries machine default to POWER10 CPU ppc/pnv: Change powernv default to powernv10

 hw/ppc/pnv.c                        |   4 +-
 hw/ppc/spapr.c                      |   2 +-
 tests/avocado/boot_freebsd.py       | 109 ++++++++++++++++++
 tests/avocado/boot_linux.py         |   9 ++
 tests/avocado/boot_linux_console.py |  61 ++++++++++
 tests/avocado/migration.py          |   1 -
 tests/avocado/ppc/macos9.ppm        | Bin 0 -> 921615 bytes
 tests/avocado/ppc_aix.py            |  63 ++++++++++
 tests/avocado/ppc_hv_tests.py       | 173 ++++++++++++++++++++++++++++
 tests/avocado/ppc_macos.py          |  90 +++++++++++++++
 tests/avocado/ppc_powernv.py        |  21 +++-
 tests/avocado/ppc_pseries.py        |  20 +++-
 12 files changed, 543 insertions(+), 10 deletions(-)
 create mode 100644 tests/avocado/boot_freebsd.py
 create mode 100644 tests/avocado/ppc/macos9.ppm
 create mode 100644 tests/avocado/ppc_aix.py
 create mode 100644 tests/avocado/ppc_hv_tests.py
 create mode 100644 tests/avocado/ppc_macos.py
Signature · 1 line
2.42.0
author reviewer
#1 lore raw

RFC PATCH 1/11 tests/avocado: ppc add powernv10 boot_linux_console test

Add a powernv POWER10 variant for boot_linux_console.py.

---
 tests/avocado/boot_linux_console.py | 8 ++++++++
 1 file changed, 8 insertions(+)
tests/avocado/boot_linux_console.py +8 -0
index 01ee149812..9434304cd3 100644
@@ -1393,6 +1393,14 @@ def test_ppc_powernv9(self):
         """
         self.do_test_ppc64_powernv('P9')
 
+    def test_ppc_powernv10(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv10
+        :avocado: tags=accel:tcg
+        """
+        self.do_test_ppc64_powernv('P10')
+
     def test_ppc_g3beige(self):
         """
         :avocado: tags=arch:ppc
Signature · 1 line
2.42.0
author reviewer
#2 lore raw

RFC PATCH 2/11 tests/avocado: Add ppc pseries and powernv Hash MMU tests

In reply to Nicholas Piggin

The Hash MMU mode is supported along side Radix in POWER hardware, and Linux supports running in either mode. Radix is the default so to keep up testing of QEMU Hash MMU, add some explicit Hash MMU tests.

---
 tests/avocado/ppc_powernv.py | 21 ++++++++++++++++++---
 tests/avocado/ppc_pseries.py | 20 +++++++++++++++++---
 2 files changed, 35 insertions(+), 6 deletions(-)
tests/avocado/ppc_powernv.py +18 -3
index d0e5c07bde..2be322c47d 100644
@@ -12,11 +12,11 @@
 class powernvMachine(QemuSystemTest):
 
     timeout = 90
-    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
     panic_message = 'Kernel panic - not syncing'
     good_message = 'VFS: Cannot open root device'
 
-    def do_test_linux_boot(self):
+    def do_test_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE):
         self.require_accelerator("tcg")
         kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                       '/fedora-secondary/releases/29/Everything/ppc64le/os'
@@ -25,7 +25,6 @@ def do_test_linux_boot(self):
         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
         self.vm.set_console()
-        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
         self.vm.add_args('-kernel', kernel_path,
                          '-append', kernel_command_line)
         self.vm.launch()
@@ -54,6 +53,22 @@ def test_linux_smp_boot(self):
         wait_for_console_pattern(self, console_pattern, self.panic_message)
         wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+    def test_linux_smp_hpt_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv
+        :avocado: tags=accel:tcg
+        """
+
+        self.vm.add_args('-smp', '4')
+        self.do_test_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
+                                'disable_radix')
+        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
+        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
+                                 self.panic_message)
+        wait_for_console_pattern(self, console_pattern, self.panic_message)
+        wait_for_console_pattern(self, self.good_message, self.panic_message)
+
     def test_linux_smt_boot(self):
         """
         :avocado: tags=arch:ppc64
tests/avocado/ppc_pseries.py +17 -3
index a8311e6555..74aaa4ac4a 100644
@@ -12,11 +12,11 @@
 class pseriesMachine(QemuSystemTest):
 
     timeout = 90
-    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
     panic_message = 'Kernel panic - not syncing'
     good_message = 'VFS: Cannot open root device'
 
-    def do_test_ppc64_linux_boot(self):
+    def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE):
         kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                       '/fedora-secondary/releases/29/Everything/ppc64le/os'
                       '/ppc/ppc64/vmlinuz')
@@ -24,7 +24,6 @@ def do_test_ppc64_linux_boot(self):
         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
         self.vm.set_console()
-        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
         self.vm.add_args('-kernel', kernel_path,
                          '-append', kernel_command_line)
         self.vm.launch()
@@ -62,6 +61,21 @@ def test_ppc64_linux_smp_boot(self):
         wait_for_console_pattern(self, console_pattern, self.panic_message)
         wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+    def test_ppc64_linux_hpt_smp_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        """
+
+        self.vm.add_args('-smp', '4')
+        self.do_test_ppc64_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
+                                      'disable_radix')
+        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
+        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
+                                 self.panic_message)
+        wait_for_console_pattern(self, console_pattern, self.panic_message)
+        wait_for_console_pattern(self, self.good_message, self.panic_message)
+
     def test_ppc64_linux_smt_boot(self):
         """
         :avocado: tags=arch:ppc64
Signature · 1 line
2.42.0
#3 lore raw

Re: [RFC PATCH 02/11] tests/avocado: Add ppc pseries and powernv Hash MMU tests

Quoted 5 lines · Nicholas Piggin

The Hash MMU mode is supported along side Radix in POWER hardware, and Linux supports running in either mode. Radix is the default so to keep up testing of QEMU Hash MMU, add some explicit Hash MMU tests.

Nice ! Could we do the same with XICS and XIVE (xive=off) ? since XIVE is the default now.

May be we should add a boot test for all CPUs supported by pseries :

970, 970mp, POWER5+, P8, P9, P10.

Same for PowerNV.

Thanks,

C.

Quoted 102 lines
---
  tests/avocado/ppc_powernv.py | 21 ++++++++++++++++++---
  tests/avocado/ppc_pseries.py | 20 +++++++++++++++++---
  2 files changed, 35 insertions(+), 6 deletions(-)
tests/avocado/ppc_powernv.py +18 -3
index d0e5c07bde..2be322c47d 100644
@@ -12,11 +12,11 @@
  class powernvMachine(QemuSystemTest):
 
      timeout = 90
-    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
      panic_message = 'Kernel panic - not syncing'
      good_message = 'VFS: Cannot open root device'
 
-    def do_test_linux_boot(self):
+    def do_test_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE):
          self.require_accelerator("tcg")
          kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                        '/fedora-secondary/releases/29/Everything/ppc64le/os'
@@ -25,7 +25,6 @@ def do_test_linux_boot(self):
          kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
          self.vm.set_console()
-        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
          self.vm.add_args('-kernel', kernel_path,
                           '-append', kernel_command_line)
          self.vm.launch()
@@ -54,6 +53,22 @@ def test_linux_smp_boot(self):
          wait_for_console_pattern(self, console_pattern, self.panic_message)
          wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+    def test_linux_smp_hpt_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv
+        :avocado: tags=accel:tcg
+        """
+
+        self.vm.add_args('-smp', '4')
+        self.do_test_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
+                                'disable_radix')
+        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
+        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
+                                 self.panic_message)
+        wait_for_console_pattern(self, console_pattern, self.panic_message)
+        wait_for_console_pattern(self, self.good_message, self.panic_message)
+
      def test_linux_smt_boot(self):
          """
          :avocado: tags=arch:ppc64
tests/avocado/ppc_pseries.py +17 -3
index a8311e6555..74aaa4ac4a 100644
@@ -12,11 +12,11 @@
  class pseriesMachine(QemuSystemTest):
 
      timeout = 90
-    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
      panic_message = 'Kernel panic - not syncing'
      good_message = 'VFS: Cannot open root device'
 
-    def do_test_ppc64_linux_boot(self):
+    def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE):
          kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                        '/fedora-secondary/releases/29/Everything/ppc64le/os'
                        '/ppc/ppc64/vmlinuz')
@@ -24,7 +24,6 @@ def do_test_ppc64_linux_boot(self):
          kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
          self.vm.set_console()
-        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
          self.vm.add_args('-kernel', kernel_path,
                           '-append', kernel_command_line)
          self.vm.launch()
@@ -62,6 +61,21 @@ def test_ppc64_linux_smp_boot(self):
          wait_for_console_pattern(self, console_pattern, self.panic_message)
          wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+    def test_ppc64_linux_hpt_smp_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        """
+
+        self.vm.add_args('-smp', '4')
+        self.do_test_ppc64_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
+                                      'disable_radix')
+        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
+        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
+                                 self.panic_message)
+        wait_for_console_pattern(self, console_pattern, self.panic_message)
+        wait_for_console_pattern(self, self.good_message, self.panic_message)
+
      def test_ppc64_linux_smt_boot(self):
          """
          :avocado: tags=arch:ppc64
author reviewer
#4 lore raw

RFC PATCH 3/11 tests/avocado: Add pseries KVM boot_linux test

In reply to Nicholas Piggin

There is not much support for KVM backend. Add a KVM boot_linux.py test for pseries.

---
 tests/avocado/boot_linux.py | 9 +++++++++
 1 file changed, 9 insertions(+)
tests/avocado/boot_linux.py +9 -0
index be30dcbd58..6ce08ff6aa 100644
@@ -103,6 +103,15 @@ def test_pseries_tcg(self):
         self.vm.add_args("-accel", "tcg")
         self.launch_and_wait(set_up_ssh_connection=False)
 
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_kvm(self):
+        """
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.vm.add_args("-accel", "kvm")
+        self.launch_and_wait(set_up_ssh_connection=False)
 
 class BootLinuxS390X(LinuxTest):
     """
Signature · 1 line
2.42.0
author reviewer
#5 lore raw

RFC PATCH 4/11 tests/avocado: ppc add hypervisor tests

In reply to Nicholas Piggin

The powernv and pseries machines both provide hypervisor facilities, which is a large and complicated set of features that don't get much system testing in CI.

Add a new test case for these which runs QEMU KVM inside the target.

---
 tests/avocado/ppc_hv_tests.py | 173 ++++++++++++++++++++++++++++++++++
 1 file changed, 173 insertions(+)
 create mode 100644 tests/avocado/ppc_hv_tests.py
tests/avocado/ppc_hv_tests.py new file +173 -0
new file mode 100644
index 0000000000..16aac1d35d
@@ -0,0 +1,173 @@
+# Tests that specifically try to exercise hypervisor features of the
+# target machines. powernv supports the Power hypervisor ISA, and
+# pseries supports the nested-HV hypervisor spec.
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado import skipIf
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern, exec_command
+import os
+import time
+import subprocess
+
+# Alpine is a light weight distro that supports QEMU. These tests boot
+# that on the machine then run a QEMU guest inside it in KVM mode,
+# that runs the same Alpine distro image.
+# QEMU packages are downloaded and installed on each test. That's not a
+# large download, but it may be more polite to create qcow2 image with
+# QEMU already installed and use that.
+class HypervisorTest(QemuSystemTest):
+
+    timeout = 600
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
+    panic_message = 'Kernel panic - not syncing'
+    good_message = 'VFS: Cannot open root device'
+
+    def extract_from_iso(self, iso, path):
+        """
+        Extracts a file from an iso file into the test workdir
+
+        :param iso: path to the iso file
+        :param path: path within the iso file of the file to be extracted
+        :returns: path of the extracted file
+        """
+        filename = os.path.basename(path)
+
+        cwd = os.getcwd()
+        os.chdir(self.workdir)
+
+        with open(filename, "w") as outfile:
+            cmd = "isoinfo -i %s -R -x %s" % (iso, path)
+            subprocess.run(cmd.split(), stdout=outfile)
+
+        os.chdir(cwd)
+
+        # Return complete path to extracted file.  Because callers to
+        # extract_from_iso() specify 'path' with a leading slash, it is
+        # necessary to use os.path.relpath() as otherwise os.path.join()
+        # interprets it as an absolute path and drops the self.workdir part.
+        return os.path.normpath(os.path.join(self.workdir, filename))
+
+    def do_start_alpine(self):
+        iso_url = ('https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/ppc64le/alpine-standard-3.18.4-ppc64le.iso')
+
+        # Alpine use sha256 so I recalculated this myself
+        iso_sha256 = 'c26b8d3e17c2f3f0fed02b4b1296589c2390e6d5548610099af75300edd7b3ff'
+        iso_path = self.fetch_asset(iso_url, asset_hash=iso_sha256,
+                                    algorithm = "sha256")
+
+        vmlinuz = self.extract_from_iso(iso_path, '/boot/vmlinuz-lts')
+        initramfs = self.extract_from_iso(iso_path, '/boot/initramfs-lts')
+
+        self.vm.set_console()
+        self.vm.add_args("-kernel", vmlinuz)
+        self.vm.add_args("-initrd", initramfs)
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+                               'console=hvc0')
+        self.require_accelerator("tcg")
+
+        self.vm.add_args("-accel", "tcg,thread=multi")
+        self.vm.add_args("-smp", "4", "-m", "2g")
+        self.vm.add_args("-drive", f"file={iso_path},format=raw,if=none,id=drive0")
+#        self.vm.add_args("-drive", f"file={iso_path},format=raw")
+
+        self.vm.launch()
+        wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'localhost login:')
+        wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
+        exec_command(self, 'setup-alpine -qe')
+        wait_for_console_pattern(self, 'localhost:~#')
+
+    def do_stop_alpine(self):
+        exec_command(self, 'poweroff')
+        wait_for_console_pattern(self, 'alpine:~#')
+        self.vm.wait()
+
+    def do_setup_kvm(self):
+        exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/main > /etc/apk/repositories')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/community >> /etc/apk/repositories')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'apk update')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'apk add qemu-system-ppc64')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'modprobe kvm-hv')
+        wait_for_console_pattern(self, 'alpine:~#')
+
+    def do_test_kvm(self, hpt=False):
+        if hpt:
+            append = 'disable_radix'
+        else:
+            append = ''
+        exec_command(self, 'qemu-system-ppc64 -nographic -smp 2 -m 1g '
+                           '-machine pseries,x-vof=on,accel=kvm '
+                           '-machine cap-cfpc=broken,cap-sbbc=broken,'
+                                    'cap-ibs=broken,cap-ccf-assist=off '
+                           '-drive file=/dev/nvme0n1,format=raw,readonly=on '
+                           '-initrd /media/nvme0n1/boot/initramfs-lts '
+                           '-kernel /media/nvme0n1/boot/vmlinuz-lts '
+                           '-append \'usbcore.nousb ' + append + '\'')
+        # Alpine 3.18 kernel seems to crash in XHCI USB driver.
+        wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'localhost login:')
+        wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
+        exec_command(self, 'poweroff >& /dev/null')
+        wait_for_console_pattern(self, 'localhost:~#')
+        wait_for_console_pattern(self, 'reboot: Power down')
+        time.sleep(1)
+        exec_command(self, '') # console has strange issue after qemu exit
+        exec_command(self, 'reset')
+        exec_command(self, 'echo VM finished')
+        wait_for_console_pattern(self, 'VM finished')
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_hv_pseries(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
+        self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_stop_alpine()
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_hv_pseries_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
+        self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_stop_alpine()
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_hv_powernv(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv
+        :avocado: tags=accel:tcg
+        """
+        self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
+                         '-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
+                         '-netdev', 'user,id=net0,hostfwd=::20022-:22,hostname=alpine')
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_test_kvm(True)
+        self.do_stop_alpine()
Signature · 1 line
2.42.0
#6 lore raw

Re: [RFC PATCH 04/11] tests/avocado: ppc add hypervisor tests

+ Anushree, Hari - FYI

Quoted 77 lines · Nicholas Piggin

The powernv and pseries machines both provide hypervisor facilities, which is a large and complicated set of features that don't get much system testing in CI.

Add a new test case for these which runs QEMU KVM inside the target.

---
  tests/avocado/ppc_hv_tests.py | 173 ++++++++++++++++++++++++++++++++++
  1 file changed, 173 insertions(+)

create mode 100644 tests/avocado/ppc_hv_tests.py

tests/avocado/ppc_hv_tests.py new file +61 -0
new file mode 100644
index 0000000000..16aac1d35d
@@ -0,0 +1,173 @@
+# Tests that specifically try to exercise hypervisor features of the
+# target machines. powernv supports the Power hypervisor ISA, and
+# pseries supports the nested-HV hypervisor spec.
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado import skipIf
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern, exec_command
+import os
+import time
+import subprocess
+
+# Alpine is a light weight distro that supports QEMU. These tests boot
+# that on the machine then run a QEMU guest inside it in KVM mode,
+# that runs the same Alpine distro image.
+# QEMU packages are downloaded and installed on each test. That's not a
+# large download, but it may be more polite to create qcow2 image with
+# QEMU already installed and use that.
+class HypervisorTest(QemuSystemTest):
+
+    timeout = 600
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
+    panic_message = 'Kernel panic - not syncing'
+    good_message = 'VFS: Cannot open root device'
+
+    def extract_from_iso(self, iso, path):
+        """
+        Extracts a file from an iso file into the test workdir
+
+        :param iso: path to the iso file
+        :param path: path within the iso file of the file to be extracted
+        :returns: path of the extracted file
+        """
+        filename = os.path.basename(path)
+
+        cwd = os.getcwd()
+        os.chdir(self.workdir)
+
+        with open(filename, "w") as outfile:
+            cmd = "isoinfo -i %s -R -x %s" % (iso, path)
+            subprocess.run(cmd.split(), stdout=outfile)
+
+        os.chdir(cwd)
+
+        # Return complete path to extracted file.  Because callers to
+        # extract_from_iso() specify 'path' with a leading slash, it is
+        # necessary to use os.path.relpath() as otherwise os.path.join()
+        # interprets it as an absolute path and drops the self.workdir part.
+        return os.path.normpath(os.path.join(self.workdir, filename))
+
+    def do_start_alpine(self):
+        iso_url = ('https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/ppc64le/alpine-standard-3.18.4-ppc64le.iso')
+
+        # Alpine use sha256 so I recalculated this myself
+        iso_sha256 = 'c26b8d3e17c2f3f0fed02b4b1296589c2390e6d5548610099af75300edd7b3ff'
+        iso_path = self.fetch_asset(iso_url, asset_hash=iso_sha256,

tests/avocado/ppc_hv_tests.py line 71

Quoted 10 lines
tests/avocado/ppc_hv_tests.py new file +10 -0
+                                    algorithm = "sha256")
+
+        vmlinuz = self.extract_from_iso(iso_path, '/boot/vmlinuz-lts')
+        initramfs = self.extract_from_iso(iso_path, '/boot/initramfs-lts')
+
+        self.vm.set_console()
+        self.vm.add_args("-kernel", vmlinuz)
+        self.vm.add_args("-initrd", initramfs)
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+                               'console=hvc0')

console=hvc0 was already added to KERNEL_COMMON_COMMAND_LINE during init.

tests/avocado/ppc_hv_tests.py line 77

Quoted 6 lines
tests/avocado/ppc_hv_tests.py new file +6 -0
+        self.require_accelerator("tcg")
+
+        self.vm.add_args("-accel", "tcg,thread=multi")
+        self.vm.add_args("-smp", "4", "-m", "2g")
+        self.vm.add_args("-drive", f"file={iso_path},format=raw,if=none,id=drive0")
+#        self.vm.add_args("-drive", f"file={iso_path},format=raw")

commented code can be removed.

Quoted 66 lines
tests/avocado/ppc_hv_tests.py new file +66 -0
+
+        self.vm.launch()
+        wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'localhost login:')
+        wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
+        exec_command(self, 'setup-alpine -qe')
+        wait_for_console_pattern(self, 'localhost:~#')
+
+    def do_stop_alpine(self):
+        exec_command(self, 'poweroff')
+        wait_for_console_pattern(self, 'alpine:~#')
+        self.vm.wait()
+
+    def do_setup_kvm(self):
+        exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/main > /etc/apk/repositories')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/community >> /etc/apk/repositories')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'apk update')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'apk add qemu-system-ppc64')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'modprobe kvm-hv')
+        wait_for_console_pattern(self, 'alpine:~#')
+
+    def do_test_kvm(self, hpt=False):
+        if hpt:
+            append = 'disable_radix'
+        else:
+            append = ''
+        exec_command(self, 'qemu-system-ppc64 -nographic -smp 2 -m 1g '
+                           '-machine pseries,x-vof=on,accel=kvm '
+                           '-machine cap-cfpc=broken,cap-sbbc=broken,'
+                                    'cap-ibs=broken,cap-ccf-assist=off '
+                           '-drive file=/dev/nvme0n1,format=raw,readonly=on '
+                           '-initrd /media/nvme0n1/boot/initramfs-lts '
+                           '-kernel /media/nvme0n1/boot/vmlinuz-lts '
+                           '-append \'usbcore.nousb ' + append + '\'')
+        # Alpine 3.18 kernel seems to crash in XHCI USB driver.
+        wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'localhost login:')
+        wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
+        exec_command(self, 'poweroff >& /dev/null')
+        wait_for_console_pattern(self, 'localhost:~#')
+        wait_for_console_pattern(self, 'reboot: Power down')
+        time.sleep(1)
+        exec_command(self, '') # console has strange issue after qemu exit
+        exec_command(self, 'reset')
+        exec_command(self, 'echo VM finished')
+        wait_for_console_pattern(self, 'VM finished')
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_hv_pseries(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
+        self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_stop_alpine()

tests/avocado/ppc_hv_tests.py line 153

Quoted 10 lines
tests/avocado/ppc_hv_tests.py new file +10 -0
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_hv_pseries_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
+        self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")

Is this meant to launch an L0 with KVM accel on pseries with cap-nested-hv=on and then do another nested guest using KVM (with below steps). Is cap-nested-hv really supported on actual pseries LPARs yet?

regards,
Harsh

Quoted 20 lines
tests/avocado/ppc_hv_tests.py new file +20 -0
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_stop_alpine()
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_hv_powernv(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv
+        :avocado: tags=accel:tcg
+        """
+        self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
+                         '-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
+                         '-netdev', 'user,id=net0,hostfwd=::20022-:22,hostname=alpine')
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_test_kvm(True)
+        self.do_stop_alpine()
author reviewer
#7 lore raw

RFC PATCH 5/11 testing/avocado: ppc add new BookE boot_linux_console.py tests

In reply to Nicholas Piggin

Add simple Linux kernel boot tests for BookE 64-bit and 32-bit CPUs using Guenter Roeck's rootfs images for Linux testing, and a gitlab repository with kernel images that I built since there are very few sources of modern BookE images now.

---
 tests/avocado/boot_linux_console.py | 53 +++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
tests/avocado/boot_linux_console.py +53 -0
index 9434304cd3..dc3346ef49 100644
@@ -1355,6 +1355,59 @@ def test_ppc64_e500(self):
         tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
         self.do_test_advcal_2018('19', tar_hash, 'uImage')
 
+    def test_ppc64_e6500(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:e6500
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/corenet64_vmlinux?ref_type=heads&inline=false')
+        kernel_hash = '01051590b083fec66cb3b9e2e553e95d4cf47691'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+        initrd_url = ('https://github.com/groeck/linux-build-test/raw/master/rootfs/ppc64/rootfs.cpio.gz')
+        initrd_hash = '798acffc036c3b1ae6cacf95c869bba2'
+        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash,
+                                       algorithm="md5")
+
+        self.vm.set_console()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+        self.vm.add_args('-smp', '2',
+                         '-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        # Wait for VM to shut down gracefully
+        self.vm.wait()
+
+    def test_ppc32_mpc85xx(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:mpc8568
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/mpc85xx_vmlinux?ref_type=heads&inline=false')
+        kernel_hash = '726f7f574a491282454850b48546b3827593142b'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+        initrd_url = ('https://github.com/groeck/linux-build-test/raw/master/rootfs/ppc/rootfs.cpio.gz')
+        initrd_hash = '4d30fa93b742c493e8cf2140e49bbd9a'
+        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash,
+                                       algorithm="md5")
+
+        self.vm.set_console()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+        self.vm.add_args('-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        # Wait for VM to shut down gracefully
+        self.vm.wait()
+
     def do_test_ppc64_powernv(self, proc):
         self.require_accelerator("tcg")
         images_url = ('https://github.com/open-power/op-build/releases/download/v2.7/')
Signature · 1 line
2.42.0
Reviewed-by on v1 5/11
#8 lore raw

Re: [RFC PATCH 05/11] testing/avocado: ppc add new BookE boot_linux_console.py tests

Quoted 9 lines · Nicholas Piggin

Add simple Linux kernel boot tests for BookE 64-bit and 32-bit CPUs using Guenter Roeck's rootfs images for Linux testing, and a gitlab repository with kernel images that I built since there are very few sources of modern BookE images now.

---
  tests/avocado/boot_linux_console.py | 53 +++++++++++++++++++++++++++++
  1 file changed, 53 insertions(+)
Reviewed-by on v1 5/11
#9 lore raw

Re: [RFC PATCH 05/11] testing/avocado: ppc add new BookE boot_linux_console.py tests

In reply to Nicholas Piggin
Quoted 7 lines · Nicholas Piggin

Add simple Linux kernel boot tests for BookE 64-bit and 32-bit CPUs using Guenter Roeck's rootfs images for Linux testing, and a gitlab repository with kernel images that I built since there are very few sources of modern BookE images now.

Should we get mpe to add a https://github.com/linuxppc/qemu-ci-images
for you to keep those kernel images? But perhaps you'd prefer to keep them on gitlab. Just a suggestion.

Quoted 10 lines
---
 tests/avocado/boot_linux_console.py | 53 +++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
tests/avocado/boot_linux_console.py +0 -0
index 9434304cd3..dc3346ef49 100644
@@ -1355,6 +1355,59 @@ def test_ppc64_e500(self):
         tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'

tests/avocado/boot_linux_console.py def test_ppc64_e500(self): · line 1365

Quoted 10 lines
tests/avocado/boot_linux_console.py +8 -0
         self.do_test_advcal_2018('19', tar_hash, 'uImage')
 
+    def test_ppc64_e6500(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:e6500
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/corenet64_vmlinux?ref_type=heads&inline=false')

Is the ref_type?heads=inline-false required? I seem to get the file successfully with wget and those omitted.

Quoted 52 lines
tests/avocado/boot_linux_console.py +45 -1
+        kernel_hash = '01051590b083fec66cb3b9e2e553e95d4cf47691'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+        initrd_url = ('https://github.com/groeck/linux-build-test/raw/master/rootfs/ppc64/rootfs.cpio.gz')
+        initrd_hash = '798acffc036c3b1ae6cacf95c869bba2'
+        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash,
+                                       algorithm="md5")
+
+        self.vm.set_console()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+        self.vm.add_args('-smp', '2',
+                         '-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        # Wait for VM to shut down gracefully
+        self.vm.wait()
+
+    def test_ppc32_mpc85xx(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:mpc8568
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/mpc85xx_vmlinux?ref_type=heads&inline=false')
+        kernel_hash = '726f7f574a491282454850b48546b3827593142b'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+        initrd_url = ('https://github.com/groeck/linux-build-test/raw/master/rootfs/ppc/rootfs.cpio.gz')
+        initrd_hash = '4d30fa93b742c493e8cf2140e49bbd9a'
+        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash,
+                                       algorithm="md5")
+
+        self.vm.set_console()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+        self.vm.add_args('-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        # Wait for VM to shut down gracefully
+        self.vm.wait()
+
     def do_test_ppc64_powernv(self, proc):
         self.require_accelerator("tcg")
         images_url = ('https://github.com/open-power/op-build/releases/download/v2.7/')
--

2.42.0

author reviewer
#10 lore raw

Re: [RFC PATCH 05/11] testing/avocado: ppc add new BookE boot_linux_console.py tests

Quoted 7 lines · Joel Stanley
Quoted 6 lines · Nicholas Piggin

Add simple Linux kernel boot tests for BookE 64-bit and 32-bit CPUs using Guenter Roeck's rootfs images for Linux testing, and a gitlab repository with kernel images that I built since there are very few sources of modern BookE images now.

Quoted 7 lines
Quoted 1 line

Should we get mpe to add a https://github.com/linuxppc/qemu-ci-images
for you to keep those kernel images? But perhaps you'd prefer to keep them on gitlab. Just a suggestion.

Not a bad idea. Or we could try for gitlab/qemu/ci-images I suppose.

Quoted 13 lines
Quoted 13 lines
---
 tests/avocado/boot_linux_console.py | 53 +++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
tests/avocado/boot_linux_console.py +0 -0
index 9434304cd3..dc3346ef49 100644
@@ -1355,6 +1355,59 @@ def test_ppc64_e500(self):
         tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
         self.do_test_advcal_2018('19', tar_hash, 'uImage')
 
Quoted 11 lines

tests/avocado/boot_linux_console.py def test_ppc64_e500(self): · line 1365

Quoted 8 lines
tests/avocado/boot_linux_console.py +8 -0
+    def test_ppc64_e6500(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:e6500
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/corenet64_vmlinux?ref_type=heads&inline=false')

Is the ref_type?heads=inline-false required? I seem to get the file successfully with wget and those omitted.

I just copied the download link, so if it works without then I'll remove it.

Thanks,
Nick

#11 lore raw

Re: [RFC PATCH 05/11] testing/avocado: ppc add new BookE boot_linux_console.py tests

Quoted 10 lines · Nicholas Piggin
Quoted 9 lines · Joel Stanley
Quoted 7 lines · Nicholas Piggin

Add simple Linux kernel boot tests for BookE 64-bit and 32-bit CPUs using Guenter Roeck's rootfs images for Linux testing, and a gitlab repository with kernel images that I built since there are very few sources of modern BookE images now.

Quoted 7 lines
Quoted 5 lines

Should we get mpe to add a https://github.com/linuxppc/qemu-ci-images
for you to keep those kernel images? But perhaps you'd prefer to keep them on gitlab. Just a suggestion.

Not a bad idea. Or we could try for gitlab/qemu/ci-images I suppose.

Feel free to take these :

https://github.com/legoater/qemu-ppc-boot/tree/main/buildroot

Supported machines

prep/ppc 604 CPU
ref405ep/ppc 405EP CPU
bamboo/ppc 440EP CPU
sam460ex/ppc 460EX CPU (equivalent to a 440) g3beige/ppc G3 CPU
mac99/ppc G4 CPU
e500mc/ppc e500mc CPU
mpc8544ds/ppc e500v2 CPU
ppce500/ppc64 e5500, e6500
mac99/ppc64 970 CPU with 64bit and 32bit user space pseries/ppc64 POWER5+, 970, 970MP, POWER7 pseries/ppc64le POWER8, POWER9, POWER10 powernv8/ppc64le POWER8 HV CPU powernv9/ppc64le POWER9 HV CPU

Thanks,

C.

Quoted 32 lines
Quoted 14 lines
Quoted 14 lines

---
  tests/avocado/boot_linux_console.py | 53 +++++++++++++++++++++++++++++
  1 file changed, 53 insertions(+)
tests/avocado/boot_linux_console.py +0 -0
index 9434304cd3..dc3346ef49 100644
@@ -1355,6 +1355,59 @@ def test_ppc64_e500(self):
          tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
          self.do_test_advcal_2018('19', tar_hash, 'uImage')
 
Quoted 11 lines

tests/avocado/boot_linux_console.py def test_ppc64_e500(self): · line 1365

Quoted 8 lines
tests/avocado/boot_linux_console.py +8 -0
+    def test_ppc64_e6500(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:e6500
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/corenet64_vmlinux?ref_type=heads&inline=false')

Is the ref_type?heads=inline-false required? I seem to get the file successfully with wget and those omitted.

I just copied the download link, so if it works without then I'll remove it.

Thanks,
Nick

#12 lore raw

Re: [RFC PATCH 05/11] testing/avocado: ppc add new BookE boot_linux_console.py tests

In reply to Nicholas Piggin
Quoted 20 lines · Nicholas Piggin

Add simple Linux kernel boot tests for BookE 64-bit and 32-bit CPUs using Guenter Roeck's rootfs images for Linux testing, and a gitlab repository with kernel images that I built since there are very few sources of modern BookE images now.

---
  tests/avocado/boot_linux_console.py | 53 +++++++++++++++++++++++++++++
  1 file changed, 53 insertions(+)
tests/avocado/boot_linux_console.py +2 -0
index 9434304cd3..dc3346ef49 100644
@@ -1355,6 +1355,59 @@ def test_ppc64_e500(self):
          tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
          self.do_test_advcal_2018('19', tar_hash, 'uImage')
 
+    def test_ppc64_e6500(self):
+        """

tests/avocado/boot_linux_console.py def test_ppc64_e500(self): · line 1369

Quoted 10 lines
tests/avocado/boot_linux_console.py +10 -0
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:e6500
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/corenet64_vmlinux?ref_type=heads&inline=false')
+        kernel_hash = '01051590b083fec66cb3b9e2e553e95d4cf47691'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+        initrd_url = ('https://github.com/groeck/linux-build-test/raw/master/rootfs/ppc64/rootfs.cpio.gz')

I think you should use buildroot images from the qemu_ppc64_e5500 defconfig:

https://github.com/buildroot/buildroot/tree/master/board/qemu/ppc64-e5500

The question is where to store them. I did under my GH account for PPC and Aspeed but it is not satisfactory in the long term.

May be could have a common repo for all the buildroot QEMU boards images ? and rebuild once a year ?

Thanks,

C.

Quoted 44 lines
tests/avocado/boot_linux_console.py +41 -0
+        initrd_hash = '798acffc036c3b1ae6cacf95c869bba2'
+        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash,
+                                       algorithm="md5")
+
+        self.vm.set_console()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+        self.vm.add_args('-smp', '2',
+                         '-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        # Wait for VM to shut down gracefully
+        self.vm.wait()
+
+    def test_ppc32_mpc85xx(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:ppce500
+        :avocado: tags=cpu:mpc8568
+        :avocado: tags=accel:tcg
+        """
+        kernel_url = ('https://gitlab.com/npiggin/qemu-ci-images/-/raw/main/ppc/mpc85xx_vmlinux?ref_type=heads&inline=false')
+        kernel_hash = '726f7f574a491282454850b48546b3827593142b'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+        initrd_url = ('https://github.com/groeck/linux-build-test/raw/master/rootfs/ppc/rootfs.cpio.gz')
+        initrd_hash = '4d30fa93b742c493e8cf2140e49bbd9a'
+        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash,
+                                       algorithm="md5")
+
+        self.vm.set_console()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+        self.vm.add_args('-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        # Wait for VM to shut down gracefully
+        self.vm.wait()
+
      def do_test_ppc64_powernv(self, proc):
          self.require_accelerator("tcg")
          images_url = ('https://github.com/open-power/op-build/releases/download/v2.7/')
author reviewer
#13 lore raw

RFC PATCH 6/11 tests/avocado: Add FreeBSD distro boot tests for ppc

In reply to Nicholas Piggin

FreeBSD project provides qcow2 images that work well for testing QEMU. Add pseries tests for HPT and Radix, KVM and TCG.

Other architectures could be added so this does not get a ppc_ prefix but is instead named similarly to boot_linux.

CC'ing Warner to check if it's okay for us to use these images and any comments or suggestions. avocado tests have many Linux boots so we'd do much better to expand test coverage by adding some other systems.

---
 tests/avocado/boot_freebsd.py | 109 ++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 tests/avocado/boot_freebsd.py
tests/avocado/boot_freebsd.py new file +109 -0
new file mode 100644
index 0000000000..9a499a28ad
@@ -0,0 +1,109 @@
+# Functional tests that boot FreeBSD in various configurations
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import os
+
+from avocado import skipUnless
+from avocado import skipIf
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+from avocado_qemu import exec_command
+from avocado.utils import archive
+from avocado.utils import process
+from avocado.utils.path import find_command
+
+class BootFreeBSDPPC64(QemuSystemTest):
+    """
+    :avocado: tags=arch:ppc64
+    """
+
+    timeout = 360
+
+    def run_pseries_test(self, force_HPT=False):
+        # We need zstd for all the tuxrun tests
+        # See https://github.com/avocado-framework/avocado/issues/5609
+        zstd = find_command('zstd', False)
+        if zstd is False:
+            self.cancel('Could not find "zstd", which is required to '
+                        'decompress rootfs')
+        self.zstd = zstd
+
+        drive_url = ('https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/a2440348eed75bb7682579af0905b652747fd016/powerpc/powerpc64le/disk.qcow2.zst')
+        drive_hash = '8ab11a05ccab3d44215fd4667a70454ed10a203f'
+        drive_path_zstd = self.fetch_asset(drive_url, asset_hash=drive_hash)
+        drive_path = os.path.join(self.workdir, 'disk.qcow2')
+        # archive.zstd_uncompress(drive_path_zstd, drive_path)
+
+        cmd = f"{self.zstd} -d {drive_path_zstd} -o {drive_path}"
+        process.run(cmd)
+
+        drive = f"file={drive_path},format=qcow2,if=virtio"
+
+        self.vm.set_console()
+        if force_HPT:
+            self.vm.add_args('-m', '4g')
+        else:
+            self.vm.add_args('-m', '1g')
+        self.vm.add_args('-smp', '4')
+        self.vm.add_args('-drive', drive)
+        self.vm.add_args('-net', 'nic,model=virtio')
+        self.vm.launch()
+
+        wait_for_console_pattern(self, 'Hit [Enter] to boot immediately, or any other key for command prompt.')
+        if force_HPT:
+            exec_command(self, 'x')
+            wait_for_console_pattern(self, 'OK')
+            exec_command(self, 'set radix_mmu=0')
+            exec_command(self, 'boot')
+            wait_for_console_pattern(self, 'cas: selected hash MMU', 'panic:')
+        else:
+            exec_command(self, '')
+            wait_for_console_pattern(self, 'cas: selected radix MMU')
+
+        wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT #0 a244034: Mon Sep 25 02:05:22 UTC 2023', 'panic:')
+        wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs')
+        wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)', 'panic:')
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.run_pseries_test()
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_hpt_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.run_pseries_test(force_HPT=True)
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.run_pseries_test()
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_hpt_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.run_pseries_test(force_HPT=True)
Signature · 1 line
2.42.0
Reviewed-by on v1 6/11
#14 lore raw

Re: [RFC PATCH 06/11] tests/avocado: Add FreeBSD distro boot tests for ppc

Quoted 6 lines · Nicholas Piggin

FreeBSD project provides qcow2 images that work well for testing QEMU. Add pseries tests for HPT and Radix, KVM and TCG.

Other architectures could be added so this does not get a ppc_ prefix but is instead named similarly to boot_linux.

Quoted 7 lines

CC'ing Warner to check if it's okay for us to use these images and any comments or suggestions. avocado tests have many Linux boots so we'd do much better to expand test coverage by adding some other systems.

I like this.... I'm a little worried at the exact hash encoded in it, but since there's a checksum
to match, it's OK I guess. It will give this code a shelf-life of months, IIRC our retention policy.

Other than that, I think this is good. Not familiar enough with Avocado to understand
skipping for gitlab CI, but given the extreme crunch on minutes, I think that's OK.

Other than one nit below which is fine if it is intentionally left behind (or removed):

Please don't hesitate to reach out to me if this is failing. I'll act as a backstop to get
it to the right people.

Warner

Quoted 52 lines
---
 tests/avocado/boot_freebsd.py | 109 ++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 tests/avocado/boot_freebsd.py
tests/avocado/boot_freebsd.py new file +35 -0
new file mode 100644
index 0000000000..9a499a28ad
@@ -0,0 +1,109 @@
+# Functional tests that boot FreeBSD in various configurations
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import os
+
+from avocado import skipUnless
+from avocado import skipIf
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+from avocado_qemu import exec_command
+from avocado.utils import archive
+from avocado.utils import process
+from avocado.utils.path import find_command
+
+class BootFreeBSDPPC64(QemuSystemTest):
+    """
+    :avocado: tags=arch:ppc64
+    """
+
+    timeout = 360
+
+    def run_pseries_test(self, force_HPT=False):
+        # We need zstd for all the tuxrun tests
+        # See https://github.com/avocado-framework/avocado/issues/5609
+        zstd = find_command('zstd', False)
+        if zstd is False:
+            self.cancel('Could not find "zstd", which is required to '
+                        'decompress rootfs')
+        self.zstd = zstd
+
+        drive_url = ('

https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/a2440348eed75bb7682579af0905b652747fd016/powerpc/powerpc64le/disk.qcow2.zst
')

tests/avocado/boot_freebsd.py new file +2 -0
+        drive_hash = '8ab11a05ccab3d44215fd4667a70454ed10a203f'
+        drive_path_zstd = self.fetch_asset(drive_url,

asset_hash=drive_hash)

tests/avocado/boot_freebsd.py line 39

Quoted 2 lines
tests/avocado/boot_freebsd.py new file +2 -0
+        drive_path = os.path.join(self.workdir, 'disk.qcow2')
+        # archive.zstd_uncompress(drive_path_zstd, drive_path)

Why is this commented out? It looks like a leftover maybe?

Quoted 79 lines
tests/avocado/boot_freebsd.py new file +17 -0
+
+        cmd = f"{self.zstd} -d {drive_path_zstd} -o {drive_path}"
+        process.run(cmd)
+
+        drive = f"file={drive_path},format=qcow2,if=virtio"
+
+        self.vm.set_console()
+        if force_HPT:
+            self.vm.add_args('-m', '4g')
+        else:
+            self.vm.add_args('-m', '1g')
+        self.vm.add_args('-smp', '4')
+        self.vm.add_args('-drive', drive)
+        self.vm.add_args('-net', 'nic,model=virtio')
+        self.vm.launch()
+
+        wait_for_console_pattern(self, 'Hit [Enter] to boot immediately,

or any other key for command prompt.')

tests/avocado/boot_freebsd.py new file +6 -0
+        if force_HPT:
+            exec_command(self, 'x')
+            wait_for_console_pattern(self, 'OK')
+            exec_command(self, 'set radix_mmu=0')
+            exec_command(self, 'boot')
+            wait_for_console_pattern(self, 'cas: selected hash MMU',

'panic:')

tests/avocado/boot_freebsd.py new file +5 -0
+        else:
+            exec_command(self, '')
+            wait_for_console_pattern(self, 'cas: selected radix MMU')
+
+        wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT #0 a244034:

Mon Sep 25 02:05:22 UTC 2023', 'panic:')
+ wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor
System Detected: 4 CPUs')
+ wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac)
(ttyu0)', 'panic:')

tests/avocado/boot_freebsd.py new file +40 -1
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.run_pseries_test()
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_hpt_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.run_pseries_test(force_HPT=True)
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.run_pseries_test()
+
+    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+    def test_pseries_hpt_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.run_pseries_test(force_HPT=True)
--

2.42.0

author reviewer
#15 lore raw

Re: [RFC PATCH 06/11] tests/avocado: Add FreeBSD distro boot tests for ppc

Quoted 16 lines · Warner Losh
Quoted 6 lines · Nicholas Piggin

FreeBSD project provides qcow2 images that work well for testing QEMU. Add pseries tests for HPT and Radix, KVM and TCG.

Other architectures could be added so this does not get a ppc_ prefix but is instead named similarly to boot_linux.

Quoted 7 lines

CC'ing Warner to check if it's okay for us to use these images and any comments or suggestions. avocado tests have many Linux boots so we'd do much better to expand test coverage by adding some other systems.

Quoted 4 lines

I like this.... I'm a little worried at the exact hash encoded in it, but since there's a checksum
to match, it's OK I guess. It will give this code a shelf-life of months, IIRC our retention policy.

Oh I didn't realise, I saw some 2021 dates in the directory listing but looks like they're not for the artifacts themselves.

I don't suppose you know if there are any long-term artifacts kept around, or someone who I could ask?

The downside of using short term images is that it can be harder to reproduce reports from others, bisect, run manual testing, etc. I think these would still be useful, so long as they get updated regularly.

Quoted 5 lines

Other than that, I think this is good. Not familiar enough with Avocado to understand
skipping for gitlab CI, but given the extreme crunch on minutes, I think that's OK.

Yeah I'm not sure what the situation there is, I didn't want to add new tests of any significant weight yet. We could always flip it on later if people want it.

Quoted 9 lines

Other than one nit below which is fine if it is intentionally left behind (or removed):

Please don't hesitate to reach out to me if this is failing. I'll act as a backstop to get
it to the right people.

Thanks Warner.

Quoted 4 lines

Warner

[snip]

Quoted 19 lines
Quoted 16 lines
tests/avocado/boot_freebsd.py new file +10 -0
+    def run_pseries_test(self, force_HPT=False):
+        # We need zstd for all the tuxrun tests
+        # See https://github.com/avocado-framework/avocado/issues/5609
+        zstd = find_command('zstd', False)
+        if zstd is False:
+            self.cancel('Could not find "zstd", which is required to '
+                        'decompress rootfs')
+        self.zstd = zstd
+
+        drive_url = ('

https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/a2440348eed75bb7682579af0905b652747fd016/powerpc/powerpc64le/disk.qcow2.zst
')

(quoted diff) +2 -0
+        drive_hash = '8ab11a05ccab3d44215fd4667a70454ed10a203f'
+        drive_path_zstd = self.fetch_asset(drive_url,

asset_hash=drive_hash)

tests/avocado/boot_freebsd.py line 39

Quoted 2 lines
tests/avocado/boot_freebsd.py new file +2 -0
+        drive_path = os.path.join(self.workdir, 'disk.qcow2')
+        # archive.zstd_uncompress(drive_path_zstd, drive_path)
Quoted 2 lines

Why is this commented out? It looks like a leftover maybe?

Ah yes, avocado recently got zstd_uncompress but it seems not available for QEMU yet so we have to do it by hand. I'll remove.

Thanks,
Nick

#16 lore raw

Re: [RFC PATCH 06/11] tests/avocado: Add FreeBSD distro boot tests for ppc

Quoted 28 lines · Nicholas Piggin
Quoted 1 line · Warner Losh

On Tue, Oct 10, 2023 at 1:53 AM Nicholas Piggin <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines

FreeBSD project provides qcow2 images that work well for testing QEMU. Add pseries tests for HPT and Radix, KVM and TCG.

Quoted 8 lines
Quoted 8 lines

Other architectures could be added so this does not get a ppc_ prefix but is instead named similarly to boot_linux.

CC'ing Warner to check if it's okay for us to use these images and any comments or suggestions. avocado tests have many Linux boots so

we'd

Quoted 7 lines
Quoted 2 lines

do much better to expand test coverage by adding some other systems.

I like this.... I'm a little worried at the exact hash encoded in it, but since there's a checksum
to match, it's OK I guess. It will give this code a shelf-life of months, IIRC our retention policy.

Oh I didn't realise, I saw some 2021 dates in the directory listing but looks
like they're not for the artifacts themselves.

Quoted 7 lines

I don't suppose you know if there are any long-term artifacts kept around, or someone who I could ask?

The downside of using short term images is that it can be harder to reproduce reports from others, bisect, run manual testing, etc. I think these would still be useful, so long as they get updated regularly.

Yes. We're in kind of a weird zone. powerpc64le is a new architecture, so hasn't had artifacts for long. 14.0 is in progress, but not done yet, so there's
no 'long term stable' version to use yet.

I don't know what our current retention policy is, hence my caution.

Quoted 11 lines
Quoted 2 lines

Other than that, I think this is good. Not familiar enough with Avocado

to

Quoted 3 lines

understand
skipping for gitlab CI, but given the extreme crunch on minutes, I think that's OK.

Yeah I'm not sure what the situation there is, I didn't want to add new tests of any significant weight yet. We could always flip it on later if people want it.

That makes sense.

Quoted 4 lines
Quoted 4 lines

Other than one nit below which is fine if it is intentionally left behind (or removed):

Quoted 9 lines
Quoted 3 lines

Please don't hesitate to reach out to me if this is failing. I'll act as

a

Quoted 2 lines

backstop to get
it to the right people.

Thanks Warner.

You bet. I'll give a heads up once we have 14.0 out so we can switch to a more stable artifact.

Warner

Quoted 36 lines
Quoted 4 lines

Warner

[snip]

Quoted 3 lines

tests/avocado/boot_freebsd.py

Quoted 3 lines
tests/avocado/boot_freebsd.py new file +3 -0
+    def run_pseries_test(self, force_HPT=False):
+        # We need zstd for all the tuxrun tests
+        # See

https://github.com/avocado-framework/avocado/issues/5609

Quoted 8 lines

tests/avocado/boot_freebsd.py

Quoted 8 lines
tests/avocado/boot_freebsd.py new file +7 -0
+        zstd = find_command('zstd', False)
+        if zstd is False:
+            self.cancel('Could not find "zstd", which is required to '
+                        'decompress rootfs')
+        self.zstd = zstd
+
+        drive_url = ('

https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/a2440348eed75bb7682579af0905b652747fd016/powerpc/powerpc64le/disk.qcow2.zst

Quoted 10 lines

tests/avocado/boot_freebsd.py line 39

Quoted 7 lines

')

(quoted diff) +2 -0
+        drive_hash = '8ab11a05ccab3d44215fd4667a70454ed10a203f'
+        drive_path_zstd = self.fetch_asset(drive_url,

asset_hash=drive_hash)

tests/avocado/boot_freebsd.py new file +2 -0
+        drive_path = os.path.join(self.workdir, 'disk.qcow2')
+        # archive.zstd_uncompress(drive_path_zstd, drive_path)

Why is this commented out? It looks like a leftover maybe?

Ah yes, avocado recently got zstd_uncompress but it seems not available for QEMU yet so we have to do it by hand. I'll remove.

Thanks,
Nick

author reviewer
#17 lore raw

Re: [RFC PATCH 06/11] tests/avocado: Add FreeBSD distro boot tests for ppc

In reply to Warner Losh
Quoted 16 lines · Warner Losh
Quoted 6 lines · Nicholas Piggin

FreeBSD project provides qcow2 images that work well for testing QEMU. Add pseries tests for HPT and Radix, KVM and TCG.

Other architectures could be added so this does not get a ppc_ prefix but is instead named similarly to boot_linux.

Quoted 7 lines

CC'ing Warner to check if it's okay for us to use these images and any comments or suggestions. avocado tests have many Linux boots so we'd do much better to expand test coverage by adding some other systems.

Quoted 4 lines

I like this.... I'm a little worried at the exact hash encoded in it, but since there's a checksum
to match, it's OK I guess. It will give this code a shelf-life of months, IIRC our retention policy.

The oldest 15.0 CURRENT image on there is May 1st, so ~6 months? That's not too bad. There are some release qcow2 images as well which sound like they're maintained longer-term:

https://download.freebsd.org/releases/VM-IMAGES/

No builds for powerpc, but those might be preferable for other targets.

Another option for powerpc might be to use a release .iso. It's much nicer to have a qcow image already installed though. I'll tinker with it a bit more, but may stick with the snapshot for now.

Thanks,
Nick

#18 lore raw

Re: [RFC PATCH 06/11] tests/avocado: Add FreeBSD distro boot tests for ppc

Quoted 28 lines · Nicholas Piggin
Quoted 1 line · Warner Losh

On Tue, Oct 10, 2023 at 1:53 AM Nicholas Piggin <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines

FreeBSD project provides qcow2 images that work well for testing QEMU. Add pseries tests for HPT and Radix, KVM and TCG.

Quoted 8 lines
Quoted 8 lines

Other architectures could be added so this does not get a ppc_ prefix but is instead named similarly to boot_linux.

CC'ing Warner to check if it's okay for us to use these images and any comments or suggestions. avocado tests have many Linux boots so

we'd

Quoted 7 lines
Quoted 2 lines

do much better to expand test coverage by adding some other systems.

I like this.... I'm a little worried at the exact hash encoded in it, but since there's a checksum
to match, it's OK I guess. It will give this code a shelf-life of months, IIRC our retention policy.

The oldest 15.0 CURRENT image on there is May 1st, so ~6 months? That's not too bad. There are some release qcow2 images as well which sound like they're maintained longer-term:

Quoted 8 lines

https://download.freebsd.org/releases/VM-IMAGES/

No builds for powerpc, but those might be preferable for other targets.

Another option for powerpc might be to use a release .iso. It's much nicer to have a qcow image already installed though. I'll tinker with it a bit more, but may stick with the snapshot for now.

I'll try to track that down. It may just be an oversight since powerpc64le is
new.

Warner

Quoted 3 lines

Thanks,
Nick

author reviewer
#19 lore raw

RFC PATCH 7/11 tests/avocado: Add ppc boot tests for non-free AIX images

In reply to Nicholas Piggin

An AIX image can be provided by setting AIX_IMAGE environment variable when running avocado.

It's questionable whether we should carry these in upstream QEMU. It's convenient to see how to run these things, but simple enough to maintain in out of tree branch. I just wanted to see opinions about it.

---
 tests/avocado/ppc_aix.py | 63 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 tests/avocado/ppc_aix.py
tests/avocado/ppc_aix.py new file +63 -0
new file mode 100644
index 0000000000..b8d5d4cc38
@@ -0,0 +1,63 @@
+# Functional test that boots AIX on ppc pseries TCG and KVM
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+import os
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+
+class pseriesMachine(QemuSystemTest):
+
+    timeout = 600
+
+    def do_test_ppc64_aix_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        """
+
+        image = os.getenv('AIX_IMAGE')
+        if not image:
+            self.cancel('No AIX_IMAGE environment variable defined')
+
+        _hash = os.getenv('AIX_HASH')
+        if _hash:
+            aix_disk = self.fetch_asset(image, asset_hash=_hash)
+        else:
+            aix_disk = self.fetch_asset(image)
+
+        self.vm.set_console()
+        self.vm.add_args('-machine', 'ic-mode=xics',
+                         '-smp', '16,threads=8,cores=2',
+                         '-m', '4g',
+#                         '-device', 'spapr-vlan,netdev=net0,mac=52:54:00:49:53:14',
+#                         '-netdev', 'tap,id=net0,helper=/usr/libexec/qemu-bridge-helper,br=virbr0',
+                         '-device', 'qemu-xhci',
+                         '-device', 'virtio-scsi,id=scsi0',
+                         '-drive', f'file={aix_disk},if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none',
+                         '-device', 'scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1',
+                         '-nodefaults')
+        self.vm.launch()
+        wait_for_console_pattern(self, 'AIX Version 7')
+
+    def test_ppc64_aix_boot_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.do_test_ppc64_aix_boot()
+
+    def test_ppc64_aix_boot_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.do_test_ppc64_aix_boot()
Signature · 1 line
2.42.0
#20 lore raw

Re: [RFC PATCH 07/11] tests/avocado: Add ppc boot tests for non-free AIX images

Quoted 7 lines · Nicholas Piggin

An AIX image can be provided by setting AIX_IMAGE environment variable when running avocado.

It's questionable whether we should carry these in upstream QEMU. It's convenient to see how to run these things, but simple enough to maintain in out of tree branch. I just wanted to see opinions about it.

Yeah there is no point adding a test no one else can run. We already have tests that utilise dead URLs that can only run if you happen to have the image in the avocado cache which should arguably be removed.

Quoted 76 lines
---
 tests/avocado/ppc_aix.py | 63 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 tests/avocado/ppc_aix.py
tests/avocado/ppc_aix.py new file +41 -0
new file mode 100644
index 0000000000..b8d5d4cc38
@@ -0,0 +1,63 @@
+# Functional test that boots AIX on ppc pseries TCG and KVM
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+import os
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+
+class pseriesMachine(QemuSystemTest):
+
+    timeout = 600
+
+    def do_test_ppc64_aix_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        """
+
+        image = os.getenv('AIX_IMAGE')
+        if not image:
+            self.cancel('No AIX_IMAGE environment variable defined')
+
+        _hash = os.getenv('AIX_HASH')
+        if _hash:
+            aix_disk = self.fetch_asset(image, asset_hash=_hash)
+        else:
+            aix_disk = self.fetch_asset(image)
+
+        self.vm.set_console()
+        self.vm.add_args('-machine', 'ic-mode=xics',
+                         '-smp', '16,threads=8,cores=2',
+                         '-m', '4g',
+#                         '-device', 'spapr-vlan,netdev=net0,mac=52:54:00:49:53:14',
+#                         '-netdev', 'tap,id=net0,helper=/usr/libexec/qemu-bridge-helper,br=virbr0',
+                         '-device', 'qemu-xhci',
+                         '-device', 'virtio-scsi,id=scsi0',
+ '-drive',

f'file={aix_disk},if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none',
+ '-device', 'scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1',

tests/avocado/ppc_aix.py new file +21 -0
+                         '-nodefaults')
+        self.vm.launch()
+        wait_for_console_pattern(self, 'AIX Version 7')
+
+    def test_ppc64_aix_boot_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.do_test_ppc64_aix_boot()
+
+    def test_ppc64_aix_boot_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.do_test_ppc64_aix_boot()
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#21 lore raw

Re: [RFC PATCH 07/11] tests/avocado: Add ppc boot tests for non-free AIX images

Quoted 6 lines · Alex Bennée
Quoted 3 lines · Nicholas Piggin

An AIX image can be provided by setting AIX_IMAGE environment variable when running avocado.

Quoted 8 lines
Quoted 4 lines

It's questionable whether we should carry these in upstream QEMU. It's convenient to see how to run these things, but simple enough to maintain in out of tree branch. I just wanted to see opinions about it.

Yeah there is no point adding a test no one else can run. We already have tests that utilise dead URLs that can only run if you happen to have the image in the avocado cache which should arguably be removed.

This isn't quite the same problem. This test image can possibly be shared among developers within the IBM realm.

Quoted 4 lines
Quoted 4 lines
---
  tests/avocado/ppc_aix.py | 63 ++++++++++++++++++++++++++++++++++++++++
  1 file changed, 63 insertions(+)

create mode 100644 tests/avocado/ppc_aix.py

author reviewer
#22 lore raw

Re: [RFC PATCH 07/11] tests/avocado: Add ppc boot tests for non-free AIX images

Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Alex Bennée
Quoted 7 lines · Nicholas Piggin

An AIX image can be provided by setting AIX_IMAGE environment variable when running avocado.

It's questionable whether we should carry these in upstream QEMU. It's convenient to see how to run these things, but simple enough to maintain in out of tree branch. I just wanted to see opinions about it.

Quoted 6 lines
Quoted 3 lines

Yeah there is no point adding a test no one else can run. We already have tests that utilise dead URLs that can only run if you happen to have the image in the avocado cache which should arguably be removed.

This isn't quite the same problem. This test image can possibly be shared among developers within the IBM realm.

Yeah, and other people can have AIX and MacOS legally by other means (IIRC you could register an acount and get AIX, but that may have changed).

We do have some people not at IBM who test AIX against upstram and report bugs. Not too sure if they would find these avocado tests useful though.

Thanks,
Nick

#23 lore raw

Re: [RFC PATCH 07/11] tests/avocado: Add ppc boot tests for non-free AIX images

In reply to Alex Bennée
Quoted 6 lines · Alex Bennée
Quoted 3 lines · Nicholas Piggin

An AIX image can be provided by setting AIX_IMAGE environment variable when running avocado.

Quoted 8 lines
Quoted 4 lines

It's questionable whether we should carry these in upstream QEMU. It's convenient to see how to run these things, but simple enough to maintain in out of tree branch. I just wanted to see opinions about it.

Yeah there is no point adding a test no one else can run. We already have tests that utilise dead URLs that can only run if you happen to have the image in the avocado cache which should arguably be removed.

I can understand the appeal of wanting to sanity check QEMU with esentially arbitrary guest OS, whether modern, or obsolete, whether OSS or proprietary.

The appeal of getting the test integrated into QEMU is you don't have to worry about rebasing / merging local git changes forever more.

I feel like this tells us we should not require users to be writing new avocado python test code merely to get a boring old guest OS boot up smoke test integrated into avocado.

I think we ought to have a 'guest_smoke_test.py' avocado test, that pulls in guest OS scenarios from external YAML/JSON files. eg

  $ cat ppc_aix.yaml
  image:
    url: https:////some/path
    checksum: xxxxxx
  console:
    expect: ...some console message...
  vm:
    arch: ppc64
    machine: pseries
    ....something something extra cli args something something...

Users could then set

export QEMU_SMOKE_TEST_PATHS=$HOME/my-guestos-library:$HOME/shared-guestos-library make check-avocado

to load all the guest OS scenarios from these dirs, in addition to any scenarios that are shipped in qemu.git by default.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
author reviewer
#24 lore raw

Re: [RFC PATCH 07/11] tests/avocado: Add ppc boot tests for non-free AIX images

Quoted 20 lines · Daniel P. Berrangé
Quoted 6 lines · Alex Bennée
Quoted 3 lines · Nicholas Piggin

An AIX image can be provided by setting AIX_IMAGE environment variable when running avocado.

Quoted 8 lines
Quoted 4 lines

It's questionable whether we should carry these in upstream QEMU. It's convenient to see how to run these things, but simple enough to maintain in out of tree branch. I just wanted to see opinions about it.

Yeah there is no point adding a test no one else can run. We already have tests that utilise dead URLs that can only run if you happen to have the image in the avocado cache which should arguably be removed.

I can understand the appeal of wanting to sanity check QEMU with esentially arbitrary guest OS, whether modern, or obsolete, whether OSS or proprietary.

Quoted 7 lines

The appeal of getting the test integrated into QEMU is you don't have to worry about rebasing / merging local git changes forever more.

I feel like this tells us we should not require users to be writing new avocado python test code merely to get a boring old guest OS boot up smoke test integrated into avocado.

Interesting thought. It is easier to be able to specify images location, qemu command line, and some expected output and input than to write an avocado test entirely. OTOH if you copy an existing one and don't need to do anything different then it is not so hard.

Quoted 15 lines

I think we ought to have a 'guest_smoke_test.py' avocado test, that pulls in guest OS scenarios from external YAML/JSON files. eg

  $ cat ppc_aix.yaml
  image:
    url: https:////some/path
    checksum: xxxxxx
  console:
    expect: ...some console message...
  vm:
    arch: ppc64
    machine: pseries
    ....something something extra cli args something something...
Quoted 7 lines

Users could then set

export QEMU_SMOKE_TEST_PATHS=$HOME/my-guestos-library:$HOME/shared-guestos-library make check-avocado

to load all the guest OS scenarios from these dirs, in addition to any scenarios that are shipped in qemu.git by default.

There would be a bunch of upstream avocado tests that could be converted to such a format.

Thanks,
Nick

author reviewer
#25 lore raw

RFC PATCH 8/11 tests/avocado: Add ppc MacOS tests

In reply to Nicholas Piggin

Similarly to the AIX test, this adds some tests that can boot MacOS9 and OSX images that are provided.

---
 tests/avocado/ppc/macos9.ppm | Bin 0 -> 921615 bytes
 tests/avocado/ppc_macos.py   |  90 +++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
 create mode 100644 tests/avocado/ppc/macos9.ppm
 create mode 100644 tests/avocado/ppc_macos.py
tests/avocado/ppc/macos9.ppm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..662d1a5a0fec47a589dbc03ed3b10b3d653c07f1
GIT binary patch
tests/avocado/ppc_macos.py new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.42.0
#26 lore raw

Re: [RFC PATCH 08/11] tests/avocado: Add ppc MacOS tests

Hi Nicholas,

Quoted 62 lines · Nicholas Piggin

Similarly to the AIX test, this adds some tests that can boot MacOS9 and OSX images that are provided.

---
  tests/avocado/ppc/macos9.ppm | Bin 0 -> 921615 bytes
  tests/avocado/ppc_macos.py   |  90 +++++++++++++++++++++++++++++++++++
  2 files changed, 90 insertions(+)

create mode 100644 tests/avocado/ppc/macos9.ppm
create mode 100644 tests/avocado/ppc_macos.py

tests/avocado/ppc_macos.py new file +46 -0
new file mode 100644
index 0000000000..055fc3aca4
@@ -0,0 +1,90 @@
+# Functional test that boots MacOS on ppc mac99
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+import time
+import tempfile
+import filecmp
+import os
+
+from typing import List
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+
+class PPCMacOSTest(QemuSystemTest):
+
+    timeout = 240
+
+    def test_macos9(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:mac99
+        :avocado: tags=device:framebuffer
+        """
+
+        basedir = os.getenv('AVOCADO_TEST_BASEDIR')
+        screenshot_path = os.path.join(basedir, 'ppc/macos9.ppm')
+
+        image = os.getenv('MACOS9_IMAGE')
+        if not image:
+            self.cancel('No MACOS9_IMAGE environment variable defined')
+        drive_path = self.fetch_asset(image)
+
+        self.vm.set_console()
+        self.vm.add_args('-M', 'via=pmu')
+        self.vm.add_args('-m', '1g')
+        self.vm.add_args('-cpu', 'G4')
+        self.vm.add_args('-drive', 'file=' + drive_path)
+#        self.vm.add_args('-net', 'nic,model=rtl8139')
+#        self.vm.add_args('-net', 'user,hostfwd=:127.0.0.1:2223-:22,hostname=qemu')
+        self.vm.add_args('-vga', 'std')
+        self.vm.add_args('-g', '640x480')
+        self.vm.launch()

tests/avocado/ppc_macos.py line 56

Quoted 10 lines
tests/avocado/ppc_macos.py new file +10 -0
+
+        # This comes up after 60 seconds on a fast x86 CPU. Give it
+        # 180s to be sure.
+        time.sleep(180)
+        with tempfile.NamedTemporaryFile(suffix='.ppm',
+                                         prefix='screendump-', delete=False) as ppmfile:
+            self.vm.command('screendump', filename=ppmfile.name)
+            if not filecmp.cmp(ppmfile.name, screenshot_path):
+                self.fail('Screenshot does not match')
+

Nitpicking, I'd rather use:

@skipUntil(os.getenv('MACOS10_IMAGE'),
'No MACOS10_IMAGE environment variable defined')

Quoted 4 lines
tests/avocado/ppc_macos.py new file +4 -0
+    def test_macos10(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:mac99

tests/avocado/ppc_macos.py line 70

Quoted 10 lines
tests/avocado/ppc_macos.py new file +10 -0
+        :avocado: tags=device:framebuffer
+        """
+
+        basedir = os.getenv('AVOCADO_TEST_BASEDIR')
+        screenshot_path = os.path.join(basedir, 'ppc/macos10.ppm')
+
+        image = os.getenv('MACOS10_IMAGE')
+        if not image:
+            self.cancel('No MACOS10_IMAGE environment variable defined')
+        drive_path = self.fetch_asset(image)

Please commit the hash if the image you used.

tests/avocado/ppc_macos.py line 43

Quoted 7 lines
tests/avocado/ppc_macos.py new file +7 -0
+        self.vm.set_console()
+        self.vm.add_args('-M', 'via=pmu')
+        self.vm.add_args('-m', '1g')
+        self.vm.add_args('-cpu', 'G4')
+        self.vm.add_args('-drive', 'file=' + drive_path)
+#        self.vm.add_args('-net', 'nic,model=rtl8139')
+#        self.vm.add_args('-net', 'user,hostfwd=:127.0.0.1:2223-:22,hostname=qemu')

Why is that commented? If not needed, just drop, since your test is already useful as it.

Quoted 12 lines
tests/avocado/ppc_macos.py new file +12 -0
+        self.vm.add_args('-vga', 'std')
+        self.vm.add_args('-g', '640x480')
+        self.vm.launch()
+
+        # This comes up after 60 seconds on a fast x86 CPU. Give it
+        # 180s to be sure.
+        time.sleep(180)
+        with tempfile.NamedTemporaryFile(suffix='.ppm',
+                                         prefix='screendump-', delete=False) as ppmfile:
+            self.vm.command('screendump', filename=ppmfile.name)
+            if not filecmp.cmp(ppmfile.name, screenshot_path):
+                self.fail('Screenshot does not match')
author reviewer
#27 lore raw

Re: [RFC PATCH 08/11] tests/avocado: Add ppc MacOS tests

Quoted 78 lines · Philippe Mathieu-Daudé

Hi Nicholas,

Quoted 62 lines · Nicholas Piggin

Similarly to the AIX test, this adds some tests that can boot MacOS9 and OSX images that are provided.

---
  tests/avocado/ppc/macos9.ppm | Bin 0 -> 921615 bytes
  tests/avocado/ppc_macos.py   |  90 +++++++++++++++++++++++++++++++++++
  2 files changed, 90 insertions(+)

create mode 100644 tests/avocado/ppc/macos9.ppm
create mode 100644 tests/avocado/ppc_macos.py

tests/avocado/ppc_macos.py new file +46 -0
new file mode 100644
index 0000000000..055fc3aca4
@@ -0,0 +1,90 @@
+# Functional test that boots MacOS on ppc mac99
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+import time
+import tempfile
+import filecmp
+import os
+
+from typing import List
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+
+class PPCMacOSTest(QemuSystemTest):
+
+    timeout = 240
+
+    def test_macos9(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:mac99
+        :avocado: tags=device:framebuffer
+        """
+
+        basedir = os.getenv('AVOCADO_TEST_BASEDIR')
+        screenshot_path = os.path.join(basedir, 'ppc/macos9.ppm')
+
+        image = os.getenv('MACOS9_IMAGE')
+        if not image:
+            self.cancel('No MACOS9_IMAGE environment variable defined')
+        drive_path = self.fetch_asset(image)
+
+        self.vm.set_console()
+        self.vm.add_args('-M', 'via=pmu')
+        self.vm.add_args('-m', '1g')
+        self.vm.add_args('-cpu', 'G4')
+        self.vm.add_args('-drive', 'file=' + drive_path)
+#        self.vm.add_args('-net', 'nic,model=rtl8139')
+#        self.vm.add_args('-net', 'user,hostfwd=:127.0.0.1:2223-:22,hostname=qemu')
+        self.vm.add_args('-vga', 'std')
+        self.vm.add_args('-g', '640x480')
+        self.vm.launch()

tests/avocado/ppc_macos.py line 56

Quoted 10 lines
tests/avocado/ppc_macos.py new file +10 -0
+
+        # This comes up after 60 seconds on a fast x86 CPU. Give it
+        # 180s to be sure.
+        time.sleep(180)
+        with tempfile.NamedTemporaryFile(suffix='.ppm',
+                                         prefix='screendump-', delete=False) as ppmfile:
+            self.vm.command('screendump', filename=ppmfile.name)
+            if not filecmp.cmp(ppmfile.name, screenshot_path):
+                self.fail('Screenshot does not match')
+

Nitpicking, I'd rather use:

Quoted 2 lines

@skipUntil(os.getenv('MACOS10_IMAGE'),
'No MACOS10_IMAGE environment variable defined')

Aha I didn't know about that one. I don't think it's nitpicking, that's a good suggestion, thank you.

Quoted 8 lines
Quoted 8 lines
tests/avocado/ppc_macos.py new file +8 -0
+    def test_macos10(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:mac99
+        :avocado: tags=device:framebuffer
+        """
+
+        basedir = os.getenv('AVOCADO_TEST_BASEDIR')
Quoted 8 lines

tests/avocado/ppc_macos.py line 70

Quoted 6 lines
tests/avocado/ppc_macos.py new file +6 -0
+        screenshot_path = os.path.join(basedir, 'ppc/macos10.ppm')
+
+        image = os.getenv('MACOS10_IMAGE')
+        if not image:
+            self.cancel('No MACOS10_IMAGE environment variable defined')
+        drive_path = self.fetch_asset(image)

Please commit the hash if the image you used.

Sure.

Quoted 11 lines

tests/avocado/ppc_macos.py line 43

Quoted 8 lines
tests/avocado/ppc_macos.py new file +7 -0
+        self.vm.set_console()
+        self.vm.add_args('-M', 'via=pmu')
+        self.vm.add_args('-m', '1g')
+        self.vm.add_args('-cpu', 'G4')
+        self.vm.add_args('-drive', 'file=' + drive_path)
+#        self.vm.add_args('-net', 'nic,model=rtl8139')
+#        self.vm.add_args('-net', 'user,hostfwd=:127.0.0.1:2223-:22,hostname=qemu')

Why is that commented? If not needed, just drop, since your test is already useful as it.

Yeah I will. That was the option used by some scripts here but it doesn't seem to work for me here, whereas the default IIRC sungem does get networking up. Could be a QEMU regression so I was meaning to try a bisect.

Thanks for the feedback on these. I'll leave the MacOS and AIX ones out of the next ppc PR so there is more time for thought and discussion about them.

Thanks,
Nick

author reviewer
#28 lore raw

RFC PATCH 9/11 tests/avocado: Use default CPU for pseries machine

In reply to Nicholas Piggin

Use the default CPU with the pseries machine unless there is a specific requirement.

---
 tests/avocado/migration.py | 1 -
 1 file changed, 1 deletion(-)
tests/avocado/migration.py +0 -1
index fdc1d234fb..91ac33919b 100644
@@ -123,7 +123,6 @@ class PPC64(MigrationTest):
     """
     :avocado: tags=arch:ppc64
     :avocado: tags=machine:pseries
-    :avocado: tags=cpu:power9_v2.0
     """
 
     def test_migration_with_tcp_localhost(self):
Signature · 1 line
2.42.0
author reviewer
#29 lore raw

RFC PATCH 10/11 ppc/spapr: change pseries machine default to POWER10 CPU

In reply to Nicholas Piggin

POWER10 is the latest pseries CPU.

---
 hw/ppc/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
index d4230d3647..9d3475d64b 100644
@@ -4661,7 +4661,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
 
     smc->dr_lmb_enabled = true;
     smc->update_dt_enabled = true;
-    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power9_v2.2");
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");
     mc->has_hotpluggable_cpus = true;
     mc->nvdimm_supported = true;
     smc->resize_hpt_default = SPAPR_RESIZE_HPT_ENABLED;
Signature · 1 line
2.42.0
Reviewed-by on v1 10/11
#30 lore raw

Re: [RFC PATCH 10/11] ppc/spapr: change pseries machine default to POWER10 CPU

Quoted 4 lines · Nicholas Piggin

POWER10 is the latest pseries CPU.

Quoted 21 lines
---
 hw/ppc/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -2
index d4230d3647..9d3475d64b 100644
@@ -4661,7 +4661,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
 
     smc->dr_lmb_enabled = true;
     smc->update_dt_enabled = true;
-    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power9_v2.2");
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");
     mc->has_hotpluggable_cpus = true;
     mc->nvdimm_supported = true;
     smc->resize_hpt_default = SPAPR_RESIZE_HPT_ENABLED;
--

2.42.0

Reviewed-by on v1 10/11
#31 lore raw

Re: [RFC PATCH 10/11] ppc/spapr: change pseries machine default to POWER10 CPU

In reply to Nicholas Piggin
Quoted 3 lines · Nicholas Piggin

POWER10 is the latest pseries CPU.

Thanks,

C.

Quoted 17 lines
---
  hw/ppc/spapr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
index d4230d3647..9d3475d64b 100644
@@ -4661,7 +4661,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
 
      smc->dr_lmb_enabled = true;
      smc->update_dt_enabled = true;
-    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power9_v2.2");
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");
      mc->has_hotpluggable_cpus = true;
      mc->nvdimm_supported = true;
      smc->resize_hpt_default = SPAPR_RESIZE_HPT_ENABLED;
author reviewer
#32 lore raw

RFC PATCH 11/11 ppc/pnv: Change powernv default to powernv10

In reply to Nicholas Piggin

POWER10 is the latest IBM Power machine. Although it is not offered in "OPAL mode" (i.e., powernv configuration), so there is a case that it should remain at powernv9, most of the development work is going into powernv10 at the moment.

---
 hw/ppc/pnv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +2 -2
index eb54f93986..f3dad5ae05 100644
@@ -2195,8 +2195,6 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data)
 
     xfc->match_nvt = pnv_match_nvt;
 
-    mc->alias = "powernv";
-
     pmc->compat = compat;
     pmc->compat_size = sizeof(compat);
     pmc->dt_power_mgt = pnv_dt_power_mgt;
@@ -2220,6 +2218,8 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)
     mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");
     compat_props_add(mc->compat_props, phb_compat, G_N_ELEMENTS(phb_compat));
 
+    mc->alias = "powernv";
+
     pmc->compat = compat;
     pmc->compat_size = sizeof(compat);
     pmc->dt_power_mgt = pnv_dt_power_mgt;
Signature · 1 line
2.42.0
Reviewed-by on v1 11/11
#33 lore raw

Re: [RFC PATCH 11/11] ppc/pnv: Change powernv default to powernv10

Quoted 7 lines · Nicholas Piggin

POWER10 is the latest IBM Power machine. Although it is not offered in "OPAL mode" (i.e., powernv configuration), so there is a case that it should remain at powernv9, most of the development work is going into powernv10 at the moment.

Do we need to update the docs?

We should consider updating the skiboot to the latest release too.

Quoted 30 lines
---
 hw/ppc/pnv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +2 -3
index eb54f93986..f3dad5ae05 100644
@@ -2195,8 +2195,6 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data)
 
     xfc->match_nvt = pnv_match_nvt;
 
-    mc->alias = "powernv";
-
     pmc->compat = compat;
     pmc->compat_size = sizeof(compat);
     pmc->dt_power_mgt = pnv_dt_power_mgt;
@@ -2220,6 +2218,8 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)
     mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");
     compat_props_add(mc->compat_props, phb_compat, G_N_ELEMENTS(phb_compat));
 
+    mc->alias = "powernv";
+
     pmc->compat = compat;
     pmc->compat_size = sizeof(compat);
     pmc->dt_power_mgt = pnv_dt_power_mgt;
--

2.42.0

author reviewer
#34 lore raw

Re: [RFC PATCH 11/11] ppc/pnv: Change powernv default to powernv10

Quoted 7 lines · Joel Stanley
Quoted 6 lines · Nicholas Piggin

POWER10 is the latest IBM Power machine. Although it is not offered in "OPAL mode" (i.e., powernv configuration), so there is a case that it should remain at powernv9, most of the development work is going into powernv10 at the moment.

Quoted 5 lines
Quoted 1 line

Do we need to update the docs?

What did you have in mind? Add some powernv10 examples?

Quoted 1 line

We should consider updating the skiboot to the latest release too.

Yeah I will do that (and SLOF as well).

Thanks,
Nick

#35 lore raw

Re: [RFC PATCH 11/11] ppc/pnv: Change powernv default to powernv10

Quoted 9 lines · Nicholas Piggin
Quoted 7 lines · Joel Stanley
Quoted 6 lines · Nicholas Piggin

POWER10 is the latest IBM Power machine. Although it is not offered in "OPAL mode" (i.e., powernv configuration), so there is a case that it should remain at powernv9, most of the development work is going into powernv10 at the moment.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Do we need to update the docs?

What did you have in mind? Add some powernv10 examples?

Nothing in mind. The docs don't actually mention which cpu is the default, which has the upside of us not needing to update it.

Cheers,

Joel

Reviewed-by on v1 11/11
#36 lore raw

Re: [RFC PATCH 11/11] ppc/pnv: Change powernv default to powernv10

In reply to Nicholas Piggin
Quoted 6 lines · Nicholas Piggin

POWER10 is the latest IBM Power machine. Although it is not offered in "OPAL mode" (i.e., powernv configuration), so there is a case that it should remain at powernv9, most of the development work is going into powernv10 at the moment.

I think we would update skiboot to v7.1 also.

Thanks,

C.

Quoted 26 lines
---
  hw/ppc/pnv.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +2 -2
index eb54f93986..f3dad5ae05 100644
@@ -2195,8 +2195,6 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data)
 
      xfc->match_nvt = pnv_match_nvt;
 
-    mc->alias = "powernv";
-
      pmc->compat = compat;
      pmc->compat_size = sizeof(compat);
      pmc->dt_power_mgt = pnv_dt_power_mgt;
@@ -2220,6 +2218,8 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)
      mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");
      compat_props_add(mc->compat_props, phb_compat, G_N_ELEMENTS(phb_compat));
 
+    mc->alias = "powernv";
+
      pmc->compat = compat;
      pmc->compat_size = sizeof(compat);
      pmc->dt_power_mgt = pnv_dt_power_mgt;
#37 lore raw
In reply to Nicholas Piggin
Quoted 12 lines · Nicholas Piggin

Sorry for going missing for a while, had a few things on but have been working on figuring out testing and git setup to get some things merged.

To start with I'd like to add a few more tests. Since most of my own tests for missing bits (like KVM backend) are mostly just ad hoc scripts, I thought adding them to avocado is a better idea. Comments on those in particular from CI gurus would be welcome,

patch 4, because it boots a Alpine distro image and installs a QEMU package via its package manager.

Quoted 7 lines

patch 5, because it grabs some Linux kernel images I put up on another gitlab page.

patch 6, because it adds a FreeBSD boot test.

patch 7/8, because they add tests for non-public images (flames welcome).

IANAL but I don't see license infringement, so personally I'm in favor of these tests.

Quoted 2 lines

Thanks,
Nick