qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Eduardo Habkost" <ehabkost@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Laszlo Ersek <lersek@redhat.com>,
	peter.maydell@linaro.org, mst@redhat.com, somlo@cmu.edu,
	qemu-devel@nongnu.org, rjones@redhat.com, imammedo@redhat.com,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCHv6 3/5] fw_cfg: move assert() and linking of fw_cfg device to the machine into instance_init()
Date: Mon, 26 Jun 2017 21:49:30 -0300	[thread overview]
Message-ID: <20170627004930.GI12152@localhost.localdomain> (raw)
In-Reply-To: <120b9dac-982b-1e3b-662f-e60110b3d730@ilande.co.uk>

On Sun, Jun 25, 2017 at 07:58:04PM +0100, Mark Cave-Ayland wrote:
> On 23/06/17 19:50, Eduardo Habkost wrote:
> 
> >> Really, please go back to the earlier discussion around fw_cfg_init1()
> >> and you'll see my original point (which matches what you just voiced).
> > 
> > Yep.  I was just not sure validation on realize was necessary or
> > convenient.  It looks like we agree it is just convenient.
> > 
> > 
> >>
> >>> All that said, I don't have a strong argument against doing it on
> >>> realize, except my gut feeling that this is not how qdev was
> >>> designed[1].  If doing it on realize is the simplest way to do it, I
> >>> won't be the one complaining.
> >>>
> >>> [1] I believe the original intent was to make every single device
> >>>     user-creatable and define boards in a declarative way in config
> >>>     files.  We are very far from that goal.
> >>
> >> I'm fine either way, I just wanted to accommodate Mark's preference,
> >> because he seemed to strongly dislike having to call any helper
> >> functions from board code, beyond initing and realizing the device.
> >>
> >> This is my recollection of the earlier discussion anyway.
> > 
> > I think we are in agreement, then.  If there are no objections from
> > others against doing object_property_add_child() on realize, I'm also OK
> > with that.
> 
> Just to clarify here that my objection wasn't so much about calling
> helper functions from board code, it was that as the current patch
> exposes the MemoryRegions in TYPE_FW_CFG_IO and TYPE_FW_CFG_MEM then as
> per my example where the machine link is omitted then the check becomes
> useless.

I don't understand this part.  When and why would the check become
useless?

> 
> I can see that device_set_realized() will always set the device parent
> to /machine/unattached before calling the realize function if the device
> doesn't have a parent. So is it even possible to add the device via
> object_property_add_child() to the machine during realize? Or could it
> be done by making /machine/fw_cfg an alias to its real location in the
> QOM tree at realize time without breaking the object_resolve_path_type()
> check?

Well, if we can't do object_property_add_child() on ->instance_init()
and doing it on ->realize() would require a more complex solution
involving QOM links, I believe the simplest solution is to provide a
helper function.

> 
> The other interesting option to explore is that since fw_cfg already has
> a machine_ready notifier, the check could be moved there similar to as
> done in hw/core/machine.c's error_on_sysbus_device() if the check
> shouldn't be present in realize. That still doesn't answer the question
> as to how to enforce that the device is correctly linked to the machine
> though.

I think both manually mapping+linking from board code or calling a
helper function from board code would be acceptable.

-- 
Eduardo

  reply	other threads:[~2017-06-27  0:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 12:59 [Qemu-devel] [PATCHv6 0/5] fw_cfg: qdev-related tidy-ups Mark Cave-Ayland
2017-06-19 12:59 ` [Qemu-devel] [PATCHv6 1/5] fw_cfg: don't map the fw_cfg IO ports in fw_cfg_io_realize() Mark Cave-Ayland
2017-06-19 14:10   ` Eduardo Habkost
2017-06-19 12:59 ` [Qemu-devel] [PATCHv6 2/5] fw_cfg: move setting of FW_CFG_VERSION_DMA bit to fw_cfg_init1() Mark Cave-Ayland
2017-06-19 14:11   ` Eduardo Habkost
2017-06-20  3:18   ` Philippe Mathieu-Daudé
2017-06-19 12:59 ` [Qemu-devel] [PATCHv6 3/5] fw_cfg: move assert() and linking of fw_cfg device to the machine into instance_init() Mark Cave-Ayland
2017-06-19 14:28   ` Eduardo Habkost
2017-06-19 14:56     ` Laszlo Ersek
2017-06-19 16:57     ` Mark Cave-Ayland
2017-06-19 17:09       ` Laszlo Ersek
2017-06-19 18:49         ` Mark Cave-Ayland
2017-06-19 22:43           ` Laszlo Ersek
2017-06-21  6:58             ` Mark Cave-Ayland
2017-06-21  7:48               ` Laszlo Ersek
2017-06-21 11:36                 ` Eduardo Habkost
2017-06-21 12:17                   ` Mark Cave-Ayland
2017-06-21 13:23                     ` Eduardo Habkost
2017-06-23  8:12                       ` Mark Cave-Ayland
2017-06-23 11:50                         ` Eduardo Habkost
2017-06-23 15:52                           ` Laszlo Ersek
2017-06-23 16:10                             ` Eduardo Habkost
2017-06-23 16:48                               ` Laszlo Ersek
2017-06-23 18:50                                 ` Eduardo Habkost
2017-06-25 18:58                                   ` Mark Cave-Ayland
2017-06-27  0:49                                     ` Eduardo Habkost [this message]
2017-06-28  7:09                                       ` Mark Cave-Ayland
2017-06-28 14:12                                         ` Igor Mammedov
2017-06-28 14:21                                           ` Laszlo Ersek
2017-06-28 15:31                                             ` Igor Mammedov
2017-06-29 12:12                                           ` Mark Cave-Ayland
2017-06-19 12:59 ` [Qemu-devel] [PATCHv6 4/5] fw_cfg: move qdev_init_nofail() from fw_cfg_init1() to callers Mark Cave-Ayland
2017-06-19 12:59 ` [Qemu-devel] [PATCHv6 5/5] fw_cfg: move QOM type defines and fw_cfg types into fw_cfg.h 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=20170627004930.GI12152@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    --cc=somlo@cmu.edu \
    /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).