From patchwork Thu Jun 9 09:15:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1641154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VP2apdMI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LJghF6N3zz9sFk for ; Thu, 9 Jun 2022 20:44:29 +1000 (AEST) Received: from localhost ([::1]:33162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzFeN-0003bA-IK for incoming@patchwork.ozlabs.org; Thu, 09 Jun 2022 06:44:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGZ-0006Hd-7C for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGT-0007Nk-UC for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654766141; 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=eXJ0/cLEQnTW9mvlDJ25ozxlPwQBkigpFPaXrqS8/ec=; b=VP2apdMIgYkzTEv1NecQa86ORnj2fMRgUsbdQgHpFeSbHIm7wJ+WicDoXiFRVC4ISSEzho 5DcLZZCy2GdASwXbmR5joNIDxLgG5fqWcexiBHICE8J9NSJu6a/w9JX2NzTUt0BMT+sa9y 6i7yzTdtd1GAu6Q8EVniIleONKcmHhQ= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-8-_cOhTVGwMW6uTA2ewQiVEw-1; Thu, 09 Jun 2022 05:15:39 -0400 X-MC-Unique: _cOhTVGwMW6uTA2ewQiVEw-1 Received: by mail-ej1-f70.google.com with SMTP id hy20-20020a1709068a7400b00703779e6f2fso10735408ejc.1 for ; Thu, 09 Jun 2022 02:15:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eXJ0/cLEQnTW9mvlDJ25ozxlPwQBkigpFPaXrqS8/ec=; b=jLtpDJMAmSC4zX5BjHsMdD/pRAgb6uHjBgozEF1+BSvokY9pRfArT54ghMX9B5A3v0 CV9StBO+2CAC0NMIIbRcQBESovp1en4b6Pb7x+Dclxt8NspSRp+N6YEXTeCqfcnywYYS kv3JYPDlZgGidUfwZE9ivtOIne5JUHIxd3ibkKBCblVSACJ6wrHwMmeu4EgMKtcJdfUL dBaF/6By0TE3Bh0mh0651uBOq/IDICqCnHI87KhY+3YjzA7z/MxR3HEbo1KXAvhVI7tA xkJhY7b77VjYKLvG5XQsUWlWB2eFHmDKGfJ97eF+CUpCpHAdxA+4alTgjoshMUuZ20Bn QNcQ== X-Gm-Message-State: AOAM530uMMKDofQmb32DNcK5MT64m88uIu909q9mfpIdZAGMo1BX42PF C4V2MtFe1fL3UWGRGQT1XHdF+kByKIzkZj4IDWHeMRc/QHa/pwpSeLU9eMG0TeX7u70/RFeCs+Q C+iQzmhGbFYXCC0H3YhrsC4J3/yJE8QZFwbEgWQYkL5O5+fSXZAH56jOKW6mmghWvCWM= X-Received: by 2002:a50:ed12:0:b0:42d:d1d3:493c with SMTP id j18-20020a50ed12000000b0042dd1d3493cmr43122084eds.174.1654766138554; Thu, 09 Jun 2022 02:15:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoF7/3lz2RNhyTkJ8Y2rTnlpEFGEIbS5xRaalLNOFYZamXu+29esOdLG+czVZ9+jnumF2b3g== X-Received: by 2002:a50:ed12:0:b0:42d:d1d3:493c with SMTP id j18-20020a50ed12000000b0042dd1d3493cmr43122060eds.174.1654766138308; Thu, 09 Jun 2022 02:15:38 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id y12-20020a170906470c00b00711d0b41bcfsm5212190ejq.0.2022.06.09.02.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 02:15:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: mst@redhat.com, thuth@redhat.com Subject: [PATCH 1/4] s390x: simplify virtio_ccw_reset_virtio Date: Thu, 9 Jun 2022 11:15:31 +0200 Message-Id: <20220609091534.1416909-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609091534.1416909-1-pbonzini@redhat.com> References: <20220609091534.1416909-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Call virtio_bus_reset instead of virtio_reset, so that the function need not receive the VirtIODevice. Signed-off-by: Paolo Bonzini Reviewed-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 15b458527e..066a387802 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -249,12 +249,12 @@ static int virtio_ccw_set_vqs(SubchDev *sch, VqInfoBlock *info, return 0; } -static void virtio_ccw_reset_virtio(VirtioCcwDevice *dev, VirtIODevice *vdev) +static void virtio_ccw_reset_virtio(VirtioCcwDevice *dev) { CcwDevice *ccw_dev = CCW_DEVICE(dev); virtio_ccw_stop_ioeventfd(dev); - virtio_reset(vdev); + virtio_bus_reset(&dev->bus); if (dev->indicators) { release_indicator(&dev->routes.adapter, dev->indicators); dev->indicators = NULL; @@ -359,7 +359,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) ret = virtio_ccw_handle_set_vq(sch, ccw, check_len, dev->revision < 1); break; case CCW_CMD_VDEV_RESET: - virtio_ccw_reset_virtio(dev, vdev); + virtio_ccw_reset_virtio(dev); ret = 0; break; case CCW_CMD_READ_FEAT: @@ -536,7 +536,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) } if (virtio_set_status(vdev, status) == 0) { if (vdev->status == 0) { - virtio_ccw_reset_virtio(dev, vdev); + virtio_ccw_reset_virtio(dev); } if (status & VIRTIO_CONFIG_S_DRIVER_OK) { virtio_ccw_start_ioeventfd(dev); @@ -921,10 +921,9 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector) static void virtio_ccw_reset(DeviceState *d) { VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); - VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); VirtIOCCWDeviceClass *vdc = VIRTIO_CCW_DEVICE_GET_CLASS(dev); - virtio_ccw_reset_virtio(dev, vdev); + virtio_ccw_reset_virtio(dev); if (vdc->parent_reset) { vdc->parent_reset(d); } From patchwork Thu Jun 9 09:15:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1641164 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=B+6kpnDD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LJh4j6Gj4z9s5V for ; Thu, 9 Jun 2022 21:02:13 +1000 (AEST) Received: from localhost ([::1]:55560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzFvX-0003iB-UD for incoming@patchwork.ozlabs.org; Thu, 09 Jun 2022 07:02:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGY-0006Em-D3 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:50693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGW-0007O6-4Z for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654766143; 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=orF3KM0omWlWJzl4+7wtwgGFsa07cv/TcVHHvRE/e/c=; b=B+6kpnDDOVLvNwBuNGDvEHTN1AGnmre/0mEZMR+cFAayngRxwshh2xd4Ua2vEbJ/pXJrhQ YIGwRi6BR3RrV8g8ohEZYXC/CeGUGRhupzhlb2WivOz7sc8ntDonUa9DW5DENrlzsOU+mD R9LkAAE/TlAGHCUW1V9yNERWiPYR56E= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-6poY1KRlNOWhs6Njgd4oQQ-1; Thu, 09 Jun 2022 05:15:41 -0400 X-MC-Unique: 6poY1KRlNOWhs6Njgd4oQQ-1 Received: by mail-ej1-f71.google.com with SMTP id l2-20020a170906078200b006fed42bfeacso10677053ejc.16 for ; Thu, 09 Jun 2022 02:15:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=orF3KM0omWlWJzl4+7wtwgGFsa07cv/TcVHHvRE/e/c=; b=orkDEZeDKcPc2WIppOlRgZZZ+QtpSBDPuvXEFL/kjlgYtqTbvR4hlNXeupJk2uBx+v HnPYl4i1vnpMgLmD52q+JCot/GM+c9Dr3XHOocFdGMDofz2OlIOAbSVTGUX6WtLnzx1Z qqp+4I2gQ+onY3o2Xr0OSGPJU+sI5FdVCJWJQRQHnxzapWqaG/heP+HeZafhnIoQuKhA si1RYTYid5iHWKPCr2G9MsN3F//SLjUlafUJI8fLpUgbfUTvfV8Njb/JnQlpScT75u8c HomoUmyEozaLV9FRC1/QbDuajhQXQXMmflWCwbO9qH4jvCyB+pR+mhLag/kz6UCM92or Y6vA== X-Gm-Message-State: AOAM531bh06wp09JJpcj/UOwozh26wR6FKmub1uBBmtE/YbCyOlQtago b12uRUzND+tHuGxgEyhpo1LNy7+/S0j7FHbkvXgeooL79plVFlwRv0vAiBYlc33Qph59HQ91qA5 LCD8KUayp1yQvIBcbtexyiUbQSDuWgrqZbYWCukdY/d+yq0LnubpQleFebHMzaljmlOw= X-Received: by 2002:a05:6402:56:b0:431:6f7b:533 with SMTP id f22-20020a056402005600b004316f7b0533mr19201399edu.333.1654766140195; Thu, 09 Jun 2022 02:15:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+DvukQnT1gb1SuO3TABJU2qqmabGzCgSrJWJp6Xr6efK7izbTL7K5+QLzGjAI4Vb5EOTGvw== X-Received: by 2002:a05:6402:56:b0:431:6f7b:533 with SMTP id f22-20020a056402005600b004316f7b0533mr19201375edu.333.1654766139875; Thu, 09 Jun 2022 02:15:39 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id r7-20020aa7d147000000b0042dd792b3e8sm14023219edo.50.2022.06.09.02.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 02:15:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: mst@redhat.com, thuth@redhat.com Subject: [PATCH 2/4] virtio-mmio: stop ioeventfd on legacy reset Date: Thu, 9 Jun 2022 11:15:32 +0200 Message-Id: <20220609091534.1416909-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609091534.1416909-1-pbonzini@redhat.com> References: <20220609091534.1416909-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If the queue PFN is set to zero on a virtio-mmio device, the device is reset. In that case however the virtio_bus_stop_ioeventfd function was not called; add it so that the behavior is similar to when status is set to 0. Signed-off-by: Paolo Bonzini Reviewed-by: Cornelia Huck --- hw/virtio/virtio-mmio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 688eccda94..41a35d31c8 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -376,6 +376,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, return; } if (value == 0) { + virtio_mmio_stop_ioeventfd(proxy); virtio_reset(vdev); } else { virtio_queue_set_addr(vdev, vdev->queue_sel, From patchwork Thu Jun 9 09:15:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1641176 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SAo/r/W/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LJhHF67Vyz9s5V for ; Thu, 9 Jun 2022 21:11:21 +1000 (AEST) Received: from localhost ([::1]:35878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzG4K-00023A-5C for incoming@patchwork.ozlabs.org; Thu, 09 Jun 2022 07:11:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGb-0006Li-AN for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54277) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGZ-0007OO-DV for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654766146; 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=tjGLYUErTNz1MM7O5eV2IFFELJREBPkgmtjcjCmnkhk=; b=SAo/r/W/Q0zepk0wxP84u84waNFk0w80vCnDGWtRcEhTiFpjRr1/w74UkTJ99y0KvGG+Fq amhd80fjsbI4HhiN6yWIsmeIUomGZRPD4AfklzZyjQ5w4mKIwPYuGM5UdoHtV6pyiaqw6b huzPmyjIymtbXdokrD7IiXGmSF1OajY= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-164-Qz6F3tIeNKOLXCpN_Ofkiw-1; Thu, 09 Jun 2022 05:15:45 -0400 X-MC-Unique: Qz6F3tIeNKOLXCpN_Ofkiw-1 Received: by mail-ej1-f69.google.com with SMTP id s4-20020a170906500400b006feaccb3a0eso10715206ejj.11 for ; Thu, 09 Jun 2022 02:15:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tjGLYUErTNz1MM7O5eV2IFFELJREBPkgmtjcjCmnkhk=; b=VeOr+MnTFXMeBDYxHYwxetug0GYAt9ljyYBUDfG2j9Cf3zOd+elO33tW0d9kGawofT tftnQm5U4ksbZsYckYlTB+ORL0fElmDcyyvXWOaDAQWaKm+bH0Ff4soz+9s0MgAXp0Ha KybdAD2oqKf/O6ipozB+8cNV/qKf3K9BcHdTkysSuwbWvl6WqLSFtAQqqGtAYL7NtuJS AEn/vtes0IEodf4oOBrbz5MZL92dFPPndGXKvGyaD6nFkavUf76i6m70Lr2W6+w6KUTH DZDK1wPKHIbxV1JF+4eVK+wvjtW4Cib6eeBzTtV/gTyS9nI9ajV8qwJUNLVXtusjFViw ugGQ== X-Gm-Message-State: AOAM530yfc+dUOZpzE7BLBfX/PQLkiLUmmJPxRuk6Pcq9sgiJ+ivBzDx xHwScUFiDkSNWir2UtRdmomJsESmPcSQigq8ceUDmMwZMKN3NmNAc0D8FbSCwPBJh1q0UlivpbS FUOxDP+cpyQke+8pDrhpsd4f5XtNN1rXV9jytJa6jZLI/rgJltNfJrt8lfu2yi1DP9g8= X-Received: by 2002:a05:6402:4246:b0:42f:3a4b:cc71 with SMTP id g6-20020a056402424600b0042f3a4bcc71mr34782545edb.107.1654766144359; Thu, 09 Jun 2022 02:15:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7Kiu+0D60H4FFXSn8A+tPzBpzAI/lJaoMtx5MkncFl9kthJbR45SeYIGorRqaBhbiteSqjg== X-Received: by 2002:a05:6402:4246:b0:42f:3a4b:cc71 with SMTP id g6-20020a056402424600b0042f3a4bcc71mr34782522edb.107.1654766144075; Thu, 09 Jun 2022 02:15:44 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id gj12-20020a170906e10c00b006fed8dfcf78sm10283173ejb.225.2022.06.09.02.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 02:15:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: mst@redhat.com, thuth@redhat.com Subject: [PATCH 3/4] virtio: stop ioeventfd on reset Date: Thu, 9 Jun 2022 11:15:33 +0200 Message-Id: <20220609091534.1416909-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609091534.1416909-1-pbonzini@redhat.com> References: <20220609091534.1416909-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All calls to virtio_bus_reset are preceded by virtio_bus_stop_ioeventfd, move the call in virtio_bus_reset: that makes sense and clarifies that the vdc->reset function is called with ioeventfd already stopped. Signed-off-by: Paolo Bonzini Reviewed-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 1 - hw/virtio/virtio-bus.c | 1 + hw/virtio/virtio-mmio.c | 4 +--- hw/virtio/virtio-pci.c | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 066a387802..e33e5207ab 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -253,7 +253,6 @@ static void virtio_ccw_reset_virtio(VirtioCcwDevice *dev) { CcwDevice *ccw_dev = CCW_DEVICE(dev); - virtio_ccw_stop_ioeventfd(dev); virtio_bus_reset(&dev->bus); if (dev->indicators) { release_indicator(&dev->routes.adapter, dev->indicators); diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index d7ec023adf..896feb37a1 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -104,6 +104,7 @@ void virtio_bus_reset(VirtioBusState *bus) VirtIODevice *vdev = virtio_bus_get_device(bus); DPRINTF("%s: reset device.\n", BUS(bus)->name); + virtio_bus_stop_ioeventfd(bus); if (vdev != NULL) { virtio_reset(vdev); } diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 41a35d31c8..6d81a26473 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -376,8 +376,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, return; } if (value == 0) { - virtio_mmio_stop_ioeventfd(proxy); - virtio_reset(vdev); + virtio_bus_reset(&vdev->bus); } else { virtio_queue_set_addr(vdev, vdev->queue_sel, value << proxy->guest_page_shift); @@ -628,7 +627,6 @@ static void virtio_mmio_reset(DeviceState *d) VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d); int i; - virtio_mmio_stop_ioeventfd(proxy); virtio_bus_reset(&proxy->bus); proxy->host_features_sel = 0; proxy->guest_features_sel = 0; diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 0566ad7d00..45327f0b31 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1945,7 +1945,6 @@ static void virtio_pci_reset(DeviceState *qdev) PCIDevice *dev = PCI_DEVICE(qdev); int i; - virtio_pci_stop_ioeventfd(proxy); virtio_bus_reset(bus); msix_unuse_all_vectors(&proxy->pci_dev); From patchwork Thu Jun 9 09:15:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1641178 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=f1X8ihw8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LJhX85zkKz9s5V for ; Thu, 9 Jun 2022 21:22:32 +1000 (AEST) Received: from localhost ([::1]:44402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzGF5-0000dp-Jp for incoming@patchwork.ozlabs.org; Thu, 09 Jun 2022 07:22:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGe-0006Qm-Sh for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:52019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzEGd-0007Op-5p for qemu-devel@nongnu.org; Thu, 09 Jun 2022 05:15:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654766150; 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=UhU5hIpnBhngBCDdQdspoAO2R7ca5GkL0HNZN9gkK3Q=; b=f1X8ihw8GUwWWLLtWvzHEkwVv+nex6tohGvLyoVBgHMvy0Supjmhzeay0mVW+1s4aun2Y6 u4MYoW+1SzVM7qX6Wk9rZmgfocGlJWJUaKYkDBXUO9LeZC7KTzH3LgwotvSuSDJkKulTT7 9PZHnjYflOd5F1DwfxYKCSh/feTkVnM= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-255-Fw6QhQTHM8SNdBYdTYO-mA-1; Thu, 09 Jun 2022 05:15:49 -0400 X-MC-Unique: Fw6QhQTHM8SNdBYdTYO-mA-1 Received: by mail-ej1-f70.google.com with SMTP id mb1-20020a170906eb0100b00710c3b46a9aso6080392ejb.22 for ; Thu, 09 Jun 2022 02:15:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UhU5hIpnBhngBCDdQdspoAO2R7ca5GkL0HNZN9gkK3Q=; b=0F5mhwQQV4JDEQQ3WMz0ubPSMWXJ5B0uc52kKFb4R9RhbEuy3JZ+IotlYakJnuvH7Q 5audH59+9KocfQGCQnO1BjJ0MABCSV84iAupbN3Ejr4WM2Ju4KVxiQwTyhg2RVnyFUla NFYzaJ8QE7K6UaPJPXULBe+ku8K0hpqDTSqtZtxfmkdene/Zj3jVvh4COckbJxglQ7bk GCBJb10Nfjwe+AWcljTlamWznrla4dgSKWWKOiyhx4QCuUvrZZrOCvGd2zYJvuCW1Ihi 91XcL53aeLwCIxRNgnQV0mz/F8esi9/VPNtOHbZcsAewLxDmutIpewFGApBeTKrrmCcB Kp3A== X-Gm-Message-State: AOAM530mUhbH/Q3n+bVKFR+I/Zxcdoto/JZdQIqqDYefGrAhv3kztV5D BiA8eZVa70/fS15HGzYH++LN4c2gFMGqzfhsie/WBskLskQtOvOWgUCZ4BtY+BNTCzDx9Qgdj+4 YhPzsasv8GSEhNqA6er1hOqOmXf/hZT1oIN1ZhMiLpF9dZDDn14AZd/3/7NIMb8r7Z9w= X-Received: by 2002:aa7:d052:0:b0:42d:d114:43f7 with SMTP id n18-20020aa7d052000000b0042dd11443f7mr43039891edo.320.1654766147593; Thu, 09 Jun 2022 02:15:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzhQuKSreGYv6KIB82qXVJMF3aB2ilOx1meG0B6RYHi5p8rNxRS1kT/+Tc8Puwzy0jg0WEZg== X-Received: by 2002:aa7:d052:0:b0:42d:d114:43f7 with SMTP id n18-20020aa7d052000000b0042dd11443f7mr43039866edo.320.1654766147324; Thu, 09 Jun 2022 02:15:47 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id t20-20020a1709066bd400b006fea3702e56sm10354475ejs.79.2022.06.09.02.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 02:15:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: mst@redhat.com, thuth@redhat.com Subject: [PATCH 4/4] virtio-mmio: cleanup reset Date: Thu, 9 Jun 2022 11:15:34 +0200 Message-Id: <20220609091534.1416909-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609091534.1416909-1-pbonzini@redhat.com> References: <20220609091534.1416909-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make virtio_mmio_soft_reset reset the virtio device, which is performed by both the "soft" and the "hard" reset; and then call virtio_mmio_soft_reset from virtio_mmio_reset to emphasize that the latter is a superset of the former. Signed-off-by: Paolo Bonzini --- hw/virtio/virtio-mmio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 6d81a26473..d240efef97 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -72,12 +72,12 @@ static void virtio_mmio_soft_reset(VirtIOMMIOProxy *proxy) { int i; - if (proxy->legacy) { - return; - } + virtio_bus_reset(&proxy->bus); - for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - proxy->vqs[i].enabled = 0; + if (!proxy->legacy) { + for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { + proxy->vqs[i].enabled = 0; + } } } @@ -376,7 +376,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, return; } if (value == 0) { - virtio_bus_reset(&vdev->bus); + virtio_mmio_soft_reset(proxy); } else { virtio_queue_set_addr(vdev, vdev->queue_sel, value << proxy->guest_page_shift); @@ -432,7 +432,6 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, } if (vdev->status == 0) { - virtio_reset(vdev); virtio_mmio_soft_reset(proxy); } break; @@ -627,7 +626,8 @@ static void virtio_mmio_reset(DeviceState *d) VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d); int i; - virtio_bus_reset(&proxy->bus); + virtio_mmio_soft_reset(proxy); + proxy->host_features_sel = 0; proxy->guest_features_sel = 0; proxy->guest_page_shift = 0; @@ -636,7 +636,6 @@ static void virtio_mmio_reset(DeviceState *d) proxy->guest_features[0] = proxy->guest_features[1] = 0; for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - proxy->vqs[i].enabled = 0; proxy->vqs[i].num = 0; proxy->vqs[i].desc[0] = proxy->vqs[i].desc[1] = 0; proxy->vqs[i].avail[0] = proxy->vqs[i].avail[1] = 0;