qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

Merge remote-tracking branch 'remotes/vivier2/tags/qemu-trivial-for-3.1-pull-request' into staging

QEMU trivial patches collected between June and October 2018
(Thank you to Thomas Huth)

v2: fix 32bit build with updated patch (v3) from Philippe Mathieu-Daudé
built in a 32bit debian sid chroot

# gpg: Signature made Tue 30 Oct 2018 11:23:01 GMT
# gpg: using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg: aka "Laurent Vivier <laurent@vivier.eu>"
# gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/qemu-trivial-for-3.1-pull-request:
milkymist-minimac2: Use qemu_log_mask(GUEST_ERROR) instead of error_report
ppc: move at24c to its own CONFIG_ symbol
hw/intc/gicv3: Remove useless parenthesis around DIV_ROUND_UP macro
hw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro
tests/bios-tables-test: Remove an useless cast
xen: Use the PCI_DEVICE macro
qobject: Catch another straggler for use of qdict_put_str()
configure: Support pkg-config for zlib
tests: Fix typos in comments and help message (found by codespell)
cpu.h: fix a typo in comment
linux-user: fix comment s/atomic_write/atomic_set/
qemu-iotests: make 218 executable
scripts/qemu.py: remove trailing quotes on docstring
scripts/decodetree.py: remove unused imports
docs/devel/testing.rst: add missing newlines after code block
qemu-iotests: fix filename containing checks
tests/tcg/README: fix location for lm32 tests
memory.h: fix typos in comments
vga_int: remove unused function protype
configs/alpha: Remove unused CONFIG_PARALLEL_ISA switch

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

+64 -53
+23 -17
configure
··· 2151 2151 fi 2152 2152 fi 2153 2153 2154 - ######################################### 2155 - # zlib check 2156 - 2157 - if test "$zlib" != "no" ; then 2158 - cat > $TMPC << EOF 2159 - #include <zlib.h> 2160 - int main(void) { zlibVersion(); return 0; } 2161 - EOF 2162 - if compile_prog "" "-lz" ; then 2163 - : 2164 - else 2165 - error_exit "zlib check failed" \ 2166 - "Make sure to have the zlib libs and headers installed." 2167 - fi 2168 - fi 2169 - LIBS="$LIBS -lz" 2170 - 2171 2154 ########################################## 2172 2155 # lzo check 2173 2156 ··· 3476 3459 if cc_has_warning_flag "-Wno-unknown-attributes"; then 3477 3460 glib_cflags="-Wno-unknown-attributes $glib_cflags" 3478 3461 CFLAGS="-Wno-unknown-attributes $CFLAGS" 3462 + fi 3463 + fi 3464 + 3465 + ######################################### 3466 + # zlib check 3467 + 3468 + if test "$zlib" != "no" ; then 3469 + if $pkg_config --exists zlib; then 3470 + zlib_cflags=$($pkg_config --cflags zlib) 3471 + zlib_libs=$($pkg_config --libs zlib) 3472 + QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS" 3473 + LIBS="$zlib_libs $LIBS" 3474 + else 3475 + cat > $TMPC << EOF 3476 + #include <zlib.h> 3477 + int main(void) { zlibVersion(); return 0; } 3478 + EOF 3479 + if compile_prog "" "-lz" ; then 3480 + LIBS="$LIBS -lz" 3481 + else 3482 + error_exit "zlib check failed" \ 3483 + "Make sure to have the zlib libs and headers installed." 3484 + fi 3479 3485 fi 3480 3486 fi 3481 3487
-1
default-configs/alpha-softmmu.mak
··· 8 8 CONFIG_I8254=y 9 9 CONFIG_I8257=y 10 10 CONFIG_PARALLEL=y 11 - CONFIG_PARALLEL_ISA=y 12 11 CONFIG_FDC=y 13 12 CONFIG_PCKBD=y 14 13 CONFIG_VGA_CIRRUS=y
+1
default-configs/ppc-softmmu.mak
··· 28 28 CONFIG_DDC=y 29 29 CONFIG_IDE_SII3112=y 30 30 CONFIG_I2C=y 31 + CONFIG_AT24C=y 31 32 CONFIG_BITBANG_I2C=y 32 33 CONFIG_M41T80=y 33 34 CONFIG_VGA_CIRRUS=y
+2
docs/devel/testing.rst
··· 59 59 and gtester options. If necessary, you can run 60 60 61 61 .. code:: 62 + 62 63 make check-unit V=1 63 64 64 65 and copy the actual command line which executes the unit test, then run ··· 116 117 from the output of 117 118 118 119 .. code:: 120 + 119 121 make check-qtest V=1 120 122 121 123 which you can run manually.
+10 -5
hw/net/milkymist-minimac2.c
··· 30 30 #include "hw/sysbus.h" 31 31 #include "trace.h" 32 32 #include "net/net.h" 33 + #include "qemu/log.h" 33 34 #include "qemu/error-report.h" 34 35 35 36 #include <zlib.h> ··· 214 215 uint32_t crc; 215 216 216 217 if (size < payload_size + 12) { 217 - error_report("milkymist_minimac2: received too big ethernet frame"); 218 + qemu_log_mask(LOG_GUEST_ERROR, "milkymist_minimac2: frame too big " 219 + "(%zd bytes)\n", payload_size); 218 220 return 0; 219 221 } 220 222 ··· 347 349 break; 348 350 349 351 default: 350 - error_report("milkymist_minimac2: read access to unknown register 0x" 351 - TARGET_FMT_plx, addr << 2); 352 + qemu_log_mask(LOG_GUEST_ERROR, 353 + "milkymist_minimac2_rd%d: 0x%" HWADDR_PRIx "\n", 354 + size, addr << 2); 352 355 break; 353 356 } 354 357 ··· 413 416 break; 414 417 415 418 default: 416 - error_report("milkymist_minimac2: write access to unknown register 0x" 417 - TARGET_FMT_plx, addr << 2); 419 + qemu_log_mask(LOG_GUEST_ERROR, 420 + "milkymist_minimac2_wr%d: 0x%" HWADDR_PRIx 421 + " = 0x%" PRIx64 "\n", 422 + size, addr << 2, value); 418 423 break; 419 424 } 420 425 }
+1 -1
hw/nvram/Makefile.objs
··· 1 1 common-obj-$(CONFIG_DS1225Y) += ds1225y.o 2 2 common-obj-y += eeprom93xx.o 3 - common-obj-$(CONFIG_I2C) += eeprom_at24c.o 3 + common-obj-$(CONFIG_AT24C) += eeprom_at24c.o 4 4 common-obj-y += fw_cfg.o 5 5 common-obj-y += chrp_nvram.o 6 6 common-obj-$(CONFIG_MAC_NVRAM) += mac_nvram.o
+1 -1
hw/pci-host/piix.c
··· 144 144 memory_region_transaction_begin(); 145 145 for (i = 0; i < 13; i++) { 146 146 pam_update(&d->pam_regions[i], i, 147 - pd->config[I440FX_PAM + (DIV_ROUND_UP(i, 2))]); 147 + pd->config[I440FX_PAM + DIV_ROUND_UP(i, 2)]); 148 148 } 149 149 memory_region_set_enabled(&d->smram_region, 150 150 !(pd->config[I440FX_SMRAM] & SMRAM_D_OPEN));
+1 -1
hw/pci-host/q35.c
··· 356 356 memory_region_transaction_begin(); 357 357 for (i = 0; i < 13; i++) { 358 358 pam_update(&mch->pam_regions[i], i, 359 - pd->config[MCH_HOST_BRIDGE_PAM0 + (DIV_ROUND_UP(i, 2))]); 359 + pd->config[MCH_HOST_BRIDGE_PAM0 + DIV_ROUND_UP(i, 2)]); 360 360 } 361 361 memory_region_transaction_commit(); 362 362 }
+4 -4
hw/xen/xen_pt_config_init.c
··· 358 358 static XenPTBarFlag xen_pt_bar_reg_parse(XenPCIPassthroughState *s, 359 359 int index) 360 360 { 361 - PCIDevice *d = &s->dev; 361 + PCIDevice *d = PCI_DEVICE(s); 362 362 XenPTRegion *region = NULL; 363 363 PCIIORegion *r; 364 364 ··· 469 469 { 470 470 XenPTRegInfo *reg = cfg_entry->reg; 471 471 XenPTRegion *base = NULL; 472 - PCIDevice *d = &s->dev; 472 + PCIDevice *d = PCI_DEVICE(s); 473 473 const PCIIORegion *r; 474 474 uint32_t writable_mask = 0; 475 475 uint32_t bar_emu_mask = 0; ··· 543 543 { 544 544 XenPTRegInfo *reg = cfg_entry->reg; 545 545 XenPTRegion *base = NULL; 546 - PCIDevice *d = (PCIDevice *)&s->dev; 546 + PCIDevice *d = PCI_DEVICE(s); 547 547 uint32_t writable_mask = 0; 548 548 uint32_t throughable_mask = get_throughable_mask(s, reg, valid_mask); 549 549 pcibus_t r_size = 0; ··· 1587 1587 const XenPTRegGroupInfo *grp_reg, 1588 1588 uint32_t base_offset, uint8_t *size) 1589 1589 { 1590 - PCIDevice *d = &s->dev; 1590 + PCIDevice *d = PCI_DEVICE(s); 1591 1591 uint8_t version = get_capability_version(s, base_offset); 1592 1592 uint8_t type = get_device_type(s, base_offset); 1593 1593 uint8_t pcie_size = 0;
+3 -3
include/exec/memory.h
··· 935 935 /** 936 936 * memory_region_is_ram: check whether a memory region is random access 937 937 * 938 - * Returns %true is a memory region is random access. 938 + * Returns %true if a memory region is random access. 939 939 * 940 940 * @mr: the memory region being queried 941 941 */ ··· 947 947 /** 948 948 * memory_region_is_ram_device: check whether a memory region is a ram device 949 949 * 950 - * Returns %true is a memory region is a device backed ram region 950 + * Returns %true if a memory region is a device backed ram region 951 951 * 952 952 * @mr: the memory region being queried 953 953 */ ··· 1161 1161 /** 1162 1162 * memory_region_is_rom: check whether a memory region is ROM 1163 1163 * 1164 - * Returns %true is a memory region is read-only memory. 1164 + * Returns %true if a memory region is read-only memory. 1165 1165 * 1166 1166 * @mr: the memory region being queried 1167 1167 */
+1 -1
include/hw/intc/arm_gicv3_common.h
··· 62 62 * avoids bugs where we forget to subtract GIC_INTERNAL from an 63 63 * interrupt number. 64 64 */ 65 - #define GICV3_BMP_SIZE (DIV_ROUND_UP(GICV3_MAXIRQ, 32)) 65 + #define GICV3_BMP_SIZE DIV_ROUND_UP(GICV3_MAXIRQ, 32) 66 66 67 67 #define GIC_DECLARE_BITMAP(name) \ 68 68 uint32_t name[GICV3_BMP_SIZE]
+1 -1
include/qom/cpu.h
··· 852 852 /** 853 853 * cpu_interrupt: 854 854 * @cpu: The CPU to set an interrupt on. 855 - * @mask: The interupts to set. 855 + * @mask: The interrupts to set. 856 856 * 857 857 * Invokes the interrupt handler. 858 858 */
+1 -1
linux-user/qemu.h
··· 147 147 /* Nonzero if process_pending_signals() needs to do something (either 148 148 * handle a pending signal or unblock signals). 149 149 * This flag is written from a signal handler so should be accessed via 150 - * the atomic_read() and atomic_write() functions. (It is not accessed 150 + * the atomic_read() and atomic_set() functions. (It is not accessed 151 151 * from multiple threads.) 152 152 */ 153 153 int signal_pending;
+1 -1
qobject/block-qdict.c
··· 577 577 if (!tmp) { 578 578 tmp = qdict_clone_shallow(src); 579 579 } 580 - qdict_put(tmp, ent->key, qstring_from_str(s)); 580 + qdict_put_str(tmp, ent->key, s); 581 581 g_free(buf); 582 582 } 583 583
-2
scripts/decodetree.py
··· 149 149 # trans_addl_i(ctx, &arg_opi, insn) 150 150 # 151 151 152 - import io 153 152 import os 154 153 import re 155 154 import sys 156 155 import getopt 157 - import pdb 158 156 159 157 insnwidth = 32 160 158 insnmask = 0xffffffff
+1 -1
scripts/qemu.py
··· 93 93 @param name: prefix for socket and log file names (default: qemu-PID) 94 94 @param test_dir: where to create socket and log file 95 95 @param monitor_address: address for QMP monitor 96 - @param socket_scm_helper: helper program, required for send_fd_scm()" 96 + @param socket_scm_helper: helper program, required for send_fd_scm() 97 97 @note: Qemu process is not started until launch() is used. 98 98 ''' 99 99 if args is None:
+2 -2
tests/bios-tables-test.c
··· 319 319 ret = g_spawn_command_line_sync(command_line->str, &out, &out_err, NULL, &error); 320 320 g_assert_no_error(error); 321 321 if (ret) { 322 - ret = g_file_get_contents(sdt->asl_file, (gchar **)&sdt->asl, 322 + ret = g_file_get_contents(sdt->asl_file, &sdt->asl, 323 323 &sdt->asl_len, &error); 324 324 g_assert(ret); 325 325 g_assert_no_error(error); ··· 390 390 if (g_file_test(aml_file, G_FILE_TEST_EXISTS)) { 391 391 exp_sdt.aml_file = aml_file; 392 392 } else if (*ext != '\0') { 393 - /* try fallback to generic (extention less) expected file */ 393 + /* try fallback to generic (extension less) expected file */ 394 394 ext = ""; 395 395 g_free(aml_file); 396 396 goto try_again;
+1 -1
tests/docker/Makefile.include
··· 41 41 docker-image: ${DOCKER_TARGETS} 42 42 43 43 # General rule for building docker images. If we are a sub-make 44 - # invoked with SKIP_DOCKER_BUILD we still check the image is upto date 44 + # invoked with SKIP_DOCKER_BUILD we still check the image is up to date 45 45 # though 46 46 ifdef SKIP_DOCKER_BUILD 47 47 docker-image-%: $(DOCKER_FILES_DIR)/%.docker
+2 -2
tests/docker/docker.py
··· 97 97 return libs 98 98 99 99 def _copy_binary_with_libs(src, dest_dir): 100 - """Copy a binary executable and all its dependant libraries. 100 + """Copy a binary executable and all its dependent libraries. 101 101 102 102 This does rely on the host file-system being fairly multi-arch 103 103 aware so the file don't clash with the guests layout.""" ··· 284 284 name = None # Subcommand name 285 285 def shared_args(self, parser): 286 286 parser.add_argument("--quiet", action="store_true", 287 - help="Run quietly unless an error occured") 287 + help="Run quietly unless an error occurred") 288 288 289 289 def args(self, parser): 290 290 """Setup argument parser"""
+1 -1
tests/guest-debug/test-gdbstub.py
··· 122 122 123 123 124 124 def run_test(): 125 - "Run throught the tests one by one" 125 + "Run through the tests one by one" 126 126 127 127 print ("Checking we can step the first few instructions") 128 128 step_ok = 0
tests/qemu-iotests/218
+1 -1
tests/qemu-iotests/common.qemu
··· 257 257 } 258 258 259 259 260 - # Silenty kills the QEMU process 260 + # Silently kills the QEMU process 261 261 # 262 262 # If $wait is set to anything other than the empty string, the process will not 263 263 # be killed but only waited for, and any output will be forwarded to stdout. If
+2 -2
tests/qemu-iotests/common.rc
··· 170 170 fi 171 171 172 172 if [ ! -d "$TEST_DIR" ]; then 173 - echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory" 173 + echo "common.rc: Error: \$TEST_DIR ($TEST_DIR) is not a directory" 174 174 exit 1 175 175 fi 176 176 ··· 179 179 fi 180 180 181 181 if [ ! -d "$SAMPLE_IMG_DIR" ]; then 182 - echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory" 182 + echo "common.rc: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory" 183 183 exit 1 184 184 fi 185 185
+1 -1
tests/tcg/Makefile.include
··· 2 2 # 3 3 # TCG tests (per-target rules) 4 4 # 5 - # This Makefile fragement is included from the per-target 5 + # This Makefile fragment is included from the per-target 6 6 # Makefile.target so will be invoked for each linux-user program we 7 7 # build. We have two options for compiling, either using a configured 8 8 # guest compiler or calling one of our docker images to do it for us.
+1 -1
tests/tcg/Makefile.probe
··· 2 2 # 3 3 # TCG Compiler Probe 4 4 # 5 - # This Makefile fragement is included multiple times in the main make 5 + # This Makefile fragment is included multiple times in the main make 6 6 # script to probe for available compilers. This is used to build up a 7 7 # selection of required docker targets before we invoke a sub-make for 8 8 # each target.
+1 -1
tests/tcg/README
··· 10 10 11 11 LM32 12 12 ==== 13 - The testsuite for LM32 is in tests/tcg/cris. You can run it 13 + The testsuite for LM32 is in tests/tcg/lm32. You can run it 14 14 with "make test-lm32". 15 15
+1 -1
tests/tcg/mips/mips64-dsp/subq_s_pw.c
··· 24 24 rt = 0x123456789ABCDEF1; 25 25 rs = 0x123456789ABCDEF2; 26 26 result = 0x0000000000000001; 27 - /* This time we do not set dspctrl, but it setted in pre-action. */ 27 + /* This time we do not set dspctrl, but set it in pre-action. */ 28 28 dspresult = 0x1; 29 29 30 30 __asm