diff options
92 files changed, 710 insertions, 514 deletions
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 51799943f1..4b55361010 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -43,7 +43,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) return; } if (!fb->mem_path) { - error_setg(errp, "mem_path property not set"); + error_setg(errp, "mem-path property not set"); return; } #ifndef CONFIG_LINUX @@ -5193,8 +5193,6 @@ case "$target_name" in TARGET_BASE_ARCH=mips echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak ;; - tricore) - ;; moxie) ;; or32) @@ -5245,6 +5243,8 @@ case "$target_name" in s390x) gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml" ;; + tricore) + ;; unicore32) ;; xtensa|xtensaeb) @@ -1016,7 +1016,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) qemu_cond_signal(&qemu_cpu_cond); /* wait for initial kick-off after machine start */ - while (QTAILQ_FIRST(&cpus)->stopped) { + while (first_cpu->stopped) { qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); /* process any pending work */ diff --git a/default-configs/microblazeel-softmmu.mak b/default-configs/microblazeel-softmmu.mak index acf22c5bb3..2fcf442fc7 100644 --- a/default-configs/microblazeel-softmmu.mak +++ b/default-configs/microblazeel-softmmu.mak @@ -1,11 +1,3 @@ # Default configuration for microblazeel-softmmu -CONFIG_PTIMER=y -CONFIG_PFLASH_CFI01=y -CONFIG_SERIAL=y -CONFIG_XILINX=y -CONFIG_XILINX_AXI=y -CONFIG_XILINX_SPI=y -CONFIG_XILINX_ETHLITE=y -CONFIG_SSI=y -CONFIG_SSI_M25P80=y +include microblaze-softmmu.mak diff --git a/dma-helpers.c b/dma-helpers.c index 19901a80ec..4faec5d0ca 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -10,7 +10,6 @@ #include "sysemu/block-backend.h" #include "sysemu/dma.h" #include "trace.h" -#include "qemu/range.h" #include "qemu/thread.h" #include "qemu/main-loop.h" diff --git a/docs/atomics.txt b/docs/atomics.txt index 6f2997bc65..ef285e3c2a 100644 --- a/docs/atomics.txt +++ b/docs/atomics.txt @@ -281,7 +281,7 @@ note that the other barrier may actually be in a driver that runs in the guest! For the purposes of pairing, smp_read_barrier_depends() and smp_rmb() -both count as read barriers. A read barriers shall pair with a write +both count as read barriers. A read barrier shall pair with a write barrier or a full barrier; a write barrier shall pair with a read barrier or a full barrier. A full barrier can pair with anything. For example: @@ -294,7 +294,7 @@ For example: smp_rmb(); y = a; -Note that the "writing" thread are accessing the variables in the +Note that the "writing" thread is accessing the variables in the opposite order as the "reading" thread. This is expected: stores before the write barrier will normally match the loads after the read barrier, and vice versa. The same is true for more than 2 @@ -109,7 +109,6 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str); void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str); void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str); void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str); -void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str); void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str); void migrate_set_capability_completion(ReadLineState *rs, int nb_args, diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 77e1126f8f..1e11af906d 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -31,7 +31,6 @@ #include "hw/pci/pci.h" #include "hw/acpi/acpi.h" #include "sysemu/sysemu.h" -#include "qemu/range.h" #include "exec/ioport.h" #include "exec/address-spaces.h" #include "hw/pci/pci_bus.h" diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 9546fd2919..e6afe9763d 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -515,7 +515,7 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) type = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); /* VIRTIO_BLK_T_OUT defines the command direction. VIRTIO_BLK_T_BARRIER - * is an optional flag. Altough a guest should not send this flag if + * is an optional flag. Although a guest should not send this flag if * not negotiated we ignored it in the past. So keep ignoring it. */ switch (type & ~(VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_BARRIER)) { case VIRTIO_BLK_T_IN: diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index a9f5e62f24..02ac80b650 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -364,6 +364,7 @@ static void console_class_init(ObjectClass *klass, void *data) ec->can_handle_event = can_handle_event; ec->read_event_data = read_event_data; ec->write_event_data = write_event_data; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo sclp_console_info = { diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 79891dfc58..b014c7f522 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -266,6 +266,7 @@ static void console_class_init(ObjectClass *klass, void *data) ec->can_handle_event = can_handle_event; ec->read_event_data = read_event_data; ec->write_event_data = write_event_data; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo sclp_console_info = { diff --git a/hw/display/qxl.c b/hw/display/qxl.c index b6d65b9487..0cd314c931 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -696,7 +696,7 @@ static inline void qxl_push_free_res(PCIQXLDevice *d, int flush) /* called from spice server thread context only */ static void interface_release_resource(QXLInstance *sin, - struct QXLReleaseInfoExt ext) + QXLReleaseInfoExt ext) { PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); QXLReleaseRing *ring; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2aaf21a3e5..a36135705c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -26,7 +26,6 @@ #include "qemu-common.h" #include "qemu/bitmap.h" #include "qemu/osdep.h" -#include "qemu/range.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" #include "qom/cpu.h" diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 38c59dbe9d..4c44317b65 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -113,15 +113,15 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, const char *kernel_filename; const char *kernel_cmdline; const char *dtb_arg; + char *filename = NULL; machine_opts = qemu_get_machine_opts(); kernel_filename = qemu_opt_get(machine_opts, "kernel"); kernel_cmdline = qemu_opt_get(machine_opts, "append"); dtb_arg = qemu_opt_get(machine_opts, "dtb"); - if (dtb_arg) { /* Preference a -dtb argument */ - dtb_filename = dtb_arg; - } else { /* default to pcbios dtb as passed by machine_init */ - dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); + /* default to pcbios dtb as passed by machine_init */ + if (!dtb_arg) { + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); } boot_info.machine_cpu_reset = machine_cpu_reset; @@ -203,7 +203,8 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, boot_info.initrd_start, boot_info.initrd_end, kernel_cmdline, - dtb_filename); + /* Preference a -dtb argument */ + dtb_arg ? dtb_arg : filename); } - + g_free(filename); } diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 4aae64a9ec..dea941ad88 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -168,6 +168,7 @@ static int64_t load_kernel (CPUMIPSState *env) rom_add_blob_fixed("prom", prom_buf, prom_size, cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR)); + g_free(prom_buf); return kernel_entry; } diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index b0fa71a514..482250d85d 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -861,6 +861,7 @@ static int64_t load_kernel (void) rom_add_blob_fixed("prom", prom_buf, prom_size, cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR)); + g_free(prom_buf); return kernel_entry; } diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 66e2a58e86..f4dcacd862 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -139,6 +139,7 @@ static int64_t load_kernel(void) rom_add_blob_fixed("params", params_buf, params_size, (16 << 20) - 264); + g_free(params_buf); return entry; } diff --git a/hw/misc/edu.c b/hw/misc/edu.c index f601069e82..fe50b42af7 100644 --- a/hw/misc/edu.c +++ b/hw/misc/edu.c @@ -279,7 +279,7 @@ static const MemoryRegionOps edu_mmio_ops = { }; /* - * We purposedly use a thread, so that users are forced to wait for the status + * We purposely use a thread, so that users are forced to wait for the status * register. */ static void *edu_fact_thread(void *opaque) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 59f76bcf76..67ab228e41 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1590,7 +1590,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) n->max_queues = MAX(n->nic_conf.peers.queues, 1); if (n->max_queues * 2 + 1 > VIRTIO_PCI_QUEUE_MAX) { error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " - "must be a postive integer less than %d.", + "must be a positive integer less than %d.", n->max_queues, (VIRTIO_PCI_QUEUE_MAX - 1) / 2); virtio_cleanup(vdev); return; diff --git a/hw/net/vmxnet_rx_pkt.c b/hw/net/vmxnet_rx_pkt.c index a40e346293..acbca6a3db 100644 --- a/hw/net/vmxnet_rx_pkt.c +++ b/hw/net/vmxnet_rx_pkt.c @@ -172,13 +172,6 @@ bool vmxnet_rx_pkt_has_virt_hdr(struct VmxnetRxPkt *pkt) return pkt->has_virt_hdr; } -uint16_t vmxnet_rx_pkt_get_num_frags(struct VmxnetRxPkt *pkt) -{ - assert(pkt); - - return pkt->vec_len; -} - uint16_t vmxnet_rx_pkt_get_vlan_tag(struct VmxnetRxPkt *pkt) { assert(pkt); diff --git a/hw/net/vmxnet_rx_pkt.h b/hw/net/vmxnet_rx_pkt.h index 6b2c60ef10..5f8352a468 100644 --- a/hw/net/vmxnet_rx_pkt.h +++ b/hw/net/vmxnet_rx_pkt.h @@ -114,15 +114,6 @@ bool vmxnet_rx_pkt_is_vlan_stripped(struct VmxnetRxPkt *pkt); bool vmxnet_rx_pkt_has_virt_hdr(struct VmxnetRxPkt *pkt); /** - * returns number of frags attached to the packet - * - * @pkt: packet - * @ret: number of frags - * - */ -uint16_t vmxnet_rx_pkt_get_num_frags(struct VmxnetRxPkt *pkt); - -/** * attach data to rx packet * * @pkt: packet diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c index 14cd7fd405..7e79bc01ef 100644 --- a/hw/pci-bridge/i82801b11.c +++ b/hw/pci-bridge/i82801b11.c @@ -101,27 +101,6 @@ static const TypeInfo i82801b11_bridge_info = { .class_init = i82801b11_bridge_class_init, }; -PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus) -{ - PCIDevice *d; - PCIBridge *br; - char buf[16]; - DeviceState *qdev; - - d = pci_create_multifunction(bus, devfn, true, "i82801b11-bridge"); - if (!d) { - return NULL; - } - br = PCI_BRIDGE(d); - qdev = DEVICE(d); - - snprintf(buf, sizeof(buf), "pci.%d", sec_bus); - pci_bridge_map_irq(br, buf, pci_swizzle_map_irq_fn); - qdev_init_nofail(qdev); - - return pci_bridge_get_sec_bus(br); -} - static void d2pbr_register(void) { type_register_static(&i82801b11_bridge_info); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 61ddc7994d..644689a6ae 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1029,7 +1029,7 @@ static int spapr_post_load(void *opaque, int version_id) sPAPREnvironment *spapr = (sPAPREnvironment *)opaque; int err = 0; - /* In earlier versions, there was no seperate qdev for the PAPR + /* In earlier versions, there was no separate qdev for the PAPR * RTC, so the RTC offset was stored directly in sPAPREnvironment. * So when migrating from those versions, poke the incoming offset * value into the RTC device */ diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 78da718362..1cb116a297 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -362,6 +362,7 @@ static void init_event_facility_class(ObjectClass *klass, void *data) dc->reset = reset_event_facility; dc->vmsd = &vmstate_event_facility; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); k->init = init_event_facility; k->command_handler = command_handler; k->event_pending = event_pending; diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 2e26d2aa2c..132004ae4f 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -315,6 +315,7 @@ static void s390_ipl_class_init(ObjectClass *klass, void *data) dc->props = s390_ipl_properties; dc->reset = s390_ipl_reset; dc->vmsd = &vmstate_ipl; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo s390_ipl_info = { diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 8f7288fadf..f9151a9afb 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -155,7 +155,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, sizeof(*reqh))) { + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, sizeof(*reqh))) { return 0; } reqh = (ClpReqHdr *)buffer; @@ -165,7 +165,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, req_len + sizeof(*resh))) { return 0; } @@ -180,7 +180,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, req_len + res_len)) { return 0; } @@ -277,7 +277,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) } out: - if (s390_cpu_virt_mem_write(cpu, env->regs[r2], buffer, + if (s390_cpu_virt_mem_write(cpu, env->regs[r2], r2, buffer, req_len + res_len)) { return 0; } @@ -546,7 +546,8 @@ out: return 0; } -int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr) +int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, + uint8_t ar) { CPUS390XState *env = &cpu->env; S390PCIBusDevice *pbdev; @@ -603,7 +604,7 @@ 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)) { + if (s390_cpu_virt_mem_read(cpu, gaddr, ar, buffer, len)) { return 0; } @@ -698,7 +699,7 @@ static void dereg_ioat(S390PCIBusDevice *pbdev) pbdev->g_iota = 0; } -int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) +int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar) { CPUS390XState *env = &cpu->env; uint8_t oc; @@ -727,7 +728,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) return 0; } - if (s390_cpu_virt_mem_read(cpu, fiba, (uint8_t *)&fib, sizeof(fib))) { + if (s390_cpu_virt_mem_read(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) { return 0; } @@ -773,7 +774,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) return 0; } -int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) +int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar) { CPUS390XState *env = &cpu->env; uint32_t fh; @@ -829,7 +830,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) fib.fc |= 0x10; } - if (s390_cpu_virt_mem_write(cpu, fiba, (uint8_t *)&fib, sizeof(fib))) { + if (s390_cpu_virt_mem_write(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) { return 0; } diff --git a/hw/s390x/s390-pci-inst.h b/hw/s390x/s390-pci-inst.h index 7e6c804737..70fa71395f 100644 --- a/hw/s390x/s390-pci-inst.h +++ b/hw/s390x/s390-pci-inst.h @@ -281,8 +281,9 @@ int clp_service_call(S390CPU *cpu, uint8_t r2); int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); -int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr); -int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba); -int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba); +int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, + uint8_t ar); +int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar); +int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar); #endif diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 0f93a644a2..c27f8a531b 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -542,6 +542,7 @@ static void s390_virtio_net_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_net_realize; dc->props = s390_virtio_net_properties; + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); } static const TypeInfo s390_virtio_net = { @@ -555,8 +556,10 @@ static const TypeInfo s390_virtio_net = { static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) { VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); k->realize = s390_virtio_blk_realize; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo s390_virtio_blk = { @@ -578,6 +581,7 @@ static void s390_virtio_serial_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_serial_realize; dc->props = s390_virtio_serial_properties; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo s390_virtio_serial = { @@ -600,6 +604,7 @@ static void s390_virtio_rng_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_rng_realize; dc->props = s390_virtio_rng_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo s390_virtio_rng = { @@ -658,6 +663,7 @@ static void s390_virtio_scsi_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_scsi_realize; dc->props = s390_virtio_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo s390_virtio_scsi = { @@ -681,6 +687,7 @@ static void s390_vhost_scsi_class_init(ObjectClass *klass, void *data) k->realize = s390_vhost_scsi_realize; dc->props = s390_vhost_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo s390_vhost_scsi = { @@ -704,8 +711,10 @@ static int s390_virtio_bridge_init(SysBusDevice *dev) static void s390_virtio_bridge_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); k->init = s390_virtio_bridge_init; + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); } static const TypeInfo s390_virtio_bridge_info = { diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index a969975a78..b3a6c5e5a4 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -457,10 +457,19 @@ sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void) TYPE_SCLP_MEMORY_HOTPLUG_DEV, NULL)); } +static void sclp_memory_hotplug_dev_class_init(ObjectClass *klass, + void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + static TypeInfo sclp_memory_hotplug_dev_info = { .name = TYPE_SCLP_MEMORY_HOTPLUG_DEV, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(sclpMemoryHotplugDev), + .class_init = sclp_memory_hotplug_dev_class_init, }; static void register_types(void) diff --git a/hw/s390x/sclpcpu.c b/hw/s390x/sclpcpu.c index 3600fe231d..2fe8b5aa40 100644 --- a/hw/s390x/sclpcpu.c +++ b/hw/s390x/sclpcpu.c @@ -88,12 +88,14 @@ static int irq_cpu_hotplug_init(SCLPEvent *event) static void cpu_class_init(ObjectClass *oc, void *data) { SCLPEventClass *k = SCLP_EVENT_CLASS(oc); + DeviceClass *dc = DEVICE_CLASS(oc); k->init = irq_cpu_hotplug_init; k->get_send_mask = send_mask; k->get_receive_mask = receive_mask; k->read_event_data = read_event_data; k->write_event_data = NULL; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo sclp_cpu_info = { diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c index 1a399bd1f0..ffa5553135 100644 --- a/hw/s390x/sclpquiesce.c +++ b/hw/s390x/sclpquiesce.c @@ -116,6 +116,7 @@ static void quiesce_class_init(ObjectClass *klass, void *data) dc->reset = quiesce_reset; dc->vmsd = &vmstate_sclpquiesce; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); k->init = quiesce_init; k->get_send_mask = send_mask; diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index ed75c638bc..c1d8288b71 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1453,6 +1453,7 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_net_properties; + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); } static const TypeInfo virtio_ccw_net = { @@ -1479,6 +1480,7 @@ static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_blk_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo virtio_ccw_blk = { @@ -1505,6 +1507,7 @@ static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_serial_properties; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo virtio_ccw_serial = { @@ -1531,6 +1534,7 @@ static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_balloon_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo virtio_ccw_balloon = { @@ -1558,6 +1562,7 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo virtio_ccw_scsi = { @@ -1583,6 +1588,7 @@ static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = vhost_ccw_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo vhost_ccw_scsi = { @@ -1620,6 +1626,7 @@ static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_rng_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo virtio_ccw_rng = { @@ -1706,9 +1713,11 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); k->init = virtual_css_bridge_init; hc->unplug = virtio_ccw_busdev_unplug; + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); } static const TypeInfo virtual_css_bridge_info = { diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c index 2a45071e36..73ca906282 100644 --- a/hw/tpm/tpm_passthrough.c +++ b/hw/tpm/tpm_passthrough.c @@ -34,15 +34,13 @@ #include "sysemu/tpm_backend_int.h" #include "tpm_tis.h" -/* #define DEBUG_TPM */ - -#ifdef DEBUG_TPM -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#define DEBUG_TPM 0 + +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_TPM) { \ + fprintf(stderr, fmt, ## __VA_ARGS__); \ + } \ +} while (0); #define TYPE_TPM_PASSTHROUGH "tpm-passthrough" #define TPM_PASSTHROUGH(obj) \ diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 815c8eace1..b8235d5c9f 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -30,15 +30,13 @@ #include "qemu-common.h" #include "qemu/main-loop.h" -/*#define DEBUG_TIS */ +#define DEBUG_TIS 0 -#ifdef DEBUG_TIS -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_TIS) { \ + printf(fmt, ## __VA_ARGS__); \ + } \ +} while (0); /* whether the STS interrupt is supported */ #define RAISE_STS_IRQ @@ -421,7 +419,7 @@ static void tpm_tis_dump_state(void *opaque, hwaddr addr) for (idx = 0; regs[idx] != 0xfff; idx++) { DPRINTF("tpm_tis: 0x%04x : 0x%08x\n", regs[idx], - (uint32_t)tpm_tis_mmio_read(opaque, base + regs[idx], 4)); + (int)tpm_tis_mmio_read(opaque, base + regs[idx], 4)); } DPRINTF("tpm_tis: read offset : %d\n" @@ -555,7 +553,7 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr, val >>= shift; } - DPRINTF("tpm_tis: read.%u(%08x) = %08x\n", size, (int)addr, (uint32_t)val); + DPRINTF("tpm_tis: read.%u(%08x) = %08x\n", size, (int)addr, (int)val); return val; } @@ -578,7 +576,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, uint16_t len; uint32_t mask = (size == 1) ? 0xff : ((size == 2) ? 0xffff : ~0); - DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr, (uint32_t)val); + DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr, (int)val); if (locty == 4 && !hw_access) { DPRINTF("tpm_tis: Access to locality 4 only allowed from hardware\n"); @@ -815,7 +813,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, /* drop the byte */ } else { DPRINTF("tpm_tis: Data to send to TPM: %08x (size=%d)\n", - val, size); + (int)val, size); if (tis->loc[locty].state == TPM_TIS_STATE_READY) { tis->loc[locty].state = TPM_TIS_STATE_RECEPTION; tpm_tis_sts_set(&tis->loc[locty], @@ -844,7 +842,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, (tis->loc[locty].sts & TPM_TIS_STS_EXPECT)) { /* we have a packet length - see if we have all of it */ #ifdef RAISE_STS_IRQ - bool needIrq = !(tis->loc[locty].sts & TPM_TIS_STS_VALID); + bool need_irq = !(tis->loc[locty].sts & TPM_TIS_STS_VALID); #endif len = tpm_tis_get_size_from_buffer(&tis->loc[locty].w_buffer); if (len > tis->loc[locty].w_offset) { @@ -855,7 +853,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, tpm_tis_sts_set(&tis->loc[locty], TPM_TIS_STS_VALID); } #ifdef RAISE_STS_IRQ - if (needIrq) { + if (need_irq) { tpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID); } #endif diff --git a/hw/usb/core.c b/hw/usb/core.c index cf34755bba..d0025db60d 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -331,23 +331,6 @@ void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p) usb_packet_complete(s, p); } -/* XXX: fix overflow */ -int set_usb_string(uint8_t *buf, const char *str) -{ - int len, i; - uint8_t *q; - - q = buf; - len = strlen(str); - *q++ = 2 * len + 2; - *q++ = 3; - for(i = 0; i < len; i++) { - *q++ = str[i]; - *q++ = 0; - } - return q - buf; -} - USBDevice *usb_find_device(USBPort *port, uint8_t addr) { USBDevice *dev = port->dev; @@ -749,12 +732,6 @@ void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type) uep->type = type; } -uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - return uep->ifnum; -} - void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); @@ -782,12 +759,6 @@ void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep, uep->max_packet_size = size * microframes; } -int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - return uep->max_packet_size; -} - void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); @@ -801,18 +772,6 @@ void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw) } } -int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - return uep->max_streams; -} - -void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - uep->pipeline = enabled; -} - void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index aefe0bbaaf..e7ab8293d1 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -128,7 +128,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { - error_report("Failed to read msg header. Read %d instead of %d.\n", r, + error_report("Failed to read msg header. Read %d instead of %d.", r, size); goto fail; } @@ -136,7 +136,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) /* validate received flags */ if (msg->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) { error_report("Failed to read msg header." - " Flags 0x%x instead of 0x%x.\n", msg->flags, + " Flags 0x%x instead of 0x%x.", msg->flags, VHOST_USER_REPLY_MASK | VHOST_USER_VERSION); goto fail; } @@ -144,7 +144,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) /* validate message size is sane */ if (msg->size > VHOST_USER_PAYLOAD_SIZE) { error_report("Failed to read msg header." - " Size %d exceeds the maximum %zu.\n", msg->size, + " Size %d exceeds the maximum %zu.", msg->size, VHOST_USER_PAYLOAD_SIZE); goto fail; } @@ -155,7 +155,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { error_report("Failed to read msg payload." - " Read %d instead of %d.\n", r, msg->size); + " Read %d instead of %d.", r, msg->size); goto fail; } } @@ -235,8 +235,8 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, msg.memory.nregions = fd_num; if (!fd_num) { - error_report("Failed initializing vhost-user memory map\n" - "consider using -object memory-backend-file share=on\n"); + error_report("Failed initializing vhost-user memory map, " + "consider using -object memory-backend-file share=on"); return -1; } @@ -280,7 +280,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, } break; default: - error_report("vhost-user trying to send unhandled ioctl\n"); + error_report("vhost-user trying to send unhandled ioctl"); return -1; break; } @@ -296,27 +296,27 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, if (msg_request != msg.request) { error_report("Received unexpected msg type." - " Expected %d received %d\n", msg_request, msg.request); + " Expected %d received %d", msg_request, msg.request); return -1; } switch (msg_request) { case VHOST_USER_GET_FEATURES: if (msg.size != sizeof(m.u64)) { - error_report("Received bad msg size.\n"); + error_report("Received bad msg size."); return -1; } *((__u64 *) arg) = msg.u64; break; case VHOST_USER_GET_VRING_BASE: if (msg.size != sizeof(m.state)) { - error_report("Received bad msg size.\n"); + error_report("Received bad msg size."); return -1; } memcpy(arg, &msg.state, sizeof(struct vhost_vring_state)); break; default: - error_report("Received unexpected msg type.\n"); + error_report("Received unexpected msg type."); return -1; break; } diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index 59ea25b49a..f4e522cc1f 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -2,7 +2,6 @@ #define HW_ICH9_H #include "hw/hw.h" -#include "qemu/range.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "hw/i386/pc.h" @@ -19,7 +18,6 @@ void ich9_lpc_set_irq(void *opaque, int irq_num, int level); int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx); PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin); void ich9_lpc_pm_init(PCIDevice *pci_lpc); -PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus); I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base); #define ICH9_CC_SIZE (16 * 1024) /* 16KB */ diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index 025d6e69af..96d4cdc713 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -23,7 +23,6 @@ #define HW_Q35_H #include "hw/hw.h" -#include "qemu/range.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "hw/i386/pc.h" diff --git a/include/hw/usb.h b/include/hw/usb.h index 5be29375a2..c8b6e7b571 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -445,15 +445,11 @@ void usb_ep_reset(USBDevice *dev); void usb_ep_dump(USBDevice *dev); struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep); uint8_t usb_ep_get_type(USBDevice *dev, int pid, int ep); -uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep); void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type); void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum); void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep, uint16_t raw); -int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep); void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw); -int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep); -void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled); void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted); USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep, uint64_t id); @@ -469,7 +465,6 @@ void usb_port_reset(USBPort *port); void usb_device_reset(USBDevice *dev); void usb_wakeup(USBEndpoint *ep, unsigned int stream); void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p); -int set_usb_string(uint8_t *buf, const char *str); /* usb-linux.c */ USBDevice *usb_host_device_open(USBBus *bus, const char *devname); diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 1c06bed39d..df67d56ec0 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -47,7 +47,6 @@ typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); void monitor_set_error(Monitor *mon, QError *qerror); void monitor_read_command(Monitor *mon, int show_prompt); -ReadLineState *monitor_get_rs(Monitor *mon); int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, void *opaque); diff --git a/include/qemu-common.h b/include/qemu-common.h index 1b5cffb403..6b373ff7e3 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -217,10 +217,6 @@ void *qemu_oom_check(void *ptr); ssize_t qemu_write_full(int fd, const void *buf, size_t count) QEMU_WARN_UNUSED_RESULT; -ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags) - QEMU_WARN_UNUSED_RESULT; -ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) - QEMU_WARN_UNUSED_RESULT; #ifndef _WIN32 int qemu_pipe(int pipefd[2]); diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 90ca8df4e2..8abdcf9077 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -20,10 +20,10 @@ #define BITS_PER_BYTE CHAR_BIT #define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE) -#define BIT(nr) (1UL << (nr)) -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +#define BIT(nr) (1UL << (nr)) +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) /** * set_bit - Set a bit in memory @@ -32,10 +32,10 @@ */ static inline void set_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); - *p |= mask; + *p |= mask; } /** @@ -45,10 +45,10 @@ static inline void set_bit(long nr, unsigned long *addr) */ static inline void clear_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); - *p &= ~mask; + *p &= ~mask; } /** @@ -58,10 +58,10 @@ static inline void clear_bit(long nr, unsigned long *addr) */ static inline void change_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); - *p ^= mask; + *p ^= mask; } /** @@ -71,12 +71,12 @@ static inline void change_bit(long nr, unsigned long *addr) */ static inline int test_and_set_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); - unsigned long old = *p; + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); + unsigned long old = *p; - *p = old | mask; - return (old & mask) != 0; + *p = old | mask; + return (old & mask) != 0; } /** @@ -86,12 +86,12 @@ static inline int test_and_set_bit(long nr, unsigned long *addr) */ static inline int test_and_clear_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); - unsigned long old = *p; + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); + unsigned long old = *p; - *p = old & ~mask; - return (old & mask) != 0; + *p = old & ~mask; + return (old & mask) != 0; } /** @@ -101,12 +101,12 @@ static inline int test_and_clear_bit(long nr, unsigned long *addr) */ static inline int test_and_change_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); - unsigned long old = *p; + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); + unsigned long old = *p; - *p = old ^ mask; - return (old & mask) != 0; + *p = old ^ mask; + return (old & mask) != 0; } /** @@ -116,7 +116,7 @@ static inline int test_and_change_bit(long nr, unsigned long *addr) */ static inline int test_bit(long nr, const unsigned long *addr) { - return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); + return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); } /** @@ -136,7 +136,8 @@ unsigned long find_last_bit(const unsigned long *addr, * @size: The bitmap size in bits */ unsigned long find_next_bit(const unsigned long *addr, - unsigned long size, unsigned long offset); + unsigned long size, + unsigned long offset); /** * find_next_zero_bit - find the next cleared bit in a memory region diff --git a/include/qemu/compatfd.h b/include/qemu/compatfd.h index 6b04877b97..fc3791520f 100644 --- a/include/qemu/compatfd.h +++ b/include/qemu/compatfd.h @@ -39,6 +39,5 @@ struct qemu_signalfd_siginfo { }; int qemu_signalfd(const sigset_t *mask); -bool qemu_signalfd_available(void); #endif diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h index 799376d414..88ada1d048 100644 --- a/include/standard-headers/linux/virtio_balloon.h +++ b/include/standard-headers/linux/virtio_balloon.h @@ -25,6 +25,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include "standard-headers/linux/types.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_config.h" @@ -51,9 +52,32 @@ struct virtio_balloon_config { #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ #define VIRTIO_BALLOON_S_NR 6 +/* + * Memory statistics structure. + * Driver fills an array of these structures and passes to device. + * + * NOTE: fields are laid out in a way that would make compiler add padding + * between and after fields, so we have to use compiler-specific attributes to + * pack it, to disable this padding. This also often causes compiler to + * generate suboptimal code. + * + * We maintain this statistics structure format for backwards compatibility, + * but don't follow this example. + * + * If implementing a similar structure, do something like the below instead: + * struct virtio_balloon_stat { + * __virtio16 tag; + * uint8_t reserved[6]; + * __virtio64 val; + * }; + * + * In other words, add explicit reserved fields to align field and + * structure boundaries at field size, avoiding compiler padding + * without the packed attribute. + */ struct virtio_balloon_stat { - uint16_t tag; - uint64_t val; + __virtio16 tag; + __virtio64 val; } QEMU_PACKED; #endif /* _LINUX_VIRTIO_BALLOON_H */ diff --git a/include/standard-headers/linux/virtio_ids.h b/include/standard-headers/linux/virtio_ids.h index 284fc3a05f..5f60aa4be5 100644 --- a/include/standard-headers/linux/virtio_ids.h +++ b/include/standard-headers/linux/virtio_ids.h @@ -39,5 +39,6 @@ #define VIRTIO_ID_9P 9 /* 9p virtio console */ #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ #define VIRTIO_ID_CAIF 12 /* Virtio caif */ +#define VIRTIO_ID_INPUT 18 /* virtio input */ #endif /* _LINUX_VIRTIO_IDS_H */ diff --git a/include/standard-headers/linux/virtio_input.h b/include/standard-headers/linux/virtio_input.h new file mode 100644 index 0000000000..a98a7974c2 --- /dev/null +++ b/include/standard-headers/linux/virtio_input.h @@ -0,0 +1,76 @@ +#ifndef _LINUX_VIRTIO_INPUT_H +#define _LINUX_VIRTIO_INPUT_H +/* This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ + +#include "standard-headers/linux/types.h" + +enum virtio_input_config_select { + VIRTIO_INPUT_CFG_UNSET = 0x00, + VIRTIO_INPUT_CFG_ID_NAME = 0x01, + VIRTIO_INPUT_CFG_ID_SERIAL = 0x02, + VIRTIO_INPUT_CFG_ID_DEVIDS = 0x03, + VIRTIO_INPUT_CFG_PROP_BITS = 0x10, + VIRTIO_INPUT_CFG_EV_BITS = 0x11, + VIRTIO_INPUT_CFG_ABS_INFO = 0x12, +}; + +struct virtio_input_absinfo { + uint32_t min; + uint32_t max; + uint32_t fuzz; + uint32_t flat; + uint32_t res; +}; + +struct virtio_input_devids { + uint16_t bustype; + uint16_t vendor; + uint16_t product; + uint16_t version; +}; + +struct virtio_input_config { + uint8_t select; + uint8_t subsel; + uint8_t size; + uint8_t reserved[5]; + union { + char string[128]; + uint8_t bitmap[128]; + struct virtio_input_absinfo abs; + struct virtio_input_devids ids; + } u; +}; + +struct virtio_input_event { + uint16_t type; + uint16_t code; + uint32_t value; +}; + +#endif /* _LINUX_VIRTIO_INPUT_H */ @@ -552,13 +552,13 @@ static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val, bool assign, uint32_t size, bool datamatch) { int ret; - struct kvm_ioeventfd iofd; - - iofd.datamatch = datamatch ? adjust_ioeventfd_endianness(val, size) : 0; - iofd.addr = addr; - iofd.len = size; - iofd.flags = 0; - iofd.fd = fd; + struct kvm_ioeventfd iofd = { + .datamatch = datamatch ? adjust_ioeventfd_endianness(val, size) : 0, + .addr = addr, + .len = size, + .flags = 0, + .fd = fd, + }; if (!kvm_enabled()) { return -ENOSYS; @@ -1544,8 +1544,17 @@ static int kvm_init(MachineState *ms) strerror(-ret)); #ifdef TARGET_S390X - fprintf(stderr, "Please add the 'switch_amode' kernel parameter to " - "your host kernel command line\n"); + if (ret == -EINVAL) { + fprintf(stderr, + "Host kernel setup problem detected. Please verify:\n"); + fprintf(stderr, "- for kernels supporting the switch_amode or" + " user_mode parameters, whether\n"); + fprintf(stderr, + " user space is running in primary address space\n"); + fprintf(stderr, + "- for kernels supporting the vm.allocate_pgste sysctl, " + "whether it is enabled\n"); + } #endif goto err; } diff --git a/libcacard/cac.c b/libcacard/cac.c index f38fdceddd..bc84534f9c 100644 --- a/libcacard/cac.c +++ b/libcacard/cac.c @@ -5,7 +5,10 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" + +#include <string.h> +#include <stdbool.h> #include "cac.h" #include "vcard.h" diff --git a/libcacard/card_7816.c b/libcacard/card_7816.c index 814fa1662f..22fd334d15 100644 --- a/libcacard/card_7816.c +++ b/libcacard/card_7816.c @@ -5,7 +5,9 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" + +#include <string.h> #include "vcard.h" #include "vcard_emul.h" diff --git a/libcacard/event.c b/libcacard/event.c index 4c551e4e38..63f4057fe5 100644 --- a/libcacard/event.c +++ b/libcacard/event.c @@ -5,7 +5,7 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" #include "vcard.h" #include "vreader.h" diff --git a/libcacard/vcard.c b/libcacard/vcard.c index d140a8ed1a..1a87208f3d 100644 --- a/libcacard/vcard.c +++ b/libcacard/vcard.c @@ -5,7 +5,9 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" + +#include <string.h> #include "vcard.h" #include "vcard_emul.h" diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c index 950edee069..d9761eedc2 100644 --- a/libcacard/vcard_emul_nss.c +++ b/libcacard/vcard_emul_nss.c @@ -25,7 +25,7 @@ #include <prthread.h> #include <secerr.h> -#include "qemu-common.h" +#include "glib-compat.h" #include "vcard.h" #include "card_7816t.h" @@ -33,7 +33,7 @@ #include "vreader.h" #include "vevent.h" -#include "libcacard/vcardt_internal.h" +#include "vcardt_internal.h" typedef enum { diff --git a/libcacard/vcardt.c b/libcacard/vcardt.c index 9ce4648f8c..c67de2f3c1 100644 --- a/libcacard/vcardt.c +++ b/libcacard/vcardt.c @@ -2,9 +2,9 @@ #include <string.h> #include <glib.h> -#include "libcacard/vcardt.h" +#include "vcardt.h" -#include "libcacard/vcardt_internal.h" +#include "vcardt_internal.h" /* create an ATR with appropriate historical bytes */ #define ATR_TS_DIRECT_CONVENTION 0x3b diff --git a/libcacard/vreader.c b/libcacard/vreader.c index 0315dd8920..9725f46a74 100644 --- a/libcacard/vreader.c +++ b/libcacard/vreader.c @@ -10,7 +10,9 @@ #endif #define G_LOG_DOMAIN "libcacard" -#include "qemu-common.h" +#include "glib-compat.h" + +#include <string.h> #include "vcard.h" #include "vcard_emul.h" diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index fa6041de99..0652684437 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -10,14 +10,20 @@ * See the COPYING.LIB file in the top-level directory. */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #ifndef _WIN32 #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> +#include <unistd.h> #define closesocket(x) close(x) +#else +#include <getopt.h> #endif -#include "qemu-common.h" +#include "glib-compat.h" #include "vscard_common.h" diff --git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h index 0db25bc328..c98e4dc460 100644 --- a/linux-headers/asm-arm/kvm.h +++ b/linux-headers/asm-arm/kvm.h @@ -195,9 +195,16 @@ struct kvm_arch_memory_slot { #define KVM_ARM_IRQ_CPU_IRQ 0 #define KVM_ARM_IRQ_CPU_FIQ 1 -/* Highest supported SPI, from VGIC_NR_IRQS */ +/* + * This used to hold the highest supported SPI, but it is now obsolete + * and only here to provide source code level compatibility with older + * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS. + */ #define KVM_ARM_IRQ_GIC_MAX 127 +/* One single KVM irqchip, ie. the VGIC */ +#define KVM_NR_IRQCHIPS 1 + /* PSCI interface */ #define KVM_PSCI_FN_BASE 0x95c1ba5e #define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h index 3ef77a4660..c8abf257c1 100644 --- a/linux-headers/asm-arm64/kvm.h +++ b/linux-headers/asm-arm64/kvm.h @@ -188,9 +188,16 @@ struct kvm_arch_memory_slot { #define KVM_ARM_IRQ_CPU_IRQ 0 #define KVM_ARM_IRQ_CPU_FIQ 1 -/* Highest supported SPI, from VGIC_NR_IRQS */ +/* + * This used to hold the highest supported SPI, but it is now obsolete + * and only here to provide source code level compatibility with older + * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS. + */ #define KVM_ARM_IRQ_GIC_MAX 127 +/* One single KVM irqchip, ie. the VGIC */ +#define KVM_NR_IRQCHIPS 1 + /* PSCI interface */ #define KVM_PSCI_FN_BASE 0x95c1ba5e #define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) diff --git a/linux-headers/asm-mips/kvm.h b/linux-headers/asm-mips/kvm.h index 2c04b6d9ff..6985eb59b0 100644 --- a/linux-headers/asm-mips/kvm.h +++ b/linux-headers/asm-mips/kvm.h @@ -36,77 +36,85 @@ struct kvm_regs { /* * for KVM_GET_FPU and KVM_SET_FPU - * - * If Status[FR] is zero (32-bit FPU), the upper 32-bits of the FPRs - * are zero filled. */ struct kvm_fpu { - __u64 fpr[32]; - __u32 fir; - __u32 fccr; - __u32 fexr; - __u32 fenr; - __u32 fcsr; - __u32 pad; }; /* - * For MIPS, we use KVM_SET_ONE_REG and KVM_GET_ONE_REG to access CP0 + * For MIPS, we use KVM_SET_ONE_REG and KVM_GET_ONE_REG to access various * registers. The id field is broken down as follows: * - * bits[2..0] - Register 'sel' index. - * bits[7..3] - Register 'rd' index. - * bits[15..8] - Must be zero. - * bits[31..16] - 1 -> CP0 registers. - * bits[51..32] - Must be zero. * bits[63..52] - As per linux/kvm.h + * bits[51..32] - Must be zero. + * bits[31..16] - Register set. + * + * Register set = 0: GP registers from kvm_regs (see definitions below). + * + * Register set = 1: CP0 registers. + * bits[15..8] - Must be zero. + * bits[7..3] - Register 'rd' index. + * bits[2..0] - Register 'sel' index. + * + * Register set = 2: KVM specific registers (see definitions below). + * + * Register set = 3: FPU / MSA registers (see definitions below). * * Other sets registers may be added in the future. Each set would * have its own identifier in bits[31..16]. - * - * The registers defined in struct kvm_regs are also accessible, the - * id values for these are below. */ -#define KVM_REG_MIPS_R0 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0) -#define KVM_REG_MIPS_R1 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 1) -#define KVM_REG_MIPS_R2 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 2) -#define KVM_REG_MIPS_R3 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 3) -#define KVM_REG_MIPS_R4 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 4) -#define KVM_REG_MIPS_R5 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 5) -#define KVM_REG_MIPS_R6 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 6) -#define KVM_REG_MIPS_R7 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 7) -#define KVM_REG_MIPS_R8 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 8) -#define KVM_REG_MIPS_R9 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 9) -#define KVM_REG_MIPS_R10 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 10) -#define KVM_REG_MIPS_R11 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 11) -#define KVM_REG_MIPS_R12 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 12) -#define KVM_REG_MIPS_R13 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 13) -#define KVM_REG_MIPS_R14 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 14) -#define KVM_REG_MIPS_R15 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 15) -#define KVM_REG_MIPS_R16 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 16) -#define KVM_REG_MIPS_R17 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 17) -#define KVM_REG_MIPS_R18 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 18) -#define KVM_REG_MIPS_R19 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 19) -#define KVM_REG_MIPS_R20 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 20) -#define KVM_REG_MIPS_R21 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 21) -#define KVM_REG_MIPS_R22 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 22) -#define KVM_REG_MIPS_R23 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 23) -#define KVM_REG_MIPS_R24 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 24) -#define KVM_REG_MIPS_R25 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 25) -#define KVM_REG_MIPS_R26 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 26) -#define KVM_REG_MIPS_R27 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 27) -#define KVM_REG_MIPS_R28 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 28) -#define KVM_REG_MIPS_R29 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 29) -#define KVM_REG_MIPS_R30 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 30) -#define KVM_REG_MIPS_R31 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 31) - -#define KVM_REG_MIPS_HI (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 32) -#define KVM_REG_MIPS_LO (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 33) -#define KVM_REG_MIPS_PC (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 34) - -/* KVM specific control registers */ +#define KVM_REG_MIPS_GP (KVM_REG_MIPS | 0x0000000000000000ULL) +#define KVM_REG_MIPS_CP0 (KVM_REG_MIPS | 0x0000000000010000ULL) +#define KVM_REG_MIPS_KVM (KVM_REG_MIPS | 0x0000000000020000ULL) +#define KVM_REG_MIPS_FPU (KVM_REG_MIPS | 0x0000000000030000ULL) + + +/* + * KVM_REG_MIPS_GP - General purpose registers from kvm_regs. + */ + +#define KVM_REG_MIPS_R0 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 0) +#define KVM_REG_MIPS_R1 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 1) +#define KVM_REG_MIPS_R2 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 2) +#define KVM_REG_MIPS_R3 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 3) +#define KVM_REG_MIPS_R4 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 4) +#define KVM_REG_MIPS_R5 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 5) +#define KVM_REG_MIPS_R6 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 6) +#define KVM_REG_MIPS_R7 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 7) +#define KVM_REG_MIPS_R8 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 8) +#define KVM_REG_MIPS_R9 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 9) +#define KVM_REG_MIPS_R10 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 10) +#define KVM_REG_MIPS_R11 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 11) +#define KVM_REG_MIPS_R12 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 12) +#define KVM_REG_MIPS_R13 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 13) +#define KVM_REG_MIPS_R14 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 14) +#define KVM_REG_MIPS_R15 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 15) +#define KVM_REG_MIPS_R16 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 16) +#define KVM_REG_MIPS_R17 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 17) +#define KVM_REG_MIPS_R18 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 18) +#define KVM_REG_MIPS_R19 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 19) +#define KVM_REG_MIPS_R20 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 20) +#define KVM_REG_MIPS_R21 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 21) +#define KVM_REG_MIPS_R22 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 22) +#define KVM_REG_MIPS_R23 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 23) +#define KVM_REG_MIPS_R24 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 24) +#define KVM_REG_MIPS_R25 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 25) +#define KVM_REG_MIPS_R26 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 26) +#define KVM_REG_MIPS_R27 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 27) +#define KVM_REG_MIPS_R28 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 28) +#define KVM_REG_MIPS_R29 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 29) +#define KVM_REG_MIPS_R30 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 30) +#define KVM_REG_MIPS_R31 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 31) + +#define KVM_REG_MIPS_HI (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 32) +#define KVM_REG_MIPS_LO (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 33) +#define KVM_REG_MIPS_PC (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 34) + + +/* + * KVM_REG_MIPS_KVM - KVM specific control registers. + */ /* * CP0_Count control @@ -118,8 +126,7 @@ struct kvm_fpu { * safely without losing time or guest timer interrupts. * Other: Reserved, do not change. */ -#define KVM_REG_MIPS_COUNT_CTL (KVM_REG_MIPS | KVM_REG_SIZE_U64 | \ - 0x20000 | 0) +#define KVM_REG_MIPS_COUNT_CTL (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 0) #define KVM_REG_MIPS_COUNT_CTL_DC 0x00000001 /* @@ -131,15 +138,46 @@ struct kvm_fpu { * emulated. * Modifications to times in the future are rejected. */ -#define KVM_REG_MIPS_COUNT_RESUME (KVM_REG_MIPS | KVM_REG_SIZE_U64 | \ - 0x20000 | 1) +#define KVM_REG_MIPS_COUNT_RESUME (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 1) /* * CP0_Count rate in Hz * Specifies the rate of the CP0_Count timer in Hz. Modifications occur without * discontinuities in CP0_Count. */ -#define KVM_REG_MIPS_COUNT_HZ (KVM_REG_MIPS | KVM_REG_SIZE_U64 | \ - 0x20000 | 2) +#define KVM_REG_MIPS_COUNT_HZ (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 2) + + +/* + * KVM_REG_MIPS_FPU - Floating Point and MIPS SIMD Architecture (MSA) registers. + * + * bits[15..8] - Register subset (see definitions below). + * bits[7..5] - Must be zero. + * bits[4..0] - Register number within register subset. + */ + +#define KVM_REG_MIPS_FPR (KVM_REG_MIPS_FPU | 0x0000000000000000ULL) +#define KVM_REG_MIPS_FCR (KVM_REG_MIPS_FPU | 0x0000000000000100ULL) +#define KVM_REG_MIPS_MSACR (KVM_REG_MIPS_FPU | 0x0000000000000200ULL) + +/* + * KVM_REG_MIPS_FPR - Floating point / Vector registers. + */ +#define KVM_REG_MIPS_FPR_32(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U32 | (n)) +#define KVM_REG_MIPS_FPR_64(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U64 | (n)) +#define KVM_REG_MIPS_VEC_128(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U128 | (n)) + +/* + * KVM_REG_MIPS_FCR - Floating point control registers. + */ +#define KVM_REG_MIPS_FCR_IR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 0) +#define KVM_REG_MIPS_FCR_CSR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 31) + +/* + * KVM_REG_MIPS_MSACR - MIPS SIMD Architecture (MSA) control registers. + */ +#define KVM_REG_MIPS_MSA_IR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 0) +#define KVM_REG_MIPS_MSA_CSR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 1) + /* * KVM MIPS specific structures and definitions diff --git a/linux-headers/asm-s390/kvm.h b/linux-headers/asm-s390/kvm.h index c5a93eb0bc..512d8f1d4f 100644 --- a/linux-headers/asm-s390/kvm.h +++ b/linux-headers/asm-s390/kvm.h @@ -150,6 +150,7 @@ struct kvm_guest_debug_arch { #define KVM_SYNC_CRS (1UL << 3) #define KVM_SYNC_ARCH0 (1UL << 4) #define KVM_SYNC_PFAULT (1UL << 5) +#define KVM_SYNC_VRS (1UL << 6) /* definition of registers in kvm_run */ struct kvm_sync_regs { __u64 prefix; /* prefix register */ @@ -164,6 +165,9 @@ struct kvm_sync_regs { __u64 pft; /* pfault token [PFAULT] */ __u64 pfs; /* pfault select [PFAULT] */ __u64 pfc; /* pfault compare [PFAULT] */ + __u64 vrs[32][2]; /* vector registers */ + __u8 reserved[512]; /* for future vector expansion */ + __u32 fpc; /* only valid with vector registers */ }; #define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1) diff --git a/linux-headers/asm-x86/hyperv.h b/linux-headers/asm-x86/hyperv.h index 90c458e66e..ce6068dbcf 100644 --- a/linux-headers/asm-x86/hyperv.h +++ b/linux-headers/asm-x86/hyperv.h @@ -225,6 +225,8 @@ #define HV_STATUS_INVALID_HYPERCALL_CODE 2 #define HV_STATUS_INVALID_HYPERCALL_INPUT 3 #define HV_STATUS_INVALID_ALIGNMENT 4 +#define HV_STATUS_INSUFFICIENT_MEMORY 11 +#define HV_STATUS_INVALID_CONNECTION_ID 18 #define HV_STATUS_INSUFFICIENT_BUFFERS 19 typedef struct _HV_REFERENCE_TSC_PAGE { diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index 60a54c82a3..b96d9787dd 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -147,6 +147,16 @@ struct kvm_pit_config { #define KVM_PIT_SPEAKER_DUMMY 1 +struct kvm_s390_skeys { + __u64 start_gfn; + __u64 count; + __u64 skeydata_addr; + __u32 flags; + __u32 reserved[9]; +}; +#define KVM_S390_GET_SKEYS_NONE 1 +#define KVM_S390_SKEYS_MAX 1048576 + #define KVM_EXIT_UNKNOWN 0 #define KVM_EXIT_EXCEPTION 1 #define KVM_EXIT_IO 2 @@ -172,6 +182,7 @@ struct kvm_pit_config { #define KVM_EXIT_S390_TSCH 22 #define KVM_EXIT_EPR 23 #define KVM_EXIT_SYSTEM_EVENT 24 +#define KVM_EXIT_S390_STSI 25 /* For KVM_EXIT_INTERNAL_ERROR */ /* Emulate instruction failed. */ @@ -309,6 +320,15 @@ struct kvm_run { __u32 type; __u64 flags; } system_event; + /* KVM_EXIT_S390_STSI */ + struct { + __u64 addr; + __u8 ar; + __u8 reserved; + __u8 fc; + __u8 sel1; + __u16 sel2; + } s390_stsi; /* Fix the size of the union. */ char padding[256]; }; @@ -324,7 +344,7 @@ struct kvm_run { __u64 kvm_dirty_regs; union { struct kvm_sync_regs regs; - char padding[1024]; + char padding[2048]; } s; }; @@ -365,6 +385,24 @@ struct kvm_translation { __u8 pad[5]; }; +/* for KVM_S390_MEM_OP */ +struct kvm_s390_mem_op { + /* in */ + __u64 gaddr; /* the guest address */ + __u64 flags; /* flags */ + __u32 size; /* amount of bytes */ + __u32 op; /* type of operation */ + __u64 buf; /* buffer in userspace */ + __u8 ar; /* the access register number */ + __u8 reserved[31]; /* should be set to 0 */ +}; +/* types for kvm_s390_mem_op->op */ +#define KVM_S390_MEMOP_LOGICAL_READ 0 +#define KVM_S390_MEMOP_LOGICAL_WRITE 1 +/* flags for kvm_s390_mem_op->flags */ +#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0) +#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1) + /* for KVM_INTERRUPT */ struct kvm_interrupt { /* in */ @@ -520,6 +558,13 @@ struct kvm_s390_irq { } u; }; +struct kvm_s390_irq_state { + __u64 buf; + __u32 flags; + __u32 len; + __u32 reserved[4]; +}; + /* for KVM_SET_GUEST_DEBUG */ #define KVM_GUESTDBG_ENABLE 0x00000001 @@ -760,6 +805,15 @@ struct kvm_ppc_smmu_info { #define KVM_CAP_PPC_ENABLE_HCALL 104 #define KVM_CAP_CHECK_EXTENSION_VM 105 #define KVM_CAP_S390_USER_SIGP 106 +#define KVM_CAP_S390_VECTOR_REGISTERS 107 +#define KVM_CAP_S390_MEM_OP 108 +#define KVM_CAP_S390_USER_STSI 109 +#define KVM_CAP_S390_SKEYS 110 +#define KVM_CAP_MIPS_FPU 111 +#define KVM_CAP_MIPS_MSA 112 +#define KVM_CAP_S390_INJECT_IRQ 113 +#define KVM_CAP_S390_IRQ_STATE 114 +#define KVM_CAP_PPC_HWRNG 115 #ifdef KVM_CAP_IRQ_ROUTING @@ -1135,6 +1189,16 @@ struct kvm_s390_ucas_mapping { #define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) #define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init) #define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) +/* Available with KVM_CAP_S390_MEM_OP */ +#define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op) +/* Available with KVM_CAP_S390_SKEYS */ +#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys) +#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys) +/* Available with KVM_CAP_S390_INJECT_IRQ */ +#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq) +/* Available with KVM_CAP_S390_IRQ_STATE */ +#define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state) +#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state) #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h index 95ba870302..0508d0b5d2 100644 --- a/linux-headers/linux/vfio.h +++ b/linux-headers/linux/vfio.h @@ -160,6 +160,8 @@ struct vfio_device_info { __u32 flags; #define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */ #define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */ +#define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */ +#define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */ __u32 num_regions; /* Max region index + 1 */ __u32 num_irqs; /* Max IRQ index + 1 */ }; diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 399c021337..0ba97062b7 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2887,8 +2887,7 @@ static int write_note_info(struct elf_note_info *info, int fd) return (error); /* write prstatus for each thread */ - for (ets = info->thread_list.tqh_first; ets != NULL; - ets = ets->ets_link.tqe_next) { + QTAILQ_FOREACH(ets, &info->thread_list, ets_link) { if ((error = write_note(&ets->notes[0], fd)) != 0) return (error); } @@ -4390,14 +4390,6 @@ static void ringbuf_completion(ReadLineState *rs, const char *str) qapi_free_ChardevInfoList(start); } -void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str) -{ - if (nb_args != 2) { - return; - } - ringbuf_completion(rs, str); -} - void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str) { if (nb_args != 2) { @@ -5392,11 +5384,6 @@ static void bdrv_password_cb(void *opaque, const char *password, monitor_read_command(mon, 1); } -ReadLineState *monitor_get_rs(Monitor *mon) -{ - return mon->rs; -} - int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, BlockCompletionFunc *completion_cb, void *opaque) diff --git a/qemu-char.c b/qemu-char.c index a405d76c31..d0c1564306 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -973,7 +973,6 @@ typedef struct FDCharDriver { CharDriverState *chr; GIOChannel *fd_in, *fd_out; int max_size; - QTAILQ_ENTRY(FDCharDriver) node; } FDCharDriver; /* Called with chr_write_lock held. */ diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c index e4860ae42f..6b4903334b 100644 --- a/qemu-coroutine-lock.c +++ b/qemu-coroutine-lock.c @@ -108,7 +108,7 @@ bool qemu_co_enter_next(CoQueue *queue) bool qemu_co_queue_empty(CoQueue *queue) { - return (QTAILQ_FIRST(&queue->entries) == NULL); + return QTAILQ_FIRST(&queue->entries) == NULL; } void qemu_co_mutex_init(CoMutex *mutex) diff --git a/qemu-options.hx b/qemu-options.hx index 319d971260..ec356f65c1 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3106,7 +3106,7 @@ executed often has little or no correlation with actual performance. to synchronise the host clock and the virtual clock. The goal is to have a guest running at the real frequency imposed by the shift option. Whenever the guest clock is behind the host clock and if -@option{align=on} is specified then we print a messsage to the user +@option{align=on} is specified then we print a message to the user to inform about the delay. Currently this option does not work when @option{shift} is @code{auto}. Note: The sync algorithm will work for those shift values for which diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 95f49e369c..5c4cd40a92 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -808,7 +808,7 @@ # # An enumeration of memory block operation result. # -# @sucess: the operation of online/offline memory block is successful. +# @success: the operation of online/offline memory block is successful. # @not-found: can't find the corresponding memoryXXX directory in sysfs. # @operation-not-supported: for some old kernels, it does not support # online or offline memory block. diff --git a/qmp-commands.hx b/qmp-commands.hx index 213508fe5d..d4a837c89b 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2380,7 +2380,7 @@ Example: "virtual-size":2048000, "backing_file":"base.qcow2", "full-backing-filename":"disks/base.qcow2", - "backing-filename-format:"qcow2", + "backing-filename-format":"qcow2", "snapshots":[ { "id": "1", @@ -3847,7 +3847,7 @@ Example: "virtual-size":2048000, "backing_file":"base.qcow2", "full-backing-filename":"disks/base.qcow2", - "backing-filename-format:"qcow2", + "backing-filename-format":"qcow2", "snapshots":[ { "id": "1", diff --git a/target-arm/cpu.h b/target-arm/cpu.h index d63d9b20f1..d4a589964e 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -93,11 +93,6 @@ #define ARM_CPU_VIRQ 2 #define ARM_CPU_VFIQ 3 -typedef void ARMWriteCPFunc(void *opaque, int cp_info, - int srcreg, int operand, uint32_t value); -typedef uint32_t ARMReadCPFunc(void *opaque, int cp_info, - int dstreg, int operand); - struct arm_boot_info; #define NB_MMU_MODES 7 @@ -1879,15 +1874,6 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, #include "exec/exec-all.h" -static inline void cpu_pc_from_tb(CPUARMState *env, TranslationBlock *tb) -{ - if (ARM_TBFLAG_AARCH64_STATE(tb->flags)) { - env->pc = tb->pc; - } else { - env->regs[15] = tb->pc; - } -} - enum { QEMU_PSCI_CONDUIT_DISABLED = 0, QEMU_PSCI_CONDUIT_SMC = 1, diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 7d06227730..4ea04acc4d 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -36,12 +36,11 @@ typedef struct CPUMBState CPUMBState; #define ELF_MACHINE EM_MICROBLAZE -#define EXCP_NMI 1 -#define EXCP_MMU 2 -#define EXCP_IRQ 3 -#define EXCP_BREAK 4 -#define EXCP_HW_BREAK 5 -#define EXCP_HW_EXCP 6 +#define EXCP_MMU 1 +#define EXCP_IRQ 2 +#define EXCP_BREAK 3 +#define EXCP_HW_BREAK 4 +#define EXCP_HW_EXCP 5 /* MicroBlaze-specific interrupt pending bits. */ #define CPU_INTERRUPT_NMI CPU_INTERRUPT_TGT_EXT_3 @@ -284,12 +283,6 @@ int cpu_mb_exec(CPUMBState *s); int cpu_mb_signal_handler(int host_signum, void *pinfo, void *puc); -enum { - CC_OP_DYNAMIC, /* Use env->cc_op */ - CC_OP_FLAGS, - CC_OP_CMP, -}; - /* FIXME: MB uses variable pages down to 1K but linux only uses 4k. */ #define TARGET_PAGE_BITS 12 #define MMAP_SHIFT TARGET_PAGE_BITS @@ -326,18 +319,8 @@ static inline int cpu_mmu_index (CPUMBState *env) int mb_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw, int mmu_idx); -static inline int cpu_interrupts_enabled(CPUMBState *env) -{ - return env->sregs[SR_MSR] & MSR_IE; -} - #include "exec/cpu-all.h" -static inline target_ulong cpu_get_pc(CPUMBState *env) -{ - return env->sregs[SR_PC]; -} - static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc, target_ulong *cs_base, int *flags) { diff --git a/target-microblaze/mmu.h b/target-microblaze/mmu.h index 3f74dda0b0..3b7a9983d5 100644 --- a/target-microblaze/mmu.h +++ b/target-microblaze/mmu.h @@ -82,7 +82,6 @@ struct microblaze_mmu_lookup } err; }; -void mmu_flip_um(CPUMBState *env, unsigned int um); unsigned int mmu_translate(struct microblaze_mmu *mmu, struct microblaze_mmu_lookup *lu, target_ulong vaddr, int rw, int mmu_idx); diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index b25324bc89..9e23cd0500 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -415,9 +415,4 @@ static inline int cpu_mmu_index(CPUOpenRISCState *env) #include "exec/exec-all.h" -static inline target_ulong cpu_get_pc(CPUOpenRISCState *env) -{ - return env->pc; -} - #endif /* CPU_OPENRISC_H */ diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 8135dda318..ba7d250962 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -356,7 +356,8 @@ int s390_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw, #ifndef CONFIG_USER_ONLY void do_restart_interrupt(CPUS390XState *env); -static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb) +static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb, + uint8_t *ar) { hwaddr addr = 0; uint8_t reg; @@ -366,6 +367,9 @@ static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb) addr = env->regs[reg]; } addr += (ipb >> 16) & 0xfff; + if (ar) { + *ar = reg; + } return addr; } @@ -401,6 +405,8 @@ void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm_s390_irq *irq); void kvm_s390_floating_interrupt(struct kvm_s390_irq *irq); int kvm_s390_inject_flic(struct kvm_s390_irq *irq); void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, uint64_t te_code); +int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf, + int len, bool is_write); int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_clock); int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_clock); #else @@ -418,6 +424,11 @@ static inline int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) { return -ENOSYS; } +static inline int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, + void *hostbuf, int len, bool is_write) +{ + return -ENOSYS; +} static inline void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, uint64_t te_code) { @@ -865,9 +876,13 @@ struct sysib_322 { uint8_t name[8]; uint32_t caf; uint8_t cpi[16]; - uint8_t res3[24]; + uint8_t res5[3]; + uint8_t ext_name_encoding; + uint32_t res3; + uint8_t uuid[16]; } vm[8]; - uint8_t res4[3552]; + uint8_t res4[1504]; + uint8_t ext_names[8][256]; }; /* MMU defines */ @@ -952,15 +967,15 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code); uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst, uint64_t vr); -int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, void *hostbuf, int len, - bool is_write); +int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf, + int len, bool is_write); -#define s390_cpu_virt_mem_read(cpu, laddr, dest, len) \ - s390_cpu_virt_mem_rw(cpu, laddr, dest, len, false) -#define s390_cpu_virt_mem_write(cpu, laddr, dest, len) \ - s390_cpu_virt_mem_rw(cpu, laddr, dest, len, true) -#define s390_cpu_virt_mem_check_write(cpu, laddr, len) \ - s390_cpu_virt_mem_rw(cpu, laddr, NULL, len, true) +#define s390_cpu_virt_mem_read(cpu, laddr, ar, dest, len) \ + s390_cpu_virt_mem_rw(cpu, laddr, ar, dest, len, false) +#define s390_cpu_virt_mem_write(cpu, laddr, ar, dest, len) \ + s390_cpu_virt_mem_rw(cpu, laddr, ar, dest, len, true) +#define s390_cpu_virt_mem_check_write(cpu, laddr, ar, len) \ + s390_cpu_virt_mem_rw(cpu, laddr, ar, NULL, len, true) /* The value of the TOD clock for 1.1.1970. */ #define TOD_UNIX_EPOCH 0x7d91048bca000000ULL diff --git a/target-s390x/helper.c b/target-s390x/helper.c index f1060c2bce..041c9c7429 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -162,7 +162,7 @@ hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr) vaddr &= 0x7fffffff; } - mmu_translate(env, vaddr, 2, asc, &raddr, &prot, false); + mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &prot, false); return raddr; } diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c index b00a00ca2b..e220cea8ab 100644 --- a/target-s390x/ioinst.c +++ b/target-s390x/ioinst.c @@ -149,13 +149,14 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) int ret = -ENODEV; int cc; CPUS390XState *env = &cpu->env; + uint8_t ar; - addr = decode_basedisp_s(env, ipb); + addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return; } - if (s390_cpu_virt_mem_read(cpu, addr, &schib, sizeof(schib))) { + if (s390_cpu_virt_mem_read(cpu, addr, ar, &schib, sizeof(schib))) { return; } if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || @@ -215,13 +216,14 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) int ret = -ENODEV; int cc; CPUS390XState *env = &cpu->env; + uint8_t ar; - addr = decode_basedisp_s(env, ipb); + addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return; } - if (s390_cpu_virt_mem_read(cpu, addr, &orig_orb, sizeof(orb))) { + if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); @@ -258,8 +260,9 @@ void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb) uint64_t addr; int cc; CPUS390XState *env = &cpu->env; + uint8_t ar; - addr = decode_basedisp_s(env, ipb); + addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return; @@ -268,7 +271,7 @@ void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb) cc = css_do_stcrw(&crw); /* 0 - crw stored, 1 - zeroes stored */ - if (s390_cpu_virt_mem_write(cpu, addr, &crw, sizeof(crw)) == 0) { + if (s390_cpu_virt_mem_write(cpu, addr, ar, &crw, sizeof(crw)) == 0) { setcc(cpu, cc); } else if (cc == 0) { /* Write failed: requeue CRW since STCRW is a suppressing instruction */ @@ -284,8 +287,9 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) int cc; SCHIB schib; CPUS390XState *env = &cpu->env; + uint8_t ar; - addr = decode_basedisp_s(env, ipb); + addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return; @@ -297,7 +301,7 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) * we check whether the memory area is writeable (injecting the * access execption if it is not) first. */ - if (!s390_cpu_virt_mem_check_write(cpu, addr, sizeof(schib))) { + if (!s390_cpu_virt_mem_check_write(cpu, addr, ar, sizeof(schib))) { program_interrupt(env, PGM_OPERAND, 2); } return; @@ -322,12 +326,13 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) } } if (cc != 3) { - if (s390_cpu_virt_mem_write(cpu, addr, &schib, sizeof(schib)) != 0) { + if (s390_cpu_virt_mem_write(cpu, addr, ar, &schib, + sizeof(schib)) != 0) { return; } } else { /* Access exceptions have a higher priority than cc3 */ - if (s390_cpu_virt_mem_check_write(cpu, addr, sizeof(schib)) != 0) { + if (s390_cpu_virt_mem_check_write(cpu, addr, ar, sizeof(schib)) != 0) { return; } } @@ -342,13 +347,14 @@ int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) IRB irb; uint64_t addr; int cc, irb_len; + uint8_t ar; if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { program_interrupt(env, PGM_OPERAND, 2); return -EIO; } trace_ioinst_sch_id("tsch", cssid, ssid, schid); - addr = decode_basedisp_s(env, ipb); + addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return -EIO; @@ -362,14 +368,14 @@ int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) } /* 0 - status pending, 1 - not status pending, 3 - not operational */ if (cc != 3) { - if (s390_cpu_virt_mem_write(cpu, addr, &irb, irb_len) != 0) { + if (s390_cpu_virt_mem_write(cpu, addr, ar, &irb, irb_len) != 0) { return -EFAULT; } css_do_tsch_update_subch(sch); } else { irb_len = sizeof(irb) - sizeof(irb.emw); /* Access exceptions have a higher priority than cc3 */ - if (s390_cpu_virt_mem_check_write(cpu, addr, irb_len) != 0) { + if (s390_cpu_virt_mem_check_write(cpu, addr, ar, irb_len) != 0) { return -EFAULT; } } @@ -645,7 +651,7 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb) * present CHSC sub-handlers ... if we ever need more, we should take * care of req->len here first. */ - if (s390_cpu_virt_mem_read(cpu, addr, buf, sizeof(ChscReq))) { + if (s390_cpu_virt_mem_read(cpu, addr, reg, buf, sizeof(ChscReq))) { return; } req = (ChscReq *)buf; @@ -677,7 +683,8 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb) break; } - if (!s390_cpu_virt_mem_write(cpu, addr + len, res, be16_to_cpu(res->len))) { + if (!s390_cpu_virt_mem_write(cpu, addr + len, reg, res, + be16_to_cpu(res->len))) { setcc(cpu, 0); /* Command execution complete */ } } @@ -690,9 +697,10 @@ int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb) IOIntCode int_code; hwaddr len; int ret; + uint8_t ar; trace_ioinst("tpi"); - addr = decode_basedisp_s(env, ipb); + addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return -EIO; @@ -702,7 +710,7 @@ int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb) len = lowcore ? 8 /* two words */ : 12 /* three words */; ret = css_do_tpi(&int_code, lowcore); if (ret == 1) { - s390_cpu_virt_mem_write(cpu, lowcore ? 184 : addr, &int_code, len); + s390_cpu_virt_mem_write(cpu, lowcore ? 184 : addr, ar, &int_code, len); } return ret; } diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index b48c643b36..8e65e43f02 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -44,6 +44,7 @@ #include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-bus.h" #include "hw/s390x/ipl.h" +#include "hw/s390x/ebcdic.h" /* #define DEBUG_KVM */ @@ -122,6 +123,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { static int cap_sync_regs; static int cap_async_pf; +static int cap_mem_op; static void *legacy_s390_alloc(size_t size, uint64_t *align); @@ -246,6 +248,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) { cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS); cap_async_pf = kvm_check_extension(s, KVM_CAP_ASYNC_PF); + cap_mem_op = kvm_check_extension(s, KVM_CAP_S390_MEM_OP); kvm_s390_enable_cmma(s); @@ -255,6 +258,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } kvm_vm_enable_cap(s, KVM_CAP_S390_USER_SIGP, 0); + kvm_vm_enable_cap(s, KVM_CAP_S390_USER_STSI, 0); return 0; } @@ -548,6 +552,46 @@ int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); } +/** + * kvm_s390_mem_op: + * @addr: the logical start address in guest memory + * @ar: the access register number + * @hostbuf: buffer in host memory. NULL = do only checks w/o copying + * @len: length that should be transfered + * @is_write: true = write, false = read + * Returns: 0 on success, non-zero if an exception or error occured + * + * Use KVM ioctl to read/write from/to guest memory. An access exception + * is injected into the vCPU in case of translation errors. + */ +int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf, + int len, bool is_write) +{ + struct kvm_s390_mem_op mem_op = { + .gaddr = addr, + .flags = KVM_S390_MEMOP_F_INJECT_EXCEPTION, + .size = len, + .op = is_write ? KVM_S390_MEMOP_LOGICAL_WRITE + : KVM_S390_MEMOP_LOGICAL_READ, + .buf = (uint64_t)hostbuf, + .ar = ar, + }; + int ret; + + if (!cap_mem_op) { + return -ENOSYS; + } + if (!hostbuf) { + mem_op.flags |= KVM_S390_MEMOP_F_CHECK_ONLY; + } + + ret = kvm_vcpu_ioctl(CPU(cpu), KVM_S390_MEM_OP, &mem_op); + if (ret < 0) { + error_printf("KVM_S390_MEM_OP failed: %s\n", strerror(-ret)); + } + return ret; +} + /* * Legacy layout for s390: * Older S390 KVM requires the topmost vma of the RAM to be @@ -975,7 +1019,8 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) return rc; } -static uint64_t get_base_disp_rxy(S390CPU *cpu, struct kvm_run *run) +static uint64_t get_base_disp_rxy(S390CPU *cpu, struct kvm_run *run, + uint8_t *ar) { CPUS390XState *env = &cpu->env; uint32_t x2 = (run->s390_sieic.ipa & 0x000f); @@ -986,12 +1031,16 @@ static uint64_t get_base_disp_rxy(S390CPU *cpu, struct kvm_run *run) if (disp2 & 0x80000) { disp2 += 0xfff00000; } + if (ar) { + *ar = base2; + } return (base2 ? env->regs[base2] : 0) + (x2 ? env->regs[x2] : 0) + (long)(int)disp2; } -static uint64_t get_base_disp_rsy(S390CPU *cpu, struct kvm_run *run) +static uint64_t get_base_disp_rsy(S390CPU *cpu, struct kvm_run *run, + uint8_t *ar) { CPUS390XState *env = &cpu->env; uint32_t base2 = run->s390_sieic.ipb >> 28; @@ -1001,6 +1050,9 @@ static uint64_t get_base_disp_rsy(S390CPU *cpu, struct kvm_run *run) if (disp2 & 0x80000) { disp2 += 0xfff00000; } + if (ar) { + *ar = base2; + } return (base2 ? env->regs[base2] : 0) + (long)(int)disp2; } @@ -1032,11 +1084,12 @@ static int kvm_stpcifc_service_call(S390CPU *cpu, struct kvm_run *run) { uint8_t r1 = (run->s390_sieic.ipa & 0x00f0) >> 4; uint64_t fiba; + uint8_t ar; cpu_synchronize_state(CPU(cpu)); - fiba = get_base_disp_rxy(cpu, run); + fiba = get_base_disp_rxy(cpu, run, &ar); - return stpcifc_service_call(cpu, r1, fiba); + return stpcifc_service_call(cpu, r1, fiba, ar); } static int kvm_sic_service_call(S390CPU *cpu, struct kvm_run *run) @@ -1058,22 +1111,24 @@ static int kvm_pcistb_service_call(S390CPU *cpu, struct kvm_run *run) uint8_t r1 = (run->s390_sieic.ipa & 0x00f0) >> 4; uint8_t r3 = run->s390_sieic.ipa & 0x000f; uint64_t gaddr; + uint8_t ar; cpu_synchronize_state(CPU(cpu)); - gaddr = get_base_disp_rsy(cpu, run); + gaddr = get_base_disp_rsy(cpu, run, &ar); - return pcistb_service_call(cpu, r1, r3, gaddr); + return pcistb_service_call(cpu, r1, r3, gaddr, ar); } static int kvm_mpcifc_service_call(S390CPU *cpu, struct kvm_run *run) { uint8_t r1 = (run->s390_sieic.ipa & 0x00f0) >> 4; uint64_t fiba; + uint8_t ar; cpu_synchronize_state(CPU(cpu)); - fiba = get_base_disp_rxy(cpu, run); + fiba = get_base_disp_rxy(cpu, run, &ar); - return mpcifc_service_call(cpu, r1, fiba); + return mpcifc_service_call(cpu, r1, fiba, ar); } static int handle_b9(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) @@ -1202,7 +1257,7 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb) * For any diagnose call we support, bits 48-63 of the resulting * address specify the function code; the remainder is ignored. */ - func_code = decode_basedisp_rs(&cpu->env, ipb) & DIAG_KVM_CODE_MASK; + func_code = decode_basedisp_rs(&cpu->env, ipb, NULL) & DIAG_KVM_CODE_MASK; switch (func_code) { case DIAG_IPL: kvm_handle_diag_308(cpu, run); @@ -1549,7 +1604,8 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) cpu_synchronize_state(CPU(cpu)); /* get order code */ - order = decode_basedisp_rs(env, run->s390_sieic.ipb) & SIGP_ORDER_MASK; + order = decode_basedisp_rs(env, run->s390_sieic.ipb, NULL) + & SIGP_ORDER_MASK; status_reg = &env->regs[r1]; param = (r1 % 2) ? env->regs[r1] : env->regs[r1 + 1]; @@ -1723,6 +1779,72 @@ static int handle_tsch(S390CPU *cpu) return ret; } +static void insert_stsi_3_2_2(S390CPU *cpu, __u64 addr, uint8_t ar) +{ + struct sysib_322 sysib; + int del; + + if (s390_cpu_virt_mem_read(cpu, addr, ar, &sysib, sizeof(sysib))) { + return; + } + /* Shift the stack of Extended Names to prepare for our own data */ + memmove(&sysib.ext_names[1], &sysib.ext_names[0], + sizeof(sysib.ext_names[0]) * (sysib.count - 1)); + /* First virt level, that doesn't provide Ext Names delimits stack. It is + * assumed it's not capable of managing Extended Names for lower levels. + */ + for (del = 1; del < sysib.count; del++) { + if (!sysib.vm[del].ext_name_encoding || !sysib.ext_names[del][0]) { + break; + } + } + if (del < sysib.count) { + memset(sysib.ext_names[del], 0, + sizeof(sysib.ext_names[0]) * (sysib.count - del)); + } + /* Insert short machine name in EBCDIC, padded with blanks */ + if (qemu_name) { + memset(sysib.vm[0].name, 0x40, sizeof(sysib.vm[0].name)); + ebcdic_put(sysib.vm[0].name, qemu_name, MIN(sizeof(sysib.vm[0].name), + strlen(qemu_name))); + } + sysib.vm[0].ext_name_encoding = 2; /* 2 = UTF-8 */ + memset(sysib.ext_names[0], 0, sizeof(sysib.ext_names[0])); + /* If hypervisor specifies zero Extended Name in STSI322 SYSIB, it's + * considered by s390 as not capable of providing any Extended Name. + * Therefore if no name was specified on qemu invocation, we go with the + * same "KVMguest" default, which KVM has filled into short name field. + */ + if (qemu_name) { + strncpy((char *)sysib.ext_names[0], qemu_name, + sizeof(sysib.ext_names[0])); + } else { + strcpy((char *)sysib.ext_names[0], "KVMguest"); + } + /* Insert UUID */ + memcpy(sysib.vm[0].uuid, qemu_uuid, sizeof(sysib.vm[0].uuid)); + + s390_cpu_virt_mem_write(cpu, addr, ar, &sysib, sizeof(sysib)); +} + +static int handle_stsi(S390CPU *cpu) +{ + CPUState *cs = CPU(cpu); + struct kvm_run *run = cs->kvm_run; + + switch (run->s390_stsi.fc) { + case 3: + if (run->s390_stsi.sel1 != 2 || run->s390_stsi.sel2 != 2) { + return 0; + } + /* Only sysib 3.2.2 needs post-handling for now. */ + insert_stsi_3_2_2(cpu, run->s390_stsi.addr, run->s390_stsi.ar); + return 0; + default: + return 0; + } +} + static int kvm_arch_handle_debug_exit(S390CPU *cpu) { CPUState *cs = CPU(cpu); @@ -1772,6 +1894,9 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) case KVM_EXIT_S390_TSCH: ret = handle_tsch(cpu); break; + case KVM_EXIT_S390_STSI: + ret = handle_stsi(cpu); + break; case KVM_EXIT_DEBUG: ret = kvm_arch_handle_debug_exit(cpu); break; diff --git a/target-s390x/mmu_helper.c b/target-s390x/mmu_helper.c index b061c85aff..e8dcd0c18f 100644 --- a/target-s390x/mmu_helper.c +++ b/target-s390x/mmu_helper.c @@ -68,7 +68,7 @@ static void trigger_prot_fault(CPUS390XState *env, target_ulong vaddr, { uint64_t tec; - tec = vaddr | (rw == 1 ? FS_WRITE : FS_READ) | 4 | asc >> 46; + tec = vaddr | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ) | 4 | asc >> 46; DPRINTF("%s: trans_exc_code=%016" PRIx64 "\n", __func__, tec); @@ -85,7 +85,7 @@ static void trigger_page_fault(CPUS390XState *env, target_ulong vaddr, int ilen = ILEN_LATER; uint64_t tec; - tec = vaddr | (rw == 1 ? FS_WRITE : FS_READ) | asc >> 46; + tec = vaddr | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ) | asc >> 46; DPRINTF("%s: vaddr=%016" PRIx64 " bits=%d\n", __func__, vaddr, bits); @@ -94,7 +94,7 @@ static void trigger_page_fault(CPUS390XState *env, target_ulong vaddr, } /* Code accesses have an undefined ilc. */ - if (rw == 2) { + if (rw == MMU_INST_FETCH) { ilen = 2; } @@ -288,7 +288,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr, r = mmu_translate_region(env, vaddr, asc, asce, level, raddr, flags, rw, exc); - if ((rw == 1) && !(*flags & PAGE_WRITE)) { + if (rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) { trigger_prot_fault(env, vaddr, asc, rw, exc); return -1; } @@ -303,8 +303,8 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr, * @param asc address space control (one of the PSW_ASC_* modes) * @param raddr the translated address is stored to this pointer * @param flags the PAGE_READ/WRITE/EXEC flags are stored to this pointer - * @param exc true = inject a program check if a fault occured - * @return 0 if the translation was successfull, -1 if a fault occured + * @param exc true = inject a program check if a fault occurred + * @return 0 if the translation was successful, -1 if a fault occurred */ int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t asc, target_ulong *raddr, int *flags, bool exc) @@ -338,7 +338,7 @@ int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t asc, * Instruction: Primary * Data: Secondary */ - if (rw == 2) { + if (rw == MMU_INST_FETCH) { r = mmu_translate_asce(env, vaddr, PSW_ASC_PRIMARY, env->cregs[1], raddr, flags, rw, exc); *flags &= ~(PAGE_READ | PAGE_WRITE); @@ -435,21 +435,29 @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, /** * s390_cpu_virt_mem_rw: * @laddr: the logical start address + * @ar: the access register number * @hostbuf: buffer in host memory. NULL = do only checks w/o copying - * @len: length that should be transfered + * @len: length that should be transferred * @is_write: true = write, false = read - * Returns: 0 on success, non-zero if an exception occured + * Returns: 0 on success, non-zero if an exception occurred * * Copy from/to guest memory using logical addresses. Note that we inject a * program interrupt in case there is an error while accessing the memory. */ -int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, void *hostbuf, +int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf, int len, bool is_write) { int currlen, nr_pages, i; target_ulong *pages; int ret; + if (kvm_enabled()) { + ret = kvm_s390_mem_op(cpu, laddr, ar, hostbuf, len, is_write); + if (ret >= 0) { + return ret; + } + } + nr_pages = (((laddr & ~TARGET_PAGE_MASK) + len - 1) >> TARGET_PAGE_BITS) + 1; pages = g_malloc(nr_pages * sizeof(*pages)); diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 4f82edde5b..8784112f4e 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -2990,7 +2990,7 @@ static ExitStatus op_sam(DisasContext *s, DisasOps *o) break; } - /* Bizzare but true, we check the address of the current insn for the + /* Bizarre but true, we check the address of the current insn for the specification exception, not the next to be executed. Thus the PoO documents that Bad Things Happen two bytes before the end. */ if (s->pc & ~mask) { diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h index 90bf0069b5..c14b5f9016 100644 --- a/target-tricore/cpu.h +++ b/target-tricore/cpu.h @@ -395,9 +395,4 @@ int cpu_tricore_handle_mmu_fault(CPUState *cpu, target_ulong address, #include "exec/exec-all.h" -static inline void cpu_pc_from_tb(CPUTriCoreState *env, TranslationBlock *tb) -{ - env->PC = tb->pc; -} - #endif /*__TRICORE_CPU_H__ */ @@ -859,8 +859,10 @@ static inline size_t tcg_current_code_size(TCGContext *s) * state is correctly synchronised and ready for execution of the next * TB (and in particular the guest PC is the address to execute next). * Otherwise, we gave up on execution of this TB before it started, and - * the caller must fix up the CPU state by calling cpu_pc_from_tb() - * with the next-TB pointer we return. + * the caller must fix up the CPU state by calling the CPU's + * synchronize_from_tb() method with the next-TB pointer we return (falling + * back to calling the CPU's set_pc method with tb->pb if no + * synchronize_from_tb() method exists). * * Note that TCG targets may use a different definition of tcg_qemu_tb_exec * to this default (which just calls the prologue.code emitted by diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index a18c12bcc1..843cf72980 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -364,7 +364,7 @@ void ahci_port_clear(AHCIQState *ahci, uint8_t port) ahci_px_wreg(ahci, port, AHCI_PX_IS, reg); g_assert_cmphex(ahci_px_rreg(ahci, port, AHCI_PX_IS), ==, 0); - /* Wipe the FIS-Recieve Buffer */ + /* Wipe the FIS-Receive Buffer */ qmemset(ahci->port[port].fb, 0x00, 0x100); } @@ -442,7 +442,7 @@ void ahci_port_check_pio_sanity(AHCIQState *ahci, uint8_t port, { PIOSetupFIS *pio = g_malloc0(0x20); - /* We cannot check the Status or E_Status registers, becuase + /* We cannot check the Status or E_Status registers, because * the status may have again changed between the PIO Setup FIS * and the conclusion of the command with the D2H Register FIS. */ memread(ahci->port[port].fb + 0x20, pio, 0x20); diff --git a/ui/console.c b/ui/console.c index 29275136c7..f5295c4688 100644 --- a/ui/console.c +++ b/ui/console.c @@ -269,7 +269,7 @@ void graphic_hw_invalidate(QemuConsole *con) } } -static void ppm_save(const char *filename, struct DisplaySurface *ds, +static void ppm_save(const char *filename, DisplaySurface *ds, Error **errp) { int width = pixman_image_get_width(ds->image); @@ -1535,7 +1535,7 @@ void dpy_text_update(QemuConsole *con, int x, int y, int w, int h) void dpy_text_resize(QemuConsole *con, int w, int h) { DisplayState *s = con->ds; - struct DisplayChangeListener *dcl; + DisplayChangeListener *dcl; if (!qemu_console_is_visible(con)) { return; diff --git a/ui/input-legacy.c b/ui/input-legacy.c index 2d4ca19740..3e9bb380e5 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -57,8 +57,6 @@ struct QEMUPutLEDEntry { static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers); -static QTAILQ_HEAD(, QEMUPutMouseEntry) mouse_handlers = - QTAILQ_HEAD_INITIALIZER(mouse_handlers); int index_from_key(const char *key) { diff --git a/ui/spice-display.c b/ui/spice-display.c index c71a059e35..9c63132054 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -539,7 +539,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) info->n_surfaces = ssd->num_surfaces; } -static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) +static int interface_get_command(QXLInstance *sin, QXLCommandExt *ext) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); SimpleSpiceUpdate *update; @@ -566,7 +566,7 @@ static int interface_req_cmd_notification(QXLInstance *sin) } static void interface_release_resource(QXLInstance *sin, - struct QXLReleaseInfoExt rext) + QXLReleaseInfoExt rext) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); SimpleSpiceUpdate *update; @@ -589,7 +589,7 @@ static void interface_release_resource(QXLInstance *sin, } } -static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *ext) +static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); int ret; @@ -718,7 +718,7 @@ static void display_update(DisplayChangeListener *dcl, } static void display_switch(DisplayChangeListener *dcl, - struct DisplaySurface *surface) + DisplaySurface *surface) { SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); qemu_spice_display_switch(ssd, surface); diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c index a420ccbd1d..03ea48a69c 100644 --- a/ui/vnc-auth-vencrypt.c +++ b/ui/vnc-auth-vencrypt.c @@ -65,7 +65,8 @@ static void start_auth_vencrypt_subauth(VncState *vs) static void vnc_tls_handshake_io(void *opaque); -static int vnc_start_vencrypt_handshake(struct VncState *vs) { +static int vnc_start_vencrypt_handshake(VncState *vs) +{ int ret; if ((ret = gnutls_handshake(vs->tls.session)) < 0) { @@ -100,8 +101,9 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs) { return 0; } -static void vnc_tls_handshake_io(void *opaque) { - struct VncState *vs = (struct VncState *)opaque; +static void vnc_tls_handshake_io(void *opaque) +{ + VncState *vs = (VncState *)opaque; VNC_DEBUG("Handshake IO continue\n"); vnc_start_vencrypt_handshake(vs); diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c index eddd39b08e..028fc4db1f 100644 --- a/ui/vnc-tls.c +++ b/ui/vnc-tls.c @@ -68,7 +68,7 @@ static int vnc_tls_initialize(void) static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport, const void *data, size_t len) { - struct VncState *vs = (struct VncState *)transport; + VncState *vs = (VncState *)transport; int ret; retry: @@ -85,7 +85,7 @@ static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport, static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport, void *data, size_t len) { - struct VncState *vs = (struct VncState *)transport; + VncState *vs = (VncState *)transport; int ret; retry: @@ -170,7 +170,7 @@ static gnutls_certificate_credentials_t vnc_tls_initialize_x509_cred(VncDisplay } -int vnc_tls_validate_certificate(struct VncState *vs) +int vnc_tls_validate_certificate(VncState *vs) { int ret; unsigned int status; @@ -332,7 +332,7 @@ static int vnc_set_gnutls_priority(gnutls_session_t s, int x509) #endif -int vnc_tls_client_setup(struct VncState *vs, +int vnc_tls_client_setup(VncState *vs, int needX509Creds) { VNC_DEBUG("Do TLS setup\n"); if (vnc_tls_initialize() < 0) { @@ -410,7 +410,7 @@ int vnc_tls_client_setup(struct VncState *vs, } -void vnc_tls_client_cleanup(struct VncState *vs) +void vnc_tls_client_cleanup(VncState *vs) { if (vs->tls.session) { gnutls_deinit(vs->tls.session); diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c index 62eb97fe76..38a1b8b646 100644 --- a/ui/vnc-ws.c +++ b/ui/vnc-ws.c @@ -24,7 +24,7 @@ #ifdef CONFIG_VNC_TLS #include "qemu/sockets.h" -static int vncws_start_tls_handshake(struct VncState *vs) +static int vncws_start_tls_handshake(VncState *vs) { int ret = gnutls_handshake(vs->tls.session); @@ -63,7 +63,7 @@ static int vncws_start_tls_handshake(struct VncState *vs) void vncws_tls_handshake_io(void *opaque) { - struct VncState *vs = (struct VncState *)opaque; + VncState *vs = (VncState *)opaque; if (!vs->tls.session) { VNC_DEBUG("TLS Websocket setup\n"); @@ -1046,7 +1046,7 @@ static void vnc_dpy_cursor_define(DisplayChangeListener *dcl, } } -static int find_and_clear_dirty_height(struct VncState *vs, +static int find_and_clear_dirty_height(VncState *vs, int y, int last_x, int x, int height) { int h; diff --git a/util/compatfd.c b/util/compatfd.c index 341ada638f..e8571502be 100644 --- a/util/compatfd.c +++ b/util/compatfd.c @@ -108,22 +108,3 @@ int qemu_signalfd(const sigset_t *mask) return qemu_signalfd_compat(mask); } - -bool qemu_signalfd_available(void) -{ -#ifdef CONFIG_SIGNALFD - sigset_t mask; - int fd; - bool ok; - sigemptyset(&mask); - errno = 0; - fd = syscall(SYS_signalfd, -1, &mask, _NSIG / 8); - ok = (errno != ENOSYS); - if (fd >= 0) { - close(fd); - } - return ok; -#else - return false; -#endif -} diff --git a/util/osdep.c b/util/osdep.c index b2bd1542c5..f938b69466 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -310,72 +310,6 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen) return ret; } -/* - * A variant of send(2) which handles partial write. - * - * Return the number of bytes transferred, which is only - * smaller than `count' if there is an error. - * - * This function won't work with non-blocking fd's. - * Any of the possibilities with non-bloking fd's is bad: - * - return a short write (then name is wrong) - * - busy wait adding (errno == EAGAIN) to the loop - */ -ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags) -{ - ssize_t ret = 0; - ssize_t total = 0; - - while (count) { - ret = send(fd, buf, count, flags); - if (ret < 0) { - if (errno == EINTR) { - continue; - } - break; - } - - count -= ret; - buf += ret; - total += ret; - } - - return total; -} - -/* - * A variant of recv(2) which handles partial write. - * - * Return the number of bytes transferred, which is only - * smaller than `count' if there is an error. - * - * This function won't work with non-blocking fd's. - * Any of the possibilities with non-bloking fd's is bad: - * - return a short write (then name is wrong) - * - busy wait adding (errno == EAGAIN) to the loop - */ -ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) -{ - ssize_t ret = 0; - ssize_t total = 0; - - while (count) { - ret = qemu_recv(fd, buf, count, flags); - if (ret <= 0) { - if (ret < 0 && errno == EINTR) { - continue; - } - break; - } - - count -= ret; - buf += ret; - total += ret; - } - - return total; -} - void qemu_set_version(const char *version) { qemu_version = version; diff --git a/util/qemu-config.c b/util/qemu-config.c index a393a3d785..30d6dcf526 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -3,10 +3,8 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/qmp/qerror.h" -#include "hw/qdev.h" #include "qapi/error.h" #include "qmp-commands.h" -#include "hw/i386/pc.h" static QemuOptsList *vm_config_groups[32]; static QemuOptsList *drive_config_groups[4]; |