diff options
Diffstat (limited to 'hw')
46 files changed, 406 insertions, 222 deletions
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 84a55e4..e82d61d 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -83,11 +83,7 @@ static void clipper_init(MachineState *machine) pci_vga_init(pci_bus); /* Serial code setup. */ - for (i = 0; i < MAX_SERIAL_PORTS; ++i) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); /* Network setup. e1000 is good enough, failing Tulip support. */ for (i = 0; i < nb_nics; i++) { diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 97dafca..c55fab8 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -158,7 +158,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } @@ -168,7 +168,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, "reset-cbar", &error_abort); object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index f67570a..a92cdc3 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -248,7 +248,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } @@ -259,7 +259,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ); diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 8c48b68..949ae1e 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -500,14 +500,14 @@ static void integratorcp_init(MachineState *machine) if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 50cb93d..ef2788d 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -108,7 +108,7 @@ static void realview_init(MachineState *machine, if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } @@ -116,14 +116,14 @@ static void realview_init(MachineState *machine, if (is_pb && is_mpcore) { object_property_set_int(cpuobj, periphbase, "reset-cbar", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index b1dae77..624fdb0 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -213,14 +213,14 @@ static void versatile_init(MachineState *machine, int board_id) if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 84415c8..5933454 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -223,7 +223,7 @@ static void init_cpus(const char *cpu_model, const char *privdev, } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 06e6e24..5c37521 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -133,25 +133,25 @@ static void zynq_init(MachineState *machine) if (object_property_find(OBJECT(cpu), "has_el3", NULL)) { object_property_set_bool(OBJECT(cpu), false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_int(OBJECT(cpu), ZYNQ_BOARD_MIDR, "midr", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } object_property_set_bool(OBJECT(cpu), true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 1a8a176..cb71772 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -858,8 +858,7 @@ static void virtio_blk_migration_state_changed(Notifier *notifier, void *data) virtio_blk_data_plane_create(VIRTIO_DEVICE(s), &s->conf, &s->dataplane, &err); if (err != NULL) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); } } } diff --git a/hw/char/parallel.c b/hw/char/parallel.c index c2b553f..4079554 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -641,3 +641,28 @@ static void parallel_register_types(void) } type_init(parallel_register_types) + +static void parallel_init(ISABus *bus, int index, CharDriverState *chr) +{ + DeviceState *dev; + ISADevice *isadev; + + isadev = isa_create(bus, "isa-parallel"); + dev = DEVICE(isadev); + qdev_prop_set_uint32(dev, "index", index); + qdev_prop_set_chr(dev, "chardev", chr); + qdev_init_nofail(dev); +} + +void parallel_hds_isa_init(ISABus *bus, int n) +{ + int i; + + assert(n <= MAX_PARALLEL_PORTS); + + for (i = 0; i < n; i++) { + if (parallel_hds[i]) { + parallel_init(bus, i, parallel_hds[i]); + } + } +} diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index c9fcb27..f3db024 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -119,20 +119,27 @@ static void serial_register_types(void) type_init(serial_register_types) -bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr) +static void serial_isa_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; - isadev = isa_try_create(bus, TYPE_ISA_SERIAL); - if (!isadev) { - return false; - } + isadev = isa_create(bus, TYPE_ISA_SERIAL); dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); - if (qdev_init(dev) < 0) { - return false; + qdev_init_nofail(dev); +} + +void serial_hds_isa_init(ISABus *bus, int n) +{ + int i; + + assert(n <= MAX_SERIAL_PORTS); + + for (i = 0; i < n; ++i) { + if (serial_hds[i]) { + serial_isa_init(bus, i, serial_hds[i]); + } } - return true; } diff --git a/hw/char/serial.c b/hw/char/serial.c index 0491897..55011cf 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -906,8 +906,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, s->chr = chr; serial_realize_core(s, &err); if (err != NULL) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); exit(1); } @@ -970,8 +969,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space, serial_realize_core(s, &err); if (err != NULL) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); exit(1); } vmstate_register(NULL, base, &vmstate_serial, s); diff --git a/hw/core/loader.c b/hw/core/loader.c index fcd4705..e45dc0b 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -1062,7 +1062,7 @@ void *rom_ptr(hwaddr addr) return rom->data + (addr - rom->addr); } -void do_info_roms(Monitor *mon, const QDict *qdict) +void hmp_info_roms(Monitor *mon, const QDict *qdict) { Rom *rom; diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 44c6b93..a02a4cb 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -373,10 +373,15 @@ void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev, way is somewhat unclean, and best avoided. */ void qdev_init_nofail(DeviceState *dev) { - const char *typename = object_get_typename(OBJECT(dev)); + Error *err = NULL; + + assert(!dev->realized); - if (qdev_init(dev) < 0) { - error_report("Initialization of device %s failed", typename); + object_property_set_bool(OBJECT(dev), true, "realized", &err); + if (err) { + error_report("Initialization of device %s failed: %s", + object_get_typename(OBJECT(dev)), + error_get_pretty(err)); exit(1); } } @@ -995,7 +1000,12 @@ void qdev_alias_all_properties(DeviceState *target, Object *source) static int qdev_add_hotpluggable_device(Object *obj, void *opaque) { GSList **list = opaque; - DeviceState *dev = DEVICE(obj); + DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj), + TYPE_DEVICE); + + if (dev == NULL) { + return 0; + } if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) { *list = g_slist_append(*list, dev); diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index bb206da..bd92c69 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -552,9 +552,8 @@ static void get_real_device(AssignedDevice *pci_dev, Error **errp) snprintf(name, sizeof(name), "%sconfig", dir); if (pci_dev->configfd_name && *pci_dev->configfd_name) { - dev->config_fd = monitor_handle_fd_param2(cur_mon, - pci_dev->configfd_name, - &local_err); + dev->config_fd = monitor_fd_param(cur_mon, pci_dev->configfd_name, + &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -953,8 +952,7 @@ static void assigned_dev_update_irq_routing(PCIDevice *dev) r = assign_intx(assigned_dev, &err); if (r < 0) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); err = NULL; qdev_unplug(&dev->qdev, &err); assert(!err); @@ -1010,8 +1008,7 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev) assign_intx(assigned_dev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } } } @@ -1158,8 +1155,7 @@ static void assigned_dev_update_msix(PCIDevice *pci_dev) assign_intx(assigned_dev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } } } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 2519297..d2e07ca 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -43,6 +43,7 @@ #include "hw/pci/msi.h" #include "hw/sysbus.h" #include "sysemu/sysemu.h" +#include "sysemu/numa.h" #include "sysemu/kvm.h" #include "kvm_i386.h" #include "hw/xen/xen.h" @@ -416,7 +417,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, set_boot_dev(s, boot_device, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } @@ -1075,8 +1076,7 @@ void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge) cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i), icc_bridge, &error); if (error) { - error_report("%s", error_get_pretty(error)); - error_free(error); + error_report_err(error); exit(1); } } @@ -1454,17 +1454,8 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, pcspk_init(isa_bus, pit); } - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } - - for(i = 0; i < MAX_PARALLEL_PORTS; i++) { - if (parallel_hds[i]) { - parallel_init(isa_bus, i, parallel_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); + parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); i8042 = isa_create_simple(isa_bus, "i8042"); diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c index 12d2137..f2e9ab6 100644 --- a/hw/i386/smbios.c +++ b/hw/i386/smbios.c @@ -908,7 +908,7 @@ void smbios_entry_add(QemuOpts *opts) qemu_opts_validate(opts, qemu_smbios_file_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } @@ -994,7 +994,7 @@ void smbios_entry_add(QemuOpts *opts) case 0: qemu_opts_validate(opts, qemu_smbios_type0_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type0.vendor, opts, "vendor"); @@ -1014,7 +1014,7 @@ void smbios_entry_add(QemuOpts *opts) case 1: qemu_opts_validate(opts, qemu_smbios_type1_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type1.manufacturer, opts, "manufacturer"); @@ -1036,7 +1036,7 @@ void smbios_entry_add(QemuOpts *opts) case 2: qemu_opts_validate(opts, qemu_smbios_type2_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type2.manufacturer, opts, "manufacturer"); @@ -1049,7 +1049,7 @@ void smbios_entry_add(QemuOpts *opts) case 3: qemu_opts_validate(opts, qemu_smbios_type3_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type3.manufacturer, opts, "manufacturer"); @@ -1061,7 +1061,7 @@ void smbios_entry_add(QemuOpts *opts) case 4: qemu_opts_validate(opts, qemu_smbios_type4_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type4.sock_pfx, opts, "sock_pfx"); @@ -1074,7 +1074,7 @@ void smbios_entry_add(QemuOpts *opts) case 17: qemu_opts_validate(opts, qemu_smbios_type17_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type17.loc_pfx, opts, "loc_pfx"); diff --git a/hw/ide/isa.c b/hw/ide/isa.c index b084162..c0c4e1b 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -88,9 +88,7 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, qdev_prop_set_uint32(dev, "iobase", iobase); qdev_prop_set_uint32(dev, "iobase2", iobase2); qdev_prop_set_uint32(dev, "irq", isairq); - if (qdev_init(dev) < 0) { - return NULL; - } + qdev_init_nofail(dev); s = ISA_IDE(dev); if (hd0) { diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1ebb58d..b4103fa 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -172,8 +172,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) if (kind != IDE_CD) { blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255, &err); if (err) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); return -1; } } diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index c51901b..0f5c025 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -429,7 +429,7 @@ static void pic_realize(DeviceState *dev, Error **errp) pc->parent_realize(dev, errp); } -void pic_info(Monitor *mon, const QDict *qdict) +void hmp_info_pic(Monitor *mon, const QDict *qdict) { int i; PICCommonState *s; @@ -447,7 +447,7 @@ void pic_info(Monitor *mon, const QDict *qdict) } } -void irq_info(Monitor *mon, const QDict *qdict) +void hmp_info_irq(Monitor *mon, const QDict *qdict) { #ifndef DEBUG_IRQ_COUNT monitor_printf(mon, "irq statistic code not compiled.\n"); diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c index 72fc9ef..641ee47 100644 --- a/hw/intc/lm32_pic.c +++ b/hw/intc/lm32_pic.c @@ -43,7 +43,7 @@ struct LM32PicState { typedef struct LM32PicState LM32PicState; static LM32PicState *pic; -void lm32_do_pic_info(Monitor *mon, const QDict *qdict) +void lm32_hmp_info_pic(Monitor *mon, const QDict *qdict) { if (pic == NULL) { return; @@ -53,7 +53,7 @@ void lm32_do_pic_info(Monitor *mon, const QDict *qdict) pic->im, pic->ip, pic->irq_state); } -void lm32_irq_info(Monitor *mon, const QDict *qdict) +void lm32_hmp_info_irq(Monitor *mon, const QDict *qdict) { int i; uint32_t count; diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 18cdc54..f27a087 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -22,6 +22,7 @@ #include "qemu/config-file.h" #include "qapi/visitor.h" #include "qemu/range.h" +#include "sysemu/numa.h" typedef struct pc_dimms_capacity { uint64_t size; diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 6a9ebfa..ea73585 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -277,7 +277,6 @@ static void mips_fulong2e_init(MachineState *machine) PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; - int i; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; @@ -384,15 +383,8 @@ static void mips_fulong2e_init(MachineState *machine) rtc_init(isa_bus, 2000, NULL); - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } - - if (parallel_hds[0]) { - parallel_init(isa_bus, 0, parallel_hds[0]); - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); + parallel_hds_isa_init(isa_bus, 1); /* Sound card */ audio_init(pci_bus); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 5845158..533b2e6 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1172,10 +1172,9 @@ void mips_malta_init(MachineState *machine) isa_create_simple(isa_bus, "i8042"); rtc_init(isa_bus, 2000, NULL); - serial_isa_init(isa_bus, 0, serial_hds[0]); - serial_isa_init(isa_bus, 1, serial_hds[1]); - if (parallel_hds[0]) - parallel_init(isa_bus, 0, parallel_hds[0]); + serial_hds_isa_init(isa_bus, 2); + parallel_hds_isa_init(isa_bus, 1); + for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 3e90e27..52564be 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -284,11 +284,7 @@ void mips_r4k_init(MachineState *machine) pit = pit_init(isa_bus, 0x40, 0, NULL); - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); isa_vga_init(isa_bus); diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index 2fbbc6c..c57365f 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -443,10 +443,7 @@ DeviceState *etsec_create(hwaddr base, dev = qdev_create(NULL, "eTSEC"); qdev_set_nic_properties(dev, nd); - - if (qdev_init(dev)) { - return NULL; - } + qdev_init_nofail(dev); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, tx_irq); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, rx_irq); diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c index 0c09c72..beea6d2 100644 --- a/hw/pci/pci-hotplug-old.c +++ b/hw/pci/pci-hotplug-old.c @@ -132,8 +132,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, dinfo->unit, false, -1, NULL, &local_err); if (!scsidev) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); return -1; } dinfo->unit = scsidev->id; @@ -267,7 +266,7 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, return dev; } -void pci_device_hot_add(Monitor *mon, const QDict *qdict) +void hmp_pci_add(Monitor *mon, const QDict *qdict) { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); @@ -337,7 +336,7 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr) return 0; } -void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict) +void hmp_pci_del(Monitor *mon, const QDict *qdict) { pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr")); } diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index 1dda89b..5e564c3 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -34,7 +34,7 @@ static void pci_error_message(Monitor *mon) monitor_printf(mon, "PCI devices not supported\n"); } -int do_pcie_aer_inject_error(Monitor *mon, +int hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict, QObject **ret_data) { pci_error_message(mon); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d508930..31b222d 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2038,8 +2038,7 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, ret = pci_add_capability2(pdev, cap_id, offset, size, &local_err); if (local_err) { assert(ret < 0); - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } else { /* success implies a positive offset in config space */ assert(ret > 0); diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index 1f4be16..5a25c32 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -962,7 +962,7 @@ static int pcie_aer_parse_error_string(const char *error_name, return -EINVAL; } -int do_pcie_aer_inject_error(Monitor *mon, +int hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict, QObject **ret_data) { const char *id = qdict_get_str(qdict, "id"); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a82a0f9..23cde20 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -25,6 +25,7 @@ * */ #include "sysemu/sysemu.h" +#include "sysemu/numa.h" #include "hw/hw.h" #include "hw/fw-path-provider.h" #include "elf.h" diff --git a/hw/s390x/css.c b/hw/s390x/css.c index d0c5dde..9a13b00 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -584,7 +584,7 @@ static void copy_schib_from_guest(SCHIB *dest, const SCHIB *src) } } -int css_do_msch(SubchDev *sch, SCHIB *orig_schib) +int css_do_msch(SubchDev *sch, const SCHIB *orig_schib) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; @@ -801,7 +801,8 @@ out: return ret; } -static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw) +static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw, + int *irb_len) { int i; uint16_t stctl = src->scsw.ctrl & SCSW_CTRL_MASK_STCTL; @@ -815,6 +816,8 @@ static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw) for (i = 0; i < ARRAY_SIZE(dest->ecw); i++) { dest->ecw[i] = cpu_to_be32(src->ecw[i]); } + *irb_len = sizeof(*dest) - sizeof(dest->emw); + /* extended measurements enabled? */ if ((src->scsw.flags & SCSW_FLAGS_MASK_ESWF) || !(pmcw->flags & PMCW_FLAGS_MASK_TF) || @@ -832,26 +835,21 @@ static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw) dest->emw[i] = cpu_to_be32(src->emw[i]); } } + *irb_len = sizeof(*dest); } -int css_do_tsch(SubchDev *sch, IRB *target_irb) +int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; uint16_t stctl; - uint16_t fctl; - uint16_t actl; IRB irb; - int ret; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { - ret = 3; - goto out; + return 3; } stctl = s->ctrl & SCSW_CTRL_MASK_STCTL; - fctl = s->ctrl & SCSW_CTRL_MASK_FCTL; - actl = s->ctrl & SCSW_CTRL_MASK_ACTL; /* Prepare the irb for the guest. */ memset(&irb, 0, sizeof(IRB)); @@ -876,7 +874,22 @@ int css_do_tsch(SubchDev *sch, IRB *target_irb) } } /* Store the irb to the guest. */ - copy_irb_to_guest(target_irb, &irb, p); + copy_irb_to_guest(target_irb, &irb, p, irb_len); + + return ((stctl & SCSW_STCTL_STATUS_PEND) == 0); +} + +void css_do_tsch_update_subch(SubchDev *sch) +{ + SCSW *s = &sch->curr_status.scsw; + PMCW *p = &sch->curr_status.pmcw; + uint16_t stctl; + uint16_t fctl; + uint16_t actl; + + stctl = s->ctrl & SCSW_CTRL_MASK_STCTL; + fctl = s->ctrl & SCSW_CTRL_MASK_FCTL; + actl = s->ctrl & SCSW_CTRL_MASK_ACTL; /* Clear conditions on subchannel, if applicable. */ if (stctl & SCSW_STCTL_STATUS_PEND) { @@ -913,11 +926,6 @@ int css_do_tsch(SubchDev *sch, IRB *target_irb) memset(sch->sense_data, 0 , sizeof(sch->sense_data)); } } - - ret = ((stctl & SCSW_STCTL_STATUS_PEND) == 0); - -out: - return ret; } static void copy_crw_to_guest(CRW *dest, const CRW *src) @@ -947,6 +955,26 @@ int css_do_stcrw(CRW *crw) return ret; } +static void copy_crw_from_guest(CRW *dest, const CRW *src) +{ + dest->flags = be16_to_cpu(src->flags); + dest->rsid = be16_to_cpu(src->rsid); +} + +void css_undo_stcrw(CRW *crw) +{ + CrwContainer *crw_cont; + + crw_cont = g_try_malloc0(sizeof(CrwContainer)); + if (!crw_cont) { + channel_subsys->crws_lost = true; + return; + } + copy_crw_from_guest(&crw_cont->crw, crw); + + QTAILQ_INSERT_HEAD(&channel_subsys->pending_crws, crw_cont, sibling); +} + int css_do_tpi(IOIntCode *int_code, int lowcore) { /* No pending interrupts for !KVM. */ diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 4ba8409..b57adbd 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -18,6 +18,7 @@ #include "hw/sysbus.h" #include "hw/s390x/virtio-ccw.h" #include "hw/s390x/css.h" +#include "ipl.h" #define KERN_IMAGE_START 0x010000UL #define KERN_PARM_AREA 0x010480UL @@ -50,14 +51,49 @@ typedef struct S390IPLState { /*< private >*/ SysBusDevice parent_obj; uint64_t start_addr; + uint64_t bios_start_addr; + bool enforce_bios; + IplParameterBlock iplb; + bool iplb_valid; + bool reipl_requested; /*< public >*/ char *kernel; char *initrd; char *cmdline; char *firmware; + uint8_t cssid; + uint8_t ssid; + uint16_t devno; } S390IPLState; +static const VMStateDescription vmstate_iplb = { + .name = "ipl/iplb", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT8_ARRAY(reserved1, IplParameterBlock, 110), + VMSTATE_UINT16(devno, IplParameterBlock), + VMSTATE_UINT8_ARRAY(reserved2, IplParameterBlock, 88), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_ipl = { + .name = "ipl", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT64(start_addr, S390IPLState), + VMSTATE_UINT64(bios_start_addr, S390IPLState), + VMSTATE_STRUCT(iplb, S390IPLState, 0, vmstate_iplb, IplParameterBlock), + VMSTATE_BOOL(iplb_valid, S390IPLState), + VMSTATE_UINT8(cssid, S390IPLState), + VMSTATE_UINT8(ssid, S390IPLState), + VMSTATE_UINT16(devno, S390IPLState), + VMSTATE_END_OF_LIST() + } +}; static int s390_ipl_init(SysBusDevice *dev) { @@ -65,11 +101,14 @@ static int s390_ipl_init(SysBusDevice *dev) uint64_t pentry = KERN_IMAGE_START; int kernel_size; - if (!ipl->kernel) { - int bios_size; - char *bios_filename; + int bios_size; + char *bios_filename; - /* Load zipl bootloader */ + /* + * Always load the bios if it was enforced, + * even if an external kernel has been defined. + */ + if (!ipl->kernel || ipl->enforce_bios) { if (bios_name == NULL) { bios_name = ipl->firmware; } @@ -79,12 +118,12 @@ static int s390_ipl_init(SysBusDevice *dev) hw_error("could not find stage1 bootloader\n"); } - bios_size = load_elf(bios_filename, NULL, NULL, &ipl->start_addr, NULL, - NULL, 1, ELF_MACHINE, 0); + bios_size = load_elf(bios_filename, NULL, NULL, &ipl->bios_start_addr, + NULL, NULL, 1, ELF_MACHINE, 0); if (bios_size < 0) { bios_size = load_image_targphys(bios_filename, ZIPL_IMAGE_START, 4096); - ipl->start_addr = ZIPL_IMAGE_START; + ipl->bios_start_addr = ZIPL_IMAGE_START; if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } @@ -94,52 +133,59 @@ static int s390_ipl_init(SysBusDevice *dev) if (bios_size == -1) { hw_error("could not load bootloader '%s'\n", bios_name); } - return 0; - } - kernel_size = load_elf(ipl->kernel, NULL, NULL, &pentry, NULL, - NULL, 1, ELF_MACHINE, 0); - if (kernel_size < 0) { - kernel_size = load_image_targphys(ipl->kernel, 0, ram_size); - } - if (kernel_size < 0) { - fprintf(stderr, "could not load kernel '%s'\n", ipl->kernel); - return -1; + /* default boot target is the bios */ + ipl->start_addr = ipl->bios_start_addr; } - /* - * Is it a Linux kernel (starting at 0x10000)? If yes, we fill in the - * kernel parameters here as well. Note: For old kernels (up to 3.2) - * we can not rely on the ELF entry point - it was 0x800 (the SALIPL - * loader) and it won't work. For this case we force it to 0x10000, too. - */ - if (pentry == KERN_IMAGE_START || pentry == 0x800) { - ipl->start_addr = KERN_IMAGE_START; - /* Overwrite parameters in the kernel image, which are "rom" */ - strcpy(rom_ptr(KERN_PARM_AREA), ipl->cmdline); - } else { - ipl->start_addr = pentry; - } - - if (ipl->initrd) { - ram_addr_t initrd_offset; - int initrd_size; - initrd_offset = INITRD_START; - while (kernel_size + 0x100000 > initrd_offset) { - initrd_offset += 0x100000; + if (ipl->kernel) { + kernel_size = load_elf(ipl->kernel, NULL, NULL, &pentry, NULL, + NULL, 1, ELF_MACHINE, 0); + if (kernel_size < 0) { + kernel_size = load_image_targphys(ipl->kernel, 0, ram_size); + } + if (kernel_size < 0) { + fprintf(stderr, "could not load kernel '%s'\n", ipl->kernel); + return -1; } - initrd_size = load_image_targphys(ipl->initrd, initrd_offset, - ram_size - initrd_offset); - if (initrd_size == -1) { - fprintf(stderr, "qemu: could not load initrd '%s'\n", ipl->initrd); - exit(1); + /* + * Is it a Linux kernel (starting at 0x10000)? If yes, we fill in the + * kernel parameters here as well. Note: For old kernels (up to 3.2) + * we can not rely on the ELF entry point - it was 0x800 (the SALIPL + * loader) and it won't work. For this case we force it to 0x10000, too. + */ + if (pentry == KERN_IMAGE_START || pentry == 0x800) { + ipl->start_addr = KERN_IMAGE_START; + /* Overwrite parameters in the kernel image, which are "rom" */ + strcpy(rom_ptr(KERN_PARM_AREA), ipl->cmdline); + } else { + ipl->start_addr = pentry; } - /* we have to overwrite values in the kernel image, which are "rom" */ - stq_p(rom_ptr(INITRD_PARM_START), initrd_offset); - stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size); - } + if (ipl->initrd) { + ram_addr_t initrd_offset; + int initrd_size; + + initrd_offset = INITRD_START; + while (kernel_size + 0x100000 > initrd_offset) { + initrd_offset += 0x100000; + } + initrd_size = load_image_targphys(ipl->initrd, initrd_offset, + ram_size - initrd_offset); + if (initrd_size == -1) { + fprintf(stderr, "qemu: could not load initrd '%s'\n", + ipl->initrd); + exit(1); + } + /* + * we have to overwrite values in the kernel image, + * which are "rom" + */ + stq_p(rom_ptr(INITRD_PARM_START), initrd_offset); + stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size); + } + } return 0; } @@ -148,9 +194,82 @@ static Property s390_ipl_properties[] = { DEFINE_PROP_STRING("initrd", S390IPLState, initrd), DEFINE_PROP_STRING("cmdline", S390IPLState, cmdline), DEFINE_PROP_STRING("firmware", S390IPLState, firmware), + DEFINE_PROP_BOOL("enforce_bios", S390IPLState, enforce_bios, false), DEFINE_PROP_END_OF_LIST(), }; +/* + * In addition to updating the iplstate, this function returns: + * - 0 if system was ipled with external kernel + * - -1 if no valid boot device was found + * - ccw id of the boot device otherwise + */ +static uint64_t s390_update_iplstate(CPUS390XState *env, S390IPLState *ipl) +{ + DeviceState *dev_st; + + if (ipl->iplb_valid) { + ipl->cssid = 0; + ipl->ssid = 0; + ipl->devno = ipl->iplb.devno; + goto out; + } + + if (ipl->kernel) { + return 0; + } + + dev_st = get_boot_device(0); + if (dev_st) { + VirtioCcwDevice *ccw_dev = (VirtioCcwDevice *) object_dynamic_cast( + OBJECT(qdev_get_parent_bus(dev_st)->parent), + TYPE_VIRTIO_CCW_DEVICE); + if (ccw_dev) { + ipl->cssid = ccw_dev->sch->cssid; + ipl->ssid = ccw_dev->sch->ssid; + ipl->devno = ccw_dev->sch->devno; + goto out; + } + } + + return -1; +out: + return ipl->cssid << 24 | ipl->ssid << 16 | ipl->devno; +} + +int s390_ipl_update_diag308(IplParameterBlock *iplb) +{ + S390IPLState *ipl; + + ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); + if (ipl) { + ipl->iplb = *iplb; + ipl->iplb_valid = true; + return 0; + } + return -1; +} + +IplParameterBlock *s390_ipl_get_iplb(void) +{ + S390IPLState *ipl; + + ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); + if (!ipl || !ipl->iplb_valid) { + return NULL; + } + return &ipl->iplb; +} + +void s390_reipl_request(void) +{ + S390IPLState *ipl; + + ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); + ipl->reipl_requested = true; + qemu_system_reset_request(); +} + static void s390_ipl_reset(DeviceState *dev) { S390IPLState *ipl = S390_IPL(dev); @@ -160,21 +279,14 @@ static void s390_ipl_reset(DeviceState *dev) env->psw.addr = ipl->start_addr; env->psw.mask = IPL_PSW_MASK; - if (!ipl->kernel) { - /* Tell firmware, if there is a preferred boot device */ - env->regs[7] = -1; - DeviceState *dev_st = get_boot_device(0); - if (dev_st) { - VirtioCcwDevice *ccw_dev = (VirtioCcwDevice *) object_dynamic_cast( - OBJECT(qdev_get_parent_bus(dev_st)->parent), - TYPE_VIRTIO_CCW_DEVICE); + if (!ipl->reipl_requested) { + ipl->iplb_valid = false; + } + ipl->reipl_requested = false; - if (ccw_dev) { - env->regs[7] = ccw_dev->sch->cssid << 24 | - ccw_dev->sch->ssid << 16 | - ccw_dev->sch->devno; - } - } + if (!ipl->kernel || ipl->iplb_valid) { + env->psw.addr = ipl->bios_start_addr; + env->regs[7] = s390_update_iplstate(env, ipl); } s390_cpu_set_state(CPU_STATE_OPERATING, cpu); @@ -188,6 +300,7 @@ static void s390_ipl_class_init(ObjectClass *klass, void *data) k->init = s390_ipl_init; dc->props = s390_ipl_properties; dc->reset = s390_ipl_reset; + dc->vmsd = &vmstate_ipl; } static const TypeInfo s390_ipl_info = { diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h new file mode 100644 index 0000000..70497bc --- /dev/null +++ b/hw/s390x/ipl.h @@ -0,0 +1,25 @@ +/* + * s390 IPL device + * + * Copyright 2015 IBM Corp. + * Author(s): Zhang Fan <bjfanzh@cn.ibm.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#ifndef HW_S390_IPL_H +#define HW_S390_IPL_H + +typedef struct IplParameterBlock { + uint8_t reserved1[110]; + uint16_t devno; + uint8_t reserved2[88]; +} IplParameterBlock; + +int s390_ipl_update_diag308(IplParameterBlock *iplb); +IplParameterBlock *s390_ipl_get_iplb(void); +void s390_reipl_request(void); + +#endif diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 9e5bc5b..08d8aa6 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -155,7 +155,9 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - cpu_physical_memory_read(env->regs[r2], buffer, sizeof(*reqh)); + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, sizeof(*reqh))) { + return 0; + } reqh = (ClpReqHdr *)buffer; req_len = lduw_p(&reqh->len); if (req_len < 16 || req_len > 8184 || (req_len % 8 != 0)) { @@ -163,7 +165,10 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - cpu_physical_memory_read(env->regs[r2], buffer, req_len + sizeof(*resh)); + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, + req_len + sizeof(*resh))) { + return 0; + } resh = (ClpRspHdr *)(buffer + req_len); res_len = lduw_p(&resh->len); if (res_len < 8 || res_len > 8176 || (res_len % 8 != 0)) { @@ -175,7 +180,10 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - cpu_physical_memory_read(env->regs[r2], buffer, req_len + res_len); + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, + req_len + res_len)) { + return 0; + } if (req_len != 32) { stw_p(&resh->rsp, CLP_RC_LEN); @@ -269,7 +277,10 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) } out: - cpu_physical_memory_write(env->regs[r2], buffer, req_len + res_len); + if (s390_cpu_virt_mem_write(cpu, env->regs[r2], buffer, + req_len + res_len)) { + return 0; + } setcc(cpu, cc); return 0; } @@ -539,10 +550,10 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr) S390PCIBusDevice *pbdev; MemoryRegion *mr; int i; - uint64_t val; uint32_t fh; uint8_t pcias; uint8_t len; + uint8_t buffer[128]; if (env->psw.mask & PSW_MASK_PSTATE) { program_interrupt(env, PGM_PRIVILEGED, 6); @@ -590,9 +601,12 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr) return 0; } + if (s390_cpu_virt_mem_read(cpu, gaddr, buffer, len)) { + return 0; + } + for (i = 0; i < len / 8; i++) { - val = ldq_phys(&address_space_memory, gaddr + i * 8); - io_mem_write(mr, env->regs[r3] + i * 8, val, 8); + io_mem_write(mr, env->regs[r3] + i * 8, ldq_p(buffer + i * 8), 8); } setcc(cpu, ZPCI_PCI_LS_OK); @@ -709,7 +723,9 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) return 0; } - cpu_physical_memory_read(fiba, (uint8_t *)&fib, sizeof(fib)); + if (s390_cpu_virt_mem_read(cpu, fiba, (uint8_t *)&fib, sizeof(fib))) { + return 0; + } switch (oc) { case ZPCI_MOD_FC_REG_INT: @@ -809,7 +825,10 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) fib.fc |= 0x10; } - cpu_physical_memory_write(fiba, (uint8_t *)&fib, sizeof(fib)); + if (s390_cpu_virt_mem_write(cpu, fiba, (uint8_t *)&fib, sizeof(fib))) { + return 0; + } + setcc(cpu, cc); return 0; } diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 71bafe0..8f0ae59 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -126,7 +126,7 @@ static void ccw_init(MachineState *machine) css_bus = virtual_css_bus_init(); s390_sclp_init(); s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline, - machine->initrd_filename, "s390-ccw.img"); + machine->initrd_filename, "s390-ccw.img", true); s390_flic_init(); dev = qdev_create(NULL, TYPE_S390_PCI_HOST_BRIDGE); diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index c215cd8..412e49b 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -128,7 +128,8 @@ static void s390_virtio_register_hcalls(void) void s390_init_ipl_dev(const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, - const char *firmware) + const char *firmware, + bool enforce_bios) { DeviceState *dev; @@ -141,6 +142,9 @@ void s390_init_ipl_dev(const char *kernel_filename, } qdev_prop_set_string(dev, "cmdline", kernel_cmdline); qdev_prop_set_string(dev, "firmware", firmware); + qdev_prop_set_bit(dev, "enforce_bios", enforce_bios); + object_property_add_child(qdev_get_machine(), "s390-ipl", + OBJECT(dev), NULL); qdev_init_nofail(dev); } @@ -221,7 +225,7 @@ static void s390_init(MachineState *machine) s390_bus = s390_virtio_bus_init(&my_ram_size); s390_sclp_init(); s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline, - machine->initrd_filename, ZIPL_FILENAME); + machine->initrd_filename, ZIPL_FILENAME, false); s390_flic_init(); /* register hypercalls */ diff --git a/hw/s390x/s390-virtio.h b/hw/s390x/s390-virtio.h index 33847ae..75b67ed 100644 --- a/hw/s390x/s390-virtio.h +++ b/hw/s390x/s390-virtio.h @@ -26,7 +26,8 @@ void s390_init_cpus(const char *cpu_model, uint8_t *storage_keys); void s390_init_ipl_dev(const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, - const char *firmware); + const char *firmware, + bool enforce_bios); void s390_create_virtio_net(BusState *bus, const char *name); void s390_nmi(NMIState *n, int cpu_index, Error **errp); #endif diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index e30ff84..618b0af 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -215,9 +215,11 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) } if (vs->conf.vhostfd) { - vhostfd = monitor_handle_fd_param(cur_mon, vs->conf.vhostfd); + vhostfd = monitor_fd_param(cur_mon, vs->conf.vhostfd, &err); if (vhostfd == -1) { - error_setg(errp, "vhost-scsi: unable to parse vhostfd"); + error_setg(errp, "vhost-scsi: unable to parse vhostfd: %s", + error_get_pretty(err)); + error_free(err); return; } } else { diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index ecd9dc1..09afccf 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -176,13 +176,13 @@ static void nvram_init(M48t59State *nvram, uint8_t *macaddr, static DeviceState *slavio_intctl; -void sun4m_pic_info(Monitor *mon, const QDict *qdict) +void sun4m_hmp_info_pic(Monitor *mon, const QDict *qdict) { if (slavio_intctl) slavio_pic_info(mon, slavio_intctl); } -void sun4m_irq_info(Monitor *mon, const QDict *qdict) +void sun4m_hmp_info_irq(Monitor *mon, const QDict *qdict) { if (slavio_intctl) slavio_irq_info(mon, slavio_intctl); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 4620cc6..b310588 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -850,17 +850,9 @@ static void sun4uv_init(MemoryRegion *address_space_mem, NULL, 115200, serial_hds[i], DEVICE_BIG_ENDIAN); i++; } - for(; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } - for(i = 0; i < MAX_PARALLEL_PORTS; i++) { - if (parallel_hds[i]) { - parallel_init(isa_bus, i, parallel_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); + parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); for(i = 0; i < nb_nics; i++) pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); diff --git a/hw/usb/bus.c b/hw/usb/bus.c index d83a938..91fc3e2 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -637,7 +637,7 @@ static char *usb_get_fw_dev_path(DeviceState *qdev) return fw_path; } -void usb_info(Monitor *mon, const QDict *qdict) +void hmp_info_usb(Monitor *mon, const QDict *qdict) { USBBus *bus; USBDevice *dev; diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 7131abd..b27b1f4 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1399,8 +1399,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline) idx = net_client_init(opts, 0, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); return NULL; } diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index cff4f7c..10f4735 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -878,8 +878,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev) usb_device_attach(udev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); goto fail; } @@ -1637,7 +1636,7 @@ static void usb_host_auto_check(void *unused) timer_mod(usb_auto_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 2000); } -void usb_host_info(Monitor *mon, const QDict *qdict) +void hmp_info_usbhost(Monitor *mon, const QDict *qdict) { libusb_device **devs = NULL; struct libusb_device_descriptor ddesc; diff --git a/hw/usb/host-stub.c b/hw/usb/host-stub.c index 28d8032..2eaaa83 100644 --- a/hw/usb/host-stub.c +++ b/hw/usb/host-stub.c @@ -35,7 +35,7 @@ #include "hw/usb.h" #include "monitor/monitor.h" -void usb_host_info(Monitor *mon, const QDict *qdict) +void hmp_info_usbhost(Monitor *mon, const QDict *qdict) { monitor_printf(mon, "USB host devices not supported\n"); } diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 962d3f5..2416de8 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1273,8 +1273,7 @@ static void usbredir_do_attach(void *opaque) usb_device_attach(&dev->dev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); WARNING("rejecting device due to speed mismatch\n"); usbredir_reject_device(dev); } |