From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Cc: "Peter Xu" <peterx@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>
Subject: [PATCH] hw/display/tcx: Init memory regions in realize
Date: Mon, 16 Mar 2026 14:06:51 +0100 (CET) [thread overview]
Message-ID: <20260316130651.5C8735968DE@zero.eik.bme.hu> (raw)
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_nomigrate
Reported by: Thomas Huth <thuth@redhat.com>
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
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 = {
.gfx_update = tcx24_update_display,
};
-static void tcx_initfn(Object *obj)
+static void tcx_realize(DeviceState *dev, Error **errp)
{
- SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
- TCXState *s = TCX(obj);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+ TCXState *s = TCX(dev);
+ Object *obj = OBJECT(dev);
+ ram_addr_t vram_offset = 0;
+ int size, ret;
+ uint8_t *vram_base;
+ char *fcode_filename;
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 = SYS_BUS_DEVICE(dev);
- TCXState *s = TCX(dev);
- ram_addr_t vram_offset = 0;
- int size, ret;
- uint8_t *vram_base;
- char *fcode_filename;
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 void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- dc->realize = tcx_realizefn;
+ dc->realize = tcx_realize;
device_class_set_legacy_reset(dc, tcx_reset);
dc->vmsd = &vmstate_tcx;
device_class_set_props(dc, tcx_properties);
@@ -897,7 +892,6 @@ static const TypeInfo tcx_info = {
.name = TYPE_TCX,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(TCXState),
- .instance_init = tcx_initfn,
.class_init = tcx_class_init,
};
--
2.41.3
next reply other threads:[~2026-03-16 13:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 13:06 BALATON Zoltan [this message]
2026-03-16 16:06 ` [PATCH] hw/display/tcx: Init memory regions in realize Peter Xu
2026-03-16 16:23 ` Thomas Huth
2026-03-16 16:36 ` Peter Maydell
2026-03-16 17:49 ` Peter Xu
2026-03-16 21:45 ` Mark Cave-Ayland
2026-03-17 5:31 ` Thomas Huth
2026-03-16 18:10 ` BALATON Zoltan
2026-03-16 21:30 ` Peter Xu
2026-03-16 22:30 ` BALATON Zoltan
2026-03-17 5:41 ` Thomas Huth
2026-03-17 6:15 ` Thomas Huth
2026-03-17 10:17 ` BALATON Zoltan
2026-03-17 10:24 ` BALATON Zoltan
2026-03-17 14:24 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260316130651.5C8735968DE@zero.eik.bme.hu \
--to=balaton@eik.bme.hu \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.