From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: Thomas Huth <thuth@redhat.com>,
qemu-devel@nongnu.org, David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH for-2.12] hw/misc/macio: Fix crash when listing device properties of macio device
Date: Tue, 20 Mar 2018 05:05:16 +0000 [thread overview]
Message-ID: <66c6e02a-a082-b9ef-f13c-3cdd8b0775f7@ilande.co.uk> (raw)
In-Reply-To: <1521468046-10400-1-git-send-email-thuth@redhat.com>
On 19/03/18 14:00, Thomas Huth wrote:
> The macio-newworld device can currently be used to abort QEMU unexpectedly:
>
> $ ppc-softmmu/qemu-system-ppc -S -M ref405ep,accel=qtest -qmp stdio
> {"QMP": {"version": {"qemu": {"micro": 50, "minor": 11, "major": 2},
> "package": "build-all"}, "capabilities": []}}
> { 'execute': 'qmp_capabilities' }
> {"return": {}}
> { 'execute': 'device-list-properties',
> 'arguments': {'typename': 'macio-newworld'}}
> Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222:
> Device 'serial0' is in use
> Aborted (core dumped)
>
> qdev properties should be set during realize(), not during instance_init(),
> so move the related code there to fix this problem.
Ah right, presumably this is because of the reference to serial_hds
again? The patch looks good, although given that it affects
macio_instance_init() and macio_common_realize() then I would have
expected this to have failed on the macio-oldworld device too (or
perhaps you were just unlucky that this was the first macio-*world
device enumerated).
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> hw/misc/macio/macio.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index 454244f..b74a657 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -115,6 +115,13 @@ static void macio_common_realize(PCIDevice *d, Error **errp)
> memory_region_add_subregion(&s->bar, 0x16000,
> sysbus_mmio_get_region(sysbus_dev, 0));
>
> + qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
> + qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
> + qdev_prop_set_uint32(DEVICE(&s->escc), "it_shift", 4);
> + qdev_prop_set_chr(DEVICE(&s->escc), "chrA", serial_hds[0]);
> + qdev_prop_set_chr(DEVICE(&s->escc), "chrB", serial_hds[1]);
> + qdev_prop_set_uint32(DEVICE(&s->escc), "chnBtype", escc_serial);
> + qdev_prop_set_uint32(DEVICE(&s->escc), "chnAtype", escc_serial);
> object_property_set_bool(OBJECT(&s->escc), true, "realized", &err);
> if (err) {
> error_propagate(errp, err);
> @@ -341,13 +348,6 @@ static void macio_instance_init(Object *obj)
> object_property_add_child(obj, "dbdma", OBJECT(&s->dbdma), NULL);
>
> object_initialize(&s->escc, sizeof(s->escc), TYPE_ESCC);
> - qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
> - qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
> - qdev_prop_set_uint32(DEVICE(&s->escc), "it_shift", 4);
> - qdev_prop_set_chr(DEVICE(&s->escc), "chrA", serial_hds[0]);
> - qdev_prop_set_chr(DEVICE(&s->escc), "chrB", serial_hds[1]);
> - qdev_prop_set_uint32(DEVICE(&s->escc), "chnBtype", escc_serial);
> - qdev_prop_set_uint32(DEVICE(&s->escc), "chnAtype", escc_serial);
> qdev_set_parent_bus(DEVICE(&s->escc), sysbus_get_default());
> object_property_add_child(obj, "escc", OBJECT(&s->escc), NULL);
> }
>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
ATB,
Mark.
next prev parent reply other threads:[~2018-03-20 5:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-19 14:00 [Qemu-devel] [PATCH for-2.12] hw/misc/macio: Fix crash when listing device properties of macio device Thomas Huth
2018-03-20 0:01 ` David Gibson
2018-03-20 1:17 ` Philippe Mathieu-Daudé
2018-03-20 5:05 ` Mark Cave-Ayland [this message]
2018-03-20 10:22 ` Thomas Huth
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=66c6e02a-a082-b9ef-f13c-3cdd8b0775f7@ilande.co.uk \
--to=mark.cave-ayland@ilande.co.uk \
--cc=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).