Skip to content

cpu/core: Fix "help" of CPU core device types

Greg Kurz qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2qdev: Separate implementations of qdev_get_machine() for user and systemhw/core/machine.c hw/core/qdev.c include/hw/qdev-core.h +2 more+28 -114 replies
2/2cpu/core: Fix "help" of CPU core device typeshw/cpu/core.c+8 -22 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchThomas Huth
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] cpu/core: Fix "help" of CPU core device types

Thomas Huth recently reported an annoying crash:

$ ./qemu-system-ppc64 -device power8_v2.0-spapr-cpu-core,help
/home/thuth/devel/qemu/include/hw/boards.h:24:
 MACHINE: Object 0x5635bd53af10 is not an instance of type machine
Aborted (core dumped)

This is caused by an early use of qdev_get_machine(), before the machine creation, which triggers a side-effect of creating a dummy "container" object instead of the machine. This is needed by user mode emulation, which doesn't really care about the type of the parent of the CPU model. This is toxic for system mode though because the system mode specific code usually assume MACHINE(qdev_get_machine()).

This series brings separate implementations between user and system mode. The breakage with "cpu-code,help" is fixed by using current_machine.

Greg Kurz (2):
qdev: Separate implementations of qdev_get_machine() for user and
system
cpu/core: Fix "help" of CPU core device types

 hw/core/machine.c        | 14 ++++++++++++++
 hw/core/qdev.c           |  2 +-
 hw/cpu/core.c            | 10 ++++++++--
 include/hw/qdev-core.h   |  1 +
 stubs/meson.build        |  1 +
 stubs/qdev-get-machine.c | 11 +++++++++++
 6 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 stubs/qdev-get-machine.c
Signature · 1 line
2.26.3