From nobody Thu Nov 6 05:46:13 2025 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=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585854658; cv=none; d=zohomail.com; s=zohoarc; b=RSDl4RU4NtsquBWEduvFbXPi8aJEH32Jce/Cte6F//pAfJT1E4E6iAYxcl2qlDpblV+4jIeKodfDmsVc0jNxnnEPtmFbHMRrRJkoQMyUD2VPH8NmchGq/1nOeHOL76q85Ykyq7Hvzrgou8vNfWnp9NfhnMCwS5li9Akx9Ug90L4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585854658; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UayyH5L3cRZEe5aAN8X8vb46906NYlR3VbPuC43zOEs=; b=jR6RqQ1IFJDhRp0pCuyJorCfT7lGADEI37BmJoem7IJr2rRA0+k2GVJB8LcIUc/BRiy0qDElePQnhXR3Rfx4gtl+NsY4JzJKz9NhDT2XLQbQOi5bweKkOp6REln4xfI86FG85HyiYNKyCOHLSLe/0Y0vvKFYVhFNgtH/XfXWGAc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1585854658913410.8180545518551; Thu, 2 Apr 2020 12:10:58 -0700 (PDT) Received: from localhost ([::1]:46346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Ev-0000OI-MD for importer@patchew.org; Thu, 02 Apr 2020 15:10:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33940) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B4-0002b0-BF for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B2-0000Ud-Vk for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:58 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:41368 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5B2-0000RD-Ra for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 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-507-qwJMkc0FOAWN9nWfuiXXCw-1; Thu, 02 Apr 2020 15:06:51 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A6F5100550D for ; Thu, 2 Apr 2020 19:06:50 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D07750BEE; Thu, 2 Apr 2020 19:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854415; 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=UayyH5L3cRZEe5aAN8X8vb46906NYlR3VbPuC43zOEs=; b=aq6rg2K3vqBTi9SthiyY2KM9tgonnyH3mSwxTMPRJuihSERAFaaygQWipyLP9ACnkfAwE6 agHSyGSlxGjU6vYg9/oqMKvlNSi0IIlh6u/Q5EZYyLdRjDRJ1Qa1fa3kdKxH3z8hXQgR2d z8qEsu8QwZ7GvnXZjUVHUW4k9AErf2c= X-MC-Unique: qwJMkc0FOAWN9nWfuiXXCw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/15] serial: Fix double migration data Date: Thu, 2 Apr 2020 15:06:35 -0400 Message-Id: <20200402190640.1693-11-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: 207.211.31.81 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: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" After c9808d60281 we have both an object representing the serial-isa device and a separate object representing the underlying common serial uart. Both of these have vmsd's associated with them and thus the migration stream ends up with two copies of the migration data - the serial-isa includes the vmstate of the core serial. Besides being wrong, it breaks backwards migration compatibility. Fix this by removing the dc->vmsd from the core device, so it only gets migrated by any parent devices including it. Add a vmstate_serial_mm so that any device that uses serial_mm_init rather than creating a device still gets migrated. (That doesn't fix backwards migration for serial_mm_init users, but does seem to work forwards for ppce500). Fixes: c9808d60281 ('serial: realize the serial device') Buglink: https://bugs.launchpad.net/qemu/+bug/1869426 Signed-off-by: Dr. David Alan Gilbert Message-Id: <20200330164712.198282-1-dgilbert@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- hw/char/serial.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 2ab8b69e03..c822a9ae6c 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1043,7 +1043,6 @@ static void serial_class_init(ObjectClass *klass, voi= d* data) dc->user_creatable =3D false; dc->realize =3D serial_realize; dc->unrealize =3D serial_unrealize; - dc->vmsd =3D &vmstate_serial; device_class_set_props(dc, serial_properties); } =20 @@ -1113,6 +1112,16 @@ static void serial_mm_realize(DeviceState *dev, Erro= r **errp) sysbus_init_irq(SYS_BUS_DEVICE(smm), &smm->serial.irq); } =20 +static const VMStateDescription vmstate_serial_mm =3D { + .name =3D "serial", + .version_id =3D 3, + .minimum_version_id =3D 2, + .fields =3D (VMStateField[]) { + VMSTATE_STRUCT(serial, SerialMM, 0, vmstate_serial, SerialState), + VMSTATE_END_OF_LIST() + } +}; + SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, qemu_irq irq, int baudbase, @@ -1162,6 +1171,7 @@ static void serial_mm_class_init(ObjectClass *oc, voi= d *data) =20 device_class_set_props(dc, serial_mm_properties); dc->realize =3D serial_mm_realize; + dc->vmsd =3D &vmstate_serial_mm; } =20 static const TypeInfo serial_mm_info =3D { --=20 2.18.2