From patchwork Fri Dec 11 12:26:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11968033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD14BC1B0D8 for ; Fri, 11 Dec 2020 12:29:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E3EA23EB1 for ; Fri, 11 Dec 2020 12:29:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E3EA23EB1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knhY6-00067S-4C for qemu-devel@archiver.kernel.org; Fri, 11 Dec 2020 07:29:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knhVz-0004Q6-1K for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:54761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knhVt-0000xc-2k for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607689627; 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=nTR6ajFnVBvqLUOuaeayLvCRV/vrVbjOUhjKSN/1HKc=; b=btI7Gylcq+i53/Jbq6mKh2AFH0yFJ899oTN06GSsEFuugPy4fqK8eO+4CQi+TRxQVTm31X Uxv/XVvjSQ2FuMJR9hEQeGTHMM97BNUgeudiZ4vmkh/sZjGB7BmIu1SazaV0Yv/Doka7Qy A5EDln01SEEp9X800bB4mExpQGThkPc= 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-108-SNMaESbOPh63s48IWHIPlg-1; Fri, 11 Dec 2020 07:27:05 -0500 X-MC-Unique: SNMaESbOPh63s48IWHIPlg-1 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 58775107ACE8; Fri, 11 Dec 2020 12:27:04 +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 E56C610023BD; Fri, 11 Dec 2020 12:27:02 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL 1/6] hw/watchdog/wdt_diag288: Remove unnecessary includes Date: Fri, 11 Dec 2020 13:26:53 +0100 Message-Id: <20201211122658.24481-2-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 Received-SPF: pass client-ip=63.128.21.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_H4=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 , Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth Neither sysbus.h nor module.h are required to compile this file. diag288 is not a sysbus device, and module.h (for type_init) is included eventually through qom/object.h. Signed-off-by: Thomas Huth Reviewed-by: Christian Borntraeger Message-Id: <20201118090344.243117-1-thuth@redhat.com> [CH: tweaked description] Signed-off-by: Cornelia Huck --- hw/watchdog/wdt_diag288.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c index 71a945f0bdf3..4c4b6a6ab704 100644 --- a/hw/watchdog/wdt_diag288.c +++ b/hw/watchdog/wdt_diag288.c @@ -14,12 +14,10 @@ #include "qemu/osdep.h" #include "sysemu/reset.h" #include "sysemu/watchdog.h" -#include "hw/sysbus.h" #include "qemu/timer.h" #include "hw/watchdog/wdt_diag288.h" #include "migration/vmstate.h" #include "qemu/log.h" -#include "qemu/module.h" static WatchdogTimerModel model = { .wdt_name = TYPE_WDT_DIAG288, From patchwork Fri Dec 11 12:26:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11968037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42EC7C4361B for ; Fri, 11 Dec 2020 12:29:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D99D623EB3 for ; Fri, 11 Dec 2020 12:29:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D99D623EB3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knhYG-0006Vu-WD for qemu-devel@archiver.kernel.org; Fri, 11 Dec 2020 07:29:37 -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 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= 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 X-MC-Unique: QwDUBAYFN9qCCRiTAGvZmQ-1 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 = 'printk.time=0 ' + + def wait_for_console_pattern(self, success_message, vm=None): + wait_for_console_pattern(self, success_message, + failure_message='Kernel panic - not syncing', + vm=vm) + + timeout = 120 + + def test_s390x_devices(self): + + """ + :avocado: tags=arch:s390x + :avocado: tags=machine:s390-ccw-virtio + """ + + kernel_url = ('https://snapshot.debian.org/archive/debian/' + '20201126T092837Z/dists/buster/main/installer-s390x/' + '20190702+deb10u6/images/generic/kernel.debian') + kernel_hash = '5821fbee57d6220a067a8b967d24595621aa1eb6' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + initrd_url = ('https://snapshot.debian.org/archive/debian/' + '20201126T092837Z/dists/buster/main/installer-s390x/' + '20190702+deb10u6/images/generic/initrd.debian') + initrd_hash = '81ba09c97bef46e8f4660ac25b4ac0a5be3a94d6' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=sclp0 root=/dev/ram0 BOOT_DEBUG=3') + self.vm.add_args('-nographic', + '-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-device', 'virtio-net-ccw,devno=fe.1.1111', + '-device', 'zpci,uid=5,target=zzz', + '-device', 'virtio-net-pci,id=zzz') + self.vm.launch() + + shell_ready = "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 detection + exec_command_and_wait_for_pattern(self, 'exit', shell_ready) + + ccw_bus_id="0.1.1111" + pci_bus_id="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) From patchwork Fri Dec 11 12:26:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11968077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC786C433FE for ; Fri, 11 Dec 2020 12:32:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 71ED823EB1 for ; Fri, 11 Dec 2020 12:32:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71ED823EB1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knhb7-0000W7-Bg for qemu-devel@archiver.kernel.org; Fri, 11 Dec 2020 07:32:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knhW5-0004Vr-Om for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knhW2-000118-GO for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:21 -0500 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=rLBFvgJC9xt41z9+1XVYcfaLfSXruK2BZzPfCAy1Hxw=; b=VUM73ak0mN+daz8mUnpCrkWULaftvYbfnf4rd7UMVyuWVT5oSUNdEDKBxdF3m+7UfTyAzC oQzLblte1XdL2pVvnU4AjvpoWdkClPAgcAe+hHcSod8/oeGeI+TbPDPqbC5WpL0OKj5iAV Xt+AfprqwfLLVnwcUE7TQl8DWGexjQ0= 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-451-md68Xn_VNF6IirH1hot-ag-1; Fri, 11 Dec 2020 07:27:12 -0500 X-MC-Unique: md68Xn_VNF6IirH1hot-ag-1 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 BEA7DEC1AE; Fri, 11 Dec 2020 12:27:10 +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 5533F1002393; Fri, 11 Dec 2020 12:27:09 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL 3/6] tests/acceptance: test virtio-ccw revision handling Date: Fri, 11 Dec 2020 13:26:55 +0100 Message-Id: <20201211122658.24481-4-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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The max_revision prop of virtio-ccw devices can be used to force an older revision for compatibility handling. The easiest way to check this is to force a device to revision 0, which turns off virtio-1. Signed-off-by: Cornelia Huck [re-formatted overlong lines] Reviewed-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20201130180216.15366-2-cohuck@redhat.com> --- tests/acceptance/machine_s390_ccw_virtio.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py index db6352c44434..c6812719728a 100644 --- a/tests/acceptance/machine_s390_ccw_virtio.py +++ b/tests/acceptance/machine_s390_ccw_virtio.py @@ -51,6 +51,10 @@ class S390CCWVirtioMachine(Test): '-initrd', initrd_path, '-append', kernel_command_line, '-device', 'virtio-net-ccw,devno=fe.1.1111', + '-device', + 'virtio-rng-ccw,devno=fe.2.0000,max_revision=0', + '-device', + 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', '-device', 'virtio-net-pci,id=zzz') self.vm.launch() @@ -60,9 +64,21 @@ class S390CCWVirtioMachine(Test): # first debug shell is too early, we need to wait for device detection exec_command_and_wait_for_pattern(self, 'exit', shell_ready) - ccw_bus_id="0.1.1111" + ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234" pci_bus_id="0005:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', - ccw_bus_id) + ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', pci_bus_id) + # check that the device at 0.2.0000 is in legacy mode, while the + # device at 0.3.1234 has the virtio-1 feature bit set + virtio_rng_features="00000000000000000000000000001100" + \ + "10000000000000000000000000000000" + virtio_rng_features_legacy="00000000000000000000000000001100" + \ + "00000000000000000000000000000000" + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.2.0000/virtio?/features', + virtio_rng_features_legacy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', + virtio_rng_features) From patchwork Fri Dec 11 12:26:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11968035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 151E8C4361B for ; Fri, 11 Dec 2020 12:29:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A54723EB1 for ; Fri, 11 Dec 2020 12:29:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A54723EB1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knhY8-0006Em-DS for qemu-devel@archiver.kernel.org; Fri, 11 Dec 2020 07:29:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knhW5-0004VP-Ij for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knhW2-00010x-GQ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607689635; 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=UKyzzLtqZJFm4h8Im1ZVsg40BKEllQ7/G6XBVDj7Wy4=; b=fjmUXlGYy5MDdfH5DdNVaMqKJfmlveIyiIunSa+bpkQmWBuGf67oBMYJhihBj/M0jQ0Lkj BhaT8V0RxTxVjiKPJE/FZf93iTI9vnh1RkLnBk0toah64VCHp00o8iOOKIEGbeKcfhFq0W LKbzwF6MlCGEFKGkB/zpj4nJdlTvDCc= 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-242-u1bNv1JYOgua12lUF7CwjA-1; Fri, 11 Dec 2020 07:27:13 -0500 X-MC-Unique: u1bNv1JYOgua12lUF7CwjA-1 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 8851F1012E67; Fri, 11 Dec 2020 12:27:12 +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 1C9411002393; Fri, 11 Dec 2020 12:27:10 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL 4/6] tests/acceptance: verify s390x device detection Date: Fri, 11 Dec 2020 13:26:56 +0100 Message-Id: <20201211122658.24481-5-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 Received-SPF: pass client-ip=63.128.21.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_H4=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The kernel/initrd combination does not provide the virtio-net driver; therefore, simply check whether the presented device type is indeed virtio-net for the two virtio-net-{ccw,pci} devices. Signed-off-by: Cornelia Huck [re-formatted overlong lines] Reviewed-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20201130180216.15366-3-cohuck@redhat.com> --- tests/acceptance/machine_s390_ccw_virtio.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py index c6812719728a..ebea1b755c81 100644 --- a/tests/acceptance/machine_s390_ccw_virtio.py +++ b/tests/acceptance/machine_s390_ccw_virtio.py @@ -82,3 +82,14 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', virtio_rng_features) + # verify that we indeed have virtio-net devices (without having the + # virtio-net driver handy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.1.1111/cutype', + '3832/01') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor', + '0x1af4') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', + '0x0001') From patchwork Fri Dec 11 12:26:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11968081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E961EC433FE for ; Fri, 11 Dec 2020 12:33:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AB8F23EB3 for ; Fri, 11 Dec 2020 12:33:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AB8F23EB3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knhcT-0002I3-9c for qemu-devel@archiver.kernel.org; Fri, 11 Dec 2020 07:33:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knhW8-0004d5-8B for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:41262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knhW3-000127-W2 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607689639; 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=53oWCkCZsyn7z/B1gtxMAV0wIeH3WpsP8vuC3tAiDAo=; b=Clfc0ZCQDi2YSZLamu6QO3Q48Kan3+MKEm1HJ65Liie/KJ4lwuYXXrNs3dhSO/723kH1vl gz2+K6dAnL3zWw/2GjVrCRSIbMUeRvOhAbr5RI9jA8Yqx4QVwBITcIYj+Hua1js4CQXzyy gM93zjrSE2xD6loT7Db1e4tU6OE5Cvs= 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-534-QprlYd2ROUGR8fcxJYCNvA-1; Fri, 11 Dec 2020 07:27:15 -0500 X-MC-Unique: QprlYd2ROUGR8fcxJYCNvA-1 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 50FF48030AC; Fri, 11 Dec 2020 12:27:14 +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 D97B710016F7; Fri, 11 Dec 2020 12:27:12 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL 5/6] tests/acceptance: test s390x zpci fid propagation Date: Fri, 11 Dec 2020 13:26:57 +0100 Message-Id: <20201211122658.24481-6-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 Received-SPF: pass client-ip=63.128.21.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_H4=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Verify that a fid specified on the command line shows up correctly as the function_id in the guest. Signed-off-by: Cornelia Huck [re-formatted overlong lines] Reviewed-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20201130180216.15366-4-cohuck@redhat.com> --- tests/acceptance/machine_s390_ccw_virtio.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py index ebea1b755c81..81d14088818c 100644 --- a/tests/acceptance/machine_s390_ccw_virtio.py +++ b/tests/acceptance/machine_s390_ccw_virtio.py @@ -56,7 +56,9 @@ class S390CCWVirtioMachine(Test): '-device', 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', - '-device', 'virtio-net-pci,id=zzz') + '-device', 'virtio-net-pci,id=zzz', + '-device', 'zpci,uid=0xa,fid=12,target=serial', + '-device', 'virtio-serial-pci,id=serial') self.vm.launch() shell_ready = "sh: can't access tty; job control turned off" @@ -65,11 +67,11 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'exit', shell_ready) ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234" - pci_bus_id="0005:00:00.0" + pci_bus_ids="0005:00:00.0 000a:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', - pci_bus_id) + pci_bus_ids) # check that the device at 0.2.0000 is in legacy mode, while the # device at 0.3.1234 has the virtio-1 feature bit set virtio_rng_features="00000000000000000000000000001100" + \ @@ -93,3 +95,7 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', '0x0001') + # check fid propagation + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id', + '0x0000000c') From patchwork Fri Dec 11 12:26:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11968085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DD72C4361B for ; Fri, 11 Dec 2020 12:35:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B675D23EB3 for ; Fri, 11 Dec 2020 12:35:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B675D23EB3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knheB-0004D0-ND for qemu-devel@archiver.kernel.org; Fri, 11 Dec 2020 07:35:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knhWH-0004gp-K6 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53512) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knhWA-00014Z-1G for qemu-devel@nongnu.org; Fri, 11 Dec 2020 07:27:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607689645; 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=jtUp9vtnc+u7JbQj01yVV9NRE2Fs+OCcOxI2USyWlRs=; b=Q3p/gfyNs21XSkfLwfQ0fHnoXwQZwk9VD6maiOgQIhktLU6hRBSOL+UmH/o3twJoHqG/9k qWKEHJR60w8Jkj6b1g+uxVlgkpbsMxdFfO3UV1f5CS9VaZ7PCcFVB20uKCAs0aUO/umoKr 7g47o72MePwmeeCFWKJhNevDZJt8Ej0= 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-499-_XqGtlTCOrGWXNvA7b10ww-1; Fri, 11 Dec 2020 07:27:21 -0500 X-MC-Unique: _XqGtlTCOrGWXNvA7b10ww-1 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 CC4FB107ACF8; Fri, 11 Dec 2020 12:27:19 +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 A2A6310023B3; Fri, 11 Dec 2020 12:27:14 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL 6/6] s390x/cpu: Use timer_free() in the finalize function to avoid memleaks Date: Fri, 11 Dec 2020 13:26:58 +0100 Message-Id: <20201211122658.24481-7-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 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=ham 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: David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Gan Qixin , Euler Robot Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the s390_cpu_initfn function, this patch use timer_free() in the finalize function to fix it. ASAN shows memory leak stack: Direct leak of 3552 byte(s) in 74 object(s) allocated from: #0 0xfffeb3d4e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xfffeb36e6800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaad51a8f9c4 in timer_new_full qemu/include/qemu/timer.h:523 #3 0xaaad51a8f9c4 in timer_new qemu/include/qemu/timer.h:544 #4 0xaaad51a8f9c4 in timer_new_ns qemu/include/qemu/timer.h:562 #5 0xaaad51a8f9c4 in s390_cpu_initfn qemu/target/s390x/cpu.c:304 #6 0xaaad51e00f58 in object_init_with_type qemu/qom/object.c:371 #7 0xaaad51e0406c in object_initialize_with_type qemu/qom/object.c:515 #8 0xaaad51e042e0 in object_new_with_type qemu/qom/object.c:729 #9 0xaaad51e3ff40 in qmp_device_list_properties qemu/qom/qom-qmp-cmds.c:153 #10 0xaaad51910518 in qdev_device_help qemu/softmmu/qdev-monitor.c:283 #11 0xaaad51911918 in qmp_device_add qemu/softmmu/qdev-monitor.c:801 #12 0xaaad51911e48 in hmp_device_add qemu/softmmu/qdev-monitor.c:916 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: David Hildenbrand Message-Id: <20201204081209.360524-4-ganqixin@huawei.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 7b66718c4423..8a734c2f8c0a 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -313,6 +313,11 @@ static void s390_cpu_finalize(Object *obj) #if !defined(CONFIG_USER_ONLY) S390CPU *cpu = S390_CPU(obj); + timer_del(cpu->env.tod_timer); + timer_free(cpu->env.tod_timer); + timer_del(cpu->env.cpu_timer); + timer_free(cpu->env.cpu_timer); + qemu_unregister_reset(s390_cpu_machine_reset_cb, cpu); g_free(cpu->irqstate); #endif