qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tests/avocado: Test Xen guest support under KVM
@ 2023-03-03 12:51 David Woodhouse
  2023-03-03 12:51 ` [PATCH 1/2] tests/avocado: Add Fedora 34 distro, including kernel/initrd checksums David Woodhouse
  2023-03-03 12:51 ` [PATCH 2/2] tests/avocado: Test Xen guest support under KVM David Woodhouse
  0 siblings, 2 replies; 3+ messages in thread
From: David Woodhouse @ 2023-03-03 12:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cleber Rosa, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Paolo Bonzini, Paul Durrant

Add avocado tests to boot Xen guests in various interesting modes:
 • MSI delivered via PIRQ.
 • MSI delivered directly with vAPIC.
 • Event channel interrupt to I/O APIC.
 • Event channel interrupt to legacy PIC.

Using AHCI disk for now so this should work with the basic platform
support that's already in Paolo's pull request. After phase 2 of the
Xen support is merged, we can switch it to use xen-disk instead.

The warnings about not being able to validate the kernel and initrd
images made me sad, so I added hashes of those to the distro structure.

David Woodhouse (2):
      tests/avocado: Add Fedora 34 distro, including kernel/initrd checksums
      tests/avocado: Test Xen guest support under KVM

 tests/avocado/avocado_qemu/__init__.py |  27 ++++++++
 tests/avocado/xen_guest.py             | 113 +++++++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] tests/avocado: Add Fedora 34 distro, including kernel/initrd checksums
  2023-03-03 12:51 [PATCH 0/2] tests/avocado: Test Xen guest support under KVM David Woodhouse
@ 2023-03-03 12:51 ` David Woodhouse
  2023-03-03 12:51 ` [PATCH 2/2] tests/avocado: Test Xen guest support under KVM David Woodhouse
  1 sibling, 0 replies; 3+ messages in thread
From: David Woodhouse @ 2023-03-03 12:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cleber Rosa, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Paolo Bonzini, Paul Durrant

From: David Woodhouse <dwmw@amazon.co.uk>

The kernel in Fedora 31 doesn't support 'xen_no_vector_callback' on
its command line, so add a slightly newer version as a prelude to
enabling avocado tests for Xen guests.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 tests/avocado/avocado_qemu/__init__.py | 27 ++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index a313e88c07..49e414e267 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -485,6 +485,23 @@ class LinuxDistro:
                                   ' console=tty0'),
                  },
             },
+            '34': {
+                'x86_64':
+                {'checksum': ('b9b621b26725ba95442d9a56cbaa0547'
+                              '84e0779a9522ec6eafff07c6e6f717ea'),
+                 'pxeboot_url': ('https://archives.fedoraproject.org/'
+                                 'pub/archive/fedora/linux/releases/34/'
+                                 'Everything/x86_64/os/images/pxeboot/'),
+                 'kernel_hash': ('085fc6e47f2e3a271b591f3e56739ca9'
+                                 '4c16718837a5f431ab95468e1e95f9eb'),
+                 'initrd_hash': ('d6cd2e03e8188eed6c896fd65ff05f81'
+                                 '2c4c1c8777d630b5909e9a1a4627e337'),
+                 'kernel_params': ('root=UUID=386769a3-cfa5-47c8-8797-'
+                                   'd5ec58c9cb6c ro no_timer_check '
+                                   'net.ifnames=0 console=tty1 '
+                                   'console=ttyS0,115200n8'),
+                },
+            },
         }
     }
 
@@ -513,6 +530,16 @@ def pxeboot_url(self):
         """Gets the repository url where pxeboot files can be found"""
         return self._info.get('pxeboot_url', None)
 
+    @property
+    def kernel_hash(self):
+        """Gets checksum of the pxeboot kernel image"""
+        return self._info.get('kernel_hash', None)
+
+    @property
+    def initrd_hash(self):
+        """Gets checksum of the pxeboot initrd image"""
+        return self._info.get('initrd_hash', None)
+
     @property
     def default_kernel_params(self):
         """Gets the default kernel parameters"""
-- 
2.39.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] tests/avocado: Test Xen guest support under KVM
  2023-03-03 12:51 [PATCH 0/2] tests/avocado: Test Xen guest support under KVM David Woodhouse
  2023-03-03 12:51 ` [PATCH 1/2] tests/avocado: Add Fedora 34 distro, including kernel/initrd checksums David Woodhouse
@ 2023-03-03 12:51 ` David Woodhouse
  1 sibling, 0 replies; 3+ messages in thread
From: David Woodhouse @ 2023-03-03 12:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cleber Rosa, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Paolo Bonzini, Paul Durrant

From: David Woodhouse <dwmw@amazon.co.uk>

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 tests/avocado/xen_guest.py | 113 +++++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 tests/avocado/xen_guest.py

diff --git a/tests/avocado/xen_guest.py b/tests/avocado/xen_guest.py
new file mode 100644
index 0000000000..111ef3ca08
--- /dev/null
+++ b/tests/avocado/xen_guest.py
@@ -0,0 +1,113 @@
+# Xen guest functional tests
+#
+# Copyright © 2021 Red Hat, Inc.
+# Copyright © 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+#
+# Author:
+#  David Woodhouse <dwmw2@infradead.org>
+#
+# 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 skipIf
+from avocado_qemu import LinuxTest
+
+@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+class XenGuest(LinuxTest):
+    """
+    :avocado: tags=arch:x86_64
+    :avocado: tags=distro:fedora
+    :avocado: tags=distro_version:34
+    :avocado: tags=machine:q35
+    :avocado: tags=accel:kvm
+    :avocado: tags=xen_guest
+    """
+
+    kernel_path = None
+    initrd_path = None
+    kernel_params = None
+
+    def set_up_boot(self):
+        path = self.download_boot()
+        self.vm.add_args('-drive', 'file=%s,if=none,id=drv0' % path)
+        if False: # Soon...
+            self.vm.add_args('-device', 'xen-disk,drive=drv0,vdev=xvda')
+        else:
+            self.vm.add_args('-device', 'ahci,id=ahci')
+            self.vm.add_args('-device', 'ide-hd,drive=drv0,bus=ahci.0')
+
+    def setUp(self):
+        super(XenGuest, self).setUp(None, 'virtio-net-pci')
+
+    def common_vm_setup(self, custom_kernel=None):
+        self.require_accelerator("kvm")
+        self.vm.add_args("-accel", "kvm,xen-version=0x4000a,kernel-irqchip=split")
+
+        if custom_kernel is None:
+            return
+
+        kernel_url = self.distro.pxeboot_url + 'vmlinuz'
+        initrd_url = self.distro.pxeboot_url + 'initrd.img'
+        self.kernel_path = self.fetch_asset(kernel_url, algorithm='sha256',
+                                            asset_hash=self.distro.kernel_hash)
+        self.initrd_path = self.fetch_asset(initrd_url, algorithm='sha256',
+                                            asset_hash=self.distro.initrd_hash)
+
+    def run_and_check(self):
+        if self.kernel_path:
+            self.vm.add_args('-kernel', self.kernel_path,
+                             '-append', self.kernel_params,
+                             '-initrd', self.initrd_path)
+        self.launch_and_wait()
+        self.ssh_command('cat /proc/cmdline')
+        self.ssh_command('dmesg | grep -e "Grant table initialized"')
+
+    def test_xen_guest(self):
+        """
+        :avocado: tags=xen_guest
+        """
+
+        self.common_vm_setup(True)
+
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks')
+        self.run_and_check()
+        self.ssh_command('grep xen-pirq.*msi /proc/interrupts')
+
+    def test_xen_guest_vapic(self):
+        """
+        :avocado: tags=xen_guest_vapic
+        """
+
+        self.common_vm_setup(True)
+        self.vm.add_args('-cpu', 'host,+xen-vapic')
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks')
+        self.run_and_check()
+        self.ssh_command('grep xen-pirq /proc/interrupts')
+        self.ssh_command('grep PCI-MSI /proc/interrupts')
+
+    def test_xen_guest_novector(self):
+        """
+        :avocado: tags=xen_guest_novector
+        """
+
+        self.common_vm_setup(True)
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks' +
+                              ' xen_no_vector_callback')
+        self.run_and_check()
+        self.ssh_command('grep xen-platform-pci /proc/interrupts')
+
+    def test_xen_guest_novector_noapic(self):
+        """
+        :avocado: tags=xen_guest_novector_noapic
+        """
+
+        self.common_vm_setup(True)
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks' +
+                              ' xen_no_vector_callback noapic')
+        self.run_and_check()
+        self.ssh_command('grep xen-platform-pci /proc/interrupts')
-- 
2.39.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-03 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-03 12:51 [PATCH 0/2] tests/avocado: Test Xen guest support under KVM David Woodhouse
2023-03-03 12:51 ` [PATCH 1/2] tests/avocado: Add Fedora 34 distro, including kernel/initrd checksums David Woodhouse
2023-03-03 12:51 ` [PATCH 2/2] tests/avocado: Test Xen guest support under KVM David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).