From: Eduardo Habkost <ehabkost@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, somlo@cmu.edu, mst@redhat.com,
pbonzini@redhat.com, rjones@redhat.com, imammedo@redhat.com,
peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCHv9 3/3] fw_cfg: move QOM type defines and fw_cfg types into fw_cfg.h
Date: Fri, 14 Jul 2017 15:56:16 -0300 [thread overview]
Message-ID: <20170714185616.GQ6020@localhost.localdomain> (raw)
In-Reply-To: <9584b0c7-96f4-f000-e53f-93accd8a39ad@redhat.com>
On Fri, Jul 14, 2017 at 08:28:37PM +0200, Laszlo Ersek wrote:
> On 07/14/17 20:09, Eduardo Habkost wrote:
> > On Fri, Jul 14, 2017 at 10:40:08AM +0100, Mark Cave-Ayland wrote:
> >> By exposing FWCfgIoState and FWCfgMemState internals we allow the possibility
> >> for the internal MemoryRegion fields to be mapped by name for boards that wish
> >> to wire up the fw_cfg device themselves.
> >>
> >> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> >> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> > [...]
> >> diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
> >> index b980cba..b77ea48 100644
> >> --- a/include/hw/nvram/fw_cfg.h
> >> +++ b/include/hw/nvram/fw_cfg.h
> >> @@ -1,8 +1,19 @@
> >> #ifndef FW_CFG_H
> >> #define FW_CFG_H
> >>
> >> +#include "qemu/typedefs.h"
> >> #include "exec/hwaddr.h"
> >> #include "hw/nvram/fw_cfg_keys.h"
> >> +#include "hw/sysbus.h"
> >> +#include "sysemu/dma.h"
> >> +
> >> +#define TYPE_FW_CFG "fw_cfg"
> >> +#define TYPE_FW_CFG_IO "fw_cfg_io"
> >> +#define TYPE_FW_CFG_MEM "fw_cfg_mem"
> >> +
> >> +#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG)
> >> +#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO)
> >> +#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM)
> >>
> >> typedef struct FWCfgFile {
> >> uint32_t size; /* file size */
> >> @@ -35,6 +46,45 @@ typedef struct FWCfgDmaAccess {
> >>
> >> typedef void (*FWCfgReadCallback)(void *opaque);
> >>
> >> +struct FWCfgState {
> >> + /*< private >*/
> >> + SysBusDevice parent_obj;
> >> + /*< public >*/
> >> +
> >> + uint16_t file_slots;
> >> + FWCfgEntry *entries[2];
> >> + int *entry_order;
> >> + FWCfgFiles *files;
> >> + uint16_t cur_entry;
> >> + uint32_t cur_offset;
> >> + Notifier machine_ready;
> >> +
> >> + int fw_cfg_order_override;
> >> +
> >> + bool dma_enabled;
> >> + dma_addr_t dma_addr;
> >> + AddressSpace *dma_as;
> >> + MemoryRegion dma_iomem;
> >> +};
> >> +
> >> +struct FWCfgIoState {
> >> + /*< private >*/
> >> + FWCfgState parent_obj;
> >> + /*< public >*/
> >> +
> >> + MemoryRegion comb_iomem;
> >> +};
> >> +
> >> +struct FWCfgMemState {
> >> + /*< private >*/
> >> + FWCfgState parent_obj;
> >> + /*< public >*/
> >> +
> >> + MemoryRegion ctl_iomem, data_iomem;
> >> + uint32_t data_width;
> >> + MemoryRegionOps wide_data_ops;
> >> +};
> >
> > Why do you need the full struct declaration to be exposed in the
> > header?
>
> Different board code wants to hook up "comb_iomem" manually to different
> address spaces, so they need to access the field directly. This is the
> ultimate goal of the entire exercise, IIRC.
>
> > The memory regions are supposed to be visible as QOM
> > children to the fw_cfg device, already.
>
> I don't understand this. How else can board code work with "comb_iomem"
> than described above? If there is a way, I agree it would be preferable.
object_resolve_path_component(fw_cfg, "fwcfg[0]") and
object_resolve_path_component(fw_cfg, "fwcfg.dma[0]") should
return fw_cfg->comb_iomem and fw_cfg->dma_iomem, respectively.
I don't know why those names were chosen, though. Probably it's
a good idea to call object_property_add_child() manually with
more appropriate names inside the fw_cfg code instead of letting
memory_region_init() pick the child name.
--
Eduardo
next prev parent reply other threads:[~2017-07-14 18:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 9:40 [Qemu-devel] [PATCHv9 0/3] fw_cfg: qdev-related tidy-ups Mark Cave-Ayland
2017-07-14 9:40 ` [Qemu-devel] [PATCHv9 1/3] fw_cfg: switch fw_cfg_find() to locate the fw_cfg device by type rather than path Mark Cave-Ayland
2017-07-14 15:53 ` Igor Mammedov
2017-07-14 17:15 ` Eduardo Habkost
2017-07-14 9:40 ` [Qemu-devel] [PATCHv9 2/3] fw_cfg: move qdev_init_nofail() from fw_cfg_init1() to callers Mark Cave-Ayland
2017-07-14 17:15 ` Eduardo Habkost
2017-07-14 9:40 ` [Qemu-devel] [PATCHv9 3/3] fw_cfg: move QOM type defines and fw_cfg types into fw_cfg.h Mark Cave-Ayland
2017-07-14 18:09 ` Eduardo Habkost
2017-07-14 18:28 ` Laszlo Ersek
2017-07-14 18:56 ` Eduardo Habkost [this message]
2017-07-16 19:12 ` Mark Cave-Ayland
2017-07-17 11:03 ` Igor Mammedov
2017-07-17 17:43 ` Eduardo Habkost
2017-07-17 17:24 ` Eduardo Habkost
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=20170714185616.GQ6020@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).