From nobody Sun Feb 8 22:49:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607689785; cv=none; d=zohomail.com; s=zohoarc; b=kjiTHnAsR9pamwfD8+/UzYddlFsm/YKPoQHYT+H4QERsE2Uapwcg0cDjm6IDiN8GsrpAV7bxZgwBoo7xoYivKe2JbtvyQn+q2RIQspnZX0W7mpdBtP4gW9H1U09neiKNjmFG9Ctb7WuZvQG80h7MgNxDKvsadgVMUeC3JxARDPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607689785; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pZiB3cLEcpI2fyr3ns49tHKczcnhFyrsLkP7062UJBY=; b=PnRGrzpmT76hvCTfHPkPLDF5UPrbxXi/KxO9aMrujFVQCvZJtuA3IEezEeUpDuZLbJei3pEnM0gwetZCNPBHWIocm3XbMTcWAmeRbZwBrDLXzF0ggN6t/p7+CpgsZsPC72nS6dspHrQKWH6ZTGUsqMdnfMcit+bkLn4vHr51EZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607689785839388.1168975822334; Fri, 11 Dec 2020 04:29:45 -0800 (PST) Received: from localhost ([::1]:55948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knhYO-0006Vu-NO for importer@patchew.org; Fri, 11 Dec 2020 07:29:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knhW7-0004ZX-35 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knhW2-00011B-Gj for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:22 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-345-QwDUBAYFN9qCCRiTAGvZmQ-1; Fri, 11 Dec 2020 07:27:10 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03D80EC1C0; Fri, 11 Dec 2020 12:27:09 +0000 (UTC) Received: from gondolin.redhat.com (ovpn-112-240.ams2.redhat.com [10.36.112.240]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9A1510016F4; Fri, 11 Dec 2020 12:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607689637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pZiB3cLEcpI2fyr3ns49tHKczcnhFyrsLkP7062UJBY=; b=N6aj+Hj35ru4SI+UrHL0Xf9TFUWvapJZzpuZaWmp9pudVvW8maMdC8Q4Wk0Bkc/EdR54Ar DDmUvlxScsuxvFcXA/LPplWJLpMi/eHa1cYfD7LGooiq6pbFdmMVsG0+bDumlrSrn4V66x bmHtduwcyi94EDK8IDLj+P2rEZX7AoY= X-MC-Unique: QwDUBAYFN9qCCRiTAGvZmQ-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 2/6] tests/acceptance: add a test for devices on s390x Date: Fri, 11 Dec 2020 13:26:54 +0100 Message-Id: <20201211122658.24481-3-cohuck@redhat.com> In-Reply-To: <20201211122658.24481-1-cohuck@redhat.com> References: <20201211122658.24481-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This adds a very basic test for checking that we present devices in a way that Linux can consume: boot with both virtio-net-ccw and virtio-net-pci attached and then verify that Linux is able to see and detect these devices. Signed-off-by: Cornelia Huck Reviewed-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20201126130158.1471985-1-cohuck@redhat.com> --- MAINTAINERS | 1 + tests/acceptance/machine_s390_ccw_virtio.py | 68 +++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 tests/acceptance/machine_s390_ccw_virtio.py diff --git a/MAINTAINERS b/MAINTAINERS index a83416d54c08..a0dcd6b597ce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1426,6 +1426,7 @@ F: include/hw/s390x/ F: hw/watchdog/wdt_diag288.c F: include/hw/watchdog/wdt_diag288.h F: default-configs/s390x-softmmu.mak +F: tests/acceptance/machine_s390_ccw_virtio.py T: git https://github.com/cohuck/qemu.git s390-next T: git https://github.com/borntraeger/qemu.git s390-next L: qemu-s390x@nongnu.org diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance= /machine_s390_ccw_virtio.py new file mode 100644 index 000000000000..db6352c44434 --- /dev/null +++ b/tests/acceptance/machine_s390_ccw_virtio.py @@ -0,0 +1,68 @@ +# Functional test that boots an s390x Linux guest with ccw and PCI devices +# attached and checks whether the devices are recognized by Linux +# +# Copyright (c) 2020 Red Hat, Inc. +# +# Author: +# Cornelia Huck +# +# 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_qemu import Test +from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import wait_for_console_pattern + +class S390CCWVirtioMachine(Test): + KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' + + def wait_for_console_pattern(self, success_message, vm=3DNone): + wait_for_console_pattern(self, success_message, + failure_message=3D'Kernel panic - not syn= cing', + vm=3Dvm) + + timeout =3D 120 + + def test_s390x_devices(self): + + """ + :avocado: tags=3Darch:s390x + :avocado: tags=3Dmachine:s390-ccw-virtio + """ + + kernel_url =3D ('https://snapshot.debian.org/archive/debian/' + '20201126T092837Z/dists/buster/main/installer-s390x/' + '20190702+deb10u6/images/generic/kernel.debian') + kernel_hash =3D '5821fbee57d6220a067a8b967d24595621aa1eb6' + kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + + initrd_url =3D ('https://snapshot.debian.org/archive/debian/' + '20201126T092837Z/dists/buster/main/installer-s390x/' + '20190702+deb10u6/images/generic/initrd.debian') + initrd_hash =3D '81ba09c97bef46e8f4660ac25b4ac0a5be3a94d6' + initrd_path =3D self.fetch_asset(initrd_url, asset_hash=3Dinitrd_h= ash) + + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3Dsclp0 root=3D/dev/ram0 BOOT_DEBUG= =3D3') + self.vm.add_args('-nographic', + '-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-device', 'virtio-net-ccw,devno=3Dfe.1.1111', + '-device', 'zpci,uid=3D5,target=3Dzzz', + '-device', 'virtio-net-pci,id=3Dzzz') + self.vm.launch() + + shell_ready =3D "sh: can't access tty; job control turned off" + self.wait_for_console_pattern(shell_ready) + # first debug shell is too early, we need to wait for device detec= tion + exec_command_and_wait_for_pattern(self, 'exit', shell_ready) + + ccw_bus_id=3D"0.1.1111" + pci_bus_id=3D"0005:00:00.0" + exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', + ccw_bus_id) + exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', + pci_bus_id) --=20 2.26.2