fwcfg: QOM'ify some more

Use type constant if possible and avoid DO_UPCAST().

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Renamed parent field]
Signed-off-by: Andreas Färber <afaerber@suse.de>
scsi/esp: QOM'ify some more

Introduce type constant and avoid DO_UPCAST().

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Renamed parent field]
Signed-off-by: Andreas Färber <afaerber@suse.de>
hpet: QOM'ify some more

Introduce type constant, avoid FROM_SYSBUS().

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Renamed parent field and renamed variable]
Signed-off-by: Andreas Färber <afaerber@suse.de>
kvm/clock: QOM'ify some more

Introduce type constant and avoid FROM_SYSBUS().

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Renamed parent field]
Signed-off-by: Andreas Färber <afaerber@suse.de>
fdc: Use QOM realize for fdc

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Renamed SysBusDevice variable]
Signed-off-by: Andreas Färber <afaerber@suse.de>
fdc: Improve error propagation for QOM realize

Rename fdctrl_init_common() to fdctrl_realize_common() and let
fdctrl_connect_drives() propagate an Error through it.

Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
pflash_cfi01: Use QOM realize for pflash_cfi01

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Renamed argument]
Signed-off-by: Andreas Färber <afaerber@suse.de>
pflash_cfi02: Use QOM realize for pflash_cfi02

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
ahci: Use QOM realize for ahci

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Avoided repeated SYS_BUS_DEVICE() casts]
Signed-off-by: Andreas Färber <afaerber@suse.de>
fw_cfg: Use QOM realize for fw_cfg

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Moved sysbus_init_mmio() to instance_init, renamed variable]
Signed-off-by: Andreas Färber <afaerber@suse.de>
scsi/esp: Use QOM realize for scsi esp

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Drop sysbus_esp_init()]
Signed-off-by: Andreas Färber <afaerber@suse.de>
megasas: Legacy command line handling fix

Only apply legacy command line handling when the device has not been
hot-plugged. Propagate failure of legacy command line handling.

Cc: qemu-stable@nongnu.org
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
scsi: Improve error propagation for scsi_bus_legacy_handle_cmdline()

Let scsi_bus_legacy_add_drive() and scsi_bus_legacy_handle_cmdline()
return an Error**. Prepare qdev initfns for QOM realize error model.

Signed-off-by: Andreas Färber <afaerber@suse.de>
hpet: Use QOM realize for hpet

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Avoided SYS_BUS_DEVICE() in loop]
Signed-off-by: Andreas Färber <afaerber@suse.de>
kvm/clock: Use QOM realize for kvmclock

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
kvmvapic: Use QOM realize

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Renamed variable]
Signed-off-by: Andreas Färber <afaerber@suse.de>
ioapic: Use QOM realize for ioapic

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Tweaked error message]
Signed-off-by: Andreas Färber <afaerber@suse.de>
isa-bus: Drop isabus_bridge_init() since it does nothing

This works since commit 4ce5dae88ecf2bafa0cd663de7e923728b1b3672.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Edited]
Signed-off-by: Andreas Färber <afaerber@suse.de>
gdbstub: Change GDBState::query_cpu to CPUState

Since first_cpu/next_cpu are CPUState, CPUArchState is no longer needed.

This resolves a NULL pointer dereference of query_cpu, introduced
with commit 182735efaf956ccab50b6d74a4fed163e0f35660 and reported by
TeLeMan and Max Filippov.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Introduce vaddr type

vaddr is to target_ulong what uintmax_t is to unsigned int.

Its purpose is to allow turning per-target functions with target_ulong
arguments into CPUClass hooks.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>