From patchwork Wed May 29 07:09:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10966279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52699912 for ; Wed, 29 May 2019 07:38:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4174521FAC for ; Wed, 29 May 2019 07:38:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35AF6287C5; Wed, 29 May 2019 07:38:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D65E121FAC for ; Wed, 29 May 2019 07:38:09 +0000 (UTC) Received: from localhost ([127.0.0.1]:49135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVtA1-0006gM-5L for patchwork-qemu-devel@patchwork.kernel.org; Wed, 29 May 2019 03:38:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVsjm-0000bX-LG for qemu-devel@nongnu.org; Wed, 29 May 2019 03:11:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVsjl-0006SC-PC for qemu-devel@nongnu.org; Wed, 29 May 2019 03:11:02 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:34094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hVsjl-0006Ql-KK for qemu-devel@nongnu.org; Wed, 29 May 2019 03:11:01 -0400 Received: by mail-pf1-x442.google.com with SMTP id n19so1028104pfa.1 for ; Wed, 29 May 2019 00:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KCQFP+ZFlVwkBiduDICRQjKoGn++Fs0jXbPk/B+kRlo=; b=pVXhUfN13yEkPRGYJVvtc3bqZOUVWl+Ggu18I5ldY/H0W8rkQ74YJfddMKVwNC6eQm sAfjiNP+kGUSp2EpQ0NEaeF2jFkFt0u+Ei9huGtoZrwcgxngVhWO6Tpx/5JGSGQphZZL qrteWcVdPGSxcsJ4u9LSeHmmsxOmsR3Gp05jVcrRvhMATlcGRMU5l0EbIkTZ2DL8urpE cYFsIz5ysJEAqg+U7NkujALgGSQYq31JLc5Tceh2rgJVEgRFOP5ZJ+y6LKr53o/wqJKA lSm/Nsj5aqhAPsPd4JeyvQrX+CNCJgde/grMJ0jRfcT04qGg7vupvo6HRxACUq89mTfh 3INw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KCQFP+ZFlVwkBiduDICRQjKoGn++Fs0jXbPk/B+kRlo=; b=Pg843tk3XTET5I/gPk+2hUyZp6KEacUDUMmSN5+nkxk4QqBROVpwwY0h9ez/HtZho5 Kreu4QbfHtnRBrHfC9Wl3b21aH4hsDv+mUcdJ/EdF5KrY9JzKfLPSQ6vvkHL85KpiPzF nfXO/YkIU6XgusOPoQnavjxWvHxxFUqm6m4FVe4UkgtxI8s5YA+Z5KtJV6GgGexYtl97 Xr6QL3FhT+eGKn53AckJ2A7JrjCypkSuEO7jJ1HNkI087YN0KH3Sf1UMNoZgLHl4haF9 WdsoinNdGew7E5VKGQrDQW+xB07Pvkf4m7VZwR0YWW6h0y0s3fEswkZxhmFmp1yc4ecp VuVg== X-Gm-Message-State: APjAAAVTwcxLQ5XqnJOO2YoUiAyhKehZND6srRJYul5vQI1L+BKWHNA9 Vktg1/sWxdta1UFZxyavwIQ= X-Google-Smtp-Source: APXvYqyyhGSdqPEvv1BlR4DJGOhel4jLkeN9sbYM++/muzgCF4kRzJDLYhIt6usA/7IMGd86xDA2JA== X-Received: by 2002:a17:90a:cb0a:: with SMTP id z10mr10432703pjt.101.1559113858348; Wed, 29 May 2019 00:10:58 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id k6sm16970656pfi.86.2019.05.29.00.10.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 May 2019 00:10:58 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, groug@kaod.org, dgilbert@redhat.com Date: Wed, 29 May 2019 15:09:52 +0800 Message-Id: <20190529070955.25565-3-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190529070955.25565-1-xieyongji@baidu.com> References: <20190529070955.25565-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH 2/5] virtio: Migrate the "start_on_kick" flag X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xie Yongji , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji We should migrate the "start_on_kick" flag so that we would not miss starting device on kicking at startup after migration. Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index fc8fca81ad..4d4ff67791 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1802,6 +1802,13 @@ static bool virtio_started_needed(void *opaque) return vdev->started; } +static bool virtio_start_on_kick_needed(void *opaque) +{ + VirtIODevice *vdev = opaque; + + return vdev->start_on_kick; +} + static const VMStateDescription vmstate_virtqueue = { .name = "virtqueue_state", .version_id = 1, @@ -1941,6 +1948,17 @@ static const VMStateDescription vmstate_virtio_started = { } }; +static const VMStateDescription vmstate_virtio_start_on_kick = { + .name = "virtio/start_on_kick", + .version_id = 1, + .minimum_version_id = 1, + .needed = &virtio_start_on_kick_needed, + .fields = (VMStateField[]) { + VMSTATE_BOOL(start_on_kick, VirtIODevice), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_virtio = { .name = "virtio", .version_id = 1, @@ -1957,6 +1975,7 @@ static const VMStateDescription vmstate_virtio = { &vmstate_virtio_broken, &vmstate_virtio_extra_state, &vmstate_virtio_started, + &vmstate_virtio_start_on_kick, NULL } };