From nobody Tue Apr 7 05:43:51 2026 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=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177366647925481.93479004001631; Mon, 16 Mar 2026 06:07:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w27fF-0000kZ-St; Mon, 16 Mar 2026 09:07:22 -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 1w27ev-0000i6-FT for qemu-devel@nongnu.org; Mon, 16 Mar 2026 09:07:03 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w27es-0003Vo-Li for qemu-devel@nongnu.org; Mon, 16 Mar 2026 09:07:01 -0400 Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 6ED315969F9; Mon, 16 Mar 2026 14:06:53 +0100 (CET) Received: from zero.eik.bme.hu ([127.0.0.1]) by localhost (zero.eik.bme.hu [127.0.0.1]) (amavis, port 10028) with ESMTP id IomEYknnNYeo; Mon, 16 Mar 2026 14:06:51 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5C8735968DE; Mon, 16 Mar 2026 14:06:51 +0100 (CET) X-Virus-Scanned: amavis at eik.bme.hu From: BALATON Zoltan Subject: [PATCH] hw/display/tcx: Init memory regions in realize MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org Cc: Peter Xu , Mark Cave-Ayland , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Message-Id: <20260316130651.5C8735968DE@zero.eik.bme.hu> Date: Mon, 16 Mar 2026 14:06:51 +0100 (CET) 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=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=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: qemu development 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: 1773666486036158500 Content-Type: text/plain; charset="utf-8" Due to aux-ram-share property qemu_ram_alloc_internal dereferences current_machine which is not set during init when inspecting the device. This causes the qtest/device-introspect-test to fail since a recent change to use memory_region_init_rom instead of global vmstate. Fix it by removing the init method and move memory region creation in realize. Fixes: 653c4fa5b0 hw/display/{cg3.tcx}: Do not use memory_region_init_rom_n= omigrate Reported by: Thomas Huth Signed-off-by: BALATON Zoltan Reported-by: Thomas Huth Reviewed-by: Thomas Huth --- hw/display/tcx.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index c8a4ac21ca..ea92a48400 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -751,10 +751,15 @@ static const GraphicHwOps tcx24_ops =3D { .gfx_update =3D tcx24_update_display, }; =20 -static void tcx_initfn(Object *obj) +static void tcx_realize(DeviceState *dev, Error **errp) { - SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); - TCXState *s =3D TCX(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + TCXState *s =3D TCX(dev); + Object *obj =3D OBJECT(dev); + ram_addr_t vram_offset =3D 0; + int size, ret; + uint8_t *vram_base; + char *fcode_filename; =20 memory_region_init_rom(&s->rom, obj, "tcx.prom", FCODE_MAX_ROM_SIZE, &error_fatal); @@ -804,16 +809,6 @@ static void tcx_initfn(Object *obj) memory_region_init_io(&s->alt, obj, &tcx_dummy_ops, s, "tcx.alt", TCX_ALT_NREGS); sysbus_init_mmio(sbd, &s->alt); -} - -static void tcx_realizefn(DeviceState *dev, Error **errp) -{ - SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); - TCXState *s =3D TCX(dev); - ram_addr_t vram_offset =3D 0; - int size, ret; - uint8_t *vram_base; - char *fcode_filename; =20 memory_region_init_ram(&s->vram_mem, OBJECT(s), "tcx.vram", s->vram_size * (1 + 4 + 4), &error_fatal); @@ -887,7 +882,7 @@ static void tcx_class_init(ObjectClass *klass, const vo= id *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - dc->realize =3D tcx_realizefn; + dc->realize =3D tcx_realize; device_class_set_legacy_reset(dc, tcx_reset); dc->vmsd =3D &vmstate_tcx; device_class_set_props(dc, tcx_properties); @@ -897,7 +892,6 @@ static const TypeInfo tcx_info =3D { .name =3D TYPE_TCX, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(TCXState), - .instance_init =3D tcx_initfn, .class_init =3D tcx_class_init, }; =20 --=20 2.41.3