From: Peter Xu <peterx@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Thomas Huth" <thuth@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
qemu-devel@nongnu.org,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH] hw/display/tcx: Init memory regions in realize
Date: Mon, 16 Mar 2026 13:49:58 -0400 [thread overview]
Message-ID: <abhCxgOL0Rdra8hI@x1.local> (raw)
In-Reply-To: <CAFEAcA-n2EW=deU=jVcLd=6PysNZd5m7WTYrHLtQkxMo=KWBPw@mail.gmail.com>
On Mon, Mar 16, 2026 at 04:36:23PM +0000, Peter Maydell wrote:
> On Mon, 16 Mar 2026 at 16:23, Thomas Huth <thuth@redhat.com> wrote:
> >
> > On 16/03/2026 17.06, Peter Xu wrote:
> > > On Mon, Mar 16, 2026 at 02:06:51PM +0100, BALATON Zoltan wrote:
> > >> 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
> > >
> > > Does it has anything to do with aux-ram-share? I thought it's because the
> > > qom introspect test will create yet another sun-tcx device, causing double
> > > registration?
> >
> > I think it happens because the test starts QEMU with the sun4m machine (or
> > whichever machine uses this device by default), and then creates another
> > instance of the device for introspection (without realizing it). You can
> > easily recreate the bug manually like this:
> >
> > $ ./qemu-system-sparc -M SS-20 -display none -monitor stdio
> > QEMU 10.2.50 monitor - type 'help' for more information
> > (qemu) device_add sun-tcx,help
> > RAMBlock "tcx.prom" already registered, abort!
> > Aborted (core dumped)
> >
> > An instance_init() function should not change the global state of QEMU, so
> > registering memory regions this way is a no-go. This has to be done in
> > realize() instead.
>
> Ah, and previously we created the MR in instance_init but did
> the vmstate_register_ram_global() in realize, so we didn't see this.
>
> I'm a little surprised that this causes a problem, though -- I
> thought that we constructed the RAM idstr not just from the
> provided string but also including the qdev path, so that
> you could have multiple devices of the same type. I guess that
> we don't get that happening correctly because the device isn't
> sufficiently created to have a qdev path yet when we haven't
> even finished instance_init ?
Device sun-tcx's parent bus is TYPE_SYSTEM_BUS, which doesn't provide
->get_dev_path().. so IIUC it'll generate the same name.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-03-16 17:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 13:06 [PATCH] hw/display/tcx: Init memory regions in realize BALATON Zoltan
2026-03-16 16:06 ` Peter Xu
2026-03-16 16:23 ` Thomas Huth
2026-03-16 16:36 ` Peter Maydell
2026-03-16 17:49 ` Peter Xu [this message]
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=abhCxgOL0Rdra8hI@x1.local \
--to=peterx@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--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.