From patchwork Mon May 21 19:34:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 917804 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="dUBogK5T"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40qTXh07f6z9s4k for ; Tue, 22 May 2018 05:36:04 +1000 (AEST) Received: from localhost ([::1]:52140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKqbB-0000ht-JF for incoming@patchwork.ozlabs.org; Mon, 21 May 2018 15:36:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKqaO-0000fL-VS for qemu-devel@nongnu.org; Mon, 21 May 2018 15:35:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKqaK-0003AN-W0 for qemu-devel@nongnu.org; Mon, 21 May 2018 15:35:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:60188) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fKqaK-00038P-QD for qemu-devel@nongnu.org; Mon, 21 May 2018 15:35:08 -0400 Received: from sstabellini-ThinkPad-X260.xilinx.com (unknown [149.199.62.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A14D520853; Mon, 21 May 2018 19:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526931307; bh=YB2xo8vHcGc0E18k1A9vX6DC7vcYpVBmtk5QHxxrK6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dUBogK5T9KqLXXvnGekhom+Y/QncnImLUfK36R2Cey/dQMkL1jzwKa2ijaMTThFJg wggo5QtR2uKJ1gbtIFdLAivN5Vj4lG6j/3U/jFKk1SGznbo7FFeQ22WKMbdIMjYcXp LlyumTvVkNDpNvLoCugo6VZg9fhdwZC+3hslQSRs= From: Stefano Stabellini To: peter.maydell@linaro.org, stefanha@gmail.com Date: Mon, 21 May 2018 12:34:50 -0700 Message-Id: <1526931304-7289-1-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 198.145.29.99 Subject: [Qemu-devel] [PULL 01/15] xen-pvdevice: Introduce a simplistic xen-pvdevice save state 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: Igor Druzhinin , sstabellini@kernel.org, qemu-devel@nongnu.org, stefanha@redhat.com, anthony.perard@citrix.com, xen-devel@lists.xenproject.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Igor Druzhinin This should help to avoid problems with accessing the device after migration/resume without PV drivers by migrating its PCI configuration space state. Without an explicitly defined state record it resets every time a VM migrates which confuses the OS and makes every access to xen-pvdevice MMIO region to fail. PV tools enable some logic to save and restore PCI configuration state from within the VM every time it migrates which basically hides the issue. Older systems will acquire the new record when migrated which should not change their state for worse. Signed-off-by: Igor Druzhinin Reviewed-by: Paul Durrant Acked-by: Anthony PERARD Signed-off-by: Stefano Stabellini --- hw/i386/xen/xen_pvdevice.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c index f748823..a146f18 100644 --- a/hw/i386/xen/xen_pvdevice.c +++ b/hw/i386/xen/xen_pvdevice.c @@ -71,6 +71,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +static const VMStateDescription vmstate_xen_pvdevice = { + .name = "xen-pvdevice", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_PCI_DEVICE(parent_obj, XenPVDevice), + VMSTATE_END_OF_LIST() + } +}; + static void xen_pv_realize(PCIDevice *pci_dev, Error **errp) { XenPVDevice *d = XEN_PV_DEVICE(pci_dev); @@ -120,6 +130,7 @@ static void xen_pv_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_SYSTEM_OTHER; dc->desc = "Xen PV Device"; dc->props = xen_pv_props; + dc->vmsd = &vmstate_xen_pvdevice; } static const TypeInfo xen_pv_type_info = {