From cba42d61a379bc1c983ddb39d479de3581d2d578 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Tue, 9 Mar 2021 14:15:10 +0300 Subject: [PATCH 01/22] Various spelling fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An assorted set of spelling fixes in various places. Signed-off-by: Michael Tokarev Reviewed-by: Stefan Weil Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Message-Id: <20210309111510.79495-1-mjt@msgid.tls.msk.ru> Signed-off-by: Laurent Vivier --- disas/nanomips.cpp | 2 +- hw/misc/trace-events | 2 +- hw/net/allwinner-sun8i-emac.c | 2 +- hw/ppc/pnv_bmc.c | 2 +- hw/usb/ccid-card-emulated.c | 2 +- hw/usb/hcd-ohci.c | 2 +- hw/virtio/vhost.c | 2 +- include/hw/s390x/css.h | 2 +- qemu-options.hx | 4 ++-- target/i386/cpu.c | 2 +- target/i386/machine.c | 2 +- target/m68k/op_helper.c | 2 +- target/riscv/cpu.c | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index 90e63b836746..2b0965527194 100644 --- a/disas/nanomips.cpp +++ b/disas/nanomips.cpp @@ -837,7 +837,7 @@ int NMD::Disassemble(const uint16 * data, std::string & dis, * an ASE attribute and the requested version * not having that attribute */ - dis = "ASE attribute missmatch"; + dis = "ASE attribute mismatch"; return -5; } disassembly_function dis_fn = table[i].disassembly; diff --git a/hw/misc/trace-events b/hw/misc/trace-events index d626b9d7a7c6..ef0a4de39d50 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -127,7 +127,7 @@ npcm7xx_pwm_update_freq(const char *id, uint8_t index, uint32_t old_value, uint3 npcm7xx_pwm_update_duty(const char *id, uint8_t index, uint32_t old_value, uint32_t new_value) "%s pwm[%u] Update Duty: old_duty: %u, new_duty: %u" # stm32f4xx_syscfg.c -stm32f4xx_syscfg_set_irq(int gpio, int line, int level) "Interupt: GPIO: %d, Line: %d; Level: %d" +stm32f4xx_syscfg_set_irq(int gpio, int line, int level) "Interrupt: GPIO: %d, Line: %d; Level: %d" stm32f4xx_pulse_exti(int irq) "Pulse EXTI: %d" stm32f4xx_syscfg_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " " stm32f4xx_syscfg_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 "" diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c index 042768922c97..bf91803d65a8 100644 --- a/hw/net/allwinner-sun8i-emac.c +++ b/hw/net/allwinner-sun8i-emac.c @@ -579,7 +579,7 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset, case REG_INT_STA: /* Interrupt Status */ value = s->int_sta; break; - case REG_INT_EN: /* Interupt Enable */ + case REG_INT_EN: /* Interrupt Enable */ value = s->int_en; break; case REG_TX_CTL_0: /* Transmit Control 0 */ diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c index b9bf5735ea0f..75a22ce50b11 100644 --- a/hw/ppc/pnv_bmc.c +++ b/hw/ppc/pnv_bmc.c @@ -233,7 +233,7 @@ static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, case HIOMAP_C_RESET: case HIOMAP_C_LOCK: default: - qemu_log_mask(LOG_GUEST_ERROR, "HIOMAP: unknow command %02X\n", cmd[2]); + qemu_log_mask(LOG_GUEST_ERROR, "HIOMAP: unknown command %02X\n", cmd[2]); break; } } diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 2d566f7db104..5c76bed77aa0 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -301,7 +301,7 @@ static void *event_thread(void *arg) } else { if (event->reader != card->reader) { fprintf(stderr, - "ERROR: wrong reader: quiting event_thread\n"); + "ERROR: wrong reader: quitting event_thread\n"); break; } } diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index f8c64c8b95bb..1cf2816772c5 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1126,7 +1126,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) OHCI_SET_BM(td.flags, TD_EC, 3); break; } - /* An error occured so we have to clear the interrupt counter. See + /* An error occurred so we have to clear the interrupt counter. See * spec at 6.4.4 on page 104 */ ohci->done_count = 0; } diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 2a01662b0882..e2163a0d63ed 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -909,7 +909,7 @@ static int vhost_migration_log(MemoryListener *listener, bool enable) r = 0; } if (r) { - /* An error is occured. */ + /* An error occurred. */ dev->log_enabled = false; } diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index 08c869ab0afc..7901ab276ce9 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -133,7 +133,7 @@ struct SubchDev { bool ccw_fmt_1; bool thinint_active; uint8_t ccw_no_data_cnt; - uint16_t migrated_schid; /* used for missmatch detection */ + uint16_t migrated_schid; /* used for mismatch detection */ CcwDataStream cds; /* transport-provided data: */ int (*ccw_cb) (SubchDev *, CCW1); diff --git a/qemu-options.hx b/qemu-options.hx index 90801286c6e2..c324633fcaad 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -176,7 +176,7 @@ SRST ``thread=single|multi`` Controls number of TCG threads. When the TCG is multi-threaded - there will be one thread per vCPU therefor taking advantage of + there will be one thread per vCPU therefore taking advantage of additional host cores. The default is to enable multi-threading where both the back-end and front-ends support it and no incompatible TCG features have been enabled (e.g. @@ -2445,7 +2445,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, " use 'vhostfd=h' to connect to an already opened vhost net device\n" " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n" " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n" - " use 'poll-us=n' to speciy the maximum number of microseconds that could be\n" + " use 'poll-us=n' to specify the maximum number of microseconds that could be\n" " spent on busy polling for vhost net\n" "-netdev bridge,id=str[,br=bridge][,helper=helper]\n" " configure a host TAP network backend with ID 'str' that is\n" diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 50008431c356..ae9fd9f31d68 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7081,7 +7081,7 @@ static void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v, GuestPanicInformation *panic_info; if (!cs->crash_occurred) { - error_setg(errp, "No crash occured"); + error_setg(errp, "No crash occurred"); return; } diff --git a/target/i386/machine.c b/target/i386/machine.c index 3768a753affb..3967dfc25763 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -1173,7 +1173,7 @@ static int nested_state_post_load(void *opaque, int version_id) return -EINVAL; } if (nested_state->size > max_nested_state_len) { - error_report("Recieved unsupported nested state size: " + error_report("Received unsupported nested state size: " "nested_state->size=%d, max=%d", nested_state->size, max_nested_state_len); return -EINVAL; diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 202498deb51a..579a66373a86 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -117,7 +117,7 @@ static const char *m68k_exception_name(int index) case EXCP_FORMAT: return "Format Error"; case EXCP_UNINITIALIZED: - return "Unitialized Interruot"; + return "Uninitialized Interrupt"; case EXCP_SPURIOUS: return "Spurious Interrupt"; case EXCP_INT_LEVEL_1: diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index ddea8fbeeb39..2a990f6253e0 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -506,7 +506,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) return; } } else { - qemu_log("vector verison is not specified, " + qemu_log("vector version is not specified, " "use the default value v0.7.1\n"); } set_vext_version(env, vext_version); From e91bae8e98a6438156752dfbe9c0e2494d4b80f6 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 9 Feb 2021 09:23:50 -0600 Subject: [PATCH 02/22] scsi: Silence gcc warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Fedora 33, gcc 10.2.1 notes that scsi_cdb_length(buf) can set len==-1, which in turn overflows g_malloc(): [5/5] Linking target qemu-system-x86_64 In function ‘scsi_disk_new_request_dump’, inlined from ‘scsi_new_request’ at ../hw/scsi/scsi-disk.c:2608:9: ../hw/scsi/scsi-disk.c:2582:19: warning: argument 1 value ‘18446744073709551612’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=] 2582 | line_buffer = g_malloc(len * 5 + 1); | ^ Silence it with a decent assertion, since we only convert a buffer to bytes when we have a valid cdb length. Signed-off-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210209152350.207958-1-eblake@redhat.com> Signed-off-by: Laurent Vivier --- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index bd7103cd0e8a..2eaea7e637d8 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2565,6 +2565,7 @@ static void scsi_disk_new_request_dump(uint32_t lun, uint32_t tag, uint8_t *buf) int len = scsi_cdb_length(buf); char *line_buffer, *p; + assert(len > 0 && len <= 16); line_buffer = g_malloc(len * 5 + 1); for (i = 0, p = line_buffer; i < len; i++) { From f413e514a9133c1e63dae8f1f3a9ca0286c7a513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 25 Feb 2021 19:13:44 +0100 Subject: [PATCH 03/22] hw/elf_ops: Fix a typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit g_mapped_file_new_from_fd()'s parameter is named 'writable'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefano Garzarella Reviewed-by: David Edmondson Message-Id: <20210225181344.3623720-1-philmd@redhat.com> Signed-off-by: Laurent Vivier --- include/hw/elf_ops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 78409ab34a9f..6ee458e7bc3c 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -417,7 +417,7 @@ static int glue(load_elf, SZ)(const char *name, int fd, /* * Since we want to be able to modify the mapped buffer, we set the - * 'writeble' parameter to 'true'. Modifications to the buffer are not + * 'writable' parameter to 'true'. Modifications to the buffer are not * written back to the file. */ mapped_file = g_mapped_file_new_from_fd(fd, true, NULL); From fc253f4a4b59e19c25df21232651d9c92220011f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 25 Feb 2021 19:15:07 +0100 Subject: [PATCH 04/22] target/hexagon/gen_tcg_funcs: Fix a typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Taylor Simpson Message-Id: <20210225181507.3624509-1-f4bug@amsat.org> Signed-off-by: Laurent Vivier --- target/hexagon/gen_tcg_funcs.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs.py index fe4d8e57303a..db9f663a778e 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -35,7 +35,7 @@ def gen_decl_ea_tcg(f, tag): def gen_free_ea_tcg(f): f.write(" tcg_temp_free(EA);\n") -def genptr_decl_pair_writeble(f, tag, regtype, regid, regno): +def genptr_decl_pair_writable(f, tag, regtype, regid, regno): regN="%s%sN" % (regtype,regid) f.write(" TCGv_i64 %s%sV = tcg_temp_local_new_i64();\n" % \ (regtype, regid)) @@ -54,7 +54,7 @@ def genptr_decl_pair_writeble(f, tag, regtype, regid, regno): (regN, regN)) f.write(" }\n") -def genptr_decl_writeble(f, tag, regtype, regid, regno): +def genptr_decl_writable(f, tag, regtype, regid, regno): regN="%s%sN" % (regtype,regid) f.write(" TCGv %s%sV = tcg_temp_local_new();\n" % \ (regtype, regid)) @@ -78,12 +78,12 @@ def genptr_decl(f, tag, regtype, regid, regno): f.write(" const int %s = insn->regno[%d];\n" % \ (regN, regno)) elif (regid in {"dd", "ee", "xx", "yy"}): - genptr_decl_pair_writeble(f, tag, regtype, regid, regno) + genptr_decl_pair_writable(f, tag, regtype, regid, regno) elif (regid in {"s", "t", "u", "v"}): f.write(" TCGv %s%sV = hex_gpr[insn->regno[%d]];\n" % \ (regtype, regid, regno)) elif (regid in {"d", "e", "x", "y"}): - genptr_decl_writeble(f, tag, regtype, regid, regno) + genptr_decl_writable(f, tag, regtype, regid, regno) else: print("Bad register parse: ", regtype, regid) elif (regtype == "P"): @@ -91,7 +91,7 @@ def genptr_decl(f, tag, regtype, regid, regno): f.write(" TCGv %s%sV = hex_pred[insn->regno[%d]];\n" % \ (regtype, regid, regno)) elif (regid in {"d", "e", "x"}): - genptr_decl_writeble(f, tag, regtype, regid, regno) + genptr_decl_writable(f, tag, regtype, regid, regno) else: print("Bad register parse: ", regtype, regid) elif (regtype == "C"): @@ -101,14 +101,14 @@ def genptr_decl(f, tag, regtype, regid, regno): f.write(" const int %s = insn->regno[%d] + HEX_REG_SA0;\n" % \ (regN, regno)) elif (regid == "dd"): - genptr_decl_pair_writeble(f, tag, regtype, regid, regno) + genptr_decl_pair_writable(f, tag, regtype, regid, regno) elif (regid == "s"): f.write(" TCGv %s%sV = tcg_temp_local_new();\n" % \ (regtype, regid)) f.write(" const int %s%sN = insn->regno[%d] + HEX_REG_SA0;\n" % \ (regtype, regid, regno)) elif (regid == "d"): - genptr_decl_writeble(f, tag, regtype, regid, regno) + genptr_decl_writable(f, tag, regtype, regid, regno) else: print("Bad register parse: ", regtype, regid) elif (regtype == "M"): From 166a1cf404cdea4c5839e3bd3028a6d28cb25b43 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 26 Jan 2021 13:42:39 +0100 Subject: [PATCH 05/22] backends/dbus-vmstate: Fix short read error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When dbus_vmstate_post_load() fails, it complains to stderr. Except on short read, where it checks with g_return_val_if_fail(). This fails silently if G_DISABLE_CHECKS is undefined (it should be), or else pads the short read with uninitialized bytes. Replace g_return_val_if_fail() by a proper error check. Fixes: 5010cec2bc87dafab39b3913c8ca91f88df9c540 Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Message-Id: <20210126124240.2081959-2-armbru@redhat.com> Signed-off-by: Laurent Vivier --- backends/dbus-vmstate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c index bd050e8e9cab..2a0d2e4a31c0 100644 --- a/backends/dbus-vmstate.c +++ b/backends/dbus-vmstate.c @@ -229,7 +229,10 @@ static int dbus_vmstate_post_load(void *opaque, int version_id) &bytes_read, NULL, &err)) { goto error; } - g_return_val_if_fail(bytes_read == len, -1); + if (bytes_read != len) { + error_report("%s: Short read", __func__); + return -1; + } id[len] = 0; trace_dbus_vmstate_loading(id); From f2a6fe7b3af726c31360678cf4f55829dae32505 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 26 Jan 2021 13:42:40 +0100 Subject: [PATCH 06/22] vhost_user_gpu: Drop dead check for g_malloc() failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Reviewed-by: Michael S. Tsirkin Message-Id: <20210126124240.2081959-3-armbru@redhat.com> Signed-off-by: Laurent Vivier --- hw/display/vhost-user-gpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index a01f9315e199..6cdaa1c73b9b 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -325,7 +325,6 @@ vhost_user_gpu_chr_read(void *opaque) } msg = g_malloc(VHOST_USER_GPU_HDR_SIZE + size); - g_return_if_fail(msg != NULL); r = qemu_chr_fe_read_all(&g->vhost_chr, (uint8_t *)&msg->payload, size); From 33b2b388a54e69ba307356eb8cfdd9894112ae3f Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Thu, 4 Feb 2021 10:54:25 -0300 Subject: [PATCH 07/22] MAINTAINERS: Fix the location of tools manuals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The qemu-img.rst, qemu-nbd.rst, virtfs-proxy-helper.rst, qemu-trace-stap.rst, and virtiofsd.rst manuals were moved to docs/tools, so this update MAINTAINERS accordingly. Fixes: a08b4a9fe6c ("docs: Move tools documentation to tools manual") Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20210204135425.1380280-1-wainersm@redhat.com> Signed-off-by: Laurent Vivier --- MAINTAINERS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index f22d83c17823..ad28f37bc5ff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1862,7 +1862,7 @@ S: Odd Fixes F: hw/9pfs/ X: hw/9pfs/xen-9p* F: fsdev/ -F: docs/interop/virtfs-proxy-helper.rst +F: docs/tools/virtfs-proxy-helper.rst F: tests/qtest/virtio-9p-test.c T: git https://gitlab.com/gkurz/qemu.git 9p-next T: git https://github.com/cschoenebeck/qemu.git 9p.next @@ -1893,7 +1893,7 @@ S: Supported F: tools/virtiofsd/* F: hw/virtio/vhost-user-fs* F: include/hw/virtio/vhost-user-fs.h -F: docs/interop/virtiofsd.rst +F: docs/tools/virtiofsd.rst virtio-input M: Gerd Hoffmann @@ -2200,7 +2200,7 @@ F: block/ F: hw/block/ F: include/block/ F: qemu-img* -F: docs/interop/qemu-img.rst +F: docs/tools/qemu-img.rst F: qemu-io* F: tests/qemu-iotests/ F: util/qemu-progress.c @@ -2656,7 +2656,7 @@ F: qapi/trace.json F: scripts/tracetool.py F: scripts/tracetool/ F: scripts/qemu-trace-stap* -F: docs/interop/qemu-trace-stap.rst +F: docs/tools/qemu-trace-stap.rst F: docs/devel/tracing.txt T: git https://github.com/stefanha/qemu.git tracing @@ -3047,7 +3047,7 @@ F: include/block/nbd* F: qemu-nbd.* F: blockdev-nbd.c F: docs/interop/nbd.txt -F: docs/interop/qemu-nbd.rst +F: docs/tools/qemu-nbd.rst T: git https://repo.or.cz/qemu/ericb.git nbd NFS From 27eb3722e439ccf7ef37ec39592acc9ebc5c687f Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Mon, 15 Feb 2021 10:02:25 +0100 Subject: [PATCH 08/22] net: Use id_generate() in the network subsystem, too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already got a global function called id_generate() to create unique IDs within QEMU. Let's use it in the network subsytem, too, instead of inventing our own ID scheme here. Signed-off-by: Thomas Huth Reviewed-by: Marc-André Lureau Message-Id: <20210215090225.1046239-1-thuth@redhat.com> Signed-off-by: Laurent Vivier --- include/qemu/id.h | 1 + net/net.c | 6 +++--- util/id.c | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/qemu/id.h b/include/qemu/id.h index b55c406e69db..46b759b284f3 100644 --- a/include/qemu/id.h +++ b/include/qemu/id.h @@ -5,6 +5,7 @@ typedef enum IdSubSystems { ID_QDEV, ID_BLOCK, ID_CHR, + ID_NET, ID_MAX /* last element, used as array size */ } IdSubSystems; diff --git a/net/net.c b/net/net.c index fb7b7dcc2528..ca30df963d77 100644 --- a/net/net.c +++ b/net/net.c @@ -43,6 +43,7 @@ #include "qemu/cutils.h" #include "qemu/config-file.h" #include "qemu/ctype.h" +#include "qemu/id.h" #include "qemu/iov.h" #include "qemu/qemu-print.h" #include "qemu/main-loop.h" @@ -1111,8 +1112,7 @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp) /* Create an ID for -net if the user did not specify one */ if (!is_netdev && !qemu_opts_id(opts)) { - static int idx; - qemu_opts_set_id(opts, g_strdup_printf("__org.qemu.net%i", idx++)); + qemu_opts_set_id(opts, id_generate(ID_NET)); } if (visit_type_Netdev(v, NULL, &object, errp)) { @@ -1467,7 +1467,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) /* Create an ID if the user did not specify one */ nd_id = g_strdup(qemu_opts_id(opts)); if (!nd_id) { - nd_id = g_strdup_printf("__org.qemu.nic%i", idx); + nd_id = id_generate(ID_NET); qemu_opts_set_id(opts, nd_id); } diff --git a/util/id.c b/util/id.c index 5addb4460ea0..ded41c5025e4 100644 --- a/util/id.c +++ b/util/id.c @@ -35,6 +35,7 @@ static const char *const id_subsys_str[ID_MAX] = { [ID_QDEV] = "qdev", [ID_BLOCK] = "block", [ID_CHR] = "chr", + [ID_NET] = "net", }; /* From c8ffacbf7ccf56757157a9551f5d536938b6507f Mon Sep 17 00:00:00 2001 From: Alexander Bulekov Date: Tue, 16 Feb 2021 13:13:15 -0500 Subject: [PATCH 09/22] fuzz-test: remove unneccessary debugging flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These flags cause the output to look strange for 'make check', and they aren't needed to reproduce bugs, if they reappear. Suggested-by: Peter Maydell Signed-off-by: Alexander Bulekov Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210216181316.794276-1-alxndr@bu.edu> Signed-off-by: Laurent Vivier --- tests/qtest/fuzz-test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c index cdb1100a0b81..6f161c93be71 100644 --- a/tests/qtest/fuzz-test.c +++ b/tests/qtest/fuzz-test.c @@ -39,8 +39,7 @@ static void test_lp1878642_pci_bus_get_irq_level_assert(void) QTestState *s; s = qtest_init("-M pc-q35-5.0 " - "-nographic -monitor none -serial none " - "-d guest_errors -trace pci*"); + "-nographic -monitor none -serial none"); qtest_outl(s, 0xcf8, 0x8400f841); qtest_outl(s, 0xcfc, 0xebed205d); From d32335e8ed89851b0359cacc04890d0f8b7683bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 25 Feb 2021 19:20:03 +0100 Subject: [PATCH 10/22] exec/memory: Use struct Object typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We forward-declare Object typedef in "qemu/typedefs.h" since commit ca27b5eb7cd ("qom/object: Move Object typedef to 'qemu/typedefs.h'"). Use it everywhere to make the code simpler. Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson Reviewed-by: Laurent Vivier Message-Id: <20210225182003.3629342-1-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/ppc/pnv_xscom.c | 2 +- include/exec/memory.h | 32 ++++++++++++++++---------------- include/hw/ppc/pnv_xscom.h | 2 +- softmmu/memory.c | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c index e9ae1569ffcf..be7018e8ac59 100644 --- a/hw/ppc/pnv_xscom.c +++ b/hw/ppc/pnv_xscom.c @@ -308,7 +308,7 @@ void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset, MemoryRegion *mr) } void pnv_xscom_region_init(MemoryRegion *mr, - struct Object *owner, + Object *owner, const MemoryRegionOps *ops, void *opaque, const char *name, diff --git a/include/exec/memory.h b/include/exec/memory.h index c6fb714e499c..54ccf1a5f09b 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -828,7 +828,7 @@ static inline bool MemoryRegionSection_eq(MemoryRegionSection *a, * @size: size of the region; any subregions beyond this size will be clipped */ void memory_region_init(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size); @@ -876,7 +876,7 @@ void memory_region_unref(MemoryRegion *mr); * @size: size of the region. */ void memory_region_init_io(MemoryRegion *mr, - struct Object *owner, + Object *owner, const MemoryRegionOps *ops, void *opaque, const char *name, @@ -898,7 +898,7 @@ void memory_region_init_io(MemoryRegion *mr, * RAM memory region to be migrated; that is the responsibility of the caller. */ void memory_region_init_ram_nomigrate(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, Error **errp); @@ -920,7 +920,7 @@ void memory_region_init_ram_nomigrate(MemoryRegion *mr, * The only difference is part of the RAM region can be remapped. */ void memory_region_init_ram_shared_nomigrate(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, bool share, @@ -946,7 +946,7 @@ void memory_region_init_ram_shared_nomigrate(MemoryRegion *mr, * RAM memory region to be migrated; that is the responsibility of the caller. */ void memory_region_init_resizeable_ram(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, uint64_t max_size, @@ -979,7 +979,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr, * RAM memory region to be migrated; that is the responsibility of the caller. */ void memory_region_init_ram_from_file(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, uint64_t align, @@ -1005,7 +1005,7 @@ void memory_region_init_ram_from_file(MemoryRegion *mr, * RAM memory region to be migrated; that is the responsibility of the caller. */ void memory_region_init_ram_from_fd(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, bool share, @@ -1030,7 +1030,7 @@ void memory_region_init_ram_from_fd(MemoryRegion *mr, * RAM memory region to be migrated; that is the responsibility of the caller. */ void memory_region_init_ram_ptr(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, void *ptr); @@ -1058,7 +1058,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr, * (For RAM device memory regions, migrating the contents rarely makes sense.) */ void memory_region_init_ram_device_ptr(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, void *ptr); @@ -1076,7 +1076,7 @@ void memory_region_init_ram_device_ptr(MemoryRegion *mr, * @size: size of the region. */ void memory_region_init_alias(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, MemoryRegion *orig, hwaddr offset, @@ -1101,7 +1101,7 @@ void memory_region_init_alias(MemoryRegion *mr, * @errp: pointer to Error*, to store an error if it happens. */ void memory_region_init_rom_nomigrate(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, Error **errp); @@ -1124,7 +1124,7 @@ void memory_region_init_rom_nomigrate(MemoryRegion *mr, * @errp: pointer to Error*, to store an error if it happens. */ void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, - struct Object *owner, + Object *owner, const MemoryRegionOps *ops, void *opaque, const char *name, @@ -1183,7 +1183,7 @@ void memory_region_init_iommu(void *_iommu_mr, * If you pass a non-NULL non-device @owner then we will assert. */ void memory_region_init_ram(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, Error **errp); @@ -1210,7 +1210,7 @@ void memory_region_init_ram(MemoryRegion *mr, * @errp: pointer to Error*, to store an error if it happens. */ void memory_region_init_rom(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, Error **errp); @@ -1241,7 +1241,7 @@ void memory_region_init_rom(MemoryRegion *mr, * @errp: pointer to Error*, to store an error if it happens. */ void memory_region_init_rom_device(MemoryRegion *mr, - struct Object *owner, + Object *owner, const MemoryRegionOps *ops, void *opaque, const char *name, @@ -1254,7 +1254,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, * * @mr: the memory region being queried. */ -struct Object *memory_region_owner(MemoryRegion *mr); +Object *memory_region_owner(MemoryRegion *mr); /** * memory_region_size: get a memory region's size. diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h index 8578f5a207df..2ff9f7a8d6fe 100644 --- a/include/hw/ppc/pnv_xscom.h +++ b/include/hw/ppc/pnv_xscom.h @@ -139,7 +139,7 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset, void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset, MemoryRegion *mr); void pnv_xscom_region_init(MemoryRegion *mr, - struct Object *owner, + Object *owner, const MemoryRegionOps *ops, void *opaque, const char *name, diff --git a/softmmu/memory.c b/softmmu/memory.c index 874a8fccdee4..91f1bf47c301 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1581,7 +1581,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr, #ifdef CONFIG_POSIX void memory_region_init_ram_from_file(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, uint64_t align, @@ -1607,7 +1607,7 @@ void memory_region_init_ram_from_file(MemoryRegion *mr, } void memory_region_init_ram_from_fd(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, bool share, @@ -1679,7 +1679,7 @@ void memory_region_init_alias(MemoryRegion *mr, } void memory_region_init_rom_nomigrate(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, Error **errp) @@ -3205,7 +3205,7 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled) } void memory_region_init_ram(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, Error **errp) @@ -3229,7 +3229,7 @@ void memory_region_init_ram(MemoryRegion *mr, } void memory_region_init_rom(MemoryRegion *mr, - struct Object *owner, + Object *owner, const char *name, uint64_t size, Error **errp) @@ -3253,7 +3253,7 @@ void memory_region_init_rom(MemoryRegion *mr, } void memory_region_init_rom_device(MemoryRegion *mr, - struct Object *owner, + Object *owner, const MemoryRegionOps *ops, void *opaque, const char *name, From c64b1d40d6f266dab1362c6eccfda7f3c164d680 Mon Sep 17 00:00:00 2001 From: lijiejun Date: Tue, 9 Mar 2021 04:14:10 -0800 Subject: [PATCH 11/22] virtio-gpu: Adjust code space style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix code style. Operator needs align with eight spaces, and delete line space. Signed-off-by: lijiejun Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1615292050-108748-1-git-send-email-a_lijiejun@163.com> Signed-off-by: Laurent Vivier --- hw/display/virtio-gpu-3d.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 9eb489077b17..d98964858e13 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -438,7 +438,7 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, break; case VIRTIO_GPU_CMD_RESOURCE_FLUSH: virgl_cmd_resource_flush(g, cmd); - break; + break; case VIRTIO_GPU_CMD_RESOURCE_UNREF: virgl_cmd_resource_unref(g, cmd); break; @@ -456,7 +456,6 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, case VIRTIO_GPU_CMD_GET_CAPSET: virgl_cmd_get_capset(g, cmd); break; - case VIRTIO_GPU_CMD_GET_DISPLAY_INFO: virtio_gpu_get_display_info(g, cmd); break; From 75ae7c465dfa51ca603584717b144f6fe68cd112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 3 Mar 2021 19:46:40 +0100 Subject: [PATCH 12/22] ui: Replace the word 'whitelist' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the inclusive terminology from the "Conscious Language in your Open Source Projects" guidelines [*] and replace the words "whitelist" appropriately. [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md Reviewed-by: Gerd Hoffmann Reviewed-by: Alex Bennée Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210303184644.1639691-2-philmd@redhat.com> Signed-off-by: Laurent Vivier --- ui/console.c | 2 +- ui/vnc-auth-sasl.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/console.c b/ui/console.c index 171a7bf14b94..c2fdf975b6b3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1724,7 +1724,7 @@ bool dpy_gfx_check_format(QemuConsole *con, return false; } } else { - /* default is to whitelist native 32 bpp only */ + /* default is to allow native 32 bpp only */ if (format != qemu_default_pixman_format(32, true)) { return false; } diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index f67111a3662a..df7dc08e9fc5 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -288,7 +288,7 @@ static int protocol_client_auth_sasl_step(VncState *vs, uint8_t *data, size_t le goto authreject; } - /* Check username whitelist ACL */ + /* Check the username access control list */ if (vnc_auth_sasl_check_access(vs) < 0) { goto authreject; } @@ -409,7 +409,7 @@ static int protocol_client_auth_sasl_start(VncState *vs, uint8_t *data, size_t l goto authreject; } - /* Check username whitelist ACL */ + /* Check the username access control list */ if (vnc_auth_sasl_check_access(vs) < 0) { goto authreject; } From 54fa79b793fcf00625be235588703fb3adbcd104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 3 Mar 2021 19:46:41 +0100 Subject: [PATCH 13/22] scripts/tracetool: Replace the word 'whitelist' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the inclusive terminology from the "Conscious Language in your Open Source Projects" guidelines [*] and replace the words "whitelist" appropriately. [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md Reviewed-by: Daniel P. Berrangé Reviewed-by: Stefan Hajnoczi Reviewed-by: Alex Bennée Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Message-Id: <20210303184644.1639691-3-philmd@redhat.com> Signed-off-by: Laurent Vivier --- scripts/tracetool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 96b1cd69a52c..5bc94d95cfc7 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -100,7 +100,7 @@ def validate_type(name): if bit == "const": continue if bit not in ALLOWED_TYPES: - raise ValueError("Argument type '%s' is not in whitelist. " + raise ValueError("Argument type '%s' is not allowed. " "Only standard C types and fixed size integer " "types should be used. struct, union, and " "other complex pointer types should be " From a202d75a99706faba2eaf69dff65b183a3eae4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 3 Mar 2021 19:46:42 +0100 Subject: [PATCH 14/22] seccomp: Replace the word 'blacklist' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the inclusive terminology from the "Conscious Language in your Open Source Projects" guidelines [*] and replace the word "blacklist" appropriately. [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md Reviewed-by: Daniel P. Berrangé Acked-by: Eduardo Otubo Reviewed-by: Alex Bennée Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20210303184644.1639691-4-philmd@redhat.com> Signed-off-by: Laurent Vivier --- softmmu/qemu-seccomp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/softmmu/qemu-seccomp.c b/softmmu/qemu-seccomp.c index 377ef6937ca5..9c29d9cf007e 100644 --- a/softmmu/qemu-seccomp.c +++ b/softmmu/qemu-seccomp.c @@ -45,8 +45,8 @@ const struct scmp_arg_cmp sched_setscheduler_arg[] = { { .arg = 1, .op = SCMP_CMP_NE, .datum_a = SCHED_IDLE } }; -static const struct QemuSeccompSyscall blacklist[] = { - /* default set of syscalls to blacklist */ +static const struct QemuSeccompSyscall denylist[] = { + /* default set of syscalls that should get blocked */ { SCMP_SYS(reboot), QEMU_SECCOMP_SET_DEFAULT }, { SCMP_SYS(swapon), QEMU_SECCOMP_SET_DEFAULT }, { SCMP_SYS(swapoff), QEMU_SECCOMP_SET_DEFAULT }, @@ -175,18 +175,18 @@ static int seccomp_start(uint32_t seccomp_opts, Error **errp) goto seccomp_return; } - for (i = 0; i < ARRAY_SIZE(blacklist); i++) { + for (i = 0; i < ARRAY_SIZE(denylist); i++) { uint32_t action; - if (!(seccomp_opts & blacklist[i].set)) { + if (!(seccomp_opts & denylist[i].set)) { continue; } - action = qemu_seccomp_get_action(blacklist[i].set); - rc = seccomp_rule_add_array(ctx, action, blacklist[i].num, - blacklist[i].narg, blacklist[i].arg_cmp); + action = qemu_seccomp_get_action(denylist[i].set); + rc = seccomp_rule_add_array(ctx, action, denylist[i].num, + denylist[i].narg, denylist[i].arg_cmp); if (rc < 0) { error_setg_errno(errp, -rc, - "failed to add seccomp blacklist rules"); + "failed to add seccomp denylist rules"); goto seccomp_return; } } From d42304b1ed9f9c4121cd1d49d92d84480f1fef44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 3 Mar 2021 19:46:43 +0100 Subject: [PATCH 15/22] qemu-options: Replace the word 'blacklist' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the inclusive terminology from the "Conscious Language in your Open Source Projects" guidelines [*] and replace the word "blacklist" appropriately. [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md Reviewed-by: Daniel P. Berrangé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20210303184644.1639691-5-philmd@redhat.com> Signed-off-by: Laurent Vivier --- qemu-options.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index c324633fcaad..622d3bfa5a7d 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4299,12 +4299,12 @@ DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \ " use 'obsolete' to allow obsolete system calls that are provided\n" \ " by the kernel, but typically no longer used by modern\n" \ " C library implementations.\n" \ - " use 'elevateprivileges' to allow or deny QEMU process to elevate\n" \ - " its privileges by blacklisting all set*uid|gid system calls.\n" \ + " use 'elevateprivileges' to allow or deny the QEMU process ability\n" \ + " to elevate privileges using set*uid|gid system calls.\n" \ " The value 'children' will deny set*uid|gid system calls for\n" \ " main QEMU process but will allow forks and execves to run unprivileged\n" \ " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \ - " blacklisting *fork and execve\n" \ + " blocking *fork and execve\n" \ " use 'resourcecontrol' to disable process affinity and schedular priority\n", QEMU_ARCH_ALL) SRST From d5f846813c45515a846e9791ded839690642e90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 3 Mar 2021 19:46:44 +0100 Subject: [PATCH 16/22] tests/fp/fp-test: Replace the word 'blacklist' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the inclusive terminology from the "Conscious Language in your Open Source Projects" guidelines [*] and replace the word "blacklist" appropriately. [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md Acked-by: Alex Bennée Reviewed-by: Daniel P. Berrangé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20210303184644.1639691-6-philmd@redhat.com> Signed-off-by: Laurent Vivier --- tests/fp/fp-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c index 06ffebd6db17..5a4cad8c8b23 100644 --- a/tests/fp/fp-test.c +++ b/tests/fp/fp-test.c @@ -123,7 +123,7 @@ static void not_implemented(void) fprintf(stderr, "Not implemented.\n"); } -static bool blacklisted(unsigned op, int rmode) +static bool is_allowed(unsigned op, int rmode) { /* odd has not been implemented for any 80-bit ops */ if (rmode == softfloat_round_odd) { @@ -161,10 +161,10 @@ static bool blacklisted(unsigned op, int rmode) case F32_TO_EXTF80: case F64_TO_EXTF80: case F128_TO_EXTF80: - return true; + return false; } } - return false; + return true; } static void do_testfloat(int op, int rmode, bool exact) @@ -194,7 +194,7 @@ static void do_testfloat(int op, int rmode, bool exact) verCases_writeFunctionName(stderr); fputs("\n", stderr); - if (blacklisted(op, rmode)) { + if (!is_allowed(op, rmode)) { not_implemented(); return; } From 6d8980a38fa7a7ebcdf20120a67feb7b35488a53 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 9 Mar 2021 16:22:58 +0000 Subject: [PATCH 17/22] qemu-common.h: Update copyright string to 2021 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the common copyright string that we use in -version reports, About dialogs, etc, to 2021. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210309162258.28633-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- include/qemu-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 654621444ecf..73bcf763ed82 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -13,7 +13,7 @@ #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) /* Copyright string for -version arguments, About dialogs, etc */ -#define QEMU_COPYRIGHT "Copyright (c) 2003-2020 " \ +#define QEMU_COPYRIGHT "Copyright (c) 2003-2021 " \ "Fabrice Bellard and the QEMU Project developers" /* Bug reporting information for --help arguments, About dialogs, etc */ From c39dd149601d0401496f3264bda9c91d274cd4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sun, 21 Feb 2021 23:56:24 +0100 Subject: [PATCH 18/22] hw/lm32/Kconfig: Introduce CONFIG_LM32_EVR for lm32-evr/uclinux boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to be able to use the 'LM32' config for architecture specific features. Introduce CONFIG_LM32_EVR to select the lm32-evr / lm32-uclinux boards. Reviewed-by: Alex Bennée Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210221225626.2589247-2-f4bug@amsat.org> Signed-off-by: Laurent Vivier --- default-configs/devices/lm32-softmmu.mak | 2 +- hw/lm32/Kconfig | 6 +++++- hw/lm32/meson.build | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/default-configs/devices/lm32-softmmu.mak b/default-configs/devices/lm32-softmmu.mak index 115b3e34c983..1bce3f6e8b64 100644 --- a/default-configs/devices/lm32-softmmu.mak +++ b/default-configs/devices/lm32-softmmu.mak @@ -8,5 +8,5 @@ CONFIG_SEMIHOSTING=y # Boards: # -CONFIG_LM32=y +CONFIG_LM32_EVR=y CONFIG_MILKYMIST=y diff --git a/hw/lm32/Kconfig b/hw/lm32/Kconfig index ed2e3060b040..20c36edc402c 100644 --- a/hw/lm32/Kconfig +++ b/hw/lm32/Kconfig @@ -1,7 +1,6 @@ config LM32 bool select PTIMER - select PFLASH_CFI02 config MILKYMIST bool @@ -12,3 +11,8 @@ config MILKYMIST select FRAMEBUFFER select SD select USB_OHCI + +config LM32_EVR + bool + select LM32 + select PFLASH_CFI02 diff --git a/hw/lm32/meson.build b/hw/lm32/meson.build index 8caf0a727ff8..42d6f8db3d97 100644 --- a/hw/lm32/meson.build +++ b/hw/lm32/meson.build @@ -1,6 +1,6 @@ lm32_ss = ss.source_set() # LM32 boards -lm32_ss.add(when: 'CONFIG_LM32', if_true: files('lm32_boards.c')) +lm32_ss.add(when: 'CONFIG_LM32_EVR', if_true: files('lm32_boards.c')) lm32_ss.add(when: 'CONFIG_MILKYMIST', if_true: files('milkymist.c')) hw_arch += {'lm32': lm32_ss} From 8ee08a6a282f4bbdd79744cad79aa87121db2e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sun, 21 Feb 2021 23:56:25 +0100 Subject: [PATCH 19/22] hw/lm32/Kconfig: Rename CONFIG_LM32 -> CONFIG_LM32_DEVICES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to be able to use the 'LM32' config for architecture specific features. As CONFIG_LM32 is only used to select peripherals, rename it CONFIG_LM32_DEVICES. Reviewed-by: Alex Bennée Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210221225626.2589247-3-f4bug@amsat.org> Signed-off-by: Laurent Vivier --- hw/char/meson.build | 4 ++-- hw/intc/meson.build | 2 +- hw/lm32/Kconfig | 4 ++-- hw/timer/meson.build | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/char/meson.build b/hw/char/meson.build index afe9a0af88c1..7ba38dbd965f 100644 --- a/hw/char/meson.build +++ b/hw/char/meson.build @@ -8,8 +8,8 @@ softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('imx_serial.c')) softmmu_ss.add(when: 'CONFIG_IPACK', if_true: files('ipoctal232.c')) softmmu_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('parallel-isa.c')) softmmu_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugcon.c')) -softmmu_ss.add(when: 'CONFIG_LM32', if_true: files('lm32_juart.c')) -softmmu_ss.add(when: 'CONFIG_LM32', if_true: files('lm32_uart.c')) +softmmu_ss.add(when: 'CONFIG_LM32_DEVICES', if_true: files('lm32_juart.c')) +softmmu_ss.add(when: 'CONFIG_LM32_DEVICES', if_true: files('lm32_uart.c')) softmmu_ss.add(when: 'CONFIG_MILKYMIST', if_true: files('milkymist-uart.c')) softmmu_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_uart.c')) softmmu_ss.add(when: 'CONFIG_PARALLEL', if_true: files('parallel.c')) diff --git a/hw/intc/meson.build b/hw/intc/meson.build index b3d9345a0d2e..8df3656419e3 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -14,7 +14,7 @@ softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c')) softmmu_ss.add(when: 'CONFIG_I8259', if_true: files('i8259_common.c', 'i8259.c')) softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('imx_avic.c', 'imx_gpcv2.c')) softmmu_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic_common.c')) -softmmu_ss.add(when: 'CONFIG_LM32', if_true: files('lm32_pic.c')) +softmmu_ss.add(when: 'CONFIG_LM32_DEVICES', if_true: files('lm32_pic.c')) softmmu_ss.add(when: 'CONFIG_OPENPIC', if_true: files('openpic.c')) softmmu_ss.add(when: 'CONFIG_PL190', if_true: files('pl190.c')) softmmu_ss.add(when: 'CONFIG_PUV3', if_true: files('puv3_intc.c')) diff --git a/hw/lm32/Kconfig b/hw/lm32/Kconfig index 20c36edc402c..518c84ed5084 100644 --- a/hw/lm32/Kconfig +++ b/hw/lm32/Kconfig @@ -1,4 +1,4 @@ -config LM32 +config LM32_DEVICES bool select PTIMER @@ -14,5 +14,5 @@ config MILKYMIST config LM32_EVR bool - select LM32 + select LM32_DEVICES select PFLASH_CFI02 diff --git a/hw/timer/meson.build b/hw/timer/meson.build index 26c2701fd78f..a2372629f001 100644 --- a/hw/timer/meson.build +++ b/hw/timer/meson.build @@ -19,7 +19,7 @@ softmmu_ss.add(when: 'CONFIG_HPET', if_true: files('hpet.c')) softmmu_ss.add(when: 'CONFIG_I8254', if_true: files('i8254_common.c', 'i8254.c')) softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('imx_epit.c')) softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('imx_gpt.c')) -softmmu_ss.add(when: 'CONFIG_LM32', if_true: files('lm32_timer.c')) +softmmu_ss.add(when: 'CONFIG_LM32_DEVICES', if_true: files('lm32_timer.c')) softmmu_ss.add(when: 'CONFIG_MILKYMIST', if_true: files('milkymist-sysctl.c')) softmmu_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_gictimer.c')) softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('mss-timer.c')) From 32d1fd8d39475bc9ed7d3b5f1a666cce7f1d5fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sun, 21 Feb 2021 23:56:26 +0100 Subject: [PATCH 20/22] hw/lm32/Kconfig: Have MILKYMIST select LM32_DEVICES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Milkymist board requires more than the PTIMER. Directly select the LM32_DEVICES. This fixes: /usr/bin/ld: libqemu-lm32-softmmu.fa.p/target_lm32_gdbstub.c.o: in function `lm32_cpu_gdb_read_register': target/lm32/gdbstub.c:46: undefined reference to `lm32_pic_get_im' target/lm32/gdbstub.c:48: undefined reference to `lm32_pic_get_ip' libqemu-lm32-softmmu.fa.p/target_lm32_op_helper.c.o: in function `helper_wcsr_im': target/lm32/op_helper.c:107: undefined reference to `lm32_pic_set_im' libqemu-lm32-softmmu.fa.p/target_lm32_op_helper.c.o: in function `helper_wcsr_ip': target/lm32/op_helper.c:114: undefined reference to `lm32_pic_set_ip' libqemu-lm32-softmmu.fa.p/target_lm32_op_helper.c.o: in function `helper_wcsr_jtx': target/lm32/op_helper.c:120: undefined reference to `lm32_juart_set_jtx' libqemu-lm32-softmmu.fa.p/target_lm32_op_helper.c.o: in function `helper_wcsr_jrx': target/lm32/op_helper.c:125: undefined reference to `lm32_juart_set_jrx' libqemu-lm32-softmmu.fa.p/target_lm32_translate.c.o: in function `lm32_cpu_dump_state': target/lm32/translate.c:1161: undefined reference to `lm32_pic_get_ip' target/lm32/translate.c:1161: undefined reference to `lm32_pic_get_im' Reviewed-by: Alex Bennée Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210221225626.2589247-4-f4bug@amsat.org> Signed-off-by: Laurent Vivier --- hw/lm32/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/lm32/Kconfig b/hw/lm32/Kconfig index 518c84ed5084..8ac94205d71b 100644 --- a/hw/lm32/Kconfig +++ b/hw/lm32/Kconfig @@ -6,11 +6,11 @@ config MILKYMIST bool # FIXME: disabling it results in compile-time errors select MILKYMIST_TMU2 if OPENGL && X11 - select PTIMER select PFLASH_CFI01 select FRAMEBUFFER select SD select USB_OHCI + select LM32_DEVICES config LM32_EVR bool From 0a38950931af0088449a6f224809acd0214d9d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Mon, 11 Jan 2021 16:20:19 +0100 Subject: [PATCH 21/22] sysemu/runstate: Let runstate_is_running() return bool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runstate_check() returns a boolean. runstate_is_running() returns what runstate_check() returns, also a boolean. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Reviewed-by: Alex Bennée Message-Id: <20210111152020.1422021-2-philmd@redhat.com> Signed-off-by: Laurent Vivier --- include/sysemu/runstate.h | 2 +- softmmu/runstate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index e557f470d421..3ab35a039a0e 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -6,7 +6,7 @@ bool runstate_check(RunState state); void runstate_set(RunState new_state); -int runstate_is_running(void); +bool runstate_is_running(void); bool runstate_needs_reset(void); bool runstate_store(char *str, size_t size); diff --git a/softmmu/runstate.c b/softmmu/runstate.c index 2874417b6183..0187f1822608 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -218,7 +218,7 @@ void runstate_set(RunState new_state) current_run_state = new_state; } -int runstate_is_running(void) +bool runstate_is_running(void) { return runstate_check(RUN_STATE_RUNNING); } From 538f049704e9b7a07eeaf326af772fdd30d89576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Mon, 11 Jan 2021 16:20:20 +0100 Subject: [PATCH 22/22] sysemu: Let VMChangeStateHandler take boolean 'running' argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'running' argument from VMChangeStateHandler does not require other value than 0 / 1. Make it a plain boolean. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Acked-by: David Gibson Message-Id: <20210111152020.1422021-3-philmd@redhat.com> Signed-off-by: Laurent Vivier --- accel/xen/xen-all.c | 2 +- audio/audio.c | 2 +- block/block-backend.c | 2 +- gdbstub.c | 2 +- hw/block/pflash_cfi01.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/display/qxl.c | 2 +- hw/i386/kvm/clock.c | 2 +- hw/i386/kvm/i8254.c | 2 +- hw/i386/kvmvapic.c | 2 +- hw/i386/xen/xen-hvm.c | 2 +- hw/ide/core.c | 2 +- hw/intc/arm_gicv3_its_kvm.c | 2 +- hw/intc/arm_gicv3_kvm.c | 2 +- hw/intc/spapr_xive_kvm.c | 2 +- hw/misc/mac_via.c | 2 +- hw/net/e1000e_core.c | 2 +- hw/nvram/spapr_nvram.c | 2 +- hw/ppc/ppc.c | 2 +- hw/ppc/ppc_booke.c | 2 +- hw/s390x/tod-kvm.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/vfio/migration.c | 2 +- hw/virtio/virtio-rng.c | 2 +- hw/virtio/virtio.c | 2 +- include/sysemu/runstate.h | 10 ++++++++-- net/net.c | 2 +- softmmu/memory.c | 2 +- softmmu/runstate.c | 2 +- target/arm/kvm.c | 2 +- target/arm/kvm_arm.h | 2 +- target/i386/kvm/kvm.c | 2 +- target/i386/sev.c | 2 +- target/i386/whpx/whpx-all.c | 2 +- target/mips/kvm.c | 4 ++-- target/ppc/cpu-qom.h | 2 +- ui/gtk.c | 2 +- ui/spice-core.c | 2 +- 41 files changed, 49 insertions(+), 43 deletions(-) diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index e9d2d6aaaa0a..69aa7d018b28 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -122,7 +122,7 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state) } -static void xen_change_state_handler(void *opaque, int running, +static void xen_change_state_handler(void *opaque, bool running, RunState state) { if (running) { diff --git a/audio/audio.c b/audio/audio.c index 6734c8af708c..534278edfed2 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1540,7 +1540,7 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv, } } -static void audio_vm_change_state_handler (void *opaque, int running, +static void audio_vm_change_state_handler (void *opaque, bool running, RunState state) { AudioState *s = opaque; diff --git a/block/block-backend.c b/block/block-backend.c index e493f17515d8..413af51f3bab 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -163,7 +163,7 @@ static const char *blk_root_get_name(BdrvChild *child) return blk_name(child->opaque); } -static void blk_vm_state_changed(void *opaque, int running, RunState state) +static void blk_vm_state_changed(void *opaque, bool running, RunState state) { Error *local_err = NULL; BlockBackend *blk = opaque; diff --git a/gdbstub.c b/gdbstub.c index 16d7c8f534fa..6de21f656741 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2754,7 +2754,7 @@ void gdb_set_stop_cpu(CPUState *cpu) } #ifndef CONFIG_USER_ONLY -static void gdb_vm_state_change(void *opaque, int running, RunState state) +static void gdb_vm_state_change(void *opaque, bool running, RunState state) { CPUState *cpu = gdbserver_state.c_cpu; g_autoptr(GString) buf = g_string_new(NULL); diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 22287a1522ec..526b70417de8 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -1014,7 +1014,7 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, DriveInfo *dinfo) loc_pop(&loc); } -static void postload_update_cb(void *opaque, int running, RunState state) +static void postload_update_cb(void *opaque, bool running, RunState state) { PFlashCFI01 *pfl = opaque; diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index e8600b069da3..3d2072cf75b9 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -870,7 +870,7 @@ static void virtio_blk_dma_restart_bh(void *opaque) virtio_blk_process_queued_requests(s, true); } -static void virtio_blk_dma_restart_cb(void *opaque, int running, +static void virtio_blk_dma_restart_cb(void *opaque, bool running, RunState state) { VirtIOBlock *s = opaque; diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 6784d32920c5..93907e82a332 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -1992,7 +1992,7 @@ static void qxl_dirty_surfaces(PCIQXLDevice *qxl) } } -static void qxl_vm_change_state_handler(void *opaque, int running, +static void qxl_vm_change_state_handler(void *opaque, bool running, RunState state) { PCIQXLDevice *qxl = opaque; diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index 2d8a36636936..51872dd84c0b 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -162,7 +162,7 @@ static void do_kvmclock_ctrl(CPUState *cpu, run_on_cpu_data data) } } -static void kvmclock_vm_state_change(void *opaque, int running, +static void kvmclock_vm_state_change(void *opaque, bool running, RunState state) { KVMClockState *s = opaque; diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index c73254e88660..c558893961ba 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -239,7 +239,7 @@ static void kvm_pit_irq_control(void *opaque, int n, int enable) kvm_pit_put(pit); } -static void kvm_pit_vm_state_change(void *opaque, int running, +static void kvm_pit_vm_state_change(void *opaque, bool running, RunState state) { KVMPITState *s = opaque; diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index 2c1898032e42..46315445d22b 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -748,7 +748,7 @@ static void do_vapic_enable(CPUState *cs, run_on_cpu_data data) s->state = VAPIC_ACTIVE; } -static void kvmvapic_vm_state_change(void *opaque, int running, +static void kvmvapic_vm_state_change(void *opaque, bool running, RunState state) { MachineState *ms = MACHINE(qdev_get_machine()); diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 68821d90f52c..7ce672e5a5c3 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -1235,7 +1235,7 @@ static void xen_main_loop_prepare(XenIOState *state) } -static void xen_hvm_change_state_handler(void *opaque, int running, +static void xen_hvm_change_state_handler(void *opaque, bool running, RunState rstate) { XenIOState *state = opaque; diff --git a/hw/ide/core.c b/hw/ide/core.c index 81db2c95de33..fd69ca3167d9 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2677,7 +2677,7 @@ static void ide_restart_bh(void *opaque) } } -static void ide_restart_cb(void *opaque, int running, RunState state) +static void ide_restart_cb(void *opaque, bool running, RunState state) { IDEBus *bus = opaque; diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c index 057cb53f13c2..b554d2ede0ad 100644 --- a/hw/intc/arm_gicv3_its_kvm.c +++ b/hw/intc/arm_gicv3_its_kvm.c @@ -71,7 +71,7 @@ static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid) * * The tables get flushed to guest RAM whenever the VM gets stopped. */ -static void vm_change_state_handler(void *opaque, int running, +static void vm_change_state_handler(void *opaque, bool running, RunState state) { GICv3ITSState *s = (GICv3ITSState *)opaque; diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index d040a5d1e990..65a4c880a351 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -743,7 +743,7 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { * * The tables get flushed to guest RAM whenever the VM gets stopped. */ -static void vm_change_state_handler(void *opaque, int running, +static void vm_change_state_handler(void *opaque, bool running, RunState state) { GICv3State *s = (GICv3State *)opaque; diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index acc8c3650c4c..c00833116071 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -504,7 +504,7 @@ static int kvmppc_xive_get_queues(SpaprXive *xive, Error **errp) * runs again. If an interrupt was queued while the VM was stopped, * simply generate a trigger. */ -static void kvmppc_xive_change_state_handler(void *opaque, int running, +static void kvmppc_xive_change_state_handler(void *opaque, bool running, RunState state) { SpaprXive *xive = opaque; diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index 488d086a17c4..ca2f939dd588 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -1098,7 +1098,7 @@ static void mac_via_init(Object *obj) TYPE_ADB_BUS, DEVICE(obj), "adb.0"); } -static void postload_update_cb(void *opaque, int running, RunState state) +static void postload_update_cb(void *opaque, bool running, RunState state) { MacVIAState *m = MAC_VIA(opaque); diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 4dcb92d966bb..b75f2ab8fc14 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -3298,7 +3298,7 @@ e1000e_autoneg_resume(E1000ECore *core) } static void -e1000e_vm_state_change(void *opaque, int running, RunState state) +e1000e_vm_state_change(void *opaque, bool running, RunState state) { E1000ECore *core = opaque; diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index 9e51bc82ae40..01f775201463 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -217,7 +217,7 @@ static int spapr_nvram_pre_load(void *opaque) return 0; } -static void postload_update_cb(void *opaque, int running, RunState state) +static void postload_update_cb(void *opaque, bool running, RunState state) { SpaprNvram *nvram = opaque; diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 5cbbff1f8d0c..bf28d6bfc8d1 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -1059,7 +1059,7 @@ static void timebase_load(PPCTimebase *tb) } } -void cpu_ppc_clock_vm_state_change(void *opaque, int running, +void cpu_ppc_clock_vm_state_change(void *opaque, bool running, RunState state) { PPCTimebase *tb = opaque; diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index 652a21b8064b..974c0c8a7528 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -317,7 +317,7 @@ static void ppc_booke_timer_reset_handle(void *opaque) * action will be taken. To avoid this we always clear the watchdog state when * state changes to running. */ -static void cpu_state_change_handler(void *opaque, int running, RunState state) +static void cpu_state_change_handler(void *opaque, bool running, RunState state) { PowerPCCPU *cpu = opaque; CPUPPCState *env = &cpu->env; diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c index 6e21d83181d7..0b9447748619 100644 --- a/hw/s390x/tod-kvm.c +++ b/hw/s390x/tod-kvm.c @@ -78,7 +78,7 @@ static void kvm_s390_tod_set(S390TODState *td, const S390TOD *tod, Error **errp) } } -static void kvm_s390_tod_vm_state_change(void *opaque, int running, +static void kvm_s390_tod_vm_state_change(void *opaque, bool running, RunState state) { S390TODState *td = opaque; diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 2d674f94d7de..2a0a98cac91d 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -181,7 +181,7 @@ void scsi_req_retry(SCSIRequest *req) req->retry = true; } -static void scsi_dma_restart_cb(void *opaque, int running, RunState state) +static void scsi_dma_restart_cb(void *opaque, bool running, RunState state) { SCSIDevice *s = opaque; diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 212eb05d3d3c..f71af0ad2d8f 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2436,7 +2436,7 @@ static int usb_ehci_post_load(void *opaque, int version_id) return 0; } -static void usb_ehci_vm_state_change(void *opaque, int running, RunState state) +static void usb_ehci_vm_state_change(void *opaque, bool running, RunState state) { EHCIState *ehci = opaque; diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 354713a77dc9..2518306f527f 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1783,7 +1783,7 @@ type_init(usb_host_register_types) static QEMUTimer *usb_auto_timer; static VMChangeStateEntry *usb_vmstate; -static void usb_host_vm_state(void *unused, int running, RunState state) +static void usb_host_vm_state(void *unused, bool running, RunState state) { if (running) { usb_host_auto_check(unused); diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 7e9e3fecbfec..17f06f34179a 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1395,7 +1395,7 @@ static void usbredir_chardev_event(void *opaque, QEMUChrEvent event) * init + destroy */ -static void usbredir_vm_state_change(void *priv, int running, RunState state) +static void usbredir_vm_state_change(void *priv, bool running, RunState state) { USBRedirDevice *dev = priv; diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 00daa50ed818..134bdccc4f8b 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -727,7 +727,7 @@ static SaveVMHandlers savevm_vfio_handlers = { /* ---------------------------------------------------------------------- */ -static void vfio_vmstate_change(void *opaque, int running, RunState state) +static void vfio_vmstate_change(void *opaque, bool running, RunState state) { VFIODevice *vbasedev = opaque; VFIOMigration *migration = vbasedev->migration; diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 76ce9376931b..cc8e9f775d87 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -133,7 +133,7 @@ static uint64_t get_features(VirtIODevice *vdev, uint64_t f, Error **errp) return f; } -static void virtio_rng_vm_state_change(void *opaque, int running, +static void virtio_rng_vm_state_change(void *opaque, bool running, RunState state) { VirtIORNG *vrng = opaque; diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 1fd1917ca0f6..07f4e60b3099 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3208,7 +3208,7 @@ void virtio_cleanup(VirtIODevice *vdev) qemu_del_vm_change_state_handler(vdev->vmstate); } -static void virtio_vmstate_change(void *opaque, int running, RunState state) +static void virtio_vmstate_change(void *opaque, bool running, RunState state) { VirtIODevice *vdev = opaque; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index 3ab35a039a0e..a53569157343 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -10,7 +10,7 @@ bool runstate_is_running(void); bool runstate_needs_reset(void); bool runstate_store(char *str, size_t size); -typedef void VMChangeStateHandler(void *opaque, int running, RunState state); +typedef void VMChangeStateHandler(void *opaque, bool running, RunState state); VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, void *opaque); @@ -20,7 +20,13 @@ VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev, VMChangeStateHandler *cb, void *opaque); void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); -void vm_state_notify(int running, RunState state); +/** + * vm_state_notify: Notify the state of the VM + * + * @running: whether the VM is running or not. + * @state: the #RunState of the VM. + */ +void vm_state_notify(bool running, RunState state); static inline bool shutdown_caused_by_guest(ShutdownCause cause) { diff --git a/net/net.c b/net/net.c index ca30df963d77..555c5551077d 100644 --- a/net/net.c +++ b/net/net.c @@ -1350,7 +1350,7 @@ void qmp_set_link(const char *name, bool up, Error **errp) } } -static void net_vm_change_state_handler(void *opaque, int running, +static void net_vm_change_state_handler(void *opaque, bool running, RunState state) { NetClientState *nc; diff --git a/softmmu/memory.c b/softmmu/memory.c index 91f1bf47c301..9db47b7db6bf 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -2679,7 +2679,7 @@ static void memory_global_dirty_log_do_stop(void) MEMORY_LISTENER_CALL_GLOBAL(log_global_stop, Reverse); } -static void memory_vm_change_state_handler(void *opaque, int running, +static void memory_vm_change_state_handler(void *opaque, bool running, RunState state) { if (running) { diff --git a/softmmu/runstate.c b/softmmu/runstate.c index 0187f1822608..ce8977c6a29c 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -317,7 +317,7 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e) g_free(e); } -void vm_state_notify(int running, RunState state) +void vm_state_notify(bool running, RunState state) { VMChangeStateEntry *e, *next; diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 00e124c81239..bebea9012298 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -844,7 +844,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) return MEMTXATTRS_UNSPECIFIED; } -void kvm_arm_vm_state_change(void *opaque, int running, RunState state) +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state) { CPUState *cs = opaque; ARMCPU *cpu = ARM_CPU(cs); diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index eb81b7059eb1..68ec970c4f4c 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -352,7 +352,7 @@ void kvm_arm_get_virtual_time(CPUState *cs); */ void kvm_arm_put_virtual_time(CPUState *cs); -void kvm_arm_vm_state_change(void *opaque, int running, RunState state); +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state); int kvm_arm_vgic_probe(void); diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index c8d61daf68b5..7fe9f527103c 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -693,7 +693,7 @@ static int kvm_inject_mce_oldstyle(X86CPU *cpu) return 0; } -static void cpu_update_state(void *opaque, int running, RunState state) +static void cpu_update_state(void *opaque, bool running, RunState state) { CPUX86State *env = opaque; diff --git a/target/i386/sev.c b/target/i386/sev.c index 0f414df02f39..72b9e2ab4010 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -691,7 +691,7 @@ sev_launch_finish(SevGuestState *sev) } static void -sev_vm_state_change(void *opaque, int running, RunState state) +sev_vm_state_change(void *opaque, bool running, RunState state) { SevGuestState *sev = opaque; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index f0a35df3bba6..f832f286ac3d 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1318,7 +1318,7 @@ void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu) static Error *whpx_migration_blocker; -static void whpx_cpu_update_state(void *opaque, int running, RunState state) +static void whpx_cpu_update_state(void *opaque, bool running, RunState state) { CPUX86State *env = opaque; diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 123ec1be7e1f..086debd9f013 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -38,7 +38,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { KVM_CAP_LAST_INFO }; -static void kvm_mips_update_state(void *opaque, int running, RunState state); +static void kvm_mips_update_state(void *opaque, bool running, RunState state); unsigned long kvm_arch_vcpu_id(CPUState *cs) { @@ -553,7 +553,7 @@ static int kvm_mips_restore_count(CPUState *cs) /* * Handle the VM clock being started or stopped */ -static void kvm_mips_update_state(void *opaque, int running, RunState state) +static void kvm_mips_update_state(void *opaque, bool running, RunState state) { CPUState *cs = opaque; int ret; diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index 63b9e8632cab..118baf8d41f7 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -218,7 +218,7 @@ extern const VMStateDescription vmstate_ppc_timebase; .offset = vmstate_offset_value(_state, _field, PPCTimebase), \ } -void cpu_ppc_clock_vm_state_change(void *opaque, int running, +void cpu_ppc_clock_vm_state_change(void *opaque, bool running, RunState state); #endif diff --git a/ui/gtk.c b/ui/gtk.c index 3edaf041defc..916056d89e87 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -683,7 +683,7 @@ static const DisplayChangeListenerOps dcl_egl_ops = { /** QEMU Events **/ -static void gd_change_runstate(void *opaque, int running, RunState state) +static void gd_change_runstate(void *opaque, bool running, RunState state) { GtkDisplayState *s = opaque; diff --git a/ui/spice-core.c b/ui/spice-core.c index beee932f5546..cadec766fe3a 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -615,7 +615,7 @@ static int add_channel(void *opaque, const char *name, const char *value, return 0; } -static void vm_change_state_handler(void *opaque, int running, +static void vm_change_state_handler(void *opaque, bool running, RunState state) { if (running) {