From: Markus Armbruster <armbru@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org, atar4qemu@gmail.com,
david@gibson.dropbear.id.au
Subject: Re: [PATCH v2 5/6] macio: don't reference serial_hd() directly within the device
Date: Thu, 05 Nov 2020 07:29:33 +0100 [thread overview]
Message-ID: <87o8kcs4du.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <365d15e9-0543-b906-4bc1-d04238fba5ed@redhat.com> (Thomas Huth's message of "Wed, 4 Nov 2020 15:51:09 +0100")
Thomas Huth <thuth@redhat.com> writes:
> On 04/11/2020 15.16, BALATON Zoltan wrote:
>> On Wed, 4 Nov 2020, Thomas Huth wrote:
>>> On 26/09/2020 16.02, Mark Cave-Ayland wrote:
>>>> Instead use qdev_prop_set_chr() to configure the ESCC serial chardevs at the
>>>> Mac Old World and New World machine level.
>>>>
>>>> Also remove the now obsolete comment referring to the use of serial_hd() and
>>>> the setting of user_creatable to false accordingly.
>>>>
>>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>>> ---
>>>> hw/misc/macio/macio.c | 4 ----
>>>> hw/ppc/mac_newworld.c | 6 ++++++
>>>> hw/ppc/mac_oldworld.c | 6 ++++++
>>>> 3 files changed, 12 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
>>>> index 679722628e..51368884d0 100644
>>>> --- a/hw/misc/macio/macio.c
>>>> +++ b/hw/misc/macio/macio.c
>>>> @@ -109,8 +109,6 @@ static void macio_common_realize(PCIDevice *d, Error **errp)
>>>> 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_hd(0));
>>>> - qdev_prop_set_chr(DEVICE(&s->escc), "chrB", serial_hd(1));
>>>> qdev_prop_set_uint32(DEVICE(&s->escc), "chnBtype", escc_serial);
>>>> qdev_prop_set_uint32(DEVICE(&s->escc), "chnAtype", escc_serial);
>>>> if (!qdev_realize(DEVICE(&s->escc), BUS(&s->macio_bus), errp)) {
>>>> @@ -458,8 +456,6 @@ static void macio_class_init(ObjectClass *klass, void *data)
>>>> k->class_id = PCI_CLASS_OTHERS << 8;
>>>> device_class_set_props(dc, macio_properties);
>>>> set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
>>>> - /* Reason: Uses serial_hds in macio_instance_init */
>>>> - dc->user_creatable = false;
>>>> }
>>>
>>> Hi Mark,
>>>
>>> the macio device can now be used to crash QEMU:
>>>
>>> $ ./qemu-system-ppc -M sam460ex -device macio-newworld
>>> Segmentation fault (core dumped)
>>>
>>> I guess we should either restore the user_creatable flag or add some sanity
>>> checks elsewhere?
>>
>> Looks like it needs to check if pic_dev is set:
[...]
>> Maybe something like:
>>
>> if (!pic_dev) {
>> error_setg(errp, "some meaningful error message");
>> return;
>> }
>>
>> before the sysbus_connect_irq calls but unless the user can set this via
>> the command line somehow then keeping the user_creatable = false with
>> comment adjusted to say that this device needs to be connected by board
>> code is probably better.
>
> Yes, as far as I can see, there is no way a user could use these devices
> from the command line - the "pic" link has to be set up by code. So I'd also
> suggest to add the user_creatable = false back again.
When you do that, add a comment that explains why. You might want to
examine existing comments for inspiration.
next prev parent reply other threads:[~2020-11-05 6:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-26 14:02 [PATCH v2 0/6] QOM minor fixes Mark Cave-Ayland
2020-09-26 14:02 ` [PATCH v2 1/6] sparc32-dma: use object_initialize_child() for espdma and ledma child objects Mark Cave-Ayland
2020-09-26 14:02 ` [PATCH v2 2/6] sparc32-ledma: use object_initialize_child() for lance child object Mark Cave-Ayland
2020-09-26 14:02 ` [PATCH v2 3/6] sparc32-espdma: use object_initialize_child() for esp " Mark Cave-Ayland
2020-09-26 14:02 ` [PATCH v2 4/6] sparc32-ledma: don't reference nd_table directly within the device Mark Cave-Ayland
2020-09-26 20:11 ` Philippe Mathieu-Daudé
2020-09-26 14:02 ` [PATCH v2 5/6] macio: don't reference serial_hd() " Mark Cave-Ayland
2020-11-04 12:47 ` Thomas Huth
2020-11-04 14:16 ` BALATON Zoltan via
2020-11-04 14:24 ` BALATON Zoltan via
2020-11-04 14:51 ` Thomas Huth
2020-11-05 6:29 ` Markus Armbruster [this message]
2020-11-04 19:29 ` Mark Cave-Ayland
2020-11-05 5:31 ` Thomas Huth
2020-11-06 7:35 ` Mark Cave-Ayland
2020-11-09 10:02 ` Thomas Huth
2020-11-10 9:03 ` Mark Cave-Ayland
2020-09-26 14:02 ` [PATCH v2 6/6] sabre: don't call sysbus_mmio_map() in sabre_realize() Mark Cave-Ayland
2020-10-21 9:18 ` [PATCH v2 0/6] QOM minor fixes Mark Cave-Ayland
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=87o8kcs4du.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=atar4qemu@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=mark.cave-ayland@ilande.co.uk \
--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 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.