qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: qemu-devel@nongnu.org
Cc: edgar.iglesias@xilinx.com, pbonzini@redhat.com, afaerber@suse.de,
	peter.maydell@linaro.org
Subject: [Qemu-devel] [RFC v1 00/25]  Memory and GPIO QOMification
Date: Thu, 15 May 2014 18:49:58 -0700	[thread overview]
Message-ID: <cover.1400204799.git.peter.crosthwaite@xilinx.com> (raw)


Hi All,

This series is my Memory and GPIO qomification as promised. This was
discussed at length on the KVM call 2014-05-13.

This is the preview RFC designed to show the capability of the full
solution. There are many parts to this that stand in their own right and
the merge would be done in smaller chunks (E.G. Memory and GPIO works
can go separately).

Theres some Microblaze stuff at the back of the series, leading to an
example of sysbus hotplug.

Some patches are already on list. I put those at the front of the
series.

Only build tested for microblaze. There's some periphery build issues
for fully configured builds that i'll figure should we get some
conceptual level acceptance of this whole idea.

configure --target-list=microblaze-softmmu

to play with it.

Contents:

QOMify Memory regions. So they are added as child objects to devices.
Devices can do this explicitly in instance_init, or sysbus can handle
it - sysbus_init_mmio parents the memory region to the device to
transparently convert all existing devs to compliance.

This prepares support for the Memory heirachy work. Machines can
create memory regions matching the bus architectures. Masters and
slaves can gen hand these to devices as proper Links.

The address and container (the memory region containing this one as a
subregion) of memory regions are QOM properties, of type integer and
link resp. Setting the properties does the
memory_region_add_subregion().

The root Memory Region is parented the machine in exec.c. This give
the Memory Region a canonical path.

Sysbus IRQ are abandoned completely and re-implemented as named GPIOs.
The sysbus irq API remains and makes this transition
behind-the-scenes.

GPIOs are QOMified. qemu_allocate_irqs does the object_new() etc. IRQ
inputs are then added as child objects of the instantiating device.
Handled by qemu_init_gpio_in_named(). gpio_outs are setup as links.
qdev_connect_gpio_out does the linkage.

QOM is patched to allow setting of a device's child's properties from
a ref to the parent. Best illustrated by example (see below).

Anyways without a single patch to the command line interface, HMP,
QMP, or implementing any machine specific hotplug or adding any new
special busses, this works:

-device xlnx.xps-timer,\
sysbus-mr-0/container=/machine/sysmem,\
sysbus-mr-0/addr=0x83c00000,\
sysbus-irq-0=/machine/intc/unnamed-gpio-0

All the other ways to create devices should just work, this is not a
command line specific feature.

Note, I edited my machine model to sanitize the canonical path of the
interrupt controller.

--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
@@ -97,6 +97,8 @@ petalogix_s3adsp1800_init(QEMUMachineInitArgs *args)
                           1, 0x89, 0x18, 0x0000, 0x0, 1);

     dev = qdev_create(NULL, "xlnx.xps-intc");
+    object_property_add_child(qdev_get_machine(), "intc", OBJECT(dev),
+                              &error_abort);

But you could have done the whole /machine/unattached/... ugliness
too. If you name the irq inputs in the intc with my named GPIO series
stuff the unnamed-gpio ugliness goes away too. If you throw away
sysbus and do the memory-regions and IRQs naming the child objects
properly the ugly sysbus names can de dispensed with too. But thats a
big tree-wide to name everything properly.


Andreas Färber (1):
  irq: Slim conversion of qemu_irq to QOM [WIP]

Peter Crosthwaite (24):
  qdev: Implement named GPIOs
  memory: Simplify mr_add_subregion() if-else
  memory: Coreify subregion add functionality
  memory: MemoryRegion: QOMify
  memory: MemoryRegion: Add contained flag
  memory: MemoryRegion: Add container and addr props
  memory: MemoryRegion: factor out memory region re-adder
  memory: MemoryRegion: Add may-overlap and priority props
  memory: MemoryRegion: Add size property
  exec: Parent root MRs to the machine
  qdev: gpio: Don't allow name share between I and O
  qdev: gpio: Register GPIO inputs as child objects
  qdev: gpio: Register GPIO outputs as QOM links
  qdev: gpio: Re-impement qdev_connect_gpio QOM style
  qom: object_property_set/get: Add child recursion
  sysbus: Use TYPE_DEVICE GPIO functionality
  sysbus: Rework sysbus_mmio_map to use mr QOMification
  sysbus: Setup memory regions as dynamic props
  sysbus: Enable hotplug.
  microblaze: s3adsp: Expand UART creator
  microblaze: s3adsp: Parent devices with sane names
  timer: xilinx_timer: Convert to realize()
  timer: xilinx_timer: init MMIO ASAP
  TEST: microblaze: s3adsp: Remove timer

 exec.c                                   |   4 +
 hw/core/irq.c                            |  44 +++++-
 hw/core/qdev.c                           | 107 +++++++++++--
 hw/core/sysbus.c                         |  85 ++++------
 hw/microblaze/petalogix_s3adsp1800_mmu.c |  16 +-
 hw/timer/xilinx_timer.c                  |  26 ++--
 include/exec/memory.h                    |   9 +-
 include/hw/irq.h                         |   2 +
 include/hw/qdev-core.h                   |  24 ++-
 include/hw/sysbus.h                      |  12 +-
 memory.c                                 | 258 +++++++++++++++++++++++++------
 qdev-monitor.c                           |  16 +-
 qom/object.c                             |  27 +++-
 qtest.c                                  |  19 ++-
 14 files changed, 500 insertions(+), 149 deletions(-)

-- 
1.9.3.1.ga73a6ad

             reply	other threads:[~2014-05-16  1:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16  1:49 Peter Crosthwaite [this message]
2014-05-16  1:50 ` [Qemu-devel] [RFC v1 01/25] qdev: Implement named GPIOs Peter Crosthwaite
2014-05-16  1:51 ` [Qemu-devel] [RFC v1 02/25] memory: Simplify mr_add_subregion() if-else Peter Crosthwaite
2014-05-16  1:51 ` [Qemu-devel] [RFC v1 03/25] memory: Coreify subregion add functionality Peter Crosthwaite
2014-05-16  1:52 ` [Qemu-devel] [RFC v1 04/25] memory: MemoryRegion: QOMify Peter Crosthwaite
2014-05-16  1:52 ` [Qemu-devel] [RFC v1 05/25] memory: MemoryRegion: Add contained flag Peter Crosthwaite
2014-05-16  1:53 ` [Qemu-devel] [RFC v1 06/25] memory: MemoryRegion: Add container and addr props Peter Crosthwaite
2014-05-16  1:53 ` [Qemu-devel] [RFC v1 07/25] memory: MemoryRegion: factor out memory region re-adder Peter Crosthwaite
2014-05-16  1:54 ` [Qemu-devel] [RFC v1 08/25] memory: MemoryRegion: Add may-overlap and priority props Peter Crosthwaite
2014-05-26  1:44   ` Peter Crosthwaite
2014-05-16  1:55 ` [Qemu-devel] [RFC v1 09/25] memory: MemoryRegion: Add size property Peter Crosthwaite
2014-05-16  1:55 ` [Qemu-devel] [RFC v1 10/25] exec: Parent root MRs to the machine Peter Crosthwaite
2014-05-16  1:56 ` [Qemu-devel] [RFC v1 11/25] irq: Slim conversion of qemu_irq to QOM [WIP] Peter Crosthwaite
2014-05-19  1:52   ` Peter Crosthwaite
2014-05-19  9:13     ` Andreas Färber
2014-05-19 10:22       ` Peter Crosthwaite
2014-05-16  1:56 ` [Qemu-devel] [RFC v1 12/25] qdev: gpio: Don't allow name share between I and O Peter Crosthwaite
2014-05-16  1:57 ` [Qemu-devel] [RFC v1 13/25] qdev: gpio: Register GPIO inputs as child objects Peter Crosthwaite
2014-05-16  1:57 ` [Qemu-devel] [RFC v1 14/25] qdev: gpio: Register GPIO outputs as QOM links Peter Crosthwaite
2014-05-16  1:58 ` [Qemu-devel] [RFC v1 15/25] qdev: gpio: Re-impement qdev_connect_gpio QOM style Peter Crosthwaite
2014-05-16  1:59 ` [Qemu-devel] [RFC v1 16/25] qom: object_property_set/get: Add child recursion Peter Crosthwaite
2014-05-16  1:59 ` [Qemu-devel] [RFC v1 17/25] sysbus: Use TYPE_DEVICE GPIO functionality Peter Crosthwaite
2014-05-19  1:59   ` Peter Crosthwaite
2014-05-16  2:00 ` [Qemu-devel] [RFC v1 18/25] sysbus: Rework sysbus_mmio_map to use mr QOMification Peter Crosthwaite
2014-05-16  2:00 ` [Qemu-devel] [RFC v1 19/25] sysbus: Setup memory regions as dynamic props Peter Crosthwaite
2014-05-16  2:01 ` [Qemu-devel] [RFC v1 20/25] sysbus: Enable hotplug Peter Crosthwaite
2014-05-16  2:01 ` [Qemu-devel] [RFC v1 21/25] microblaze: s3adsp: Expand UART creator Peter Crosthwaite
2014-05-16  2:02 ` [Qemu-devel] [RFC v1 22/25] microblaze: s3adsp: Parent devices with sane names Peter Crosthwaite
2014-05-16  2:03 ` [Qemu-devel] [RFC v1 23/25] timer: xilinx_timer: Convert to realize() Peter Crosthwaite
2014-05-16  2:03 ` [Qemu-devel] [RFC v1 24/25] timer: xilinx_timer: init MMIO ASAP Peter Crosthwaite
2014-05-16  2:04 ` [Qemu-devel] [RFC v1 25/25] TEST: microblaze: s3adsp: Remove timer Peter Crosthwaite

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=cover.1400204799.git.peter.crosthwaite@xilinx.com \
    --to=peter.crosthwaite@xilinx.com \
    --cc=afaerber@suse.de \
    --cc=edgar.iglesias@xilinx.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).