From nobody Wed May 8 02:08:57 2024 Delivered-To: importer@patchew.org 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; 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=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1576846426; cv=none; d=zohomail.com; s=zohoarc; b=lehfMrWHqyN+v4rN+WchTz/zQJKKbR31yJwQPIHPkT3cbi5PxkUPGSCh5HuF2PkNZIgYJhNc7iIba/pHd7FPgPux25vZ79sWJY5EndDB0Lxu+0im5NyZr3Y20TZl848lsCvG0IbRSd0/NanSuf/T6uwcfPxmGKu00Pwlu2UNgBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576846426; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=5gFaRuPUS0w4ERQpWaDZFIw9M9ZTSN+Y4AlY9XlX3ho=; b=JX3U/Ci3T3ZbkYHYsG9ikgshuhpvNSFWk8a4uKsZzjPvB6f/RIqfflWiBuhWcILLbshB0GmKt1Vh3+OmjOXk/Hj+dL8jdUcSB6sq4ISfPB5HLdfwMtGJumfI3IDtXDCEGCI95GDeN6i5fc9VWpw14PIXML799qKCDJ54BP1Ut2k= 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 1576846426038932.2084047152265; Fri, 20 Dec 2019 04:53:46 -0800 (PST) Received: from localhost ([::1]:54816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiHmq-0006MQ-Sv for importer@patchew.org; Fri, 20 Dec 2019 07:53:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60141) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiHm9-0005hV-01 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:53:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiHm5-0002NH-Rs for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:52:58 -0500 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:42100) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiHm5-00024Y-2d for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:52:57 -0500 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id B307E2E1435; Fri, 20 Dec 2019 15:52:52 +0300 (MSK) Received: from sas1-9998cec34266.qloud-c.yandex.net (sas1-9998cec34266.qloud-c.yandex.net [2a02:6b8:c14:3a0e:0:640:9998:cec3]) by mxbackcorp1g.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id uXEJCKdFzr-qpEOaQCj; Fri, 20 Dec 2019 15:52:52 +0300 Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:408:3ee1:a1ff:fe4b:4744]) by sas1-9998cec34266.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id jMDccCIVpa-qpVCIuWL; Fri, 20 Dec 2019 15:52:51 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Precedence: bulk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1576846372; bh=Iu3UL1w8SxSMzA4FDC+4pEn/VK8m32gfNbIWWDQHzaA=; h=Message-Id:Date:Subject:To:From:Cc; b=f4tYxpl+gLh4tzRFNoNe4H9ewRZp4+7ZFLQY5e8gSOriKm38kpVBye6hkSUhaq/xM 1UXSD3EBBGz6Eg1atLgZd2jIcmpESSMxblV5+fzEz9xLcicfpIwDacdHy6AAerDN5R DUDkELed+YHwBO1jV1sxZrsrj7VtX7V9PljKYSvg= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Anton Kuchin To: qemu-devel@nongnu.org Subject: [RFC PATCH] virtio: Change order of appling runstate to device and bus Date: Fri, 20 Dec 2019 15:52:45 +0300 Message-Id: <20191220125245.7679-1-antonkuchin@yandex-team.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 77.88.29.217 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anton Kuchin , yc-core@yandex-team.ru, "Michael S. Tsirkin" 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" On transition to running first apply state to bus and then to device so device can access bus functions correctly. When going to stopped notify device first and then the bus. Signed-off-by: Anton Kuchin --- hw/virtio/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 04716b5f6c..2ea2edba10 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3096,7 +3096,7 @@ static void virtio_vmstate_change(void *opaque, int r= unning, RunState state) bool backend_run =3D running && virtio_device_started(vdev, vdev->stat= us); vdev->vm_running =3D running; =20 - if (backend_run) { + if (!backend_run) { virtio_set_status(vdev, vdev->status); } =20 @@ -3104,7 +3104,7 @@ static void virtio_vmstate_change(void *opaque, int r= unning, RunState state) k->vmstate_change(qbus->parent, backend_run); } =20 - if (!backend_run) { + if (backend_run) { virtio_set_status(vdev, vdev->status); } } --=20 2.20.1