Skip to content

Platform device support

Alexander Graf qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5Platform: Add platform device classhw/Makefile.objs hw/platform/Makefile.objs hw/platform/device.c +1 more+155 -01 reply
2/5Platform: Add serial devicehw/char/Makefile.objs hw/char/serial-platform.c include/hw/char/serial-platform.h+160 -00 replies
3/5PPC: e500: Only create dt entries for existing serial portshw/ppc/e500.c+9 -40 replies
4/5PPC: e500: Support platform devicesdefault-configs/ppc-softmmu.mak default-configs/ppc64-softmmu.mak hw/ppc/e500.c +2 more+225 -07 replies
5/5PPC: e500: Add support for platform serial devicesdefault-configs/ppc-softmmu.mak default-configs/ppc64-softmmu.mak hw/ppc/e500.c+28 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/5] Platform device support

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?

Well, SysBus is trying to be incredibly generic. It allows you to plug any interrupt sender into any other interrupt receiver. It allows you to map a device's memory regions into any other random memory region. All of that only works from C code or via really complicated command line arguments under discussion upstream right now.

But do we need that level of complexity for normal devices usually? In a normal platform world (SoCs, PV machines) we have a flat memory layout we can plug our device memory into. We also have a flat IRQ model where we can plug our device IRQs into.

So the idea for platform devices arose. A platform device is really just a device that exposes its qemu_irq slots and memory regions to the world.

That allows us to write machine specific code that maps a platform device wherever the machine thinks fits nicely. It also allows that same machine to generate a device tree entry for platform devices easily, as it is fully aware of the interrupt lines and places it was mapped to.

A device (read: user) may or may not explictly request to be mapped at a specific IRQ and/or memory address. If no explicit mapping is requested, platform devices can get mapped at convenient places by the machine.

The actual pressing issue this solves is that today it's impossible to spawn serial ports from the command line. With this patch set, it's possible to do so. But it lays the groundwork for much more...

Alexander Graf (5):
Platform: Add platform device class
Platform: Add serial device
PPC: e500: Only create dt entries for existing serial ports
PPC: e500: Support platform devices
PPC: e500: Add support for platform serial devices

 default-configs/ppc-softmmu.mak   |   2 +
 default-configs/ppc64-softmmu.mak |   2 +
 hw/Makefile.objs                  |   1 +
 hw/char/Makefile.objs             |   1 +
 hw/char/serial-platform.c         | 103 +++++++++++++++
 hw/platform/Makefile.objs         |   1 +
 hw/platform/device.c              | 108 ++++++++++++++++
 hw/ppc/e500.c                     | 262 +++++++++++++++++++++++++++++++++++++-
 hw/ppc/e500.h                     |   1 +
 hw/ppc/e500plat.c                 |   1 +
 include/hw/char/serial-platform.h |  56 ++++++++
 include/hw/platform/device.h      |  45 +++++++
 12 files changed, 577 insertions(+), 6 deletions(-)
 create mode 100644 hw/char/serial-platform.c
 create mode 100644 hw/platform/Makefile.objs
 create mode 100644 hw/platform/device.c
 create mode 100644 include/hw/char/serial-platform.h
 create mode 100644 include/hw/platform/device.h
Signature · 1 line
1.8.1.4