aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml8
-rw-r--r--MAINTAINERS120
-rw-r--r--block.c12
-rw-r--r--block/file-posix.c2
-rw-r--r--block/qcow2-refcount.c20
-rw-r--r--block/qcow2.h6
-rw-r--r--block/vvfat.c6
-rwxr-xr-xconfigure2
-rw-r--r--crypto/tlssession.c3
-rw-r--r--docs/interop/qcow2.txt38
-rw-r--r--hw/block/fdc.c2
-rw-r--r--hw/block/nvme.c7
-rw-r--r--hw/block/onenand.c24
-rw-r--r--hw/char/stm32f2xx_usart.c2
-rw-r--r--hw/riscv/virt.c1
-rw-r--r--hw/s390x/s390-pci-bus.c25
-rw-r--r--hw/timer/stm32f2xx_timer.c2
-rw-r--r--hw/tpm/tpm_tis.c2
-rw-r--r--include/io/channel-tls.h1
-rw-r--r--include/io/channel.h6
-rw-r--r--io/channel-tls.c5
-rw-r--r--linux-user/sparc/signal.c16
-rw-r--r--linux-user/syscall.c18
-rw-r--r--nbd/server.c14
-rw-r--r--net/filter-rewriter.c3
-rw-r--r--qapi/ui.json17
-rw-r--r--qemu-options.hx6
-rw-r--r--scripts/coccinelle/tcg_gen_extract.cocci2
-rwxr-xr-xscripts/make-release1
-rw-r--r--target/arm/kvm.c1
-rw-r--r--target/arm/kvm32.c79
-rw-r--r--target/arm/kvm64.c90
-rw-r--r--target/arm/kvm_arm.h1
-rw-r--r--target/arm/op_helper.c54
-rw-r--r--target/mips/translate.c707
-rw-r--r--target/mips/translate_init.inc.c59
-rw-r--r--target/riscv/translate.c24
-rwxr-xr-xtests/check-block.sh6
-rwxr-xr-xtests/qemu-iotests/0011
-rwxr-xr-xtests/qemu-iotests/0021
-rwxr-xr-xtests/qemu-iotests/0031
-rwxr-xr-xtests/qemu-iotests/0041
-rwxr-xr-xtests/qemu-iotests/0051
-rwxr-xr-xtests/qemu-iotests/0071
-rwxr-xr-xtests/qemu-iotests/0081
-rwxr-xr-xtests/qemu-iotests/0091
-rwxr-xr-xtests/qemu-iotests/0101
-rwxr-xr-xtests/qemu-iotests/0111
-rwxr-xr-xtests/qemu-iotests/0121
-rwxr-xr-xtests/qemu-iotests/0131
-rwxr-xr-xtests/qemu-iotests/0141
-rwxr-xr-xtests/qemu-iotests/0151
-rwxr-xr-xtests/qemu-iotests/0171
-rwxr-xr-xtests/qemu-iotests/0181
-rwxr-xr-xtests/qemu-iotests/0191
-rwxr-xr-xtests/qemu-iotests/0201
-rwxr-xr-xtests/qemu-iotests/0211
-rwxr-xr-xtests/qemu-iotests/0221
-rwxr-xr-xtests/qemu-iotests/0231
-rwxr-xr-xtests/qemu-iotests/0241
-rwxr-xr-xtests/qemu-iotests/0251
-rwxr-xr-xtests/qemu-iotests/0261
-rwxr-xr-xtests/qemu-iotests/0271
-rwxr-xr-xtests/qemu-iotests/0281
-rwxr-xr-xtests/qemu-iotests/0291
-rwxr-xr-xtests/qemu-iotests/0311
-rwxr-xr-xtests/qemu-iotests/0321
-rwxr-xr-xtests/qemu-iotests/0331
-rwxr-xr-xtests/qemu-iotests/0341
-rwxr-xr-xtests/qemu-iotests/0353
-rwxr-xr-xtests/qemu-iotests/0361
-rwxr-xr-xtests/qemu-iotests/0373
-rwxr-xr-xtests/qemu-iotests/0387
-rwxr-xr-xtests/qemu-iotests/0391
-rwxr-xr-xtests/qemu-iotests/0421
-rwxr-xr-xtests/qemu-iotests/0431
-rwxr-xr-xtests/qemu-iotests/0467
-rwxr-xr-xtests/qemu-iotests/0473
-rwxr-xr-xtests/qemu-iotests/0495
-rwxr-xr-xtests/qemu-iotests/0501
-rwxr-xr-xtests/qemu-iotests/0515
-rwxr-xr-xtests/qemu-iotests/0521
-rwxr-xr-xtests/qemu-iotests/0531
-rwxr-xr-xtests/qemu-iotests/0541
-rwxr-xr-xtests/qemu-iotests/05848
-rwxr-xr-xtests/qemu-iotests/0591
-rwxr-xr-xtests/qemu-iotests/0601
-rwxr-xr-xtests/qemu-iotests/0611
-rwxr-xr-xtests/qemu-iotests/0621
-rwxr-xr-xtests/qemu-iotests/0631
-rwxr-xr-xtests/qemu-iotests/0641
-rwxr-xr-xtests/qemu-iotests/0661
-rwxr-xr-xtests/qemu-iotests/0675
-rwxr-xr-xtests/qemu-iotests/0681
-rwxr-xr-xtests/qemu-iotests/0691
-rwxr-xr-xtests/qemu-iotests/0701
-rwxr-xr-xtests/qemu-iotests/0715
-rwxr-xr-xtests/qemu-iotests/0721
-rwxr-xr-xtests/qemu-iotests/0731
-rwxr-xr-xtests/qemu-iotests/0751
-rwxr-xr-xtests/qemu-iotests/0761
-rwxr-xr-xtests/qemu-iotests/0775
-rwxr-xr-xtests/qemu-iotests/0781
-rwxr-xr-xtests/qemu-iotests/0791
-rwxr-xr-xtests/qemu-iotests/0801
-rwxr-xr-xtests/qemu-iotests/0815
-rwxr-xr-xtests/qemu-iotests/0823
-rwxr-xr-xtests/qemu-iotests/0831
-rwxr-xr-xtests/qemu-iotests/0841
-rwxr-xr-xtests/qemu-iotests/08511
-rwxr-xr-xtests/qemu-iotests/0863
-rwxr-xr-xtests/qemu-iotests/0877
-rwxr-xr-xtests/qemu-iotests/0881
-rwxr-xr-xtests/qemu-iotests/0891
-rwxr-xr-xtests/qemu-iotests/0901
-rwxr-xr-xtests/qemu-iotests/0911
-rwxr-xr-xtests/qemu-iotests/0921
-rwxr-xr-xtests/qemu-iotests/0941
-rwxr-xr-xtests/qemu-iotests/0951
-rwxr-xr-xtests/qemu-iotests/0971
-rwxr-xr-xtests/qemu-iotests/0981
-rwxr-xr-xtests/qemu-iotests/0997
-rwxr-xr-xtests/qemu-iotests/1011
-rwxr-xr-xtests/qemu-iotests/1021
-rwxr-xr-xtests/qemu-iotests/1031
-rwxr-xr-xtests/qemu-iotests/1041
-rwxr-xr-xtests/qemu-iotests/1051
-rwxr-xr-xtests/qemu-iotests/1061
-rwxr-xr-xtests/qemu-iotests/1071
-rwxr-xr-xtests/qemu-iotests/1081
-rwxr-xr-xtests/qemu-iotests/1093
-rwxr-xr-xtests/qemu-iotests/1101
-rwxr-xr-xtests/qemu-iotests/1111
-rwxr-xr-xtests/qemu-iotests/1123
-rwxr-xr-xtests/qemu-iotests/1131
-rwxr-xr-xtests/qemu-iotests/1141
-rwxr-xr-xtests/qemu-iotests/1151
-rwxr-xr-xtests/qemu-iotests/1161
-rwxr-xr-xtests/qemu-iotests/1171
-rwxr-xr-xtests/qemu-iotests/1191
-rwxr-xr-xtests/qemu-iotests/1201
-rwxr-xr-xtests/qemu-iotests/1211
-rwxr-xr-xtests/qemu-iotests/1221
-rwxr-xr-xtests/qemu-iotests/1231
-rwxr-xr-xtests/qemu-iotests/1251
-rwxr-xr-xtests/qemu-iotests/1261
-rwxr-xr-xtests/qemu-iotests/1271
-rwxr-xr-xtests/qemu-iotests/1281
-rwxr-xr-xtests/qemu-iotests/1301
-rwxr-xr-xtests/qemu-iotests/1311
-rwxr-xr-xtests/qemu-iotests/1331
-rwxr-xr-xtests/qemu-iotests/1341
-rwxr-xr-xtests/qemu-iotests/1351
-rwxr-xr-xtests/qemu-iotests/1371
-rwxr-xr-xtests/qemu-iotests/1381
-rwxr-xr-xtests/qemu-iotests/1401
-rwxr-xr-xtests/qemu-iotests/1411
-rwxr-xr-xtests/qemu-iotests/1429
-rwxr-xr-xtests/qemu-iotests/1431
-rwxr-xr-xtests/qemu-iotests/1441
-rwxr-xr-xtests/qemu-iotests/1451
-rwxr-xr-xtests/qemu-iotests/1461
-rwxr-xr-xtests/qemu-iotests/1501
-rwxr-xr-xtests/qemu-iotests/1535
-rwxr-xr-xtests/qemu-iotests/1541
-rwxr-xr-xtests/qemu-iotests/1561
-rwxr-xr-xtests/qemu-iotests/1575
-rwxr-xr-xtests/qemu-iotests/1581
-rwxr-xr-xtests/qemu-iotests/1591
-rwxr-xr-xtests/qemu-iotests/1601
-rwxr-xr-xtests/qemu-iotests/1621
-rwxr-xr-xtests/qemu-iotests/1701
-rwxr-xr-xtests/qemu-iotests/1711
-rwxr-xr-xtests/qemu-iotests/1727
-rwxr-xr-xtests/qemu-iotests/1731
-rwxr-xr-xtests/qemu-iotests/1741
-rwxr-xr-xtests/qemu-iotests/1751
-rwxr-xr-xtests/qemu-iotests/1763
-rwxr-xr-xtests/qemu-iotests/1773
-rwxr-xr-xtests/qemu-iotests/1781
-rwxr-xr-xtests/qemu-iotests/1791
-rwxr-xr-xtests/qemu-iotests/1811
-rwxr-xr-xtests/qemu-iotests/18272
-rw-r--r--tests/qemu-iotests/182.out9
-rwxr-xr-xtests/qemu-iotests/1831
-rwxr-xr-xtests/qemu-iotests/1845
-rwxr-xr-xtests/qemu-iotests/1851
-rwxr-xr-xtests/qemu-iotests/1865
-rwxr-xr-xtests/qemu-iotests/1871
-rwxr-xr-xtests/qemu-iotests/1881
-rwxr-xr-xtests/qemu-iotests/1891
-rwxr-xr-xtests/qemu-iotests/1901
-rwxr-xr-xtests/qemu-iotests/1911
-rwxr-xr-xtests/qemu-iotests/1921
-rwxr-xr-xtests/qemu-iotests/1955
-rwxr-xr-xtests/qemu-iotests/1971
-rwxr-xr-xtests/qemu-iotests/1981
-rwxr-xr-xtests/qemu-iotests/2001
-rwxr-xr-xtests/qemu-iotests/2043
-rwxr-xr-xtests/qemu-iotests/2141
-rwxr-xr-xtests/qemu-iotests/2151
-rwxr-xr-xtests/qemu-iotests/22096
-rw-r--r--tests/qemu-iotests/220.out54
-rwxr-xr-xtests/qemu-iotests/2211
-rwxr-xr-xtests/qemu-iotests/2235
-rwxr-xr-xtests/qemu-iotests/2251
-rwxr-xr-xtests/qemu-iotests/2261
-rwxr-xr-xtests/qemu-iotests/2275
-rwxr-xr-xtests/qemu-iotests/2291
-rwxr-xr-xtests/qemu-iotests/2311
-rwxr-xr-xtests/qemu-iotests/2327
-rwxr-xr-xtests/qemu-iotests/233112
-rw-r--r--tests/qemu-iotests/233.out40
-rwxr-xr-xtests/qemu-iotests/check62
-rw-r--r--tests/qemu-iotests/common.config6
-rw-r--r--tests/qemu-iotests/common.nbd109
-rw-r--r--tests/qemu-iotests/common.pattern16
-rw-r--r--tests/qemu-iotests/common.qemu8
-rw-r--r--tests/qemu-iotests/common.rc2
-rw-r--r--tests/qemu-iotests/common.tls137
-rw-r--r--tests/qemu-iotests/group2
-rw-r--r--tests/tcg/multiarch/linux-test.c4
-rw-r--r--tests/tpm-tests.c2
-rw-r--r--ui/egl-headless.c2
224 files changed, 1681 insertions, 786 deletions
diff --git a/.travis.yml b/.travis.yml
index aa49c7b114..d472fd650b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -107,8 +107,14 @@ matrix:
- env: CONFIG="--disable-tcg"
TEST_CMD=""
compiler: gcc
- - env: CONFIG=""
+ # 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"
os: osx
+ osx_image: xcode9.4
+ compiler: clang
+ - env: CONFIG="--target-list=i386-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,x86_64-softmmu"
+ os: osx
+ osx_image: xcode10
compiler: clang
# Python builds
- env: CONFIG="--target-list=x86_64-softmmu"
diff --git a/MAINTAINERS b/MAINTAINERS
index 4b8db618f5..1032406c56 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12,9 +12,14 @@ consult qemu-devel and not any specific individual privately.
Descriptions of section entries:
M: Mail patches to: FullName <address@domain>
+ Maintainers are looking after a certain area and must be CCed on
+ patches. They are considered the main contact point.
R: Designated reviewer: FullName <address@domain>
These reviewers should be CCed on patches.
+ Reviewers are familiar with the subject matter and provide feedback
+ even though they are not maintainers.
L: Mailing list that is relevant to this area
+ These lists should be CCed on patches.
W: Web-page with status/info
Q: Patchwork web based patch tracking system site
T: SCM tree type and location. Type is one of: git, hg, quilt, stgit.
@@ -190,6 +195,7 @@ F: disas/microblaze.c
MIPS
M: Aurelien Jarno <aurelien@aurel32.net>
M: Aleksandar Markovic <amarkovic@wavecomp.com>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: target/mips/
F: hw/mips/
@@ -336,6 +342,7 @@ F: target/arm/kvm.c
MIPS
M: James Hogan <jhogan@kernel.org>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: target/mips/kvm.c
@@ -435,8 +442,9 @@ ARM Machines
------------
Allwinner-a10
M: Beniamino Galvani <b.galvani@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: hw/*/allwinner*
F: include/hw/*/allwinner*
F: hw/arm/cubieboard.c
@@ -495,40 +503,46 @@ F: tests/test-arm-mptimer.c
Exynos
M: Igor Mitsyanko <i.mitsyanko@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: hw/*/exynos*
F: include/hw/arm/exynos4210.h
Calxeda Highbank
M: Rob Herring <robh@kernel.org>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: hw/arm/highbank.c
F: hw/net/xgmac.c
Canon DIGIC
M: Antony Pavlov <antonynpavlov@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: include/hw/arm/digic.h
F: hw/*/digic*
Gumstix
-M: Philippe Mathieu-Daudé <f4bug@amsat.org>
+M: Peter Maydell <peter.maydell@linaro.org>
+R: Philippe Mathieu-Daudé <f4bug@amsat.org>
L: qemu-devel@nongnu.org
L: qemu-arm@nongnu.org
S: Odd Fixes
F: hw/arm/gumstix.c
-i.MX31
+i.MX31 (kzm)
M: Peter Chubb <peter.chubb@nicta.com.au>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Odd fixes
-F: hw/*/imx*
-F: include/hw/*/imx*
+S: Odd Fixes
F: hw/arm/kzm.c
-F: include/hw/arm/fsl-imx31.h
+F: hw/*/imx_*
+F: hw/*/*imx31*
+F: include/hw/*/imx_*
+F: include/hw/*/*imx31*
Integrator CP
M: Peter Maydell <peter.maydell@linaro.org>
@@ -537,6 +551,28 @@ S: Maintained
F: hw/arm/integratorcp.c
F: hw/misc/arm_integrator_debug.c
+MCIMX6UL EVK / i.MX6ul
+M: Peter Maydell <peter.maydell@linaro.org>
+R: Jean-Christophe Dubois <jcd@tribudubois.net>
+L: qemu-arm@nongnu.org
+S: Odd Fixes
+F: hw/arm/mcimx6ul-evk.c
+F: hw/arm/fsl-imx6ul.c
+F: hw/misc/imx6ul_ccm.c
+F: include/hw/arm/fsl-imx6ul.h
+F: include/hw/misc/imx6ul_ccm.h
+
+MCIMX7D SABRE / i.MX7
+M: Peter Maydell <peter.maydell@linaro.org>
+R: Andrey Smirnov <andrew.smirnov@gmail.com>
+L: qemu-arm@nongnu.org
+S: Odd Fixes
+F: hw/arm/mcimx7d-sabre.c
+F: hw/arm/fsl-imx7.c
+F: include/hw/arm/fsl-imx7.h
+F: hw/pci-host/designware.c
+F: include/hw/pci-host/designware.h
+
MPS2
M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
@@ -554,22 +590,36 @@ F: include/hw/misc/iotkit-sysinfo.h
Musicpal
M: Jan Kiszka <jan.kiszka@web.de>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: hw/arm/musicpal.c
nSeries
M: Andrzej Zaborowski <balrogg@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: hw/arm/nseries.c
Palm
M: Andrzej Zaborowski <balrogg@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: hw/arm/palm.c
+Raspberry Pi
+M: Peter Maydell <peter.maydell@linaro.org>
+R: Andrew Baumann <Andrew.Baumann@microsoft.com>
+R: Philippe Mathieu-Daudé <f4bug@amsat.org>
+L: qemu-arm@nongnu.org
+S: Odd Fixes
+F: hw/arm/raspi_platform.h
+F: hw/*/bcm283*
+F: include/hw/arm/raspi*
+F: include/hw/*/bcm283*
+
Real View
M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
@@ -581,8 +631,9 @@ F: include/hw/intc/realview_gic.h
PXA2XX
M: Andrzej Zaborowski <balrogg@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
-S: Maintained
+S: Odd Fixes
F: hw/arm/mainstone.c
F: hw/arm/spitz.c
F: hw/arm/tosa.c
@@ -591,6 +642,19 @@ F: hw/*/pxa2xx*
F: hw/misc/mst_fpga.c
F: include/hw/arm/pxa.h
+SABRELITE / i.MX6
+M: Peter Maydell <peter.maydell@linaro.org>
+R: Jean-Christophe Dubois <jcd@tribudubois.net>
+L: qemu-arm@nongnu.org
+S: Odd Fixes
+F: hw/arm/sabrelite.c
+F: hw/arm/fsl-imx6.c
+F: hw/misc/imx6_src.c
+F: hw/ssi/imx_spi.c
+F: include/hw/arm/fsl-imx6.h
+F: include/hw/misc/imx6_src.h
+F: include/hw/ssi/imx_spi.h
+
Sharp SL-5500 (Collie) PDA
M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
@@ -604,6 +668,12 @@ L: qemu-arm@nongnu.org
S: Maintained
F: hw/*/stellaris*
+Versatile Express
+M: Peter Maydell <peter.maydell@linaro.org>
+L: qemu-arm@nongnu.org
+S: Maintained
+F: hw/arm/vexpress.c
+
Versatile PB
M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
@@ -611,9 +681,17 @@ S: Maintained
F: hw/*/versatile*
F: hw/misc/arm_sysctl.c
+Virt
+M: Peter Maydell <peter.maydell@linaro.org>
+L: qemu-arm@nongnu.org
+S: Maintained
+F: hw/arm/virt*
+F: include/hw/arm/virt.h
+
Xilinx Zynq
M: Edgar E. Iglesias <edgar.iglesias@gmail.com>
M: Alistair Francis <alistair@alistair23.me>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
S: Maintained
F: hw/*/xilinx_*
@@ -625,6 +703,7 @@ X: hw/ssi/xilinx_*
Xilinx ZynqMP
M: Alistair Francis <alistair@alistair23.me>
M: Edgar E. Iglesias <edgar.iglesias@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org
S: Maintained
F: hw/*/xlnx*.c
@@ -638,6 +717,7 @@ F: hw/arm/virt-acpi-build.c
STM32F205
M: Alistair Francis <alistair@alistair23.me>
+M: Peter Maydell <peter.maydell@linaro.org>
S: Maintained
F: hw/arm/stm32f205_soc.c
F: hw/misc/stm32f2xx_syscfg.c
@@ -649,11 +729,13 @@ F: include/hw/*/stm32*.h
Netduino 2
M: Alistair Francis <alistair@alistair23.me>
+M: Peter Maydell <peter.maydell@linaro.org>
S: Maintained
F: hw/arm/netduino2.c
SmartFusion2
M: Subbaraya Sundeep <sundeep.lkml@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
S: Maintained
F: hw/arm/msf2-soc.c
F: hw/misc/msf2-sysreg.c
@@ -666,11 +748,13 @@ F: include/hw/ssi/mss-spi.h
Emcraft M2S-FG484
M: Subbaraya Sundeep <sundeep.lkml@gmail.com>
+M: Peter Maydell <peter.maydell@linaro.org>
S: Maintained
F: hw/arm/msf2-som.c
ASPEED BMCs
M: Cédric Le Goater <clg@kaod.org>
+M: Peter Maydell <peter.maydell@linaro.org>
R: Andrew Jeffery <andrew@aj.id.au>
R: Joel Stanley <joel@jms.id.au>
L: qemu-arm@nongnu.org
@@ -682,6 +766,7 @@ F: include/hw/net/ftgmac100.h
NRF51
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
@@ -741,27 +826,32 @@ MIPS Machines
-------------
Jazz
M: Hervé Poussineau <hpoussin@reactos.org>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/mips/mips_jazz.c
Malta
M: Aurelien Jarno <aurelien@aurel32.net>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/mips/mips_malta.c
Mipssim
M: Aleksandar Markovic <amarkovic@wavecomp.com>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Odd Fixes
F: hw/mips/mips_mipssim.c
F: hw/net/mipsnet.c
R4000
M: Aurelien Jarno <aurelien@aurel32.net>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/mips/mips_r4k.c
Fulong 2E
M: Aleksandar Markovic <amarkovic@wavecomp.com>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Odd Fixes
F: hw/mips/mips_fulong2e.c
F: hw/isa/vt82c686.c
@@ -770,6 +860,7 @@ F: include/hw/isa/vt82c686.h
Boston
M: Paul Burton <pburton@wavecomp.com>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: hw/core/loader-fit.c
F: hw/mips/boston.c
@@ -1992,6 +2083,7 @@ F: disas/i386.c
MIPS target
M: Aurelien Jarno <aurelien@aurel32.net>
+R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained
F: tcg/mips/
F: disas/mips.c
diff --git a/block.c b/block.c
index fd67e14dfa..3feac08535 100644
--- a/block.c
+++ b/block.c
@@ -3201,6 +3201,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
QDict *orig_reopen_opts;
char *discard = NULL;
bool read_only;
+ bool drv_prepared = false;
assert(reopen_state != NULL);
assert(reopen_state->bs->drv != NULL);
@@ -3285,6 +3286,8 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
goto error;
}
+ drv_prepared = true;
+
/* Options that are not handled are only okay if they are unchanged
* compared to the old state. It is expected that some options are only
* used for the initial open, but not reopen (e.g. filename) */
@@ -3350,6 +3353,15 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
reopen_state->options = qobject_ref(orig_reopen_opts);
error:
+ if (ret < 0 && drv_prepared) {
+ /* drv->bdrv_reopen_prepare() has succeeded, so we need to
+ * call drv->bdrv_reopen_abort() before signaling an error
+ * (bdrv_reopen_multiple() will not call bdrv_reopen_abort()
+ * when the respective bdrv_reopen_prepare() has failed) */
+ if (drv->bdrv_reopen_abort) {
+ drv->bdrv_reopen_abort(reopen_state);
+ }
+ }
qemu_opts_del(opts);
qobject_unref(orig_reopen_opts);
g_free(discard);
diff --git a/block/file-posix.c b/block/file-posix.c
index 58c86a01ea..07bbdab953 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -959,7 +959,7 @@ static void raw_reopen_commit(BDRVReopenState *state)
/* Copy locks to the new fd before closing the old one. */
raw_apply_lock_bytes(NULL, rs->fd, s->locked_perm,
- ~s->locked_shared_perm, false, &local_err);
+ s->locked_shared_perm, false, &local_err);
if (local_err) {
/* shouldn't fail in a sane host, but report it just in case. */
error_report_err(local_err);
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 46082aeac1..1c63ac244a 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -31,7 +31,8 @@
#include "qemu/bswap.h"
#include "qemu/cutils.h"
-static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size);
+static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size,
+ uint64_t max);
static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
int64_t offset, int64_t length, uint64_t addend,
bool decrease, enum qcow2_discard_type type);
@@ -362,7 +363,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
}
/* Allocate the refcount block itself and mark it as used */
- int64_t new_block = alloc_clusters_noref(bs, s->cluster_size);
+ int64_t new_block = alloc_clusters_noref(bs, s->cluster_size, INT64_MAX);
if (new_block < 0) {
return new_block;
}
@@ -954,7 +955,8 @@ int qcow2_update_cluster_refcount(BlockDriverState *bs,
/* return < 0 if error */
-static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size)
+static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size,
+ uint64_t max)
{
BDRVQcow2State *s = bs->opaque;
uint64_t i, nb_clusters, refcount;
@@ -979,9 +981,9 @@ retry:
}
/* Make sure that all offsets in the "allocated" range are representable
- * in an int64_t */
+ * in the requested max */
if (s->free_cluster_index > 0 &&
- s->free_cluster_index - 1 > (INT64_MAX >> s->cluster_bits))
+ s->free_cluster_index - 1 > (max >> s->cluster_bits))
{
return -EFBIG;
}
@@ -1001,7 +1003,7 @@ int64_t qcow2_alloc_clusters(BlockDriverState *bs, uint64_t size)
BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC);
do {
- offset = alloc_clusters_noref(bs, size);
+ offset = alloc_clusters_noref(bs, size, QCOW_MAX_CLUSTER_OFFSET);
if (offset < 0) {
return offset;
}
@@ -1083,7 +1085,11 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
free_in_cluster = s->cluster_size - offset_into_cluster(s, offset);
do {
if (!offset || free_in_cluster < size) {
- int64_t new_cluster = alloc_clusters_noref(bs, s->cluster_size);
+ int64_t new_cluster;
+
+ new_cluster = alloc_clusters_noref(bs, s->cluster_size,
+ MIN(s->cluster_offset_mask,
+ QCOW_MAX_CLUSTER_OFFSET));
if (new_cluster < 0) {
return new_cluster;
}
diff --git a/block/qcow2.h b/block/qcow2.h
index 29c98d87a0..8662b68575 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -42,6 +42,12 @@
#define QCOW_MAX_CRYPT_CLUSTERS 32
#define QCOW_MAX_SNAPSHOTS 65536
+/* Field widths in qcow2 mean normal cluster offsets cannot reach
+ * 64PB; depending on cluster size, compressed clusters can have a
+ * smaller limit (64PB for up to 16k clusters, then ramps down to
+ * 512TB for 2M clusters). */
+#define QCOW_MAX_CLUSTER_OFFSET ((1ULL << 56) - 1)
+
/* 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
diff --git a/block/vvfat.c b/block/vvfat.c
index 1de5de1db4..b7b61ea8b7 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2510,7 +2510,7 @@ static int commit_one_file(BDRVVVFATState* s,
uint32_t first_cluster = c;
mapping_t* mapping = find_mapping_for_cluster(s, c);
uint32_t size = filesize_of_direntry(direntry);
- char* cluster = g_malloc(s->cluster_size);
+ char *cluster;
uint32_t i;
int fd = 0;
@@ -2528,17 +2528,17 @@ static int commit_one_file(BDRVVVFATState* s,
if (fd < 0) {
fprintf(stderr, "Could not open %s... (%s, %d)\n", mapping->path,
strerror(errno), errno);
- g_free(cluster);
return fd;
}
if (offset > 0) {
if (lseek(fd, offset, SEEK_SET) != offset) {
qemu_close(fd);
- g_free(cluster);
return -3;
}
}
+ cluster = g_malloc(s->cluster_size);
+
while (offset < size) {
uint32_t c1;
int rest_size = (size - offset > s->cluster_size ?
diff --git a/configure b/configure
index 5b1d83ea26..0a3c6a72c3 100755
--- a/configure
+++ b/configure
@@ -878,7 +878,7 @@ Linux)
vhost_crypto="yes"
vhost_scsi="yes"
vhost_vsock="yes"
- QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
+ QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES"
supported_os="yes"
libudev="yes"
;;
diff --git a/crypto/tlssession.c b/crypto/tlssession.c
index 2f28fa7f71..0dedd4af52 100644
--- a/crypto/tlssession.c
+++ b/crypto/tlssession.c
@@ -473,6 +473,9 @@ qcrypto_tls_session_read(QCryptoTLSSession *session,
case GNUTLS_E_INTERRUPTED:
errno = EINTR;
break;
+ case GNUTLS_E_PREMATURE_TERMINATION:
+ errno = ECONNABORTED;
+ break;
default:
errno = EIO;
break;
diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt
index 845d40a086..fb5cb47245 100644
--- a/docs/interop/qcow2.txt
+++ b/docs/interop/qcow2.txt
@@ -40,7 +40,18 @@ The first cluster of a qcow2 image contains the file header:
with larger cluster sizes.
24 - 31: size
- Virtual disk size in bytes
+ Virtual disk size in bytes.
+
+ Note: qemu has an implementation limit of 32 MB as
+ the maximum L1 table size. With a 2 MB cluster
+ size, it is unable to populate a virtual cluster
+ beyond 2 EB (61 bits); with a 512 byte cluster
+ size, it is unable to populate a virtual size
+ larger than 128 GB (37 bits). Meanwhile, L1/L2
+ table layouts limit an image to no more than 64 PB
+ (56 bits) of populated clusters, and an image may
+ hit other limits first (such as a file system's
+ maximum size).
32 - 35: crypt_method
0 for no encryption
@@ -326,6 +337,17 @@ in the image file.
It contains pointers to the second level structures which are called refcount
blocks and are exactly one cluster in size.
+Although a large enough refcount table can reserve clusters past 64 PB
+(56 bits) (assuming the underlying protocol can even be sized that
+large), note that some qcow2 metadata such as L1/L2 tables must point
+to clusters prior to that point.
+
+Note: qemu has an implementation limit of 8 MB as the maximum refcount
+table size. With a 2 MB cluster size and a default refcount_order of
+4, it is unable to reference host resources beyond 2 EB (61 bits); in
+the worst case, with a 512 cluster size and refcount_order of 6, it is
+unable to access beyond 32 GB (35 bits).
+
Given an offset into the image file, the refcount of its cluster can be
obtained as follows:
@@ -365,6 +387,16 @@ The L1 table has a variable size (stored in the header) and may use multiple
clusters, however it must be contiguous in the image file. L2 tables are
exactly one cluster in size.
+The L1 and L2 tables have implications on the maximum virtual file
+size; for a given L1 table size, a larger cluster size is required for
+the guest to have access to more space. Furthermore, a virtual
+cluster must currently map to a host offset below 64 PB (56 bits)
+(although this limit could be relaxed by putting reserved bits into
+use). Additionally, as cluster size increases, the maximum host
+offset for a compressed cluster is reduced (a 2M cluster size requires
+compressed clusters to reside below 512 TB (49 bits), and this limit
+cannot be relaxed without an incompatible layout change).
+
Given an offset into the virtual disk, the offset into the image file can be
obtained as follows:
@@ -427,7 +459,9 @@ Standard Cluster Descriptor:
Compressed Clusters Descriptor (x = 62 - (cluster_bits - 8)):
Bit 0 - x-1: Host cluster offset. This is usually _not_ aligned to a
- cluster or sector boundary!
+ cluster or sector boundary! If cluster_bits is
+ small enough that this field includes bits beyond
+ 55, those upper bits must be set to 0.
x - 61: Number of additional 512-byte sectors used for the
compressed data, beyond the sector containing the offset
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 2e9c1e1e2f..6f19f127a5 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -1617,7 +1617,7 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0,
fdctrl->fifo[5] = cur_drv->sect;
fdctrl->fifo[6] = FD_SECTOR_SC;
fdctrl->data_dir = FD_DIR_READ;
- if (!(fdctrl->msr & FD_MSR_NONDMA)) {
+ if (fdctrl->dma_chann != -1 && !(fdctrl->msr & FD_MSR_NONDMA)) {
IsaDmaClass *k = ISADMA_GET_CLASS(fdctrl->dma);
k->release_DREQ(fdctrl->dma, fdctrl->dma_chann);
}
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 09d7c90259..d0226e7fdc 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1175,6 +1175,10 @@ static void nvme_cmb_write(void *opaque, hwaddr addr, uint64_t data,
unsigned size)
{
NvmeCtrl *n = (NvmeCtrl *)opaque;
+
+ if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) {
+ return;
+ }
memcpy(&n->cmbuf[addr], &data, size);
}
@@ -1183,6 +1187,9 @@ static uint64_t nvme_cmb_read(void *opaque, hwaddr addr, unsigned size)
uint64_t val;
NvmeCtrl *n = (NvmeCtrl *)opaque;
+ if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) {
+ return 0;
+ }
memcpy(&val, &n->cmbuf[addr], size);
return val;
}
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index 0cb8d7fa13..2b48609776 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -28,6 +28,7 @@
#include "exec/memory.h"
#include "hw/sysbus.h"
#include "qemu/error-report.h"
+#include "qemu/log.h"
/* 11 for 2kB-page OneNAND ("2nd generation") and 10 for 1kB-page chips */
#define PAGE_SHIFT 11
@@ -594,8 +595,8 @@ static void onenand_command(OneNANDState *s)
default:
s->status |= ONEN_ERR_CMD;
s->intstatus |= ONEN_INT;
- fprintf(stderr, "%s: unknown OneNAND command %x\n",
- __func__, s->command);
+ qemu_log_mask(LOG_GUEST_ERROR, "unknown OneNAND command %x\n",
+ s->command);
}
onenand_intr_update(s);
@@ -608,7 +609,7 @@ static uint64_t onenand_read(void *opaque, hwaddr addr,
int offset = addr >> s->shift;
switch (offset) {
- case 0x0000 ... 0xc000:
+ case 0x0000 ... 0xbffe:
return lduw_le_p(s->boot[0] + addr);
case 0xf000: /* Manufacturer ID */
@@ -657,12 +658,13 @@ static uint64_t onenand_read(void *opaque, hwaddr addr,
case 0xff02: /* ECC Result of spare area data */
case 0xff03: /* ECC Result of main area data */
case 0xff04: /* ECC Result of spare area data */
- hw_error("%s: implement ECC\n", __func__);
+ qemu_log_mask(LOG_UNIMP,
+ "onenand: ECC result registers unimplemented\n");
return 0x0000;
}
- fprintf(stderr, "%s: unknown OneNAND register %x\n",
- __func__, offset);
+ qemu_log_mask(LOG_GUEST_ERROR, "read of unknown OneNAND register 0x%x\n",
+ offset);
return 0;
}
@@ -706,8 +708,9 @@ static void onenand_write(void *opaque, hwaddr addr,
break;
default:
- fprintf(stderr, "%s: unknown OneNAND boot command %"PRIx64"\n",
- __func__, value);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "unknown OneNAND boot command %" PRIx64 "\n",
+ value);
}
break;
@@ -757,8 +760,9 @@ static void onenand_write(void *opaque, hwaddr addr,
break;
default:
- fprintf(stderr, "%s: unknown OneNAND register %x\n",
- __func__, offset);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "write to unknown OneNAND register 0x%x\n",
+ offset);
}
}
diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
index 032b5fda13..f3363a2952 100644
--- a/hw/char/stm32f2xx_usart.c
+++ b/hw/char/stm32f2xx_usart.c
@@ -202,7 +202,7 @@ static void stm32f2xx_usart_init(Object *obj)
sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
memory_region_init_io(&s->mmio, obj, &stm32f2xx_usart_ops, s,
- TYPE_STM32F2XX_USART, 0x2000);
+ TYPE_STM32F2XX_USART, 0x400);
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
}
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4a137a503c..2b38f89070 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -240,6 +240,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
qemu_fdt_setprop_cells(fdt, nodename, "reg",
0x0, memmap[VIRT_TEST].base,
0x0, memmap[VIRT_TEST].size);
+ g_free(nodename);
nodename = g_strdup_printf("/uart@%lx",
(long)memmap[VIRT_UART0].base);
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index e42e1b80d6..060ff062bc 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -780,17 +780,31 @@ static void s390_pci_msix_free(S390PCIBusDevice *pbdev)
}
static S390PCIBusDevice *s390_pci_device_new(S390pciState *s,
- const char *target)
+ const char *target, Error **errp)
{
- DeviceState *dev = NULL;
+ Error *local_err = NULL;
+ DeviceState *dev;
dev = qdev_try_create(BUS(s->bus), TYPE_S390_PCI_DEVICE);
if (!dev) {
+ error_setg(errp, "zPCI device could not be created");
return NULL;
}
- qdev_prop_set_string(dev, "target", target);
- qdev_init_nofail(dev);
+ object_property_set_str(OBJECT(dev), target, "target", &local_err);
+ if (local_err) {
+ object_unparent(OBJECT(dev));
+ error_propagate_prepend(errp, local_err,
+ "zPCI device could not be created: ");
+ return NULL;
+ }
+ object_property_set_bool(OBJECT(dev), true, "realized", &local_err);
+ if (local_err) {
+ object_unparent(OBJECT(dev));
+ error_propagate_prepend(errp, local_err,
+ "zPCI device could not be created: ");
+ return NULL;
+ }
return S390_PCI_DEVICE(dev);
}
@@ -865,9 +879,8 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
pbdev = s390_pci_find_dev_by_target(s, dev->id);
if (!pbdev) {
- pbdev = s390_pci_device_new(s, dev->id);
+ pbdev = s390_pci_device_new(s, dev->id, errp);
if (!pbdev) {
- error_setg(errp, "create zpci device failed");
return;
}
}
diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c
index 58fc7b1188..ae744d1642 100644
--- a/hw/timer/stm32f2xx_timer.c
+++ b/hw/timer/stm32f2xx_timer.c
@@ -308,7 +308,7 @@ static void stm32f2xx_timer_init(Object *obj)
sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
memory_region_init_io(&s->iomem, obj, &stm32f2xx_timer_ops, s,
- "stm32f2xx_timer", 0x4000);
+ "stm32f2xx_timer", 0x400);
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, stm32f2xx_timer_interrupt, s);
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 12f5c9a759..d9322692ee 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -295,7 +295,7 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
if (s->cmd.selftest_done) {
for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
- s->loc[locty].sts |= TPM_TIS_STS_SELFTEST_DONE;
+ s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
}
}
diff --git a/include/io/channel-tls.h b/include/io/channel-tls.h
index 87fcaf9146..fdbdf12feb 100644
--- a/include/io/channel-tls.h
+++ b/include/io/channel-tls.h
@@ -48,6 +48,7 @@ struct QIOChannelTLS {
QIOChannel parent;
QIOChannel *master;
QCryptoTLSSession *session;
+ QIOChannelShutdown shutdown;
};
/**
diff --git a/include/io/channel.h b/include/io/channel.h
index e8cdadb0b0..da2f138200 100644
--- a/include/io/channel.h
+++ b/include/io/channel.h
@@ -51,9 +51,9 @@ enum QIOChannelFeature {
typedef enum QIOChannelShutdown QIOChannelShutdown;
enum QIOChannelShutdown {
- QIO_CHANNEL_SHUTDOWN_BOTH,
- QIO_CHANNEL_SHUTDOWN_READ,
- QIO_CHANNEL_SHUTDOWN_WRITE,
+ QIO_CHANNEL_SHUTDOWN_READ = 1,
+ QIO_CHANNEL_SHUTDOWN_WRITE = 2,
+ QIO_CHANNEL_SHUTDOWN_BOTH = 3,
};
typedef gboolean (*QIOChannelFunc)(QIOChannel *ioc,
diff --git a/io/channel-tls.c b/io/channel-tls.c
index 9628e6fa47..c98ead21b0 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -275,6 +275,9 @@ static ssize_t qio_channel_tls_readv(QIOChannel *ioc,
} else {
return QIO_CHANNEL_ERR_BLOCK;
}
+ } else if (errno == ECONNABORTED &&
+ (tioc->shutdown & QIO_CHANNEL_SHUTDOWN_READ)) {
+ return 0;
}
error_setg_errno(errp, errno,
@@ -357,6 +360,8 @@ static int qio_channel_tls_shutdown(QIOChannel *ioc,
{
QIOChannelTLS *tioc = QIO_CHANNEL_TLS(ioc);
+ tioc->shutdown |= how;
+
return qio_channel_shutdown(tioc->master, how, errp);
}
diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c
index 295e415b1e..ead169fbaa 100644
--- a/linux-user/sparc/signal.c
+++ b/linux-user/sparc/signal.c
@@ -282,7 +282,7 @@ long do_sigreturn(CPUSPARCState *env)
uint32_t up_psr, pc, npc;
target_sigset_t set;
sigset_t host_set;
- int err=0, i;
+ int i;
sf_addr = env->regwptr[UREG_FP];
trace_user_do_sigreturn(env, sf_addr);
@@ -320,10 +320,13 @@ long do_sigreturn(CPUSPARCState *env)
}
/* FIXME: implement FPU save/restore:
- * __get_user(fpu_save, &sf->fpu_save);
- * if (fpu_save)
- * err |= restore_fpu_state(env, fpu_save);
- */
+ * __get_user(fpu_save, &sf->fpu_save);
+ * if (fpu_save) {
+ * if (restore_fpu_state(env, fpu_save)) {
+ * goto segv_and_exit;
+ * }
+ * }
+ */
/* This is pretty much atomic, no amount locking would prevent
* the races which exist anyways.
@@ -336,9 +339,6 @@ long do_sigreturn(CPUSPARCState *env)
target_to_host_sigset_internal(&host_set, &set);
set_sigmask(&host_set);
- if (err) {
- goto segv_and_exit;
- }
unlock_user_struct(sf, sf_addr, 0);
return -TARGET_QEMU_ESIGRETURN;
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5c166928a4..280137da8c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9554,9 +9554,25 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
{
CPUMIPSState *env = ((CPUMIPSState *)cpu_env);
bool old_fr = env->CP0_Status & (1 << CP0St_FR);
+ bool old_fre = env->CP0_Config5 & (1 << CP0C5_FRE);
bool new_fr = arg2 & TARGET_PR_FP_MODE_FR;
bool new_fre = arg2 & TARGET_PR_FP_MODE_FRE;
+ const unsigned int known_bits = TARGET_PR_FP_MODE_FR |
+ TARGET_PR_FP_MODE_FRE;
+
+ /* If nothing to change, return right away, successfully. */
+ if (old_fr == new_fr && old_fre == new_fre) {
+ return 0;
+ }
+ /* Check the value is valid */
+ if (arg2 & ~known_bits) {
+ return -TARGET_EOPNOTSUPP;
+ }
+ /* Setting FRE without FR is not supported. */
+ if (new_fre && !new_fr) {
+ return -TARGET_EOPNOTSUPP;
+ }
if (new_fr && !(env->active_fpu.fcr0 & (1 << FCR0_F64))) {
/* FR1 is not supported */
return -TARGET_EOPNOTSUPP;
@@ -9586,6 +9602,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
env->hflags |= MIPS_HFLAG_F64;
} else {
env->CP0_Status &= ~(1 << CP0St_FR);
+ env->hflags &= ~MIPS_HFLAG_F64;
}
if (new_fre) {
env->CP0_Config5 |= (1 << CP0C5_FRE);
@@ -9594,6 +9611,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
}
} else {
env->CP0_Config5 &= ~(1 << CP0C5_FRE);
+ env->hflags &= ~MIPS_HFLAG_FRE;
}
return 0;
diff --git a/nbd/server.c b/nbd/server.c
index 4e8f5ae51b..dc04513de7 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1134,12 +1134,16 @@ static int nbd_negotiate_options(NBDClient *client, uint16_t myflags,
return -EINVAL;
default:
- ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD, errp,
- "Option 0x%" PRIx32
- "not permitted before TLS", option);
/* Let the client keep trying, unless they asked to
- * quit. In this mode, we've already sent an error, so
- * we can't ack the abort. */
+ * quit. Always try to give an error back to the
+ * client; but when replying to OPT_ABORT, be aware
+ * that the client may hang up before receiving the
+ * error, in which case we are fine ignoring the
+ * resulting EPIPE. */
+ ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD,
+ option == NBD_OPT_ABORT ? NULL : errp,
+ "Option 0x%" PRIx32
+ " not permitted before TLS", option);
if (option == NBD_OPT_ABORT) {
return 1;
}
diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index bb8f4d93b1..2e26839bc2 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -155,12 +155,13 @@ static int handle_primary_tcp_pkt(RewriterState *rf,
* Active close step 2.
*/
if (conn->tcp_state == TCPS_FIN_WAIT_1) {
- conn->tcp_state = TCPS_TIME_WAIT;
/*
* For simplify implementation, we needn't wait 2MSL time
* in filter rewriter. Because guest kernel will track the
* TCP status and wait 2MSL time, if client resend the FIN
* packet, guest will apply the last ACK too.
+ * So, we skip the TCPS_TIME_WAIT state here and go straight
+ * to TCPS_CLOSED state.
*/
conn->tcp_state = TCPS_CLOSED;
g_hash_table_remove(rf->connection_track_table, key);
diff --git a/qapi/ui.json b/qapi/ui.json
index bf9e157d5a..e0000248d3 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1037,6 +1037,20 @@
'data' : { '*grab-on-hover' : 'bool',
'*zoom-to-fit' : 'bool' } }
+##
+# @DisplayEGLHeadless:
+#
+# EGL headless display options.
+#
+# @rendernode: Which DRM render node should be used. Default is the first
+# available node on the host.
+#
+# Since: 3.1
+#
+##
+{ 'struct' : 'DisplayEGLHeadless',
+ 'data' : { '*rendernode' : 'str' } }
+
##
# @DisplayGLMode:
#
@@ -1086,4 +1100,5 @@
'*window-close' : 'bool',
'*gl' : 'DisplayGLMode' },
'discriminator' : 'type',
- 'data' : { 'gtk' : 'DisplayGTK' } }
+ 'data' : { 'gtk' : 'DisplayGTK',
+ 'egl-headless' : 'DisplayEGLHeadless'} }
diff --git a/qemu-options.hx b/qemu-options.hx
index ee379b32e3..f7df472f43 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1216,7 +1216,8 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
"-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n"
"-display vnc=<display>[,<optargs>]\n"
"-display curses\n"
- "-display none"
+ "-display none\n"
+ "-display egl-headless[,rendernode=<file>]"
" select display type\n"
"The default display is equivalent to\n"
#if defined(CONFIG_GTK)
@@ -1258,6 +1259,9 @@ menus and other UI elements to configure and control the VM during
runtime.
@item vnc
Start a VNC server on display <arg>
+@item egl-headless
+Offload all OpenGL operations to a local DRI device. For any graphical display,
+this display needs to be paired with either VNC or SPICE displays.
@end table
ETEXI
diff --git a/scripts/coccinelle/tcg_gen_extract.cocci b/scripts/coccinelle/tcg_gen_extract.cocci
index 81e66a35ae..c10c863482 100644
--- a/scripts/coccinelle/tcg_gen_extract.cocci
+++ b/scripts/coccinelle/tcg_gen_extract.cocci
@@ -17,7 +17,7 @@
// --keep-comments --in-place \
// --use-gitgrep --dir target
//
-// $ docker run --rm -v `pwd`:`pwd` -w `pwd` philmd/coccinelle \
+// $ docker run --rm -v $PWD:$PWD -w $PWD philmd/coccinelle \
// --macro-file scripts/cocci-macro-file.h \
// --sp-file scripts/coccinelle/tcg_gen_extract.cocci \
// --keep-comments --in-place \
diff --git a/scripts/make-release b/scripts/make-release
index 04fa9defdc..c14f75b12c 100755
--- a/scripts/make-release
+++ b/scripts/make-release
@@ -19,6 +19,7 @@ pushd ${destination}
git checkout "v${version}"
git submodule update --init
(cd roms/seabios && git describe --tags --long --dirty > .version)
+(cd roms/skiboot && ./make_version.sh > .version)
# FIXME: The following line is a workaround for avoiding filename collisions
# when unpacking u-boot sources on case-insensitive filesystems. Once we
# update to something with u-boot commit 610eec7f0 we can drop this line.
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 09a86e2820..44dd0ce6ce 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -158,6 +158,7 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
cpu->kvm_target = arm_host_cpu_features.target;
cpu->dtb_compatible = arm_host_cpu_features.dtb_compatible;
+ cpu->isar = arm_host_cpu_features.isar;
env->features = arm_host_cpu_features.features;
}
diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c
index cb3fb73a96..bd51eb43c8 100644
--- a/target/arm/kvm32.c
+++ b/target/arm/kvm32.c
@@ -28,6 +28,14 @@ static inline void set_feature(uint64_t *features, int feature)
*features |= 1ULL << feature;
}
+static int read_sys_reg32(int fd, uint32_t *pret, uint64_t id)
+{
+ struct kvm_one_reg idreg = { .id = id, .addr = (uintptr_t)pret };
+
+ assert((id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32);
+ return ioctl(fd, KVM_GET_ONE_REG, &idreg);
+}
+
bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
{
/* Identify the feature bits corresponding to the host CPU, and
@@ -35,9 +43,10 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
* we have to create a scratch VM, create a single CPU inside it,
* and then query that CPU for the relevant ID registers.
*/
- int i, ret, fdarray[3];
- uint32_t midr, id_pfr0, mvfr1;
+ int err = 0, fdarray[3];
+ uint32_t midr, id_pfr0;
uint64_t features = 0;
+
/* Old kernels may not know about the PREFERRED_TARGET ioctl: however
* we know these will only support creating one kind of guest CPU,
* which is its preferred CPU type.
@@ -47,23 +56,6 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
QEMU_KVM_ARM_TARGET_NONE
};
struct kvm_vcpu_init init;
- struct kvm_one_reg idregs[] = {
- {
- .id = KVM_REG_ARM | KVM_REG_SIZE_U32
- | ENCODE_CP_REG(15, 0, 0, 0, 0, 0, 0),
- .addr = (uintptr_t)&midr,
- },
- {
- .id = KVM_REG_ARM | KVM_REG_SIZE_U32
- | ENCODE_CP_REG(15, 0, 0, 0, 1, 0, 0),
- .addr = (uintptr_t)&id_pfr0,
- },
- {
- .id = KVM_REG_ARM | KVM_REG_SIZE_U32
- | KVM_REG_ARM_VFP | KVM_REG_ARM_VFP_MVFR1,
- .addr = (uintptr_t)&mvfr1,
- },
- };
if (!kvm_arm_create_scratch_host_vcpu(cpus_to_try, fdarray, &init)) {
return false;
@@ -77,16 +69,45 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
*/
ahcf->dtb_compatible = "arm,arm-v7";
- for (i = 0; i < ARRAY_SIZE(idregs); i++) {
- ret = ioctl(fdarray[2], KVM_GET_ONE_REG, &idregs[i]);
- if (ret) {
- break;
- }
- }
+ err |= read_sys_reg32(fdarray[2], &midr, ARM_CP15_REG32(0, 0, 0, 0));
+ err |= read_sys_reg32(fdarray[2], &id_pfr0, ARM_CP15_REG32(0, 0, 1, 0));
+
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar0,
+ ARM_CP15_REG32(0, 0, 2, 0));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar1,
+ ARM_CP15_REG32(0, 0, 2, 1));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar2,
+ ARM_CP15_REG32(0, 0, 2, 2));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar3,
+ ARM_CP15_REG32(0, 0, 2, 3));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar4,
+ ARM_CP15_REG32(0, 0, 2, 4));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar5,
+ ARM_CP15_REG32(0, 0, 2, 5));
+ if (read_sys_reg32(fdarray[2], &ahcf->isar.id_isar6,
+ ARM_CP15_REG32(0, 0, 2, 7))) {
+ /*
+ * Older kernels don't support reading ID_ISAR6. This register was
+ * only introduced in ARMv8, so we can assume that it is zero on a
+ * CPU that a kernel this old is running on.
+ */
+ ahcf->isar.id_isar6 = 0;
+ }
+
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr0,
+ KVM_REG_ARM | KVM_REG_SIZE_U32 |
+ KVM_REG_ARM_VFP | KVM_REG_ARM_VFP_MVFR0);
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr1,
+ KVM_REG_ARM | KVM_REG_SIZE_U32 |
+ KVM_REG_ARM_VFP | KVM_REG_ARM_VFP_MVFR1);
+ /*
+ * FIXME: There is not yet a way to read MVFR2.
+ * Fortunately there is not yet anything in there that affects migration.
+ */
kvm_arm_destroy_scratch_host_vcpu(fdarray);
- if (ret) {
+ if (err < 0) {
return false;
}
@@ -104,13 +125,13 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
if (extract32(id_pfr0, 12, 4) == 1) {
set_feature(&features, ARM_FEATURE_THUMB2EE);
}
- if (extract32(mvfr1, 20, 4) == 1) {
+ if (extract32(ahcf->isar.mvfr1, 20, 4) == 1) {
set_feature(&features, ARM_FEATURE_VFP_FP16);
}
- if (extract32(mvfr1, 12, 4) == 1) {
+ if (extract32(ahcf->isar.mvfr1, 12, 4) == 1) {
set_feature(&features, ARM_FEATURE_NEON);
}
- if (extract32(mvfr1, 28, 4) == 1) {
+ if (extract32(ahcf->isar.mvfr1, 28, 4) == 1) {
/* FMAC support implies VFPv4 */
set_feature(&features, ARM_FEATURE_VFP4);
}
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 46fbe6d8ff..0a502091e7 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -456,17 +456,40 @@ static inline void unset_feature(uint64_t *features, int feature)
*features &= ~(1ULL << feature);
}
+static int read_sys_reg32(int fd, uint32_t *pret, uint64_t id)
+{
+ uint64_t ret;
+ struct kvm_one_reg idreg = { .id = id, .addr = (uintptr_t)&ret };
+ int err;
+
+ assert((id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64);
+ err = ioctl(fd, KVM_GET_ONE_REG, &idreg);
+ if (err < 0) {
+ return -1;
+ }
+ *pret = ret;
+ return 0;
+}
+
+static int read_sys_reg64(int fd, uint64_t *pret, uint64_t id)
+{
+ struct kvm_one_reg idreg = { .id = id, .addr = (uintptr_t)pret };
+
+ assert((id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64);
+ return ioctl(fd, KVM_GET_ONE_REG, &idreg);
+}
+
bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
{
/* Identify the feature bits corresponding to the host CPU, and
* fill out the ARMHostCPUClass fields accordingly. To do this
* we have to create a scratch VM, create a single CPU inside it,
* and then query that CPU for the relevant ID registers.
- * For AArch64 we currently don't care about ID registers at
- * all; we just want to know the CPU type.
*/
int fdarray[3];
uint64_t features = 0;
+ int err;
+
/* Old kernels may not know about the PREFERRED_TARGET ioctl: however
* we know these will only support creating one kind of guest CPU,
* which is its preferred CPU type. Fortunately these old kernels
@@ -487,8 +510,71 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
ahcf->target = init.target;
ahcf->dtb_compatible = "arm,arm-v8";
+ err = read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64pfr0,
+ ARM64_SYS_REG(3, 0, 0, 4, 0));
+ if (unlikely(err < 0)) {
+ /*
+ * Before v4.15, the kernel only exposed a limited number of system
+ * registers, not including any of the interesting AArch64 ID regs.
+ * For the most part we could leave these fields as zero with minimal
+ * effect, since this does not affect the values seen by the guest.
+ *
+ * However, it could cause problems down the line for QEMU,
+ * so provide a minimal v8.0 default.
+ *
+ * ??? Could read MIDR and use knowledge from cpu64.c.
+ * ??? Could map a page of memory into our temp guest and
+ * run the tiniest of hand-crafted kernels to extract
+ * the values seen by the guest.
+ * ??? Either of these sounds like too much effort just
+ * to work around running a modern host kernel.
+ */
+ ahcf->isar.id_aa64pfr0 = 0x00000011; /* EL1&0, AArch64 only */
+ err = 0;
+ } else {
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64pfr1,
+ ARM64_SYS_REG(3, 0, 0, 4, 1));
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64isar0,
+ ARM64_SYS_REG(3, 0, 0, 6, 0));
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64isar1,
+ ARM64_SYS_REG(3, 0, 0, 6, 1));
+
+ /*
+ * Note that if AArch32 support is not present in the host,
+ * the AArch32 sysregs are present to be read, but will
+ * return UNKNOWN values. This is neither better nor worse
+ * than skipping the reads and leaving 0, as we must avoid
+ * considering the values in every case.
+ */
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar0,
+ ARM64_SYS_REG(3, 0, 0, 2, 0));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar1,
+ ARM64_SYS_REG(3, 0, 0, 2, 1));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar2,
+ ARM64_SYS_REG(3, 0, 0, 2, 2));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar3,
+ ARM64_SYS_REG(3, 0, 0, 2, 3));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar4,
+ ARM64_SYS_REG(3, 0, 0, 2, 4));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar5,
+ ARM64_SYS_REG(3, 0, 0, 2, 5));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_isar6,
+ ARM64_SYS_REG(3, 0, 0, 2, 7));
+
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr0,
+ ARM64_SYS_REG(3, 0, 0, 3, 0));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr1,
+ ARM64_SYS_REG(3, 0, 0, 3, 1));
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr2,
+ ARM64_SYS_REG(3, 0, 0, 3, 2));
+ }
+
kvm_arm_destroy_scratch_host_vcpu(fdarray);
+ if (err < 0) {
+ return false;
+ }
+
/* We can assume any KVM supporting CPU is at least a v8
* with VFPv4+Neon; this in turn implies most of the other
* feature bits.
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 21c0129da2..6393455b1d 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -183,6 +183,7 @@ void kvm_arm_destroy_scratch_host_vcpu(int *fdarray);
* by asking the host kernel)
*/
typedef struct ARMHostCPUFeatures {
+ ARMISARegisters isar;
uint64_t features;
uint32_t target;
const char *dtb_compatible;
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
index eb6fb82fb8..0d6e89e474 100644
--- a/target/arm/op_helper.c
+++ b/target/arm/op_helper.c
@@ -939,7 +939,38 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)
ARMCPU *cpu = arm_env_get_cpu(env);
int cur_el = arm_current_el(env);
bool secure = arm_is_secure(env);
- bool smd = env->cp15.scr_el3 & SCR_SMD;
+ bool smd_flag = env->cp15.scr_el3 & SCR_SMD;
+
+ /*
+ * SMC behaviour is summarized in the following table.
+ * This helper handles the "Trap to EL2" and "Undef insn" cases.
+ * The "Trap to EL3" and "PSCI call" cases are handled in the exception
+ * helper.
+ *
+ * -> ARM_FEATURE_EL3 and !SMD
+ * HCR_TSC && NS EL1 !HCR_TSC || !NS EL1
+ *
+ * Conduit SMC, valid call Trap to EL2 PSCI Call
+ * Conduit SMC, inval call Trap to EL2 Trap to EL3
+ * Conduit not SMC Trap to EL2 Trap to EL3
+ *
+ *
+ * -> ARM_FEATURE_EL3 and SMD
+ * HCR_TSC && NS EL1 !HCR_TSC || !NS EL1
+ *
+ * Conduit SMC, valid call Trap to EL2 PSCI Call
+ * Conduit SMC, inval call Trap to EL2 Undef insn
+ * Conduit not SMC Trap to EL2 Undef insn
+ *
+ *
+ * -> !ARM_FEATURE_EL3
+ * HCR_TSC && NS EL1 !HCR_TSC || !NS EL1
+ *
+ * Conduit SMC, valid call Trap to EL2 PSCI Call
+ * Conduit SMC, inval call Trap to EL2 Undef insn
+ * Conduit not SMC Undef insn Undef insn
+ */
+
/* On ARMv8 with EL3 AArch64, SMD applies to both S and NS state.
* On ARMv8 with EL3 AArch32, or ARMv7 with the Virtualization
* extensions, SMD only applies to NS state.
@@ -947,7 +978,8 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)
* doesn't exist, but we forbid the guest to set it to 1 in scr_write(),
* so we need not special case this here.
*/
- bool undef = arm_feature(env, ARM_FEATURE_AARCH64) ? smd : smd && !secure;
+ bool smd = arm_feature(env, ARM_FEATURE_AARCH64) ? smd_flag
+ : smd_flag && !secure;
if (!arm_feature(env, ARM_FEATURE_EL3) &&
cpu->psci_conduit != QEMU_PSCI_CONDUIT_SMC) {
@@ -957,21 +989,27 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)
* to forbid its EL1 from making PSCI calls into QEMU's
* "firmware" via HCR.TSC, so for these purposes treat
* PSCI-via-SMC as implying an EL3.
+ * This handles the very last line of the previous table.
*/
- undef = true;
- } else if (!secure && cur_el == 1 && (env->cp15.hcr_el2 & HCR_TSC)) {
+ raise_exception(env, EXCP_UDEF, syn_uncategorized(),
+ exception_target_el(env));
+ }
+
+ if (!secure && cur_el == 1 && (env->cp15.hcr_el2 & HCR_TSC)) {
/* In NS EL1, HCR controlled routing to EL2 has priority over SMD.
* We also want an EL2 guest to be able to forbid its EL1 from
* making PSCI calls into QEMU's "firmware" via HCR.TSC.
+ * This handles all the "Trap to EL2" cases of the previous table.
*/
raise_exception(env, EXCP_HYP_TRAP, syndrome, 2);
}
- /* If PSCI is enabled and this looks like a valid PSCI call then
- * suppress the UNDEF -- we'll catch the SMC exception and
- * implement the PSCI call behaviour there.
+ /* Catch the two remaining "Undef insn" cases of the previous table:
+ * - PSCI conduit is SMC but we don't have a valid PCSI call,
+ * - We don't have EL3 or SMD is set.
*/
- if (undef && !arm_is_psci_call(cpu, EXCP_SMC)) {
+ if (!arm_is_psci_call(cpu, EXCP_SMC) &&
+ (smd || !arm_feature(env, ARM_FEATURE_EL3))) {
raise_exception(env, EXCP_UDEF, syn_uncategorized(),
exception_target_el(env));
}
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 60320cbe69..e9c23a594b 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -2138,10 +2138,10 @@ enum {
* MTSAH rs, immediate Move Halfword Count to Shift Amount Register
* PROT3W rd, rt Parallel Rotate 3 Words
*
- * The TX79-specific Multimedia Instruction encodings
- * ==================================================
+ * MMI (MultiMedia Instruction) encodings
+ * ======================================
*
- * TX79 Multimedia Instruction encoding table keys:
+ * MMI instructions encoding table keys:
*
* * This code is reserved for future use. An attempt to execute it
* causes a Reserved Instruction exception.
@@ -2152,7 +2152,7 @@ enum {
* DMULTU, DDIV, DDIVU, LL, LLD, SC, SCD, LWC2 and SWC2. An attempt
* to execute it causes a Reserved Instruction exception.
*
- * TX79 Multimedia Instructions encoded by opcode field (MMI, LQ, SQ):
+ * MMI instructions encoded by opcode field (MMI, LQ, SQ):
*
* 31 26 0
* +--------+----------------------------------------+
@@ -2174,13 +2174,13 @@ enum {
*/
enum {
- TX79_CLASS_MMI = 0x1C << 26, /* Same as OPC_SPECIAL2 */
- TX79_LQ = 0x1E << 26, /* Same as OPC_MSA */
- TX79_SQ = 0x1F << 26, /* Same as OPC_SPECIAL3 */
+ MMI_OPC_CLASS_MMI = 0x1C << 26, /* Same as OPC_SPECIAL2 */
+ MMI_OPC_LQ = 0x1E << 26, /* Same as OPC_MSA */
+ MMI_OPC_SQ = 0x1F << 26, /* Same as OPC_SPECIAL3 */
};
/*
- * TX79 Multimedia Instructions with opcode field = MMI:
+ * MMI instructions with opcode field = MMI:
*
* 31 26 5 0
* +--------+-------------------------------+--------+
@@ -2201,37 +2201,37 @@ enum {
* 7 111 | * | * | * | * | PSLLW | * | PSRLW | PSRAW
*/
-#define MASK_TX79_MMI(op) (MASK_OP_MAJOR(op) | ((op) & 0x3F))
+#define MASK_MMI(op) (MASK_OP_MAJOR(op) | ((op) & 0x3F))
enum {
- TX79_MMI_MADD = 0x00 | TX79_CLASS_MMI, /* Same as OPC_MADD */
- TX79_MMI_MADDU = 0x01 | TX79_CLASS_MMI, /* Same as OPC_MADDU */
- TX79_MMI_PLZCW = 0x04 | TX79_CLASS_MMI,
- TX79_MMI_CLASS_MMI0 = 0x08 | TX79_CLASS_MMI,
- TX79_MMI_CLASS_MMI2 = 0x09 | TX79_CLASS_MMI,
- TX79_MMI_MFHI1 = 0x10 | TX79_CLASS_MMI, /* Same minor as OPC_MFHI */
- TX79_MMI_MTHI1 = 0x11 | TX79_CLASS_MMI, /* Same minor as OPC_MTHI */
- TX79_MMI_MFLO1 = 0x12 | TX79_CLASS_MMI, /* Same minor as OPC_MFLO */
- TX79_MMI_MTLO1 = 0x13 | TX79_CLASS_MMI, /* Same minor as OPC_MTLO */
- TX79_MMI_MULT1 = 0x18 | TX79_CLASS_MMI, /* Same minor as OPC_MULT */
- TX79_MMI_MULTU1 = 0x19 | TX79_CLASS_MMI, /* Same minor as OPC_MULTU */
- TX79_MMI_DIV1 = 0x1A | TX79_CLASS_MMI, /* Same minor as OPC_DIV */
- TX79_MMI_DIVU1 = 0x1B | TX79_CLASS_MMI, /* Same minor as OPC_DIVU */
- TX79_MMI_MADD1 = 0x20 | TX79_CLASS_MMI,
- TX79_MMI_MADDU1 = 0x21 | TX79_CLASS_MMI,
- TX79_MMI_CLASS_MMI1 = 0x28 | TX79_CLASS_MMI,
- TX79_MMI_CLASS_MMI3 = 0x29 | TX79_CLASS_MMI,
- TX79_MMI_PMFHL = 0x30 | TX79_CLASS_MMI,
- TX79_MMI_PMTHL = 0x31 | TX79_CLASS_MMI,
- TX79_MMI_PSLLH = 0x34 | TX79_CLASS_MMI,
- TX79_MMI_PSRLH = 0x36 | TX79_CLASS_MMI,
- TX79_MMI_PSRAH = 0x37 | TX79_CLASS_MMI,
- TX79_MMI_PSLLW = 0x3C | TX79_CLASS_MMI,
- TX79_MMI_PSRLW = 0x3E | TX79_CLASS_MMI,
- TX79_MMI_PSRAW = 0x3F | TX79_CLASS_MMI,
+ MMI_OPC_MADD = 0x00 | MMI_OPC_CLASS_MMI, /* Same as OPC_MADD */
+ MMI_OPC_MADDU = 0x01 | MMI_OPC_CLASS_MMI, /* Same as OPC_MADDU */
+ MMI_OPC_PLZCW = 0x04 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_CLASS_MMI0 = 0x08 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_CLASS_MMI2 = 0x09 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_MFHI1 = 0x10 | MMI_OPC_CLASS_MMI, /* Same minor as OPC_MFHI */
+ MMI_OPC_MTHI1 = 0x11 | MMI_OPC_CLASS_MMI, /* Same minor as OPC_MTHI */
+ MMI_OPC_MFLO1 = 0x12 | MMI_OPC_CLASS_MMI, /* Same minor as OPC_MFLO */
+ MMI_OPC_MTLO1 = 0x13 | MMI_OPC_CLASS_MMI, /* Same minor as OPC_MTLO */
+ MMI_OPC_MULT1 = 0x18 | MMI_OPC_CLASS_MMI, /* Same minor as OPC_MULT */
+ MMI_OPC_MULTU1 = 0x19 | MMI_OPC_CLASS_MMI, /* Same min. as OPC_MULTU */
+ MMI_OPC_DIV1 = 0x1A | MMI_OPC_CLASS_MMI, /* Same minor as OPC_DIV */
+ MMI_OPC_DIVU1 = 0x1B | MMI_OPC_CLASS_MMI, /* Same minor as OPC_DIVU */
+ MMI_OPC_MADD1 = 0x20 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_MADDU1 = 0x21 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_CLASS_MMI1 = 0x28 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_CLASS_MMI3 = 0x29 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PMFHL = 0x30 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PMTHL = 0x31 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PSLLH = 0x34 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PSRLH = 0x36 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PSRAH = 0x37 | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PSLLW = 0x3C | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PSRLW = 0x3E | MMI_OPC_CLASS_MMI,
+ MMI_OPC_PSRAW = 0x3F | MMI_OPC_CLASS_MMI,
};
/*
- * TX79 Multimedia Instructions with opcode field = MMI and bits 5..0 = MMI0:
+ * MMI instructions with opcode field = MMI and bits 5..0 = MMI0:
*
* 31 26 10 6 5 0
* +--------+----------------------+--------+--------+
@@ -2252,37 +2252,37 @@ enum {
* 7 111 | * | * | PEXT5 | PPAC5
*/
-#define MASK_TX79_MMI0(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
+#define MASK_MMI0(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
enum {
- TX79_MMI0_PADDW = (0x00 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PSUBW = (0x01 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PCGTW = (0x02 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PMAXW = (0x03 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PADDH = (0x04 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PSUBH = (0x05 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PCGTH = (0x06 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PMAXH = (0x07 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PADDB = (0x08 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PSUBB = (0x09 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PCGTB = (0x0A << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PADDSW = (0x10 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PSUBSW = (0x11 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PEXTLW = (0x12 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PPACW = (0x13 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PADDSH = (0x14 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PSUBSH = (0x15 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PEXTLH = (0x16 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PPACH = (0x17 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PADDSB = (0x18 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PSUBSB = (0x19 << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PEXTLB = (0x1A << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PPACB = (0x1B << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PEXT5 = (0x1E << 6) | TX79_MMI_CLASS_MMI0,
- TX79_MMI0_PPAC5 = (0x1F << 6) | TX79_MMI_CLASS_MMI0,
+ MMI_OPC_0_PADDW = (0x00 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PSUBW = (0x01 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PCGTW = (0x02 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PMAXW = (0x03 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PADDH = (0x04 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PSUBH = (0x05 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PCGTH = (0x06 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PMAXH = (0x07 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PADDB = (0x08 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PSUBB = (0x09 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PCGTB = (0x0A << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PADDSW = (0x10 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PSUBSW = (0x11 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PEXTLW = (0x12 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PPACW = (0x13 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PADDSH = (0x14 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PSUBSH = (0x15 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PEXTLH = (0x16 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PPACH = (0x17 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PADDSB = (0x18 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PSUBSB = (0x19 << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PEXTLB = (0x1A << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PPACB = (0x1B << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PEXT5 = (0x1E << 6) | MMI_OPC_CLASS_MMI0,
+ MMI_OPC_0_PPAC5 = (0x1F << 6) | MMI_OPC_CLASS_MMI0,
};
/*
- * TX79 Multimedia Instructions with opcode field = MMI and bits 5..0 = MMI1:
+ * MMI instructions with opcode field = MMI and bits 5..0 = MMI1:
*
* 31 26 10 6 5 0
* +--------+----------------------+--------+--------+
@@ -2303,30 +2303,30 @@ enum {
* 7 111 | * | * | * | *
*/
-#define MASK_TX79_MMI1(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
+#define MASK_MMI1(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
enum {
- TX79_MMI1_PABSW = (0x01 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PCEQW = (0x02 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PMINW = (0x03 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PADSBH = (0x04 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PABSH = (0x05 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PCEQH = (0x06 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PMINH = (0x07 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PCEQB = (0x0A << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PADDUW = (0x10 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PSUBUW = (0x11 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PEXTUW = (0x12 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PADDUH = (0x14 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PSUBUH = (0x15 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PEXTUH = (0x16 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PADDUB = (0x18 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PSUBUB = (0x19 << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_PEXTUB = (0x1A << 6) | TX79_MMI_CLASS_MMI1,
- TX79_MMI1_QFSRV = (0x1B << 6) | TX79_MMI_CLASS_MMI1,
+ MMI_OPC_1_PABSW = (0x01 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PCEQW = (0x02 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PMINW = (0x03 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PADSBH = (0x04 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PABSH = (0x05 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PCEQH = (0x06 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PMINH = (0x07 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PCEQB = (0x0A << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PADDUW = (0x10 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PSUBUW = (0x11 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PEXTUW = (0x12 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PADDUH = (0x14 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PSUBUH = (0x15 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PEXTUH = (0x16 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PADDUB = (0x18 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PSUBUB = (0x19 << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_PEXTUB = (0x1A << 6) | MMI_OPC_CLASS_MMI1,
+ MMI_OPC_1_QFSRV = (0x1B << 6) | MMI_OPC_CLASS_MMI1,
};
/*
- * TX79 Multimedia Instructions with opcode field = MMI and bits 5..0 = MMI2:
+ * MMI instructions with opcode field = MMI and bits 5..0 = MMI2:
*
* 31 26 10 6 5 0
* +--------+----------------------+--------+--------+
@@ -2347,34 +2347,34 @@ enum {
* 7 111 | PMULTH| PDIVBW| PEXEW | PROT3W
*/
-#define MASK_TX79_MMI2(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
+#define MASK_MMI2(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
enum {
- TX79_MMI2_PMADDW = (0x00 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PSLLVW = (0x02 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PSRLVW = (0x03 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PMSUBW = (0x04 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PMFHI = (0x08 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PMFLO = (0x09 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PINTH = (0x0A << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PMULTW = (0x0C << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PDIVW = (0x0D << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PCPYLD = (0x0E << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PMADDH = (0x10 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PHMADH = (0x11 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PAND = (0x12 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PXOR = (0x13 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PMSUBH = (0x14 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PHMSBH = (0x15 << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PEXEH = (0x1A << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PREVH = (0x1B << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PMULTH = (0x1C << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PDIVBW = (0x1D << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PEXEW = (0x1E << 6) | TX79_MMI_CLASS_MMI2,
- TX79_MMI2_PROT3W = (0x1F << 6) | TX79_MMI_CLASS_MMI2,
+ MMI_OPC_2_PMADDW = (0x00 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PSLLVW = (0x02 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PSRLVW = (0x03 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PMSUBW = (0x04 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PMFHI = (0x08 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PMFLO = (0x09 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PINTH = (0x0A << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PMULTW = (0x0C << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PDIVW = (0x0D << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PCPYLD = (0x0E << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PMADDH = (0x10 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PHMADH = (0x11 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PAND = (0x12 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PXOR = (0x13 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PMSUBH = (0x14 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PHMSBH = (0x15 << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PEXEH = (0x1A << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PREVH = (0x1B << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PMULTH = (0x1C << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PDIVBW = (0x1D << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PEXEW = (0x1E << 6) | MMI_OPC_CLASS_MMI2,
+ MMI_OPC_2_PROT3W = (0x1F << 6) | MMI_OPC_CLASS_MMI2,
};
/*
- * TX79 Multimedia Instructions with opcode field = MMI and bits 5..0 = MMI3:
+ * MMI instructions with opcode field = MMI and bits 5..0 = MMI3:
*
* 31 26 10 6 5 0
* +--------+----------------------+--------+--------+
@@ -2395,21 +2395,21 @@ enum {
* 7 111 | * | * | PEXCW | *
*/
-#define MASK_TX79_MMI3(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
+#define MASK_MMI3(op) (MASK_OP_MAJOR(op) | ((op) & 0x7FF))
enum {
- TX79_MMI3_PMADDUW = (0x00 << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PSRAVW = (0x03 << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PMTHI = (0x08 << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PMTLO = (0x09 << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PINTEH = (0x0A << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PMULTUW = (0x0C << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PDIVUW = (0x0D << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PCPYUD = (0x0E << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_POR = (0x12 << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PNOR = (0x13 << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PEXCH = (0x1A << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PCPYH = (0x1B << 6) | TX79_MMI_CLASS_MMI3,
- TX79_MMI3_PEXCW = (0x1E << 6) | TX79_MMI_CLASS_MMI3,
+ MMI_OPC_3_PMADDUW = (0x00 << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PSRAVW = (0x03 << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PMTHI = (0x08 << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PMTLO = (0x09 << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PINTEH = (0x0A << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PMULTUW = (0x0C << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PDIVUW = (0x0D << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PCPYUD = (0x0E << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_POR = (0x12 << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PNOR = (0x13 << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PEXCH = (0x1A << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PCPYH = (0x1B << 6) | MMI_OPC_CLASS_MMI3,
+ MMI_OPC_3_PEXCW = (0x1E << 6) | MMI_OPC_CLASS_MMI3,
};
/* global register indices */
@@ -4359,24 +4359,56 @@ static void gen_shift(DisasContext *ctx, uint32_t opc,
tcg_temp_free(t1);
}
+/* Copy GPR to and from TX79 HI1/LO1 register. */
+static void gen_HILO1_tx79(DisasContext *ctx, uint32_t opc, int reg)
+{
+ if (reg == 0 && (opc == MMI_OPC_MFHI1 || opc == MMI_OPC_MFLO1)) {
+ /* Treat as NOP. */
+ return;
+ }
+
+ switch (opc) {
+ case MMI_OPC_MFHI1:
+ tcg_gen_mov_tl(cpu_gpr[reg], cpu_HI[1]);
+ break;
+ case MMI_OPC_MFLO1:
+ tcg_gen_mov_tl(cpu_gpr[reg], cpu_LO[1]);
+ break;
+ case MMI_OPC_MTHI1:
+ if (reg != 0) {
+ tcg_gen_mov_tl(cpu_HI[1], cpu_gpr[reg]);
+ } else {
+ tcg_gen_movi_tl(cpu_HI[1], 0);
+ }
+ break;
+ case MMI_OPC_MTLO1:
+ if (reg != 0) {
+ tcg_gen_mov_tl(cpu_LO[1], cpu_gpr[reg]);
+ } else {
+ tcg_gen_movi_tl(cpu_LO[1], 0);
+ }
+ break;
+ default:
+ MIPS_INVAL("mfthilo1 TX79");
+ generate_exception_end(ctx, EXCP_RI);
+ break;
+ }
+}
+
/* Arithmetic on HI/LO registers */
static void gen_HILO(DisasContext *ctx, uint32_t opc, int acc, int reg)
{
- if (reg == 0 && (opc == OPC_MFHI || opc == TX79_MMI_MFHI1 ||
- opc == OPC_MFLO || opc == TX79_MMI_MFLO1)) {
+ if (reg == 0 && (opc == OPC_MFHI || opc == OPC_MFLO)) {
/* Treat as NOP. */
return;
}
if (acc != 0) {
- if (!(ctx->insn_flags & INSN_R5900)) {
- check_dsp(ctx);
- }
+ check_dsp(ctx);
}
switch (opc) {
case OPC_MFHI:
- case TX79_MMI_MFHI1:
#if defined(TARGET_MIPS64)
if (acc != 0) {
tcg_gen_ext32s_tl(cpu_gpr[reg], cpu_HI[acc]);
@@ -4387,7 +4419,6 @@ static void gen_HILO(DisasContext *ctx, uint32_t opc, int acc, int reg)
}
break;
case OPC_MFLO:
- case TX79_MMI_MFLO1:
#if defined(TARGET_MIPS64)
if (acc != 0) {
tcg_gen_ext32s_tl(cpu_gpr[reg], cpu_LO[acc]);
@@ -4398,7 +4429,6 @@ static void gen_HILO(DisasContext *ctx, uint32_t opc, int acc, int reg)
}
break;
case OPC_MTHI:
- case TX79_MMI_MTHI1:
if (reg != 0) {
#if defined(TARGET_MIPS64)
if (acc != 0) {
@@ -4413,7 +4443,6 @@ static void gen_HILO(DisasContext *ctx, uint32_t opc, int acc, int reg)
}
break;
case OPC_MTLO:
- case TX79_MMI_MTLO1:
if (reg != 0) {
#if defined(TARGET_MIPS64)
if (acc != 0) {
@@ -4714,6 +4743,63 @@ static void gen_r6_muldiv(DisasContext *ctx, int opc, int rd, int rs, int rt)
tcg_temp_free(t1);
}
+static void gen_div1_tx79(DisasContext *ctx, uint32_t opc, int rs, int rt)
+{
+ TCGv t0, t1;
+
+ t0 = tcg_temp_new();
+ t1 = tcg_temp_new();
+
+ gen_load_gpr(t0, rs);
+ gen_load_gpr(t1, rt);
+
+ switch (opc) {
+ case MMI_OPC_DIV1:
+ {
+ TCGv t2 = tcg_temp_new();
+ TCGv t3 = tcg_temp_new();
+ tcg_gen_ext32s_tl(t0, t0);
+ tcg_gen_ext32s_tl(t1, t1);
+ tcg_gen_setcondi_tl(TCG_COND_EQ, t2, t0, INT_MIN);
+ tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, -1);
+ tcg_gen_and_tl(t2, t2, t3);
+ tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, 0);
+ tcg_gen_or_tl(t2, t2, t3);
+ tcg_gen_movi_tl(t3, 0);
+ tcg_gen_movcond_tl(TCG_COND_NE, t1, t2, t3, t2, t1);
+ tcg_gen_div_tl(cpu_LO[1], t0, t1);
+ tcg_gen_rem_tl(cpu_HI[1], t0, t1);
+ tcg_gen_ext32s_tl(cpu_LO[1], cpu_LO[1]);
+ tcg_gen_ext32s_tl(cpu_HI[1], cpu_HI[1]);
+ tcg_temp_free(t3);
+ tcg_temp_free(t2);
+ }
+ break;
+ case MMI_OPC_DIVU1:
+ {
+ TCGv t2 = tcg_const_tl(0);
+ TCGv t3 = tcg_const_tl(1);
+ tcg_gen_ext32u_tl(t0, t0);
+ tcg_gen_ext32u_tl(t1, t1);
+ tcg_gen_movcond_tl(TCG_COND_EQ, t1, t1, t2, t3, t1);
+ tcg_gen_divu_tl(cpu_LO[1], t0, t1);
+ tcg_gen_remu_tl(cpu_HI[1], t0, t1);
+ tcg_gen_ext32s_tl(cpu_LO[1], cpu_LO[1]);
+ tcg_gen_ext32s_tl(cpu_HI[1], cpu_HI[1]);
+ tcg_temp_free(t3);
+ tcg_temp_free(t2);
+ }
+ break;
+ default:
+ MIPS_INVAL("div1 TX79");
+ generate_exception_end(ctx, EXCP_RI);
+ goto out;
+ }
+ out:
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+}
+
static void gen_muldiv(DisasContext *ctx, uint32_t opc,
int acc, int rs, int rt)
{
@@ -4726,14 +4812,11 @@ static void gen_muldiv(DisasContext *ctx, uint32_t opc,
gen_load_gpr(t1, rt);
if (acc != 0) {
- if (!(ctx->insn_flags & INSN_R5900)) {
- check_dsp(ctx);
- }
+ check_dsp(ctx);
}
switch (opc) {
case OPC_DIV:
- case TX79_MMI_DIV1:
{
TCGv t2 = tcg_temp_new();
TCGv t3 = tcg_temp_new();
@@ -4755,7 +4838,6 @@ static void gen_muldiv(DisasContext *ctx, uint32_t opc,
}
break;
case OPC_DIVU:
- case TX79_MMI_DIVU1:
{
TCGv t2 = tcg_const_tl(0);
TCGv t3 = tcg_const_tl(1);
@@ -4939,7 +5021,7 @@ static void gen_mul_txx9(DisasContext *ctx, uint32_t opc,
gen_load_gpr(t1, rt);
switch (opc) {
- case TX79_MMI_MULT1:
+ case MMI_OPC_MULT1:
acc = 1;
/* Fall through */
case OPC_MULT:
@@ -4958,7 +5040,7 @@ static void gen_mul_txx9(DisasContext *ctx, uint32_t opc,
tcg_temp_free_i32(t3);
}
break;
- case TX79_MMI_MULTU1:
+ case MMI_OPC_MULTU1:
acc = 1;
/* Fall through */
case OPC_MULTU:
@@ -23781,6 +23863,53 @@ static void decode_opc_special_r6(CPUMIPSState *env, DisasContext *ctx)
}
}
+static void decode_opc_special_tx79(CPUMIPSState *env, DisasContext *ctx)
+{
+ int rs = extract32(ctx->opcode, 21, 5);
+ int rt = extract32(ctx->opcode, 16, 5);
+ int rd = extract32(ctx->opcode, 11, 5);
+ uint32_t op1 = MASK_SPECIAL(ctx->opcode);
+
+ switch (op1) {
+ case OPC_MOVN: /* Conditional move */
+ case OPC_MOVZ:
+ gen_cond_move(ctx, op1, rd, rs, rt);
+ break;
+ case OPC_MFHI: /* Move from HI/LO */
+ case OPC_MFLO:
+ gen_HILO(ctx, op1, 0, rd);
+ break;
+ case OPC_MTHI:
+ case OPC_MTLO: /* Move to HI/LO */
+ gen_HILO(ctx, op1, 0, rs);
+ break;
+ case OPC_MULT:
+ case OPC_MULTU:
+ gen_mul_txx9(ctx, op1, rd, rs, rt);
+ break;
+ case OPC_DIV:
+ case OPC_DIVU:
+ gen_muldiv(ctx, op1, 0, rs, rt);
+ break;
+#if defined(TARGET_MIPS64)
+ case OPC_DMULT:
+ case OPC_DMULTU:
+ case OPC_DDIV:
+ case OPC_DDIVU:
+ check_insn_opc_user_only(ctx, INSN_R5900);
+ gen_muldiv(ctx, op1, 0, rs, rt);
+ break;
+#endif
+ case OPC_JR:
+ gen_compute_branch(ctx, op1, 4, rs, 0, 0, 4);
+ break;
+ default: /* Invalid */
+ MIPS_INVAL("special_tx79");
+ generate_exception_end(ctx, EXCP_RI);
+ break;
+ }
+}
+
static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx)
{
int rs, rt, rd, sa;
@@ -23796,7 +23925,7 @@ static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx)
case OPC_MOVN: /* Conditional move */
case OPC_MOVZ:
check_insn(ctx, ISA_MIPS4 | ISA_MIPS32 |
- INSN_LOONGSON2E | INSN_LOONGSON2F | INSN_R5900);
+ INSN_LOONGSON2E | INSN_LOONGSON2F);
gen_cond_move(ctx, op1, rd, rs, rt);
break;
case OPC_MFHI: /* Move from HI/LO */
@@ -23823,8 +23952,6 @@ static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx)
check_insn(ctx, INSN_VR54XX);
op1 = MASK_MUL_VR54XX(ctx->opcode);
gen_mul_vr54xx(ctx, op1, rd, rs, rt);
- } else if (ctx->insn_flags & INSN_R5900) {
- gen_mul_txx9(ctx, op1, rd, rs, rt);
} else {
gen_muldiv(ctx, op1, rd & 3, rs, rt);
}
@@ -23839,7 +23966,6 @@ static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx)
case OPC_DDIV:
case OPC_DDIVU:
check_insn(ctx, ISA_MIPS3);
- check_insn_opc_user_only(ctx, INSN_R5900);
check_mips_64(ctx);
gen_muldiv(ctx, op1, 0, rs, rt);
break;
@@ -24066,6 +24192,8 @@ static void decode_opc_special(CPUMIPSState *env, DisasContext *ctx)
default:
if (ctx->insn_flags & ISA_MIPS32R6) {
decode_opc_special_r6(env, ctx);
+ } else if (ctx->insn_flags & INSN_R5900) {
+ decode_opc_special_tx79(env, ctx);
} else {
decode_opc_special_legacy(env, ctx);
}
@@ -26336,37 +26464,37 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx)
}
}
-static void decode_tx79_mmi0(CPUMIPSState *env, DisasContext *ctx)
+static void decode_mmi0(CPUMIPSState *env, DisasContext *ctx)
{
- uint32_t opc = MASK_TX79_MMI0(ctx->opcode);
+ uint32_t opc = MASK_MMI0(ctx->opcode);
switch (opc) {
- case TX79_MMI0_PADDW: /* TODO: TX79_MMI0_PADDW */
- case TX79_MMI0_PSUBW: /* TODO: TX79_MMI0_PSUBW */
- case TX79_MMI0_PCGTW: /* TODO: TX79_MMI0_PCGTW */
- case TX79_MMI0_PMAXW: /* TODO: TX79_MMI0_PMAXW */
- case TX79_MMI0_PADDH: /* TODO: TX79_MMI0_PADDH */
- case TX79_MMI0_PSUBH: /* TODO: TX79_MMI0_PSUBH */
- case TX79_MMI0_PCGTH: /* TODO: TX79_MMI0_PCGTH */
- case TX79_MMI0_PMAXH: /* TODO: TX79_MMI0_PMAXH */
- case TX79_MMI0_PADDB: /* TODO: TX79_MMI0_PADDB */
- case TX79_MMI0_PSUBB: /* TODO: TX79_MMI0_PSUBB */
- case TX79_MMI0_PCGTB: /* TODO: TX79_MMI0_PCGTB */
- case TX79_MMI0_PADDSW: /* TODO: TX79_MMI0_PADDSW */
- case TX79_MMI0_PSUBSW: /* TODO: TX79_MMI0_PSUBSW */
- case TX79_MMI0_PEXTLW: /* TODO: TX79_MMI0_PEXTLW */
- case TX79_MMI0_PPACW: /* TODO: TX79_MMI0_PPACW */
- case TX79_MMI0_PADDSH: /* TODO: TX79_MMI0_PADDSH */
- case TX79_MMI0_PSUBSH: /* TODO: TX79_MMI0_PSUBSH */
- case TX79_MMI0_PEXTLH: /* TODO: TX79_MMI0_PEXTLH */
- case TX79_MMI0_PPACH: /* TODO: TX79_MMI0_PPACH */
- case TX79_MMI0_PADDSB: /* TODO: TX79_MMI0_PADDSB */
- case TX79_MMI0_PSUBSB: /* TODO: TX79_MMI0_PSUBSB */
- case TX79_MMI0_PEXTLB: /* TODO: TX79_MMI0_PEXTLB */
- case TX79_MMI0_PPACB: /* TODO: TX79_MMI0_PPACB */
- case TX79_MMI0_PEXT5: /* TODO: TX79_MMI0_PEXT5 */
- case TX79_MMI0_PPAC5: /* TODO: TX79_MMI0_PPAC5 */
- generate_exception_end(ctx, EXCP_RI); /* TODO: TX79_MMI_CLASS_MMI0 */
+ case MMI_OPC_0_PADDW: /* TODO: MMI_OPC_0_PADDW */
+ case MMI_OPC_0_PSUBW: /* TODO: MMI_OPC_0_PSUBW */
+ case MMI_OPC_0_PCGTW: /* TODO: MMI_OPC_0_PCGTW */
+ case MMI_OPC_0_PMAXW: /* TODO: MMI_OPC_0_PMAXW */
+ case MMI_OPC_0_PADDH: /* TODO: MMI_OPC_0_PADDH */
+ case MMI_OPC_0_PSUBH: /* TODO: MMI_OPC_0_PSUBH */
+ case MMI_OPC_0_PCGTH: /* TODO: MMI_OPC_0_PCGTH */
+ case MMI_OPC_0_PMAXH: /* TODO: MMI_OPC_0_PMAXH */
+ case MMI_OPC_0_PADDB: /* TODO: MMI_OPC_0_PADDB */
+ case MMI_OPC_0_PSUBB: /* TODO: MMI_OPC_0_PSUBB */
+ case MMI_OPC_0_PCGTB: /* TODO: MMI_OPC_0_PCGTB */
+ case MMI_OPC_0_PADDSW: /* TODO: MMI_OPC_0_PADDSW */
+ case MMI_OPC_0_PSUBSW: /* TODO: MMI_OPC_0_PSUBSW */
+ case MMI_OPC_0_PEXTLW: /* TODO: MMI_OPC_0_PEXTLW */
+ case MMI_OPC_0_PPACW: /* TODO: MMI_OPC_0_PPACW */
+ case MMI_OPC_0_PADDSH: /* TODO: MMI_OPC_0_PADDSH */
+ case MMI_OPC_0_PSUBSH: /* TODO: MMI_OPC_0_PSUBSH */
+ case MMI_OPC_0_PEXTLH: /* TODO: MMI_OPC_0_PEXTLH */
+ case MMI_OPC_0_PPACH: /* TODO: MMI_OPC_0_PPACH */
+ case MMI_OPC_0_PADDSB: /* TODO: MMI_OPC_0_PADDSB */
+ case MMI_OPC_0_PSUBSB: /* TODO: MMI_OPC_0_PSUBSB */
+ case MMI_OPC_0_PEXTLB: /* TODO: MMI_OPC_0_PEXTLB */
+ case MMI_OPC_0_PPACB: /* TODO: MMI_OPC_0_PPACB */
+ case MMI_OPC_0_PEXT5: /* TODO: MMI_OPC_0_PEXT5 */
+ case MMI_OPC_0_PPAC5: /* TODO: MMI_OPC_0_PPAC5 */
+ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_CLASS_MMI0 */
break;
default:
MIPS_INVAL("TX79 MMI class MMI0");
@@ -26375,30 +26503,30 @@ static void decode_tx79_mmi0(CPUMIPSState *env, DisasContext *ctx)
}
}
-static void decode_tx79_mmi1(CPUMIPSState *env, DisasContext *ctx)
+static void decode_mmi1(CPUMIPSState *env, DisasContext *ctx)
{
- uint32_t opc = MASK_TX79_MMI1(ctx->opcode);
+ uint32_t opc = MASK_MMI1(ctx->opcode);
switch (opc) {
- case TX79_MMI1_PABSW: /* TODO: TX79_MMI1_PABSW */
- case TX79_MMI1_PCEQW: /* TODO: TX79_MMI1_PCEQW */
- case TX79_MMI1_PMINW: /* TODO: TX79_MMI1_PMINW */
- case TX79_MMI1_PADSBH: /* TODO: TX79_MMI1_PADSBH */
- case TX79_MMI1_PABSH: /* TODO: TX79_MMI1_PABSH */
- case TX79_MMI1_PCEQH: /* TODO: TX79_MMI1_PCEQH */
- case TX79_MMI1_PMINH: /* TODO: TX79_MMI1_PMINH */
- case TX79_MMI1_PCEQB: /* TODO: TX79_MMI1_PCEQB */
- case TX79_MMI1_PADDUW: /* TODO: TX79_MMI1_PADDUW */
- case TX79_MMI1_PSUBUW: /* TODO: TX79_MMI1_PSUBUW */
- case TX79_MMI1_PEXTUW: /* TODO: TX79_MMI1_PEXTUW */
- case TX79_MMI1_PADDUH: /* TODO: TX79_MMI1_PADDUH */
- case TX79_MMI1_PSUBUH: /* TODO: TX79_MMI1_PSUBUH */
- case TX79_MMI1_PEXTUH: /* TODO: TX79_MMI1_PEXTUH */
- case TX79_MMI1_PADDUB: /* TODO: TX79_MMI1_PADDUB */
- case TX79_MMI1_PSUBUB: /* TODO: TX79_MMI1_PSUBUB */
- case TX79_MMI1_PEXTUB: /* TODO: TX79_MMI1_PEXTUB */
- case TX79_MMI1_QFSRV: /* TODO: TX79_MMI1_QFSRV */
- generate_exception_end(ctx, EXCP_RI); /* TODO: TX79_MMI_CLASS_MMI1 */
+ case MMI_OPC_1_PABSW: /* TODO: MMI_OPC_1_PABSW */
+ case MMI_OPC_1_PCEQW: /* TODO: MMI_OPC_1_PCEQW */
+ case MMI_OPC_1_PMINW: /* TODO: MMI_OPC_1_PMINW */
+ case MMI_OPC_1_PADSBH: /* TODO: MMI_OPC_1_PADSBH */
+ case MMI_OPC_1_PABSH: /* TODO: MMI_OPC_1_PABSH */
+ case MMI_OPC_1_PCEQH: /* TODO: MMI_OPC_1_PCEQH */
+ case MMI_OPC_1_PMINH: /* TODO: MMI_OPC_1_PMINH */
+ case MMI_OPC_1_PCEQB: /* TODO: MMI_OPC_1_PCEQB */
+ case MMI_OPC_1_PADDUW: /* TODO: MMI_OPC_1_PADDUW */
+ case MMI_OPC_1_PSUBUW: /* TODO: MMI_OPC_1_PSUBUW */
+ case MMI_OPC_1_PEXTUW: /* TODO: MMI_OPC_1_PEXTUW */
+ case MMI_OPC_1_PADDUH: /* TODO: MMI_OPC_1_PADDUH */
+ case MMI_OPC_1_PSUBUH: /* TODO: MMI_OPC_1_PSUBUH */
+ case MMI_OPC_1_PEXTUH: /* TODO: MMI_OPC_1_PEXTUH */
+ case MMI_OPC_1_PADDUB: /* TODO: MMI_OPC_1_PADDUB */
+ case MMI_OPC_1_PSUBUB: /* TODO: MMI_OPC_1_PSUBUB */
+ case MMI_OPC_1_PEXTUB: /* TODO: MMI_OPC_1_PEXTUB */
+ case MMI_OPC_1_QFSRV: /* TODO: MMI_OPC_1_QFSRV */
+ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_CLASS_MMI1 */
break;
default:
MIPS_INVAL("TX79 MMI class MMI1");
@@ -26407,34 +26535,34 @@ static void decode_tx79_mmi1(CPUMIPSState *env, DisasContext *ctx)
}
}
-static void decode_tx79_mmi2(CPUMIPSState *env, DisasContext *ctx)
+static void decode_mmi2(CPUMIPSState *env, DisasContext *ctx)
{
- uint32_t opc = MASK_TX79_MMI2(ctx->opcode);
+ uint32_t opc = MASK_MMI2(ctx->opcode);
switch (opc) {
- case TX79_MMI2_PMADDW: /* TODO: TX79_MMI2_PMADDW */
- case TX79_MMI2_PSLLVW: /* TODO: TX79_MMI2_PSLLVW */
- case TX79_MMI2_PSRLVW: /* TODO: TX79_MMI2_PSRLVW */
- case TX79_MMI2_PMSUBW: /* TODO: TX79_MMI2_PMSUBW */
- case TX79_MMI2_PMFHI: /* TODO: TX79_MMI2_PMFHI */
- case TX79_MMI2_PMFLO: /* TODO: TX79_MMI2_PMFLO */
- case TX79_MMI2_PINTH: /* TODO: TX79_MMI2_PINTH */
- case TX79_MMI2_PMULTW: /* TODO: TX79_MMI2_PMULTW */
- case TX79_MMI2_PDIVW: /* TODO: TX79_MMI2_PDIVW */
- case TX79_MMI2_PCPYLD: /* TODO: TX79_MMI2_PCPYLD */
- case TX79_MMI2_PMADDH: /* TODO: TX79_MMI2_PMADDH */
- case TX79_MMI2_PHMADH: /* TODO: TX79_MMI2_PHMADH */
- case TX79_MMI2_PAND: /* TODO: TX79_MMI2_PAND */
- case TX79_MMI2_PXOR: /* TODO: TX79_MMI2_PXOR */
- case TX79_MMI2_PMSUBH: /* TODO: TX79_MMI2_PMSUBH */
- case TX79_MMI2_PHMSBH: /* TODO: TX79_MMI2_PHMSBH */
- case TX79_MMI2_PEXEH: /* TODO: TX79_MMI2_PEXEH */
- case TX79_MMI2_PREVH: /* TODO: TX79_MMI2_PREVH */
- case TX79_MMI2_PMULTH: /* TODO: TX79_MMI2_PMULTH */
- case TX79_MMI2_PDIVBW: /* TODO: TX79_MMI2_PDIVBW */
- case TX79_MMI2_PEXEW: /* TODO: TX79_MMI2_PEXEW */
- case TX79_MMI2_PROT3W: /* TODO: TX79_MMI2_PROT3W */
- generate_exception_end(ctx, EXCP_RI); /* TODO: TX79_MMI_CLASS_MMI2 */
+ case MMI_OPC_2_PMADDW: /* TODO: MMI_OPC_2_PMADDW */
+ case MMI_OPC_2_PSLLVW: /* TODO: MMI_OPC_2_PSLLVW */
+ case MMI_OPC_2_PSRLVW: /* TODO: MMI_OPC_2_PSRLVW */
+ case MMI_OPC_2_PMSUBW: /* TODO: MMI_OPC_2_PMSUBW */
+ case MMI_OPC_2_PMFHI: /* TODO: MMI_OPC_2_PMFHI */
+ case MMI_OPC_2_PMFLO: /* TODO: MMI_OPC_2_PMFLO */
+ case MMI_OPC_2_PINTH: /* TODO: MMI_OPC_2_PINTH */
+ case MMI_OPC_2_PMULTW: /* TODO: MMI_OPC_2_PMULTW */
+ case MMI_OPC_2_PDIVW: /* TODO: MMI_OPC_2_PDIVW */
+ case MMI_OPC_2_PCPYLD: /* TODO: MMI_OPC_2_PCPYLD */
+ case MMI_OPC_2_PMADDH: /* TODO: MMI_OPC_2_PMADDH */
+ case MMI_OPC_2_PHMADH: /* TODO: MMI_OPC_2_PHMADH */
+ case MMI_OPC_2_PAND: /* TODO: MMI_OPC_2_PAND */
+ case MMI_OPC_2_PXOR: /* TODO: MMI_OPC_2_PXOR */
+ case MMI_OPC_2_PMSUBH: /* TODO: MMI_OPC_2_PMSUBH */
+ case MMI_OPC_2_PHMSBH: /* TODO: MMI_OPC_2_PHMSBH */
+ case MMI_OPC_2_PEXEH: /* TODO: MMI_OPC_2_PEXEH */
+ case MMI_OPC_2_PREVH: /* TODO: MMI_OPC_2_PREVH */
+ case MMI_OPC_2_PMULTH: /* TODO: MMI_OPC_2_PMULTH */
+ case MMI_OPC_2_PDIVBW: /* TODO: MMI_OPC_2_PDIVBW */
+ case MMI_OPC_2_PEXEW: /* TODO: MMI_OPC_2_PEXEW */
+ case MMI_OPC_2_PROT3W: /* TODO: MMI_OPC_2_PROT3W */
+ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_CLASS_MMI2 */
break;
default:
MIPS_INVAL("TX79 MMI class MMI2");
@@ -26443,25 +26571,25 @@ static void decode_tx79_mmi2(CPUMIPSState *env, DisasContext *ctx)
}
}
-static void decode_tx79_mmi3(CPUMIPSState *env, DisasContext *ctx)
+static void decode_mmi3(CPUMIPSState *env, DisasContext *ctx)
{
- uint32_t opc = MASK_TX79_MMI3(ctx->opcode);
+ uint32_t opc = MASK_MMI3(ctx->opcode);
switch (opc) {
- case TX79_MMI3_PMADDUW: /* TODO: TX79_MMI3_PMADDUW */
- case TX79_MMI3_PSRAVW: /* TODO: TX79_MMI3_PSRAVW */
- case TX79_MMI3_PMTHI: /* TODO: TX79_MMI3_PMTHI */
- case TX79_MMI3_PMTLO: /* TODO: TX79_MMI3_PMTLO */
- case TX79_MMI3_PINTEH: /* TODO: TX79_MMI3_PINTEH */
- case TX79_MMI3_PMULTUW: /* TODO: TX79_MMI3_PMULTUW */
- case TX79_MMI3_PDIVUW: /* TODO: TX79_MMI3_PDIVUW */
- case TX79_MMI3_PCPYUD: /* TODO: TX79_MMI3_PCPYUD */
- case TX79_MMI3_POR: /* TODO: TX79_MMI3_POR */
- case TX79_MMI3_PNOR: /* TODO: TX79_MMI3_PNOR */
- case TX79_MMI3_PEXCH: /* TODO: TX79_MMI3_PEXCH */
- case TX79_MMI3_PCPYH: /* TODO: TX79_MMI3_PCPYH */
- case TX79_MMI3_PEXCW: /* TODO: TX79_MMI3_PEXCW */
- generate_exception_end(ctx, EXCP_RI); /* TODO: TX79_MMI_CLASS_MMI3 */
+ case MMI_OPC_3_PMADDUW: /* TODO: MMI_OPC_3_PMADDUW */
+ case MMI_OPC_3_PSRAVW: /* TODO: MMI_OPC_3_PSRAVW */
+ case MMI_OPC_3_PMTHI: /* TODO: MMI_OPC_3_PMTHI */
+ case MMI_OPC_3_PMTLO: /* TODO: MMI_OPC_3_PMTLO */
+ case MMI_OPC_3_PINTEH: /* TODO: MMI_OPC_3_PINTEH */
+ case MMI_OPC_3_PMULTUW: /* TODO: MMI_OPC_3_PMULTUW */
+ case MMI_OPC_3_PDIVUW: /* TODO: MMI_OPC_3_PDIVUW */
+ case MMI_OPC_3_PCPYUD: /* TODO: MMI_OPC_3_PCPYUD */
+ case MMI_OPC_3_POR: /* TODO: MMI_OPC_3_POR */
+ case MMI_OPC_3_PNOR: /* TODO: MMI_OPC_3_PNOR */
+ case MMI_OPC_3_PEXCH: /* TODO: MMI_OPC_3_PEXCH */
+ case MMI_OPC_3_PCPYH: /* TODO: MMI_OPC_3_PCPYH */
+ case MMI_OPC_3_PEXCW: /* TODO: MMI_OPC_3_PEXCW */
+ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_CLASS_MMI3 */
break;
default:
MIPS_INVAL("TX79 MMI class MMI3");
@@ -26470,56 +26598,56 @@ static void decode_tx79_mmi3(CPUMIPSState *env, DisasContext *ctx)
}
}
-static void decode_tx79_mmi(CPUMIPSState *env, DisasContext *ctx)
+static void decode_mmi(CPUMIPSState *env, DisasContext *ctx)
{
- uint32_t opc = MASK_TX79_MMI(ctx->opcode);
+ uint32_t opc = MASK_MMI(ctx->opcode);
int rs = extract32(ctx->opcode, 21, 5);
int rt = extract32(ctx->opcode, 16, 5);
int rd = extract32(ctx->opcode, 11, 5);
switch (opc) {
- case TX79_MMI_CLASS_MMI0:
- decode_tx79_mmi0(env, ctx);
+ case MMI_OPC_CLASS_MMI0:
+ decode_mmi0(env, ctx);
break;
- case TX79_MMI_CLASS_MMI1:
- decode_tx79_mmi1(env, ctx);
+ case MMI_OPC_CLASS_MMI1:
+ decode_mmi1(env, ctx);
break;
- case TX79_MMI_CLASS_MMI2:
- decode_tx79_mmi2(env, ctx);
+ case MMI_OPC_CLASS_MMI2:
+ decode_mmi2(env, ctx);
break;
- case TX79_MMI_CLASS_MMI3:
- decode_tx79_mmi3(env, ctx);
+ case MMI_OPC_CLASS_MMI3:
+ decode_mmi3(env, ctx);
break;
- case TX79_MMI_MULT1:
- case TX79_MMI_MULTU1:
+ case MMI_OPC_MULT1:
+ case MMI_OPC_MULTU1:
gen_mul_txx9(ctx, opc, rd, rs, rt);
break;
- case TX79_MMI_DIV1:
- case TX79_MMI_DIVU1:
- gen_muldiv(ctx, opc, 1, rs, rt);
- break;
- case TX79_MMI_MTLO1:
- case TX79_MMI_MTHI1:
- gen_HILO(ctx, opc, 1, rs);
- break;
- case TX79_MMI_MFLO1:
- case TX79_MMI_MFHI1:
- gen_HILO(ctx, opc, 1, rd);
- break;
- case TX79_MMI_MADD: /* TODO: TX79_MMI_MADD */
- case TX79_MMI_MADDU: /* TODO: TX79_MMI_MADDU */
- case TX79_MMI_PLZCW: /* TODO: TX79_MMI_PLZCW */
- case TX79_MMI_MADD1: /* TODO: TX79_MMI_MADD1 */
- case TX79_MMI_MADDU1: /* TODO: TX79_MMI_MADDU1 */
- case TX79_MMI_PMFHL: /* TODO: TX79_MMI_PMFHL */
- case TX79_MMI_PMTHL: /* TODO: TX79_MMI_PMTHL */
- case TX79_MMI_PSLLH: /* TODO: TX79_MMI_PSLLH */
- case TX79_MMI_PSRLH: /* TODO: TX79_MMI_PSRLH */
- case TX79_MMI_PSRAH: /* TODO: TX79_MMI_PSRAH */
- case TX79_MMI_PSLLW: /* TODO: TX79_MMI_PSLLW */
- case TX79_MMI_PSRLW: /* TODO: TX79_MMI_PSRLW */
- case TX79_MMI_PSRAW: /* TODO: TX79_MMI_PSRAW */
- generate_exception_end(ctx, EXCP_RI); /* TODO: TX79_CLASS_MMI */
+ case MMI_OPC_DIV1:
+ case MMI_OPC_DIVU1:
+ gen_div1_tx79(ctx, opc, rs, rt);
+ break;
+ case MMI_OPC_MTLO1:
+ case MMI_OPC_MTHI1:
+ gen_HILO1_tx79(ctx, opc, rs);
+ break;
+ case MMI_OPC_MFLO1:
+ case MMI_OPC_MFHI1:
+ gen_HILO1_tx79(ctx, opc, rd);
+ break;
+ case MMI_OPC_MADD: /* TODO: MMI_OPC_MADD */
+ case MMI_OPC_MADDU: /* TODO: MMI_OPC_MADDU */
+ case MMI_OPC_PLZCW: /* TODO: MMI_OPC_PLZCW */
+ case MMI_OPC_MADD1: /* TODO: MMI_OPC_MADD1 */
+ case MMI_OPC_MADDU1: /* TODO: MMI_OPC_MADDU1 */
+ case MMI_OPC_PMFHL: /* TODO: MMI_OPC_PMFHL */
+ case MMI_OPC_PMTHL: /* TODO: MMI_OPC_PMTHL */
+ case MMI_OPC_PSLLH: /* TODO: MMI_OPC_PSLLH */
+ case MMI_OPC_PSRLH: /* TODO: MMI_OPC_PSRLH */
+ case MMI_OPC_PSRAH: /* TODO: MMI_OPC_PSRAH */
+ case MMI_OPC_PSLLW: /* TODO: MMI_OPC_PSLLW */
+ case MMI_OPC_PSRLW: /* TODO: MMI_OPC_PSRLW */
+ case MMI_OPC_PSRAW: /* TODO: MMI_OPC_PSRAW */
+ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_CLASS_MMI */
break;
default:
MIPS_INVAL("TX79 MMI class");
@@ -26528,14 +26656,14 @@ static void decode_tx79_mmi(CPUMIPSState *env, DisasContext *ctx)
}
}
-static void decode_tx79_lq(CPUMIPSState *env, DisasContext *ctx)
+static void gen_mmi_lq(CPUMIPSState *env, DisasContext *ctx)
{
- generate_exception_end(ctx, EXCP_RI); /* TODO: TX79_LQ */
+ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_LQ */
}
-static void gen_tx79_sq(DisasContext *ctx, int base, int rt, int offset)
+static void gen_mmi_sq(DisasContext *ctx, int base, int rt, int offset)
{
- generate_exception_end(ctx, EXCP_RI); /* TODO: TX79_SQ */
+ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_SQ */
}
/*
@@ -26559,7 +26687,7 @@ static void gen_tx79_sq(DisasContext *ctx, int base, int rt, int offset)
* In user mode, QEMU must verify the upper and lower 11 bits to distinguish
* between SQ and RDHWR, as the Linux kernel does.
*/
-static void decode_tx79_sq(CPUMIPSState *env, DisasContext *ctx)
+static void decode_mmi_sq(CPUMIPSState *env, DisasContext *ctx)
{
int base = extract32(ctx->opcode, 21, 5);
int rt = extract32(ctx->opcode, 16, 5);
@@ -26577,7 +26705,7 @@ static void decode_tx79_sq(CPUMIPSState *env, DisasContext *ctx)
}
#endif
- gen_tx79_sq(ctx, base, rt, offset);
+ gen_mmi_sq(ctx, base, rt, offset);
}
static void decode_opc_special3(CPUMIPSState *env, DisasContext *ctx)
@@ -27886,7 +28014,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
break;
case OPC_SPECIAL2:
if ((ctx->insn_flags & INSN_R5900) && (ctx->insn_flags & ASE_MMI)) {
- decode_tx79_mmi(env, ctx);
+ decode_mmi(env, ctx);
} else if (ctx->insn_flags & ASE_MXU) {
decode_opc_mxu(env, ctx);
} else {
@@ -27895,7 +28023,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
break;
case OPC_SPECIAL3:
if (ctx->insn_flags & INSN_R5900) {
- decode_tx79_sq(env, ctx); /* TX79_SQ */
+ decode_mmi_sq(env, ctx); /* MMI_OPC_SQ */
} else {
decode_opc_special3(env, ctx);
}
@@ -28185,7 +28313,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
break;
case OPC_LL: /* Load and stores */
check_insn(ctx, ISA_MIPS2);
- check_insn_opc_user_only(ctx, INSN_R5900);
+ if (ctx->insn_flags & INSN_R5900) {
+ check_insn_opc_user_only(ctx, INSN_R5900);
+ }
/* Fallthrough */
case OPC_LWL:
case OPC_LWR:
@@ -28211,7 +28341,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
case OPC_SC:
check_insn(ctx, ISA_MIPS2);
check_insn_opc_removed(ctx, ISA_MIPS32R6);
- check_insn_opc_user_only(ctx, INSN_R5900);
+ if (ctx->insn_flags & INSN_R5900) {
+ check_insn_opc_user_only(ctx, INSN_R5900);
+ }
gen_st_cond(ctx, op, rt, rs, imm);
break;
case OPC_CACHE:
@@ -28225,9 +28357,12 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
break;
case OPC_PREF:
check_insn_opc_removed(ctx, ISA_MIPS32R6);
- check_insn(ctx, ISA_MIPS4 | ISA_MIPS32 |
- INSN_R5900);
- /* Treat as NOP. */
+ if (ctx->insn_flags & INSN_R5900) {
+ /* Treat as NOP. */
+ } else {
+ check_insn(ctx, ISA_MIPS4 | ISA_MIPS32);
+ /* Treat as NOP. */
+ }
break;
/* Floating point (COP1). */
@@ -28479,7 +28614,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
#if defined(TARGET_MIPS64)
/* MIPS64 opcodes */
case OPC_LLD:
- check_insn_opc_user_only(ctx, INSN_R5900);
+ if (ctx->insn_flags & INSN_R5900) {
+ check_insn_opc_user_only(ctx, INSN_R5900);
+ }
/* fall through */
case OPC_LDL:
case OPC_LDR:
@@ -28503,7 +28640,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
case OPC_SCD:
check_insn_opc_removed(ctx, ISA_MIPS32R6);
check_insn(ctx, ISA_MIPS3);
- check_insn_opc_user_only(ctx, INSN_R5900);
+ if (ctx->insn_flags & INSN_R5900) {
+ check_insn_opc_user_only(ctx, INSN_R5900);
+ }
check_mips_64(ctx);
gen_st_cond(ctx, op, rt, rs, imm);
break;
@@ -28559,7 +28698,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
break;
case OPC_MSA: /* OPC_MDMX */
if (ctx->insn_flags & INSN_R5900) {
- decode_tx79_lq(env, ctx); /* TX79_LQ */
+ gen_mmi_lq(env, ctx); /* MMI_OPC_LQ */
} else {
/* MDMX: Not implemented. */
gen_msa(env, ctx);
diff --git a/target/mips/translate_init.inc.c b/target/mips/translate_init.inc.c
index 85da4a269c..acab097820 100644
--- a/target/mips/translate_init.inc.c
+++ b/target/mips/translate_init.inc.c
@@ -411,65 +411,6 @@ const mips_def_t mips_defs[] =
.mmu_type = MMU_TYPE_R4000,
},
{
- /*
- * The Toshiba TX System RISC TX79 Core Architecture manual
- *
- * https://wiki.qemu.org/File:C790.pdf
- *
- * describes the C790 processor that is a follow-up to the R5900.
- * There are a few notable differences in that the R5900 FPU
- *
- * - is not IEEE 754-1985 compliant,
- * - does not implement double format, and
- * - its machine code is nonstandard.
- */
- .name = "R5900",
- .CP0_PRid = 0x00002E00,
- /* No L2 cache, icache size 32k, dcache size 32k, uncached coherency. */
- .CP0_Config0 = (0x3 << 9) | (0x3 << 6) | (0x2 << CP0C0_K0),
- .CP0_Status_rw_bitmask = 0xF4C79C1F,
-#ifdef CONFIG_USER_ONLY
- /*
- * R5900 hardware traps to the Linux kernel for IEEE 754-1985 and LL/SC
- * emulation. For user only, QEMU is the kernel, so we emulate the traps
- * by simply emulating the instructions directly.
- *
- * Note: Config1 is only used internally, the R5900 has only Config0.
- */
- .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU),
- .CP0_LLAddr_rw_bitmask = 0xFFFFFFFF,
- .CP0_LLAddr_shift = 4,
- .CP1_fcr0 = (0x38 << FCR0_PRID) | (0x0 << FCR0_REV),
- .CP1_fcr31 = 0,
- .CP1_fcr31_rw_bitmask = 0x0183FFFF,
-#else
- /*
- * The R5900 COP1 FPU implements single-precision floating-point
- * operations but is not entirely IEEE 754-1985 compatible. In
- * particular,
- *
- * - NaN (not a number) and +/- infinities are not supported;
- * - exception mechanisms are not fully supported;
- * - denormalized numbers are not supported;
- * - rounding towards nearest and +/- infinities are not supported;
- * - computed results usually differs in the least significant bit;
- * - saturations can differ more than the least significant bit.
- *
- * Since only rounding towards zero is supported, the two least
- * significant bits of FCR31 are hardwired to 01.
- *
- * FPU emulation is disabled here until it is implemented.
- *
- * Note: Config1 is only used internally, the R5900 has only Config0.
- */
- .CP0_Config1 = (47 << CP0C1_MMU),
-#endif /* !CONFIG_USER_ONLY */
- .SEGBITS = 32,
- .PABITS = 32,
- .insn_flags = CPU_R5900 | ASE_MMI,
- .mmu_type = MMU_TYPE_R4000,
- },
- {
/* A generic CPU supporting MIPS32 Release 6 ISA.
FIXME: Support IEEE 754-2008 FP.
Eventually this should be replaced by a real CPU model. */
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
index 18d7b6d147..312bf298b3 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -1237,13 +1237,14 @@ static void gen_fp_arith(DisasContext *ctx, uint32_t opc, int rd,
tcg_temp_free(t0);
break;
-#if defined(TARGET_RISCV64)
case OPC_RISC_FMV_X_D:
/* also OPC_RISC_FCLASS_D */
switch (rm) {
+#if defined(TARGET_RISCV64)
case 0: /* FMV */
gen_set_gpr(rd, cpu_fpr[rs1]);
break;
+#endif
case 1:
t0 = tcg_temp_new();
gen_helper_fclass_d(t0, cpu_fpr[rs1]);
@@ -1255,6 +1256,7 @@ static void gen_fp_arith(DisasContext *ctx, uint32_t opc, int rd,
}
break;
+#if defined(TARGET_RISCV64)
case OPC_RISC_FMV_D_X:
t0 = tcg_temp_new();
gen_get_gpr(t0, rs1);
@@ -1290,10 +1292,14 @@ static void gen_system(CPURISCVState *env, DisasContext *ctx, uint32_t opc,
#ifndef CONFIG_USER_ONLY
/* Extract funct7 value and check whether it matches SFENCE.VMA */
if ((opc == OPC_RISC_ECALL) && ((csr >> 5) == 9)) {
- /* sfence.vma */
- /* TODO: handle ASID specific fences */
- gen_helper_tlb_flush(cpu_env);
- return;
+ if (env->priv_ver == PRIV_VERSION_1_10_0) {
+ /* sfence.vma */
+ /* TODO: handle ASID specific fences */
+ gen_helper_tlb_flush(cpu_env);
+ return;
+ } else {
+ gen_exception_illegal(ctx);
+ }
}
#endif
@@ -1340,7 +1346,11 @@ static void gen_system(CPURISCVState *env, DisasContext *ctx, uint32_t opc,
gen_helper_wfi(cpu_env);
break;
case 0x104: /* SFENCE.VM */
- gen_helper_tlb_flush(cpu_env);
+ if (env->priv_ver <= PRIV_VERSION_1_09_1) {
+ gen_helper_tlb_flush(cpu_env);
+ } else {
+ gen_exception_illegal(ctx);
+ }
break;
#endif
default:
@@ -1766,7 +1776,6 @@ static void decode_RV32_64G(CPURISCVState *env, DisasContext *ctx)
GET_RM(ctx->opcode));
break;
case OPC_RISC_FENCE:
-#ifndef CONFIG_USER_ONLY
if (ctx->opcode & 0x1000) {
/* FENCE_I is a no-op in QEMU,
* however we need to end the translation block */
@@ -1777,7 +1786,6 @@ static void decode_RV32_64G(CPURISCVState *env, DisasContext *ctx)
/* FENCE is a full memory barrier. */
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);
}
-#endif
break;
case OPC_RISC_SYSTEM:
gen_system(env, ctx, MASK_OP_SYSTEM(ctx->opcode), rd, rs1,
diff --git a/tests/check-block.sh b/tests/check-block.sh
index c3de3789c4..f3d12fd602 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -5,9 +5,9 @@ if [ "$#" -ne 0 ]; then
FORMAT_LIST="$@"
fi
-export QEMU_PROG="$(pwd)/x86_64-softmmu/qemu-system-x86_64"
-export QEMU_IMG_PROG="$(pwd)/qemu-img"
-export QEMU_IO_PROG="$(pwd)/qemu-io"
+export QEMU_PROG="$PWD/x86_64-softmmu/qemu-system-x86_64"
+export QEMU_IMG_PROG="$PWD/qemu-img"
+export QEMU_IO_PROG="$PWD/qemu-io"
if [ ! -x $QEMU_PROG ]; then
echo "'make check-block' requires qemu-system-x86_64"
diff --git a/tests/qemu-iotests/001 b/tests/qemu-iotests/001
index ffd14e2ce9..55dcbb71d9 100755
--- a/tests/qemu-iotests/001
+++ b/tests/qemu-iotests/001
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/002 b/tests/qemu-iotests/002
index d4f8e91b91..74572b4711 100755
--- a/tests/qemu-iotests/002
+++ b/tests/qemu-iotests/002
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/003 b/tests/qemu-iotests/003
index 19889b9fcd..bf2595559b 100755
--- a/tests/qemu-iotests/003
+++ b/tests/qemu-iotests/003
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/004 b/tests/qemu-iotests/004
index 6f2aa3d9a2..841b15dfac 100755
--- a/tests/qemu-iotests/004
+++ b/tests/qemu-iotests/004
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005
index 444737751f..8aa4283a4d 100755
--- a/tests/qemu-iotests/005
+++ b/tests/qemu-iotests/005
@@ -27,7 +27,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007
index fa543eeb7d..b983022a7f 100755
--- a/tests/qemu-iotests/007
+++ b/tests/qemu-iotests/007
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/008 b/tests/qemu-iotests/008
index 8e89d74fe9..8dfa10bcb8 100755
--- a/tests/qemu-iotests/008
+++ b/tests/qemu-iotests/008
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/009 b/tests/qemu-iotests/009
index 16e4475ca4..73ae09db69 100755
--- a/tests/qemu-iotests/009
+++ b/tests/qemu-iotests/009
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/010 b/tests/qemu-iotests/010
index 151dac238d..751aca9813 100755
--- a/tests/qemu-iotests/010
+++ b/tests/qemu-iotests/010
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011
index f8d044ec85..35909564a9 100755
--- a/tests/qemu-iotests/011
+++ b/tests/qemu-iotests/011
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/012 b/tests/qemu-iotests/012
index 01a770d59c..de9a5fb4d5 100755
--- a/tests/qemu-iotests/012
+++ b/tests/qemu-iotests/012
@@ -26,7 +26,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/013 b/tests/qemu-iotests/013
index d013f87da9..5e1efcee28 100755
--- a/tests/qemu-iotests/013
+++ b/tests/qemu-iotests/013
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/014 b/tests/qemu-iotests/014
index 2ea79e8c8b..9ade571a95 100755
--- a/tests/qemu-iotests/014
+++ b/tests/qemu-iotests/014
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/015 b/tests/qemu-iotests/015
index aaf9c3f415..21f7d42c84 100755
--- a/tests/qemu-iotests/015
+++ b/tests/qemu-iotests/015
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017
index 4f9302db42..1ac6f74502 100755
--- a/tests/qemu-iotests/017
+++ b/tests/qemu-iotests/017
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018
index 1d39d35c47..bba30a1be2 100755
--- a/tests/qemu-iotests/018
+++ b/tests/qemu-iotests/018
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
index 24a789a25c..8f911a79c1 100755
--- a/tests/qemu-iotests/019
+++ b/tests/qemu-iotests/019
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
index eac5080f83..6b972d082f 100755
--- a/tests/qemu-iotests/020
+++ b/tests/qemu-iotests/020
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/021 b/tests/qemu-iotests/021
index 11e8ed7187..c15ebf9eb8 100755
--- a/tests/qemu-iotests/021
+++ b/tests/qemu-iotests/021
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/022 b/tests/qemu-iotests/022
index 2452a9f86a..44765c7b7a 100755
--- a/tests/qemu-iotests/022
+++ b/tests/qemu-iotests/022
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/023 b/tests/qemu-iotests/023
index 497ae1ed17..c8e1b9a761 100755
--- a/tests/qemu-iotests/023
+++ b/tests/qemu-iotests/023
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
index 4071ed6093..428b5c815d 100755
--- a/tests/qemu-iotests/024
+++ b/tests/qemu-iotests/024
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025
index 70dd5f10aa..fcd4d97c17 100755
--- a/tests/qemu-iotests/025
+++ b/tests/qemu-iotests/025
@@ -24,7 +24,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index 582d254195..31276d9027 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/027 b/tests/qemu-iotests/027
index 08593da775..2c46ae1457 100755
--- a/tests/qemu-iotests/027
+++ b/tests/qemu-iotests/027
@@ -24,7 +24,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 97a8869251..a2a7c93bcd 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -27,7 +27,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
index 5cff6875bf..cf0fe0f6a6 100755
--- a/tests/qemu-iotests/029
+++ b/tests/qemu-iotests/029
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
index 1e08abc5ed..ac0dfaed7d 100755
--- a/tests/qemu-iotests/031
+++ b/tests/qemu-iotests/031
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/032 b/tests/qemu-iotests/032
index 24bcb52fc2..3e86bb0111 100755
--- a/tests/qemu-iotests/032
+++ b/tests/qemu-iotests/032
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
index ee8a1338bb..46b91388ef 100755
--- a/tests/qemu-iotests/033
+++ b/tests/qemu-iotests/033
@@ -24,7 +24,6 @@ owner=pbonzini@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034
index 1b28bdae63..62812cd53c 100755
--- a/tests/qemu-iotests/034
+++ b/tests/qemu-iotests/034
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/035 b/tests/qemu-iotests/035
index efc38e4d49..85d9ef7f8e 100755
--- a/tests/qemu-iotests/035
+++ b/tests/qemu-iotests/035
@@ -25,7 +25,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -50,7 +49,7 @@ echo
echo "creating image"
_make_test_img $size
-function generate_requests() {
+generate_requests() {
for i in $(seq 0 63); do
echo "aio_write ${i}M 512"
echo "aio_write ${i}M 512"
diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index ce638d6076..4e76602a93 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -27,7 +27,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037
index c476b823d2..a11992dad2 100755
--- a/tests/qemu-iotests/037
+++ b/tests/qemu-iotests/037
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -55,7 +54,7 @@ TEST_IMG="$TEST_IMG.base"
_make_test_img $size
-function backing_io()
+backing_io()
{
local offset=$1
local sectors=$2
diff --git a/tests/qemu-iotests/038 b/tests/qemu-iotests/038
index d99a1501d7..575093e8cf 100755
--- a/tests/qemu-iotests/038
+++ b/tests/qemu-iotests/038
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -52,7 +51,7 @@ TEST_IMG="$TEST_IMG.base"
_make_test_img $size
-function backing_io()
+backing_io()
{
local offset=$1
local sectors=$2
@@ -77,7 +76,7 @@ _make_test_img -b "$TEST_IMG.base" 6G
echo
echo "== Some concurrent requests touching the same cluster =="
-function overlay_io()
+overlay_io()
{
# Start with a request touching two clusters
echo aio_write -P 0x80 2020k 80k
@@ -103,7 +102,7 @@ overlay_io | $QEMU_IO "$TEST_IMG" | _filter_qemu_io |\
echo
echo "== Verify image content =="
-function verify_io()
+verify_io()
{
echo read -P 31 2016k 4k
echo read -P 0x80 2020k 80k
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index 1f48339692..b3c344cb27 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -27,7 +27,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/042 b/tests/qemu-iotests/042
index a53e7cb757..beaa339000 100755
--- a/tests/qemu-iotests/042
+++ b/tests/qemu-iotests/042
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/043 b/tests/qemu-iotests/043
index 1c6c22d92a..fc9005b28f 100755
--- a/tests/qemu-iotests/043
+++ b/tests/qemu-iotests/043
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
index f2ebecf24c..5e41d96daa 100755
--- a/tests/qemu-iotests/046
+++ b/tests/qemu-iotests/046
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -49,7 +48,7 @@ echo "== creating backing file for COW tests =="
_make_test_img $size
-function backing_io()
+backing_io()
{
local offset=$1
local sectors=$2
@@ -74,7 +73,7 @@ _make_test_img -b "$TEST_IMG.base" 6G
echo
echo "== Some concurrent requests touching the same cluster =="
-function overlay_io()
+overlay_io()
{
# Allocate middle of cluster 1, then write to somewhere before and after it
cat <<EOF
@@ -190,7 +189,7 @@ overlay_io | $QEMU_IO blkdebug::"$TEST_IMG" | _filter_qemu_io |\
echo
echo "== Verify image content =="
-function verify_io()
+verify_io()
{
if ($QEMU_IMG info -U -f "$IMGFMT" "$TEST_IMG" | grep "compat: 0.10" > /dev/null); then
# For v2 images, discarded clusters are read from the backing file
diff --git a/tests/qemu-iotests/047 b/tests/qemu-iotests/047
index 1b8f3d4a64..6e776d2ce5 100755
--- a/tests/qemu-iotests/047
+++ b/tests/qemu-iotests/047
@@ -25,7 +25,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -46,7 +45,7 @@ size=128M
_make_test_img $size
-function qemu_io_cmds()
+qemu_io_cmds()
{
cat <<EOF
write -P 0x66 0 320k
diff --git a/tests/qemu-iotests/049 b/tests/qemu-iotests/049
index df35b6d21e..97d8a64697 100755
--- a/tests/qemu-iotests/049
+++ b/tests/qemu-iotests/049
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -41,13 +40,13 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function filter_test_dir()
+filter_test_dir()
{
sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
-e "s#$TEST_DIR#TEST_DIR#g"
}
-function test_qemu_img()
+test_qemu_img()
{
echo qemu-img "$@" | filter_test_dir
$QEMU_IMG "$@" 2>&1 | filter_test_dir
diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050
index 03b4a5d620..963a0db97f 100755
--- a/tests/qemu-iotests/050
+++ b/tests/qemu-iotests/050
@@ -24,7 +24,6 @@ owner=pbonzini@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 25d3b2d478..32741d7efd 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -44,7 +43,7 @@ _supported_os Linux
# other than refcount_bits=16
_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
(
@@ -58,7 +57,7 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu |
_filter_generated_node_ids | _filter_hmp
diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052
index 842eaced3b..b992adf4ff 100755
--- a/tests/qemu-iotests/052
+++ b/tests/qemu-iotests/052
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/053 b/tests/qemu-iotests/053
index 2a04f5f551..afa109c950 100755
--- a/tests/qemu-iotests/053
+++ b/tests/qemu-iotests/053
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054
index bf47ef9fac..cf88a7c76e 100755
--- a/tests/qemu-iotests/054
+++ b/tests/qemu-iotests/054
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
index 5eb8784669..d6d4f94d5d 100755
--- a/tests/qemu-iotests/058
+++ b/tests/qemu-iotests/058
@@ -26,58 +26,21 @@ owner=xiawenc@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
-nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
-nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
-rm -f "${TEST_DIR}/qemu-nbd.pid"
-
-_cleanup_nbd()
-{
- local NBD_SNAPSHOT_PID
- if [ -f "${TEST_DIR}/qemu-nbd.pid" ]; then
- read NBD_SNAPSHOT_PID < "${TEST_DIR}/qemu-nbd.pid"
- rm -f "${TEST_DIR}/qemu-nbd.pid"
- if [ -n "$NBD_SNAPSHOT_PID" ]; then
- kill "$NBD_SNAPSHOT_PID"
- fi
- fi
- rm -f "$nbd_unix_socket"
-}
-
-_wait_for_nbd()
-{
- for ((i = 0; i < 300; i++))
- do
- if [ -r "$nbd_unix_socket" ]; then
- return
- fi
- sleep 0.1
- done
- echo "Failed in check of unix socket created by qemu-nbd"
- exit 1
-}
-
-converted_image=$TEST_IMG.converted
-
_export_nbd_snapshot()
{
- _cleanup_nbd
- $QEMU_NBD -v -t -k "$nbd_unix_socket" "$TEST_IMG" -l $1 &
- _wait_for_nbd
+ nbd_server_start_unix_socket "$TEST_IMG" -l $1
}
_export_nbd_snapshot1()
{
- _cleanup_nbd
- $QEMU_NBD -v -t -k "$nbd_unix_socket" "$TEST_IMG" -l snapshot.name=$1 &
- _wait_for_nbd
+ nbd_server_start_unix_socket "$TEST_IMG" -l snapshot.name=$1
}
_cleanup()
{
- _cleanup_nbd
+ nbd_server_stop
_cleanup_test_img
rm -f "$converted_image"
}
@@ -87,6 +50,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.rc
. ./common.filter
. ./common.pattern
+. ./common.nbd
_supported_fmt qcow2
_supported_proto file
@@ -95,6 +59,10 @@ _require_command QEMU_NBD
# Internal snapshots are (currently) impossible with refcount_bits=1
_unsupported_imgopts 'refcount_bits=1[^0-9]'
+nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
+
+converted_image=$TEST_IMG.converted
+
# Use -f raw instead of -f $IMGFMT for the NBD connection
QEMU_IO_NBD="$QEMU_IO -f raw --cache=$CACHEMODE"
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index 530bbbe6ce..54d5567acc 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -24,7 +24,6 @@ owner=famz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
index 74ad371885..af0588ae9a 100755
--- a/tests/qemu-iotests/060
+++ b/tests/qemu-iotests/060
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
index 911b6f2894..1a50163419 100755
--- a/tests/qemu-iotests/061
+++ b/tests/qemu-iotests/061
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
index 051fb9f410..985fbef41e 100755
--- a/tests/qemu-iotests/062
+++ b/tests/qemu-iotests/062
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063
index adc037c1f5..041fb5c1ac 100755
--- a/tests/qemu-iotests/063
+++ b/tests/qemu-iotests/063
@@ -25,7 +25,6 @@ owner=alex@alex.org.uk
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/064 b/tests/qemu-iotests/064
index 5792fbbc92..f55ff37ca7 100755
--- a/tests/qemu-iotests/064
+++ b/tests/qemu-iotests/064
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
index 8638217736..26c043711b 100755
--- a/tests/qemu-iotests/066
+++ b/tests/qemu-iotests/066
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
index fe259f6165..342b2b0a30 100755
--- a/tests/qemu-iotests/067
+++ b/tests/qemu-iotests/067
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
# get standard environment, filters and checks
@@ -37,7 +36,7 @@ _supported_os Linux
# Because anything other than 16 would change the output of query-block
_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
@@ -53,7 +52,7 @@ _filter_qmp_events()
| tr '\t' '\n'
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu \
| _filter_actual_image_size \
diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
index e7fca6a494..f0583d52ae 100755
--- a/tests/qemu-iotests/068
+++ b/tests/qemu-iotests/068
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069
index 96e55ef216..fdee121f43 100755
--- a/tests/qemu-iotests/069
+++ b/tests/qemu-iotests/069
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/070 b/tests/qemu-iotests/070
index 8d08d74ff9..78e0390f5f 100755
--- a/tests/qemu-iotests/070
+++ b/tests/qemu-iotests/070
@@ -25,7 +25,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071
index 48b495513f..6e467dc1da 100755
--- a/tests/qemu-iotests/071
+++ b/tests/qemu-iotests/071
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -41,14 +40,14 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@" | _filter_imgfmt
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp | _filter_qemu_io
}
diff --git a/tests/qemu-iotests/072 b/tests/qemu-iotests/072
index aa027c7d29..08ef29f5b4 100755
--- a/tests/qemu-iotests/072
+++ b/tests/qemu-iotests/072
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
index 40f85b18b9..5e7f76cb7f 100755
--- a/tests/qemu-iotests/073
+++ b/tests/qemu-iotests/073
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/075 b/tests/qemu-iotests/075
index caa30d4743..45b8901ef0 100755
--- a/tests/qemu-iotests/075
+++ b/tests/qemu-iotests/075
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/076 b/tests/qemu-iotests/076
index ef9e6a4ff3..3b5ab3fd08 100755
--- a/tests/qemu-iotests/076
+++ b/tests/qemu-iotests/076
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/077 b/tests/qemu-iotests/077
index b3c6fb1370..58fe8932b3 100755
--- a/tests/qemu-iotests/077
+++ b/tests/qemu-iotests/077
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -49,7 +48,7 @@ _make_test_img $size
echo
echo "== Some concurrent requests involving RMW =="
-function test_io()
+test_io()
{
echo "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG"
# A simple RMW request
@@ -194,7 +193,7 @@ test_io | $QEMU_IO | _filter_qemu_io | \
echo
echo "== Verify image content =="
-function verify_io()
+verify_io()
{
# A simple RMW request
echo read -P 0 0 0x200
diff --git a/tests/qemu-iotests/078 b/tests/qemu-iotests/078
index a106c26f6b..68d0ea8802 100755
--- a/tests/qemu-iotests/078
+++ b/tests/qemu-iotests/078
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079
index b2e3f7426a..fca2f77d37 100755
--- a/tests/qemu-iotests/079
+++ b/tests/qemu-iotests/079
@@ -24,7 +24,6 @@ owner=hutao@cn.fujitsu.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
index f0eb42f390..cec2376f59 100755
--- a/tests/qemu-iotests/080
+++ b/tests/qemu-iotests/080
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
index 9f1dece271..edf6e6172a 100755
--- a/tests/qemu-iotests/081
+++ b/tests/qemu-iotests/081
@@ -24,7 +24,6 @@ owner=benoit@irqsave.net
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -43,14 +42,14 @@ _supported_fmt raw
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@" | _filter_imgfmt
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
| _filter_qemu_io | _filter_generated_node_ids
diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082
index 3e605d52d1..61eec63797 100755
--- a/tests/qemu-iotests/082
+++ b/tests/qemu-iotests/082
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -41,7 +40,7 @@ _supported_fmt qcow2
_supported_proto file nfs
_supported_os Linux
-function run_qemu_img()
+run_qemu_img()
{
echo
echo Testing: "$@" | _filter_testdir
diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083
index 9f92317b0a..89f67db70f 100755
--- a/tests/qemu-iotests/083
+++ b/tests/qemu-iotests/083
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/084 b/tests/qemu-iotests/084
index 04f2aa9d7d..e131fa9642 100755
--- a/tests/qemu-iotests/084
+++ b/tests/qemu-iotests/084
@@ -25,7 +25,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085
index 5c7668cf9b..ade68ef853 100755
--- a/tests/qemu-iotests/085
+++ b/tests/qemu-iotests/085
@@ -29,7 +29,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
snapshot_virt0="snapshot-v0.qcow2"
@@ -61,7 +60,7 @@ _supported_os Linux
# ${1}: unique identifier for the snapshot filename
-function create_single_snapshot()
+create_single_snapshot()
{
cmd="{ 'execute': 'blockdev-snapshot-sync',
'arguments': { 'device': 'virtio0',
@@ -71,7 +70,7 @@ function create_single_snapshot()
}
# ${1}: unique identifier for the snapshot filename
-function create_group_snapshot()
+create_group_snapshot()
{
cmd="{ 'execute': 'transaction', 'arguments':
{'actions': [
@@ -89,7 +88,7 @@ function create_group_snapshot()
# ${1}: unique identifier for the snapshot filename
# ${2}: extra_params to the blockdev-add command
# ${3}: filename
-function do_blockdev_add()
+do_blockdev_add()
{
cmd="{ 'execute': 'blockdev-add', 'arguments':
{ 'driver': 'qcow2', 'node-name': 'snap_${1}', ${2}
@@ -100,7 +99,7 @@ function do_blockdev_add()
}
# ${1}: unique identifier for the snapshot filename
-function add_snapshot_image()
+add_snapshot_image()
{
base_image="${TEST_DIR}/$((${1}-1))-${snapshot_virt0}"
snapshot_file="${TEST_DIR}/${1}-${snapshot_virt0}"
@@ -111,7 +110,7 @@ function add_snapshot_image()
# ${1}: unique identifier for the snapshot filename
# ${2}: expected response, defaults to 'return'
-function blockdev_snapshot()
+blockdev_snapshot()
{
cmd="{ 'execute': 'blockdev-snapshot',
'arguments': { 'node': 'virtio0',
diff --git a/tests/qemu-iotests/086 b/tests/qemu-iotests/086
index 84e3835071..3cca3687ea 100755
--- a/tests/qemu-iotests/086
+++ b/tests/qemu-iotests/086
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -41,7 +40,7 @@ _supported_fmt qcow2 raw
_supported_proto file
_supported_os Linux
-function run_qemu_img()
+run_qemu_img()
{
echo
echo Testing: "$@" | _filter_testdir
diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087
index 2561a14456..f625887082 100755
--- a/tests/qemu-iotests/087
+++ b/tests/qemu-iotests/087
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
# get standard environment, filters and checks
@@ -35,14 +34,14 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
| _filter_qemu | _filter_imgfmt \
@@ -103,7 +102,7 @@ echo === aio=native without O_DIRECT ===
echo
# Skip this test if AIO is not enabled in this build
-function run_qemu_filter_aio()
+run_qemu_filter_aio()
{
run_qemu "$@" | \
sed -e 's/is not supported in this build/it requires cache.direct=on, which was not specified/'
diff --git a/tests/qemu-iotests/088 b/tests/qemu-iotests/088
index b8076f216b..c5e9ab42c7 100755
--- a/tests/qemu-iotests/088
+++ b/tests/qemu-iotests/088
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089
index aa1ba4a98e..3165d79e2a 100755
--- a/tests/qemu-iotests/089
+++ b/tests/qemu-iotests/089
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/090 b/tests/qemu-iotests/090
index 7380503d57..1450993e15 100755
--- a/tests/qemu-iotests/090
+++ b/tests/qemu-iotests/090
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091
index 10ac4a8d73..2f2f98ee64 100755
--- a/tests/qemu-iotests/091
+++ b/tests/qemu-iotests/091
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
MIG_FIFO="${TEST_DIR}/migrate"
diff --git a/tests/qemu-iotests/092 b/tests/qemu-iotests/092
index 5bbdd071d8..8e318f10b9 100755
--- a/tests/qemu-iotests/092
+++ b/tests/qemu-iotests/092
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
index 9aa01e3627..7adc9b9138 100755
--- a/tests/qemu-iotests/094
+++ b/tests/qemu-iotests/094
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095
index 72ecc22e1b..9fc47f6b87 100755
--- a/tests/qemu-iotests/095
+++ b/tests/qemu-iotests/095
@@ -27,7 +27,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097
index e22670c8d0..7234b16053 100755
--- a/tests/qemu-iotests/097
+++ b/tests/qemu-iotests/097
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
index b002e969b3..c7977da99a 100755
--- a/tests/qemu-iotests/098
+++ b/tests/qemu-iotests/098
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
index caaf58eee5..578808b747 100755
--- a/tests/qemu-iotests/099
+++ b/tests/qemu-iotests/099
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -46,12 +45,12 @@ _supported_os Linux
_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
"subformat=twoGbMaxExtentSparse"
-function do_run_qemu()
+do_run_qemu()
{
$QEMU -nographic -qmp stdio -serial none "$@"
}
-function run_qemu()
+run_qemu()
{
# Get the "file": "foo" entry ($foo may only contain escaped double quotes,
# which is how we can extract it)
@@ -60,7 +59,7 @@ function run_qemu()
| sed -e 's/^.*"file": "\(\(\\"\|[^"]\)*\)".*$/\1/' -e 's/\\"/"/g'
}
-function test_qemu()
+test_qemu()
{
run_qemu -drive "if=none,id=drv0,$1" <<EOF
{ 'execute': 'qmp_capabilities' }
diff --git a/tests/qemu-iotests/101 b/tests/qemu-iotests/101
index ea53f8b8d3..3001ba3c0a 100755
--- a/tests/qemu-iotests/101
+++ b/tests/qemu-iotests/101
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
index 04b3f28445..29a6a940e2 100755
--- a/tests/qemu-iotests/102
+++ b/tests/qemu-iotests/102
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
index 2841318492..66f8167f02 100755
--- a/tests/qemu-iotests/103
+++ b/tests/qemu-iotests/103
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/104 b/tests/qemu-iotests/104
index 726d467052..34bb0d23ba 100755
--- a/tests/qemu-iotests/104
+++ b/tests/qemu-iotests/104
@@ -24,7 +24,6 @@ owner=hutao@cn.fujitsu.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
trap "exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/105 b/tests/qemu-iotests/105
index 3db4ce3cf3..943bda2f4f 100755
--- a/tests/qemu-iotests/105
+++ b/tests/qemu-iotests/105
@@ -24,7 +24,6 @@ owner=famz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
index 5e51f88a78..4129fee6bc 100755
--- a/tests/qemu-iotests/106
+++ b/tests/qemu-iotests/106
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/107 b/tests/qemu-iotests/107
index d7222dc1c9..5d70ad2007 100755
--- a/tests/qemu-iotests/107
+++ b/tests/qemu-iotests/107
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
index 2355d98c1d..58e8ad7636 100755
--- a/tests/qemu-iotests/108
+++ b/tests/qemu-iotests/108
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
index acbd079136..b51e4616c6 100755
--- a/tests/qemu-iotests/109
+++ b/tests/qemu-iotests/109
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -46,7 +45,7 @@ _supported_os Linux
qemu_comm_method=qmp
-function run_qemu()
+run_qemu()
{
local raw_img="$1"
local source_img="$2"
diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110
index 9de7369f3a..b64b3b215a 100755
--- a/tests/qemu-iotests/110
+++ b/tests/qemu-iotests/110
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111
index a1c152d0c1..e15e66ac5d 100755
--- a/tests/qemu-iotests/111
+++ b/tests/qemu-iotests/111
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112
index 28eb9aae93..d67e6ebe9c 100755
--- a/tests/qemu-iotests/112
+++ b/tests/qemu-iotests/112
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -45,7 +44,7 @@ _supported_os Linux
# manual setting; compat will be overridden as well
_unsupported_imgopts refcount_bits 'compat=0.10'
-function print_refcount_bits()
+print_refcount_bits()
{
$QEMU_IMG info "$TEST_IMG" | sed -n '/refcount bits:/ s/^ *//p'
}
diff --git a/tests/qemu-iotests/113 b/tests/qemu-iotests/113
index 4e09810905..d8d78c46dc 100755
--- a/tests/qemu-iotests/113
+++ b/tests/qemu-iotests/113
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
index 5b7dc5496c..e17fb514cb 100755
--- a/tests/qemu-iotests/114
+++ b/tests/qemu-iotests/114
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115
index 665c2ead41..0581e03c26 100755
--- a/tests/qemu-iotests/115
+++ b/tests/qemu-iotests/115
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/116 b/tests/qemu-iotests/116
index df0172fed3..f8a27b9c02 100755
--- a/tests/qemu-iotests/116
+++ b/tests/qemu-iotests/116
@@ -27,7 +27,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117
index 6c83461182..e533e230a3 100755
--- a/tests/qemu-iotests/117
+++ b/tests/qemu-iotests/117
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/119 b/tests/qemu-iotests/119
index 4f34fb4343..32810d52c9 100755
--- a/tests/qemu-iotests/119
+++ b/tests/qemu-iotests/119
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120
index f40b97d099..76afdf449b 100755
--- a/tests/qemu-iotests/120
+++ b/tests/qemu-iotests/120
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121
index 6d6f55a5dc..d2885c700f 100755
--- a/tests/qemu-iotests/121
+++ b/tests/qemu-iotests/121
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122
index d8c8ad722d..eab3399dd6 100755
--- a/tests/qemu-iotests/122
+++ b/tests/qemu-iotests/122
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
index b18e3fca9a..168b985c8b 100755
--- a/tests/qemu-iotests/123
+++ b/tests/qemu-iotests/123
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125
index c20c71570c..778c874933 100755
--- a/tests/qemu-iotests/125
+++ b/tests/qemu-iotests/125
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/126 b/tests/qemu-iotests/126
index a2d4d6c73d..91148383ad 100755
--- a/tests/qemu-iotests/126
+++ b/tests/qemu-iotests/126
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
# get standard environment, filters and checks
diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127
index 9e0d7d3be8..c9139ed5e6 100755
--- a/tests/qemu-iotests/127
+++ b/tests/qemu-iotests/127
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/128 b/tests/qemu-iotests/128
index 0976a18133..925f5c7e98 100755
--- a/tests/qemu-iotests/128
+++ b/tests/qemu-iotests/128
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
devname="eiodev$$"
diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130
index 2c4b94da1b..f2f2706b28 100755
--- a/tests/qemu-iotests/130
+++ b/tests/qemu-iotests/130
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/131 b/tests/qemu-iotests/131
index 94a9ae76af..58c25f7abe 100755
--- a/tests/qemu-iotests/131
+++ b/tests/qemu-iotests/131
@@ -24,7 +24,6 @@ owner=den@openvz.org
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/133 b/tests/qemu-iotests/133
index af6b3e1dd4..a9a47a3c36 100755
--- a/tests/qemu-iotests/133
+++ b/tests/qemu-iotests/133
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134
index 99144151b8..cacabcd28b 100755
--- a/tests/qemu-iotests/134
+++ b/tests/qemu-iotests/134
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/135 b/tests/qemu-iotests/135
index ce608312f6..a18a0c7230 100755
--- a/tests/qemu-iotests/135
+++ b/tests/qemu-iotests/135
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
index 19e8597306..09cd4450ca 100755
--- a/tests/qemu-iotests/137
+++ b/tests/qemu-iotests/137
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
index 21650d8197..eccbcae3a6 100755
--- a/tests/qemu-iotests/138
+++ b/tests/qemu-iotests/138
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140
index a8fc95145c..d4623b5a5d 100755
--- a/tests/qemu-iotests/140
+++ b/tests/qemu-iotests/140
@@ -28,7 +28,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141
index 4246d387a1..e2408c7988 100755
--- a/tests/qemu-iotests/141
+++ b/tests/qemu-iotests/141
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142
index 1639c83985..5fc488f5d2 100755
--- a/tests/qemu-iotests/142
+++ b/tests/qemu-iotests/142
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -46,7 +45,7 @@ _supported_os Linux
_default_cache_mode none
_supported_cache_modes none directsync
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
(
@@ -60,7 +59,7 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp
}
@@ -89,7 +88,7 @@ echo
files="if=none,file=$TEST_IMG,backing.file.filename=$TEST_IMG.base"
ids="node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file"
-function check_cache_all()
+check_cache_all()
{
# cache.direct is supposed to be inherited by both bs->file and
# bs->backing
@@ -232,7 +231,7 @@ drv_bk="if=none,file=json:{'driver':'$IMGFMT',,'file':'backing-file',,'node-name
drv_file="if=none,driver=file,filename=$TEST_IMG,node-name=file"
drv_img="if=none,id=blk,file=json:{'driver':'$IMGFMT',,'file':'file',,'backing':'backing',,'node-name':'image'}"
-function check_cache_all_separate()
+check_cache_all_separate()
{
# Check cache.direct
diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143
index 5ff1944507..d6302cc06d 100755
--- a/tests/qemu-iotests/143
+++ b/tests/qemu-iotests/143
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/144 b/tests/qemu-iotests/144
index 4b915718cd..118c099994 100755
--- a/tests/qemu-iotests/144
+++ b/tests/qemu-iotests/144
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
TMP_SNAP1=${TEST_DIR}/tmp.qcow2
diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145
index c371b3c46a..6ce8a46f92 100755
--- a/tests/qemu-iotests/145
+++ b/tests/qemu-iotests/145
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146
index 043711be68..3f61351ffe 100755
--- a/tests/qemu-iotests/146
+++ b/tests/qemu-iotests/146
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/150 b/tests/qemu-iotests/150
index ee8f6375f6..955b877efa 100755
--- a/tests/qemu-iotests/150
+++ b/tests/qemu-iotests/150
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
index 0daeb1b005..3120a61da4 100755
--- a/tests/qemu-iotests/153
+++ b/tests/qemu-iotests/153
@@ -24,7 +24,6 @@ owner=famz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
tmp=/tmp/$$
status=1 # failure is the default!
@@ -71,7 +70,7 @@ _run_cmd()
(echo "$@"; "$@" 2>&1 1>/dev/null) | _filter_testdir
}
-function _do_run_qemu()
+_do_run_qemu()
{
(
if ! test -t 0; then
@@ -83,7 +82,7 @@ function _do_run_qemu()
) | $QEMU -nographic -monitor stdio -serial none "$@" 1>/dev/null
}
-function _run_qemu_with_images()
+_run_qemu_with_images()
{
_do_run_qemu \
$(for i in $@; do echo "-drive if=none,file=$i"; done) 2>&1 \
diff --git a/tests/qemu-iotests/154 b/tests/qemu-iotests/154
index fde03b0dc8..4a4abf0589 100755
--- a/tests/qemu-iotests/154
+++ b/tests/qemu-iotests/154
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
index 0a9a09802e..f97f96f666 100755
--- a/tests/qemu-iotests/156
+++ b/tests/qemu-iotests/156
@@ -32,7 +32,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157
index 2bf02be465..6fb26596ad 100755
--- a/tests/qemu-iotests/157
+++ b/tests/qemu-iotests/157
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -41,7 +40,7 @@ _supported_fmt generic
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
(
if ! test -t 0; then
@@ -54,7 +53,7 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt \
| _filter_qemu | _filter_generated_node_ids
diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158
index 24ac600a4a..d277ddcc94 100755
--- a/tests/qemu-iotests/158
+++ b/tests/qemu-iotests/158
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/159 b/tests/qemu-iotests/159
index 9b0e1ecc90..e74b2739de 100755
--- a/tests/qemu-iotests/159
+++ b/tests/qemu-iotests/159
@@ -23,7 +23,6 @@ owner=fullmanet@gmail.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1
_cleanup()
diff --git a/tests/qemu-iotests/160 b/tests/qemu-iotests/160
index 5c910e5bfc..92fff45d10 100755
--- a/tests/qemu-iotests/160
+++ b/tests/qemu-iotests/160
@@ -23,7 +23,6 @@ owner=fullmanet@gmail.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1
_cleanup()
diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162
index 477a806360..ef02d844a2 100755
--- a/tests/qemu-iotests/162
+++ b/tests/qemu-iotests/162
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/170 b/tests/qemu-iotests/170
index b79359fc4e..861eabf5cc 100755
--- a/tests/qemu-iotests/170
+++ b/tests/qemu-iotests/170
@@ -23,7 +23,6 @@ owner=fullmanet@gmail.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1
_cleanup()
diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171
index bcfaaf1be2..5b46069fde 100755
--- a/tests/qemu-iotests/171
+++ b/tests/qemu-iotests/171
@@ -25,7 +25,6 @@ owner=tgolembi@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172
index 02c5f79bab..1e60a7e3d6 100755
--- a/tests/qemu-iotests/172
+++ b/tests/qemu-iotests/172
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -47,7 +46,7 @@ if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
_notrun "Requires a PC machine"
fi
-function do_run_qemu()
+do_run_qemu()
{
(
if ! test -t 0; then
@@ -60,7 +59,7 @@ function do_run_qemu()
echo
}
-function check_floppy_qtree()
+check_floppy_qtree()
{
echo
echo Testing: "$@" | _filter_testdir
@@ -76,7 +75,7 @@ function check_floppy_qtree()
_filter_win32 | _filter_qemu
}
-function check_cache_mode()
+check_cache_mode()
{
echo "info block none0" |
QEMU_OPTIONS="" do_run_qemu -drive if=none,file="$TEST_IMG" "$@" |
diff --git a/tests/qemu-iotests/173 b/tests/qemu-iotests/173
index bdaa092979..1fe8c5d738 100755
--- a/tests/qemu-iotests/173
+++ b/tests/qemu-iotests/173
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174
index 552879db32..d8bb05c4e2 100755
--- a/tests/qemu-iotests/174
+++ b/tests/qemu-iotests/174
@@ -24,7 +24,6 @@ owner=nirsof@gmail.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
index ca56e827cd..ebbeb6e74c 100755
--- a/tests/qemu-iotests/175
+++ b/tests/qemu-iotests/175
@@ -24,7 +24,6 @@ owner=nirsof@gmail.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176
index 32baa116dd..4ecd5894a3 100755
--- a/tests/qemu-iotests/176
+++ b/tests/qemu-iotests/176
@@ -29,7 +29,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -51,7 +50,7 @@ _supported_os Linux
# Persistent dirty bitmaps require compat=1.1
_unsupported_imgopts 'compat=0.10'
-function run_qemu()
+run_qemu()
{
$QEMU -nographic -qmp stdio -serial none "$@" 2>&1 \
| _filter_testdir | _filter_qmp | _filter_qemu \
diff --git a/tests/qemu-iotests/177 b/tests/qemu-iotests/177
index 396986da89..f0c1155e80 100755
--- a/tests/qemu-iotests/177
+++ b/tests/qemu-iotests/177
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -86,7 +85,7 @@ $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
echo
echo "== verify image content =="
-function verify_io()
+verify_io()
{
if ($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" |
grep "compat: 0.10" > /dev/null); then
diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178
index 6af52c653a..3f4b4a4564 100755
--- a/tests/qemu-iotests/178
+++ b/tests/qemu-iotests/178
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/179 b/tests/qemu-iotests/179
index 115944a753..3040631636 100755
--- a/tests/qemu-iotests/179
+++ b/tests/qemu-iotests/179
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index e02979378d..0c44108dac 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
MIG_SOCKET="${TEST_DIR}/migrate"
diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182
index 4b31592fb8..9e078c5484 100755
--- a/tests/qemu-iotests/182
+++ b/tests/qemu-iotests/182
@@ -24,13 +24,13 @@ owner=famz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
+ rm -f "$TEST_IMG.overlay"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -71,6 +71,76 @@ echo 'quit' | $QEMU -nographic -monitor stdio \
_cleanup_qemu
+echo
+echo '=== Testing reopen ==='
+echo
+
+# This tests that reopening does not unshare any permissions it should
+# not unshare
+# (There was a bug where reopening shared exactly the opposite of the
+# permissions it was supposed to share)
+
+_launch_qemu
+
+_send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'qmp_capabilities'}" \
+ 'return'
+
+# Open the image without any format layer (we are not going to access
+# it, so that is fine)
+# This should keep all permissions shared.
+success_or_failure=y _send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'blockdev-add',
+ 'arguments': {
+ 'node-name': 'node0',
+ 'driver': 'file',
+ 'filename': '$TEST_IMG',
+ 'locking': 'on'
+ } }" \
+ 'return' \
+ 'error'
+
+# This snapshot will perform a reopen to drop R/W to RO.
+# It should still keep all permissions shared.
+success_or_failure=y _send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'blockdev-snapshot-sync',
+ 'arguments': {
+ 'node-name': 'node0',
+ 'snapshot-file': '$TEST_IMG.overlay',
+ 'snapshot-node-name': 'node1'
+ } }" \
+ 'return' \
+ 'error'
+
+# Now open the same file again
+# This does not require any permissions (and does not unshare any), so
+# this will not conflict with node0.
+success_or_failure=y _send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'blockdev-add',
+ 'arguments': {
+ 'node-name': 'node1',
+ 'driver': 'file',
+ 'filename': '$TEST_IMG',
+ 'locking': 'on'
+ } }" \
+ 'return' \
+ 'error'
+
+# Now we attach the image to a virtio-blk device. This device does
+# require some permissions (at least WRITE and READ_CONSISTENT), so if
+# reopening node0 unshared any (which it should not have), this will
+# fail (but it should not).
+success_or_failure=y _send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'device_add',
+ 'arguments': {
+ 'driver': 'virtio-blk',
+ 'drive': 'node1'
+ } }" \
+ 'return' \
+ 'error'
+
+_cleanup_qemu
+
# success, all done
echo "*** done"
rm -f $seq.full
diff --git a/tests/qemu-iotests/182.out b/tests/qemu-iotests/182.out
index f1463c8862..af501ca3f3 100644
--- a/tests/qemu-iotests/182.out
+++ b/tests/qemu-iotests/182.out
@@ -5,4 +5,13 @@ Starting QEMU
Starting a second QEMU using the same image should fail
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0,file.locking=on: Failed to get "write" lock
Is another process using the image [TEST_DIR/t.qcow2]?
+
+=== Testing reopen ===
+
+{"return": {}}
+{"return": {}}
+Formatting 'TEST_DIR/t.qcow2.overlay', fmt=qcow2 size=197120 backing_file=TEST_DIR/t.qcow2 backing_fmt=file cluster_size=65536 lazy_refcounts=off refcount_bits=16
+{"return": {}}
+{"return": {}}
+{"return": {}}
*** done
diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183
index c49e1ad6ef..ebb5e304ac 100755
--- a/tests/qemu-iotests/183
+++ b/tests/qemu-iotests/183
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
MIG_SOCKET="${TEST_DIR}/migrate"
diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184
index 2b68284d58..0af7a73aca 100755
--- a/tests/qemu-iotests/184
+++ b/tests/qemu-iotests/184
@@ -24,7 +24,6 @@ owner="Manos Pitsidianakis"
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
trap "exit \$status" 0 1 2 3 15
@@ -35,14 +34,14 @@ trap "exit \$status" 0 1 2 3 15
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@" | _filter_imgfmt
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
| _filter_qemu_io | _filter_generated_node_ids \
diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
index 7dcfdeac60..d8f1505cd8 100755
--- a/tests/qemu-iotests/185
+++ b/tests/qemu-iotests/185
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
index 0aa4395a57..c27dc953b6 100755
--- a/tests/qemu-iotests/186
+++ b/tests/qemu-iotests/186
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -45,7 +44,7 @@ if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
_notrun "Requires a PC machine"
fi
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
@@ -60,7 +59,7 @@ function do_run_qemu()
echo
}
-function check_info_block()
+check_info_block()
{
echo "info block" |
do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
diff --git a/tests/qemu-iotests/187 b/tests/qemu-iotests/187
index 7bb783363c..1feddca508 100755
--- a/tests/qemu-iotests/187
+++ b/tests/qemu-iotests/187
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/188 b/tests/qemu-iotests/188
index 83ed03e33e..af40e496ee 100755
--- a/tests/qemu-iotests/188
+++ b/tests/qemu-iotests/188
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/189 b/tests/qemu-iotests/189
index e695475722..222bec133b 100755
--- a/tests/qemu-iotests/189
+++ b/tests/qemu-iotests/189
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190
index 8f808fef5d..95ba06d8f4 100755
--- a/tests/qemu-iotests/190
+++ b/tests/qemu-iotests/190
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
index d6860e72f7..198272ea3b 100755
--- a/tests/qemu-iotests/191
+++ b/tests/qemu-iotests/191
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192
index 595f0d786a..415c706db5 100755
--- a/tests/qemu-iotests/192
+++ b/tests/qemu-iotests/192
@@ -25,7 +25,6 @@ owner=famz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195
index e7a403ded2..a977c9798e 100755
--- a/tests/qemu-iotests/195
+++ b/tests/qemu-iotests/195
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -42,14 +41,14 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qemu \
| _filter_qmp | _filter_qemu_io \
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index 0369aa5cff..8170f5d4ab 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
# get standard environment, filters and checks
diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
index 54eaaf5153..4d961f4f3a 100755
--- a/tests/qemu-iotests/198
+++ b/tests/qemu-iotests/198
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
index ddbdedc476..b9ebd5a8c7 100755
--- a/tests/qemu-iotests/200
+++ b/tests/qemu-iotests/200
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/204 b/tests/qemu-iotests/204
index feb69d2ada..30f0653ce9 100755
--- a/tests/qemu-iotests/204
+++ b/tests/qemu-iotests/204
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -94,7 +93,7 @@ $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
echo
echo "== verify image content =="
-function verify_io()
+verify_io()
{
echo read -P 22 0 1000
echo read -P 33 1000 128k
diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214
index c46ca2a6dd..7a2d5391bb 100755
--- a/tests/qemu-iotests/214
+++ b/tests/qemu-iotests/214
@@ -22,7 +22,6 @@
seq=$(basename "$0")
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
index 2e616ed659..230fd2551a 100755
--- a/tests/qemu-iotests/215
+++ b/tests/qemu-iotests/215
@@ -21,7 +21,6 @@
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
# get standard environment, filters and checks
diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220
new file mode 100755
index 0000000000..0c5682bda0
--- /dev/null
+++ b/tests/qemu-iotests/220
@@ -0,0 +1,96 @@
+#!/bin/bash
+#
+# max limits on compression in huge qcow2 files
+#
+# Copyright (C) 2018 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+seq=$(basename $0)
+echo "QA output created by $seq"
+
+status=1 # failure is the default!
+
+_cleanup()
+{
+ _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.pattern
+
+_supported_fmt qcow2
+_supported_proto file
+_supported_os Linux
+
+echo "== Creating huge file =="
+
+# Sanity check: We require a file system that permits the creation
+# of a HUGE (but very sparse) file. tmpfs works, ext4 does not.
+if ! truncate --size=513T "$TEST_IMG"; then
+ _notrun "file system on $TEST_DIR does not support large enough files"
+fi
+rm "$TEST_IMG"
+IMGOPTS='cluster_size=2M,refcount_bits=1' _make_test_img 513T
+
+echo "== Populating refcounts =="
+# We want an image with 256M refcounts * 2M clusters = 512T referenced.
+# Each 2M cluster holds 16M refcounts; the refcount table initially uses
+# 1 refblock, so we need to add 15 more. The refcount table lives at 2M,
+# first refblock at 4M, L2 at 6M, so our remaining additions start at 8M.
+# Then, for each refblock, mark it as fully populated.
+to_hex() {
+ printf %016x\\n $1 | sed 's/\(..\)/\\x\1/g'
+}
+truncate --size=38m "$TEST_IMG"
+entry=$((0x200000))
+$QEMU_IO_PROG -f raw -c "w -P 0xff 4m 2m" "$TEST_IMG" | _filter_qemu_io
+for i in {1..15}; do
+ offs=$((0x600000 + i*0x200000))
+ poke_file "$TEST_IMG" $((i*8 + entry)) $(to_hex $offs)
+ $QEMU_IO_PROG -f raw -c "w -P 0xff $offs 2m" "$TEST_IMG" | _filter_qemu_io
+done
+
+echo "== Checking file before =="
+# FIXME: 'qemu-img check' doesn't diagnose refcounts beyond the end of
+# the file as leaked clusters
+_check_test_img 2>&1 | sed '/^Leaked cluster/d'
+stat -c 'image size %s' "$TEST_IMG"
+
+echo "== Trying to write compressed cluster =="
+# Given our file size, the next available cluster at 512T lies beyond the
+# maximum offset that a compressed 2M cluster can reside in
+$QEMU_IO_PROG -c 'w -c 0 2m' "$TEST_IMG" | _filter_qemu_io
+# The attempt failed, but ended up allocating a new refblock
+stat -c 'image size %s' "$TEST_IMG"
+
+echo "== Writing normal cluster =="
+# The failed write should not corrupt the image, so a normal write succeeds
+$QEMU_IO_PROG -c 'w 0 2m' "$TEST_IMG" | _filter_qemu_io
+
+echo "== Checking file after =="
+# qemu-img now sees the millions of leaked clusters, thanks to the allocations
+# at 512T. Undo many of our faked references to speed up the check.
+$QEMU_IO_PROG -f raw -c "w -z 5m 1m" -c "w -z 8m 30m" "$TEST_IMG" |
+ _filter_qemu_io
+_check_test_img 2>&1 | sed '/^Leaked cluster/d'
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/220.out b/tests/qemu-iotests/220.out
new file mode 100644
index 0000000000..af3021fd88
--- /dev/null
+++ b/tests/qemu-iotests/220.out
@@ -0,0 +1,54 @@
+QA output created by 220
+== Creating huge file ==
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=564049465049088
+== Populating refcounts ==
+wrote 2097152/2097152 bytes at offset 4194304
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 8388608
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 10485760
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 12582912
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 14680064
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 16777216
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 18874368
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 20971520
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 23068672
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 25165824
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 27262976
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 29360128
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 31457280
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 33554432
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 35651584
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2097152/2097152 bytes at offset 37748736
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== Checking file before ==
+No errors were found on the image.
+image size 39845888
+== Trying to write compressed cluster ==
+write failed: Input/output error
+image size 562949957615616
+== Writing normal cluster ==
+wrote 2097152/2097152 bytes at offset 0
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== Checking file after ==
+wrote 1048576/1048576 bytes at offset 5242880
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 31457280/31457280 bytes at offset 8388608
+30 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+8388589 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
+*** done
diff --git a/tests/qemu-iotests/221 b/tests/qemu-iotests/221
index 41c4e4bdf8..06f48f1f23 100755
--- a/tests/qemu-iotests/221
+++ b/tests/qemu-iotests/221
@@ -21,7 +21,6 @@
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index 8b1859c2dd..72419e0338 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -21,7 +21,6 @@
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -43,14 +42,14 @@ _supported_os Linux
# Persistent dirty bitmaps require compat=1.1
_unsupported_imgopts 'compat=0.10'
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
| _filter_qemu | _filter_imgfmt \
diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225
index f2ee715685..e42ee94ff0 100755
--- a/tests/qemu-iotests/225
+++ b/tests/qemu-iotests/225
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/226 b/tests/qemu-iotests/226
index 8ec3e612dd..aec413b23c 100755
--- a/tests/qemu-iotests/226
+++ b/tests/qemu-iotests/226
@@ -25,7 +25,6 @@ owner=jsnow@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
index 9a5f7f9f14..be1b636af0 100755
--- a/tests/qemu-iotests/227
+++ b/tests/qemu-iotests/227
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
@@ -41,14 +40,14 @@ _supported_fmt generic
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
| _filter_qemu | _filter_imgfmt \
diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
index ff851ec431..86602437ff 100755
--- a/tests/qemu-iotests/229
+++ b/tests/qemu-iotests/229
@@ -25,7 +25,6 @@ owner=jcody@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/231 b/tests/qemu-iotests/231
index 3e283708b4..e9f8aaacd3 100755
--- a/tests/qemu-iotests/231
+++ b/tests/qemu-iotests/231
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
index bc2972d124..0708b8b155 100755
--- a/tests/qemu-iotests/232
+++ b/tests/qemu-iotests/232
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -42,7 +41,7 @@ _supported_fmt generic
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
(
@@ -56,13 +55,13 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp |
_filter_generated_node_ids | _filter_imgfmt
}
-function run_qemu_info_block()
+run_qemu_info_block()
{
echo "info block -n" | run_qemu "$@" | grep -e "(file" -e "QEMU_PROG"
}
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
new file mode 100755
index 0000000000..a4da60d0ad
--- /dev/null
+++ b/tests/qemu-iotests/233
@@ -0,0 +1,112 @@
+#!/bin/bash
+#
+# Test NBD TLS certificate / authorization integration
+#
+# Copyright (C) 2018 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=berrange@redhat.com
+
+seq=$(basename $0)
+echo "QA output created by $seq"
+
+status=1 # failure is the default!
+
+_cleanup()
+{
+ nbd_server_stop
+ _cleanup_test_img
+ tls_x509_cleanup
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.pattern
+. ./common.tls
+. ./common.nbd
+
+_supported_fmt raw qcow2
+_supported_proto file
+# If porting to non-Linux, consider using socat instead of ss in common.nbd
+_supported_os Linux
+_require_command QEMU_NBD
+
+nbd_server_set_tcp_port
+tls_x509_init
+
+echo
+echo "== preparing TLS creds =="
+
+tls_x509_create_root_ca "ca1"
+tls_x509_create_root_ca "ca2"
+tls_x509_create_server "ca1" "server1"
+tls_x509_create_client "ca1" "client1"
+tls_x509_create_client "ca2" "client2"
+
+echo
+echo "== preparing image =="
+_make_test_img 64M
+$QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_io
+
+echo
+echo "== check TLS client to plain server fails =="
+nbd_server_start_tcp_socket "$TEST_IMG"
+
+$QEMU_IMG info --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+nbd_server_stop
+
+echo
+echo "== check plain client to TLS server fails =="
+
+nbd_server_start_tcp_socket --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes --tls-creds tls0 "$TEST_IMG"
+
+$QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+echo
+echo "== check TLS works =="
+$QEMU_IMG info --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+echo
+echo "== check TLS with different CA fails =="
+$QEMU_IMG info --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client2,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+echo
+echo "== perform I/O over TLS =="
+QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
+$QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | _filter_qemu_io
+
+$QEMU_IO -f qcow2 -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out
new file mode 100644
index 0000000000..94acd9b947
--- /dev/null
+++ b/tests/qemu-iotests/233.out
@@ -0,0 +1,40 @@
+QA output created by 233
+
+== preparing TLS creds ==
+Generating a self signed certificate...
+Generating a self signed certificate...
+Generating a signed certificate...
+Generating a signed certificate...
+Generating a signed certificate...
+
+== preparing image ==
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
+wrote 1048576/1048576 bytes at offset 1048576
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+== check TLS client to plain server fails ==
+qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Denied by server for option 5 (starttls)
+server reported: TLS not configured
+
+== check plain client to TLS server fails ==
+qemu-img: Could not open 'nbd://localhost:PORT': TLS negotiation required before option 8 (structured reply)
+server reported: Option 0x8 not permitted before TLS
+
+== check TLS works ==
+image: nbd://127.0.0.1:PORT
+file format: nbd
+virtual size: 64M (67108864 bytes)
+disk size: unavailable
+
+== check TLS with different CA fails ==
+option negotiation failed: Verify failed: No certificate was found.
+qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': The certificate hasn't got a known issuer
+
+== perform I/O over TLS ==
+read 1048576/1048576 bytes at offset 1048576
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 1048576/1048576 bytes at offset 1048576
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 1048576/1048576 bytes at offset 1048576
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+*** done
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index aa94c6c7ea..89ed275988 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -80,17 +80,17 @@ _full_imgfmt_details()
_full_platform_details()
{
- os=`uname -s`
- host=`hostname -s`
- kernel=`uname -r`
- platform=`uname -m`
+ os=$(uname -s)
+ host=$(hostname -s)
+ kernel=$(uname -r)
+ platform=$(uname -m)
echo "$os/$platform $host $kernel"
}
# $1 = prog to look for
set_prog_path()
{
- p=`command -v $1 2> /dev/null`
+ p=$(command -v $1 2> /dev/null)
if [ -n "$p" -a -x "$p" ]; then
type -p "$p"
else
@@ -99,7 +99,7 @@ set_prog_path()
}
if [ -z "$TEST_DIR" ]; then
- TEST_DIR=`pwd`/scratch
+ TEST_DIR=$PWD/scratch
fi
if [ ! -e "$TEST_DIR" ]; then
@@ -147,9 +147,9 @@ do
if $group
then
# arg after -g
- group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+ group_list=$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
s/ .*//p
-}'`
+}')
if [ -z "$group_list" ]
then
echo "Group \"$r\" is empty or not defined?"
@@ -173,9 +173,9 @@ s/ .*//p
# arg after -x
# Populate $tmp.list with all tests
awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.list 2>/dev/null
- group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+ group_list=$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
s/ .*//p
-}'`
+}')
if [ -z "$group_list" ]
then
echo "Group \"$r\" is empty or not defined?"
@@ -193,7 +193,7 @@ s/ .*//p
rm -f $tmp.sed
fi
echo "/^$t\$/d" >>$tmp.sed
- numsed=`expr $numsed + 1`
+ numsed=$(expr $numsed + 1)
done
sed -f $tmp.sed <$tmp.list >$tmp.tmp
mv $tmp.tmp $tmp.list
@@ -433,12 +433,12 @@ testlist options
;;
[0-9]*-[0-9]*)
- eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
+ eval $(echo $r | sed -e 's/^/start=/' -e 's/-/ end=/')
;;
[0-9]*-)
- eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
- end=`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/ *$//' -e 's/.* //'`
+ eval $(echo $r | sed -e 's/^/start=/' -e 's/-//')
+ end=$(echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/ *$//' -e 's/.* //')
if [ -z "$end" ]
then
echo "No tests in range \"$r\"?"
@@ -455,8 +455,8 @@ testlist options
esac
# get rid of leading 0s as can be interpreted as octal
- start=`echo $start | sed 's/^0*//'`
- end=`echo $end | sed 's/^0*//'`
+ start=$(echo $start | sed 's/^0*//')
+ end=$(echo $end | sed 's/^0*//')
if $xpand
then
@@ -531,7 +531,7 @@ fi
# should be sort -n, but this did not work for Linux when this
# was ported from IRIX
#
-list=`sort $tmp.list`
+list=$(sort $tmp.list)
rm -f $tmp.list $tmp.tmp $tmp.sed
if [ -z "$QEMU_PROG" ]
@@ -590,7 +590,7 @@ fi
export QEMU_NBD_PROG="$(type -p "$QEMU_NBD_PROG")"
if [ -z "$QEMU_VXHS_PROG" ]; then
- export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
+ export QEMU_VXHS_PROG="$(set_prog_path qnio_server)"
fi
if [ -x "$build_iotests/socket_scm_helper" ]
@@ -616,7 +616,7 @@ _wallclock()
_timestamp()
{
- now=`date "+%T"`
+ now=$(date "+%T")
printf %s " [$now]"
}
@@ -642,9 +642,9 @@ END { if (NR > 0) {
if [ -f $tmp.expunged ]
then
- notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
- try=`expr $try - $notrun`
- list=`echo "$list" | sed -f $tmp.expunged`
+ notrun=$(wc -l <$tmp.expunged | sed -e 's/ *//g')
+ try=$(expr $try - $notrun)
+ list=$(echo "$list" | sed -f $tmp.expunged)
fi
echo "" >>check.log
@@ -682,8 +682,8 @@ trap "_wrapup; exit \$status" 0 1 2 3 15
[ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE
-FULL_IMGFMT_DETAILS=`_full_imgfmt_details`
-FULL_HOST_DETAILS=`_full_platform_details`
+FULL_IMGFMT_DETAILS=$(_full_imgfmt_details)
+FULL_HOST_DETAILS=$(_full_platform_details)
cat <<EOF
QEMU -- "$QEMU_PROG" $QEMU_OPTIONS
@@ -729,7 +729,7 @@ do
# really going to try and run this one
#
rm -f $seq.out.bad
- lasttime=`sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE`
+ lasttime=$(sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE)
if [ "X$lasttime" != X ]; then
printf %s " ${lasttime}s ..."
else
@@ -737,7 +737,7 @@ do
fi
rm -f core $seq.notrun
- start=`_wallclock`
+ start=$(_wallclock)
$timestamp && printf %s " [$(date "+%T")]"
if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then
@@ -757,7 +757,7 @@ do
fi
sts=$?
$timestamp && _timestamp
- stop=`_wallclock`
+ stop=$(_wallclock)
if [ -f core ]
then
@@ -806,7 +806,7 @@ do
then
:
else
- echo "$seq `expr $stop - $start`" >>$tmp.time
+ echo "$seq $(expr $stop - $start)" >>$tmp.time
fi
else
echo " - output mismatch (see $seq.out.bad)"
@@ -824,14 +824,14 @@ do
if $err
then
bad="$bad $seq"
- n_bad=`expr $n_bad + 1`
+ n_bad=$(expr $n_bad + 1)
quick=false
fi
- [ -f $seq.notrun ] || try=`expr $try + 1`
+ [ -f $seq.notrun ] || try=$(expr $try + 1)
seq="after_$seq"
done
interrupt=false
-status=`expr $n_bad`
+status=$(expr $n_bad)
exit
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 102aa6878a..9f460f203d 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -21,12 +21,10 @@ export LANG=C
PATH=".:$PATH"
-HOSTOS=`uname -s`
-arch=`uname -m`
+HOSTOS=$(uname -s)
+arch=$(uname -m)
[[ "$arch" =~ "ppc64" ]] && qemu_arch=ppc64 || qemu_arch="$arch"
-export PWD=`pwd`
-
# make sure we have a standard umask
umask 022
diff --git a/tests/qemu-iotests/common.nbd b/tests/qemu-iotests/common.nbd
new file mode 100644
index 0000000000..233187a25c
--- /dev/null
+++ b/tests/qemu-iotests/common.nbd
@@ -0,0 +1,109 @@
+#!/bin/bash
+# -*- shell-script-mode -*-
+#
+# Helpers for NBD server related config
+#
+# Copyright (C) 2018 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+nbd_unix_socket="${TEST_DIR}/qemu-nbd.sock"
+nbd_tcp_addr="127.0.0.1"
+nbd_pid_file="${TEST_DIR}/qemu-nbd.pid"
+
+nbd_server_stop()
+{
+ local NBD_PID
+ if [ -f "$nbd_pid_file" ]; then
+ read NBD_PID < "$nbd_pid_file"
+ rm -f "$nbd_pid_file"
+ if [ -n "$NBD_PID" ]; then
+ kill "$NBD_PID"
+ fi
+ fi
+ rm -f "$nbd_unix_socket"
+}
+
+nbd_server_wait_for_unix_socket()
+{
+ pid=$1
+
+ for ((i = 0; i < 300; i++))
+ do
+ if [ -r "$nbd_unix_socket" ]; then
+ return
+ fi
+ kill -s 0 $pid 2>/dev/null
+ if test $? != 0
+ then
+ echo "qemu-nbd unexpectedly quit"
+ exit 1
+ fi
+ sleep 0.1
+ done
+ echo "Failed in check of unix socket created by qemu-nbd"
+ exit 1
+}
+
+nbd_server_start_unix_socket()
+{
+ nbd_server_stop
+ $QEMU_NBD -v -t -k "$nbd_unix_socket" "$@" &
+ nbd_server_wait_for_unix_socket $!
+}
+
+nbd_server_set_tcp_port()
+{
+ (ss --help) >/dev/null 2>&1 || _notrun "ss utility not found, skipping test"
+
+ for ((port = 10809; port <= 10909; port++))
+ do
+ if ! ss -tln | grep -sqE ":$port\b"; then
+ nbd_tcp_port=$port
+ return
+ fi
+ done
+
+ echo "Cannot find free TCP port for nbd in range 10809-10909"
+ exit 1
+}
+
+nbd_server_wait_for_tcp_socket()
+{
+ pid=$1
+
+ for ((i = 0; i < 300; i++))
+ do
+ if ss -tln | grep -sqE ":$nbd_tcp_port\b"; then
+ return
+ fi
+ kill -s 0 $pid 2>/dev/null
+ if test $? != 0
+ then
+ echo "qemu-nbd unexpectedly quit"
+ exit 1
+ fi
+ sleep 0.1
+ done
+ echo "Failed in check of TCP socket created by qemu-nbd"
+ exit 1
+}
+
+nbd_server_start_tcp_socket()
+{
+ nbd_server_stop
+ $QEMU_NBD -v -t -b $nbd_tcp_addr -p $nbd_tcp_port "$@" &
+ nbd_server_wait_for_tcp_socket $!
+}
diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
index 34f4a8dc9b..b67bb34136 100644
--- a/tests/qemu-iotests/common.pattern
+++ b/tests/qemu-iotests/common.pattern
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-function do_is_allocated() {
+do_is_allocated() {
local start=$1
local size=$2
local step=$3
@@ -27,11 +27,11 @@ function do_is_allocated() {
done
}
-function is_allocated() {
+is_allocated() {
do_is_allocated "$@" | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function do_io() {
+do_io() {
local op=$1
local start=$2
local size=$3
@@ -45,22 +45,22 @@ function do_io() {
done
}
-function io_pattern() {
+io_pattern() {
do_io "$@" | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function io() {
+io() {
local start=$2
local pattern=$(( (start >> 9) % 256 ))
do_io "$@" $pattern | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function io_zero() {
+io_zero() {
do_io "$@" 0 | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function io_test() {
+io_test() {
local op=$1
local offset=$2
local cluster_size=$3
@@ -100,7 +100,7 @@ function io_test() {
offset=$((offset + num_large * ( l2_size + half_cluster )))
}
-function io_test2() {
+io_test2() {
local orig_offset=$1
local cluster_size=$2
local num=$3
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index dadde2a266..7c87b897fa 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -60,7 +60,7 @@ _in_fd=4
# $3: A string to search for in the response; if found, this indicates
# failure and the test is either aborted (if $qemu_error_no_exit
# is not set) or ${QEMU_STATUS[$1]} is set to -1 (otherwise).
-function _timed_wait_for()
+_timed_wait_for()
{
local h=${1}
shift
@@ -131,7 +131,7 @@ function _timed_wait_for()
# strings the response will be scanned for. The first of the two
# indicates success, the latter indicates failure. Failure is handled
# like a timeout.
-function _send_qemu_cmd()
+_send_qemu_cmd()
{
local h=${1}
local count=1
@@ -186,7 +186,7 @@ function _send_qemu_cmd()
# Returns:
# $QEMU_HANDLE: set to a handle value to communicate with this QEMU instance.
#
-function _launch_qemu()
+_launch_qemu()
{
local comm=
local fifo_out=
@@ -262,7 +262,7 @@ function _launch_qemu()
# If $wait is set to anything other than the empty string, the process will not
# be killed but only waited for, and any output will be forwarded to stdout. If
# $wait is empty, the process will be killed and all output will be suppressed.
-function _cleanup_qemu()
+_cleanup_qemu()
{
# QEMU_PID[], QEMU_IN[], QEMU_OUT[] all use same indices
for i in "${!QEMU_OUT[@]}"
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 70ca65b49b..e15e7a7c8e 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -160,7 +160,7 @@ fi
ORIG_TEST_IMG="$TEST_IMG"
if [ -z "$TEST_DIR" ]; then
- TEST_DIR=`pwd`/scratch
+ TEST_DIR=$PWD/scratch
fi
QEMU_TEST_DIR="${TEST_DIR}"
diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls
new file mode 100644
index 0000000000..39f17c1b99
--- /dev/null
+++ b/tests/qemu-iotests/common.tls
@@ -0,0 +1,137 @@
+#!/bin/bash
+#
+# Helpers for TLS related config
+#
+# Copyright (C) 2018 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+tls_dir="${TEST_DIR}/tls"
+
+tls_x509_cleanup()
+{
+ rm -f "${tls_dir}"/*.pem
+ rm -f "${tls_dir}"/*/*.pem
+ rmdir "${tls_dir}"/*
+ rmdir "${tls_dir}"
+}
+
+
+tls_x509_init()
+{
+ mkdir -p "${tls_dir}"
+
+ # use a fixed key so we don't waste system entropy on
+ # each test run
+ cat > "${tls_dir}/key.pem" <<EOF
+-----BEGIN PRIVATE KEY-----
+MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALVcr
+BL40Tm6yq88FBhJNw1aaoCjmtg0l4dWQZ/e9Fimx4ARxFpT+ji4FE
+Cgl9s/SGqC+1nvlkm9ViSo0j7MKDbnDB+VRHDvMAzQhA2X7e8M0n9
+rPolUY2lIVC83q0BBaOBkCj2RSmT2xTEbbC2xLukSrg2WP/ihVOxc
+kXRuyFtzAgMBAAECgYB7slBexDwXrtItAMIH6m/U+LUpNe0Xx48OL
+IOn4a4whNgO/o84uIwygUK27ZGFZT0kAGAk8CdF9hA6ArcbQ62s1H
+myxrUbF9/mrLsQw1NEqpuUk9Ay2Tx5U/wPx35S3W/X2AvR/ZpTnCn
+2q/7ym9fyiSoj86drD7BTvmKXlOnOwQJBAPOFMp4mMa9NGpGuEssO
+m3Uwbp6lhcP0cA9MK+iOmeANpoKWfBdk5O34VbmeXnGYWEkrnX+9J
+bM4wVhnnBWtgBMCQQC+qAEmvwcfhauERKYznMVUVksyeuhxhCe7EK
+mPh+U2+g0WwdKvGDgO0PPt1gq0ILEjspMDeMHVdTwkaVBo/uMhAkA
+Z5SsZyCP2aTOPFDypXRdI4eqRcjaEPOUBq27r3uYb/jeboVb2weLa
+L1MmVuHiIHoa5clswPdWVI2y0em2IGoDAkBPSp/v9VKJEZabk9Frd
+a+7u4fanrM9QrEjY3KhduslSilXZZSxrWjjAJPyPiqFb3M8XXA26W
+nz1KYGnqYKhLcBAkB7dt57n9xfrhDpuyVEv+Uv1D3VVAhZlsaZ5Pp
+dcrhrkJn2sa/+O8OKvdrPSeeu/N5WwYhJf61+CPoenMp7IFci
+-----END PRIVATE KEY-----
+EOF
+}
+
+
+tls_x509_create_root_ca()
+{
+ name=${1:-ca-cert}
+
+ cat > "${tls_dir}/ca.info" <<EOF
+cn = Cthulhu Dark Lord Enterprises $name
+ca
+cert_signing_key
+EOF
+
+ certtool --generate-self-signed \
+ --load-privkey "${tls_dir}/key.pem" \
+ --template "${tls_dir}/ca.info" \
+ --outfile "${tls_dir}/$name-cert.pem" 2>&1 | head -1
+
+ rm -f "${tls_dir}/ca.info"
+}
+
+
+tls_x509_create_server()
+{
+ caname=$1
+ name=$2
+
+ mkdir -p "${tls_dir}/$name"
+ cat > "${tls_dir}/cert.info" <<EOF
+organization = Cthulhu Dark Lord Enterprises $name
+cn = localhost
+dns_name = localhost
+dns_name = localhost.localdomain
+ip_address = 127.0.0.1
+ip_address = ::1
+tls_www_server
+encryption_key
+signing_key
+EOF
+
+ certtool --generate-certificate \
+ --load-ca-privkey "${tls_dir}/key.pem" \
+ --load-ca-certificate "${tls_dir}/$caname-cert.pem" \
+ --load-privkey "${tls_dir}/key.pem" \
+ --template "${tls_dir}/cert.info" \
+ --outfile "${tls_dir}/$name/server-cert.pem" 2>&1 | head -1
+ ln -s "${tls_dir}/$caname-cert.pem" "${tls_dir}/$name/ca-cert.pem"
+ ln -s "${tls_dir}/key.pem" "${tls_dir}/$name/server-key.pem"
+
+ rm -f "${tls_dir}/cert.info"
+}
+
+
+tls_x509_create_client()
+{
+ caname=$1
+ name=$2
+
+ mkdir -p "${tls_dir}/$name"
+ cat > "${tls_dir}/cert.info" <<EOF
+country = South Pacific
+locality = R'lyeh
+organization = Cthulhu Dark Lord Enterprises $name
+cn = localhost
+tls_www_client
+encryption_key
+signing_key
+EOF
+
+ certtool --generate-certificate \
+ --load-ca-privkey "${tls_dir}/key.pem" \
+ --load-ca-certificate "${tls_dir}/$caname-cert.pem" \
+ --load-privkey "${tls_dir}/key.pem" \
+ --template "${tls_dir}/cert.info" \
+ --outfile "${tls_dir}/$name/client-cert.pem" 2>&1 | head -1
+ ln -s "${tls_dir}/$caname-cert.pem" "${tls_dir}/$name/ca-cert.pem"
+ ln -s "${tls_dir}/key.pem" "${tls_dir}/$name/client-key.pem"
+
+ rm -f "${tls_dir}/cert.info"
+}
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index ebe4fe78bc..2722103381 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -219,6 +219,7 @@
217 rw auto quick
218 rw auto quick
219 rw auto
+220 rw auto
221 rw auto quick
222 rw auto quick
223 rw auto quick
@@ -228,3 +229,4 @@
229 auto quick
231 auto quick
232 auto quick
+233 auto quick
diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
index e80eccc0ce..fa4243fc04 100644
--- a/tests/tcg/multiarch/linux-test.c
+++ b/tests/tcg/multiarch/linux-test.c
@@ -83,7 +83,7 @@ static void test_file(void)
struct utimbuf tbuf;
struct iovec vecs[2];
DIR *dir;
- struct dirent *de;
+ struct dirent64 *de;
/* TODO: make common tempdir creation for tcg tests */
char template[] = "/tmp/linux-test-XXXXXX";
char *tmpdir = mkdtemp(template);
@@ -186,7 +186,7 @@ static void test_file(void)
error("opendir");
len = 0;
for(;;) {
- de = readdir(dir);
+ de = readdir64(dir);
if (!de)
break;
if (strcmp(de->d_name, ".") != 0 &&
diff --git a/tests/tpm-tests.c b/tests/tpm-tests.c
index 93a5beba01..582ec0cfd4 100644
--- a/tests/tpm-tests.c
+++ b/tests/tpm-tests.c
@@ -22,7 +22,7 @@ static bool
tpm_test_swtpm_skip(void)
{
if (!tpm_util_swtpm_has_tpm2()) {
- fprintf(stderr, "swtpm not in PATH or missing --tpm2 support; ");
+ g_test_message("swtpm not in PATH or missing --tpm2 support");
return true;
}
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 42a41310b0..4cf3bbc0e4 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -176,7 +176,7 @@ static void egl_headless_init(DisplayState *ds, DisplayOptions *opts)
egl_dpy *edpy;
int idx;
- if (egl_rendernode_init(NULL, mode) < 0) {
+ if (egl_rendernode_init(opts->u.egl_headless.rendernode, mode) < 0) {
error_report("egl: render node init failed");
exit(1);
}