From nobody Wed Nov 27 20:52:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697622511764965.1386695978222; Wed, 18 Oct 2023 02:48:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt38a-0001Mq-1z; Wed, 18 Oct 2023 05:46:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt38R-0001JT-Hp for qemu-devel@nongnu.org; Wed, 18 Oct 2023 05:46:40 -0400 Received: from mail.ozlabs.org ([2404:9400:2221:ea00::3] helo=gandalf.ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt38O-0003Z0-NV for qemu-devel@nongnu.org; Wed, 18 Oct 2023 05:46:39 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4S9QwT4MxPz4xc9; Wed, 18 Oct 2023 20:46:33 +1100 (AEDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4S9QwR3hRBz4xbC; Wed, 18 Oct 2023 20:46:31 +1100 (AEDT) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Laszlo Ersek , Gerd Hoffmann , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 21/22] ramfb-standalone: add migration support Date: Wed, 18 Oct 2023 11:45:30 +0200 Message-ID: <20231018094531.733211-22-clg@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018094531.733211-1-clg@redhat.com> References: <20231018094531.733211-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2404:9400:2221:ea00::3; envelope-from=SRS0=VFJy=GA=redhat.com=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1697622512473100005 From: Marc-Andr=C3=A9 Lureau Add a "ramfb-dev" section whenever "x-migrate" is turned on. Turn it off by default on machines <=3D 8.1 for compatibility reasons. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Laszlo Ersek Acked-by: Gerd Hoffmann Signed-off-by: C=C3=A9dric Le Goater --- hw/core/machine.c | 1 + hw/display/ramfb-standalone.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index cfd1edfe20b53f2a2e5a7963f63a285fea6fef56..6305f2d7a4bbe25e0c132737bc8= ebda83f7fd3a2 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -34,6 +34,7 @@ =20 GlobalProperty hw_compat_8_1[] =3D { { TYPE_PCI_BRIDGE, "x-pci-express-writeable-slt-bug", "true" }, + { "ramfb", "x-migrate", "off" }, }; const size_t hw_compat_8_1_len =3D G_N_ELEMENTS(hw_compat_8_1); =20 diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c index 8c0094397f5b384df94cafa87cc854d4353e19f4..a96e7ebcd9fa57989475e25b755= 99990acbe884f 100644 --- a/hw/display/ramfb-standalone.c +++ b/hw/display/ramfb-standalone.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "migration/vmstate.h" #include "qapi/error.h" #include "qemu/module.h" #include "hw/loader.h" @@ -15,6 +16,7 @@ struct RAMFBStandaloneState { SysBusDevice parent_obj; QemuConsole *con; RAMFBState *state; + bool migrate; }; =20 static void display_update_wrapper(void *dev) @@ -40,14 +42,39 @@ static void ramfb_realizefn(DeviceState *dev, Error **e= rrp) ramfb->state =3D ramfb_setup(errp); } =20 +static bool migrate_needed(void *opaque) +{ + RAMFBStandaloneState *ramfb =3D RAMFB(opaque); + + return ramfb->migrate; +} + +static const VMStateDescription ramfb_dev_vmstate =3D { + .name =3D "ramfb-dev", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D migrate_needed, + .fields =3D (VMStateField[]) { + VMSTATE_STRUCT_POINTER(state, RAMFBStandaloneState, ramfb_vmstate,= RAMFBState), + VMSTATE_END_OF_LIST() + } +}; + +static Property ramfb_properties[] =3D { + DEFINE_PROP_BOOL("x-migrate", RAMFBStandaloneState, migrate, true), + DEFINE_PROP_END_OF_LIST(), +}; + static void ramfb_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); + dc->vmsd =3D &ramfb_dev_vmstate; dc->realize =3D ramfb_realizefn; dc->desc =3D "ram framebuffer standalone device"; dc->user_creatable =3D true; + device_class_set_props(dc, ramfb_properties); } =20 static const TypeInfo ramfb_info =3D { --=20 2.41.0