aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml16
-rw-r--r--.gitignore5
-rw-r--r--.travis.yml35
-rw-r--r--COPYING.LIB22
-rw-r--r--MAINTAINERS85
-rw-r--r--Makefile54
-rw-r--r--Makefile.objs18
-rw-r--r--Makefile.target12
-rw-r--r--accel/kvm/kvm-all.c3
-rw-r--r--accel/kvm/trace-events2
-rw-r--r--accel/tcg/atomic_template.h2
-rw-r--r--accel/tcg/cpu-exec-common.c2
-rw-r--r--accel/tcg/cpu-exec.c6
-rw-r--r--accel/tcg/cputlb.c198
-rw-r--r--accel/tcg/softmmu_template.h10
-rw-r--r--accel/tcg/tcg-runtime-gvec.c259
-rw-r--r--accel/tcg/tcg-runtime.h23
-rw-r--r--accel/tcg/translate-all.c5
-rw-r--r--accel/tcg/translate-all.h2
-rw-r--r--accel/tcg/user-exec.c68
-rw-r--r--audio/audio.c12
-rw-r--r--audio/audio_int.h4
-rw-r--r--audio/paaudio.c15
-rw-r--r--audio/wavcapture.c39
-rw-r--r--backends/hostmem-file.c6
-rw-r--r--backends/hostmem.c8
-rw-r--r--block.c180
-rw-r--r--block/blklogwrites.c5
-rw-r--r--block/block-backend.c64
-rw-r--r--block/crypto.c9
-rw-r--r--block/curl.c29
-rw-r--r--block/dirty-bitmap.c21
-rw-r--r--block/file-posix.c25
-rw-r--r--block/io.c8
-rw-r--r--block/iscsi.c2
-rw-r--r--block/mirror.c11
-rw-r--r--block/nbd-client.c209
-rw-r--r--block/nbd-client.h6
-rw-r--r--block/nbd.c40
-rw-r--r--block/nvme.c1
-rw-r--r--block/qapi.c7
-rw-r--r--block/qcow2-bitmap.c76
-rw-r--r--block/qcow2-refcount.c3
-rw-r--r--block/qcow2.c22
-rw-r--r--block/qcow2.h12
-rw-r--r--block/qed.c1
-rw-r--r--block/sheepdog.c49
-rw-r--r--block/ssh.c46
-rw-r--r--block/throttle-groups.c9
-rw-r--r--block/trace-events47
-rw-r--r--block/vdi.c57
-rw-r--r--block/vmdk.c535
-rw-r--r--block/vpc.c4
-rw-r--r--blockdev-nbd.c10
-rw-r--r--blockdev.c31
-rw-r--r--chardev/char-fe.c35
-rw-r--r--chardev/char-mux.c19
-rw-r--r--chardev/char-pty.c56
-rw-r--r--chardev/char-serial.c2
-rw-r--r--chardev/char-socket.c490
-rw-r--r--chardev/char.c34
-rw-r--r--chardev/wctablet.c2
-rwxr-xr-xconfigure354
-rw-r--r--contrib/elf2dmp/kdbg.h12
-rw-r--r--contrib/elf2dmp/main.c27
-rw-r--r--contrib/elf2dmp/pdb.c33
-rw-r--r--contrib/elf2dmp/pdb.h4
-rw-r--r--contrib/elf2dmp/pe.h6
-rw-r--r--contrib/elf2dmp/qemu_elf.c27
-rw-r--r--contrib/elf2dmp/qemu_elf.h10
-rw-r--r--contrib/gitdm/filetypes.txt2
-rw-r--r--contrib/libvhost-user/libvhost-user.c8
-rw-r--r--contrib/rdmacm-mux/Makefile.objs1
-rw-r--r--contrib/rdmacm-mux/main.c12
-rw-r--r--contrib/vhost-user-blk/vhost-user-blk.c146
-rw-r--r--cpus.c2
-rw-r--r--crypto/aes.c414
-rw-r--r--crypto/afsplit.c11
-rw-r--r--crypto/desrfb.c594
-rw-r--r--default-configs/alpha-softmmu.mak1
-rw-r--r--default-configs/arm-softmmu.mak13
-rw-r--r--default-configs/cris-softmmu.mak1
-rw-r--r--default-configs/hppa-softmmu.mak1
-rw-r--r--default-configs/i386-softmmu.mak7
-rw-r--r--default-configs/lm32-softmmu.mak2
-rw-r--r--default-configs/m68k-softmmu.mak2
-rw-r--r--default-configs/microblaze-softmmu.mak3
-rw-r--r--default-configs/mips-softmmu-common.mak5
-rw-r--r--default-configs/mips64el-softmmu.mak2
-rw-r--r--default-configs/moxie-softmmu.mak1
-rw-r--r--default-configs/nios2-softmmu.mak1
-rw-r--r--default-configs/or1k-softmmu.mak1
-rw-r--r--default-configs/pci.mak4
-rw-r--r--default-configs/ppc-softmmu.mak8
-rw-r--r--default-configs/riscv32-softmmu.mak9
-rw-r--r--default-configs/riscv64-softmmu.mak9
-rw-r--r--default-configs/s390x-softmmu.mak6
-rw-r--r--default-configs/sh4-softmmu.mak2
-rw-r--r--default-configs/sh4eb-softmmu.mak2
-rw-r--r--default-configs/sparc-softmmu.mak2
-rw-r--r--default-configs/sparc64-softmmu.mak2
-rw-r--r--default-configs/tricore-softmmu.mak1
-rw-r--r--default-configs/virtio.mak3
-rw-r--r--default-configs/xtensa-softmmu.mak3
-rw-r--r--default-configs/xtensaeb-softmmu.mak3
-rw-r--r--disas/nanomips.cpp119
-rw-r--r--docs/devel/qapi-code-gen.txt90
-rw-r--r--docs/devel/testing.rst2
-rw-r--r--docs/devel/tracing.txt4
-rw-r--r--docs/multiseat.txt2
-rw-r--r--docs/pvrdma.txt4
-rw-r--r--docs/qdev-device-use.txt4
-rw-r--r--docs/qemu-cpu-models.texi163
-rw-r--r--docs/specs/ivshmem-spec.txt8
-rw-r--r--docs/specs/tpm.txt104
-rw-r--r--dump.c5
-rw-r--r--exec.c80
-rw-r--r--fpu/softfloat.c33
-rw-r--r--gdb-xml/i386-32bit-core.xml65
-rw-r--r--gdb-xml/i386-32bit-sse.xml52
-rw-r--r--gdb-xml/i386-32bit.xml184
-rw-r--r--gdb-xml/i386-64bit-core.xml73
-rw-r--r--gdb-xml/i386-64bit-sse.xml60
-rw-r--r--gdb-xml/i386-64bit.xml210
-rw-r--r--gdbstub.c127
-rw-r--r--hmp.c6
-rw-r--r--hw/Makefile.objs2
-rw-r--r--hw/acpi/Makefile.objs1
-rw-r--r--hw/acpi/core.c12
-rw-r--r--hw/acpi/cpu.c2
-rw-r--r--hw/acpi/memory_hotplug.c10
-rw-r--r--hw/acpi/pcihp.c2
-rw-r--r--hw/acpi/piix4.c2
-rw-r--r--hw/acpi/tpm.c459
-rw-r--r--hw/acpi/vmgenid.c6
-rw-r--r--hw/alpha/Makefile.objs2
-rw-r--r--hw/alpha/dp264.c4
-rw-r--r--hw/arm/Makefile.objs6
-rw-r--r--hw/arm/armsse.c1249
-rw-r--r--hw/arm/armv7m.c26
-rw-r--r--hw/arm/boot.c172
-rw-r--r--hw/arm/iotkit.c759
-rw-r--r--hw/arm/microbit.c16
-rw-r--r--hw/arm/mps2-tz.c121
-rw-r--r--hw/arm/musca.c669
-rw-r--r--hw/arm/nrf51_soc.c44
-rw-r--r--hw/arm/omap2.c2
-rw-r--r--hw/arm/xlnx-zynqmp.c9
-rw-r--r--hw/audio/pcspk.c35
-rw-r--r--hw/block/dataplane/xen-block.c4
-rw-r--r--hw/block/nvme.c15
-rw-r--r--hw/block/trace-events8
-rw-r--r--hw/block/vhost-user-blk.c11
-rw-r--r--hw/block/virtio-blk.c37
-rw-r--r--hw/block/xen-block.c40
-rw-r--r--hw/bt/hci-csr.c2
-rw-r--r--hw/char/omap_uart.c4
-rw-r--r--hw/char/pl011.c81
-rw-r--r--hw/char/terminal3270.c15
-rw-r--r--hw/char/virtio-serial-bus.c2
-rw-r--r--hw/char/xen_console.c3
-rw-r--r--hw/core/bus.c11
-rw-r--r--hw/core/generic-loader.c2
-rw-r--r--hw/core/loader.c35
-rw-r--r--hw/core/machine.c10
-rw-r--r--hw/cpu/cluster.c49
-rw-r--r--hw/cris/Makefile.objs2
-rw-r--r--hw/cris/boot.c3
-rw-r--r--hw/display/Makefile.objs8
-rw-r--r--hw/display/milkymist-tmu2.c49
-rw-r--r--hw/display/qxl.c14
-rw-r--r--hw/display/trace-events2
-rw-r--r--hw/display/virtio-gpu-pci.c14
-rw-r--r--hw/display/virtio-vga.c1
-rw-r--r--hw/dma/i8257.c4
-rw-r--r--hw/gpio/trace-events2
-rw-r--r--hw/hppa/Makefile.objs2
-rw-r--r--hw/hppa/dino.c8
-rw-r--r--hw/hppa/machine.c6
-rw-r--r--hw/i2c/Makefile.objs6
-rw-r--r--hw/i2c/microbit_i2c.c127
-rw-r--r--hw/i2c/smbus_eeprom.c129
-rw-r--r--hw/i386/Makefile.objs4
-rw-r--r--hw/i386/acpi-build.c47
-rw-r--r--hw/i386/intel_iommu.c3
-rw-r--r--hw/i386/multiboot.c2
-rw-r--r--hw/i386/pc.c234
-rw-r--r--hw/i386/pc_piix.c4
-rw-r--r--hw/i386/pc_q35.c3
-rw-r--r--hw/ide/Makefile.objs4
-rw-r--r--hw/ide/cmd646.c102
-rw-r--r--hw/ide/core.c25
-rw-r--r--hw/ide/ioport.c66
-rw-r--r--hw/ide/pci.c65
-rw-r--r--hw/ide/sii3112.c52
-rw-r--r--hw/ide/via.c87
-rw-r--r--hw/input/pckbd.c20
-rw-r--r--hw/input/trace-events7
-rw-r--r--hw/input/tsc210x.c18
-rw-r--r--hw/intc/armv7m_nvic.c7
-rw-r--r--hw/intc/spapr_xive.c16
-rw-r--r--hw/intc/xics.c76
-rw-r--r--hw/intc/xics_kvm.c121
-rw-r--r--hw/intc/xics_spapr.c12
-rw-r--r--hw/intc/xive.c22
-rw-r--r--hw/isa/isa-superio.c4
-rw-r--r--hw/lm32/Makefile.objs4
-rw-r--r--hw/lm32/lm32_boards.c6
-rw-r--r--hw/lm32/milkymist-hw.h63
-rw-r--r--hw/lm32/milkymist.c4
-rw-r--r--hw/m68k/Makefile.objs4
-rw-r--r--hw/m68k/an5206.c2
-rw-r--r--hw/m68k/mcf5208.c2
-rw-r--r--hw/microblaze/Makefile.objs6
-rw-r--r--hw/microblaze/boot.c7
-rw-r--r--hw/microblaze/petalogix_s3adsp1800_mmu.c4
-rw-r--r--hw/mips/Makefile.objs5
-rw-r--r--hw/mips/boston.c2
-rw-r--r--hw/mips/cps.c8
-rw-r--r--hw/mips/mips_fulong2e.c7
-rw-r--r--hw/mips/mips_int.c12
-rw-r--r--hw/mips/mips_malta.c7
-rw-r--r--hw/mips/mips_mipssim.c5
-rw-r--r--hw/mips/mips_r4k.c5
-rw-r--r--hw/misc/Makefile.objs1
-rw-r--r--hw/misc/armsse-cpuid.c134
-rw-r--r--hw/misc/edu.c3
-rw-r--r--hw/misc/iotkit-secctl.c5
-rw-r--r--hw/misc/iotkit-sysinfo.c15
-rw-r--r--hw/misc/ivshmem.c210
-rw-r--r--hw/misc/macio/cuda.c11
-rw-r--r--hw/misc/mips_cpc.c17
-rw-r--r--hw/misc/mips_itu.c73
-rw-r--r--hw/misc/trace-events4
-rw-r--r--hw/misc/tz-ppc.c32
-rw-r--r--hw/moxie/Makefile.objs2
-rw-r--r--hw/moxie/moxiesim.c2
-rw-r--r--hw/net/Makefile.objs4
-rw-r--r--hw/net/virtio-net.c667
-rw-r--r--hw/nios2/Makefile.objs3
-rw-r--r--hw/nios2/boot.c7
-rw-r--r--hw/nvram/Makefile.objs1
-rw-r--r--hw/nvram/fw_cfg.c9
-rw-r--r--hw/nvram/nrf51_nvm.c388
-rw-r--r--hw/openrisc/Makefile.objs2
-rw-r--r--hw/openrisc/openrisc_sim.c2
-rw-r--r--hw/pci-host/Makefile.objs10
-rw-r--r--hw/pci-host/prep.c2
-rw-r--r--hw/pci/msi.c2
-rw-r--r--hw/pci/msix.c2
-rw-r--r--hw/pci/pcie.c27
-rw-r--r--hw/pci/pcie_port.c1
-rw-r--r--hw/pci/shpc.c2
-rw-r--r--hw/ppc/Makefile.objs12
-rw-r--r--hw/ppc/e500.c3
-rw-r--r--hw/ppc/mac_newworld.c8
-rw-r--r--hw/ppc/mac_oldworld.c6
-rw-r--r--hw/ppc/pnv.c7
-rw-r--r--hw/ppc/pnv_core.c12
-rw-r--r--hw/ppc/ppc.c58
-rw-r--r--hw/ppc/ppc405_uc.c58
-rw-r--r--hw/ppc/ppc440_bamboo.c4
-rw-r--r--hw/ppc/ppc440_uc.c76
-rw-r--r--hw/ppc/ppc4xx_devs.c48
-rw-r--r--hw/ppc/ppc_booke.c1
-rw-r--r--hw/ppc/prep.c1
-rw-r--r--hw/ppc/sam460ex.c184
-rw-r--r--hw/ppc/spapr.c40
-rw-r--r--hw/ppc/spapr_cpu_core.c8
-rw-r--r--hw/ppc/spapr_events.c2
-rw-r--r--hw/ppc/spapr_irq.c104
-rw-r--r--hw/ppc/spapr_pci.c21
-rw-r--r--hw/ppc/spapr_rtc.c2
-rw-r--r--hw/ppc/spapr_vio.c49
-rw-r--r--hw/ppc/virtex_ml507.c2
-rw-r--r--hw/rdma/rdma_backend.c63
-rw-r--r--hw/rdma/rdma_backend.h12
-rw-r--r--hw/rdma/rdma_backend_defs.h1
-rw-r--r--hw/rdma/rdma_rm.c9
-rw-r--r--hw/rdma/vmw/pvrdma_main.c10
-rw-r--r--hw/rdma/vmw/pvrdma_qp_ops.c44
-rw-r--r--hw/rdma/vmw/pvrdma_qp_ops.h4
-rw-r--r--hw/riscv/Makefile.objs22
-rw-r--r--hw/riscv/sifive_e.c4
-rw-r--r--hw/riscv/sifive_u.c4
-rw-r--r--hw/riscv/spike.c4
-rw-r--r--hw/riscv/virt.c4
-rw-r--r--hw/s390x/Makefile.objs5
-rw-r--r--hw/s390x/css-bridge.c2
-rw-r--r--hw/s390x/ipl.c9
-rw-r--r--hw/s390x/s390-pci-bus.c300
-rw-r--r--hw/s390x/s390-pci-bus.h33
-rw-r--r--hw/s390x/s390-pci-inst.c133
-rw-r--r--hw/s390x/s390-pci-inst.h1
-rw-r--r--hw/s390x/s390-pci-stub.c77
-rw-r--r--hw/s390x/s390-skeys.c2
-rw-r--r--hw/s390x/s390-virtio-ccw.c8
-rw-r--r--hw/scsi/scsi-disk.c162
-rw-r--r--hw/scsi/scsi-generic.c74
-rw-r--r--hw/scsi/trace-events40
-rw-r--r--hw/scsi/vhost-scsi.c3
-rw-r--r--hw/scsi/vhost-user-scsi.c3
-rw-r--r--hw/scsi/virtio-scsi.c15
-rw-r--r--hw/scsi/vmw_pvscsi.c2
-rw-r--r--hw/sd/sd.c1
-rw-r--r--hw/sh4/Makefile.objs4
-rw-r--r--hw/sh4/r2d.c2
-rw-r--r--hw/sparc/Makefile.objs4
-rw-r--r--hw/sparc/leon3.c3
-rw-r--r--hw/sparc/sun4m.c31
-rw-r--r--hw/sparc64/Makefile.objs6
-rw-r--r--hw/sparc64/sun4u.c23
-rw-r--r--hw/ssi/aspeed_smc.c128
-rw-r--r--hw/timer/mc146818rtc.c4
-rw-r--r--hw/timer/pl031.c80
-rw-r--r--hw/timer/trace-events6
-rw-r--r--hw/tpm/Makefile.objs1
-rw-r--r--hw/tpm/tpm_crb.c13
-rw-r--r--hw/tpm/tpm_ppi.c53
-rw-r--r--hw/tpm/tpm_ppi.h46
-rw-r--r--hw/tpm/tpm_tis.c13
-rw-r--r--hw/tpm/trace-events3
-rw-r--r--hw/tricore/Makefile.objs2
-rw-r--r--hw/tricore/tricore_testboard.c2
-rw-r--r--hw/unicore32/puv3.c1
-rw-r--r--hw/usb/combined-packet.c4
-rw-r--r--hw/usb/core.c6
-rw-r--r--hw/usb/dev-hid.c26
-rw-r--r--hw/usb/dev-mtp.c168
-rw-r--r--hw/usb/dev-serial.c2
-rw-r--r--hw/usb/dev-smartcard-reader.c2
-rw-r--r--hw/usb/hcd-ehci-pci.c4
-rw-r--r--hw/usb/hcd-ehci-sysbus.c4
-rw-r--r--hw/usb/hcd-ehci.c12
-rw-r--r--hw/usb/hcd-ehci.h4
-rw-r--r--hw/usb/hcd-musb.c8
-rw-r--r--hw/usb/hcd-ohci.c8
-rw-r--r--hw/usb/hcd-uhci.c8
-rw-r--r--hw/usb/hcd-xhci.c28
-rw-r--r--hw/usb/hcd-xhci.h1
-rw-r--r--hw/usb/redirect.c3
-rw-r--r--hw/vfio/Makefile.objs9
-rw-r--r--hw/vfio/pci.c2
-rw-r--r--hw/vfio/trace-events2
-rw-r--r--hw/virtio/Makefile.objs15
-rw-r--r--hw/virtio/vhost-scsi-pci.c97
-rw-r--r--hw/virtio/vhost-user-blk-pci.c103
-rw-r--r--hw/virtio/vhost-user-scsi-pci.c103
-rw-r--r--hw/virtio/vhost-user.c2
-rw-r--r--hw/virtio/vhost-vsock-pci.c86
-rw-r--r--hw/virtio/virtio-9p-pci.c88
-rw-r--r--hw/virtio/virtio-balloon-pci.c95
-rw-r--r--hw/virtio/virtio-balloon.c2
-rw-r--r--hw/virtio/virtio-blk-pci.c100
-rw-r--r--hw/virtio/virtio-crypto-pci.c14
-rw-r--r--hw/virtio/virtio-input-host-pci.c48
-rw-r--r--hw/virtio/virtio-input-pci.c157
-rw-r--r--hw/virtio/virtio-net-pci.c98
-rw-r--r--hw/virtio/virtio-pci.c815
-rw-r--r--hw/virtio/virtio-pci.h234
-rw-r--r--hw/virtio/virtio-rng-pci.c88
-rw-r--r--hw/virtio/virtio-scsi-pci.c107
-rw-r--r--hw/virtio/virtio-serial-pci.c115
-rw-r--r--hw/virtio/virtio.c4
-rw-r--r--hw/xen/xen-bus.c32
-rw-r--r--hw/xtensa/Makefile.objs5
-rw-r--r--hw/xtensa/mx_pic.c354
-rw-r--r--hw/xtensa/pic_cpu.c47
-rw-r--r--hw/xtensa/sim.c12
-rw-r--r--hw/xtensa/xtfpga.c67
-rw-r--r--include/block/block.h4
-rw-r--r--include/block/block_int.h3
-rw-r--r--include/block/nbd.h63
-rw-r--r--include/block/throttle-groups.h5
-rw-r--r--include/chardev/char-fe.h21
-rw-r--r--include/chardev/char-mux.h1
-rw-r--r--include/chardev/char.h16
-rw-r--r--include/crypto/afsplit.h11
-rw-r--r--include/elf.h10
-rw-r--r--include/exec/cpu-all.h2
-rw-r--r--include/exec/cpu-common.h8
-rw-r--r--include/exec/cpu-defs.h71
-rw-r--r--include/exec/cpu_ldst.h9
-rw-r--r--include/exec/exec-all.h9
-rw-r--r--include/exec/memattrs.h10
-rw-r--r--include/exec/memory.h40
-rw-r--r--include/exec/tb-lookup.h4
-rw-r--r--include/fpu/softfloat-macros.h2
-rw-r--r--include/glib-compat.h57
-rw-r--r--include/hw/acpi/acpi-defs.h13
-rw-r--r--include/hw/acpi/cpu.h2
-rw-r--r--include/hw/acpi/tpm.h21
-rw-r--r--include/hw/arm/armsse.h (renamed from include/hw/arm/iotkit.h)120
-rw-r--r--include/hw/arm/armv7m.h1
-rw-r--r--include/hw/arm/nrf51.h2
-rw-r--r--include/hw/arm/nrf51_soc.h3
-rw-r--r--include/hw/arm/pxa.h1
-rw-r--r--include/hw/boards.h1
-rw-r--r--include/hw/char/pl011.h34
-rw-r--r--include/hw/char/serial.h4
-rw-r--r--include/hw/cpu/cluster.h24
-rw-r--r--include/hw/devices.h1
-rw-r--r--include/hw/display/milkymist_tmu2.h41
-rw-r--r--include/hw/elf_ops.h77
-rw-r--r--include/hw/i2c/microbit_i2c.h42
-rw-r--r--include/hw/i2c/smbus.h5
-rw-r--r--include/hw/i386/pc.h7
-rw-r--r--include/hw/ide.h2
-rw-r--r--include/hw/ide/ahci.h4
-rw-r--r--include/hw/ide/pci.h14
-rw-r--r--include/hw/input/ps2.h2
-rw-r--r--include/hw/loader.h9
-rw-r--r--include/hw/misc/armsse-cpuid.h41
-rw-r--r--include/hw/misc/iotkit-secctl.h6
-rw-r--r--include/hw/misc/iotkit-sysinfo.h6
-rw-r--r--include/hw/misc/mips_itu.h8
-rw-r--r--include/hw/misc/tz-ppc.h8
-rw-r--r--include/hw/nvram/nrf51_nvm.h64
-rw-r--r--include/hw/pci-host/gpex.h4
-rw-r--r--include/hw/pci-host/q35.h4
-rw-r--r--include/hw/pci-host/spapr.h2
-rw-r--r--include/hw/pci/msi.h1
-rw-r--r--include/hw/pci/pcie.h2
-rw-r--r--include/hw/pcmcia.h4
-rw-r--r--include/hw/ppc/pnv_core.h9
-rw-r--r--include/hw/ppc/ppc4xx.h2
-rw-r--r--include/hw/ppc/spapr.h8
-rw-r--r--include/hw/ppc/spapr_cpu_core.h2
-rw-r--r--include/hw/ppc/spapr_irq.h2
-rw-r--r--include/hw/ppc/spapr_xive.h2
-rw-r--r--include/hw/ppc/xics.h33
-rw-r--r--include/hw/ppc/xics_spapr.h37
-rw-r--r--include/hw/ppc/xive.h66
-rw-r--r--include/hw/qdev-core.h6
-rw-r--r--include/hw/s390x/tod.h16
-rw-r--r--include/hw/ssi/aspeed_smc.h3
-rw-r--r--include/hw/timer/pl031.h44
-rw-r--r--include/hw/virtio/virtio-net.h86
-rw-r--r--include/hw/xen/start_info.h146
-rw-r--r--include/hw/xtensa/mx_pic.h44
-rw-r--r--include/io/task.h29
-rw-r--r--include/migration/register.h2
-rw-r--r--include/net/eth.h2
-rw-r--r--include/net/net.h2
-rw-r--r--include/qapi/qmp-event.h6
-rw-r--r--include/qapi/qmp/dispatch.h1
-rw-r--r--include/qemu-common.h2
-rw-r--r--include/qemu/atomic128.h2
-rw-r--r--include/qemu/compiler.h19
-rw-r--r--include/qemu/main-loop.h15
-rw-r--r--include/qemu/mmap-alloc.h2
-rw-r--r--include/qemu/osdep.h16
-rw-r--r--include/qemu/queue.h2
-rw-r--r--include/qemu/range.h11
-rw-r--r--include/qemu/typedefs.h13
-rw-r--r--include/qemu/units.h73
-rw-r--r--include/qemu/uuid.h2
-rw-r--r--include/qom/cpu.h23
-rw-r--r--include/standard-headers/asm-x86/bootparam.h34
-rw-r--r--include/standard-headers/drm/drm_fourcc.h63
-rw-r--r--include/standard-headers/linux/ethtool.h19
-rw-r--r--include/standard-headers/linux/input-event-codes.h17
-rw-r--r--include/standard-headers/linux/pci_regs.h1
-rw-r--r--include/standard-headers/linux/vhost_types.h128
-rw-r--r--include/standard-headers/linux/virtio_balloon.h8
-rw-r--r--include/standard-headers/linux/virtio_blk.h54
-rw-r--r--include/standard-headers/linux/virtio_config.h3
-rw-r--r--include/standard-headers/linux/virtio_gpu.h18
-rw-r--r--include/standard-headers/linux/virtio_ring.h52
-rw-r--r--include/sysemu/arch_init.h11
-rw-r--r--include/sysemu/block-backend.h7
-rw-r--r--include/sysemu/bt.h4
-rw-r--r--include/sysemu/sysemu.h1
-rw-r--r--include/ui/console.h24
-rw-r--r--include/ui/egl-helpers.h4
-rw-r--r--include/ui/gtk.h2
-rw-r--r--include/ui/kbd-state.h101
-rw-r--r--include/ui/qemu-pixman.h10
-rw-r--r--include/ui/sdl2.h6
-rw-r--r--io/channel-socket.c19
-rw-r--r--io/task.c101
-rw-r--r--io/trace-events2
-rw-r--r--iothread.c6
-rw-r--r--linux-headers/asm-arm/unistd-common.h1
-rw-r--r--linux-headers/asm-arm64/unistd.h1
-rw-r--r--linux-headers/asm-generic/unistd.h10
-rw-r--r--linux-headers/asm-mips/sgidefs.h8
-rw-r--r--linux-headers/asm-mips/unistd.h1074
-rw-r--r--linux-headers/asm-mips/unistd_n32.h338
-rw-r--r--linux-headers/asm-mips/unistd_n64.h334
-rw-r--r--linux-headers/asm-mips/unistd_o32.h374
-rw-r--r--linux-headers/asm-powerpc/unistd.h389
-rw-r--r--linux-headers/asm-powerpc/unistd_32.h381
-rw-r--r--linux-headers/asm-powerpc/unistd_64.h372
-rw-r--r--linux-headers/linux/kvm.h29
-rw-r--r--linux-headers/linux/vfio.h92
-rw-r--r--linux-headers/linux/vhost.h113
-rw-r--r--linux-headers/linux/vhost_types.h1
-rw-r--r--linux-user/aarch64/cpu_loop.c31
-rw-r--r--linux-user/aarch64/target_syscall.h9
-rw-r--r--linux-user/elfload.c11
-rw-r--r--linux-user/fd-trans.c8
-rw-r--r--linux-user/m68k/target_cpu.h4
-rw-r--r--linux-user/m68k/target_structs.h2
-rw-r--r--linux-user/mips/cpu_loop.c73
-rw-r--r--linux-user/qemu.h6
-rw-r--r--linux-user/riscv/signal.c4
-rw-r--r--linux-user/s390x/target_cpu.h19
-rw-r--r--linux-user/syscall.c104
-rw-r--r--migration/channel.c11
-rw-r--r--migration/global_state.c15
-rw-r--r--migration/migration.c51
-rw-r--r--migration/migration.h12
-rw-r--r--migration/postcopy-ram.c1
-rw-r--r--migration/ram.c34
-rw-r--r--migration/ram.h4
-rw-r--r--migration/rdma.c1
-rw-r--r--migration/savevm.c5
-rw-r--r--monitor.c97
-rw-r--r--nbd/client.c825
-rw-r--r--nbd/common.c2
-rw-r--r--nbd/server.c52
-rw-r--r--nbd/trace-events17
-rw-r--r--net/net.c4
-rw-r--r--net/slirp.c187
-rw-r--r--numa.c1
-rw-r--r--pc-bios/README2
-rw-r--r--pc-bios/efi-e1000.rombin240128 -> 240128 bytes
-rw-r--r--pc-bios/efi-e1000e.rombin240128 -> 240128 bytes
-rw-r--r--pc-bios/efi-eepro100.rombin240128 -> 240128 bytes
-rw-r--r--pc-bios/efi-ne2k_pci.rombin238080 -> 238592 bytes
-rw-r--r--pc-bios/efi-pcnet.rombin238080 -> 238592 bytes
-rw-r--r--pc-bios/efi-rtl8139.rombin241664 -> 242688 bytes
-rw-r--r--pc-bios/efi-virtio.rombin242176 -> 242688 bytes
-rw-r--r--pc-bios/efi-vmxnet3.rombin236032 -> 236032 bytes
-rw-r--r--pc-bios/openbios-ppcbin767224 -> 767224 bytes
-rw-r--r--pc-bios/openbios-sparc32bin382048 -> 382048 bytes
-rw-r--r--pc-bios/openbios-sparc64bin1593408 -> 1593408 bytes
-rw-r--r--pc-bios/optionrom/Makefile5
-rw-r--r--pc-bios/optionrom/linuxboot_dma.c114
-rw-r--r--pc-bios/optionrom/optrom.h110
-rw-r--r--pc-bios/optionrom/optrom_fw_cfg.h92
-rw-r--r--pc-bios/optionrom/pvh.S200
-rw-r--r--pc-bios/optionrom/pvh_main.c133
-rw-r--r--pc-bios/pvh.binbin0 -> 1536 bytes
-rw-r--r--pc-bios/qemu-icon.bmpbin630 -> 0 bytes
-rw-r--r--pc-bios/qemu_vga.ndrvbin14752 -> 18752 bytes
-rw-r--r--pc-bios/s390-ccw/start.S14
-rw-r--r--pc-bios/slof.binbin974544 -> 926392 bytes
-rw-r--r--qapi/Makefile.objs25
-rw-r--r--qapi/block-core.json259
-rw-r--r--qapi/migration.json5
-rw-r--r--qapi/misc.json521
-rw-r--r--qapi/qapi-schema.json17
-rw-r--r--qapi/qmp-event.c12
-rw-r--r--qapi/qmp-registry.c8
-rw-r--r--qapi/target.json514
-rw-r--r--qapi/ui.json10
-rw-r--r--qemu-deprecated.texi73
-rw-r--r--qemu-doc.texi29
-rw-r--r--qemu-img.c2
-rw-r--r--qemu-io-cmds.c9
-rw-r--r--qemu-nbd.c226
-rw-r--r--qemu-nbd.texi121
-rw-r--r--qemu-options.hx35
-rw-r--r--qemu-seccomp.c3
-rw-r--r--qmp.c26
-rw-r--r--qobject/json-parser.c10
-rw-r--r--qom/cpu.c1
-rw-r--r--qom/object.c3
-rw-r--r--qtest.c2
m---------roms/QemuMacDrivers0
m---------roms/SLOF0
m---------roms/ipxe0
m---------roms/openbios0
-rwxr-xr-xscripts/analyse-locks-simpletrace.py1
-rwxr-xr-xscripts/analyze-migration.py1
-rwxr-xr-xscripts/archive-source.sh9
-rwxr-xr-xscripts/checkpatch.pl2
-rwxr-xr-xscripts/decodetree.py2
-rwxr-xr-xscripts/device-crash-test20
-rw-r--r--scripts/dump-guest-memory.py1
-rw-r--r--scripts/qapi/commands.py2
-rw-r--r--scripts/qapi/common.py55
-rw-r--r--scripts/qapi/events.py52
-rw-r--r--scripts/qapi/types.py4
-rw-r--r--scripts/qapi/visit.py4
-rwxr-xr-xscripts/qemu-trace-stap175
-rw-r--r--scripts/qemu-trace-stap.texi140
-rw-r--r--scripts/qemu.py14
-rw-r--r--scripts/qemugdb/coroutine.py2
-rw-r--r--scripts/qtest.py6
-rwxr-xr-xscripts/render_block_graph.py120
-rwxr-xr-xscripts/replay-dump.py2
-rwxr-xr-xscripts/simpletrace.py1
-rwxr-xr-xscripts/tap-driver.pl1
-rwxr-xr-xscripts/tap-merge.pl1
-rwxr-xr-xscripts/texi2pod.pl2
-rwxr-xr-xscripts/tracetool.py2
-rw-r--r--scripts/tracetool/__init__.py6
-rw-r--r--scripts/tracetool/format/log_stap.py127
-rw-r--r--scripts/tracetool/format/simpletrace_stap.py2
-rwxr-xr-xscripts/update-linux-headers.sh17
-rw-r--r--slirp/Makefile.objs4
-rw-r--r--slirp/arp_table.c3
-rw-r--r--slirp/bootp.c1
-rw-r--r--slirp/cksum.c1
-rw-r--r--slirp/debug.h13
-rw-r--r--slirp/dhcpv6.c4
-rw-r--r--slirp/dnssearch.c1
-rw-r--r--slirp/if.c4
-rw-r--r--slirp/ip.h17
-rw-r--r--slirp/ip6.h14
-rw-r--r--slirp/ip6_icmp.c27
-rw-r--r--slirp/ip6_icmp.h26
-rw-r--r--slirp/ip6_input.c1
-rw-r--r--slirp/ip6_output.c2
-rw-r--r--slirp/ip_icmp.c12
-rw-r--r--slirp/ip_icmp.h18
-rw-r--r--slirp/ip_input.c5
-rw-r--r--slirp/ip_output.c1
-rw-r--r--slirp/libslirp.h71
-rw-r--r--slirp/main.h2
-rw-r--r--slirp/mbuf.c1
-rw-r--r--slirp/mbuf.h2
-rw-r--r--slirp/misc.c114
-rw-r--r--slirp/misc.h15
-rw-r--r--slirp/ncsi.c3
-rw-r--r--slirp/ndp_table.c2
-rw-r--r--slirp/qtailq.h193
-rw-r--r--slirp/sbuf.c8
-rw-r--r--slirp/sbuf.h2
-rw-r--r--slirp/slirp.c981
-rw-r--r--slirp/slirp.h45
-rw-r--r--slirp/socket.c27
-rw-r--r--slirp/socket.h9
-rw-r--r--slirp/state.c394
-rw-r--r--slirp/state.h9
-rw-r--r--slirp/tcp_input.c29
-rw-r--r--slirp/tcp_output.c13
-rw-r--r--slirp/tcp_subr.c45
-rw-r--r--slirp/tcp_timer.c3
-rw-r--r--slirp/tcp_var.h14
-rw-r--r--slirp/tftp.c16
-rw-r--r--slirp/trace-events5
-rw-r--r--slirp/udp.c14
-rw-r--r--slirp/udp.h2
-rw-r--r--slirp/udp6.c2
-rw-r--r--slirp/util.c367
-rw-r--r--slirp/util.h174
-rw-r--r--stubs/Makefile.objs7
-rw-r--r--stubs/arch-query-cpu-def.c11
-rw-r--r--stubs/arch-query-cpu-model-baseline.c13
-rw-r--r--stubs/arch-query-cpu-model-comparison.c13
-rw-r--r--stubs/arch-query-cpu-model-expansion.c13
-rw-r--r--stubs/monitor.c5
-rw-r--r--stubs/slirp.c13
-rw-r--r--stubs/tpm.c5
-rw-r--r--target/arm/Makefile.objs2
-rw-r--r--target/arm/arm-powerctl.c3
-rw-r--r--target/arm/cpu.c51
-rw-r--r--target/arm/cpu.h118
-rw-r--r--target/arm/cpu64.c81
-rw-r--r--target/arm/helper-a64.c4
-rw-r--r--target/arm/helper.c1477
-rw-r--r--target/arm/helper.h48
-rw-r--r--target/arm/internals.h27
-rw-r--r--target/arm/kvm32.c20
-rw-r--r--target/arm/kvm64.c2
-rw-r--r--target/arm/machine.c2
-rw-r--r--target/arm/monitor.c2
-rw-r--r--target/arm/neon_helper.c14
-rw-r--r--target/arm/translate-a64.c726
-rw-r--r--target/arm/translate-sve.c6
-rw-r--r--target/arm/translate.c456
-rw-r--r--target/arm/translate.h16
-rw-r--r--target/arm/vec_helper.c134
-rw-r--r--target/arm/vfp_helper.c1176
-rw-r--r--target/hppa/Makefile.objs8
-rw-r--r--target/hppa/gdbstub.c2
-rw-r--r--target/hppa/insns.decode527
-rw-r--r--target/hppa/op_helper.c30
-rw-r--r--target/hppa/translate.c3227
-rw-r--r--target/i386/cpu.c34
-rw-r--r--target/i386/cpu.h1
-rw-r--r--target/i386/gdbstub.c193
-rw-r--r--target/i386/hvf/hvf.c11
-rw-r--r--target/i386/hvf/x86_cpuid.c18
-rw-r--r--target/i386/hvf/x86_decode.c2
-rw-r--r--target/i386/kvm.c14
-rw-r--r--target/i386/sev_i386.h2
-rw-r--r--target/m68k/cpu.h4
-rw-r--r--target/m68k/fpu_helper.c4
-rw-r--r--target/m68k/gdbstub.c2
-rw-r--r--target/m68k/helper.c4
-rw-r--r--target/m68k/op_helper.c2
-rw-r--r--target/m68k/translate.c4
-rw-r--r--target/microblaze/cpu.c14
-rw-r--r--target/microblaze/cpu.h9
-rw-r--r--target/microblaze/op_helper.c22
-rw-r--r--target/mips/cpu.h342
-rw-r--r--target/mips/helper.c6
-rw-r--r--target/mips/helper.h8
-rw-r--r--target/mips/internal.h1
-rw-r--r--target/mips/machine.c10
-rw-r--r--target/mips/op_helper.c140
-rw-r--r--target/mips/translate.c1380
-rw-r--r--target/mips/translate_init.inc.c40
-rw-r--r--target/moxie/cpu.c2
-rw-r--r--target/moxie/cpu.h4
-rw-r--r--target/moxie/helper.c4
-rw-r--r--target/moxie/mmu.c4
-rw-r--r--target/moxie/translate.c4
-rw-r--r--target/openrisc/cpu.c2
-rw-r--r--target/openrisc/exception.h2
-rw-r--r--target/openrisc/gdbstub.c2
-rw-r--r--target/openrisc/helper.h2
-rw-r--r--target/openrisc/interrupt_helper.c2
-rw-r--r--target/openrisc/sys_helper.c2
-rw-r--r--target/openrisc/translate.c2
-rw-r--r--target/ppc/arch_dump.c3
-rw-r--r--target/ppc/cpu-qom.h4
-rw-r--r--target/ppc/cpu.h15
-rw-r--r--target/ppc/excp_helper.c12
-rw-r--r--target/ppc/gdbstub.c61
-rw-r--r--target/ppc/helper.h57
-rw-r--r--target/ppc/int_helper.c638
-rw-r--r--target/ppc/internal.h9
-rw-r--r--target/ppc/kvm.c1
-rw-r--r--target/ppc/machine.c44
-rw-r--r--target/ppc/mmu_helper.c12
-rw-r--r--target/ppc/translate.c49
-rw-r--r--target/ppc/translate/vmx-impl.inc.c251
-rw-r--r--target/ppc/translate/vsx-impl.inc.c147
-rw-r--r--target/ppc/translate_init.inc.c82
-rw-r--r--target/riscv/cpu.c2
-rw-r--r--target/riscv/cpu.h31
-rw-r--r--target/riscv/cpu_bits.h11
-rw-r--r--target/riscv/cpu_helper.c10
-rw-r--r--target/riscv/csr.c103
-rw-r--r--target/riscv/fpu_helper.c6
-rw-r--r--target/riscv/op_helper.c47
-rw-r--r--target/riscv/translate.c290
-rw-r--r--target/s390x/cc_helper.c2
-rw-r--r--target/s390x/cpu.c19
-rw-r--r--target/s390x/cpu.h23
-rw-r--r--target/s390x/cpu_features.c2
-rw-r--r--target/s390x/cpu_models.c43
-rw-r--r--target/s390x/cpu_models.h2
-rw-r--r--target/s390x/diag.c2
-rw-r--r--target/s390x/excp_helper.c2
-rw-r--r--target/s390x/fpu_helper.c2
-rw-r--r--target/s390x/gdbstub.c2
-rw-r--r--target/s390x/gen-features.c18
-rw-r--r--target/s390x/helper.c2
-rw-r--r--target/s390x/helper.h2
-rw-r--r--target/s390x/insn-data.def161
-rw-r--r--target/s390x/int_helper.c2
-rw-r--r--target/s390x/kvm.c30
-rw-r--r--target/s390x/mem_helper.c2
-rw-r--r--target/s390x/misc_helper.c36
-rw-r--r--target/s390x/s390-tod.h29
-rw-r--r--target/s390x/trace-events1
-rw-r--r--target/s390x/translate.c139
-rw-r--r--target/tricore/cpu-qom.h2
-rw-r--r--target/tricore/cpu.c2
-rw-r--r--target/tricore/cpu.h2
-rw-r--r--target/tricore/fpu_helper.c2
-rw-r--r--target/tricore/helper.c2
-rw-r--r--target/tricore/helper.h2
-rw-r--r--target/tricore/op_helper.c2
-rw-r--r--target/tricore/translate.c2
-rw-r--r--target/tricore/tricore-defs.h2
-rw-r--r--target/tricore/tricore-opcodes.h2
-rw-r--r--target/xtensa/Makefile.objs6
-rw-r--r--target/xtensa/core-test_mmuhifi_c3.c53
-rw-r--r--target/xtensa/core-test_mmuhifi_c3/core-isa.h384
-rw-r--r--target/xtensa/core-test_mmuhifi_c3/gdb-config.inc.c140
-rw-r--r--target/xtensa/core-test_mmuhifi_c3/xtensa-modules.inc.c36403
-rw-r--r--target/xtensa/cpu.h40
-rw-r--r--target/xtensa/dbg_helper.c129
-rw-r--r--target/xtensa/exc_helper.c271
-rw-r--r--target/xtensa/fpu_helper.c166
-rw-r--r--target/xtensa/helper.c637
-rw-r--r--target/xtensa/helper.h5
-rw-r--r--target/xtensa/mmu_helper.c818
-rw-r--r--target/xtensa/op_helper.c896
-rw-r--r--target/xtensa/overlay_tool.h1
-rw-r--r--target/xtensa/translate.c67
-rw-r--r--target/xtensa/win_helper.c222
-rw-r--r--tcg/README19
-rw-r--r--tcg/aarch64/tcg-target.h2
-rw-r--r--tcg/aarch64/tcg-target.inc.c148
-rw-r--r--tcg/arm/tcg-target.inc.c139
-rw-r--r--tcg/i386/tcg-target.h2
-rw-r--r--tcg/i386/tcg-target.inc.c590
-rw-r--r--tcg/mips/tcg-target.inc.c97
-rw-r--r--tcg/ppc/tcg-target.inc.c97
-rw-r--r--tcg/riscv/tcg-target.inc.c124
-rw-r--r--tcg/s390/tcg-target.inc.c45
-rw-r--r--tcg/sparc/tcg-target.inc.c82
-rw-r--r--tcg/tcg-gvec-desc.h2
-rw-r--r--tcg/tcg-op-gvec.c307
-rw-r--r--tcg/tcg-op-gvec.h20
-rw-r--r--tcg/tcg-op-vec.c77
-rw-r--r--tcg/tcg-op.h12
-rw-r--r--tcg/tcg-opc.h8
-rw-r--r--tcg/tcg.c33
-rw-r--r--tcg/tcg.h14
-rw-r--r--tests/Makefile.include202
-rw-r--r--tests/acceptance/linux_initrd.py48
-rw-r--r--tests/acpi-utils.c35
-rw-r--r--tests/acpi-utils.h44
-rw-r--r--tests/bios-tables-test.c261
-rw-r--r--tests/boot-order-test.c59
-rw-r--r--tests/check-qjson.c5
-rw-r--r--tests/data/acpi/pc/DSDT.dimmpxmbin6790 -> 6784 bytes
-rw-r--r--tests/data/acpi/pc/DSDT.memhpbin6496 -> 6490 bytes
-rw-r--r--tests/data/acpi/q35/DSDT.dimmpxmbin9474 -> 9468 bytes
-rw-r--r--tests/data/acpi/q35/DSDT.memhpbin9180 -> 9174 bytes
-rw-r--r--tests/data/acpi/q35/DSDT.mmio64bin8947 -> 8945 bytes
-rw-r--r--tests/docker/Makefile.include1
-rwxr-xr-xtests/docker/docker.py110
-rw-r--r--tests/docker/dockerfiles/centos7.docker5
-rw-r--r--tests/docker/dockerfiles/debian-buster-arm64-cross.docker15
-rw-r--r--tests/docker/dockerfiles/debian10.docker31
-rwxr-xr-xtests/docker/test-mingw3
-rw-r--r--tests/endianness-test.c329
-rw-r--r--tests/fp/Makefile3
m---------tests/fp/berkeley-testfloat-30
-rw-r--r--tests/fp/fp-bench.c15
-rw-r--r--tests/fp/fp-test.c4
-rw-r--r--tests/fp/platform.h1
-rw-r--r--tests/hexloader-test.c2
-rw-r--r--tests/ivshmem-test.c67
-rw-r--r--tests/libqtest.c29
-rw-r--r--tests/libqtest.h11
-rw-r--r--tests/microbit-test.c458
-rw-r--r--tests/pnv-xscom-test.c29
-rw-r--r--tests/qapi-schema/comments.out1
-rw-r--r--tests/qapi-schema/doc-bad-section.out1
-rw-r--r--tests/qapi-schema/doc-good.out1
-rw-r--r--tests/qapi-schema/empty.out1
-rw-r--r--tests/qapi-schema/event-case.out1
-rw-r--r--tests/qapi-schema/ident-with-escape.out1
-rw-r--r--tests/qapi-schema/include-relpath.out1
-rw-r--r--tests/qapi-schema/include-repetition.out1
-rw-r--r--tests/qapi-schema/include-simple.out1
-rw-r--r--tests/qapi-schema/indented-expr.out1
-rw-r--r--tests/qapi-schema/qapi-schema-test.out1
-rwxr-xr-xtests/qemu-iotests/1241
-rw-r--r--tests/qemu-iotests/141.out4
-rwxr-xr-xtests/qemu-iotests/14798
-rwxr-xr-xtests/qemu-iotests/2232
-rw-r--r--tests/qemu-iotests/223.out20
-rwxr-xr-xtests/qemu-iotests/2296
-rw-r--r--tests/qemu-iotests/229.out1
-rwxr-xr-xtests/qemu-iotests/23330
-rw-r--r--tests/qemu-iotests/233.out19
-rwxr-xr-xtests/qemu-iotests/23456
-rw-r--r--tests/qemu-iotests/234.out10
-rw-r--r--tests/qemu-iotests/236.out70
-rwxr-xr-xtests/qemu-iotests/237237
-rw-r--r--tests/qemu-iotests/237.out348
-rwxr-xr-xtests/qemu-iotests/23847
-rw-r--r--tests/qemu-iotests/238.out6
-rwxr-xr-xtests/qemu-iotests/23953
-rw-r--r--tests/qemu-iotests/239.out4
-rwxr-xr-xtests/qemu-iotests/240129
-rw-r--r--tests/qemu-iotests/240.out54
-rwxr-xr-xtests/qemu-iotests/242104
-rw-r--r--tests/qemu-iotests/242.out166
-rwxr-xr-xtests/qemu-iotests/check7
-rw-r--r--tests/qemu-iotests/common.filter1
-rw-r--r--tests/qemu-iotests/group5
-rw-r--r--tests/qemu-iotests/iotests.py36
-rw-r--r--tests/qemu-iotests/sample_images/simple-dmg.dmg.bz2bin0 -> 3479 bytes
-rw-r--r--tests/tcg/aarch64/Makefile.include2
-rw-r--r--tests/tcg/aarch64/Makefile.target6
-rw-r--r--tests/tcg/aarch64/pauth-1.c23
-rw-r--r--tests/tcg/mips/include/test_inputs.h122
-rw-r--r--tests/tcg/mips/include/test_utils.h78
-rw-r--r--tests/tcg/mips/include/wrappers_msa.h101
-rw-r--r--tests/tcg/mips/mips32-dsp/Makefile136
-rw-r--r--tests/tcg/mips/mips32-dspr2/Makefile71
-rw-r--r--tests/tcg/mips/mips64-dsp/Makefile306
-rw-r--r--tests/tcg/mips/mips64-dsp/absq_s_ob.c63
-rw-r--r--tests/tcg/mips/mips64-dsp/absq_s_ph.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/absq_s_pw.c66
-rw-r--r--tests/tcg/mips/mips64-dsp/absq_s_qh.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/absq_s_w.c48
-rw-r--r--tests/tcg/mips/mips64-dsp/addq_ph.c57
-rw-r--r--tests/tcg/mips/mips64-dsp/addq_pw.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/addq_qh.c28
-rw-r--r--tests/tcg/mips/mips64-dsp/addq_s_ph.c84
-rw-r--r--tests/tcg/mips/mips64-dsp/addq_s_pw.c45
-rw-r--r--tests/tcg/mips/mips64-dsp/addq_s_qh.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/addq_s_w.c48
-rw-r--r--tests/tcg/mips/mips64-dsp/addsc.c39
-rw-r--r--tests/tcg/mips/mips64-dsp/addu_ob.c28
-rw-r--r--tests/tcg/mips/mips64-dsp/addu_qb.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/addu_s_ob.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/addu_s_qb.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/addwc.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/bitrev.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/bposge32.c50
-rw-r--r--tests/tcg/mips/mips64-dsp/bposge64.c50
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_eq_ph.c42
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_eq_pw.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_eq_qh.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_le_ph.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_le_pw.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_le_qh.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_lt_ph.c41
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_lt_pw.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/cmp_lt_qh.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpgu_eq_ob.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpgu_eq_qb.c38
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpgu_le_ob.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpgu_le_qb.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpgu_lt_ob.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpgu_lt_qb.c38
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpu_eq_ob.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpu_eq_qb.c42
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpu_le_ob.c44
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpu_le_qb.c41
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpu_lt_ob.c44
-rw-r--r--tests/tcg/mips/mips64-dsp/cmpu_lt_qb.c42
-rw-r--r--tests/tcg/mips/mips64-dsp/dappend.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/dextp.c54
-rw-r--r--tests/tcg/mips/mips64-dsp/dextpdp.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/dextpdpv.c63
-rw-r--r--tests/tcg/mips/mips64-dsp/dextpv.c58
-rw-r--r--tests/tcg/mips/mips64-dsp/dextr_l.c44
-rw-r--r--tests/tcg/mips/mips64-dsp/dextr_r_l.c54
-rw-r--r--tests/tcg/mips/mips64-dsp/dextr_r_w.c54
-rw-r--r--tests/tcg/mips/mips64-dsp/dextr_rs_l.c52
-rw-r--r--tests/tcg/mips/mips64-dsp/dextr_rs_w.c52
-rw-r--r--tests/tcg/mips/mips64-dsp/dextr_s_h.c73
-rw-r--r--tests/tcg/mips/mips64-dsp/dextr_w.c44
-rw-r--r--tests/tcg/mips/mips64-dsp/dextrv_l.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/dextrv_r_l.c56
-rw-r--r--tests/tcg/mips/mips64-dsp/dextrv_r_w.c56
-rw-r--r--tests/tcg/mips/mips64-dsp/dextrv_rs_l.c54
-rw-r--r--tests/tcg/mips/mips64-dsp/dextrv_rs_w.c54
-rw-r--r--tests/tcg/mips/mips64-dsp/dextrv_s_h.c32
-rw-r--r--tests/tcg/mips/mips64-dsp/dextrv_w.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/dinsv.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/dmadd.c57
-rw-r--r--tests/tcg/mips/mips64-dsp/dmaddu.c56
-rw-r--r--tests/tcg/mips/mips64-dsp/dmsub.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/dmsubu.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/dmthlip.c41
-rw-r--r--tests/tcg/mips/mips64-dsp/dpaq_s_w_ph.c32
-rw-r--r--tests/tcg/mips/mips64-dsp/dpaq_s_w_qh.c57
-rw-r--r--tests/tcg/mips/mips64-dsp/dpaq_sa_l_pw.c88
-rw-r--r--tests/tcg/mips/mips64-dsp/dpaq_sa_l_w.c82
-rw-r--r--tests/tcg/mips/mips64-dsp/dpau_h_obl.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/dpau_h_obr.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/dpau_h_qbl.c29
-rw-r--r--tests/tcg/mips/mips64-dsp/dpau_h_qbr.c29
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsq_s_w_ph.c51
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsq_s_w_qh.c56
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsq_sa_l_pw.c76
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsq_sa_l_w.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsu_h_obl.c32
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsu_h_obr.c32
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsu_h_qbl.c29
-rw-r--r--tests/tcg/mips/mips64-dsp/dpsu_h_qbr.c29
-rw-r--r--tests/tcg/mips/mips64-dsp/dshilo.c52
-rw-r--r--tests/tcg/mips/mips64-dsp/dshilov.c54
-rw-r--r--tests/tcg/mips/mips64-dsp/extp.c50
-rw-r--r--tests/tcg/mips/mips64-dsp/extpdp.c51
-rw-r--r--tests/tcg/mips/mips64-dsp/extpdpv.c52
-rw-r--r--tests/tcg/mips/mips64-dsp/extpv.c51
-rw-r--r--tests/tcg/mips/mips64-dsp/extr_r_w.c53
-rw-r--r--tests/tcg/mips/mips64-dsp/extr_rs_w.c53
-rw-r--r--tests/tcg/mips/mips64-dsp/extr_s_h.c71
-rw-r--r--tests/tcg/mips/mips64-dsp/extr_w.c53
-rw-r--r--tests/tcg/mips/mips64-dsp/extrv_r_w.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/extrv_rs_w.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/extrv_s_h.c79
-rw-r--r--tests/tcg/mips/mips64-dsp/extrv_w.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/head.S16
-rw-r--r--tests/tcg/mips/mips64-dsp/insv.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/io.h22
-rw-r--r--tests/tcg/mips/mips64-dsp/lbux.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/ldx.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/lhx.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/lwx.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/madd.c33
-rw-r--r--tests/tcg/mips/mips64-dsp/maddu.c33
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_l_pwl.c56
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_l_pwr.c56
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_w_phl.c60
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_w_phr.c60
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_w_qhll.c62
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_w_qhlr.c62
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_w_qhrl.c63
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_s_w_qhrr.c63
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_sa_w_phl.c60
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_sa_w_phr.c60
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_sa_w_qhll.c62
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_sa_w_qhlr.c64
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_sa_w_qhrl.c64
-rw-r--r--tests/tcg/mips/mips64-dsp/maq_sa_w_qhrr.c64
-rw-r--r--tests/tcg/mips/mips64-dsp/mfhi.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/mflo.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/mips_boot.lds31
-rw-r--r--tests/tcg/mips/mips64-dsp/modsub.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/msub.c32
-rw-r--r--tests/tcg/mips/mips64-dsp/msubu.c32
-rw-r--r--tests/tcg/mips/mips64-dsp/mthi.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/mthlip.c61
-rw-r--r--tests/tcg/mips/mips64-dsp/mtlo.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/muleq_s_pw_qhl.c56
-rw-r--r--tests/tcg/mips/mips64-dsp/muleq_s_pw_qhr.c57
-rw-r--r--tests/tcg/mips/mips64-dsp/muleq_s_w_phl.c46
-rw-r--r--tests/tcg/mips/mips64-dsp/muleq_s_w_phr.c45
-rw-r--r--tests/tcg/mips/mips64-dsp/muleu_s_ph_qbl.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/muleu_s_ph_qbr.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/muleu_s_qh_obl.c30
-rw-r--r--tests/tcg/mips/mips64-dsp/muleu_s_qh_obr.c31
-rw-r--r--tests/tcg/mips/mips64-dsp/mulq_rs_ph.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/mulq_rs_qh.c33
-rw-r--r--tests/tcg/mips/mips64-dsp/mulsaq_s_l_pw.c59
-rw-r--r--tests/tcg/mips/mips64-dsp/mulsaq_s_w_qh.c57
-rw-r--r--tests/tcg/mips/mips64-dsp/mult.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/multu.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/packrl_ph.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/packrl_pw.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/pick_ob.c66
-rw-r--r--tests/tcg/mips/mips64-dsp/pick_ph.c60
-rw-r--r--tests/tcg/mips/mips64-dsp/pick_pw.c48
-rw-r--r--tests/tcg/mips/mips64-dsp/pick_qb.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/pick_qh.c48
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_l_pwl.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_l_pwr.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_pw_qhl.c21
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_pw_qhla.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_pw_qhr.c21
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_pw_qhra.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_w_phl.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceq_w_phr.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_ph_qbl.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_ph_qbla.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_ph_qbr.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_ph_qbra.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_qh_obl.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_qh_obla.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_qh_obr.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/precequ_qh_obra.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_ph_qbl.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_ph_qbla.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_ph_qbr.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_ph_qbra.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_qh_obl.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_qh_obla.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_qh_obr.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/preceu_qh_obra.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/precr_ob_qh.c25
-rw-r--r--tests/tcg/mips/mips64-dsp/precr_sra_qh_pw.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/precr_sra_r_qh_pw.c40
-rw-r--r--tests/tcg/mips/mips64-dsp/precrq_ob_qh.c25
-rw-r--r--tests/tcg/mips/mips64-dsp/precrq_ph_w.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/precrq_pw_l.c25
-rw-r--r--tests/tcg/mips/mips64-dsp/precrq_qb_ph.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/precrq_qh_pw.c25
-rw-r--r--tests/tcg/mips/mips64-dsp/precrq_rs_ph_w.c41
-rw-r--r--tests/tcg/mips/mips64-dsp/precrq_rs_qh_pw.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/precrqu_s_ob_qh.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/precrqu_s_qb_ph.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/prependd.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/prependw.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/printf.c266
-rw-r--r--tests/tcg/mips/mips64-dsp/raddu_l_ob.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/raddu_w_qb.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/rddsp.c53
-rw-r--r--tests/tcg/mips/mips64-dsp/repl_ob.c21
-rw-r--r--tests/tcg/mips/mips64-dsp/repl_ph.c30
-rw-r--r--tests/tcg/mips/mips64-dsp/repl_pw.c34
-rw-r--r--tests/tcg/mips/mips64-dsp/repl_qb.c19
-rw-r--r--tests/tcg/mips/mips64-dsp/repl_qh.c34
-rw-r--r--tests/tcg/mips/mips64-dsp/replv_ob.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/replv_ph.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/replv_pw.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/replv_qb.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/shilo.c29
-rw-r--r--tests/tcg/mips/mips64-dsp/shilov.c31
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_ob.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_ph.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_pw.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_qb.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_qh.c42
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_s_ph.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_s_pw.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_s_qh.c43
-rw-r--r--tests/tcg/mips/mips64-dsp/shll_s_w.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_ob.c45
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_ph.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_pw.c45
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_qb.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_qh.c45
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_s_ph.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_s_pw.c45
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_s_qh.c45
-rw-r--r--tests/tcg/mips/mips64-dsp/shllv_s_w.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_ob.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_ph.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_pw.c36
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_qh.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_r_ob.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_r_ph.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_r_pw.c36
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_r_qh.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/shra_r_w.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/shrav_ph.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/shrav_pw.c38
-rw-r--r--tests/tcg/mips/mips64-dsp/shrav_qh.c39
-rw-r--r--tests/tcg/mips/mips64-dsp/shrav_r_ph.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/shrav_r_pw.c37
-rw-r--r--tests/tcg/mips/mips64-dsp/shrav_r_qh.c39
-rw-r--r--tests/tcg/mips/mips64-dsp/shrav_r_w.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/shrl_ob.c38
-rw-r--r--tests/tcg/mips/mips64-dsp/shrl_qb.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/shrl_qh.c22
-rw-r--r--tests/tcg/mips/mips64-dsp/shrlv_ob.c39
-rw-r--r--tests/tcg/mips/mips64-dsp/shrlv_qb.c24
-rw-r--r--tests/tcg/mips/mips64-dsp/shrlv_qh.c23
-rw-r--r--tests/tcg/mips/mips64-dsp/subq_ph.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/subq_pw.c44
-rw-r--r--tests/tcg/mips/mips64-dsp/subq_qh.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/subq_s_ph.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/subq_s_pw.c63
-rw-r--r--tests/tcg/mips/mips64-dsp/subq_s_qh.c61
-rw-r--r--tests/tcg/mips/mips64-dsp/subq_s_w.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/subu_ob.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/subu_qb.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/subu_s_ob.c26
-rw-r--r--tests/tcg/mips/mips64-dsp/subu_s_qb.c27
-rw-r--r--tests/tcg/mips/mips64-dsp/wrdsp.c48
-rw-r--r--tests/tcg/mips/mips64-dspr2/.directory2
-rw-r--r--tests/tcg/mips/mips64-dspr2/Makefile116
-rw-r--r--tests/tcg/mips/mips64-dspr2/absq_s_qb.c42
-rw-r--r--tests/tcg/mips/mips64-dspr2/addqh_ph.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/addqh_r_ph.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/addqh_r_w.c38
-rw-r--r--tests/tcg/mips/mips64-dspr2/addqh_w.c39
-rw-r--r--tests/tcg/mips/mips64-dspr2/addu_ph.c37
-rw-r--r--tests/tcg/mips/mips64-dspr2/addu_qh.c43
-rw-r--r--tests/tcg/mips/mips64-dspr2/addu_s_ph.c37
-rw-r--r--tests/tcg/mips/mips64-dspr2/addu_s_qh.c43
-rw-r--r--tests/tcg/mips/mips64-dspr2/adduh_ob.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/adduh_qb.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/adduh_r_ob.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/adduh_r_qb.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/append.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/balign.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/cmpgdu_eq_ob.c44
-rw-r--r--tests/tcg/mips/mips64-dspr2/cmpgdu_eq_qb.c41
-rw-r--r--tests/tcg/mips/mips64-dspr2/cmpgdu_le_ob.c44
-rw-r--r--tests/tcg/mips/mips64-dspr2/cmpgdu_le_qb.c48
-rw-r--r--tests/tcg/mips/mips64-dspr2/cmpgdu_lt_ob.c44
-rw-r--r--tests/tcg/mips/mips64-dspr2/cmpgdu_lt_qb.c48
-rw-r--r--tests/tcg/mips/mips64-dspr2/dbalign.c39
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpa_w_ph.c47
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpa_w_qh.c56
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpaqx_s_w_ph.c97
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpaqx_sa_w_ph.c54
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpax_w_ph.c32
-rw-r--r--tests/tcg/mips/mips64-dspr2/dps_w_ph.c28
-rw-r--r--tests/tcg/mips/mips64-dspr2/dps_w_qh.c55
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpsqx_s_w_ph.c55
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpsqx_sa_w_ph.c53
-rw-r--r--tests/tcg/mips/mips64-dspr2/dpsx_w_ph.c28
-rw-r--r--tests/tcg/mips/mips64-dspr2/head.S16
-rw-r--r--tests/tcg/mips/mips64-dspr2/io.h22
-rw-r--r--tests/tcg/mips/mips64-dspr2/mips_boot.lds31
-rw-r--r--tests/tcg/mips/mips64-dspr2/mul_ph.c50
-rw-r--r--tests/tcg/mips/mips64-dspr2/mul_s_ph.c67
-rw-r--r--tests/tcg/mips/mips64-dspr2/mulq_rs_w.c40
-rw-r--r--tests/tcg/mips/mips64-dspr2/mulq_s_ph.c26
-rw-r--r--tests/tcg/mips/mips64-dspr2/mulq_s_w.c40
-rw-r--r--tests/tcg/mips/mips64-dspr2/mulsa_w_ph.c30
-rw-r--r--tests/tcg/mips/mips64-dspr2/mulsaq_s_w_ph.c30
-rw-r--r--tests/tcg/mips/mips64-dspr2/precr_qb_ph.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/precr_sra_ph_w.c37
-rw-r--r--tests/tcg/mips/mips64-dspr2/precr_sra_r_ph_w.c37
-rw-r--r--tests/tcg/mips/mips64-dspr2/prepend.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/printf.c266
-rw-r--r--tests/tcg/mips/mips64-dspr2/shra_qb.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/shra_r_qb.c35
-rw-r--r--tests/tcg/mips/mips64-dspr2/shrav_ob.c22
-rw-r--r--tests/tcg/mips/mips64-dspr2/shrav_qb.c37
-rw-r--r--tests/tcg/mips/mips64-dspr2/shrav_r_ob.c22
-rw-r--r--tests/tcg/mips/mips64-dspr2/shrav_r_qb.c37
-rw-r--r--tests/tcg/mips/mips64-dspr2/shrl_ph.c22
-rw-r--r--tests/tcg/mips/mips64-dspr2/shrlv_ph.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/subqh_ph.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/subqh_r_ph.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/subqh_r_w.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/subqh_w.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/subu_ph.c26
-rw-r--r--tests/tcg/mips/mips64-dspr2/subu_qh.c24
-rw-r--r--tests/tcg/mips/mips64-dspr2/subu_s_ph.c25
-rw-r--r--tests/tcg/mips/mips64-dspr2/subu_s_qh.c42
-rw-r--r--tests/tcg/mips/mips64-dspr2/subuh_ob.c36
-rw-r--r--tests/tcg/mips/mips64-dspr2/subuh_qb.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/subuh_r_ob.c23
-rw-r--r--tests/tcg/mips/mips64-dspr2/subuh_r_qb.c37
-rw-r--r--tests/tcg/mips/user/ase/dsp/Makefile184
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_absq_s_ph.c (renamed from tests/tcg/mips/mips32-dsp/absq_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_absq_s_w.c (renamed from tests/tcg/mips/mips32-dsp/absq_s_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_addq_ph.c (renamed from tests/tcg/mips/mips32-dsp/addq_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_addq_s_ph.c (renamed from tests/tcg/mips/mips32-dsp/addq_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_addq_s_w.c (renamed from tests/tcg/mips/mips32-dsp/addq_s_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_addsc.c (renamed from tests/tcg/mips/mips32-dsp/addsc.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_addu_qb.c (renamed from tests/tcg/mips/mips32-dsp/addu_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_addu_s_qb.c (renamed from tests/tcg/mips/mips32-dsp/addu_s_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_addwc.c (renamed from tests/tcg/mips/mips32-dsp/addwc.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_bitrev.c (renamed from tests/tcg/mips/mips32-dsp/bitrev.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_bposge32.c (renamed from tests/tcg/mips/mips32-dsp/bposge32.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmp_eq_ph.c (renamed from tests/tcg/mips/mips32-dsp/cmp_eq_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmp_le_ph.c (renamed from tests/tcg/mips/mips32-dsp/cmp_le_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmp_lt_ph.c (renamed from tests/tcg/mips/mips32-dsp/cmp_lt_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmpgu_eq_qb.c (renamed from tests/tcg/mips/mips32-dsp/cmpgu_eq_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmpgu_le_qb.c (renamed from tests/tcg/mips/mips32-dsp/cmpgu_le_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmpgu_lt_qb.c (renamed from tests/tcg/mips/mips32-dsp/cmpgu_lt_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmpu_eq_qb.c (renamed from tests/tcg/mips/mips32-dsp/cmpu_eq_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmpu_le_qb.c (renamed from tests/tcg/mips/mips32-dsp/cmpu_le_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_cmpu_lt_qb.c (renamed from tests/tcg/mips/mips32-dsp/cmpu_lt_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpaq_s_w_ph.c (renamed from tests/tcg/mips/mips32-dsp/dpaq_s_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpaq_sa_l_w.c (renamed from tests/tcg/mips/mips32-dsp/dpaq_sa_l_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpau_h_qbl.c (renamed from tests/tcg/mips/mips32-dsp/dpau_h_qbl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpau_h_qbr.c (renamed from tests/tcg/mips/mips32-dsp/dpau_h_qbr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpsq_s_w_ph.c (renamed from tests/tcg/mips/mips32-dsp/dpsq_s_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpsq_sa_l_w.c (renamed from tests/tcg/mips/mips32-dsp/dpsq_sa_l_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpsu_h_qbl.c (renamed from tests/tcg/mips/mips32-dsp/dpsu_h_qbl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_dpsu_h_qbr.c (renamed from tests/tcg/mips/mips32-dsp/dpsu_h_qbr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extp.c (renamed from tests/tcg/mips/mips32-dsp/extp.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extpdp.c (renamed from tests/tcg/mips/mips32-dsp/extpdp.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extpdpv.c (renamed from tests/tcg/mips/mips32-dsp/extpdpv.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extpv.c (renamed from tests/tcg/mips/mips32-dsp/extpv.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extr_r_w.c (renamed from tests/tcg/mips/mips32-dsp/extr_r_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extr_rs_w.c (renamed from tests/tcg/mips/mips32-dsp/extr_rs_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extr_s_h.c (renamed from tests/tcg/mips/mips32-dsp/extr_s_h.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extr_w.c (renamed from tests/tcg/mips/mips32-dsp/extr_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extrv_r_w.c (renamed from tests/tcg/mips/mips32-dsp/extrv_r_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extrv_rs_w.c (renamed from tests/tcg/mips/mips32-dsp/extrv_rs_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extrv_s_h.c (renamed from tests/tcg/mips/mips32-dsp/extrv_s_h.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_extrv_w.c (renamed from tests/tcg/mips/mips32-dsp/extrv_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_insv.c (renamed from tests/tcg/mips/mips32-dsp/insv.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_lbux.c (renamed from tests/tcg/mips/mips32-dsp/lbux.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_lhx.c (renamed from tests/tcg/mips/mips32-dsp/lhx.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_lwx.c (renamed from tests/tcg/mips/mips32-dsp/lwx.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_madd.c (renamed from tests/tcg/mips/mips32-dsp/madd.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_maddu.c (renamed from tests/tcg/mips/mips32-dsp/maddu.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_main.c (renamed from tests/tcg/mips/mips32-dsp/main.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_maq_s_w_phl.c (renamed from tests/tcg/mips/mips32-dsp/maq_s_w_phl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_maq_s_w_phr.c (renamed from tests/tcg/mips/mips32-dsp/maq_s_w_phr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_maq_sa_w_phl.c (renamed from tests/tcg/mips/mips32-dsp/maq_sa_w_phl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_maq_sa_w_phr.c (renamed from tests/tcg/mips/mips32-dsp/maq_sa_w_phr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_mfhi.c (renamed from tests/tcg/mips/mips32-dsp/mfhi.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_mflo.c (renamed from tests/tcg/mips/mips32-dsp/mflo.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_modsub.c (renamed from tests/tcg/mips/mips32-dsp/modsub.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_msub.c (renamed from tests/tcg/mips/mips32-dsp/msub.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_msubu.c (renamed from tests/tcg/mips/mips32-dsp/msubu.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_mthi.c (renamed from tests/tcg/mips/mips32-dsp/mthi.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_mthlip.c (renamed from tests/tcg/mips/mips32-dsp/mthlip.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_mtlo.c (renamed from tests/tcg/mips/mips32-dsp/mtlo.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_muleq_s_w_phl.c (renamed from tests/tcg/mips/mips32-dsp/muleq_s_w_phl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_muleq_s_w_phr.c (renamed from tests/tcg/mips/mips32-dsp/muleq_s_w_phr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_muleu_s_ph_qbl.c (renamed from tests/tcg/mips/mips32-dsp/muleu_s_ph_qbl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_muleu_s_ph_qbr.c (renamed from tests/tcg/mips/mips32-dsp/muleu_s_ph_qbr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_mulq_rs_ph.c (renamed from tests/tcg/mips/mips32-dsp/mulq_rs_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_mult.c (renamed from tests/tcg/mips/mips32-dsp/mult.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_multu.c (renamed from tests/tcg/mips/mips32-dsp/multu.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_packrl_ph.c (renamed from tests/tcg/mips/mips32-dsp/packrl_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_pick_ph.c (renamed from tests/tcg/mips/mips32-dsp/pick_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_pick_qb.c (renamed from tests/tcg/mips/mips32-dsp/pick_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_preceq_w_phl.c (renamed from tests/tcg/mips/mips32-dsp/preceq_w_phl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_preceq_w_phr.c (renamed from tests/tcg/mips/mips32-dsp/preceq_w_phr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precequ_ph_qbl.c (renamed from tests/tcg/mips/mips32-dsp/precequ_ph_qbl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precequ_ph_qbla.c (renamed from tests/tcg/mips/mips32-dsp/precequ_ph_qbla.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precequ_ph_qbr.c (renamed from tests/tcg/mips/mips32-dsp/precequ_ph_qbr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precequ_ph_qbra.c (renamed from tests/tcg/mips/mips32-dsp/precequ_ph_qbra.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_preceu_ph_qbl.c (renamed from tests/tcg/mips/mips32-dsp/preceu_ph_qbl.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_preceu_ph_qbla.c (renamed from tests/tcg/mips/mips32-dsp/preceu_ph_qbla.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_preceu_ph_qbr.c (renamed from tests/tcg/mips/mips32-dsp/preceu_ph_qbr.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_preceu_ph_qbra.c (renamed from tests/tcg/mips/mips32-dsp/preceu_ph_qbra.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precrq_ph_w.c (renamed from tests/tcg/mips/mips32-dsp/precrq_ph_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precrq_qb_ph.c (renamed from tests/tcg/mips/mips32-dsp/precrq_qb_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precrq_rs_ph_w.c (renamed from tests/tcg/mips/mips32-dsp/precrq_rs_ph_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_precrqu_s_qb_ph.c (renamed from tests/tcg/mips/mips32-dsp/precrqu_s_qb_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_raddu_w_qb.c (renamed from tests/tcg/mips/mips32-dsp/raddu_w_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_rddsp.c (renamed from tests/tcg/mips/mips32-dsp/rddsp.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_repl_ph.c (renamed from tests/tcg/mips/mips32-dsp/repl_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_repl_qb.c (renamed from tests/tcg/mips/mips32-dsp/repl_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_replv_ph.c (renamed from tests/tcg/mips/mips32-dsp/replv_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_replv_qb.c (renamed from tests/tcg/mips/mips32-dsp/replv_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shilo.c (renamed from tests/tcg/mips/mips32-dsp/shilo.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shilov.c (renamed from tests/tcg/mips/mips32-dsp/shilov.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shll_ph.c (renamed from tests/tcg/mips/mips32-dsp/shll_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shll_qb.c (renamed from tests/tcg/mips/mips32-dsp/shll_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shll_s_ph.c (renamed from tests/tcg/mips/mips32-dsp/shll_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shll_s_w.c (renamed from tests/tcg/mips/mips32-dsp/shll_s_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shllv_ph.c (renamed from tests/tcg/mips/mips32-dsp/shllv_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shllv_qb.c (renamed from tests/tcg/mips/mips32-dsp/shllv_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shllv_s_ph.c (renamed from tests/tcg/mips/mips32-dsp/shllv_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shllv_s_w.c (renamed from tests/tcg/mips/mips32-dsp/shllv_s_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shra_ph.c (renamed from tests/tcg/mips/mips32-dsp/shra_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shra_r_ph.c (renamed from tests/tcg/mips/mips32-dsp/shra_r_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shra_r_w.c (renamed from tests/tcg/mips/mips32-dsp/shra_r_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shrav_ph.c (renamed from tests/tcg/mips/mips32-dsp/shrav_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shrav_r_ph.c (renamed from tests/tcg/mips/mips32-dsp/shrav_r_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shrav_r_w.c (renamed from tests/tcg/mips/mips32-dsp/shrav_r_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shrl_qb.c (renamed from tests/tcg/mips/mips32-dsp/shrl_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_shrlv_qb.c (renamed from tests/tcg/mips/mips32-dsp/shrlv_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_subq_ph.c (renamed from tests/tcg/mips/mips32-dsp/subq_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_subq_s_ph.c (renamed from tests/tcg/mips/mips32-dsp/subq_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_subq_s_w.c (renamed from tests/tcg/mips/mips32-dsp/subq_s_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_subu_qb.c (renamed from tests/tcg/mips/mips32-dsp/subu_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_subu_s_qb.c (renamed from tests/tcg/mips/mips32-dsp/subu_s_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r1_wrdsp.c (renamed from tests/tcg/mips/mips32-dsp/wrdsp.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_absq_s_qb.c (renamed from tests/tcg/mips/mips32-dspr2/absq_s_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_addqh_ph.c (renamed from tests/tcg/mips/mips32-dspr2/addqh_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_addqh_r_ph.c (renamed from tests/tcg/mips/mips32-dspr2/addqh_r_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_addqh_r_w.c (renamed from tests/tcg/mips/mips32-dspr2/addqh_r_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_addqh_w.c (renamed from tests/tcg/mips/mips32-dspr2/addqh_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_addu_ph.c (renamed from tests/tcg/mips/mips32-dspr2/addu_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_addu_s_ph.c (renamed from tests/tcg/mips/mips32-dspr2/addu_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_adduh_qb.c (renamed from tests/tcg/mips/mips32-dspr2/adduh_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_adduh_r_qb.c (renamed from tests/tcg/mips/mips32-dspr2/adduh_r_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_append.c (renamed from tests/tcg/mips/mips32-dspr2/append.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_balign.c (renamed from tests/tcg/mips/mips32-dspr2/balign.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_cmpgdu_eq_qb.c (renamed from tests/tcg/mips/mips32-dspr2/cmpgdu_eq_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_cmpgdu_le_qb.c (renamed from tests/tcg/mips/mips32-dspr2/cmpgdu_le_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_cmpgdu_lt_qb.c (renamed from tests/tcg/mips/mips32-dspr2/cmpgdu_lt_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dpa_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dpa_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dpaqx_s_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dpaqx_s_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dpaqx_sa_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dpaqx_sa_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dpax_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dpax_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dps_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dps_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dpsqx_s_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dpsqx_s_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dpsqx_sa_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dpsqx_sa_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_dpsx_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/dpsx_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_mul_ph.c (renamed from tests/tcg/mips/mips32-dspr2/mul_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_mul_s_ph.c (renamed from tests/tcg/mips/mips32-dspr2/mul_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_mulq_rs_w.c (renamed from tests/tcg/mips/mips32-dspr2/mulq_rs_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_mulq_s_ph.c (renamed from tests/tcg/mips/mips32-dspr2/mulq_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_mulq_s_w.c (renamed from tests/tcg/mips/mips32-dspr2/mulq_s_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_mulsa_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/mulsa_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_mulsaq_s_w_ph.c (renamed from tests/tcg/mips/mips32-dspr2/mulsaq_s_w_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_precr_qb_ph.c (renamed from tests/tcg/mips/mips32-dspr2/precr_qb_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_precr_sra_ph_w.c (renamed from tests/tcg/mips/mips32-dspr2/precr_sra_ph_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_precr_sra_r_ph_w.c (renamed from tests/tcg/mips/mips32-dspr2/precr_sra_r_ph_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_prepend.c (renamed from tests/tcg/mips/mips32-dspr2/prepend.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_shra_qb.c (renamed from tests/tcg/mips/mips32-dspr2/shra_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_shra_r_qb.c (renamed from tests/tcg/mips/mips32-dspr2/shra_r_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_shrav_qb.c (renamed from tests/tcg/mips/mips32-dspr2/shrav_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_shrav_r_qb.c (renamed from tests/tcg/mips/mips32-dspr2/shrav_r_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_shrl_ph.c (renamed from tests/tcg/mips/mips32-dspr2/shrl_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_shrlv_ph.c (renamed from tests/tcg/mips/mips32-dspr2/shrlv_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subqh_ph.c (renamed from tests/tcg/mips/mips32-dspr2/subqh_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subqh_r_ph.c (renamed from tests/tcg/mips/mips32-dspr2/subqh_r_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subqh_r_w.c (renamed from tests/tcg/mips/mips32-dspr2/subqh_r_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subqh_w.c (renamed from tests/tcg/mips/mips32-dspr2/subqh_w.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subu_ph.c (renamed from tests/tcg/mips/mips32-dspr2/subu_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subu_s_ph.c (renamed from tests/tcg/mips/mips32-dspr2/subu_s_ph.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subuh_qb.c (renamed from tests/tcg/mips/mips32-dspr2/subuh_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/dsp/test_dsp_r2_subuh_r_qb.c (renamed from tests/tcg/mips/mips32-dspr2/subuh_r_qb.c)0
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_b.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_d.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_h.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_w.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_b.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_d.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_h.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_w.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_b.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_d.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_h.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_w.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c153
-rw-r--r--tests/tcg/mips/user/isa/r5900/Makefile (renamed from tests/tcg/mips/mipsr5900/Makefile)18
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_div1.c (renamed from tests/tcg/mips/mipsr5900/div1.c)0
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_divu1.c (renamed from tests/tcg/mips/mipsr5900/divu1.c)0
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_madd.c (renamed from tests/tcg/mips/mipsr5900/madd.c)0
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_maddu.c (renamed from tests/tcg/mips/mipsr5900/maddu.c)0
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_mflohi1.c (renamed from tests/tcg/mips/mipsr5900/mflohi1.c)0
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_mtlohi1.c (renamed from tests/tcg/mips/mipsr5900/mtlohi1.c)0
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_mult.c (renamed from tests/tcg/mips/mipsr5900/mult.c)0
-rw-r--r--tests/tcg/mips/user/isa/r5900/test_r5900_multu.c (renamed from tests/tcg/mips/mipsr5900/multu.c)0
-rw-r--r--tests/test-block-iothread.c372
-rw-r--r--tests/test-char.c757
-rw-r--r--tests/test-filter-mirror.c22
-rw-r--r--tests/test-filter-redirector.c4
-rw-r--r--tests/test-io-channel-socket.c86
-rw-r--r--tests/test-qmp-event.c7
-rw-r--r--tests/test-qobject-input-visitor.c1
-rw-r--r--tests/test-vmstate.c50
-rw-r--r--tests/vhost-user-test.c108
-rw-r--r--tests/vm/Makefile.include22
-rwxr-xr-xtests/vm/basevm.py3
-rwxr-xr-xtests/vm/centos3
-rwxr-xr-xtests/vm/freebsd6
-rwxr-xr-xtests/vm/netbsd6
-rwxr-xr-xtests/vm/openbsd3
-rwxr-xr-xtests/vm/ubuntu.i3863
-rw-r--r--tests/vmgenid-test.c66
-rw-r--r--trace-events4
-rw-r--r--ui/Makefile.objs7
-rw-r--r--ui/cocoa.m28
-rw-r--r--ui/curses.c2
-rw-r--r--ui/egl-headless.c3
-rw-r--r--ui/egl-helpers.c13
-rw-r--r--ui/gtk-egl.c6
-rw-r--r--ui/gtk.c61
-rw-r--r--ui/icons/Makefile13
-rw-r--r--ui/icons/qemu.svg (renamed from pc-bios/qemu_logo_no_text.svg)0
-rw-r--r--ui/icons/qemu_128x128.pngbin0 -> 8286 bytes
-rw-r--r--ui/icons/qemu_16x16.pngbin0 -> 765 bytes
-rw-r--r--ui/icons/qemu_24x24.pngbin0 -> 1201 bytes
-rw-r--r--ui/icons/qemu_256x256.pngbin0 -> 17572 bytes
-rw-r--r--ui/icons/qemu_32x32.bmpbin0 -> 4234 bytes
-rw-r--r--ui/icons/qemu_32x32.pngbin0 -> 1696 bytes
-rw-r--r--ui/icons/qemu_48x48.pngbin0 -> 2694 bytes
-rw-r--r--ui/icons/qemu_512x512.pngbin0 -> 38007 bytes
-rw-r--r--ui/icons/qemu_64x64.pngbin0 -> 3807 bytes
-rw-r--r--ui/input-linux.c66
-rw-r--r--ui/kbd-state.c130
-rw-r--r--ui/keymaps.c55
-rw-r--r--ui/keymaps.h3
-rw-r--r--ui/qemu.desktop8
-rw-r--r--ui/sdl.c1027
-rw-r--r--ui/sdl2-input.c50
-rw-r--r--ui/sdl2.c34
-rw-r--r--ui/sdl_keysym.h278
-rw-r--r--ui/sdl_zoom.c93
-rw-r--r--ui/sdl_zoom.h25
-rw-r--r--ui/sdl_zoom_template.h219
-rw-r--r--ui/spice-display.c2
-rw-r--r--ui/vnc-enc-hextile-template.h268
-rw-r--r--ui/vnc-enc-zywrle.h394
-rw-r--r--ui/vnc.c147
-rw-r--r--ui/vnc.h5
-rw-r--r--util/main-loop.c38
-rw-r--r--util/mmap-alloc.c73
-rw-r--r--util/osdep.c2
-rw-r--r--util/oslib-posix.c10
-rw-r--r--util/qemu-coroutine-sleep.c27
-rw-r--r--util/range.c11
-rw-r--r--util/uuid.c10
-rw-r--r--vl.c110
1473 files changed, 78843 insertions, 35433 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
new file mode 100644
index 0000000000..303fe720d6
--- /dev/null
+++ b/.cirrus.yml
@@ -0,0 +1,16 @@
+freebsd_12_task:
+ freebsd_instance:
+ image: freebsd-12-0-release-amd64
+ cpu: 8
+ memory: 8G
+ env:
+ CIRRUS_CLONE_DEPTH: 1
+ install_script: pkg install -y
+ bison curl cyrus-sasl git glib gmake gnutls
+ nettle perl5 pixman pkgconf png usbredir
+ script:
+ - mkdir build
+ - cd build
+ - ../configure || { cat config.log; exit 1; }
+ - gmake -j8
+ - gmake -j8 V=1 check
diff --git a/.gitignore b/.gitignore
index 0430257313..b66b772551 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@
/qapi/qapi-builtin-visit.[ch]
/qapi/qapi-commands-*.[ch]
/qapi/qapi-commands.[ch]
+/qapi/qapi-emit-events.[ch]
/qapi/qapi-events-*.[ch]
/qapi/qapi-events.[ch]
/qapi/qapi-introspect.[ch]
@@ -103,6 +104,10 @@
/pc-bios/optionrom/linuxboot_dma.bin
/pc-bios/optionrom/linuxboot_dma.raw
/pc-bios/optionrom/linuxboot_dma.img
+/pc-bios/optionrom/pvh.asm
+/pc-bios/optionrom/pvh.bin
+/pc-bios/optionrom/pvh.raw
+/pc-bios/optionrom/pvh.img
/pc-bios/optionrom/multiboot.asm
/pc-bios/optionrom/multiboot.bin
/pc-bios/optionrom/multiboot.raw
diff --git a/.travis.yml b/.travis.yml
index 93fd0164a0..baa06b976a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -40,8 +40,6 @@ addons:
- gcovr
homebrew:
packages:
- - libffi
- - gettext
- glib
- pixman
@@ -61,6 +59,7 @@ env:
global:
- SRC_DIR="."
- BUILD_DIR="."
+ - BASE_CONFIG="--disable-docs --disable-tools"
- TEST_CMD="make check -j3 V=1"
@@ -71,7 +70,7 @@ git:
before_script:
- mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
- - ${SRC_DIR}/configure ${CONFIG} || { cat config.log && exit 1; }
+ - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
script:
- make -j3 && ${TEST_CMD}
@@ -98,14 +97,29 @@ matrix:
- CONFIG="--enable-modules --disable-linux-user"
+ # Alternate coroutines implementations are only really of interest to KVM users
+ # However we can't test against KVM on Travis so we can only run unit tests
- env:
- - CONFIG="--with-coroutine=ucontext --disable-linux-user"
+ - CONFIG="--with-coroutine=ucontext --disable-tcg"
+ - TEST_CMD="make check-unit -j3 V=1"
- env:
- - CONFIG="--with-coroutine=sigaltstack --disable-linux-user"
+ - CONFIG="--with-coroutine=sigaltstack --disable-tcg"
+ - TEST_CMD="make check-unit -j3 V=1"
+ # Check we can build docs and tools
+ - env:
+ - BASE_CONFIG="--enable-tools --enable-docs"
+ - CONFIG="--target-list=x86_64-softmmu,aarch64-linux-user"
+ addons:
+ apt:
+ packages:
+ - python-sphinx
+ - texinfo
+ - perl
+
# Test out-of-tree builds
- env:
- CONFIG="--enable-debug --enable-debug-tcg"
@@ -152,11 +166,6 @@ matrix:
- TEST_CMD=""
- - env:
- - CONFIG="--disable-tcg"
- - TEST_CMD=""
-
-
# MacOSX builds
- env:
- CONFIG="--target-list=aarch64-softmmu,arm-softmmu,i386-softmmu,mips-softmmu,mips64-softmmu,ppc64-softmmu,riscv64-softmmu,s390x-softmmu,x86_64-softmmu"
@@ -175,12 +184,14 @@ matrix:
# Python builds
- env:
- CONFIG="--target-list=x86_64-softmmu"
+ language: python
python:
- - "3.0"
+ - "3.4"
- env:
- CONFIG="--target-list=x86_64-softmmu"
+ language: python
python:
- "3.6"
@@ -241,5 +252,5 @@ matrix:
- env:
- - CONFIG="--disable-system --disable-docs"
+ - CONFIG="--disable-system"
- TEST_CMD="make -j3 check-tcg V=1"
diff --git a/COPYING.LIB b/COPYING.LIB
index 48afc2efd7..4362b49151 100644
--- a/COPYING.LIB
+++ b/COPYING.LIB
@@ -1,8 +1,8 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -10,7 +10,7 @@
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -112,7 +112,7 @@ modification follow. Pay close attention to the difference between a
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
- GNU LESSER GENERAL PUBLIC LICENSE
+ GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
@@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -455,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
@@ -476,7 +476,7 @@ convey the exclusion of warranty; and each file should have at least the
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
@@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names:
Ty Coon, President of Vice
That's all there is to it!
-
-
diff --git a/MAINTAINERS b/MAINTAINERS
index af339b86db..6ae55ff732 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -110,7 +110,6 @@ Guest CPU cores (TCG):
----------------------
Overall
L: qemu-devel@nongnu.org
-M: Peter Crosthwaite <crosthwaite.peter@gmail.com>
M: Richard Henderson <rth@twiddle.net>
R: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained
@@ -185,6 +184,7 @@ F: disas/lm32.c
F: hw/lm32/
F: hw/*/lm32_*
F: hw/*/milkymist-*
+F: include/hw/display/milkymist_tmu2.h
F: include/hw/char/lm32_juart.h
F: include/hw/lm32/
F: tests/tcg/lm32/
@@ -206,7 +206,6 @@ MIPS
M: Aurelien Jarno <aurelien@aurel32.net>
M: Aleksandar Markovic <amarkovic@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: target/mips/
F: default-configs/*mips*
@@ -259,7 +258,6 @@ F: include/hw/ppc/
F: disas/ppc.c
RISC-V
-M: Michael Clark <mjc@sifive.com>
M: Palmer Dabbelt <palmer@sifive.com>
M: Alistair Francis <Alistair.Francis@wdc.com>
M: Sagar Karandikar <sagark@eecs.berkeley.edu>
@@ -365,7 +363,6 @@ F: target/arm/kvm.c
MIPS
M: James Hogan <jhogan@kernel.org>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: target/mips/kvm.c
@@ -378,7 +375,7 @@ S390
M: Halil Pasic <pasic@linux.ibm.com>
M: Cornelia Huck <cohuck@redhat.com>
M: Christian Borntraeger <borntraeger@de.ibm.com>
-S: Maintained
+S: Supported
F: target/s390x/kvm.c
F: target/s390x/kvm_s390x.h
F: target/s390x/kvm-stub.c
@@ -494,6 +491,7 @@ F: hw/sd/pl181.c
F: hw/ssi/pl022.c
F: include/hw/ssi/pl022.h
F: hw/timer/pl031.c
+F: include/hw/timer/pl031.h
F: include/hw/arm/primecell.h
F: hw/timer/cmsdk-apb-timer.c
F: include/hw/timer/cmsdk-apb-timer.h
@@ -625,14 +623,22 @@ F: hw/arm/mps2.c
F: hw/arm/mps2-tz.c
F: hw/misc/mps2-*.c
F: include/hw/misc/mps2-*.h
-F: hw/arm/iotkit.c
-F: include/hw/arm/iotkit.h
+F: hw/arm/armsse.c
+F: include/hw/arm/armsse.h
F: hw/misc/iotkit-secctl.c
F: include/hw/misc/iotkit-secctl.h
F: hw/misc/iotkit-sysctl.c
F: include/hw/misc/iotkit-sysctl.h
F: hw/misc/iotkit-sysinfo.c
F: include/hw/misc/iotkit-sysinfo.h
+F: hw/misc/armsse-cpuid.c
+F: include/hw/misc/armsse-cpuid.h
+
+Musca
+M: Peter Maydell <peter.maydell@linaro.org>
+L: qemu-arm@nongnu.org
+S: Maintained
+F: hw/arm/musca.c
Musicpal
M: Jan Kiszka <jan.kiszka@web.de>
@@ -831,9 +837,11 @@ M: Joel Stanley <joel@jms.id.au>
M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
S: Maintained
-F: hw/arm/nrf51_soc.c
-F: hw/arm/microbit.c
-F: include/hw/arm/nrf51_soc.h
+F: hw/*/nrf51*.c
+F: hw/*/microbit*.c
+F: include/hw/*/nrf51*.h
+F: include/hw/*/microbit*.h
+F: tests/microbit-test.c
CRIS Machines
-------------
@@ -890,7 +898,6 @@ MIPS Machines
Jazz
M: Hervé Poussineau <hpoussin@reactos.org>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/mips/mips_jazz.c
F: hw/display/jazz_led.c
@@ -899,14 +906,12 @@ F: hw/dma/rc4030.c
Malta
M: Aurelien Jarno <aurelien@aurel32.net>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/mips/mips_malta.c
Mipssim
M: Aleksandar Markovic <amarkovic@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Odd Fixes
F: hw/mips/mips_mipssim.c
F: hw/net/mipsnet.c
@@ -914,14 +919,12 @@ F: hw/net/mipsnet.c
R4000
M: Aurelien Jarno <aurelien@aurel32.net>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/mips/mips_r4k.c
Fulong 2E
M: Aleksandar Markovic <amarkovic@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Odd Fixes
F: hw/mips/mips_fulong2e.c
F: hw/isa/vt82c686.c
@@ -931,7 +934,6 @@ F: include/hw/isa/vt82c686.h
Boston
M: Paul Burton <pburton@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/core/loader-fit.c
F: hw/mips/boston.c
@@ -963,9 +965,10 @@ e500
M: David Gibson <david@gibson.dropbear.id.au>
L: qemu-ppc@nongnu.org
S: Odd Fixes
-F: hw/ppc/e500.[hc]
-F: hw/ppc/e500plat.c
+F: hw/ppc/e500*
F: hw/gpio/mpc8xxx.c
+F: hw/net/fsl_etsec/
+F: hw/pci-host/ppce500.c
F: include/hw/ppc/ppc_e500.h
F: include/hw/pci-host/ppce500.h
F: pc-bios/u-boot.e500
@@ -978,7 +981,8 @@ F: hw/ppc/mpc8544ds.c
F: hw/ppc/mpc8544_guts.c
New World (mac99)
-M: David Gibson <david@gibson.dropbear.id.au>
+M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
+R: David Gibson <david@gibson.dropbear.id.au>
L: qemu-ppc@nongnu.org
S: Odd Fixes
F: hw/ppc/mac_newworld.c
@@ -996,7 +1000,8 @@ F: include/hw/input/adb*
F: pc-bios/qemu_vga.ndrv
Old World (g3beige)
-M: David Gibson <david@gibson.dropbear.id.au>
+M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
+R: David Gibson <david@gibson.dropbear.id.au>
L: qemu-ppc@nongnu.org
S: Odd Fixes
F: hw/ppc/mac_oldworld.c
@@ -1044,14 +1049,6 @@ F: tests/libqos/*spapr*
F: tests/rtas*
F: tests/libqos/rtas*
-XIVE
-M: David Gibson <david@gibson.dropbear.id.au>
-M: Cédric Le Goater <clg@kaod.org>
-L: qemu-ppc@nongnu.org
-S: Supported
-F: hw/*/*xive*
-F: include/hw/*/*xive*
-
virtex_ml507
M: Edgar E. Iglesias <edgar.iglesias@gmail.com>
L: qemu-ppc@nongnu.org
@@ -1330,14 +1327,6 @@ F: hw/i2c/ppc4xx_i2c.c
F: include/hw/ppc/ppc4xx.h
F: include/hw/i2c/ppc4xx_i2c.h
-ppce500
-M: David Gibson <david@gibson.dropbear.id.au>
-L: qemu-ppc@nongnu.org
-S: Odd Fixes
-F: hw/ppc/e500*
-F: hw/pci-host/ppce500.c
-F: hw/net/fsl_etsec/
-
Character devices
M: Marc-André Lureau <marcandre.lureau@redhat.com>
R: Paolo Bonzini <pbonzini@redhat.com>
@@ -1362,7 +1351,6 @@ F: tests/virtio-scsi-test.c
T: git https://github.com/bonzini/qemu.git scsi-next
SSI
-M: Peter Crosthwaite <crosthwaite.peter@gmail.com>
M: Alistair Francis <alistair@alistair23.me>
S: Maintained
F: hw/ssi/*
@@ -1373,7 +1361,6 @@ F: tests/m25p80-test.c
Xilinx SPI
M: Alistair Francis <alistair@alistair23.me>
-M: Peter Crosthwaite <crosthwaite.peter@gmail.com>
S: Maintained
F: hw/ssi/xilinx_*
@@ -1639,7 +1626,7 @@ F: include/hw/display/edid.h
F: qemu-edid.c
Firmware configuration (fw_cfg)
-M: Philippe Mathieu-Daudé <philmd@redhat.com>
+M: Philippe Mathieu-Daudé <philmd@redhat.com>
R: Laszlo Ersek <lersek@redhat.com>
R: Gerd Hoffmann <kraxel@redhat.com>
S: Supported
@@ -1651,6 +1638,14 @@ F: tests/libqos/fw_cfg.c
F: tests/fw_cfg-test.c
T: git https://github.com/philmd/qemu.git fw_cfg-next
+XIVE
+M: David Gibson <david@gibson.dropbear.id.au>
+M: Cédric Le Goater <clg@kaod.org>
+L: qemu-ppc@nongnu.org
+S: Supported
+F: hw/*/*xive*
+F: include/hw/*/*xive*
+
Subsystems
----------
Audio
@@ -1775,7 +1770,6 @@ F: qom/cpu.c
F: include/qom/cpu.h
Device Tree
-M: Peter Crosthwaite <crosthwaite.peter@gmail.com>
M: Alexander Graf <agraf@suse.de>
S: Maintained
F: device_tree.c
@@ -2017,6 +2011,7 @@ F: trace-events
F: qemu-option-trace.texi
F: scripts/tracetool.py
F: scripts/tracetool/
+F: scripts/qemu-trace-stap*
F: docs/devel/tracing.txt
T: git https://github.com/stefanha/qemu.git tracing
@@ -2203,7 +2198,6 @@ F: disas/i386.c
MIPS target
M: Aurelien Jarno <aurelien@aurel32.net>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
-R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: tcg/mips/
F: disas/mips.c
@@ -2479,10 +2473,19 @@ F: scripts/travis/
F: .shippable.yml
F: tests/docker/
F: tests/vm/
+F: scripts/archive-source.sh
W: https://travis-ci.org/qemu/qemu
W: https://app.shippable.com/github/qemu/qemu
W: http://patchew.org/QEMU/
+FreeBSD Hosted Continuous Integration
+M: Ed Maste <emaste@freebsd.org>
+M: Li-Wen Hsu <lwhsu@freebsd.org>
+L: qemu-devel@nongnu.org
+S: Maintained
+F: .cirrus.yml
+W: https://cirrus-ci.com/github/qemu/qemu
+
Guest Test Compilation Support
M: Alex Bennée <alex.bennee@linaro.org>
R: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff --git a/Makefile b/Makefile
index dccba1dca2..a6de28677f 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,6 @@ include $(SRC_PATH)/rules.mak
GENERATED_FILES = qemu-version.h config-host.h qemu-options.def
-#see Makefile.objs for the definition of QAPI_MODULES
GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
@@ -101,6 +100,7 @@ GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
+GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
@@ -145,7 +145,7 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
%/trace.h: %/trace.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
+%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=$(call trace-group-name,$@) \
--format=h \
@@ -154,7 +154,7 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
%/trace.c: %/trace.c-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
+%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=$(call trace-group-name,$@) \
--format=c \
@@ -163,7 +163,7 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
%/trace-ust.h: %/trace-ust.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-%/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
+%/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=$(call trace-group-name,$@) \
--format=ust-events-h \
@@ -187,7 +187,7 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
trace-root.h: trace-root.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
+trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=root \
--format=h \
@@ -196,7 +196,7 @@ trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
trace-root.c: trace-root.c-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
+trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=root \
--format=c \
@@ -205,7 +205,7 @@ trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
trace-ust-root.h: trace-ust-root.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
+trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=root \
--format=ust-events-h \
@@ -214,7 +214,7 @@ trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
trace-ust-all.h: trace-ust-all.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y)
+trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=ust-events-h \
@@ -223,7 +223,7 @@ trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y)
trace-ust-all.c: trace-ust-all.c-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y)
+trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=ust-events-c \
@@ -305,6 +305,9 @@ DOCS+=docs/qemu-cpu-models.7
ifdef CONFIG_VIRTFS
DOCS+=fsdev/virtfs-proxy-helper.1
endif
+ifdef CONFIG_TRACE_SYSTEMTAP
+DOCS+=scripts/qemu-trace-stap.1
+endif
else
DOCS=
endif
@@ -567,8 +570,8 @@ ifneq ($(EXESUF),)
qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
endif
-elf2dmp: LIBS = $(CURL_LIBS)
-elf2dmp: $(elf2dmp-obj-y)
+elf2dmp$(EXESUF): LIBS += $(CURL_LIBS)
+elf2dmp$(EXESUF): $(elf2dmp-obj-y)
$(call LINK, $^)
ifdef CONFIG_IVSHMEM
@@ -581,6 +584,8 @@ vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
$(call LINK, $^)
vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
$(call LINK, $^)
+
+rdmacm-mux$(EXESUF): LIBS += "-libumad"
rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
$(call LINK, $^)
@@ -667,9 +672,8 @@ pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
efi-e1000e.rom efi-vmxnet3.rom \
-qemu-icon.bmp qemu_logo_no_text.svg \
bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
-multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
+multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
s390-ccw.img s390-netboot.img \
spapr-rtas.bin slof.bin skiboot.lid \
palcode-clipper \
@@ -698,6 +702,9 @@ ifneq ($(TOOLS),)
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
endif
+ifdef CONFIG_TRACE_SYSTEMTAP
+ $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
+endif
ifneq (,$(findstring qemu-ga,$(TOOLS)))
$(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
@@ -720,6 +727,7 @@ ifneq (,$(findstring qemu-ga,$(TOOLS)))
endif
endif
+ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
ifneq ($(TOOLS),)
@@ -736,11 +744,28 @@ endif
ifneq ($(HELPERS-y),)
$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
endif
+ifdef CONFIG_TRACE_SYSTEMTAP
+ $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
+endif
ifneq ($(BLOBS),)
set -e; for x in $(BLOBS); do \
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
done
endif
+ for s in $(ICON_SIZES); do \
+ mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps"; \
+ $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
+ "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
+ done; \
+ mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps"; \
+ $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
+ "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
+ mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps"; \
+ $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
+ "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
+ mkdir -p "$(DESTDIR)/$(qemu_desktopdir)"
+ $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
+ "$(DESTDIR)/$(qemu_desktopdir)/qemu.desktop"
ifdef CONFIG_GTK
$(MAKE) -C po $@
endif
@@ -836,6 +861,7 @@ qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
qemu-ga.8: qemu-ga.texi
docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
+scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
@@ -858,6 +884,8 @@ docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
+$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
+
# Reports/Analysis
%/coverage-report.html:
diff --git a/Makefile.objs b/Makefile.objs
index 67a054b08a..5fb022d7ad 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -1,20 +1,7 @@
-QAPI_MODULES = block-core block char common crypto introspect job migration
-QAPI_MODULES += misc net rdma rocker run-state sockets tpm trace transaction
-QAPI_MODULES += ui
-
#######################################################################
# Common libraries for tools and emulators
stub-obj-y = stubs/ crypto/
util-obj-y = util/ qobject/ qapi/
-util-obj-y += qapi/qapi-builtin-types.o
-util-obj-y += qapi/qapi-types.o
-util-obj-y += $(QAPI_MODULES:%=qapi/qapi-types-%.o)
-util-obj-y += qapi/qapi-builtin-visit.o
-util-obj-y += qapi/qapi-visit.o
-util-obj-y += $(QAPI_MODULES:%=qapi/qapi-visit-%.o)
-util-obj-y += qapi/qapi-events.o
-util-obj-y += $(QAPI_MODULES:%=qapi/qapi-events-%.o)
-util-obj-y += qapi/qapi-introspect.o
chardev-obj-y = chardev/
slirp-obj-$(CONFIG_SLIRP) = slirp/
@@ -92,10 +79,8 @@ common-obj-$(CONFIG_FDT) += device_tree.o
######################################################################
# qapi
-common-obj-y += qapi/qapi-commands.o
-common-obj-y += $(QAPI_MODULES:%=qapi/qapi-commands-%.o)
-common-obj-y += qapi/qapi-introspect.o
common-obj-y += qmp.o hmp.o
+common-obj-y += qapi/
endif
#######################################################################
@@ -192,7 +177,6 @@ trace-events-subdirs += net
trace-events-subdirs += qapi
trace-events-subdirs += qom
trace-events-subdirs += scsi
-trace-events-subdirs += slirp
trace-events-subdirs += target/arm
trace-events-subdirs += target/i386
trace-events-subdirs += target/mips
diff --git a/Makefile.target b/Makefile.target
index 39f72e81be..d6ce549388 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -45,7 +45,7 @@ config-target.h: config-target.h-timestamp
config-target.h-timestamp: config-target.mak
ifdef CONFIG_TRACE_SYSTEMTAP
-stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp
+stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp
ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
@@ -84,6 +84,14 @@ $(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
+$(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
+ $(call quiet-command,$(TRACETOOL) \
+ --group=all \
+ --format=log-stap \
+ --backends=$(TRACE_BACKENDS) \
+ --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
+ $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp")
+
else
stap:
endif
@@ -140,6 +148,7 @@ ifdef CONFIG_SOFTMMU
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
obj-y += qtest.o
obj-y += hw/
+obj-y += qapi/
obj-y += memory.o
obj-y += memory_mapping.o
obj-y += dump.o
@@ -227,6 +236,7 @@ ifdef CONFIG_TRACE_SYSTEMTAP
$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
$(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
+ $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp"
endif
GENERATED_FILES += config-target.h
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 4e1de942ce..fd92b6f375 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -657,6 +657,8 @@ static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val,
.fd = fd,
};
+ trace_kvm_set_ioeventfd_mmio(fd, (uint64_t)addr, val, assign, size,
+ datamatch);
if (!kvm_enabled()) {
return -ENOSYS;
}
@@ -688,6 +690,7 @@ static int kvm_set_ioeventfd_pio(int fd, uint16_t addr, uint16_t val,
.fd = fd,
};
int r;
+ trace_kvm_set_ioeventfd_pio(fd, addr, val, assign, size, datamatch);
if (!kvm_enabled()) {
return -ENOSYS;
}
diff --git a/accel/kvm/trace-events b/accel/kvm/trace-events
index 58e98efe5d..8841025d68 100644
--- a/accel/kvm/trace-events
+++ b/accel/kvm/trace-events
@@ -12,5 +12,7 @@ kvm_irqchip_commit_routes(void) ""
kvm_irqchip_add_msi_route(char *name, int vector, int virq) "dev %s vector %d virq %d"
kvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
kvm_irqchip_release_virq(int virq) "virq %d"
+kvm_set_ioeventfd_mmio(int fd, uint64_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) "fd: %d @0x%" PRIx64 " val=0x%x assign: %d size: %d match: %d"
+kvm_set_ioeventfd_pio(int fd, uint16_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) "fd: %d @0x%x val=0x%x assign: %d size: %d match: %d"
kvm_set_user_memory(uint32_t slot, uint32_t flags, uint64_t guest_phys_addr, uint64_t memory_size, uint64_t userspace_addr, int ret) "Slot#%d flags=0x%x gpa=0x%"PRIx64 " size=0x%"PRIx64 " ua=0x%"PRIx64 " ret=%d"
diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h
index efde12fdb2..685602b076 100644
--- a/accel/tcg/atomic_template.h
+++ b/accel/tcg/atomic_template.h
@@ -7,7 +7,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c
index 2988fde650..462a1f1865 100644
--- a/accel/tcg/cpu-exec-common.c
+++ b/accel/tcg/cpu-exec-common.c
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 870027d435..45ef41ebb2 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -266,6 +266,9 @@ void cpu_exec_step_atomic(CPUState *cpu)
#ifndef CONFIG_SOFTMMU
tcg_debug_assert(!have_mmap_lock());
#endif
+ if (qemu_mutex_iothread_locked()) {
+ qemu_mutex_unlock_iothread();
+ }
assert_no_pages_locked();
}
@@ -699,6 +702,7 @@ int cpu_exec(CPUState *cpu)
if (qemu_mutex_iothread_locked()) {
qemu_mutex_unlock_iothread();
}
+ assert_no_pages_locked();
}
/* if an exception is pending, we execute it here */
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index af6bd8ccf9..88cc8389e9 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -74,6 +74,166 @@ QEMU_BUILD_BUG_ON(sizeof(target_ulong) > sizeof(run_on_cpu_data));
QEMU_BUILD_BUG_ON(NB_MMU_MODES > 16);
#define ALL_MMUIDX_BITS ((1 << NB_MMU_MODES) - 1)
+static inline size_t sizeof_tlb(CPUArchState *env, uintptr_t mmu_idx)
+{
+ return env->tlb_mask[mmu_idx] + (1 << CPU_TLB_ENTRY_BITS);
+}
+
+static void tlb_window_reset(CPUTLBWindow *window, int64_t ns,
+ size_t max_entries)
+{
+ window->begin_ns = ns;
+ window->max_entries = max_entries;
+}
+
+static void tlb_dyn_init(CPUArchState *env)
+{
+ int i;
+
+ for (i = 0; i < NB_MMU_MODES; i++) {
+ CPUTLBDesc *desc = &env->tlb_d[i];
+ size_t n_entries = 1 << CPU_TLB_DYN_DEFAULT_BITS;
+
+ tlb_window_reset(&desc->window, get_clock_realtime(), 0);
+ desc->n_used_entries = 0;
+ env->tlb_mask[i] = (n_entries - 1) << CPU_TLB_ENTRY_BITS;
+ env->tlb_table[i] = g_new(CPUTLBEntry, n_entries);
+ env->iotlb[i] = g_new(CPUIOTLBEntry, n_entries);
+ }
+}
+
+/**
+ * tlb_mmu_resize_locked() - perform TLB resize bookkeeping; resize if necessary
+ * @env: CPU that owns the TLB
+ * @mmu_idx: MMU index of the TLB
+ *
+ * Called with tlb_lock_held.
+ *
+ * We have two main constraints when resizing a TLB: (1) we only resize it
+ * on a TLB flush (otherwise we'd have to take a perf hit by either rehashing
+ * the array or unnecessarily flushing it), which means we do not control how
+ * frequently the resizing can occur; (2) we don't have access to the guest's
+ * future scheduling decisions, and therefore have to decide the magnitude of
+ * the resize based on past observations.
+ *
+ * In general, a memory-hungry process can benefit greatly from an appropriately
+ * sized TLB, since a guest TLB miss is very expensive. This doesn't mean that
+ * we just have to make the TLB as large as possible; while an oversized TLB
+ * results in minimal TLB miss rates, it also takes longer to be flushed
+ * (flushes can be _very_ frequent), and the reduced locality can also hurt
+ * performance.
+ *
+ * To achieve near-optimal performance for all kinds of workloads, we:
+ *
+ * 1. Aggressively increase the size of the TLB when the use rate of the
+ * TLB being flushed is high, since it is likely that in the near future this
+ * memory-hungry process will execute again, and its memory hungriness will
+ * probably be similar.
+ *
+ * 2. Slowly reduce the size of the TLB as the use rate declines over a
+ * reasonably large time window. The rationale is that if in such a time window
+ * we have not observed a high TLB use rate, it is likely that we won't observe
+ * it in the near future. In that case, once a time window expires we downsize
+ * the TLB to match the maximum use rate observed in the window.
+ *
+ * 3. Try to keep the maximum use rate in a time window in the 30-70% range,
+ * since in that range performance is likely near-optimal. Recall that the TLB
+ * is direct mapped, so we want the use rate to be low (or at least not too
+ * high), since otherwise we are likely to have a significant amount of
+ * conflict misses.
+ */
+static void tlb_mmu_resize_locked(CPUArchState *env, int mmu_idx)
+{
+ CPUTLBDesc *desc = &env->tlb_d[mmu_idx];
+ size_t old_size = tlb_n_entries(env, mmu_idx);
+ size_t rate;
+ size_t new_size = old_size;
+ int64_t now = get_clock_realtime();
+ int64_t window_len_ms = 100;
+ int64_t window_len_ns = window_len_ms * 1000 * 1000;
+ bool window_expired = now > desc->window.begin_ns + window_len_ns;
+
+ if (desc->n_used_entries > desc->window.max_entries) {
+ desc->window.max_entries = desc->n_used_entries;
+ }
+ rate = desc->window.max_entries * 100 / old_size;
+
+ if (rate > 70) {
+ new_size = MIN(old_size << 1, 1 << CPU_TLB_DYN_MAX_BITS);
+ } else if (rate < 30 && window_expired) {
+ size_t ceil = pow2ceil(desc->window.max_entries);
+ size_t expected_rate = desc->window.max_entries * 100 / ceil;
+
+ /*
+ * Avoid undersizing when the max number of entries seen is just below
+ * a pow2. For instance, if max_entries == 1025, the expected use rate
+ * would be 1025/2048==50%. However, if max_entries == 1023, we'd get
+ * 1023/1024==99.9% use rate, so we'd likely end up doubling the size
+ * later. Thus, make sure that the expected use rate remains below 70%.
+ * (and since we double the size, that means the lowest rate we'd
+ * expect to get is 35%, which is still in the 30-70% range where
+ * we consider that the size is appropriate.)
+ */
+ if (expected_rate > 70) {
+ ceil *= 2;
+ }
+ new_size = MAX(ceil, 1 << CPU_TLB_DYN_MIN_BITS);
+ }
+
+ if (new_size == old_size) {
+ if (window_expired) {
+ tlb_window_reset(&desc->window, now, desc->n_used_entries);
+ }
+ return;
+ }
+
+ g_free(env->tlb_table[mmu_idx]);
+ g_free(env->iotlb[mmu_idx]);
+
+ tlb_window_reset(&desc->window, now, 0);
+ /* desc->n_used_entries is cleared by the caller */
+ env->tlb_mask[mmu_idx] = (new_size - 1) << CPU_TLB_ENTRY_BITS;
+ env->tlb_table[mmu_idx] = g_try_new(CPUTLBEntry, new_size);
+ env->iotlb[mmu_idx] = g_try_new(CPUIOTLBEntry, new_size);
+ /*
+ * If the allocations fail, try smaller sizes. We just freed some
+ * memory, so going back to half of new_size has a good chance of working.
+ * Increased memory pressure elsewhere in the system might cause the
+ * allocations to fail though, so we progressively reduce the allocation
+ * size, aborting if we cannot even allocate the smallest TLB we support.
+ */
+ while (env->tlb_table[mmu_idx] == NULL || env->iotlb[mmu_idx] == NULL) {
+ if (new_size == (1 << CPU_TLB_DYN_MIN_BITS)) {
+ error_report("%s: %s", __func__, strerror(errno));
+ abort();
+ }
+ new_size = MAX(new_size >> 1, 1 << CPU_TLB_DYN_MIN_BITS);
+ env->tlb_mask[mmu_idx] = (new_size - 1) << CPU_TLB_ENTRY_BITS;
+
+ g_free(env->tlb_table[mmu_idx]);
+ g_free(env->iotlb[mmu_idx]);
+ env->tlb_table[mmu_idx] = g_try_new(CPUTLBEntry, new_size);
+ env->iotlb[mmu_idx] = g_try_new(CPUIOTLBEntry, new_size);
+ }
+}
+
+static inline void tlb_table_flush_by_mmuidx(CPUArchState *env, int mmu_idx)
+{
+ tlb_mmu_resize_locked(env, mmu_idx);
+ memset(env->tlb_table[mmu_idx], -1, sizeof_tlb(env, mmu_idx));
+ env->tlb_d[mmu_idx].n_used_entries = 0;
+}
+
+static inline void tlb_n_used_entries_inc(CPUArchState *env, uintptr_t mmu_idx)
+{
+ env->tlb_d[mmu_idx].n_used_entries++;
+}
+
+static inline void tlb_n_used_entries_dec(CPUArchState *env, uintptr_t mmu_idx)
+{
+ env->tlb_d[mmu_idx].n_used_entries--;
+}
+
void tlb_init(CPUState *cpu)
{
CPUArchState *env = cpu->env_ptr;
@@ -82,6 +242,8 @@ void tlb_init(CPUState *cpu)
/* Ensure that cpu_reset performs a full flush. */
env->tlb_c.dirty = ALL_MMUIDX_BITS;
+
+ tlb_dyn_init(env);
}
/* flush_all_helper: run fn across all cpus
@@ -122,7 +284,7 @@ void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide)
static void tlb_flush_one_mmuidx_locked(CPUArchState *env, int mmu_idx)
{
- memset(env->tlb_table[mmu_idx], -1, sizeof(env->tlb_table[0]));
+ tlb_table_flush_by_mmuidx(env, mmu_idx);
memset(env->tlb_v_table[mmu_idx], -1, sizeof(env->tlb_v_table[0]));
env->tlb_d[mmu_idx].large_page_addr = -1;
env->tlb_d[mmu_idx].large_page_mask = -1;
@@ -224,13 +386,24 @@ static inline bool tlb_hit_page_anyprot(CPUTLBEntry *tlb_entry,
tlb_hit_page(tlb_entry->addr_code, page);
}
+/**
+ * tlb_entry_is_empty - return true if the entry is not in use
+ * @te: pointer to CPUTLBEntry
+ */
+static inline bool tlb_entry_is_empty(const CPUTLBEntry *te)
+{
+ return te->addr_read == -1 && te->addr_write == -1 && te->addr_code == -1;
+}
+
/* Called with tlb_c.lock held */
-static inline void tlb_flush_entry_locked(CPUTLBEntry *tlb_entry,
+static inline bool tlb_flush_entry_locked(CPUTLBEntry *tlb_entry,
target_ulong page)
{
if (tlb_hit_page_anyprot(tlb_entry, page)) {
memset(tlb_entry, -1, sizeof(*tlb_entry));
+ return true;
}
+ return false;
}
/* Called with tlb_c.lock held */
@@ -241,7 +414,9 @@ static inline void tlb_flush_vtlb_page_locked(CPUArchState *env, int mmu_idx,
assert_cpu_is_self(ENV_GET_CPU(env));
for (k = 0; k < CPU_VTLB_SIZE; k++) {
- tlb_flush_entry_locked(&env->tlb_v_table[mmu_idx][k], page);
+ if (tlb_flush_entry_locked(&env->tlb_v_table[mmu_idx][k], page)) {
+ tlb_n_used_entries_dec(env, mmu_idx);
+ }
}
}
@@ -258,7 +433,9 @@ static void tlb_flush_page_locked(CPUArchState *env, int midx,
midx, lp_addr, lp_mask);
tlb_flush_one_mmuidx_locked(env, midx);
} else {
- tlb_flush_entry_locked(tlb_entry(env, midx, page), page);
+ if (tlb_flush_entry_locked(tlb_entry(env, midx, page), page)) {
+ tlb_n_used_entries_dec(env, midx);
+ }
tlb_flush_vtlb_page_locked(env, midx, page);
}
}
@@ -435,8 +612,9 @@ void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length)
qemu_spin_lock(&env->tlb_c.lock);
for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
unsigned int i;
+ unsigned int n = tlb_n_entries(env, mmu_idx);
- for (i = 0; i < CPU_TLB_SIZE; i++) {
+ for (i = 0; i < n; i++) {
tlb_reset_dirty_range_locked(&env->tlb_table[mmu_idx][i], start1,
length);
}
@@ -591,13 +769,14 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
* Only evict the old entry to the victim tlb if it's for a
* different page; otherwise just overwrite the stale data.
*/
- if (!tlb_hit_page_anyprot(te, vaddr_page)) {
+ if (!tlb_hit_page_anyprot(te, vaddr_page) && !tlb_entry_is_empty(te)) {
unsigned vidx = env->tlb_d[mmu_idx].vindex++ % CPU_VTLB_SIZE;
CPUTLBEntry *tv = &env->tlb_v_table[mmu_idx][vidx];
/* Evict the old entry into the victim tlb. */
copy_tlb_helper_locked(tv, te);
env->iotlb_v[mmu_idx][vidx] = env->iotlb[mmu_idx][index];
+ tlb_n_used_entries_dec(env, mmu_idx);
}
/* refill the tlb */
@@ -649,6 +828,7 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
}
copy_tlb_helper_locked(te, &tn);
+ tlb_n_used_entries_inc(env, mmu_idx);
qemu_spin_unlock(&env->tlb_c.lock);
}
@@ -865,6 +1045,8 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr)
if (unlikely(!tlb_hit(entry->addr_code, addr))) {
if (!VICTIM_TLB_HIT(addr_code, addr)) {
tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0);
+ index = tlb_index(env, mmu_idx, addr);
+ entry = tlb_entry(env, mmu_idx, addr);
}
assert(tlb_hit(entry->addr_code, addr));
}
@@ -945,6 +1127,8 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr,
if (!VICTIM_TLB_HIT(addr_write, addr)) {
tlb_fill(ENV_GET_CPU(env), addr, 1 << s_bits, MMU_DATA_STORE,
mmu_idx, retaddr);
+ index = tlb_index(env, mmu_idx, addr);
+ tlbe = tlb_entry(env, mmu_idx, addr);
}
tlb_addr = tlb_addr_write(tlbe) & ~TLB_INVALID_MASK;
}
diff --git a/accel/tcg/softmmu_template.h b/accel/tcg/softmmu_template.h
index b0adea045e..e970a8b378 100644
--- a/accel/tcg/softmmu_template.h
+++ b/accel/tcg/softmmu_template.h
@@ -11,7 +11,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -129,6 +129,8 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr,
if (!VICTIM_TLB_HIT(ADDR_READ, addr)) {
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, READ_ACCESS_TYPE,
mmu_idx, retaddr);
+ index = tlb_index(env, mmu_idx, addr);
+ entry = tlb_entry(env, mmu_idx, addr);
}
tlb_addr = entry->ADDR_READ;
}
@@ -198,6 +200,8 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr,
if (!VICTIM_TLB_HIT(ADDR_READ, addr)) {
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, READ_ACCESS_TYPE,
mmu_idx, retaddr);
+ index = tlb_index(env, mmu_idx, addr);
+ entry = tlb_entry(env, mmu_idx, addr);
}
tlb_addr = entry->ADDR_READ;
}
@@ -294,6 +298,8 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
if (!VICTIM_TLB_HIT(addr_write, addr)) {
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, MMU_DATA_STORE,
mmu_idx, retaddr);
+ index = tlb_index(env, mmu_idx, addr);
+ entry = tlb_entry(env, mmu_idx, addr);
}
tlb_addr = tlb_addr_write(entry) & ~TLB_INVALID_MASK;
}
@@ -372,6 +378,8 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
if (!VICTIM_TLB_HIT(addr_write, addr)) {
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, MMU_DATA_STORE,
mmu_idx, retaddr);
+ index = tlb_index(env, mmu_idx, addr);
+ entry = tlb_entry(env, mmu_idx, addr);
}
tlb_addr = tlb_addr_write(entry) & ~TLB_INVALID_MASK;
}
diff --git a/accel/tcg/tcg-runtime-gvec.c b/accel/tcg/tcg-runtime-gvec.c
index 90340e56e0..e2c6f24262 100644
--- a/accel/tcg/tcg-runtime-gvec.c
+++ b/accel/tcg/tcg-runtime-gvec.c
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -512,6 +512,39 @@ void HELPER(gvec_orc)(void *d, void *a, void *b, uint32_t desc)
clear_high(d, oprsz, desc);
}
+void HELPER(gvec_nand)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(vec64)) {
+ *(vec64 *)(d + i) = ~(*(vec64 *)(a + i) & *(vec64 *)(b + i));
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_nor)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(vec64)) {
+ *(vec64 *)(d + i) = ~(*(vec64 *)(a + i) | *(vec64 *)(b + i));
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_eqv)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(vec64)) {
+ *(vec64 *)(d + i) = ~(*(vec64 *)(a + i) ^ *(vec64 *)(b + i));
+ }
+ clear_high(d, oprsz, desc);
+}
+
void HELPER(gvec_ands)(void *d, void *a, uint64_t b, uint32_t desc)
{
intptr_t oprsz = simd_oprsz(desc);
@@ -995,3 +1028,227 @@ void HELPER(gvec_ussub64)(void *d, void *a, void *b, uint32_t desc)
}
clear_high(d, oprsz, desc);
}
+
+void HELPER(gvec_smin8)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int8_t)) {
+ int8_t aa = *(int8_t *)(a + i);
+ int8_t bb = *(int8_t *)(b + i);
+ int8_t dd = aa < bb ? aa : bb;
+ *(int8_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_smin16)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int16_t)) {
+ int16_t aa = *(int16_t *)(a + i);
+ int16_t bb = *(int16_t *)(b + i);
+ int16_t dd = aa < bb ? aa : bb;
+ *(int16_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_smin32)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int32_t)) {
+ int32_t aa = *(int32_t *)(a + i);
+ int32_t bb = *(int32_t *)(b + i);
+ int32_t dd = aa < bb ? aa : bb;
+ *(int32_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_smin64)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int64_t)) {
+ int64_t aa = *(int64_t *)(a + i);
+ int64_t bb = *(int64_t *)(b + i);
+ int64_t dd = aa < bb ? aa : bb;
+ *(int64_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_smax8)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int8_t)) {
+ int8_t aa = *(int8_t *)(a + i);
+ int8_t bb = *(int8_t *)(b + i);
+ int8_t dd = aa > bb ? aa : bb;
+ *(int8_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_smax16)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int16_t)) {
+ int16_t aa = *(int16_t *)(a + i);
+ int16_t bb = *(int16_t *)(b + i);
+ int16_t dd = aa > bb ? aa : bb;
+ *(int16_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_smax32)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int32_t)) {
+ int32_t aa = *(int32_t *)(a + i);
+ int32_t bb = *(int32_t *)(b + i);
+ int32_t dd = aa > bb ? aa : bb;
+ *(int32_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_smax64)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(int64_t)) {
+ int64_t aa = *(int64_t *)(a + i);
+ int64_t bb = *(int64_t *)(b + i);
+ int64_t dd = aa > bb ? aa : bb;
+ *(int64_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umin8)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint8_t)) {
+ uint8_t aa = *(uint8_t *)(a + i);
+ uint8_t bb = *(uint8_t *)(b + i);
+ uint8_t dd = aa < bb ? aa : bb;
+ *(uint8_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umin16)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint16_t)) {
+ uint16_t aa = *(uint16_t *)(a + i);
+ uint16_t bb = *(uint16_t *)(b + i);
+ uint16_t dd = aa < bb ? aa : bb;
+ *(uint16_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umin32)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint32_t)) {
+ uint32_t aa = *(uint32_t *)(a + i);
+ uint32_t bb = *(uint32_t *)(b + i);
+ uint32_t dd = aa < bb ? aa : bb;
+ *(uint32_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umin64)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint64_t)) {
+ uint64_t aa = *(uint64_t *)(a + i);
+ uint64_t bb = *(uint64_t *)(b + i);
+ uint64_t dd = aa < bb ? aa : bb;
+ *(uint64_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umax8)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint8_t)) {
+ uint8_t aa = *(uint8_t *)(a + i);
+ uint8_t bb = *(uint8_t *)(b + i);
+ uint8_t dd = aa > bb ? aa : bb;
+ *(uint8_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umax16)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint16_t)) {
+ uint16_t aa = *(uint16_t *)(a + i);
+ uint16_t bb = *(uint16_t *)(b + i);
+ uint16_t dd = aa > bb ? aa : bb;
+ *(uint16_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umax32)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint32_t)) {
+ uint32_t aa = *(uint32_t *)(a + i);
+ uint32_t bb = *(uint32_t *)(b + i);
+ uint32_t dd = aa > bb ? aa : bb;
+ *(uint32_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
+
+void HELPER(gvec_umax64)(void *d, void *a, void *b, uint32_t desc)
+{
+ intptr_t oprsz = simd_oprsz(desc);
+ intptr_t i;
+
+ for (i = 0; i < oprsz; i += sizeof(uint64_t)) {
+ uint64_t aa = *(uint64_t *)(a + i);
+ uint64_t bb = *(uint64_t *)(b + i);
+ uint64_t dd = aa > bb ? aa : bb;
+ *(uint64_t *)(d + i) = dd;
+ }
+ clear_high(d, oprsz, desc);
+}
diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h
index 1bd39d136d..dfe325625c 100644
--- a/accel/tcg/tcg-runtime.h
+++ b/accel/tcg/tcg-runtime.h
@@ -200,6 +200,26 @@ DEF_HELPER_FLAGS_4(gvec_ussub16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_ussub32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_ussub64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_smin8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_smin16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_smin32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_smin64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_4(gvec_smax8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_smax16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_smax32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_smax64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_4(gvec_umin8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_umin16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_umin32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_umin64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_4(gvec_umax8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_umax16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_umax32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_umax64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+
DEF_HELPER_FLAGS_3(gvec_neg8, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
DEF_HELPER_FLAGS_3(gvec_neg16, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
DEF_HELPER_FLAGS_3(gvec_neg32, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
@@ -211,6 +231,9 @@ DEF_HELPER_FLAGS_4(gvec_or, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_xor, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_andc, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_orc, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_nand, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_nor, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_4(gvec_eqv, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_ands, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
DEF_HELPER_FLAGS_4(gvec_xors, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 8cb8c8870e..8f593b926f 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -1688,6 +1688,9 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
cflags |= CF_NOCACHE | 1;
}
+ cflags &= ~CF_CLUSTER_MASK;
+ cflags |= cpu->cluster_index << CF_CLUSTER_SHIFT;
+
buffer_overflow:
tb = tb_alloc(pc);
if (unlikely(!tb)) {
diff --git a/accel/tcg/translate-all.h b/accel/tcg/translate-all.h
index 08e2f23a46..64f5fd9a05 100644
--- a/accel/tcg/translate-all.h
+++ b/accel/tcg/translate-all.h
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 941295ea49..0789984fe6 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -479,28 +479,66 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#elif defined(__aarch64__)
+#ifndef ESR_MAGIC
+/* Pre-3.16 kernel headers don't have these, so provide fallback definitions */
+#define ESR_MAGIC 0x45535201
+struct esr_context {
+ struct _aarch64_ctx head;
+ uint64_t esr;
+};
+#endif
+
+static inline struct _aarch64_ctx *first_ctx(ucontext_t *uc)
+{
+ return (struct _aarch64_ctx *)&uc->uc_mcontext.__reserved;
+}
+
+static inline struct _aarch64_ctx *next_ctx(struct _aarch64_ctx *hdr)
+{
+ return (struct _aarch64_ctx *)((char *)hdr + hdr->size);
+}
+
int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
{
siginfo_t *info = pinfo;
ucontext_t *uc = puc;
uintptr_t pc = uc->uc_mcontext.pc;
- uint32_t insn = *(uint32_t *)pc;
bool is_write;
+ struct _aarch64_ctx *hdr;
+ struct esr_context const *esrctx = NULL;
- /* XXX: need kernel patch to get write flag faster. */
- is_write = ( (insn & 0xbfff0000) == 0x0c000000 /* C3.3.1 */
- || (insn & 0xbfe00000) == 0x0c800000 /* C3.3.2 */
- || (insn & 0xbfdf0000) == 0x0d000000 /* C3.3.3 */
- || (insn & 0xbfc00000) == 0x0d800000 /* C3.3.4 */
- || (insn & 0x3f400000) == 0x08000000 /* C3.3.6 */
- || (insn & 0x3bc00000) == 0x39000000 /* C3.3.13 */
- || (insn & 0x3fc00000) == 0x3d800000 /* ... 128bit */
- /* Ingore bits 10, 11 & 21, controlling indexing. */
- || (insn & 0x3bc00000) == 0x38000000 /* C3.3.8-12 */
- || (insn & 0x3fe00000) == 0x3c800000 /* ... 128bit */
- /* Ignore bits 23 & 24, controlling indexing. */
- || (insn & 0x3a400000) == 0x28000000); /* C3.3.7,14-16 */
+ /* Find the esr_context, which has the WnR bit in it */
+ for (hdr = first_ctx(uc); hdr->magic; hdr = next_ctx(hdr)) {
+ if (hdr->magic == ESR_MAGIC) {
+ esrctx = (struct esr_context const *)hdr;
+ break;
+ }
+ }
+ if (esrctx) {
+ /* For data aborts ESR.EC is 0b10010x: then bit 6 is the WnR bit */
+ uint64_t esr = esrctx->esr;
+ is_write = extract32(esr, 27, 5) == 0x12 && extract32(esr, 6, 1) == 1;
+ } else {
+ /*
+ * Fall back to parsing instructions; will only be needed
+ * for really ancient (pre-3.16) kernels.
+ */
+ uint32_t insn = *(uint32_t *)pc;
+
+ is_write = ((insn & 0xbfff0000) == 0x0c000000 /* C3.3.1 */
+ || (insn & 0xbfe00000) == 0x0c800000 /* C3.3.2 */
+ || (insn & 0xbfdf0000) == 0x0d000000 /* C3.3.3 */
+ || (insn & 0xbfc00000) == 0x0d800000 /* C3.3.4 */
+ || (insn & 0x3f400000) == 0x08000000 /* C3.3.6 */
+ || (insn & 0x3bc00000) == 0x39000000 /* C3.3.13 */
+ || (insn & 0x3fc00000) == 0x3d800000 /* ... 128bit */
+ /* Ignore bits 10, 11 & 21, controlling indexing. */
+ || (insn & 0x3bc00000) == 0x38000000 /* C3.3.8-12 */
+ || (insn & 0x3fe00000) == 0x3c800000 /* ... 128bit */
+ /* Ignore bits 23 & 24, controlling indexing. */
+ || (insn & 0x3a400000) == 0x28000000); /* C3.3.7,14-16 */
+ }
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
}
diff --git a/audio/audio.c b/audio/audio.c
index 1ace47f510..d163ffbc88 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1762,7 +1762,7 @@ void AUD_help (void)
);
}
-static int audio_driver_init (AudioState *s, struct audio_driver *drv)
+static int audio_driver_init(AudioState *s, struct audio_driver *drv, bool msg)
{
if (drv->options) {
audio_process_options (drv->name, drv->options);
@@ -1776,7 +1776,9 @@ static int audio_driver_init (AudioState *s, struct audio_driver *drv)
return 0;
}
else {
- dolog ("Could not init `%s' audio driver\n", drv->name);
+ if (msg) {
+ dolog("Could not init `%s' audio driver\n", drv->name);
+ }
return -1;
}
}
@@ -1901,7 +1903,7 @@ static void audio_init (void)
if (drvname) {
driver = audio_driver_lookup(drvname);
if (driver) {
- done = !audio_driver_init(s, driver);
+ done = !audio_driver_init(s, driver, true);
} else {
dolog ("Unknown audio driver `%s'\n", drvname);
dolog ("Run with -audio-help to list available drivers\n");
@@ -1912,14 +1914,14 @@ static void audio_init (void)
for (i = 0; !done && i < ARRAY_SIZE(audio_prio_list); i++) {
driver = audio_driver_lookup(audio_prio_list[i]);
if (driver && driver->can_be_default) {
- done = !audio_driver_init(s, driver);
+ done = !audio_driver_init(s, driver, false);
}
}
}
if (!done) {
driver = audio_driver_lookup("none");
- done = !audio_driver_init(s, driver);
+ done = !audio_driver_init(s, driver, false);
assert(done);
dolog("warning: Using timer based audio emulation\n");
}
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 244b454012..6c451b995c 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -191,7 +191,7 @@ struct SWVoiceCap {
QLIST_ENTRY (SWVoiceCap) entries;
};
-struct AudioState {
+typedef struct AudioState {
struct audio_driver *drv;
void *drv_opaque;
@@ -203,7 +203,7 @@ struct AudioState {
int nb_hw_voices_out;
int nb_hw_voices_in;
int vm_running;
-};
+} AudioState;
extern const struct mixeng_volume nominal_volume;
diff --git a/audio/paaudio.c b/audio/paaudio.c
index 4c100bc318..6153b908da 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -814,6 +814,21 @@ static PAConf glob_conf = {
static void *qpa_audio_init (void)
{
+ if (glob_conf.server == NULL) {
+ char pidfile[64];
+ char *runtime;
+ struct stat st;
+
+ runtime = getenv("XDG_RUNTIME_DIR");
+ if (!runtime) {
+ return NULL;
+ }
+ snprintf(pidfile, sizeof(pidfile), "%s/pulse/pid", runtime);
+ if (stat(pidfile, &st) != 0) {
+ return NULL;
+ }
+ }
+
paaudio *g = g_malloc(sizeof(paaudio));
g->conf = glob_conf;
g->mainloop = NULL;
diff --git a/audio/wavcapture.c b/audio/wavcapture.c
index cf31ed652c..cd24570aa7 100644
--- a/audio/wavcapture.c
+++ b/audio/wavcapture.c
@@ -38,30 +38,29 @@ static void wav_destroy (void *opaque)
uint8_t dlen[4];
uint32_t datalen = wav->bytes;
uint32_t rifflen = datalen + 36;
- Monitor *mon = cur_mon;
if (wav->f) {
le_store (rlen, rifflen, 4);
le_store (dlen, datalen, 4);
if (fseek (wav->f, 4, SEEK_SET)) {
- monitor_printf (mon, "wav_destroy: rlen fseek failed\nReason: %s\n",
- strerror (errno));
+ error_report("wav_destroy: rlen fseek failed: %s",
+ strerror(errno));
goto doclose;
}
if (fwrite (rlen, 4, 1, wav->f) != 1) {
- monitor_printf (mon, "wav_destroy: rlen fwrite failed\nReason %s\n",
- strerror (errno));
+ error_report("wav_destroy: rlen fwrite failed: %s",
+ strerror(errno));
goto doclose;
}
if (fseek (wav->f, 32, SEEK_CUR)) {
- monitor_printf (mon, "wav_destroy: dlen fseek failed\nReason %s\n",
- strerror (errno));
+ error_report("wav_destroy: dlen fseek failed: %s",
+ strerror(errno));
goto doclose;
}
if (fwrite (dlen, 1, 4, wav->f) != 4) {
- monitor_printf (mon, "wav_destroy: dlen fwrite failed\nReason %s\n",
- strerror (errno));
+ error_report("wav_destroy: dlen fwrite failed: %s",
+ strerror(errno));
goto doclose;
}
doclose:
@@ -78,8 +77,7 @@ static void wav_capture (void *opaque, void *buf, int size)
WAVState *wav = opaque;
if (fwrite (buf, size, 1, wav->f) != 1) {
- monitor_printf (cur_mon, "wav_capture: fwrite error\nReason: %s",
- strerror (errno));
+ error_report("wav_capture: fwrite error: %s", strerror(errno));
}
wav->bytes += size;
}
@@ -110,7 +108,6 @@ static struct capture_ops wav_capture_ops = {
int wav_start_capture (CaptureState *s, const char *path, int freq,
int bits, int nchannels)
{
- Monitor *mon = cur_mon;
WAVState *wav;
uint8_t hdr[] = {
0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x41, 0x56,
@@ -124,13 +121,13 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
CaptureVoiceOut *cap;
if (bits != 8 && bits != 16) {
- monitor_printf (mon, "incorrect bit count %d, must be 8 or 16\n", bits);
+ error_report("incorrect bit count %d, must be 8 or 16", bits);
return -1;
}
if (nchannels != 1 && nchannels != 2) {
- monitor_printf (mon, "incorrect channel count %d, must be 1 or 2\n",
- nchannels);
+ error_report("incorrect channel count %d, must be 1 or 2",
+ nchannels);
return -1;
}
@@ -158,8 +155,8 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
wav->f = fopen (path, "wb");
if (!wav->f) {
- monitor_printf (mon, "Failed to open wave file `%s'\nReason: %s\n",
- path, strerror (errno));
+ error_report("Failed to open wave file `%s': %s",
+ path, strerror(errno));
g_free (wav);
return -1;
}
@@ -170,14 +167,13 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
wav->freq = freq;
if (fwrite (hdr, sizeof (hdr), 1, wav->f) != 1) {
- monitor_printf (mon, "Failed to write header\nReason: %s\n",
- strerror (errno));
+ error_report("Failed to write header: %s", strerror(errno));
goto error_free;
}
cap = AUD_add_capture (&as, &ops, wav);
if (!cap) {
- monitor_printf (mon, "Failed to add audio capture\n");
+ error_report("Failed to add audio capture");
goto error_free;
}
@@ -189,8 +185,7 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
error_free:
g_free (wav->path);
if (fclose (wav->f)) {
- monitor_printf (mon, "Failed to close wave file\nReason: %s\n",
- strerror (errno));
+ error_report("Failed to close wave file: %s", strerror(errno));
}
g_free (wav);
return -1;
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index 7a34e25c43..ba601ce940 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -82,7 +82,8 @@ static void set_mem_path(Object *o, const char *str, Error **errp)
HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
if (host_memory_backend_mr_inited(backend)) {
- error_setg(errp, "cannot change property value");
+ error_setg(errp, "cannot change property 'mem-path' of %s",
+ object_get_typename(o));
return;
}
g_free(fb->mem_path);
@@ -120,7 +121,8 @@ static void file_memory_backend_set_align(Object *o, Visitor *v,
uint64_t val;
if (host_memory_backend_mr_inited(backend)) {
- error_setg(&local_err, "cannot change property value");
+ error_setg(&local_err, "cannot change property '%s' of %s",
+ name, object_get_typename(o));
goto out;
}
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 0c8ef17653..87b19d2111 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -57,7 +57,8 @@ host_memory_backend_set_size(Object *obj, Visitor *v, const char *name,
uint64_t value;
if (host_memory_backend_mr_inited(backend)) {
- error_setg(&local_err, "cannot change property value");
+ error_setg(&local_err, "cannot change property %s of %s ",
+ name, object_get_typename(obj));
goto out;
}
@@ -66,8 +67,9 @@ host_memory_backend_set_size(Object *obj, Visitor *v, const char *name,
goto out;
}
if (!value) {
- error_setg(&local_err, "Property '%s.%s' doesn't take value '%"
- PRIu64 "'", object_get_typename(obj), name, value);
+ error_setg(&local_err,
+ "property '%s' of %s doesn't take value '%" PRIu64 "'",
+ name, object_get_typename(obj), value);
goto out;
}
backend->size = value;
diff --git a/block.c b/block.c
index 4f5ff2cc12..4ad0e90d7e 100644
--- a/block.c
+++ b/block.c
@@ -1438,13 +1438,19 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
bs->read_only = !(bs->open_flags & BDRV_O_RDWR);
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
- error_setg(errp,
- !bs->read_only && bdrv_is_whitelisted(drv, true)
- ? "Driver '%s' can only be used for read-only devices"
- : "Driver '%s' is not whitelisted",
- drv->format_name);
- ret = -ENOTSUP;
- goto fail_opts;
+ if (!bs->read_only && bdrv_is_whitelisted(drv, true)) {
+ ret = bdrv_apply_auto_read_only(bs, NULL, NULL);
+ } else {
+ ret = -ENOTSUP;
+ }
+ if (ret < 0) {
+ error_setg(errp,
+ !bs->read_only && bdrv_is_whitelisted(drv, true)
+ ? "Driver '%s' can only be used for read-only devices"
+ : "Driver '%s' is not whitelisted",
+ drv->format_name);
+ goto fail_opts;
+ }
}
/* bdrv_new() and bdrv_close() make it so */
@@ -3725,6 +3731,7 @@ static void bdrv_check_co_entry(void *opaque)
{
CheckCo *cco = opaque;
cco->ret = bdrv_co_check(cco->bs, cco->res, cco->fix);
+ aio_wait_kick();
}
int bdrv_check(BlockDriverState *bs,
@@ -3743,7 +3750,7 @@ int bdrv_check(BlockDriverState *bs,
bdrv_check_co_entry(&cco);
} else {
co = qemu_coroutine_create(bdrv_check_co_entry, &cco);
- qemu_coroutine_enter(co);
+ bdrv_coroutine_enter(bs, co);
BDRV_POLL_WHILE(bs, cco.ret == -EINPROGRESS);
}
@@ -4119,6 +4126,154 @@ BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp)
return list;
}
+#define QAPI_LIST_ADD(list, element) do { \
+ typeof(list) _tmp = g_new(typeof(*(list)), 1); \
+ _tmp->value = (element); \
+ _tmp->next = (list); \
+ (list) = _tmp; \
+} while (0)
+
+typedef struct XDbgBlockGraphConstructor {
+ XDbgBlockGraph *graph;
+ GHashTable *graph_nodes;
+} XDbgBlockGraphConstructor;
+
+static XDbgBlockGraphConstructor *xdbg_graph_new(void)
+{
+ XDbgBlockGraphConstructor *gr = g_new(XDbgBlockGraphConstructor, 1);
+
+ gr->graph = g_new0(XDbgBlockGraph, 1);
+ gr->graph_nodes = g_hash_table_new(NULL, NULL);
+
+ return gr;
+}
+
+static XDbgBlockGraph *xdbg_graph_finalize(XDbgBlockGraphConstructor *gr)
+{
+ XDbgBlockGraph *graph = gr->graph;
+
+ g_hash_table_destroy(gr->graph_nodes);
+ g_free(gr);
+
+ return graph;
+}
+
+static uintptr_t xdbg_graph_node_num(XDbgBlockGraphConstructor *gr, void *node)
+{
+ uintptr_t ret = (uintptr_t)g_hash_table_lookup(gr->graph_nodes, node);
+
+ if (ret != 0) {
+ return ret;
+ }
+
+ /*
+ * Start counting from 1, not 0, because 0 interferes with not-found (NULL)
+ * answer of g_hash_table_lookup.
+ */
+ ret = g_hash_table_size(gr->graph_nodes) + 1;
+ g_hash_table_insert(gr->graph_nodes, node, (void *)ret);
+
+ return ret;
+}
+
+static void xdbg_graph_add_node(XDbgBlockGraphConstructor *gr, void *node,
+ XDbgBlockGraphNodeType type, const char *name)
+{
+ XDbgBlockGraphNode *n;
+
+ n = g_new0(XDbgBlockGraphNode, 1);
+
+ n->id = xdbg_graph_node_num(gr, node);
+ n->type = type;
+ n->name = g_strdup(name);
+
+ QAPI_LIST_ADD(gr->graph->nodes, n);
+}
+
+static void xdbg_graph_add_edge(XDbgBlockGraphConstructor *gr, void *parent,
+ const BdrvChild *child)
+{
+ typedef struct {
+ unsigned int flag;
+ BlockPermission num;
+ } PermissionMap;
+
+ static const PermissionMap permissions[] = {
+ { BLK_PERM_CONSISTENT_READ, BLOCK_PERMISSION_CONSISTENT_READ },
+ { BLK_PERM_WRITE, BLOCK_PERMISSION_WRITE },
+ { BLK_PERM_WRITE_UNCHANGED, BLOCK_PERMISSION_WRITE_UNCHANGED },
+ { BLK_PERM_RESIZE, BLOCK_PERMISSION_RESIZE },
+ { BLK_PERM_GRAPH_MOD, BLOCK_PERMISSION_GRAPH_MOD },
+ { 0, 0 }
+ };
+ const PermissionMap *p;
+ XDbgBlockGraphEdge *edge;
+
+ QEMU_BUILD_BUG_ON(1UL << (ARRAY_SIZE(permissions) - 1) != BLK_PERM_ALL + 1);
+
+ edge = g_new0(XDbgBlockGraphEdge, 1);
+
+ edge->parent = xdbg_graph_node_num(gr, parent);
+ edge->child = xdbg_graph_node_num(gr, child->bs);
+ edge->name = g_strdup(child->name);
+
+ for (p = permissions; p->flag; p++) {
+ if (p->flag & child->perm) {
+ QAPI_LIST_ADD(edge->perm, p->num);
+ }
+ if (p->flag & child->shared_perm) {
+ QAPI_LIST_ADD(edge->shared_perm, p->num);
+ }
+ }
+
+ QAPI_LIST_ADD(gr->graph->edges, edge);
+}
+
+
+XDbgBlockGraph *bdrv_get_xdbg_block_graph(Error **errp)
+{
+ BlockBackend *blk;
+ BlockJob *job;
+ BlockDriverState *bs;
+ BdrvChild *child;
+ XDbgBlockGraphConstructor *gr = xdbg_graph_new();
+
+ for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
+ char *allocated_name = NULL;
+ const char *name = blk_name(blk);
+
+ if (!*name) {
+ name = allocated_name = blk_get_attached_dev_id(blk);
+ }
+ xdbg_graph_add_node(gr, blk, X_DBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_BACKEND,
+ name);
+ g_free(allocated_name);
+ if (blk_root(blk)) {
+ xdbg_graph_add_edge(gr, blk, blk_root(blk));
+ }
+ }
+
+ for (job = block_job_next(NULL); job; job = block_job_next(job)) {
+ GSList *el;
+
+ xdbg_graph_add_node(gr, job, X_DBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_JOB,
+ job->job.id);
+ for (el = job->nodes; el; el = el->next) {
+ xdbg_graph_add_edge(gr, job, (BdrvChild *)el->data);
+ }
+ }
+
+ QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {
+ xdbg_graph_add_node(gr, bs, X_DBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_DRIVER,
+ bs->node_name);
+ QLIST_FOREACH(child, &bs->children, next) {
+ xdbg_graph_add_edge(gr, bs, child);
+ }
+ }
+
+ return xdbg_graph_finalize(gr);
+}
+
BlockDriverState *bdrv_lookup_bs(const char *device,
const char *node_name,
Error **errp)
@@ -4307,11 +4462,12 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
return drv->bdrv_get_info(bs, bdi);
}
-ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs)
+ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs,
+ Error **errp)
{
BlockDriver *drv = bs->drv;
if (drv && drv->bdrv_get_specific_info) {
- return drv->bdrv_get_specific_info(bs);
+ return drv->bdrv_get_specific_info(bs, errp);
}
return NULL;
}
@@ -4542,6 +4698,7 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,
if (parent->role->activate) {
parent->role->activate(parent, &local_err);
if (local_err) {
+ bs->open_flags |= BDRV_O_INACTIVE;
error_propagate(errp, local_err);
return;
}
@@ -4560,6 +4717,7 @@ static void coroutine_fn bdrv_invalidate_cache_co_entry(void *opaque)
InvalidateCacheCo *ico = opaque;
bdrv_co_invalidate_cache(ico->bs, ico->errp);
ico->done = true;
+ aio_wait_kick();
}
void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)
@@ -4576,7 +4734,7 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)
bdrv_invalidate_cache_co_entry(&ico);
} else {
co = qemu_coroutine_create(bdrv_invalidate_cache_co_entry, &ico);
- qemu_coroutine_enter(co);
+ bdrv_coroutine_enter(bs, co);
BDRV_POLL_WHILE(bs, !ico.done);
}
}
diff --git a/block/blklogwrites.c b/block/blklogwrites.c
index ff98cd5533..d2e01bdb1d 100644
--- a/block/blklogwrites.c
+++ b/block/blklogwrites.c
@@ -295,10 +295,9 @@ static void blk_log_writes_refresh_filename(BlockDriverState *bs,
qdict_put_str(opts, "driver", "blklogwrites");
qobject_ref(bs->file->bs->full_open_options);
- qdict_put_obj(opts, "file", QOBJECT(bs->file->bs->full_open_options));
+ qdict_put(opts, "file", bs->file->bs->full_open_options);
qobject_ref(s->log_file->bs->full_open_options);
- qdict_put_obj(opts, "log",
- QOBJECT(s->log_file->bs->full_open_options));
+ qdict_put(opts, "log", s->log_file->bs->full_open_options);
qdict_put_int(opts, "log-sector-size", s->sectorsize);
bs->full_open_options = opts;
diff --git a/block/block-backend.c b/block/block-backend.c
index 60d37a0c3d..f6ea824308 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -47,9 +47,7 @@ struct BlockBackend {
QTAILQ_ENTRY(BlockBackend) monitor_link; /* for monitor_block_backends */
BlockBackendPublic public;
- void *dev; /* attached device model, if any */
- bool legacy_dev; /* true if dev is not a DeviceState */
- /* TODO change to DeviceState when all users are qdevified */
+ DeviceState *dev; /* attached device model, if any */
const BlockDevOps *dev_ops;
void *dev_opaque;
@@ -836,7 +834,11 @@ void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm)
*shared_perm = blk->shared_perm;
}
-static int blk_do_attach_dev(BlockBackend *blk, void *dev)
+/*
+ * Attach device model @dev to @blk.
+ * Return 0 on success, -EBUSY when a device model is attached already.
+ */
+int blk_attach_dev(BlockBackend *blk, DeviceState *dev)
{
if (blk->dev) {
return -EBUSY;
@@ -851,40 +853,16 @@ static int blk_do_attach_dev(BlockBackend *blk, void *dev)
blk_ref(blk);
blk->dev = dev;
- blk->legacy_dev = false;
blk_iostatus_reset(blk);
return 0;
}
/*
- * Attach device model @dev to @blk.
- * Return 0 on success, -EBUSY when a device model is attached already.
- */
-int blk_attach_dev(BlockBackend *blk, DeviceState *dev)
-{
- return blk_do_attach_dev(blk, dev);
-}
-
-/*
- * Attach device model @dev to @blk.
- * @blk must not have a device model attached already.
- * TODO qdevified devices don't use this, remove when devices are qdevified
- */
-void blk_attach_dev_legacy(BlockBackend *blk, void *dev)
-{
- if (blk_do_attach_dev(blk, dev) < 0) {
- abort();
- }
- blk->legacy_dev = true;
-}
-
-/*
* Detach device model @dev from @blk.
* @dev must be currently attached to @blk.
*/
-void blk_detach_dev(BlockBackend *blk, void *dev)
-/* TODO change to DeviceState *dev when all users are qdevified */
+void blk_detach_dev(BlockBackend *blk, DeviceState *dev)
{
assert(blk->dev == dev);
blk->dev = NULL;
@@ -898,8 +876,7 @@ void blk_detach_dev(BlockBackend *blk, void *dev)
/*
* Return the device model attached to @blk if any, else null.
*/
-void *blk_get_attached_dev(BlockBackend *blk)
-/* TODO change to return DeviceState * when all users are qdevified */
+DeviceState *blk_get_attached_dev(BlockBackend *blk)
{
return blk->dev;
}
@@ -908,10 +885,7 @@ void *blk_get_attached_dev(BlockBackend *blk)
* device attached to the BlockBackend. */
char *blk_get_attached_dev_id(BlockBackend *blk)
{
- DeviceState *dev;
-
- assert(!blk->legacy_dev);
- dev = blk->dev;
+ DeviceState *dev = blk->dev;
if (!dev) {
return g_strdup("");
@@ -949,11 +923,6 @@ BlockBackend *blk_by_dev(void *dev)
void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops,
void *opaque)
{
- /* All drivers that use blk_set_dev_ops() are qdevified and we want to keep
- * it that way, so we can assume blk->dev, if present, is a DeviceState if
- * blk->dev_ops is set. Non-device users may use dev_ops without device. */
- assert(!blk->legacy_dev);
-
blk->dev_ops = ops;
blk->dev_opaque = opaque;
@@ -979,8 +948,6 @@ void blk_dev_change_media_cb(BlockBackend *blk, bool load, Error **errp)
bool tray_was_open, tray_is_open;
Error *local_err = NULL;
- assert(!blk->legacy_dev);
-
tray_was_open = blk_dev_is_tray_open(blk);
blk->dev_ops->change_media_cb(blk->dev_opaque, load, &local_err);
if (local_err) {
@@ -1220,6 +1187,7 @@ static void blk_read_entry(void *opaque)
rwco->ret = blk_co_preadv(rwco->blk, rwco->offset, qiov->size,
qiov, rwco->flags);
+ aio_wait_kick();
}
static void blk_write_entry(void *opaque)
@@ -1229,6 +1197,7 @@ static void blk_write_entry(void *opaque)
rwco->ret = blk_co_pwritev(rwco->blk, rwco->offset, qiov->size,
qiov, rwco->flags);
+ aio_wait_kick();
}
static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf,
@@ -1540,6 +1509,7 @@ static void blk_ioctl_entry(void *opaque)
rwco->ret = blk_co_ioctl(rwco->blk, rwco->offset,
qiov->iov[0].iov_base);
+ aio_wait_kick();
}
int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
@@ -1586,6 +1556,7 @@ static void blk_flush_entry(void *opaque)
{
BlkRwCo *rwco = opaque;
rwco->ret = blk_co_flush(rwco->blk);
+ aio_wait_kick();
}
int blk_flush(BlockBackend *blk)
@@ -1779,9 +1750,6 @@ void blk_eject(BlockBackend *blk, bool eject_flag)
BlockDriverState *bs = blk_bs(blk);
char *id;
- /* blk_eject is only called by qdevified devices */
- assert(!blk->legacy_dev);
-
if (bs) {
bdrv_eject(bs, eject_flag);
}
@@ -2018,6 +1986,7 @@ static void blk_pdiscard_entry(void *opaque)
QEMUIOVector *qiov = rwco->iobuf;
rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, qiov->size);
+ aio_wait_kick();
}
int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
@@ -2249,3 +2218,8 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
blk_out->root, off_out,
bytes, read_flags, write_flags);
}
+
+const BdrvChild *blk_root(BlockBackend *blk)
+{
+ return blk->root;
+}
diff --git a/block/crypto.c b/block/crypto.c
index f0a5f6b987..d5b1da66a1 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -594,20 +594,17 @@ static int block_crypto_get_info_luks(BlockDriverState *bs,
}
static ImageInfoSpecific *
-block_crypto_get_specific_info_luks(BlockDriverState *bs)
+block_crypto_get_specific_info_luks(BlockDriverState *bs, Error **errp)
{
BlockCrypto *crypto = bs->opaque;
ImageInfoSpecific *spec_info;
QCryptoBlockInfo *info;
- info = qcrypto_block_get_info(crypto->block, NULL);
+ info = qcrypto_block_get_info(crypto->block, errp);
if (!info) {
return NULL;
}
- if (info->format != Q_CRYPTO_BLOCK_FORMAT_LUKS) {
- qapi_free_QCryptoBlockInfo(info);
- return NULL;
- }
+ assert(info->format == Q_CRYPTO_BLOCK_FORMAT_LUKS);
spec_info = g_new(ImageInfoSpecific, 1);
spec_info->type = IMAGE_INFO_SPECIFIC_KIND_LUKS;
diff --git a/block/curl.c b/block/curl.c
index db5d2bd8ef..b7ac265d3a 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -32,22 +32,10 @@
#include "crypto/secret.h"
#include <curl/curl.h>
#include "qemu/cutils.h"
+#include "trace.h"
-// #define DEBUG_CURL
// #define DEBUG_VERBOSE
-#ifdef DEBUG_CURL
-#define DEBUG_CURL_PRINT 1
-#else
-#define DEBUG_CURL_PRINT 0
-#endif
-#define DPRINTF(fmt, ...) \
- do { \
- if (DEBUG_CURL_PRINT) { \
- fprintf(stderr, fmt, ## __VA_ARGS__); \
- } \
- } while (0)
-
#if LIBCURL_VERSION_NUM >= 0x071000
/* The multi interface timer callback was introduced in 7.16.0 */
#define NEED_CURL_TIMER_CALLBACK
@@ -154,7 +142,7 @@ static int curl_timer_cb(CURLM *multi, long timeout_ms, void *opaque)
{
BDRVCURLState *s = opaque;
- DPRINTF("CURL: timer callback timeout_ms %ld\n", timeout_ms);
+ trace_curl_timer_cb(timeout_ms);
if (timeout_ms == -1) {
timer_del(&s->timer);
} else {
@@ -193,7 +181,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
}
socket = NULL;
- DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd);
+ trace_curl_sock_cb(action, (int)fd);
switch (action) {
case CURL_POLL_IN:
aio_set_fd_handler(s->aio_context, fd, false,
@@ -238,7 +226,7 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
size_t realsize = size * nmemb;
int i;
- DPRINTF("CURL: Just reading %zd bytes\n", realsize);
+ trace_curl_read_cb(realsize);
if (!s || !s->orig_buf) {
goto read_end;
@@ -777,7 +765,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
}
}
- DPRINTF("CURL: Opening %s\n", file);
+ trace_curl_open(file);
qemu_co_queue_init(&s->free_state_waitq);
s->aio_context = bdrv_get_aio_context(bs);
s->url = g_strdup(file);
@@ -830,7 +818,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
"Server does not support 'range' (byte ranges).");
goto out;
}
- DPRINTF("CURL: Size = %" PRIu64 "\n", s->len);
+ trace_curl_open_size(s->len);
qemu_mutex_lock(&s->mutex);
curl_clean_state(state);
@@ -908,8 +896,7 @@ static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
state->acb[0] = acb;
snprintf(state->range, 127, "%" PRIu64 "-%" PRIu64, start, end);
- DPRINTF("CURL (AIO): Reading %" PRIu64 " at %" PRIu64 " (%s)\n",
- acb->bytes, start, state->range);
+ trace_curl_setup_preadv(acb->bytes, start, state->range);
curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);
curl_multi_add_handle(s->multi, state->curl);
@@ -943,7 +930,7 @@ static void curl_close(BlockDriverState *bs)
{
BDRVCURLState *s = bs->opaque;
- DPRINTF("CURL: Close\n");
+ trace_curl_close();
curl_detach_aio_context(bs);
qemu_mutex_destroy(&s->mutex);
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 00ea36f554..c6d4acebfa 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -29,12 +29,20 @@
#include "block/blockjob.h"
/**
- * A BdrvDirtyBitmap can be in three possible states:
- * (1) successor is NULL and disabled is false: full r/w mode
- * (2) successor is NULL and disabled is true: read only mode ("disabled")
- * (3) successor is set: frozen mode.
- * A frozen bitmap cannot be renamed, deleted, anonymized, cleared, set,
- * or enabled. A frozen bitmap can only abdicate() or reclaim().
+ * A BdrvDirtyBitmap can be in four possible user-visible states:
+ * (1) Active: successor is NULL, and disabled is false: full r/w mode
+ * (2) Disabled: successor is NULL, and disabled is true: qualified r/w mode,
+ * guest writes are dropped, but monitor writes are possible,
+ * through commands like merge and clear.
+ * (3) Frozen: successor is not NULL.
+ * A frozen bitmap cannot be renamed, deleted, cleared, set,
+ * enabled, merged to, etc. A frozen bitmap can only abdicate()
+ * or reclaim().
+ * In this state, the anonymous successor bitmap may be either
+ * Active and recording writes from the guest (e.g. backup jobs),
+ * but it can be Disabled and not recording writes.
+ * (4) Locked: Whether Active or Disabled, the user cannot modify this bitmap
+ * in any way from the monitor.
*/
struct BdrvDirtyBitmap {
QemuMutex *mutex;
@@ -440,6 +448,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
info->has_name = !!bm->name;
info->name = g_strdup(bm->name);
info->status = bdrv_dirty_bitmap_status(bm);
+ info->persistent = bm->persistent;
entry->value = info;
*plist = entry;
plist = &entry->next;
diff --git a/block/file-posix.c b/block/file-posix.c
index 8aee7a3fb8..ba6ab62a38 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -102,19 +102,7 @@
#include <xfs/xfs.h>
#endif
-//#define DEBUG_BLOCK
-
-#ifdef DEBUG_BLOCK
-# define DEBUG_BLOCK_PRINT 1
-#else
-# define DEBUG_BLOCK_PRINT 0
-#endif
-#define DPRINTF(fmt, ...) \
-do { \
- if (DEBUG_BLOCK_PRINT) { \
- printf(fmt, ## __VA_ARGS__); \
- } \
-} while (0)
+#include "trace.h"
/* OS X does not have O_DSYNC */
#ifndef O_DSYNC
@@ -1411,7 +1399,7 @@ static int xfs_write_zeroes(BDRVRawState *s, int64_t offset, uint64_t bytes)
if (xfsctl(NULL, s->fd, XFS_IOC_ZERO_RANGE, &fl) < 0) {
err = errno;
- DPRINTF("cannot write zero range (%s)\n", strerror(errno));
+ trace_file_xfs_write_zeroes(strerror(errno));
return -err;
}
@@ -1430,7 +1418,7 @@ static int xfs_discard(BDRVRawState *s, int64_t offset, uint64_t bytes)
if (xfsctl(NULL, s->fd, XFS_IOC_UNRESVSP64, &fl) < 0) {
err = errno;
- DPRINTF("cannot punch hole (%s)\n", strerror(errno));
+ trace_file_xfs_discard(strerror(errno));
return -err;
}
@@ -2819,7 +2807,7 @@ static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator)
/* If a match was found, leave the loop */
if (*mediaIterator != 0) {
- DPRINTF("Matching using %s\n", matching_array[index]);
+ trace_file_FindEjectableOpticalMedia(matching_array[index]);
mediaType = g_strdup(matching_array[index]);
break;
}
@@ -2879,7 +2867,7 @@ static bool setup_cdrom(char *bsd_path, Error **errp)
if (partition_found == false) {
error_setg(errp, "Failed to find a working partition on disc");
} else {
- DPRINTF("Using %s as optical disc\n", test_partition);
+ trace_file_setup_cdrom(test_partition);
pstrcpy(bsd_path, MAXPATHLEN, test_partition);
}
return partition_found;
@@ -2974,8 +2962,7 @@ static bool hdev_is_sg(BlockDriverState *bs)
ret = ioctl(s->fd, SG_GET_SCSI_ID, &scsiid);
if (ret >= 0) {
- DPRINTF("SG device found: type=%d, version=%d\n",
- scsiid.scsi_type, sg_version);
+ trace_file_hdev_is_sg(scsiid.scsi_type, sg_version);
return true;
}
diff --git a/block/io.c b/block/io.c
index bd9d688f8b..213ca03d8d 100644
--- a/block/io.c
+++ b/block/io.c
@@ -806,6 +806,7 @@ static void coroutine_fn bdrv_rw_co_entry(void *opaque)
rwco->qiov->size, rwco->qiov,
rwco->flags);
}
+ aio_wait_kick();
}
/*
@@ -2279,6 +2280,7 @@ static void coroutine_fn bdrv_block_status_above_co_entry(void *opaque)
data->offset, data->bytes,
data->pnum, data->map, data->file);
data->done = true;
+ aio_wait_kick();
}
/*
@@ -2438,6 +2440,7 @@ static void coroutine_fn bdrv_co_rw_vmstate_entry(void *opaque)
{
BdrvVmstateCo *co = opaque;
co->ret = bdrv_co_rw_vmstate(co->bs, co->qiov, co->pos, co->is_read);
+ aio_wait_kick();
}
static inline int
@@ -2559,6 +2562,7 @@ static void coroutine_fn bdrv_flush_co_entry(void *opaque)
FlushCo *rwco = opaque;
rwco->ret = bdrv_co_flush(rwco->bs);
+ aio_wait_kick();
}
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
@@ -2704,6 +2708,7 @@ static void coroutine_fn bdrv_pdiscard_co_entry(void *opaque)
DiscardCo *rwco = opaque;
rwco->ret = bdrv_co_pdiscard(rwco->child, rwco->offset, rwco->bytes);
+ aio_wait_kick();
}
int coroutine_fn bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int bytes)
@@ -3217,6 +3222,7 @@ static void coroutine_fn bdrv_truncate_co_entry(void *opaque)
TruncateCo *tco = opaque;
tco->ret = bdrv_co_truncate(tco->child, tco->offset, tco->prealloc,
tco->errp);
+ aio_wait_kick();
}
int bdrv_truncate(BdrvChild *child, int64_t offset, PreallocMode prealloc,
@@ -3236,7 +3242,7 @@ int bdrv_truncate(BdrvChild *child, int64_t offset, PreallocMode prealloc,
bdrv_truncate_co_entry(&tco);
} else {
co = qemu_coroutine_create(bdrv_truncate_co_entry, &tco);
- qemu_coroutine_enter(co);
+ bdrv_coroutine_enter(child->bs, co);
BDRV_POLL_WHILE(child->bs, tco.ret == NOT_DONE);
}
diff --git a/block/iscsi.c b/block/iscsi.c
index a7e8c1ffaf..ff473206e6 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -49,7 +49,9 @@
/* Conflict between scsi/utils.h and libiscsi! :( */
#define SCSI_XFER_NONE ISCSI_XFER_NONE
#include <iscsi/iscsi.h>
+#define inline __attribute__((gnu_inline)) /* required for libiscsi v1.9.0 */
#include <iscsi/scsi-lowlevel.h>
+#undef inline
#undef SCSI_XFER_NONE
QEMU_BUILD_BUG_ON((int)SCSI_XFER_NONE != (int)ISCSI_XFER_NONE);
diff --git a/block/mirror.c b/block/mirror.c
index 24ede6fdaa..b67b0120f8 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1612,6 +1612,14 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
goto fail;
}
+ ret = block_job_add_bdrv(&s->common, "source", bs, 0,
+ BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
+ BLK_PERM_CONSISTENT_READ,
+ errp);
+ if (ret < 0) {
+ goto fail;
+ }
+
/* Required permissions are already taken with blk_new() */
block_job_add_bdrv(&s->common, "target", target, 0, BLK_PERM_ALL,
&error_abort);
@@ -1649,6 +1657,9 @@ fail:
g_free(s->replaces);
blk_unref(s->target);
bs_opaque->job = NULL;
+ if (s->dirty_bitmap) {
+ bdrv_release_dirty_bitmap(bs, s->dirty_bitmap);
+ }
job_early_fail(&s->common.job);
}
diff --git a/block/nbd-client.c b/block/nbd-client.c
index ef32075971..f0ad54ce21 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -53,15 +53,13 @@ static void nbd_teardown_connection(BlockDriverState *bs)
{
NBDClientSession *client = nbd_get_client_session(bs);
- if (!client->ioc) { /* Already closed */
- return;
- }
+ assert(client->ioc);
/* finish any pending coroutines */
qio_channel_shutdown(client->ioc,
QIO_CHANNEL_SHUTDOWN_BOTH,
NULL);
- BDRV_POLL_WHILE(bs, client->read_reply_co);
+ BDRV_POLL_WHILE(bs, client->connection_co);
nbd_client_detach_aio_context(bs);
object_unref(OBJECT(client->sioc));
@@ -70,7 +68,7 @@ static void nbd_teardown_connection(BlockDriverState *bs)
client->ioc = NULL;
}
-static coroutine_fn void nbd_read_reply_entry(void *opaque)
+static coroutine_fn void nbd_connection_entry(void *opaque)
{
NBDClientSession *s = opaque;
uint64_t i;
@@ -102,14 +100,14 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)
}
/* We're woken up again by the request itself. Note that there
- * is no race between yielding and reentering read_reply_co. This
+ * is no race between yielding and reentering connection_co. This
* is because:
*
* - if the request runs on the same AioContext, it is only
* entered after we yield
*
* - if the request runs on a different AioContext, reentering
- * read_reply_co happens through a bottom half, which can only
+ * connection_co happens through a bottom half, which can only
* run after we yield.
*/
aio_co_wake(s->requests[i].coroutine);
@@ -118,7 +116,8 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)
s->quit = true;
nbd_recv_coroutines_wake_all(s);
- s->read_reply_co = NULL;
+ s->connection_co = NULL;
+ aio_wait_kick();
}
static int nbd_co_send_request(BlockDriverState *bs,
@@ -153,10 +152,7 @@ static int nbd_co_send_request(BlockDriverState *bs,
rc = -EIO;
goto err;
}
- if (!s->ioc) {
- rc = -EPIPE;
- goto err;
- }
+ assert(s->ioc);
if (qiov) {
qio_channel_set_cork(s->ioc, true);
@@ -249,11 +245,11 @@ static int nbd_parse_blockstatus_payload(NBDClientSession *client,
}
context_id = payload_advance32(&payload);
- if (client->info.meta_base_allocation_id != context_id) {
+ if (client->info.context_id != context_id) {
error_setg(errp, "Protocol error: unexpected context id %d for "
"NBD_REPLY_TYPE_BLOCK_STATUS, when negotiated context "
"id is %d", context_id,
- client->info.meta_base_allocation_id);
+ client->info.context_id);
return -EINVAL;
}
@@ -337,10 +333,9 @@ static int nbd_co_receive_offset_data_payload(NBDClientSession *s,
return -EINVAL;
}
- if (nbd_read(s->ioc, &offset, sizeof(offset), errp) < 0) {
+ if (nbd_read64(s->ioc, &offset, "OFFSET_DATA offset", errp) < 0) {
return -EIO;
}
- be64_to_cpus(&offset);
data_size = chunk->length - sizeof(offset);
assert(data_size);
@@ -387,7 +382,7 @@ static coroutine_fn int nbd_co_receive_structured_payload(
}
*payload = g_new(char, len);
- ret = nbd_read(s->ioc, *payload, len, errp);
+ ret = nbd_read(s->ioc, *payload, len, "structured payload", errp);
if (ret < 0) {
g_free(*payload);
*payload = NULL;
@@ -425,14 +420,15 @@ static coroutine_fn int nbd_co_do_receive_one_chunk(
}
*request_ret = 0;
- /* Wait until we're woken up by nbd_read_reply_entry. */
+ /* Wait until we're woken up by nbd_connection_entry. */
s->requests[i].receiving = true;
qemu_coroutine_yield();
s->requests[i].receiving = false;
- if (!s->ioc || s->quit) {
+ if (s->quit) {
error_setg(errp, "Connection closed");
return -EIO;
}
+ assert(s->ioc);
assert(s->reply.handle == handle);
@@ -499,30 +495,29 @@ static coroutine_fn int nbd_co_do_receive_one_chunk(
}
/* nbd_co_receive_one_chunk
- * Read reply, wake up read_reply_co and set s->quit if needed.
+ * Read reply, wake up connection_co and set s->quit if needed.
* Return value is a fatal error code or normal nbd reply error code
*/
static coroutine_fn int nbd_co_receive_one_chunk(
NBDClientSession *s, uint64_t handle, bool only_structured,
- QEMUIOVector *qiov, NBDReply *reply, void **payload, Error **errp)
+ int *request_ret, QEMUIOVector *qiov, NBDReply *reply, void **payload,
+ Error **errp)
{
- int request_ret;
int ret = nbd_co_do_receive_one_chunk(s, handle, only_structured,
- &request_ret, qiov, payload, errp);
+ request_ret, qiov, payload, errp);
if (ret < 0) {
s->quit = true;
} else {
- /* For assert at loop start in nbd_read_reply_entry */
+ /* For assert at loop start in nbd_connection_entry */
if (reply) {
*reply = s->reply;
}
s->reply.handle = 0;
- ret = request_ret;
}
- if (s->read_reply_co) {
- aio_co_wake(s->read_reply_co);
+ if (s->connection_co) {
+ aio_co_wake(s->connection_co);
}
return ret;
@@ -530,22 +525,17 @@ static coroutine_fn int nbd_co_receive_one_chunk(
typedef struct NBDReplyChunkIter {
int ret;
- bool fatal;
+ int request_ret;
Error *err;
bool done, only_structured;
} NBDReplyChunkIter;
-static void nbd_iter_error(NBDReplyChunkIter *iter, bool fatal,
- int ret, Error **local_err)
+static void nbd_iter_channel_error(NBDReplyChunkIter *iter,
+ int ret, Error **local_err)
{
assert(ret < 0);
- if ((fatal && !iter->fatal) || iter->ret == 0) {
- if (iter->ret != 0) {
- error_free(iter->err);
- iter->err = NULL;
- }
- iter->fatal = fatal;
+ if (!iter->ret) {
iter->ret = ret;
error_propagate(&iter->err, *local_err);
} else {
@@ -555,6 +545,15 @@ static void nbd_iter_error(NBDReplyChunkIter *iter, bool fatal,
*local_err = NULL;
}
+static void nbd_iter_request_error(NBDReplyChunkIter *iter, int ret)
+{
+ assert(ret < 0);
+
+ if (!iter->request_ret) {
+ iter->request_ret = ret;
+ }
+}
+
/* NBD_FOREACH_REPLY_CHUNK
*/
#define NBD_FOREACH_REPLY_CHUNK(s, iter, handle, structured, \
@@ -570,13 +569,13 @@ static bool nbd_reply_chunk_iter_receive(NBDClientSession *s,
QEMUIOVector *qiov, NBDReply *reply,
void **payload)
{
- int ret;
+ int ret, request_ret;
NBDReply local_reply;
NBDStructuredReplyChunk *chunk;
Error *local_err = NULL;
if (s->quit) {
error_setg(&local_err, "Connection closed");
- nbd_iter_error(iter, true, -EIO, &local_err);
+ nbd_iter_channel_error(iter, -EIO, &local_err);
goto break_loop;
}
@@ -590,14 +589,16 @@ static bool nbd_reply_chunk_iter_receive(NBDClientSession *s,
}
ret = nbd_co_receive_one_chunk(s, handle, iter->only_structured,
- qiov, reply, payload, &local_err);
+ &request_ret, qiov, reply, payload,
+ &local_err);
if (ret < 0) {
- /* If it is a fatal error s->quit is set by nbd_co_receive_one_chunk */
- nbd_iter_error(iter, s->quit, ret, &local_err);
+ nbd_iter_channel_error(iter, ret, &local_err);
+ } else if (request_ret < 0) {
+ nbd_iter_request_error(iter, request_ret);
}
/* Do not execute the body of NBD_FOREACH_REPLY_CHUNK for simple reply. */
- if (nbd_reply_is_simple(&s->reply) || s->quit) {
+ if (nbd_reply_is_simple(reply) || s->quit) {
goto break_loop;
}
@@ -630,7 +631,7 @@ break_loop:
}
static int nbd_co_receive_return_code(NBDClientSession *s, uint64_t handle,
- Error **errp)
+ int *request_ret, Error **errp)
{
NBDReplyChunkIter iter;
@@ -639,12 +640,13 @@ static int nbd_co_receive_return_code(NBDClientSession *s, uint64_t handle,
}
error_propagate(errp, iter.err);
+ *request_ret = iter.request_ret;
return iter.ret;
}
static int nbd_co_receive_cmdread_reply(NBDClientSession *s, uint64_t handle,
uint64_t offset, QEMUIOVector *qiov,
- Error **errp)
+ int *request_ret, Error **errp)
{
NBDReplyChunkIter iter;
NBDReply reply;
@@ -669,7 +671,7 @@ static int nbd_co_receive_cmdread_reply(NBDClientSession *s, uint64_t handle,
offset, qiov, &local_err);
if (ret < 0) {
s->quit = true;
- nbd_iter_error(&iter, true, ret, &local_err);
+ nbd_iter_channel_error(&iter, ret, &local_err);
}
break;
default:
@@ -679,7 +681,7 @@ static int nbd_co_receive_cmdread_reply(NBDClientSession *s, uint64_t handle,
error_setg(&local_err,
"Unexpected reply type: %d (%s) for CMD_READ",
chunk->type, nbd_reply_type_lookup(chunk->type));
- nbd_iter_error(&iter, true, -EINVAL, &local_err);
+ nbd_iter_channel_error(&iter, -EINVAL, &local_err);
}
}
@@ -688,12 +690,14 @@ static int nbd_co_receive_cmdread_reply(NBDClientSession *s, uint64_t handle,
}
error_propagate(errp, iter.err);
+ *request_ret = iter.request_ret;
return iter.ret;
}
static int nbd_co_receive_blockstatus_reply(NBDClientSession *s,
uint64_t handle, uint64_t length,
- NBDExtent *extent, Error **errp)
+ NBDExtent *extent,
+ int *request_ret, Error **errp)
{
NBDReplyChunkIter iter;
NBDReply reply;
@@ -715,7 +719,7 @@ static int nbd_co_receive_blockstatus_reply(NBDClientSession *s,
if (received) {
s->quit = true;
error_setg(&local_err, "Several BLOCK_STATUS chunks in reply");
- nbd_iter_error(&iter, true, -EINVAL, &local_err);
+ nbd_iter_channel_error(&iter, -EINVAL, &local_err);
}
received = true;
@@ -724,7 +728,7 @@ static int nbd_co_receive_blockstatus_reply(NBDClientSession *s,
&local_err);
if (ret < 0) {
s->quit = true;
- nbd_iter_error(&iter, true, ret, &local_err);
+ nbd_iter_channel_error(&iter, ret, &local_err);
}
break;
default:
@@ -734,7 +738,7 @@ static int nbd_co_receive_blockstatus_reply(NBDClientSession *s,
"Unexpected reply type: %d (%s) "
"for CMD_BLOCK_STATUS",
chunk->type, nbd_reply_type_lookup(chunk->type));
- nbd_iter_error(&iter, true, -EINVAL, &local_err);
+ nbd_iter_channel_error(&iter, -EINVAL, &local_err);
}
}
@@ -749,14 +753,16 @@ static int nbd_co_receive_blockstatus_reply(NBDClientSession *s,
iter.ret = -EIO;
}
}
+
error_propagate(errp, iter.err);
+ *request_ret = iter.request_ret;
return iter.ret;
}
static int nbd_co_request(BlockDriverState *bs, NBDRequest *request,
QEMUIOVector *write_qiov)
{
- int ret;
+ int ret, request_ret;
Error *local_err = NULL;
NBDClientSession *client = nbd_get_client_session(bs);
@@ -772,7 +778,8 @@ static int nbd_co_request(BlockDriverState *bs, NBDRequest *request,
return ret;
}
- ret = nbd_co_receive_return_code(client, request->handle, &local_err);
+ ret = nbd_co_receive_return_code(client, request->handle,
+ &request_ret, &local_err);
if (local_err) {
trace_nbd_co_request_fail(request->from, request->len, request->handle,
request->flags, request->type,
@@ -780,13 +787,13 @@ static int nbd_co_request(BlockDriverState *bs, NBDRequest *request,
ret, error_get_pretty(local_err));
error_free(local_err);
}
- return ret;
+ return ret ? ret : request_ret;
}
int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, QEMUIOVector *qiov, int flags)
{
- int ret;
+ int ret, request_ret;
Error *local_err = NULL;
NBDClientSession *client = nbd_get_client_session(bs);
NBDRequest request = {
@@ -807,7 +814,7 @@ int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset,
}
ret = nbd_co_receive_cmdread_reply(client, request.handle, offset, qiov,
- &local_err);
+ &request_ret, &local_err);
if (local_err) {
trace_nbd_co_request_fail(request.from, request.len, request.handle,
request.flags, request.type,
@@ -815,7 +822,7 @@ int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset,
ret, error_get_pretty(local_err));
error_free(local_err);
}
- return ret;
+ return ret ? ret : request_ret;
}
int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset,
@@ -909,7 +916,7 @@ int coroutine_fn nbd_client_co_block_status(BlockDriverState *bs,
int64_t *pnum, int64_t *map,
BlockDriverState **file)
{
- int64_t ret;
+ int ret, request_ret;
NBDExtent extent = { 0 };
NBDClientSession *client = nbd_get_client_session(bs);
Error *local_err = NULL;
@@ -934,7 +941,7 @@ int coroutine_fn nbd_client_co_block_status(BlockDriverState *bs,
}
ret = nbd_co_receive_blockstatus_reply(client, request.handle, bytes,
- &extent, &local_err);
+ &extent, &request_ret, &local_err);
if (local_err) {
trace_nbd_co_request_fail(request.from, request.len, request.handle,
request.flags, request.type,
@@ -942,8 +949,8 @@ int coroutine_fn nbd_client_co_block_status(BlockDriverState *bs,
ret, error_get_pretty(local_err));
error_free(local_err);
}
- if (ret < 0) {
- return ret;
+ if (ret < 0 || request_ret < 0) {
+ return ret ? ret : request_ret;
}
assert(extent.length);
@@ -963,7 +970,7 @@ void nbd_client_attach_aio_context(BlockDriverState *bs,
{
NBDClientSession *client = nbd_get_client_session(bs);
qio_channel_attach_aio_context(QIO_CHANNEL(client->ioc), new_context);
- aio_co_schedule(new_context, client->read_reply_co);
+ aio_co_schedule(new_context, client->connection_co);
}
void nbd_client_close(BlockDriverState *bs)
@@ -971,26 +978,55 @@ void nbd_client_close(BlockDriverState *bs)
NBDClientSession *client = nbd_get_client_session(bs);
NBDRequest request = { .type = NBD_CMD_DISC };
- if (client->ioc == NULL) {
- return;
- }
+ assert(client->ioc);
nbd_send_request(client->ioc, &request);
nbd_teardown_connection(bs);
}
-int nbd_client_init(BlockDriverState *bs,
- QIOChannelSocket *sioc,
- const char *export,
- QCryptoTLSCreds *tlscreds,
- const char *hostname,
- const char *x_dirty_bitmap,
- Error **errp)
+static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr,
+ Error **errp)
+{
+ QIOChannelSocket *sioc;
+ Error *local_err = NULL;
+
+ sioc = qio_channel_socket_new();
+ qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client");
+
+ qio_channel_socket_connect_sync(sioc, saddr, &local_err);
+ if (local_err) {
+ object_unref(OBJECT(sioc));
+ error_propagate(errp, local_err);
+ return NULL;
+ }
+
+ qio_channel_set_delay(QIO_CHANNEL(sioc), false);
+
+ return sioc;
+}
+
+static int nbd_client_connect(BlockDriverState *bs,
+ SocketAddress *saddr,
+ const char *export,
+ QCryptoTLSCreds *tlscreds,
+ const char *hostname,
+ const char *x_dirty_bitmap,
+ Error **errp)
{
NBDClientSession *client = nbd_get_client_session(bs);
int ret;
+ /*
+ * establish TCP connection, return error if it fails
+ * TODO: Configurable retry-until-timeout behaviour.
+ */
+ QIOChannelSocket *sioc = nbd_establish_connection(saddr, errp);
+
+ if (!sioc) {
+ return -ECONNREFUSED;
+ }
+
/* NBD handshake */
logout("session init %s\n", export);
qio_channel_set_blocking(QIO_CHANNEL(sioc), true, NULL);
@@ -999,12 +1035,14 @@ int nbd_client_init(BlockDriverState *bs,
client->info.structured_reply = true;
client->info.base_allocation = true;
client->info.x_dirty_bitmap = g_strdup(x_dirty_bitmap);
- ret = nbd_receive_negotiate(QIO_CHANNEL(sioc), export,
- tlscreds, hostname,
+ client->info.name = g_strdup(export ?: "");
+ ret = nbd_receive_negotiate(QIO_CHANNEL(sioc), tlscreds, hostname,
&client->ioc, &client->info, errp);
g_free(client->info.x_dirty_bitmap);
+ g_free(client->info.name);
if (ret < 0) {
logout("Failed to negotiate with the NBD server\n");
+ object_unref(OBJECT(sioc));
return ret;
}
if (x_dirty_bitmap && !client->info.base_allocation) {
@@ -1027,10 +1065,7 @@ int nbd_client_init(BlockDriverState *bs,
bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP;
}
- qemu_co_mutex_init(&client->send_mutex);
- qemu_co_queue_init(&client->free_sema);
client->sioc = sioc;
- object_ref(OBJECT(client->sioc));
if (!client->ioc) {
client->ioc = QIO_CHANNEL(sioc);
@@ -1040,7 +1075,7 @@ int nbd_client_init(BlockDriverState *bs,
/* Now that we're connected, set the socket to be non-blocking and
* kick the reply mechanism. */
qio_channel_set_blocking(QIO_CHANNEL(sioc), false, NULL);
- client->read_reply_co = qemu_coroutine_create(nbd_read_reply_entry, client);
+ client->connection_co = qemu_coroutine_create(nbd_connection_entry, client);
nbd_client_attach_aio_context(bs, bdrv_get_aio_context(bs));
logout("Established connection with NBD server\n");
@@ -1056,6 +1091,26 @@ int nbd_client_init(BlockDriverState *bs,
NBDRequest request = { .type = NBD_CMD_DISC };
nbd_send_request(client->ioc ?: QIO_CHANNEL(sioc), &request);
+
+ object_unref(OBJECT(sioc));
+
return ret;
}
}
+
+int nbd_client_init(BlockDriverState *bs,
+ SocketAddress *saddr,
+ const char *export,
+ QCryptoTLSCreds *tlscreds,
+ const char *hostname,
+ const char *x_dirty_bitmap,
+ Error **errp)
+{
+ NBDClientSession *client = nbd_get_client_session(bs);
+
+ qemu_co_mutex_init(&client->send_mutex);
+ qemu_co_queue_init(&client->free_sema);
+
+ return nbd_client_connect(bs, saddr, export, tlscreds, hostname,
+ x_dirty_bitmap, errp);
+}
diff --git a/block/nbd-client.h b/block/nbd-client.h
index cfc90550b9..d990207a5c 100644
--- a/block/nbd-client.h
+++ b/block/nbd-client.h
@@ -20,7 +20,7 @@
typedef struct {
Coroutine *coroutine;
uint64_t offset; /* original offset of the request */
- bool receiving; /* waiting for read_reply_co? */
+ bool receiving; /* waiting for connection_co? */
} NBDClientRequest;
typedef struct NBDClientSession {
@@ -30,7 +30,7 @@ typedef struct NBDClientSession {
CoMutex send_mutex;
CoQueue free_sema;
- Coroutine *read_reply_co;
+ Coroutine *connection_co;
int in_flight;
NBDClientRequest requests[MAX_NBD_REQUESTS];
@@ -41,7 +41,7 @@ typedef struct NBDClientSession {
NBDClientSession *nbd_get_client_session(BlockDriverState *bs);
int nbd_client_init(BlockDriverState *bs,
- QIOChannelSocket *sock,
+ SocketAddress *saddr,
const char *export_name,
QCryptoTLSCreds *tlscreds,
const char *hostname,
diff --git a/block/nbd.c b/block/nbd.c
index e87699fb73..9db5eded89 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -295,30 +295,6 @@ NBDClientSession *nbd_get_client_session(BlockDriverState *bs)
return &s->client;
}
-static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr,
- Error **errp)
-{
- QIOChannelSocket *sioc;
- Error *local_err = NULL;
-
- sioc = qio_channel_socket_new();
- qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client");
-
- qio_channel_socket_connect_sync(sioc,
- saddr,
- &local_err);
- if (local_err) {
- object_unref(OBJECT(sioc));
- error_propagate(errp, local_err);
- return NULL;
- }
-
- qio_channel_set_delay(QIO_CHANNEL(sioc), false);
-
- return sioc;
-}
-
-
static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, Error **errp)
{
Object *obj;
@@ -394,7 +370,6 @@ static int nbd_open(BlockDriverState *bs, QDict *options, int flags,
BDRVNBDState *s = bs->opaque;
QemuOpts *opts = NULL;
Error *local_err = NULL;
- QIOChannelSocket *sioc = NULL;
QCryptoTLSCreds *tlscreds = NULL;
const char *hostname = NULL;
int ret = -EINVAL;
@@ -434,22 +409,11 @@ static int nbd_open(BlockDriverState *bs, QDict *options, int flags,
hostname = s->saddr->u.inet.host;
}
- /* establish TCP connection, return error if it fails
- * TODO: Configurable retry-until-timeout behaviour.
- */
- sioc = nbd_establish_connection(s->saddr, errp);
- if (!sioc) {
- ret = -ECONNREFUSED;
- goto error;
- }
-
/* NBD handshake */
- ret = nbd_client_init(bs, sioc, s->export, tlscreds, hostname,
+ ret = nbd_client_init(bs, s->saddr, s->export, tlscreds, hostname,
qemu_opt_get(opts, "x-dirty-bitmap"), errp);
+
error:
- if (sioc) {
- object_unref(OBJECT(sioc));
- }
if (tlscreds) {
object_unref(OBJECT(tlscreds));
}
diff --git a/block/nvme.c b/block/nvme.c
index 982097b5b1..b5952c9b08 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -390,6 +390,7 @@ static void nvme_cmd_sync_cb(void *opaque, int ret)
{
int *pret = opaque;
*pret = ret;
+ aio_wait_kick();
}
static int nvme_cmd_sync(BlockDriverState *bs, NVMeQueuePair *q,
diff --git a/block/qapi.c b/block/qapi.c
index c66f949db8..00291f9105 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -282,7 +282,12 @@ void bdrv_query_image_info(BlockDriverState *bs,
info->dirty_flag = bdi.is_dirty;
info->has_dirty_flag = true;
}
- info->format_specific = bdrv_get_specific_info(bs);
+ info->format_specific = bdrv_get_specific_info(bs, &err);
+ if (err) {
+ error_propagate(errp, err);
+ qapi_free_ImageInfo(info);
+ goto out;
+ }
info->has_format_specific = info->format_specific != NULL;
backing_filename = bs->backing_file;
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index b946301429..3ee524da4b 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -1006,6 +1006,82 @@ fail:
return false;
}
+
+static Qcow2BitmapInfoFlagsList *get_bitmap_info_flags(uint32_t flags)
+{
+ Qcow2BitmapInfoFlagsList *list = NULL;
+ Qcow2BitmapInfoFlagsList **plist = &list;
+ int i;
+
+ static const struct {
+ int bme; /* Bitmap directory entry flags */
+ int info; /* The flags to report to the user */
+ } map[] = {
+ { BME_FLAG_IN_USE, QCOW2_BITMAP_INFO_FLAGS_IN_USE },
+ { BME_FLAG_AUTO, QCOW2_BITMAP_INFO_FLAGS_AUTO },
+ };
+
+ int map_size = ARRAY_SIZE(map);
+
+ for (i = 0; i < map_size; ++i) {
+ if (flags & map[i].bme) {
+ Qcow2BitmapInfoFlagsList *entry =
+ g_new0(Qcow2BitmapInfoFlagsList, 1);
+ entry->value = map[i].info;
+ *plist = entry;
+ plist = &entry->next;
+ flags &= ~map[i].bme;
+ }
+ }
+ /* Check if the BME_* mapping above is complete */
+ assert(!flags);
+
+ return list;
+}
+
+/*
+ * qcow2_get_bitmap_info_list()
+ * Returns a list of QCOW2 bitmap details.
+ * In case of no bitmaps, the function returns NULL and
+ * the @errp parameter is not set.
+ * When bitmap information can not be obtained, the function returns
+ * NULL and the @errp parameter is set.
+ */
+Qcow2BitmapInfoList *qcow2_get_bitmap_info_list(BlockDriverState *bs,
+ Error **errp)
+{
+ BDRVQcow2State *s = bs->opaque;
+ Qcow2BitmapList *bm_list;
+ Qcow2Bitmap *bm;
+ Qcow2BitmapInfoList *list = NULL;
+ Qcow2BitmapInfoList **plist = &list;
+
+ if (s->nb_bitmaps == 0) {
+ return NULL;
+ }
+
+ bm_list = bitmap_list_load(bs, s->bitmap_directory_offset,
+ s->bitmap_directory_size, errp);
+ if (bm_list == NULL) {
+ return NULL;
+ }
+
+ QSIMPLEQ_FOREACH(bm, bm_list, entry) {
+ Qcow2BitmapInfo *info = g_new0(Qcow2BitmapInfo, 1);
+ Qcow2BitmapInfoList *obj = g_new0(Qcow2BitmapInfoList, 1);
+ info->granularity = 1U << bm->granularity_bits;
+ info->name = g_strdup(bm->name);
+ info->flags = get_bitmap_info_flags(bm->flags & ~BME_RESERVED_FLAGS);
+ obj->value = info;
+ *plist = obj;
+ plist = &obj->next;
+ }
+
+ bitmap_list_free(bm_list);
+
+ return list;
+}
+
int qcow2_reopen_bitmaps_rw_hint(BlockDriverState *bs, bool *header_updated,
Error **errp)
{
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 1c63ac244a..6f13d470d3 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -368,6 +368,9 @@ static int alloc_refcount_block(BlockDriverState *bs,
return new_block;
}
+ /* The offset must fit in the offset field of the refcount table entry */
+ assert((new_block & REFT_OFFSET_MASK) == new_block);
+
/* If we're allocating the block at offset 0 then something is wrong */
if (new_block == 0) {
qcow2_signal_corruption(bs, true, -1, -1, "Preventing invalid "
diff --git a/block/qcow2.c b/block/qcow2.c
index 4897abae5e..65a54c9ac6 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1671,6 +1671,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
/* From bdrv_co_create. */
qcow2_open_entry(&qoc);
} else {
+ assert(qemu_get_current_aio_context() == qemu_get_aio_context());
qemu_coroutine_enter(qemu_coroutine_create(qcow2_open_entry, &qoc));
BDRV_POLL_WHILE(bs, qoc.ret == -EINPROGRESS);
}
@@ -4367,20 +4368,26 @@ static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
return 0;
}
-static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
+static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs,
+ Error **errp)
{
BDRVQcow2State *s = bs->opaque;
ImageInfoSpecific *spec_info;
QCryptoBlockInfo *encrypt_info = NULL;
+ Error *local_err = NULL;
if (s->crypto != NULL) {
- encrypt_info = qcrypto_block_get_info(s->crypto, &error_abort);
+ encrypt_info = qcrypto_block_get_info(s->crypto, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return NULL;
+ }
}
spec_info = g_new(ImageInfoSpecific, 1);
*spec_info = (ImageInfoSpecific){
.type = IMAGE_INFO_SPECIFIC_KIND_QCOW2,
- .u.qcow2.data = g_new(ImageInfoSpecificQCow2, 1),
+ .u.qcow2.data = g_new0(ImageInfoSpecificQCow2, 1),
};
if (s->qcow_version == 2) {
*spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
@@ -4388,6 +4395,13 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
.refcount_bits = s->refcount_bits,
};
} else if (s->qcow_version == 3) {
+ Qcow2BitmapInfoList *bitmaps;
+ bitmaps = qcow2_get_bitmap_info_list(bs, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ qapi_free_ImageInfoSpecific(spec_info);
+ return NULL;
+ }
*spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
.compat = g_strdup("1.1"),
.lazy_refcounts = s->compatible_features &
@@ -4397,6 +4411,8 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
QCOW2_INCOMPAT_CORRUPT,
.has_corrupt = true,
.refcount_bits = s->refcount_bits,
+ .has_bitmaps = !!bitmaps,
+ .bitmaps = bitmaps,
};
} else {
/* if this assertion fails, this probably means a new version was
diff --git a/block/qcow2.h b/block/qcow2.h
index 438a1dee9e..9dd02df831 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -50,11 +50,11 @@
/* 8 MB refcount table is enough for 2 PB images at 64k cluster size
* (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
-#define QCOW_MAX_REFTABLE_SIZE S_8MiB
+#define QCOW_MAX_REFTABLE_SIZE (8 * MiB)
/* 32 MB L1 table is enough for 2 PB images at 64k cluster size
* (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
-#define QCOW_MAX_L1_SIZE S_32MiB
+#define QCOW_MAX_L1_SIZE (32 * MiB)
/* Allow for an average of 1k per snapshot table entry, should be plenty of
* space for snapshot names and IDs */
@@ -81,15 +81,15 @@
#define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */
#ifdef CONFIG_LINUX
-#define DEFAULT_L2_CACHE_MAX_SIZE S_32MiB
+#define DEFAULT_L2_CACHE_MAX_SIZE (32 * MiB)
#define DEFAULT_CACHE_CLEAN_INTERVAL 600 /* seconds */
#else
-#define DEFAULT_L2_CACHE_MAX_SIZE S_8MiB
+#define DEFAULT_L2_CACHE_MAX_SIZE (8 * MiB)
/* Cache clean interval is currently available only on Linux, so must be 0 */
#define DEFAULT_CACHE_CLEAN_INTERVAL 0
#endif
-#define DEFAULT_CLUSTER_SIZE S_64KiB
+#define DEFAULT_CLUSTER_SIZE 65536
#define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
#define QCOW2_OPT_DISCARD_REQUEST "pass-discard-request"
@@ -684,6 +684,8 @@ int qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table,
int64_t *refcount_table_size);
bool qcow2_load_dirty_bitmaps(BlockDriverState *bs, Error **errp);
+Qcow2BitmapInfoList *qcow2_get_bitmap_info_list(BlockDriverState *bs,
+ Error **errp);
int qcow2_reopen_bitmaps_rw_hint(BlockDriverState *bs, bool *header_updated,
Error **errp);
int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp);
diff --git a/block/qed.c b/block/qed.c
index 9377c0b7ad..1280870024 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -559,6 +559,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
if (qemu_in_coroutine()) {
bdrv_qed_open_entry(&qoc);
} else {
+ assert(qemu_get_current_aio_context() == qemu_get_aio_context());
qemu_coroutine_enter(qemu_coroutine_create(bdrv_qed_open_entry, &qoc));
BDRV_POLL_WHILE(bs, qoc.ret == -EINPROGRESS);
}
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 90ab43baa4..b916ba07bf 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -28,6 +28,7 @@
#include "sysemu/block-backend.h"
#include "qemu/bitops.h"
#include "qemu/cutils.h"
+#include "trace.h"
#define SD_PROTO_VER 0x01
@@ -299,19 +300,6 @@ static inline size_t count_data_objs(const struct SheepdogInode *inode)
(1UL << inode->block_size_shift));
}
-#undef DPRINTF
-#ifdef DEBUG_SDOG
-#define DEBUG_SDOG_PRINT 1
-#else
-#define DEBUG_SDOG_PRINT 0
-#endif
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_SDOG_PRINT) { \
- fprintf(stderr, "%s %d: " fmt, __func__, __LINE__, ##args); \
- } \
- } while (0)
-
typedef struct SheepdogAIOCB SheepdogAIOCB;
typedef struct BDRVSheepdogState BDRVSheepdogState;
@@ -750,7 +738,7 @@ static coroutine_fn void reconnect_to_sdog(void *opaque)
Error *local_err = NULL;
s->fd = get_sheep_fd(s, &local_err);
if (s->fd < 0) {
- DPRINTF("Wait for connection to be established\n");
+ trace_sheepdog_reconnect_to_sdog();
error_report_err(local_err);
qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000000ULL);
}
@@ -847,7 +835,7 @@ static void coroutine_fn aio_read_response(void *opaque)
break;
case AIOCB_FLUSH_CACHE:
if (rsp.result == SD_RES_INVALID_PARMS) {
- DPRINTF("disable cache since the server doesn't support it\n");
+ trace_sheepdog_aio_read_response();
s->cache_flags = SD_FLAG_CMD_DIRECT;
rsp.result = SD_RES_SUCCESS;
}
@@ -1224,7 +1212,7 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename,
SheepdogVdiReq hdr;
SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;
unsigned int wlen, rlen = 0;
- char buf[SD_MAX_VDI_LEN + SD_MAX_VDI_TAG_LEN];
+ char buf[SD_MAX_VDI_LEN + SD_MAX_VDI_TAG_LEN] QEMU_NONSTRING;
fd = connect_to_sdog(s, errp);
if (fd < 0) {
@@ -1639,7 +1627,7 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags,
s->discard_supported = true;
if (snap_id || tag[0]) {
- DPRINTF("%" PRIx32 " snapshot inode was open.\n", vid);
+ trace_sheepdog_open(vid);
s->is_snapshot = true;
}
@@ -2252,7 +2240,7 @@ static void sd_close(BlockDriverState *bs)
unsigned int wlen, rlen = 0;
int fd, ret;
- DPRINTF("%s\n", s->name);
+ trace_sheepdog_close(s->name);
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
@@ -2429,7 +2417,7 @@ static int sd_create_branch(BDRVSheepdogState *s)
char *buf;
bool deleted;
- DPRINTF("%" PRIx32 " is snapshot.\n", s->inode.vdi_id);
+ trace_sheepdog_create_branch_snapshot(s->inode.vdi_id);
buf = g_malloc(SD_INODE_SIZE);
@@ -2445,7 +2433,7 @@ static int sd_create_branch(BDRVSheepdogState *s)
goto out;
}
- DPRINTF("%" PRIx32 " is created.\n", vid);
+ trace_sheepdog_create_branch_created(vid);
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
@@ -2467,7 +2455,7 @@ static int sd_create_branch(BDRVSheepdogState *s)
s->is_snapshot = false;
ret = 0;
- DPRINTF("%" PRIx32 " was newly created.\n", s->inode.vdi_id);
+ trace_sheepdog_create_branch_new(s->inode.vdi_id);
out:
g_free(buf);
@@ -2561,11 +2549,11 @@ static void coroutine_fn sd_co_rw_vector(SheepdogAIOCB *acb)
}
if (create) {
- DPRINTF("update ino (%" PRIu32 ") %" PRIu64 " %" PRIu64 " %ld\n",
- inode->vdi_id, oid,
- vid_to_data_oid(inode->data_vdi_id[idx], idx), idx);
+ trace_sheepdog_co_rw_vector_update(inode->vdi_id, oid,
+ vid_to_data_oid(inode->data_vdi_id[idx], idx),
+ idx);
oid = vid_to_data_oid(inode->vdi_id, idx);
- DPRINTF("new oid %" PRIx64 "\n", oid);
+ trace_sheepdog_co_rw_vector_new(oid);
}
aio_req = alloc_aio_req(s, acb, oid, len, offset, flags, create,
@@ -2670,9 +2658,8 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
SheepdogInode *inode;
unsigned int datalen;
- DPRINTF("sn_info: name %s id_str %s s: name %s vm_state_size %" PRId64 " "
- "is_snapshot %d\n", sn_info->name, sn_info->id_str,
- s->name, sn_info->vm_state_size, s->is_snapshot);
+ trace_sheepdog_snapshot_create_info(sn_info->name, sn_info->id_str, s->name,
+ sn_info->vm_state_size, s->is_snapshot);
if (s->is_snapshot) {
error_report("You can't create a snapshot of a snapshot VDI, "
@@ -2681,7 +2668,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
return -EINVAL;
}
- DPRINTF("%s %s\n", sn_info->name, sn_info->id_str);
+ trace_sheepdog_snapshot_create(sn_info->name, sn_info->id_str);
s->inode.vm_state_size = sn_info->vm_state_size;
s->inode.vm_clock_nsec = sn_info->vm_clock_nsec;
@@ -2726,8 +2713,8 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
}
memcpy(&s->inode, inode, datalen);
- DPRINTF("s->inode: name %s snap_id %x oid %x\n",
- s->inode.name, s->inode.snap_id, s->inode.vdi_id);
+ trace_sheepdog_snapshot_create_inode(s->inode.name, s->inode.snap_id,
+ s->inode.vdi_id);
cleanup:
g_free(inode);
diff --git a/block/ssh.c b/block/ssh.c
index 7fbc27abdf..bbc513e095 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -41,27 +41,17 @@
#include "qapi/qmp/qstring.h"
#include "qapi/qobject-input-visitor.h"
#include "qapi/qobject-output-visitor.h"
+#include "trace.h"
-/* DEBUG_SSH=1 enables the DPRINTF (debugging printf) statements in
- * this block driver code.
- *
+/*
* TRACE_LIBSSH2=<bitmask> enables tracing in libssh2 itself. Note
* that this requires that libssh2 was specially compiled with the
* `./configure --enable-debug' option, so most likely you will have
* to compile it yourself. The meaning of <bitmask> is described
* here: http://www.libssh2.org/libssh2_trace.html
*/
-#define DEBUG_SSH 0
#define TRACE_LIBSSH2 0 /* or try: LIBSSH2_TRACE_SFTP */
-#define DPRINTF(fmt, ...) \
- do { \
- if (DEBUG_SSH) { \
- fprintf(stderr, "ssh: %-15s " fmt "\n", \
- __func__, ##__VA_ARGS__); \
- } \
- } while (0)
-
typedef struct BDRVSSHState {
/* Coroutine. */
CoMutex lock;
@@ -336,7 +326,7 @@ static int check_host_key_knownhosts(BDRVSSHState *s,
switch (r) {
case LIBSSH2_KNOWNHOST_CHECK_MATCH:
/* OK */
- DPRINTF("host key OK: %s", found->key);
+ trace_ssh_check_host_key_knownhosts(found->key);
break;
case LIBSSH2_KNOWNHOST_CHECK_MISMATCH:
ret = -EINVAL;
@@ -721,8 +711,7 @@ static int connect_to_ssh(BDRVSSHState *s, BlockdevOptionsSsh *opts,
}
/* Open the remote file. */
- DPRINTF("opening file %s flags=0x%x creat_mode=0%o",
- opts->path, ssh_flags, creat_mode);
+ trace_ssh_connect_to_ssh(opts->path, ssh_flags, creat_mode);
s->sftp_handle = libssh2_sftp_open(s->sftp, opts->path, ssh_flags,
creat_mode);
if (!s->sftp_handle) {
@@ -890,7 +879,7 @@ static int coroutine_fn ssh_co_create_opts(const char *filename, QemuOpts *opts,
/* Get desired file size. */
ssh_opts->size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
BDRV_SECTOR_SIZE);
- DPRINTF("total_size=%" PRIi64, ssh_opts->size);
+ trace_ssh_co_create_opts(ssh_opts->size);
uri_options = qdict_new();
ret = parse_uri(filename, uri_options, errp);
@@ -946,7 +935,7 @@ static void restart_coroutine(void *opaque)
BDRVSSHState *s = bs->opaque;
AioContext *ctx = bdrv_get_aio_context(bs);
- DPRINTF("co=%p", restart->co);
+ trace_ssh_restart_coroutine(restart->co);
aio_set_fd_handler(ctx, s->sock, false, NULL, NULL, NULL, NULL);
aio_co_wake(restart->co);
@@ -974,13 +963,12 @@ static coroutine_fn void co_yield(BDRVSSHState *s, BlockDriverState *bs)
wr_handler = restart_coroutine;
}
- DPRINTF("s->sock=%d rd_handler=%p wr_handler=%p", s->sock,
- rd_handler, wr_handler);
+ trace_ssh_co_yield(s->sock, rd_handler, wr_handler);
aio_set_fd_handler(bdrv_get_aio_context(bs), s->sock,
false, rd_handler, wr_handler, NULL, &restart);
qemu_coroutine_yield();
- DPRINTF("s->sock=%d - back", s->sock);
+ trace_ssh_co_yield_back(s->sock);
}
/* SFTP has a function `libssh2_sftp_seek64' which seeks to a position
@@ -1003,7 +991,7 @@ static void ssh_seek(BDRVSSHState *s, int64_t offset, int flags)
bool force = (flags & SSH_SEEK_FORCE) != 0;
if (force || op_read != s->offset_op_read || offset != s->offset) {
- DPRINTF("seeking to offset=%" PRIi64, offset);
+ trace_ssh_seek(offset);
libssh2_sftp_seek64(s->sftp_handle, offset);
s->offset = offset;
s->offset_op_read = op_read;
@@ -1019,7 +1007,7 @@ static coroutine_fn int ssh_read(BDRVSSHState *s, BlockDriverState *bs,
char *buf, *end_of_vec;
struct iovec *i;
- DPRINTF("offset=%" PRIi64 " size=%zu", offset, size);
+ trace_ssh_read(offset, size);
ssh_seek(s, offset, SSH_SEEK_READ);
@@ -1038,9 +1026,9 @@ static coroutine_fn int ssh_read(BDRVSSHState *s, BlockDriverState *bs,
*/
for (got = 0; got < size; ) {
again:
- DPRINTF("sftp_read buf=%p size=%zu", buf, end_of_vec - buf);
+ trace_ssh_read_buf(buf, end_of_vec - buf);
r = libssh2_sftp_read(s->sftp_handle, buf, end_of_vec - buf);
- DPRINTF("sftp_read returned %zd", r);
+ trace_ssh_read_return(r);
if (r == LIBSSH2_ERROR_EAGAIN || r == LIBSSH2_ERROR_TIMEOUT) {
co_yield(s, bs);
@@ -1094,7 +1082,7 @@ static int ssh_write(BDRVSSHState *s, BlockDriverState *bs,
char *buf, *end_of_vec;
struct iovec *i;
- DPRINTF("offset=%" PRIi64 " size=%zu", offset, size);
+ trace_ssh_write(offset, size);
ssh_seek(s, offset, SSH_SEEK_WRITE);
@@ -1108,9 +1096,9 @@ static int ssh_write(BDRVSSHState *s, BlockDriverState *bs,
for (written = 0; written < size; ) {
again:
- DPRINTF("sftp_write buf=%p size=%zu", buf, end_of_vec - buf);
+ trace_ssh_write_buf(buf, end_of_vec - buf);
r = libssh2_sftp_write(s->sftp_handle, buf, end_of_vec - buf);
- DPRINTF("sftp_write returned %zd", r);
+ trace_ssh_write_return(r);
if (r == LIBSSH2_ERROR_EAGAIN || r == LIBSSH2_ERROR_TIMEOUT) {
co_yield(s, bs);
@@ -1187,7 +1175,7 @@ static coroutine_fn int ssh_flush(BDRVSSHState *s, BlockDriverState *bs)
{
int r;
- DPRINTF("fsync");
+ trace_ssh_flush();
again:
r = libssh2_sftp_fsync(s->sftp_handle);
if (r == LIBSSH2_ERROR_EAGAIN || r == LIBSSH2_ERROR_TIMEOUT) {
@@ -1238,7 +1226,7 @@ static int64_t ssh_getlength(BlockDriverState *bs)
/* Note we cannot make a libssh2 call here. */
length = (int64_t) s->attrs.filesize;
- DPRINTF("length=%" PRIi64, length);
+ trace_ssh_getlength(length);
return length;
}
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 5d8213a443..a5a2037924 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -415,6 +415,9 @@ static void coroutine_fn throttle_group_restart_queue_entry(void *opaque)
}
g_free(data);
+
+ atomic_dec(&tgm->restart_pending);
+ aio_wait_kick();
}
static void throttle_group_restart_queue(ThrottleGroupMember *tgm, bool is_write)
@@ -430,6 +433,8 @@ static void throttle_group_restart_queue(ThrottleGroupMember *tgm, bool is_write
* be no timer pending on this tgm at this point */
assert(!timer_pending(tgm->throttle_timers.timers[is_write]));
+ atomic_inc(&tgm->restart_pending);
+
co = qemu_coroutine_create(throttle_group_restart_queue_entry, rd);
aio_co_enter(tgm->aio_context, co);
}
@@ -538,6 +543,7 @@ void throttle_group_register_tgm(ThrottleGroupMember *tgm,
tgm->throttle_state = ts;
tgm->aio_context = ctx;
+ atomic_set(&tgm->restart_pending, 0);
qemu_mutex_lock(&tg->lock);
/* If the ThrottleGroup is new set this ThrottleGroupMember as the token */
@@ -584,6 +590,9 @@ void throttle_group_unregister_tgm(ThrottleGroupMember *tgm)
return;
}
+ /* Wait for throttle_group_restart_queue_entry() coroutines to finish */
+ AIO_WAIT_WHILE(tgm->aio_context, atomic_read(&tgm->restart_pending) > 0);
+
qemu_mutex_lock(&tg->lock);
for (i = 0; i < 2; i++) {
assert(tgm->pending_reqs[i] == 0);
diff --git a/block/trace-events b/block/trace-events
index 693c14c443..70056eafd2 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -160,3 +160,50 @@ iscsi_xcopy(void *src_lun, uint64_t src_off, void *dst_lun, uint64_t dst_off, ui
# block/nbd-client.c
nbd_read_reply_entry_fail(int ret, const char *err) "ret = %d, err: %s"
nbd_co_request_fail(uint64_t from, uint32_t len, uint64_t handle, uint16_t flags, uint16_t type, const char *name, int ret, const char *err) "Request failed { .from = %" PRIu64", .len = %" PRIu32 ", .handle = %" PRIu64 ", .flags = 0x%" PRIx16 ", .type = %" PRIu16 " (%s) } ret = %d, err: %s"
+
+# block/ssh.c
+ssh_restart_coroutine(void *co) "co=%p"
+ssh_flush(void) "fsync"
+ssh_check_host_key_knownhosts(const char *key) "host key OK: %s"
+ssh_connect_to_ssh(char *path, int flags, int mode) "opening file %s flags=0x%x creat_mode=0%o"
+ssh_co_yield(int sock, void *rd_handler, void *wr_handler) "s->sock=%d rd_handler=%p wr_handler=%p"
+ssh_co_yield_back(int sock) "s->sock=%d - back"
+ssh_getlength(int64_t length) "length=%" PRIi64
+ssh_co_create_opts(uint64_t size) "total_size=%" PRIu64
+ssh_read(int64_t offset, size_t size) "offset=%" PRIi64 " size=%zu"
+ssh_read_buf(void *buf, size_t size) "sftp_read buf=%p size=%zu"
+ssh_read_return(ssize_t ret) "sftp_read returned %zd"
+ssh_write(int64_t offset, size_t size) "offset=%" PRIi64 " size=%zu"
+ssh_write_buf(void *buf, size_t size) "sftp_write buf=%p size=%zu"
+ssh_write_return(ssize_t ret) "sftp_write returned %zd"
+ssh_seek(int64_t offset) "seeking to offset=%" PRIi64
+
+# block/curl.c
+curl_timer_cb(long timeout_ms) "timer callback timeout_ms %ld"
+curl_sock_cb(int action, int fd) "sock action %d on fd %d"
+curl_read_cb(size_t realsize) "just reading %zu bytes"
+curl_open(const char *file) "opening %s"
+curl_open_size(uint64_t size) "size = %" PRIu64
+curl_setup_preadv(uint64_t bytes, uint64_t start, const char *range) "reading %" PRIu64 " at %" PRIu64 " (%s)"
+curl_close(void) "close"
+
+# block/file-posix.c
+file_xfs_write_zeroes(const char *error) "cannot write zero range (%s)"
+file_xfs_discard(const char *error) "cannot punch hole (%s)"
+file_FindEjectableOpticalMedia(const char *media) "Matching using %s"
+file_setup_cdrom(const char *partition) "Using %s as optical disc"
+file_hdev_is_sg(int type, int version) "SG device found: type=%d, version=%d"
+
+# block/sheepdog.c
+sheepdog_reconnect_to_sdog(void) "Wait for connection to be established"
+sheepdog_aio_read_response(void) "disable cache since the server doesn't support it"
+sheepdog_open(uint32_t vid) "0x%" PRIx32 " snapshot inode was open"
+sheepdog_close(const char *name) "%s"
+sheepdog_create_branch_snapshot(uint32_t vdi) "0x%" PRIx32 " is snapshot"
+sheepdog_create_branch_created(uint32_t vdi) "0x%" PRIx32 " is created"
+sheepdog_create_branch_new(uint32_t vdi) "0x%" PRIx32 " was newly created"
+sheepdog_co_rw_vector_update(uint32_t vdi, uint64_t oid, uint64_t data, long idx) "update ino (%" PRIu32 ") %" PRIu64 " %" PRIu64 " %ld"
+sheepdog_co_rw_vector_new(uint64_t oid) "new oid 0x%" PRIx64
+sheepdog_snapshot_create_info(const char *sn_name, const char *id, const char *name, int64_t size, int is_snapshot) "sn_info: name %s id_str %s s: name %s vm_state_size %" PRId64 " " "is_snapshot %d"
+sheepdog_snapshot_create(const char *sn_name, const char *id) "%s %s"
+sheepdog_snapshot_create_inode(const char *name, uint32_t snap, uint32_t vdi) "s->inode: name %s snap_id 0x%" PRIx32 " vdi 0x%" PRIx32
diff --git a/block/vdi.c b/block/vdi.c
index 2380daa583..e1c42ad732 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -85,7 +85,8 @@
#define BLOCK_OPT_STATIC "static"
#define SECTOR_SIZE 512
-#define DEFAULT_CLUSTER_SIZE S_1MiB
+#define DEFAULT_CLUSTER_SIZE 1048576
+/* Note: can't use 1 * MiB, because it's passed to stringify() */
#if defined(CONFIG_VDI_DEBUG)
#define VDI_DEBUG 1
@@ -203,10 +204,10 @@ static void vdi_header_to_cpu(VdiHeader *header)
header->block_extra = le32_to_cpu(header->block_extra);
header->blocks_in_image = le32_to_cpu(header->blocks_in_image);
header->blocks_allocated = le32_to_cpu(header->blocks_allocated);
- qemu_uuid_bswap(&header->uuid_image);
- qemu_uuid_bswap(&header->uuid_last_snap);
- qemu_uuid_bswap(&header->uuid_link);
- qemu_uuid_bswap(&header->uuid_parent);
+ header->uuid_image = qemu_uuid_bswap(header->uuid_image);
+ header->uuid_last_snap = qemu_uuid_bswap(header->uuid_last_snap);
+ header->uuid_link = qemu_uuid_bswap(header->uuid_link);
+ header->uuid_parent = qemu_uuid_bswap(header->uuid_parent);
}
static void vdi_header_to_le(VdiHeader *header)
@@ -227,15 +228,16 @@ static void vdi_header_to_le(VdiHeader *header)
header->block_extra = cpu_to_le32(header->block_extra);
header->blocks_in_image = cpu_to_le32(header->blocks_in_image);
header->blocks_allocated = cpu_to_le32(header->blocks_allocated);
- qemu_uuid_bswap(&header->uuid_image);
- qemu_uuid_bswap(&header->uuid_last_snap);
- qemu_uuid_bswap(&header->uuid_link);
- qemu_uuid_bswap(&header->uuid_parent);
+ header->uuid_image = qemu_uuid_bswap(header->uuid_image);
+ header->uuid_last_snap = qemu_uuid_bswap(header->uuid_last_snap);
+ header->uuid_link = qemu_uuid_bswap(header->uuid_link);
+ header->uuid_parent = qemu_uuid_bswap(header->uuid_parent);
}
static void vdi_header_print(VdiHeader *header)
{
- char uuid[37];
+ char uuidstr[37];
+ QemuUUID uuid;
logout("text %s", header->text);
logout("signature 0x%08x\n", header->signature);
logout("header size 0x%04x\n", header->header_size);
@@ -254,14 +256,18 @@ static void vdi_header_print(VdiHeader *header)
logout("block extra 0x%04x\n", header->block_extra);
logout("blocks tot. 0x%04x\n", header->blocks_in_image);
logout("blocks all. 0x%04x\n", header->blocks_allocated);
- qemu_uuid_unparse(&header->uuid_image, uuid);
- logout("uuid image %s\n", uuid);
- qemu_uuid_unparse(&header->uuid_last_snap, uuid);
- logout("uuid snap %s\n", uuid);
- qemu_uuid_unparse(&header->uuid_link, uuid);
- logout("uuid link %s\n", uuid);
- qemu_uuid_unparse(&header->uuid_parent, uuid);
- logout("uuid parent %s\n", uuid);
+ uuid = header->uuid_image;
+ qemu_uuid_unparse(&uuid, uuidstr);
+ logout("uuid image %s\n", uuidstr);
+ uuid = header->uuid_last_snap;
+ qemu_uuid_unparse(&uuid, uuidstr);
+ logout("uuid snap %s\n", uuidstr);
+ uuid = header->uuid_link;
+ qemu_uuid_unparse(&uuid, uuidstr);
+ logout("uuid link %s\n", uuidstr);
+ uuid = header->uuid_parent;
+ qemu_uuid_unparse(&uuid, uuidstr);
+ logout("uuid parent %s\n", uuidstr);
}
static int coroutine_fn vdi_co_check(BlockDriverState *bs, BdrvCheckResult *res,
@@ -368,6 +374,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
size_t bmap_size;
int ret;
Error *local_err = NULL;
+ QemuUUID uuid_link, uuid_parent;
bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file,
false, errp);
@@ -395,6 +402,9 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
goto fail;
}
+ uuid_link = header.uuid_link;
+ uuid_parent = header.uuid_parent;
+
if (header.disk_size % SECTOR_SIZE != 0) {
/* 'VBoxManage convertfromraw' can create images with odd disk sizes.
We accept them but round the disk size to the next multiple of
@@ -444,11 +454,11 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
(uint64_t)header.blocks_in_image * header.block_size);
ret = -ENOTSUP;
goto fail;
- } else if (!qemu_uuid_is_null(&header.uuid_link)) {
+ } else if (!qemu_uuid_is_null(&uuid_link)) {
error_setg(errp, "unsupported VDI image (non-NULL link UUID)");
ret = -ENOTSUP;
goto fail;
- } else if (!qemu_uuid_is_null(&header.uuid_parent)) {
+ } else if (!qemu_uuid_is_null(&uuid_parent)) {
error_setg(errp, "unsupported VDI image (non-NULL parent UUID)");
ret = -ENOTSUP;
goto fail;
@@ -733,6 +743,7 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreateOptions *create_options,
BlockDriverState *bs_file = NULL;
BlockBackend *blk = NULL;
uint32_t *bmap = NULL;
+ QemuUUID uuid;
assert(create_options->driver == BLOCKDEV_DRIVER_VDI);
vdi_opts = &create_options->u.vdi;
@@ -819,8 +830,10 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreateOptions *create_options,
if (image_type == VDI_TYPE_STATIC) {
header.blocks_allocated = blocks;
}
- qemu_uuid_generate(&header.uuid_image);
- qemu_uuid_generate(&header.uuid_last_snap);
+ qemu_uuid_generate(&uuid);
+ header.uuid_image = uuid;
+ qemu_uuid_generate(&uuid);
+ header.uuid_last_snap = uuid;
/* There is no need to set header.uuid_link or header.uuid_parent here. */
if (VDI_DEBUG) {
vdi_header_print(&header);
diff --git a/block/vmdk.c b/block/vmdk.c
index 2c9e86d98f..096e8eb662 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1741,35 +1741,17 @@ static int coroutine_fn vmdk_co_pwrite_zeroes(BlockDriverState *bs,
return ret;
}
-static int vmdk_create_extent(const char *filename, int64_t filesize,
- bool flat, bool compress, bool zeroed_grain,
- QemuOpts *opts, Error **errp)
+static int vmdk_init_extent(BlockBackend *blk,
+ int64_t filesize, bool flat,
+ bool compress, bool zeroed_grain,
+ Error **errp)
{
int ret, i;
- BlockBackend *blk = NULL;
VMDK4Header header;
- Error *local_err = NULL;
uint32_t tmp, magic, grains, gd_sectors, gt_size, gt_count;
uint32_t *gd_buf = NULL;
int gd_buf_size;
- ret = bdrv_create_file(filename, opts, &local_err);
- if (ret < 0) {
- error_propagate(errp, local_err);
- goto exit;
- }
-
- blk = blk_new_open(filename, NULL, NULL,
- BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL,
- &local_err);
- if (blk == NULL) {
- error_propagate(errp, local_err);
- ret = -EIO;
- goto exit;
- }
-
- blk_set_allow_write_beyond_eof(blk, true);
-
if (flat) {
ret = blk_truncate(blk, filesize, PREALLOC_MODE_OFF, errp);
goto exit;
@@ -1863,15 +1845,50 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
gd_buf, gd_buf_size, 0);
if (ret < 0) {
error_setg(errp, QERR_IO_ERROR);
- goto exit;
}
ret = 0;
exit:
+ g_free(gd_buf);
+ return ret;
+}
+
+static int vmdk_create_extent(const char *filename, int64_t filesize,
+ bool flat, bool compress, bool zeroed_grain,
+ BlockBackend **pbb,
+ QemuOpts *opts, Error **errp)
+{
+ int ret;
+ BlockBackend *blk = NULL;
+ Error *local_err = NULL;
+
+ ret = bdrv_create_file(filename, opts, &local_err);
+ if (ret < 0) {
+ error_propagate(errp, local_err);
+ goto exit;
+ }
+
+ blk = blk_new_open(filename, NULL, NULL,
+ BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL,
+ &local_err);
+ if (blk == NULL) {
+ error_propagate(errp, local_err);
+ ret = -EIO;
+ goto exit;
+ }
+
+ blk_set_allow_write_beyond_eof(blk, true);
+
+ ret = vmdk_init_extent(blk, filesize, flat, compress, zeroed_grain, errp);
+exit:
if (blk) {
- blk_unref(blk);
+ if (pbb) {
+ *pbb = blk;
+ } else {
+ blk_unref(blk);
+ blk = NULL;
+ }
}
- g_free(gd_buf);
return ret;
}
@@ -1915,33 +1932,57 @@ static int filename_decompose(const char *filename, char *path, char *prefix,
return VMDK_OK;
}
-static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts,
- Error **errp)
+/*
+ * idx == 0: get or create the descriptor file (also the image file if in a
+ * non-split format.
+ * idx >= 1: get the n-th extent if in a split subformat
+ */
+typedef BlockBackend *(*vmdk_create_extent_fn)(int64_t size,
+ int idx,
+ bool flat,
+ bool split,
+ bool compress,
+ bool zeroed_grain,
+ void *opaque,
+ Error **errp);
+
+static void vmdk_desc_add_extent(GString *desc,
+ const char *extent_line_fmt,
+ int64_t size, const char *filename)
{
- int idx = 0;
- BlockBackend *new_blk = NULL;
+ char *basename = g_path_get_basename(filename);
+
+ g_string_append_printf(desc, extent_line_fmt,
+ DIV_ROUND_UP(size, BDRV_SECTOR_SIZE), basename);
+ g_free(basename);
+}
+
+static int coroutine_fn vmdk_co_do_create(int64_t size,
+ BlockdevVmdkSubformat subformat,
+ BlockdevVmdkAdapterType adapter_type,
+ const char *backing_file,
+ const char *hw_version,
+ bool compat6,
+ bool zeroed_grain,
+ vmdk_create_extent_fn extent_fn,
+ void *opaque,
+ Error **errp)
+{
+ int extent_idx;
+ BlockBackend *blk = NULL;
+ BlockBackend *extent_blk;
Error *local_err = NULL;
char *desc = NULL;
- int64_t total_size = 0, filesize;
- char *adapter_type = NULL;
- char *backing_file = NULL;
- char *hw_version = NULL;
- char *fmt = NULL;
int ret = 0;
bool flat, split, compress;
GString *ext_desc_lines;
- char *path = g_malloc0(PATH_MAX);
- char *prefix = g_malloc0(PATH_MAX);
- char *postfix = g_malloc0(PATH_MAX);
- char *desc_line = g_malloc0(BUF_SIZE);
- char *ext_filename = g_malloc0(PATH_MAX);
- char *desc_filename = g_malloc0(PATH_MAX);
const int64_t split_size = 0x80000000; /* VMDK has constant split size */
- const char *desc_extent_line;
+ int64_t extent_size;
+ int64_t created_size = 0;
+ const char *extent_line_fmt;
char *parent_desc_line = g_malloc0(BUF_SIZE);
uint32_t parent_cid = 0xffffffff;
uint32_t number_heads = 16;
- bool zeroed_grain = false;
uint32_t desc_offset = 0, desc_len;
const char desc_template[] =
"# Disk DescriptorFile\n"
@@ -1965,71 +2006,35 @@ static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts
ext_desc_lines = g_string_new(NULL);
- if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) {
- ret = -EINVAL;
- goto exit;
- }
/* Read out options */
- total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
- BDRV_SECTOR_SIZE);
- adapter_type = qemu_opt_get_del(opts, BLOCK_OPT_ADAPTER_TYPE);
- backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE);
- hw_version = qemu_opt_get_del(opts, BLOCK_OPT_HWVERSION);
- if (qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false)) {
- if (strcmp(hw_version, "undefined")) {
+ if (compat6) {
+ if (hw_version) {
error_setg(errp,
"compat6 cannot be enabled with hwversion set");
ret = -EINVAL;
goto exit;
}
- g_free(hw_version);
- hw_version = g_strdup("6");
+ hw_version = "6";
}
- if (strcmp(hw_version, "undefined") == 0) {
- g_free(hw_version);
- hw_version = g_strdup("4");
- }
- fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT);
- if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false)) {
- zeroed_grain = true;
+ if (!hw_version) {
+ hw_version = "4";
}
- if (!adapter_type) {
- adapter_type = g_strdup("ide");
- } else if (strcmp(adapter_type, "ide") &&
- strcmp(adapter_type, "buslogic") &&
- strcmp(adapter_type, "lsilogic") &&
- strcmp(adapter_type, "legacyESX")) {
- error_setg(errp, "Unknown adapter type: '%s'", adapter_type);
- ret = -EINVAL;
- goto exit;
- }
- if (strcmp(adapter_type, "ide") != 0) {
+ if (adapter_type != BLOCKDEV_VMDK_ADAPTER_TYPE_IDE) {
/* that's the number of heads with which vmware operates when
creating, exporting, etc. vmdk files with a non-ide adapter type */
number_heads = 255;
}
- if (!fmt) {
- /* Default format to monolithicSparse */
- fmt = g_strdup("monolithicSparse");
- } else if (strcmp(fmt, "monolithicFlat") &&
- strcmp(fmt, "monolithicSparse") &&
- strcmp(fmt, "twoGbMaxExtentSparse") &&
- strcmp(fmt, "twoGbMaxExtentFlat") &&
- strcmp(fmt, "streamOptimized")) {
- error_setg(errp, "Unknown subformat: '%s'", fmt);
- ret = -EINVAL;
- goto exit;
- }
- split = !(strcmp(fmt, "twoGbMaxExtentFlat") &&
- strcmp(fmt, "twoGbMaxExtentSparse"));
- flat = !(strcmp(fmt, "monolithicFlat") &&
- strcmp(fmt, "twoGbMaxExtentFlat"));
- compress = !strcmp(fmt, "streamOptimized");
+ split = (subformat == BLOCKDEV_VMDK_SUBFORMAT_TWOGBMAXEXTENTFLAT) ||
+ (subformat == BLOCKDEV_VMDK_SUBFORMAT_TWOGBMAXEXTENTSPARSE);
+ flat = (subformat == BLOCKDEV_VMDK_SUBFORMAT_MONOLITHICFLAT) ||
+ (subformat == BLOCKDEV_VMDK_SUBFORMAT_TWOGBMAXEXTENTFLAT);
+ compress = subformat == BLOCKDEV_VMDK_SUBFORMAT_STREAMOPTIMIZED;
+
if (flat) {
- desc_extent_line = "RW %" PRId64 " FLAT \"%s\" 0\n";
+ extent_line_fmt = "RW %" PRId64 " FLAT \"%s\" 0\n";
} else {
- desc_extent_line = "RW %" PRId64 " SPARSE \"%s\"\n";
+ extent_line_fmt = "RW %" PRId64 " SPARSE \"%s\"\n";
}
if (flat && backing_file) {
error_setg(errp, "Flat image can't have backing file");
@@ -2041,10 +2046,34 @@ static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts
ret = -ENOTSUP;
goto exit;
}
+
+ /* Create extents */
+ if (split) {
+ extent_size = split_size;
+ } else {
+ extent_size = size;
+ }
+ if (!split && !flat) {
+ created_size = extent_size;
+ } else {
+ created_size = 0;
+ }
+ /* Get the descriptor file BDS */
+ blk = extent_fn(created_size, 0, flat, split, compress, zeroed_grain,
+ opaque, errp);
+ if (!blk) {
+ ret = -EIO;
+ goto exit;
+ }
+ if (!split && !flat) {
+ vmdk_desc_add_extent(ext_desc_lines, extent_line_fmt, created_size,
+ blk_bs(blk)->filename);
+ }
+
if (backing_file) {
- BlockBackend *blk;
+ BlockBackend *backing;
char *full_backing = g_new0(char, PATH_MAX);
- bdrv_get_full_backing_filename_from_filename(filename, backing_file,
+ bdrv_get_full_backing_filename_from_filename(blk_bs(blk)->filename, backing_file,
full_backing, PATH_MAX,
&local_err);
if (local_err) {
@@ -2054,106 +2083,227 @@ static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts
goto exit;
}
- blk = blk_new_open(full_backing, NULL, NULL,
- BDRV_O_NO_BACKING, errp);
+ backing = blk_new_open(full_backing, NULL, NULL,
+ BDRV_O_NO_BACKING, errp);
g_free(full_backing);
- if (blk == NULL) {
+ if (backing == NULL) {
ret = -EIO;
goto exit;
}
- if (strcmp(blk_bs(blk)->drv->format_name, "vmdk")) {
- blk_unref(blk);
+ if (strcmp(blk_bs(backing)->drv->format_name, "vmdk")) {
+ error_setg(errp, "Invalid backing file format: %s. Must be vmdk",
+ blk_bs(backing)->drv->format_name);
+ blk_unref(backing);
ret = -EINVAL;
goto exit;
}
- ret = vmdk_read_cid(blk_bs(blk), 0, &parent_cid);
- blk_unref(blk);
+ ret = vmdk_read_cid(blk_bs(backing), 0, &parent_cid);
+ blk_unref(backing);
if (ret) {
+ error_setg(errp, "Failed to read parent CID");
goto exit;
}
snprintf(parent_desc_line, BUF_SIZE,
"parentFileNameHint=\"%s\"", backing_file);
}
-
- /* Create extents */
- filesize = total_size;
- while (filesize > 0) {
- int64_t size = filesize;
-
- if (split && size > split_size) {
- size = split_size;
- }
- if (split) {
- snprintf(desc_filename, PATH_MAX, "%s-%c%03d%s",
- prefix, flat ? 'f' : 's', ++idx, postfix);
- } else if (flat) {
- snprintf(desc_filename, PATH_MAX, "%s-flat%s", prefix, postfix);
- } else {
- snprintf(desc_filename, PATH_MAX, "%s%s", prefix, postfix);
- }
- snprintf(ext_filename, PATH_MAX, "%s%s", path, desc_filename);
-
- if (vmdk_create_extent(ext_filename, size,
- flat, compress, zeroed_grain, opts, errp)) {
+ extent_idx = 1;
+ while (created_size < size) {
+ int64_t cur_size = MIN(size - created_size, extent_size);
+ extent_blk = extent_fn(cur_size, extent_idx, flat, split, compress,
+ zeroed_grain, opaque, errp);
+ if (!extent_blk) {
ret = -EINVAL;
goto exit;
}
- filesize -= size;
+ vmdk_desc_add_extent(ext_desc_lines, extent_line_fmt, cur_size,
+ blk_bs(extent_blk)->filename);
+ created_size += cur_size;
+ extent_idx++;
+ blk_unref(extent_blk);
+ }
- /* Format description line */
- snprintf(desc_line, BUF_SIZE,
- desc_extent_line, size / BDRV_SECTOR_SIZE, desc_filename);
- g_string_append(ext_desc_lines, desc_line);
+ /* Check whether we got excess extents */
+ extent_blk = extent_fn(-1, extent_idx, flat, split, compress, zeroed_grain,
+ opaque, NULL);
+ if (extent_blk) {
+ blk_unref(extent_blk);
+ error_setg(errp, "List of extents contains unused extents");
+ ret = -EINVAL;
+ goto exit;
}
+
/* generate descriptor file */
desc = g_strdup_printf(desc_template,
g_random_int(),
parent_cid,
- fmt,
+ BlockdevVmdkSubformat_str(subformat),
parent_desc_line,
ext_desc_lines->str,
hw_version,
- total_size /
+ size /
(int64_t)(63 * number_heads * BDRV_SECTOR_SIZE),
number_heads,
- adapter_type);
+ BlockdevVmdkAdapterType_str(adapter_type));
desc_len = strlen(desc);
/* the descriptor offset = 0x200 */
if (!split && !flat) {
desc_offset = 0x200;
- } else {
- ret = bdrv_create_file(filename, opts, &local_err);
+ }
+
+ ret = blk_pwrite(blk, desc_offset, desc, desc_len, 0);
+ if (ret < 0) {
+ error_setg_errno(errp, -ret, "Could not write description");
+ goto exit;
+ }
+ /* bdrv_pwrite write padding zeros to align to sector, we don't need that
+ * for description file */
+ if (desc_offset == 0) {
+ ret = blk_truncate(blk, desc_len, PREALLOC_MODE_OFF, errp);
if (ret < 0) {
- error_propagate(errp, local_err);
goto exit;
}
}
+ ret = 0;
+exit:
+ if (blk) {
+ blk_unref(blk);
+ }
+ g_free(desc);
+ g_free(parent_desc_line);
+ g_string_free(ext_desc_lines, true);
+ return ret;
+}
+
+typedef struct {
+ char *path;
+ char *prefix;
+ char *postfix;
+ QemuOpts *opts;
+} VMDKCreateOptsData;
+
+static BlockBackend *vmdk_co_create_opts_cb(int64_t size, int idx,
+ bool flat, bool split, bool compress,
+ bool zeroed_grain, void *opaque,
+ Error **errp)
+{
+ BlockBackend *blk = NULL;
+ BlockDriverState *bs = NULL;
+ VMDKCreateOptsData *data = opaque;
+ char *ext_filename = NULL;
+ char *rel_filename = NULL;
+
+ /* We're done, don't create excess extents. */
+ if (size == -1) {
+ assert(errp == NULL);
+ return NULL;
+ }
- new_blk = blk_new_open(filename, NULL, NULL,
- BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL,
- &local_err);
- if (new_blk == NULL) {
- error_propagate(errp, local_err);
- ret = -EIO;
+ if (idx == 0) {
+ rel_filename = g_strdup_printf("%s%s", data->prefix, data->postfix);
+ } else if (split) {
+ rel_filename = g_strdup_printf("%s-%c%03d%s",
+ data->prefix,
+ flat ? 'f' : 's', idx, data->postfix);
+ } else {
+ assert(idx == 1);
+ rel_filename = g_strdup_printf("%s-flat%s", data->prefix, data->postfix);
+ }
+
+ ext_filename = g_strdup_printf("%s%s", data->path, rel_filename);
+ g_free(rel_filename);
+
+ if (vmdk_create_extent(ext_filename, size,
+ flat, compress, zeroed_grain, &blk, data->opts,
+ errp)) {
goto exit;
}
+ bdrv_unref(bs);
+exit:
+ g_free(ext_filename);
+ return blk;
+}
- blk_set_allow_write_beyond_eof(new_blk, true);
+static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts,
+ Error **errp)
+{
+ Error *local_err = NULL;
+ char *desc = NULL;
+ int64_t total_size = 0;
+ char *adapter_type = NULL;
+ BlockdevVmdkAdapterType adapter_type_enum;
+ char *backing_file = NULL;
+ char *hw_version = NULL;
+ char *fmt = NULL;
+ BlockdevVmdkSubformat subformat;
+ int ret = 0;
+ char *path = g_malloc0(PATH_MAX);
+ char *prefix = g_malloc0(PATH_MAX);
+ char *postfix = g_malloc0(PATH_MAX);
+ char *desc_line = g_malloc0(BUF_SIZE);
+ char *ext_filename = g_malloc0(PATH_MAX);
+ char *desc_filename = g_malloc0(PATH_MAX);
+ char *parent_desc_line = g_malloc0(BUF_SIZE);
+ bool zeroed_grain;
+ bool compat6;
+ VMDKCreateOptsData data;
- ret = blk_pwrite(new_blk, desc_offset, desc, desc_len, 0);
- if (ret < 0) {
- error_setg_errno(errp, -ret, "Could not write description");
+ if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) {
+ ret = -EINVAL;
goto exit;
}
- /* bdrv_pwrite write padding zeros to align to sector, we don't need that
- * for description file */
- if (desc_offset == 0) {
- ret = blk_truncate(new_blk, desc_len, PREALLOC_MODE_OFF, errp);
+ /* Read out options */
+ total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
+ BDRV_SECTOR_SIZE);
+ adapter_type = qemu_opt_get_del(opts, BLOCK_OPT_ADAPTER_TYPE);
+ backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE);
+ hw_version = qemu_opt_get_del(opts, BLOCK_OPT_HWVERSION);
+ compat6 = qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false);
+ if (strcmp(hw_version, "undefined") == 0) {
+ g_free(hw_version);
+ hw_version = g_strdup("4");
}
-exit:
- if (new_blk) {
- blk_unref(new_blk);
+ fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT);
+ zeroed_grain = qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false);
+
+ if (adapter_type) {
+ adapter_type_enum = qapi_enum_parse(&BlockdevVmdkAdapterType_lookup,
+ adapter_type,
+ BLOCKDEV_VMDK_ADAPTER_TYPE_IDE,
+ &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ ret = -EINVAL;
+ goto exit;
+ }
+ } else {
+ adapter_type_enum = BLOCKDEV_VMDK_ADAPTER_TYPE_IDE;
+ }
+
+ if (!fmt) {
+ /* Default format to monolithicSparse */
+ subformat = BLOCKDEV_VMDK_SUBFORMAT_MONOLITHICSPARSE;
+ } else {
+ subformat = qapi_enum_parse(&BlockdevVmdkSubformat_lookup,
+ fmt,
+ BLOCKDEV_VMDK_SUBFORMAT_MONOLITHICSPARSE,
+ &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ ret = -EINVAL;
+ goto exit;
+ }
}
+ data = (VMDKCreateOptsData){
+ .prefix = prefix,
+ .postfix = postfix,
+ .path = path,
+ .opts = opts,
+ };
+ ret = vmdk_co_do_create(total_size, subformat, adapter_type_enum,
+ backing_file, hw_version, compat6, zeroed_grain,
+ vmdk_co_create_opts_cb, &data, errp);
+
+exit:
g_free(adapter_type);
g_free(backing_file);
g_free(hw_version);
@@ -2166,7 +2316,86 @@ exit:
g_free(ext_filename);
g_free(desc_filename);
g_free(parent_desc_line);
- g_string_free(ext_desc_lines, true);
+ return ret;
+}
+
+static BlockBackend *vmdk_co_create_cb(int64_t size, int idx,
+ bool flat, bool split, bool compress,
+ bool zeroed_grain, void *opaque,
+ Error **errp)
+{
+ int ret;
+ BlockDriverState *bs;
+ BlockBackend *blk;
+ BlockdevCreateOptionsVmdk *opts = opaque;
+
+ if (idx == 0) {
+ bs = bdrv_open_blockdev_ref(opts->file, errp);
+ } else {
+ int i;
+ BlockdevRefList *list = opts->extents;
+ for (i = 1; i < idx; i++) {
+ if (!list || !list->next) {
+ error_setg(errp, "Extent [%d] not specified", i);
+ return NULL;
+ }
+ list = list->next;
+ }
+ if (!list) {
+ error_setg(errp, "Extent [%d] not specified", idx - 1);
+ return NULL;
+ }
+ bs = bdrv_open_blockdev_ref(list->value, errp);
+ }
+ if (!bs) {
+ return NULL;
+ }
+ blk = blk_new(BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | BLK_PERM_RESIZE,
+ BLK_PERM_ALL);
+ if (blk_insert_bs(blk, bs, errp)) {
+ bdrv_unref(bs);
+ return NULL;
+ }
+ blk_set_allow_write_beyond_eof(blk, true);
+ bdrv_unref(bs);
+
+ if (size != -1) {
+ ret = vmdk_init_extent(blk, size, flat, compress, zeroed_grain, errp);
+ if (ret) {
+ blk_unref(blk);
+ blk = NULL;
+ }
+ }
+ return blk;
+}
+
+static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,
+ Error **errp)
+{
+ int ret;
+ BlockdevCreateOptionsVmdk *opts;
+
+ opts = &create_options->u.vmdk;
+
+ /* Validate options */
+ if (!QEMU_IS_ALIGNED(opts->size, BDRV_SECTOR_SIZE)) {
+ error_setg(errp, "Image size must be a multiple of 512 bytes");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ ret = vmdk_co_do_create(opts->size,
+ opts->subformat,
+ opts->adapter_type,
+ opts->backing_file,
+ opts->hwversion,
+ false,
+ opts->zeroed_grain,
+ vmdk_co_create_cb,
+ opts, errp);
+ return ret;
+
+out:
return ret;
}
@@ -2314,7 +2543,8 @@ static int coroutine_fn vmdk_co_check(BlockDriverState *bs,
return ret;
}
-static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs)
+static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs,
+ Error **errp)
{
int i;
BDRVVmdkState *s = bs->opaque;
@@ -2434,6 +2664,7 @@ static BlockDriver bdrv_vmdk = {
.bdrv_co_pwrite_zeroes = vmdk_co_pwrite_zeroes,
.bdrv_close = vmdk_close,
.bdrv_co_create_opts = vmdk_co_create_opts,
+ .bdrv_co_create = vmdk_co_create,
.bdrv_co_flush_to_disk = vmdk_co_flush,
.bdrv_co_block_status = vmdk_co_block_status,
.bdrv_get_allocated_file_size = vmdk_get_allocated_file_size,
diff --git a/block/vpc.c b/block/vpc.c
index d886465b7e..52ab717642 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -979,6 +979,7 @@ static int coroutine_fn vpc_co_create(BlockdevCreateOptions *opts,
int64_t total_size;
int disk_type;
int ret = -EIO;
+ QemuUUID uuid;
assert(opts->driver == BLOCKDEV_DRIVER_VPC);
vpc_opts = &opts->u.vpc;
@@ -1062,7 +1063,8 @@ static int coroutine_fn vpc_co_create(BlockdevCreateOptions *opts,
footer->type = cpu_to_be32(disk_type);
- qemu_uuid_generate(&footer->uuid);
+ qemu_uuid_generate(&uuid);
+ footer->uuid = uuid;
footer->checksum = cpu_to_be32(vpc_checksum(buf, HEADER_SIZE));
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index c76d5416b9..d73ac1b026 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -146,6 +146,7 @@ void qmp_nbd_server_add(const char *device, bool has_name, const char *name,
BlockDriverState *bs = NULL;
BlockBackend *on_eject_blk;
NBDExport *exp;
+ int64_t len;
if (!nbd_server) {
error_setg(errp, "NBD server not running");
@@ -168,6 +169,13 @@ void qmp_nbd_server_add(const char *device, bool has_name, const char *name,
return;
}
+ len = bdrv_getlength(bs);
+ if (len < 0) {
+ error_setg_errno(errp, -len,
+ "Failed to determine the NBD export's length");
+ return;
+ }
+
if (!has_writable) {
writable = false;
}
@@ -175,7 +183,7 @@ void qmp_nbd_server_add(const char *device, bool has_name, const char *name,
writable = false;
}
- exp = nbd_export_new(bs, 0, -1, name, NULL, bitmap,
+ exp = nbd_export_new(bs, 0, len, name, NULL, bitmap,
writable ? 0 : NBD_FLAG_READ_ONLY,
NULL, false, on_eject_blk, errp);
if (!exp) {
diff --git a/blockdev.c b/blockdev.c
index a8fa8748a9..8714ad2702 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2820,6 +2820,7 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
{
BlockDriverState *bs;
BdrvDirtyBitmap *bitmap;
+ AioContext *aio_context = NULL;
if (!name || name[0] == '\0') {
error_setg(errp, "Bitmap name cannot be empty");
@@ -2854,15 +2855,17 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
disabled = false;
}
- if (persistent &&
- !bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
- {
- return;
+ if (persistent) {
+ aio_context = bdrv_get_aio_context(bs);
+ aio_context_acquire(aio_context);
+ if (!bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp)) {
+ goto out;
+ }
}
bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
if (bitmap == NULL) {
- return;
+ goto out;
}
if (disabled) {
@@ -2870,6 +2873,10 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
}
bdrv_dirty_bitmap_set_persistance(bitmap, persistent);
+ out:
+ if (aio_context) {
+ aio_context_release(aio_context);
+ }
}
void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
@@ -2878,6 +2885,7 @@ void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
BlockDriverState *bs;
BdrvDirtyBitmap *bitmap;
Error *local_err = NULL;
+ AioContext *aio_context = NULL;
bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
if (!bitmap || !bs) {
@@ -2892,14 +2900,20 @@ void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
}
if (bdrv_dirty_bitmap_get_persistance(bitmap)) {
+ aio_context = bdrv_get_aio_context(bs);
+ aio_context_acquire(aio_context);
bdrv_remove_persistent_dirty_bitmap(bs, name, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
- return;
+ goto out;
}
}
bdrv_release_dirty_bitmap(bs, bitmap);
+ out:
+ if (aio_context) {
+ aio_context_release(aio_context);
+ }
}
/**
@@ -3582,6 +3596,11 @@ BlockDeviceInfoList *qmp_query_named_block_nodes(Error **errp)
return bdrv_named_nodes_list(errp);
}
+XDbgBlockGraph *qmp_x_debug_query_block_graph(Error **errp)
+{
+ return bdrv_get_xdbg_block_graph(errp);
+}
+
BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
Error **errp)
{
diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index a8931f7afd..f3530a90e6 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -246,14 +246,15 @@ void qemu_chr_fe_deinit(CharBackend *b, bool del)
}
}
-void qemu_chr_fe_set_handlers(CharBackend *b,
- IOCanReadHandler *fd_can_read,
- IOReadHandler *fd_read,
- IOEventHandler *fd_event,
- BackendChangeHandler *be_change,
- void *opaque,
- GMainContext *context,
- bool set_open)
+void qemu_chr_fe_set_handlers_full(CharBackend *b,
+ IOCanReadHandler *fd_can_read,
+ IOReadHandler *fd_read,
+ IOEventHandler *fd_event,
+ BackendChangeHandler *be_change,
+ void *opaque,
+ GMainContext *context,
+ bool set_open,
+ bool sync_state)
{
Chardev *s;
int fe_open;
@@ -285,14 +286,24 @@ void qemu_chr_fe_set_handlers(CharBackend *b,
qemu_chr_fe_take_focus(b);
/* We're connecting to an already opened device, so let's make sure we
also get the open event */
- if (s->be_open) {
+ if (sync_state && s->be_open) {
qemu_chr_be_event(s, CHR_EVENT_OPENED);
}
}
+}
- if (CHARDEV_IS_MUX(s)) {
- mux_chr_set_handlers(s, context);
- }
+void qemu_chr_fe_set_handlers(CharBackend *b,
+ IOCanReadHandler *fd_can_read,
+ IOReadHandler *fd_read,
+ IOEventHandler *fd_event,
+ BackendChangeHandler *be_change,
+ void *opaque,
+ GMainContext *context,
+ bool set_open)
+{
+ qemu_chr_fe_set_handlers_full(b, fd_can_read, fd_read, fd_event, be_change,
+ opaque, context, set_open,
+ true);
}
void qemu_chr_fe_take_focus(CharBackend *b)
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index 6055e76293..23aa82125d 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -278,18 +278,18 @@ static void char_mux_finalize(Object *obj)
qemu_chr_fe_deinit(&d->chr, false);
}
-void mux_chr_set_handlers(Chardev *chr, GMainContext *context)
+static void mux_chr_update_read_handlers(Chardev *chr)
{
MuxChardev *d = MUX_CHARDEV(chr);
/* Fix up the real driver with mux routines */
- qemu_chr_fe_set_handlers(&d->chr,
- mux_chr_can_read,
- mux_chr_read,
- mux_chr_event,
- NULL,
- chr,
- context, true);
+ qemu_chr_fe_set_handlers_full(&d->chr,
+ mux_chr_can_read,
+ mux_chr_read,
+ mux_chr_event,
+ NULL,
+ chr,
+ chr->gcontext, true, false);
}
void mux_set_focus(Chardev *chr, int focus)
@@ -367,7 +367,7 @@ static int open_muxes(Chardev *chr)
* mark mux as OPENED so any new FEs will immediately receive
* OPENED event
*/
- qemu_chr_be_event(chr, CHR_EVENT_OPENED);
+ chr->be_open = 1;
return 0;
}
@@ -383,6 +383,7 @@ static void char_mux_class_init(ObjectClass *oc, void *data)
cc->chr_add_watch = mux_chr_add_watch;
cc->chr_be_event = mux_chr_be_event;
cc->chr_machine_done = open_muxes;
+ cc->chr_update_read_handler = mux_chr_update_read_handlers;
}
static const TypeInfo char_mux_type_info = {
diff --git a/chardev/char-pty.c b/chardev/char-pty.c
index f681d637c1..b034332edd 100644
--- a/chardev/char-pty.c
+++ b/chardev/char-pty.c
@@ -36,15 +36,12 @@ typedef struct {
QIOChannel *ioc;
int read_bytes;
- /* Protected by the Chardev chr_write_lock. */
int connected;
GSource *timer_src;
- GSource *open_source;
} PtyChardev;
#define PTY_CHARDEV(obj) OBJECT_CHECK(PtyChardev, (obj), TYPE_CHARDEV_PTY)
-static void pty_chr_update_read_handler_locked(Chardev *chr);
static void pty_chr_state(Chardev *chr, int connected);
static void pty_chr_timer_cancel(PtyChardev *s)
@@ -56,32 +53,19 @@ static void pty_chr_timer_cancel(PtyChardev *s)
}
}
-static void pty_chr_open_src_cancel(PtyChardev *s)
-{
- if (s->open_source) {
- g_source_destroy(s->open_source);
- g_source_unref(s->open_source);
- s->open_source = NULL;
- }
-}
-
static gboolean pty_chr_timer(gpointer opaque)
{
struct Chardev *chr = CHARDEV(opaque);
PtyChardev *s = PTY_CHARDEV(opaque);
- qemu_mutex_lock(&chr->chr_write_lock);
pty_chr_timer_cancel(s);
- pty_chr_open_src_cancel(s);
if (!s->connected) {
/* Next poll ... */
- pty_chr_update_read_handler_locked(chr);
+ qemu_chr_be_update_read_handlers(chr, chr->gcontext);
}
- qemu_mutex_unlock(&chr->chr_write_lock);
return FALSE;
}
-/* Called with chr_write_lock held. */
static void pty_chr_rearm_timer(Chardev *chr, int ms)
{
PtyChardev *s = PTY_CHARDEV(chr);
@@ -94,8 +78,7 @@ static void pty_chr_rearm_timer(Chardev *chr, int ms)
g_free(name);
}
-/* Called with chr_write_lock held. */
-static void pty_chr_update_read_handler_locked(Chardev *chr)
+static void pty_chr_update_read_handler(Chardev *chr)
{
PtyChardev *s = PTY_CHARDEV(chr);
GPollFD pfd;
@@ -117,24 +100,12 @@ static void pty_chr_update_read_handler_locked(Chardev *chr)
}
}
-static void pty_chr_update_read_handler(Chardev *chr)
-{
- qemu_mutex_lock(&chr->chr_write_lock);
- pty_chr_update_read_handler_locked(chr);
- qemu_mutex_unlock(&chr->chr_write_lock);
-}
-
-/* Called with chr_write_lock held. */
static int char_pty_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
PtyChardev *s = PTY_CHARDEV(chr);
if (!s->connected) {
- /* guest sends data, check for (re-)connect */
- pty_chr_update_read_handler_locked(chr);
- if (!s->connected) {
- return len;
- }
+ return len;
}
return io_channel_send(s->ioc, buf, len);
}
@@ -183,23 +154,11 @@ static gboolean pty_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
return TRUE;
}
-static gboolean qemu_chr_be_generic_open_func(gpointer opaque)
-{
- Chardev *chr = CHARDEV(opaque);
- PtyChardev *s = PTY_CHARDEV(opaque);
-
- s->open_source = NULL;
- qemu_chr_be_event(chr, CHR_EVENT_OPENED);
- return FALSE;
-}
-
-/* Called with chr_write_lock held. */
static void pty_chr_state(Chardev *chr, int connected)
{
PtyChardev *s = PTY_CHARDEV(chr);
if (!connected) {
- pty_chr_open_src_cancel(s);
remove_fd_in_watch(chr);
s->connected = 0;
/* (re-)connect poll interval for idle guests: once per second.
@@ -209,13 +168,8 @@ static void pty_chr_state(Chardev *chr, int connected)
} else {
pty_chr_timer_cancel(s);
if (!s->connected) {
- g_assert(s->open_source == NULL);
- s->open_source = g_idle_source_new();
s->connected = 1;
- g_source_set_callback(s->open_source,
- qemu_chr_be_generic_open_func,
- chr, NULL);
- g_source_attach(s->open_source, chr->gcontext);
+ qemu_chr_be_event(chr, CHR_EVENT_OPENED);
}
if (!chr->gsource) {
chr->gsource = io_add_watch_poll(chr, s->ioc,
@@ -231,11 +185,9 @@ static void char_pty_finalize(Object *obj)
Chardev *chr = CHARDEV(obj);
PtyChardev *s = PTY_CHARDEV(obj);
- qemu_mutex_lock(&chr->chr_write_lock);
pty_chr_state(chr, 0);
object_unref(OBJECT(s->ioc));
pty_chr_timer_cancel(s);
- qemu_mutex_unlock(&chr->chr_write_lock);
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
}
diff --git a/chardev/char-serial.c b/chardev/char-serial.c
index 3299b46853..a8bae31b8d 100644
--- a/chardev/char-serial.c
+++ b/chardev/char-serial.c
@@ -57,7 +57,7 @@ static void qmp_chardev_open_serial(Chardev *chr,
static void tty_serial_init(int fd, int speed,
int parity, int data_bits, int stop_bits)
{
- struct termios tty;
+ struct termios tty = {0};
speed_t spd;
#if 0
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index eaa8e8b68f..4fcdd8aedd 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -46,6 +46,12 @@ typedef struct {
size_t buflen;
} TCPChardevTelnetInit;
+typedef enum {
+ TCP_CHARDEV_STATE_DISCONNECTED,
+ TCP_CHARDEV_STATE_CONNECTING,
+ TCP_CHARDEV_STATE_CONNECTED,
+} TCPChardevState;
+
typedef struct {
Chardev parent;
QIOChannel *ioc; /* Client I/O channel */
@@ -53,7 +59,7 @@ typedef struct {
QIONetListener *listener;
GSource *hup_source;
QCryptoTLSCreds *tls_creds;
- int connected;
+ TCPChardevState state;
int max_size;
int do_telnetopt;
int do_nodelay;
@@ -74,6 +80,8 @@ typedef struct {
GSource *reconnect_timer;
int64_t reconnect_time;
bool connect_err_reported;
+
+ QIOTask *connect_task;
} SocketChardev;
#define SOCKET_CHARDEV(obj) \
@@ -82,6 +90,21 @@ typedef struct {
static gboolean socket_reconnect_timeout(gpointer opaque);
static void tcp_chr_telnet_init(Chardev *chr);
+static void tcp_chr_change_state(SocketChardev *s, TCPChardevState state)
+{
+ switch (state) {
+ case TCP_CHARDEV_STATE_DISCONNECTED:
+ break;
+ case TCP_CHARDEV_STATE_CONNECTING:
+ assert(s->state == TCP_CHARDEV_STATE_DISCONNECTED);
+ break;
+ case TCP_CHARDEV_STATE_CONNECTED:
+ assert(s->state == TCP_CHARDEV_STATE_CONNECTING);
+ break;
+ }
+ s->state = state;
+}
+
static void tcp_chr_reconn_timer_cancel(SocketChardev *s)
{
if (s->reconnect_timer) {
@@ -96,7 +119,8 @@ static void qemu_chr_socket_restart_timer(Chardev *chr)
SocketChardev *s = SOCKET_CHARDEV(chr);
char *name;
- assert(s->connected == 0);
+ assert(s->state == TCP_CHARDEV_STATE_DISCONNECTED);
+ assert(!s->reconnect_timer);
name = g_strdup_printf("chardev-socket-reconnect-%s", chr->label);
s->reconnect_timer = qemu_chr_timeout_add_ms(chr,
s->reconnect_time * 1000,
@@ -131,7 +155,7 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
SocketChardev *s = SOCKET_CHARDEV(chr);
- if (s->connected) {
+ if (s->state == TCP_CHARDEV_STATE_CONNECTED) {
int ret = io_channel_send_full(s->ioc, buf, len,
s->write_msgfds,
s->write_msgfds_num);
@@ -164,7 +188,7 @@ static int tcp_chr_read_poll(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
SocketChardev *s = SOCKET_CHARDEV(opaque);
- if (!s->connected) {
+ if (s->state != TCP_CHARDEV_STATE_CONNECTED) {
return 0;
}
s->max_size = qemu_chr_be_can_write(chr);
@@ -277,7 +301,7 @@ static int tcp_set_msgfds(Chardev *chr, int *fds, int num)
s->write_msgfds = NULL;
s->write_msgfds_num = 0;
- if (!s->connected ||
+ if ((s->state != TCP_CHARDEV_STATE_CONNECTED) ||
!qio_channel_has_feature(s->ioc,
QIO_CHANNEL_FEATURE_FD_PASS)) {
return -1;
@@ -389,7 +413,7 @@ static void tcp_chr_free_connection(Chardev *chr)
s->ioc = NULL;
g_free(chr->filename);
chr->filename = NULL;
- s->connected = 0;
+ tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
}
static const char *qemu_chr_socket_protocol(SocketChardev *s)
@@ -442,12 +466,12 @@ static void update_disconnected_filename(SocketChardev *s)
/* NB may be called even if tcp_chr_connect has not been
* reached, due to TLS or telnet initialization failure,
- * so can *not* assume s->connected == true
+ * so can *not* assume s->state == TCP_CHARDEV_STATE_CONNECTED
*/
static void tcp_chr_disconnect(Chardev *chr)
{
SocketChardev *s = SOCKET_CHARDEV(chr);
- bool emit_close = s->connected;
+ bool emit_close = s->state == TCP_CHARDEV_STATE_CONNECTED;
tcp_chr_free_connection(chr);
@@ -471,7 +495,8 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
uint8_t buf[CHR_READ_BUF_LEN];
int len, size;
- if (!s->connected || s->max_size <= 0) {
+ if ((s->state != TCP_CHARDEV_STATE_CONNECTED) ||
+ s->max_size <= 0) {
return TRUE;
}
len = sizeof(buf);
@@ -508,7 +533,7 @@ static int tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, int len)
SocketChardev *s = SOCKET_CHARDEV(chr);
int size;
- if (!s->connected) {
+ if (s->state != TCP_CHARDEV_STATE_CONNECTED) {
return 0;
}
@@ -564,7 +589,7 @@ static void update_ioc_handlers(SocketChardev *s)
{
Chardev *chr = CHARDEV(s);
- if (!s->connected) {
+ if (s->state != TCP_CHARDEV_STATE_CONNECTED) {
return;
}
@@ -589,7 +614,7 @@ static void tcp_chr_connect(void *opaque)
g_free(chr->filename);
chr->filename = qemu_chr_compute_filename(s);
- s->connected = 1;
+ tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTED);
update_ioc_handlers(s);
qemu_chr_be_event(chr, CHR_EVENT_OPENED);
}
@@ -828,7 +853,7 @@ static int tcp_chr_new_client(Chardev *chr, QIOChannelSocket *sioc)
{
SocketChardev *s = SOCKET_CHARDEV(chr);
- if (s->ioc != NULL) {
+ if (s->state != TCP_CHARDEV_STATE_CONNECTING) {
return -1;
}
@@ -865,11 +890,17 @@ static int tcp_chr_add_client(Chardev *chr, int fd)
{
int ret;
QIOChannelSocket *sioc;
+ SocketChardev *s = SOCKET_CHARDEV(chr);
+
+ if (s->state != TCP_CHARDEV_STATE_DISCONNECTED) {
+ return -1;
+ }
sioc = qio_channel_socket_new_fd(fd, NULL);
if (!sioc) {
return -1;
}
+ tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
tcp_chr_set_client_ioc_name(chr, sioc);
ret = tcp_chr_new_client(chr, sioc);
object_unref(OBJECT(sioc));
@@ -881,35 +912,125 @@ static void tcp_chr_accept(QIONetListener *listener,
void *opaque)
{
Chardev *chr = CHARDEV(opaque);
+ SocketChardev *s = SOCKET_CHARDEV(chr);
+ tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
tcp_chr_set_client_ioc_name(chr, cioc);
tcp_chr_new_client(chr, cioc);
}
-static int tcp_chr_wait_connected(Chardev *chr, Error **errp)
+
+static int tcp_chr_connect_client_sync(Chardev *chr, Error **errp)
+{
+ SocketChardev *s = SOCKET_CHARDEV(chr);
+ QIOChannelSocket *sioc = qio_channel_socket_new();
+ tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
+ tcp_chr_set_client_ioc_name(chr, sioc);
+ if (qio_channel_socket_connect_sync(sioc, s->addr, errp) < 0) {
+ tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
+ object_unref(OBJECT(sioc));
+ return -1;
+ }
+ tcp_chr_new_client(chr, sioc);
+ object_unref(OBJECT(sioc));
+ return 0;
+}
+
+
+static void tcp_chr_accept_server_sync(Chardev *chr)
{
SocketChardev *s = SOCKET_CHARDEV(chr);
QIOChannelSocket *sioc;
+ info_report("QEMU waiting for connection on: %s",
+ chr->filename);
+ tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
+ sioc = qio_net_listener_wait_client(s->listener);
+ tcp_chr_set_client_ioc_name(chr, sioc);
+ tcp_chr_new_client(chr, sioc);
+ object_unref(OBJECT(sioc));
+}
+
- /* It can't wait on s->connected, since it is set asynchronously
- * in TLS and telnet cases, only wait for an accepted socket */
- while (!s->ioc) {
+static int tcp_chr_wait_connected(Chardev *chr, Error **errp)
+{
+ SocketChardev *s = SOCKET_CHARDEV(chr);
+ const char *opts[] = { "telnet", "tn3270", "websock", "tls-creds" };
+ bool optset[] = { s->is_telnet, s->is_tn3270, s->is_websock, s->tls_creds };
+ size_t i;
+
+ QEMU_BUILD_BUG_ON(G_N_ELEMENTS(opts) != G_N_ELEMENTS(optset));
+ for (i = 0; i < G_N_ELEMENTS(opts); i++) {
+ if (optset[i]) {
+ error_setg(errp,
+ "'%s' option is incompatible with waiting for "
+ "connection completion", opts[i]);
+ return -1;
+ }