Platforms without ISA and/or PCI have had a seriously hard time in the dynamic
device creation world of QEMU. Devices on these were modeled as SysBus devices
which can only be instantiated in machine files, not through -device.

Why is that so?

For Sysbus devices we didn't know who should be responsible for mapping them
when the machine file didn't do it. Turns out, the machine file is the perfect
place to map them even when it doesn't create them :).

This patch set enables machine files to declare sysbus device creation via the
-device command line option as possible. With this we can (in the machine file)
map sysbus devices to whatever the machine thinks is fitting.

Some times users do want to specify manually where to map a device. This is
very useful when you want to have stable offsets in memory and irq space.
This patch set adds support for "user mapping hints" that the machine can use
to map a device at a certain location.

As example this patch set only enables the eTSEC device on the e500plat machine
type. This device was not possible to get added to the machine at all.

  $ qemu-system-ppc -nographic -M ppce500 -device eTSEC,netdev=nd \
                    -netdev user,id=nd

The idea can easily be extended to any sysbus device on any machine type though.


This patch set is based on previous ideas and discussions, most notably:

  https://lists.gnu.org/archive/html/qemu-devel/2013-07/msg03614.html
  https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00849.html



v1 -> v2:

  - new patch: qom: Move property helpers to own file
  - reworked patch: qom: Expose property helpers for get/set of integers
  - new patch: qom: Add generic object property g_free helper
  - new patch: PPC: Fix default config ordering and add eTSEC for ppc64
  - Rename DECLARE_INTEGER_VISITOR to DECLARE_PROP_SET_GET
  - Make macro take name and type arguments, enabling generation of "bool"
    types later
  - make irq and pio properties uint64
  - ensure qom exposed pointers don't change due to realloc
  - fix sysbus_pass_irq
  - make properties write-once, not write-before-realize
  - make props only available via qom, no state pointers left
  - use bool in MachineClass rather than property
  - access sysbus properties via qom
  - move platform bus definitions to params
  - move platform bus to 36bit address space
  - make naming more consistent
  - remove device_type from platform bus dt node
  - remove id field in dt generation
  - fix device name (base on reg for value after @)
  - use qom properties to fetch mmio and irq props
  - remove useless interrupt-parent
  - make interrupts level triggered

Alexander Graf (9):
  qom: Move property helpers to own file
  qom: macroify integer property helpers
  qom: Expose property helpers for get/set of integers
  qom: Add generic object property g_free helper
  sysbus: Add user map hints
  sysbus: Make devices spawnable via -device
  PPC: e500: Support dynamically spawned sysbus devices
  e500: Add support for eTSEC in device tree
  PPC: Fix default config ordering and add eTSEC for ppc64

 backends/hostmem-file.c           |   1 +
 backends/hostmem.c                |   1 +
 backends/rng-egd.c                |   1 +
 backends/rng-random.c             |   1 +
 backends/rng.c                    |   1 +
 backends/tpm.c                    |   1 +
 default-configs/ppc-softmmu.mak   |   4 +-
 default-configs/ppc64-softmmu.mak |   3 +-
 hw/acpi/ich9.c                    |   1 +
 hw/acpi/pcihp.c                   |   1 +
 hw/acpi/piix4.c                   |   1 +
 hw/core/machine.c                 |  44 ++++++
 hw/core/qdev.c                    |   1 +
 hw/core/sysbus.c                  |  50 +++++--
 hw/i386/acpi-build.c              |   1 +
 hw/isa/lpc_ich9.c                 |   1 +
 hw/ppc/e500.c                     | 288 ++++++++++++++++++++++++++++++++++++++
 hw/ppc/e500.h                     |   5 +
 hw/ppc/e500plat.c                 |   6 +
 hw/ppc/spapr.c                    |   1 +
 include/hw/boards.h               |   8 +-
 include/hw/sysbus.h               |   1 +
 include/qom/object.h              |  85 -----------
 include/qom/property.h            | 244 ++++++++++++++++++++++++++++++++
 memory.c                          |   1 +
 qom/Makefile.objs                 |   2 +-
 qom/object.c                      | 206 +--------------------------
 qom/property.c                    | 179 +++++++++++++++++++++++
 target-i386/cpu.c                 |   1 +
 ui/console.c                      |   1 +
 vl.c                              |   1 +
 31 files changed, 842 insertions(+), 300 deletions(-)
 create mode 100644 include/qom/property.h
 create mode 100644 qom/property.c

-- 
1.8.1.4


Reply via email to