Trivial patches for 2018-05-20
Subsystems (3)
[Qemu-devel] [PULL 04/22] qemu-option-trace: -trace enable= is a pattern, not a file
In reply to Michael Tokarev--- qemu-option-trace.texi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
qemu-option-trace.texi +2 -3
@@ -2,9 +2,8 @@ Specify tracing options. @table @option @item [enable=]@var{pattern} -Immediately enable events matching @var{pattern}. -The file must contain one event name (as listed in the @file{trace-events-all} -file) per line; globbing patterns are accepted too. This option is only +Immediately enable events matching @var{pattern} +(either event name or a globbing pattern). This option is only available if QEMU has been compiled with the @var{simple}, @var{log} or @var{ftrace} tracing backend. To specify multiple events or patterns, specify the @option{-trace} option multiple times.
Signature · 1 line
2.11.0
Hello!
This is a next trivial-patches pull request. It's been a while since the last pull, and quite some changes has been accumulated.
Please consider pulling/applying.
Thanks,
/mjt
The following changes since commit 5bcf917ee37a5efbef99f091a96db54a5276becb:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180518' into staging (2018-05-18 18:25:29 +0100)
are available in the git repository at:
git://git.corpit.ru/qemu.git tags/trivial-patches-fetch
for you to fetch changes up to 9a232487aab8a7640ff8853d7d8d7c27106b44f8:
acpi: fix a comment about aml_call0() (2018-05-20 08:58:58 +0300)
----------------------------------------------------------------
trivial patches for 2018-05-20
----------------------------------------------------------------
Alexey Kardashevskiy (1):
slirp/debug: Print IP addresses in human readable form
Daniel P. Berrangé (1):
misc, ide: remove use of HWADDR_PRIx in trace events
Emilio G. Cota (1):
tcg: fix s/compliment/complement/ typos
John Snow (5):
qemu-img-commands.hx: argument ordering fixups qemu-img.texi: fix command ordering
qemu-img: remove references to GEN_DOCS
qemu-img: Make documentation between .texi and .hx consistent qemu-img-cmds.hx: add passive-aggressive note
Laurent Vivier (1):
Remove unnecessary variables for function return value
Marc-André Lureau (2):
tests: fix tpm-crb tpm-tis tests race
acpi: fix a comment about aml_call0()
Michael Tokarev (1):
qemu-option-trace: -trace enable= is a pattern, not a file
Michal Privoznik (1):
qemu-options: Allow -no-user-config again
Murilo Opsfelder Araujo (1):
HACKING: document preference for g_new instead of g_malloc
Olaf Hering (1):
replace functions which are only available in glib-2.24
Peter Maydell (2):
gdbstub: Use qemu_set_cloexec()
gdbstub: Handle errors in gdb_accept()
Philippe Mathieu-Daudé (2):
hw/ide/ahci: Keep ALLWINNER_AHCI() macro internal
typedefs: Remove PcGuestInfo from qemu/typedefs.h
Thomas Huth (3):
trivial: Do not include pci.h if it is not necessary hw/timer/mt48t59: Fix bit-rotten NVRAM_PRINTF format strings qapi/net.json: Fix the version number of the "vlan" removal
HACKING | 9 +++ accel/tcg/translate-all.c | 5 +- block/quorum.c | 6 +- gdbstub.c | 24 ++++--- hw/acpi/aml-build.c | 2 +- hw/arm/exynos4210.c | 6 +- hw/block/vhost-user-blk.c | 5 +- hw/hppa/dino.c | 5 +- hw/ide/ahci-allwinner.c | 3 + hw/ide/ahci_internal.h | 3 - hw/ide/trace-events | 4 +- hw/misc/mos6522.c | 8 +-- hw/misc/trace-events | 8 +-- hw/net/ftgmac100.c | 5 +- hw/ppc/pnv_lpc.c | 16 ++--- hw/timer/m48t59-internal.h | 9 +-- hw/timer/m48t59.c | 4 +- include/hw/ppc/ppc4xx.h | 2 - include/hw/virtio/virtio-balloon.h | 1 - include/hw/virtio/virtio-gpu.h | 1 - include/qemu/typedefs.h | 1 - io/net-listener.c | 6 +- qapi/net.json | 4 +- qemu-img-cmds.hx | 13 ++-- qemu-img.c | 2 - qemu-img.texi | 78 +++++++++++----------- qemu-option-trace.texi | 5 +- qemu-options-wrapper.h | 1 - slirp/arp_table.c | 4 +- slirp/socket.c | 8 +-- slirp/udp.c | 4 +- target/i386/hax-darwin.c | 10 +-- target/i386/translate.c | 2 +- target/m68k/translate.c | 2 +- target/mips/dsp_helper.c | 15 +---- target/xtensa/core-dc232b/xtensa-modules.inc.c | 56 ++++------------ target/xtensa/core-dc233c/xtensa-modules.inc.c | 56 ++++------------ target/xtensa/core-de212/xtensa-modules.inc.c | 48 ++++--------- target/xtensa/core-fsf/xtensa-modules.inc.c | 32 +++------ .../core-sample_controller/xtensa-modules.inc.c | 24 ++----- target/xtensa/translate.c | 7 +- tcg/README | 2 +- tests/m48t59-test.c | 6 +- tests/test-thread-pool.c | 6 +- tests/tpm-emu.c | 2 +- util/uri.c | 5 +- util/vfio-helpers.c | 6 +- vl.c | 4 ++ 48 files changed, 187 insertions(+), 348 deletions(-)
[Qemu-devel] [PULL 01/22] tcg: fix s/compliment/complement/ typos
From: "Emilio G. Cota" <[email protected]>
--- target/i386/translate.c | 2 +- target/m68k/translate.c | 2 +- tcg/README | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
target/i386/translate.c +1 -1
@@ -113,7 +113,7 @@ typedef struct DisasContext {int rex_x, rex_b;#endif int vex_l;/* vex vector length */ -int vex_v;/* vex vvvv register, without 1's compliment. */ +int vex_v;/* vex vvvv register, without 1's complement. */ int ss32;/* 32 bit stack segment */ CCOp cc_op;/* current CC operation */ bool cc_op_dirty;
target/m68k/translate.c +1 -1
@@ -4002,7 +4002,7 @@ DISAS_INSN(bfext_reg)TCGv shift;/* In general, we're going to rotate the field so that it's at the -top of the word and then right-shift by the compliment of the +top of the word and then right-shift by the complement of the width to extend the field. */ if (ext &0x20 ) {/* Variable width. */
tcg/README +1 -1
@@ -561,7 +561,7 @@ E.g. VECL=1 -> 64 << 1 -> v128, and VECE=2 -> 1 << 2 -> i32. * orc_vec v0, v1, v2 * not_vec v0, v1 - Similarly, logical operations with and without compliment. + Similarly, logical operations with and without complement. Note that VECE is unused. * shli_vec v0, v1, i2
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 03/22] slirp/debug: Print IP addresses in human readable form
In reply to Michael TokarevFrom: Alexey Kardashevskiy <[email protected]>
--- slirp/arp_table.c | 4 ++-- slirp/socket.c | 8 ++++---- slirp/udp.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
slirp/arp_table.c +2 -2
@@ -33,7 +33,7 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN])int i;DEBUG_CALL ("arp_table_add" ); -DEBUG_ARG ("ip = 0x%x" , ip_addr); +DEBUG_ARG ("ip = %s" ,inet_ntoa (*(struct in_addr *)&ip_addr));DEBUG_ARGS ((dfd," hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n" , ethaddr[0 ], ethaddr[1 ], ethaddr[2 ], ethaddr[3 ], ethaddr[4 ], ethaddr[5 ]));
@@ -67,7 +67,7 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr,int i;DEBUG_CALL ("arp_table_search" ); -DEBUG_ARG ("ip = 0x%x" , ip_addr); +DEBUG_ARG ("ip = %s" ,inet_ntoa (*(struct in_addr *)&ip_addr));/* If broadcast address */ if (ip_addr ==0xffffffff || ip_addr == broadcast_addr) {
slirp/socket.c +4 -4
@@ -701,10 +701,10 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,memset (&addr,0 , addrlen);DEBUG_CALL ("tcp_listen" ); -DEBUG_ARG ("haddr = %x" , haddr); -DEBUG_ARG ("hport = %d" , hport); -DEBUG_ARG ("laddr = %x" , laddr); -DEBUG_ARG ("lport = %d" , lport); +DEBUG_ARG ("haddr = %s" ,inet_ntoa (*(struct in_addr *)&haddr)); +DEBUG_ARG ("hport = %d" ,ntohs (hport)); +DEBUG_ARG ("laddr = %s" ,inet_ntoa (*(struct in_addr *)&laddr)); +DEBUG_ARG ("lport = %d" ,ntohs (lport));DEBUG_ARG ("flags = %x" , flags); so =socreate (slirp);
slirp/udp.c +2 -2
@@ -241,8 +241,8 @@ int udp_output(struct socket *so, struct mbuf *m,DEBUG_CALL ("udp_output" );DEBUG_ARG ("so = %p" , so);DEBUG_ARG ("m = %p" , m); -DEBUG_ARG ("saddr = %lx" , (long )saddr->sin_addr.s_addr); -DEBUG_ARG ("daddr = %lx" , (long )daddr->sin_addr.s_addr); +DEBUG_ARG ("saddr = %s" ,inet_ntoa (saddr->sin_addr)); +DEBUG_ARG ("daddr = %s" ,inet_ntoa (daddr->sin_addr));/* * Adjust for header
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 02/22] misc, ide: remove use of HWADDR_PRIx in trace events
In reply to Michael TokarevFrom: Daniel P. Berrangé <[email protected]>
The trace events all use a uint64_t data type, so should be using the corresponding PRIx64 format, not HWADDR_PRIx which is intended for use with the 'hwaddr' type.
--- hw/ide/trace-events | 4 ++-- hw/misc/trace-events | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
hw/ide/trace-events +2 -2
@@ -108,8 +108,8 @@ ahci_dma_prepare_buf_fail(void *s, int port) "ahci(%p)[%d]: sglist population fa ahci_dma_rw_buf(void *s, int port, int l) "ahci(%p)[%d] len=0x%x" ahci_cmd_done(void *s, int port) "ahci(%p)[%d]: cmd done" ahci_reset(void *s) "ahci(%p): HBA reset" -allwinner_ahci_mem_read(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): read a=%p addr=0x%"HWADDR_PRIx" val=0x%"PRIx64", size=%d" -allwinner_ahci_mem_write(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): write a=%p addr=0x%"HWADDR_PRIx" val=0x%"PRIx64", size=%d" +allwinner_ahci_mem_read(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): read a=%p addr=0x%"PRIx64" val=0x%"PRIx64", size=%d" +allwinner_ahci_mem_write(void *s, void *a, uint64_t addr, uint64_t val, unsigned size) "ahci(%p): write a=%p addr=0x%"PRIx64" val=0x%"PRIx64", size=%d" # Warning: Verbose handle_reg_h2d_fis_dump(void *s, int port, const char *fis) "ahci(%p)[%d]: %s"
hw/misc/trace-events +4 -4
@@ -69,13 +69,13 @@ mps2_fpgaio_reset(void) "MPS2 FPGAIO: reset" mps2_fpgaio_leds(char led1, char led0) "MPS2 FPGAIO LEDs: %c%c" # hw/misc/msf2-sysreg.c -msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev) "msf2-sysreg write: addr 0x%08" HWADDR_PRIx " data 0x%" PRIx32 " prev 0x%" PRIx32 -msf2_sysreg_read(uint64_t offset, uint32_t val) "msf2-sysreg read: addr 0x%08" HWADDR_PRIx " data 0x%08" PRIx32 +msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev) "msf2-sysreg write: addr 0x%08" PRIx64 " data 0x%" PRIx32 " prev 0x%" PRIx32 +msf2_sysreg_read(uint64_t offset, uint32_t val) "msf2-sysreg read: addr 0x%08" PRIx64 " data 0x%08" PRIx32 msf2_sysreg_write_pll_status(void) "Invalid write to read only PLL status register" #hw/misc/imx7_gpr.c -imx7_gpr_read(uint64_t offset) "addr 0x%08" HWADDR_PRIx -imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" HWADDR_PRIx "value 0x%08" HWADDR_PRIx +imx7_gpr_read(uint64_t offset) "addr 0x%08" PRIx64 +imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" PRIx64 "value 0x%08" PRIx64 # hw/misc/mos6522.c mos6522_set_counter(int index, unsigned int val) "T%d.counter=%d"
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 13/22] trivial: Do not include pci.h if it is not necessary
In reply to Michael TokarevFrom: Thomas Huth <[email protected]>
There is no need to include pci.h in these files.
--- include/hw/ppc/ppc4xx.h | 2 -- include/hw/virtio/virtio-balloon.h | 1 - include/hw/virtio/virtio-gpu.h | 1 - 3 files changed, 4 deletions(-)
include/hw/ppc/ppc4xx.h +0 -2
@@ -25,8 +25,6 @@#ifndef PPC4XX_H #define PPC4XX_H -#include "hw/pci/pci.h" -/* PowerPC 4xx core initialization */ PowerPCCPU *ppc4xx_init(const char *cpu_model, clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
include/hw/virtio/virtio-balloon.h +0 -1
@@ -17,7 +17,6 @@#include "standard-headers/linux/virtio_balloon.h" #include "hw/virtio/virtio.h" -#include "hw/pci/pci.h" #define TYPE_VIRTIO_BALLOON "virtio-balloon-device"#define VIRTIO_BALLOON (obj) \
include/hw/virtio/virtio-gpu.h +0 -1
@@ -18,7 +18,6 @@#include "ui/qemu-pixman.h" #include "ui/console.h" #include "hw/virtio/virtio.h" -#include "hw/pci/pci.h" #include "qemu/log.h" #include "standard-headers/linux/virtio_gpu.h"
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 17/22] typedefs: Remove PcGuestInfo from qemu/typedefs.h
In reply to Michael TokarevFrom: Philippe Mathieu-Daudé <[email protected]>
It is long gone since e4e8ba04c2007 ...
--- include/qemu/typedefs.h | 1 - 1 file changed, 1 deletion(-)
include/qemu/typedefs.h +0 -1
@@ -62,7 +62,6 @@ typedef struct NetClientState NetClientState;typedef struct NetFilterState NetFilterState ;typedef struct NICInfo NICInfo ;typedef struct NumaNodeMem NumaNodeMem ; -typedef struct PcGuestInfo PcGuestInfo ;typedef struct PCIBridge PCIBridge ;typedef struct PCIBus PCIBus ;typedef struct PCIDevice PCIDevice ;
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 20/22] gdbstub: Handle errors in gdb_accept()
In reply to Michael TokarevFrom: Peter Maydell <[email protected]>
In gdb_accept(), we both fail to check all errors (notably that from socket_set_nodelay(), as Coverity notes in CID 1005666), and fail to return an error status back to our caller. Correct both of these things, so that errors in accept() result in our stopping with a useful error message rather than ignoring it.
--- gdbstub.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
gdbstub.c +12 -4
@@ -1814,7 +1814,7 @@ void gdb_signalled(CPUArchState *env, int sig)put_packet (s, buf); } -static void gdb_accept (void ) +static bool gdb_accept (void ) {GDBState *s;struct sockaddr_in sockaddr;
@@ -1826,7 +1826,7 @@ static void gdb_accept(void) fd =accept (gdbserver_fd, (struct sockaddr *)&sockaddr, &len);if (fd <0 && errno !=EINTR ) {perror ("accept" ); -return ; +return false; }else if (fd >=0 ) {qemu_set_cloexec (fd);break ;
@@ -1834,7 +1834,10 @@ static void gdb_accept(void) }/* set short latency */ -socket_set_nodelay (fd); +if (socket_set_nodelay (fd)) { +perror ("setsockopt" ); +return false; + } s =g_malloc0 (sizeof (GDBState)); s->c_cpu = first_cpu;
@@ -1843,6 +1846,7 @@ static void gdb_accept(void) gdb_has_xml = false; gdbserver_state = s; +return true; }static int gdbserver_open (int port)
@@ -1883,7 +1887,11 @@ int gdbserver_start(int port)if (gdbserver_fd <0 )return -1 ;/* accept connections */ -gdb_accept (); +if (!gdb_accept ()) { +close (gdbserver_fd); + gdbserver_fd =-1 ; +return -1 ; + }return 0 ; }
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 15/22] hw/timer/mt48t59: Fix bit-rotten NVRAM_PRINTF format strings
In reply to Michael TokarevFrom: Thomas Huth <[email protected]>
When compiling with NVRAM_PRINTF enabled, gcc currently bails out with:
CC hw/timer/m48t59.o
CC hw/timer/m48t59-isa.ohw/timer/m48t59.c: In function ‘NVRAM_writeb’:hw/timer/m48t59.c:460:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘hwaddr’ [-Werror=format=]
NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
^
hw/timer/m48t59.c:460:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format=]
hw/timer/m48t59.c: In function ‘NVRAM_readb’:
hw/timer/m48t59.c:492:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘hwaddr’ [-Werror=format=]
NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval);Fix it by using the correct format strings and while we're at it, also change the definition of NVRAM_PRINTF so that this can not bit-rot so easily again.
--- hw/timer/m48t59-internal.h | 9 +++------ hw/timer/m48t59.c | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-)
hw/timer/m48t59-internal.h +3 -6
@@ -25,13 +25,10 @@#ifndef HW_M48T59_INTERNAL_H #define HW_M48T59_INTERNAL_H 1 -//#define DEBUG_NVRAM +#define M48T59_DEBUG 0 -#if defined(DEBUG_NVRAM ) -#define NVRAM_PRINTF (fmt, ...) do { printf(fmt , ## __VA_ARGS__); } while (0) -#else -#define NVRAM_PRINTF (fmt, ...) do { } while (0) -#endif +#define NVRAM_PRINTF (fmt, ...) do { \ + if (M48T59_DEBUG) { printf(fmt , ## __VA_ARGS__); } } while (0)/* * The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has
hw/timer/m48t59.c +2 -2
@@ -456,7 +456,7 @@ static void NVRAM_writeb(void *opaque, hwaddr addr, uint64_t val, {M48t59State *NVRAM = opaque; -NVRAM_PRINTF ("%s: 0x%08x => 0x%08x\n" , __func__, addr, val); +NVRAM_PRINTF ("%s: 0x%" HWADDR_PRIx" => 0x%" PRIx64"\n" , __func__, addr, val);switch (addr) {case 0 :NVRAM ->addr &= ~0x00FF ;
@@ -488,7 +488,7 @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr, unsigned size) retval =-1 ;break ; } -NVRAM_PRINTF ("%s: 0x%08x <= 0x%08x\n" , __func__, addr, retval); +NVRAM_PRINTF ("%s: 0x%" HWADDR_PRIx" <= 0x%08x\n" , __func__, addr, retval);return retval; }
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 06/22] qemu-img-commands.hx: argument ordering fixups
In reply to Michael TokarevFrom: John Snow <[email protected]>
The TEXI and string versions are actually identical, except for markup. We can probably automate this... but make the ordering the same until then.
--- qemu-img-cmds.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
qemu-img-cmds.hx +3 -3
@@ -23,13 +23,13 @@ STEXI ETEXI DEF("check", img_check, - "check [-q] [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [-r [leaks | all]] [-T src_cache] [-U] filename") + "check [--object objectdef] [--image-opts] [-q] [-f fmt] [--output=ofmt] [-r [leaks | all]] [-T src_cache] [-U] filename") STEXI @item check [--object @var{objectdef}] [--image-opts] [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] [-U] @var{filename} ETEXI DEF("commit", img_commit, - "commit [-q] [--object objectdef] [--image-opts] [-f fmt] [-t cache] [-b base] [-d] [-p] filename") + "commit [--object objectdef] [--image-opts] [-q] [-f fmt] [-t cache] [-b base] [-d] [-p] filename") STEXI @item commit [--object @var{objectdef}] [--image-opts] [-q] [-f @var{fmt}] [-t @var{cache}] [-b @var{base}] [-d] [-p] @var{filename} ETEXI
@@ -47,7 +47,7 @@ STEXI ETEXI DEF("create", img_create, - "create [-q] [--object objectdef] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]") + "create [--object objectdef] [-q] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]") STEXI @item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}] ETEXI
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 08/22] qemu-img: remove references to GEN_DOCS
In reply to Michael TokarevFrom: John Snow <[email protected]>
Nothing seemingly uses this.
(jcody: commit 77bd1119ba even mentions that it appears unused)
--- qemu-img.c | 2 -- qemu-options-wrapper.h | 1 - 2 files changed, 3 deletions(-)
qemu-img.c +0 -2
@@ -123,7 +123,6 @@ static void QEMU_NORETURN help(void) " " arg_string "\n"#include "qemu-img-cmds.h" #undef DEF -#undef GEN_DOCS"\n" "Command parameters:\n" " 'filename' is a disk image filename\n"
@@ -4716,7 +4715,6 @@ static const img_cmd_t img_cmds[] = { { option, callback }, #include "qemu-img-cmds.h" #undef DEF -#undef GEN_DOCS { NULL, NULL, }, };
qemu-options-wrapper.h +0 -1
@@ -34,7 +34,6 @@#undef DEF#undef DEFHEADING#undef ARCHHEADING -#undef GEN_DOCS#undef QEMU_OPTIONS_GENERATE_ENUM#undef QEMU_OPTIONS_GENERATE_HELP
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 07/22] qemu-img.texi: fix command ordering
In reply to Michael TokarevFrom: John Snow <[email protected]>
This should match the summary ordering, which is alphabetical.
--- qemu-img.texi | 58 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 28 deletions(-)
qemu-img.texi +30 -28
@@ -193,6 +193,12 @@ sets the number of input blocks to skip Command description: @table @option + +@item amend [-p] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename} + +Amends the image format specific @var{options} for the image file +@var{filename}. Not all file formats support this operation. + @item bench [-c @var{count}] [-d @var{depth}] [-f @var{fmt}] [--flush-interval=@var{flush_interval}] [-n] [--no-drain] [-o @var{offset}] [--pattern=@var{pattern}] [-q] [-s @var{buffer_size}] [-S @var{step_size}] [-t @var{cache}] [-w] @var{filename} Run a simple sequential I/O benchmark on the specified image. If @code{-w} is
@@ -253,30 +259,6 @@ If @code{-r} is specified, exit codes representing the image state refer to the state after (the attempt at) repairing it. That is, a successful @code{-r all} will yield the exit code 0, independently of the image state before. -@item create [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}] - -Create the new disk image @var{filename} of size @var{size} and format -@var{fmt}. Depending on the file format, you can add one or more @var{options} -that enable additional features of this format. - -If the option @var{backing_file} is specified, then the image will record -only the differences from @var{backing_file}. No size needs to be specified in -this case. @var{backing_file} will never be modified unless you use the -@code{commit} monitor command (or qemu-img commit). - -If a relative path name is given, the backing file is looked up relative to -the directory containing @var{filename}. - -Note that a given backing file will be opened to check that it is valid. Use -the @code{-u} option to enable unsafe backing file mode, which means that the -image will be created even if the associated backing file cannot be opened. A -matching backing file must be created or additional options be used to make the -backing file specification valid when you want to use an image created this -way. - -The size can also be specified using the @var{size} option with @code{-o}, -it doesn't need to be specified separately in this case. - @item commit [-q] [-f @var{fmt}] [-t @var{cache}] [-b @var{base}] [-d] [-p] @var{filename} Commit the changes recorded in @var{filename} in its base image or backing file.
@@ -381,6 +363,30 @@ creating compressed images. @var{num_coroutines} specifies how many coroutines work in parallel during the convert process (defaults to 8). +@item create [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}] + +Create the new disk image @var{filename} of size @var{size} and format +@var{fmt}. Depending on the file format, you can add one or more @var{options} +that enable additional features of this format. + +If the option @var{backing_file} is specified, then the image will record +only the differences from @var{backing_file}. No size needs to be specified in +this case. @var{backing_file} will never be modified unless you use the +@code{commit} monitor command (or qemu-img commit). + +If a relative path name is given, the backing file is looked up relative to +the directory containing @var{filename}. + +Note that a given backing file will be opened to check that it is valid. Use +the @code{-u} option to enable unsafe backing file mode, which means that the +image will be created even if the associated backing file cannot be opened. A +matching backing file must be created or additional options be used to make the +backing file specification valid when you want to use an image created this +way. + +The size can also be specified using the @var{size} option with @code{-o}, +it doesn't need to be specified separately in this case. + @item dd [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] [skip=@var{blocks}] if=@var{input} of=@var{output} Dd copies from @var{input} file to @var{output} file converting it from
@@ -585,10 +591,6 @@ how the additional image area should be allocated on the host. See the format description in the @code{NOTES} section which values are allowed. Using this option may result in slightly more data being allocated than necessary. -@item amend [-p] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename} - -Amends the image format specific @var{options} for the image file -@var{filename}. Not all file formats support this operation. @end table @c man end
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 21/22] qapi/net.json: Fix the version number of the "vlan" removal
In reply to Michael TokarevFrom: Thomas Huth <[email protected]>
"vlan" will be dropped in 2.13, not in 2.12. And while we're at it, use the better wording "dropped in" instead of "removed with" (also for the "dump" removal).
--- qapi/net.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qapi/net.json +2 -2
@@ -450,7 +450,7 @@ # # Since: 2.7 # -# 'dump' - removed with 2.12 +# 'dump': dropped in 2.12 ## { 'enum': 'NetClientDriver', 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
@@ -498,7 +498,7 @@ # # Since: 1.2 # -# 'vlan' - removed with 2.12 +# 'vlan': dropped in 2.13 ## { 'struct': 'NetLegacy', 'data': {
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 09/22] qemu-img: Make documentation between .texi and .hx consistent
In reply to Michael TokarevFrom: John Snow <[email protected]>
These are also different and out of order for whatever reason. I'd like to automate this in the future, but for now let's put on the band-aid.
In the case of resize, there were options missing from all three docstrings; the new string is based on the code.
--- qemu-img-cmds.hx | 4 ++-- qemu-img.texi | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-)
qemu-img-cmds.hx +2 -2
@@ -89,9 +89,9 @@ STEXI ETEXI DEF("resize", img_resize, - "resize [--object objectdef] [--image-opts] [-q] [--shrink] filename [+ | -]size") + "resize [--object objectdef] [--image-opts] [-f fmt] [--preallocation=prealloc] [-q] [--shrink] filename [+ | -]size") STEXI -@item resize [--object @var{objectdef}] [--image-opts] [-q] [--shrink] @var{filename} [+ | -]@var{size} +@item resize [--object @var{objectdef}] [--image-opts] [-f @var{fmt}] [--preallocation=@var{prealloc}] [-q] [--shrink] @var{filename} [+ | -]@var{size} ETEXI STEXI
qemu-img.texi +12 -12
@@ -194,12 +194,12 @@ Command description: @table @option -@item amend [-p] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename} +@item amend [--object @var{objectdef}] [--image-opts] [-p] [-p] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename} Amends the image format specific @var{options} for the image file @var{filename}. Not all file formats support this operation. -@item bench [-c @var{count}] [-d @var{depth}] [-f @var{fmt}] [--flush-interval=@var{flush_interval}] [-n] [--no-drain] [-o @var{offset}] [--pattern=@var{pattern}] [-q] [-s @var{buffer_size}] [-S @var{step_size}] [-t @var{cache}] [-w] @var{filename} +@item bench [-c @var{count}] [-d @var{depth}] [-f @var{fmt}] [--flush-interval=@var{flush_interval}] [-n] [--no-drain] [-o @var{offset}] [--pattern=@var{pattern}] [-q] [-s @var{buffer_size}] [-S @var{step_size}] [-t @var{cache}] [-w] [-U] @var{filename} Run a simple sequential I/O benchmark on the specified image. If @code{-w} is specified, a write test is performed, otherwise a read test is performed.
@@ -223,7 +223,7 @@ specified as well. For write tests, by default a buffer filled with zeros is written. This can be overridden with a pattern byte specified by @var{pattern}. -@item check [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] @var{filename} +@item check [--object @var{objectdef}] [--image-opts] [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] [-U] @var{filename} Perform a consistency check on the disk image @var{filename}. The command can output in the format @var{ofmt} which is either @code{human} or @code{json}.
@@ -259,7 +259,7 @@ If @code{-r} is specified, exit codes representing the image state refer to the state after (the attempt at) repairing it. That is, a successful @code{-r all} will yield the exit code 0, independently of the image state before. -@item commit [-q] [-f @var{fmt}] [-t @var{cache}] [-b @var{base}] [-d] [-p] @var{filename} +@item commit [--object @var{objectdef}] [--image-opts] [-q] [-f @var{fmt}] [-t @var{cache}] [-b @var{base}] [-d] [-p] @var{filename} Commit the changes recorded in @var{filename} in its base image or backing file. If the backing file is smaller than the snapshot, then the backing file will be
@@ -281,7 +281,7 @@ all images between @var{base} and the top image will be invalid and may return garbage data when read. For this reason, @code{-b} implies @code{-d} (so that the top image stays valid). -@item compare [-f @var{fmt}] [-F @var{fmt}] [-T @var{src_cache}] [-p] [-s] [-q] @var{filename1} @var{filename2} +@item compare [--object @var{objectdef}] [--image-opts] [-f @var{fmt}] [-F @var{fmt}] [-T @var{src_cache}] [-p] [-q] [-s] [-U] @var{filename1} @var{filename2} Check if two images have the same content. You can compare images with different format or settings.
@@ -322,7 +322,7 @@ Error on reading data @end table -@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-m @var{num_coroutines}] [-W] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename} +@item convert [--object @var{objectdef}] [--image-opts] [--target-image-opts] [-U] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}] [-W] @var{filename} [@var{filename2} [...]] @var{output_filename} Convert the disk image @var{filename} or a snapshot @var{snapshot_param}(@var{snapshot_id_or_name} is deprecated) to disk image @var{output_filename} using format @var{output_fmt}. It can be optionally compressed (@code{-c}
@@ -363,7 +363,7 @@ creating compressed images. @var{num_coroutines} specifies how many coroutines work in parallel during the convert process (defaults to 8). -@item create [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}] +@item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}] Create the new disk image @var{filename} of size @var{size} and format @var{fmt}. Depending on the file format, you can add one or more @var{options}
@@ -387,7 +387,7 @@ way. The size can also be specified using the @var{size} option with @code{-o}, it doesn't need to be specified separately in this case. -@item dd [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] [skip=@var{blocks}] if=@var{input} of=@var{output} +@item dd [--image-opts] [-U] [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] [skip=@var{blocks}] if=@var{input} of=@var{output} Dd copies from @var{input} file to @var{output} file converting it from @var{fmt} format to @var{output_fmt} format.
@@ -398,7 +398,7 @@ dd will stop reading input after reading @var{blocks} input blocks. The size syntax is similar to dd(1)'s size syntax. -@item info [-f @var{fmt}] [--output=@var{ofmt}] [--backing-chain] @var{filename} +@item info [--object @var{objectdef}] [--image-opts] [-f @var{fmt}] [--output=@var{ofmt}] [--backing-chain] [-U] @var{filename} Give information about the disk image @var{filename}. Use it in particular to know the size reserved on disk which can be different
@@ -506,11 +506,11 @@ been written to all sectors. This is the maximum size that the image file can occupy with the exception of internal snapshots, dirty bitmaps, vmstate data, and other advanced image format features. -@item snapshot [-l | -a @var{snapshot} | -c @var{snapshot} | -d @var{snapshot} ] @var{filename} +@item snapshot [--object @var{objectdef}] [--image-opts] [-U] [-q] [-l | -a @var{snapshot} | -c @var{snapshot} | -d @var{snapshot}] @var{filename} List, apply, create or delete snapshots in image @var{filename}. -@item rebase [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename} +@item rebase [--object @var{objectdef}] [--image-opts] [-U] [-q] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename} Changes the backing file of an image. Only the formats @code{qcow2} and @code{qed} support changing the backing file.
@@ -570,7 +570,7 @@ qemu-img rebase -b base.img diff.qcow2 At this point, @code{modified.img} can be discarded, since @code{base.img + diff.qcow2} contains the same information. -@item resize [--shrink] [--preallocation=@var{prealloc}] @var{filename} [+ | -]@var{size} +@item resize [--object @var{objectdef}] [--image-opts] [-f @var{fmt}] [--preallocation=@var{prealloc}] [-q] [--shrink] @var{filename} [+ | -]@var{size} Change the disk image as if it had been created with @var{size}.
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 05/22] HACKING: document preference for g_new instead of g_malloc
In reply to Michael TokarevFrom: Murilo Opsfelder Araujo <[email protected]>
This patch documents the preference for g_new instead of g_malloc. The reasons were adapted from commit b45c03f585ea9bb1af76c73e82195418c294919d.
Discussion in QEMU's mailing list:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg03238.html
--- HACKING | 9 +++++++++ 1 file changed, 9 insertions(+)
HACKING +9 -0
@@ -118,6 +118,15 @@ Please note that g_malloc will exit on allocation failure, so there is no need to test for failure (as you would have to with malloc). Calling g_malloc with a zero size is valid and will return NULL. +Prefer g_new(T, n) instead of g_malloc(sizeof(T) * n) for the following +reasons: + + a. It catches multiplication overflowing size_t; + b. It returns T * instead of void *, letting compiler catch more type + errors. + +Declarations like T *v = g_malloc(sizeof(*v)) are acceptable, though. + Memory allocated by qemu_memalign or qemu_blockalign must be freed with qemu_vfree, since breaking this will cause problems on Win32.
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 10/22] qemu-img-cmds.hx: add passive-aggressive note
In reply to Michael TokarevFrom: John Snow <[email protected]>
I'm kidding. It's very easy to forget there are per-command sections in the texi, and insane that we don't autogenerate those, too.
Until then, leave a little post-it note in this .hx file until I find a way to delete it.
--- qemu-img-cmds.hx | 3 +++ 1 file changed, 3 insertions(+)
qemu-img-cmds.hx +3 -0
@@ -6,6 +6,9 @@ HXCOMM DEF(command, callback, arg_string) is used to construct HXCOMM command structures and help message. HXCOMM HXCOMM can be used for comments, discarded from both texi and C +HXCOMM When amending the TEXI sections, please remember to copy the usage +HXCOMM over to the per-command sections in qemu-img.texi. + STEXI @table @option ETEXI
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 22/22] acpi: fix a comment about aml_call0()
In reply to Michael TokarevFrom: Marc-André Lureau <[email protected]>
--- hw/acpi/aml-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/aml-build.c +1 -1
@@ -627,7 +627,7 @@ Aml *aml_notify(Aml *arg1, Aml *arg2)return var; } -/* helper to call method with 1 argument */ +/* helper to call method without argument */ Aml *aml_call0 (const char *method) {Aml *var =aml_alloc ();
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 16/22] qemu-options: Allow -no-user-config again
In reply to Michael TokarevFrom: Michal Privoznik <[email protected]>
After 1217d6ca2bf28c0febe1bd7d5b3fa912bbf6af2a we error out explicitly if an unknown -option was passed on the command line. However, we are doing two pass command line option parsing. In the first pass we just look for -no-user-config or -nodefconfig being present which determines whether we load user config or not. Then in the second pass we finally parse everything else throwing an error if an unsupported -option was found. Problem is that in the second pass -no-user-config and -nodefconfig are not handled explicitly which makes us throw the unsupported option error.
--- vl.c | 4 ++++ 1 file changed, 4 insertions(+)
vl.c +4 -0
@@ -4011,6 +4011,10 @@ int main(int argc, char **argv, char **envp)exit (1 ); }break ; +case QEMU_OPTION_nodefconfig: +case QEMU_OPTION_nouserconfig: +/* Nothing to be parsed here. Especially, do not error out below. */ +break ;default :if (os_parse_cmd_args (popt->index, optarg)) {error_report ("Option not supported in this build" );
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 11/22] hw/ide/ahci: Keep ALLWINNER_AHCI() macro internal
In reply to Michael TokarevFrom: Philippe Mathieu-Daudé <[email protected]>
The ALLWINNER_AHCI() macro is only used in ahci-allwinner.c.
--- hw/ide/ahci-allwinner.c | 3 +++ hw/ide/ahci_internal.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/ide/ahci-allwinner.c +3 -0
@@ -24,6 +24,9 @@#include "trace.h" +#define ALLWINNER_AHCI (obj) \ + OBJECT_CHECK(AllwinnerAHCIState, (obj), TYPE_ALLWINNER_AHCI) +#define ALLWINNER_AHCI_BISTAFR ((0xa0 - ALLWINNER_AHCI_MMIO_OFF) / 4)#define ALLWINNER_AHCI_BISTCR ((0xa4 - ALLWINNER_AHCI_MMIO_OFF) / 4)#define ALLWINNER_AHCI_BISTFCTR ((0xa8 - ALLWINNER_AHCI_MMIO_OFF) / 4)
hw/ide/ahci_internal.h +0 -3
@@ -375,7 +375,4 @@ void ahci_reset(AHCIState *s);#define SYSBUS_AHCI (obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) -#define ALLWINNER_AHCI (obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \ - TYPE_ALLWINNER_AHCI) -#endif /* HW_IDE_AHCI_H */
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 12/22] tests: fix tpm-crb tpm-tis tests race
In reply to Michael TokarevFrom: Marc-André Lureau <[email protected]>
No need to close the TPM data socket on the emulator end, qemu will close it after a SHUTDOWN. This avoids a race between close() and read() in the TPM data thread.
--- tests/tpm-emu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tpm-emu.c +1 -1
@@ -125,7 +125,7 @@ void *tpm_emu_ctrl_thread(void *data)case CMD_SHUTDOWN : {ptm_res res =0 ;qio_channel_write (ioc, (char *)&res,sizeof (res), &error_abort); -qio_channel_close (s->tpm_ioc, &error_abort); +/* the tpm data thread is expected to finish now */ g_thread_join (s->emu_tpm_thread);break ; }
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 18/22] replace functions which are only available in glib-2.24
In reply to Michael TokarevFrom: Olaf Hering <[email protected]>
Currently the minimal supported version of glib is 2.22. Since testing is done with a glib that claims to be 2.22, but in fact has APIs from newer version of glib, this bug was not caught during submit of the patch referenced below.
Replace g_realloc_n, which is available only since 2.24, with g_renew.
Fixes commit 418026ca43 ("util: Introduce vfio helpers")
--- util/vfio-helpers.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
util/vfio-helpers.c +2 -4
@@ -522,8 +522,7 @@ static IOVAMapping *qemu_vfio_add_mapping(QEMUVFIOState *s,assert (index >=0 ); s->nr_mappings++; - s->mappings =g_realloc_n (s->mappings,sizeof (s->mappings[0 ]), - s->nr_mappings); + s->mappings =g_renew (IOVAMapping, s->mappings, s->nr_mappings); insert = &s->mappings[index]; shift = s->nr_mappings - index -1 ;if (shift) {
@@ -577,8 +576,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IOVAMapping *mapping,memmove (mapping, &s->mappings[index +1 ],sizeof (s->mappings[0 ]) * (s->nr_mappings - index -1 )); s->nr_mappings--; - s->mappings =g_realloc_n (s->mappings,sizeof (s->mappings[0 ]), - s->nr_mappings); + s->mappings =g_renew (IOVAMapping, s->mappings, s->nr_mappings); }/* Check if the mapping list is (ascending) ordered. */
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 19/22] gdbstub: Use qemu_set_cloexec()
In reply to Michael TokarevFrom: Peter Maydell <[email protected]>
Use the utility routine qemu_set_cloexec() rather than manually calling fcntl(). This lets us drop the #ifndef _WIN32 guards and also means Coverity doesn't complain that we're ignoring the fcntl error return (CID 1005665, CID 1005667).
--- gdbstub.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
gdbstub.c +2 -6
@@ -1828,9 +1828,7 @@ static void gdb_accept(void)perror ("accept" );return ; }else if (fd >=0 ) { -#ifndef _WIN32 -fcntl (fd,F_SETFD ,FD_CLOEXEC ); -#endif +qemu_set_cloexec (fd);break ; } }
@@ -1857,9 +1855,7 @@ static int gdbserver_open(int port)perror ("socket" );return -1 ; } -#ifndef _WIN32 -fcntl (fd,F_SETFD ,FD_CLOEXEC ); -#endif +qemu_set_cloexec (fd);socket_set_fast_reuse (fd);
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 14/22] Remove unnecessary variables for function return value
In reply to Michael TokarevFrom: Laurent Vivier <[email protected]>
Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
ppc part
--- accel/tcg/translate-all.c | 5 +- block/quorum.c | 6 +-- hw/arm/exynos4210.c | 6 +-- hw/block/vhost-user-blk.c | 5 +- hw/hppa/dino.c | 5 +- hw/misc/mos6522.c | 8 +--- hw/net/ftgmac100.c | 5 +- hw/ppc/pnv_lpc.c | 16 ++----- io/net-listener.c | 6 +-- target/i386/hax-darwin.c | 10 ++-- target/mips/dsp_helper.c | 15 ++---- target/xtensa/core-dc232b/xtensa-modules.inc.c | 56 ++++++---------------- target/xtensa/core-dc233c/xtensa-modules.inc.c | 56 ++++++---------------- target/xtensa/core-de212/xtensa-modules.inc.c | 48 +++++-------------- target/xtensa/core-fsf/xtensa-modules.inc.c | 32 ++++--------- .../core-sample_controller/xtensa-modules.inc.c | 24 +++------- target/xtensa/translate.c | 7 +-- tests/m48t59-test.c | 6 +-- tests/test-thread-pool.c | 6 +-- util/uri.c | 5 +- 20 files changed, 79 insertions(+), 248 deletions(-)
accel/tcg/translate-all.c +1 -4
@@ -644,11 +644,8 @@ static inline void *alloc_code_gen_buffer(void)static inline void *alloc_code_gen_buffer (void ) {size_t size = tcg_ctx->code_gen_buffer_size; -void *buf; - - buf =VirtualAlloc (NULL , size,MEM_RESERVE |MEM_COMMIT , +return VirtualAlloc (NULL , size,MEM_RESERVE |MEM_COMMIT ,PAGE_EXECUTE_READWRITE ); -return buf; }#else static inline void *alloc_code_gen_buffer (void )
block/quorum.c +2 -4
@@ -613,7 +613,7 @@ static void read_quorum_children_entry(void *opaque)static int read_quorum_children (QuorumAIOCB *acb) {BDRVQuorumState *s = acb->bs->opaque; -int i, ret; +int i; acb->children_read = s->num_children;for (i =0 ; i < s->num_children; i++) {
@@ -648,9 +648,7 @@ static int read_quorum_children(QuorumAIOCB *acb)qemu_coroutine_yield (); } - ret = acb->vote_ret; - -return ret; +return acb->vote_ret; }static int read_fifo_child (QuorumAIOCB *acb)
hw/arm/exynos4210.c +1 -5
@@ -156,12 +156,8 @@ void exynos4210_write_secondary(ARMCPU *cpu,static uint64_t exynos4210_calc_affinity (int cpu) { -uint64_t mp_affinity; -/* Exynos4210 has 0x9 as cluster ID */ - mp_affinity = (0x9 <<ARM_AFF1_SHIFT ) | cpu; - -return mp_affinity; +return (0x9 <<ARM_AFF1_SHIFT ) | cpu; }Exynos4210State *exynos4210_init (MemoryRegion *system_mem)
hw/block/vhost-user-blk.c +1 -4
@@ -196,7 +196,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev, Error **errp) {VHostUserBlk *s =VHOST_USER_BLK (vdev); -uint64_t get_features;/* Turn on pre-defined features */ virtio_add_feature (&features,VIRTIO_BLK_F_SEG_MAX );
@@ -215,9 +214,7 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,virtio_add_feature (&features,VIRTIO_BLK_F_MQ ); } - get_features =vhost_get_features (&s->dev, user_feature_bits, features); - -return get_features; +return vhost_get_features (&s->dev, user_feature_bits, features); }static void vhost_user_blk_handle_output (VirtIODevice *vdev,VirtQueue *vq)
hw/hppa/dino.c +1 -4
@@ -403,13 +403,10 @@ static void dino_set_irq(void *opaque, int irq, int level)static int dino_pci_map_irq (PCIDevice *d,int irq_num) {int slot = d->devfn >>3 ; -int local_irq;assert (irq_num >=0 && irq_num <=3 ); - local_irq = slot &0x03 ; - -return local_irq; +return slot &0x03 ; }static void dino_set_timer_irq (void *opaque,int irq,int level)
hw/misc/mos6522.c +2 -6
@@ -176,12 +176,8 @@ static void mos6522_set_sr_int(MOS6522State *s)static uint64_t mos6522_get_counter_value (MOS6522State *s,MOS6522Timer *ti) { -uint64_t d; - - d =muldiv64 (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) - ti->load_time, - ti->frequency,NANOSECONDS_PER_SECOND ); - -return d; +return muldiv64 (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) - ti->load_time, + ti->frequency,NANOSECONDS_PER_SECOND ); }static uint64_t mos6522_get_load_time (MOS6522State *s,MOS6522Timer *ti)
hw/net/ftgmac100.c +1 -4
@@ -511,7 +511,6 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)uint32_t cnt =1024 *FTGMAC100_APTC_RXPOLL_CNT (s->aptcr);uint32_t speed = (s->maccr &FTGMAC100_MACCR_FAST_MODE ) ?1 :0 ; -uint32_t period;if (s->aptcr &FTGMAC100_APTC_RXPOLL_TIME_SEL ) { cnt <<=4 ;
@@ -521,9 +520,7 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s) speed =2 ; } - period = cnt / div[speed]; - -return period; +return cnt / div[speed]; }static void ftgmac100_reset (DeviceState *d)
hw/ppc/pnv_lpc.c +4 -12
@@ -125,25 +125,17 @@ static int pnv_lpc_dt_xscom(PnvXScomInterface *dev, void *fdt, int xscom_offset)static bool opb_read (PnvLpcController *lpc,uint32_t addr,uint8_t *data,int sz) { -bool success; -/* XXX Handle access size limits and FW read caching here */ - success = !address_space_rw (&lpc->opb_as, addr,MEMTXATTRS_UNSPECIFIED , - data, sz, false); - -return success; +return !address_space_rw (&lpc->opb_as, addr,MEMTXATTRS_UNSPECIFIED , + data, sz, false); }static bool opb_write (PnvLpcController *lpc,uint32_t addr,uint8_t *data,int sz) { -bool success; -/* XXX Handle access size limits here */ - success = !address_space_rw (&lpc->opb_as, addr,MEMTXATTRS_UNSPECIFIED , - data, sz, true); - -return success; +return !address_space_rw (&lpc->opb_as, addr,MEMTXATTRS_UNSPECIFIED , + data, sz, true); }#define ECCB_CTL_READ PPC_BIT(15)
io/net-listener.c +1 -5
@@ -25,11 +25,7 @@QIONetListener *qio_net_listener_new (void ) { -QIONetListener *ret; - - ret =QIO_NET_LISTENER (object_new (TYPE_QIO_NET_LISTENER )); - -return ret; +return QIO_NET_LISTENER (object_new (TYPE_QIO_NET_LISTENER )); } void qio_net_listener_set_name(QIONetListener *listener,
target/i386/hax-darwin.c +3 -7
@@ -257,10 +257,7 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu)int hax_vcpu_run (struct hax_vcpu_state *vcpu) { -int ret; - - ret =ioctl (vcpu->fd,HAX_VCPU_IOCTL_RUN ,NULL ); -return ret; +return ioctl (vcpu->fd,HAX_VCPU_IOCTL_RUN ,NULL ); }int hax_sync_fpu (CPUArchState *env,struct fx_layout *fl,int set)
@@ -315,13 +312,12 @@ int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state, int set)int hax_inject_interrupt (CPUArchState *env,int vector) { -int ret, fd; +int fd; fd =hax_vcpu_get_fd (env);if (fd <=0 ) {return -1 ; } - ret =ioctl (fd,HAX_VCPU_IOCTL_INTERRUPT , &vector); -return ret; +return ioctl (fd,HAX_VCPU_IOCTL_INTERRUPT , &vector); }
target/mips/dsp_helper.c +3 -12
@@ -3274,14 +3274,11 @@ target_ulong helper_dextr_l(target_ulong ac, target_ulong shift, CPUMIPSState *env) {uint64_t temp[3 ]; -target_ulong result; shift = shift &0x3F ;mipsdsp_rndrashift_acc (temp, ac, shift, env); - result = (temp[1 ] <<63 ) | (temp[0 ] >>1 ); - -return result; +return (temp[1 ] <<63 ) | (temp[0 ] >>1 ); } target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
@@ -3289,7 +3286,6 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift, {uint64_t temp[3 ];uint32_t temp128; -target_ulong result; shift = shift &0x3F ;mipsdsp_rndrashift_acc (temp, ac, shift, env);
@@ -3309,9 +3305,7 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,set_DSPControl_overflow_flag (1 ,23 , env); } - result = (temp[1 ] <<63 ) | (temp[0 ] >>1 ); - -return result; +return (temp[1 ] <<63 ) | (temp[0 ] >>1 ); } target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
@@ -3319,7 +3313,6 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift, {uint64_t temp[3 ];uint32_t temp128; -target_ulong result; shift = shift &0x3F ;mipsdsp_rndrashift_acc (temp, ac, shift, env);
@@ -3345,9 +3338,7 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift, }set_DSPControl_overflow_flag (1 ,23 , env); } - result = (temp[1 ] <<63 ) | (temp[0 ] >>1 ); - -return result; +return (temp[1 ] <<63 ) | (temp[0 ] >>1 ); }#endif
target/xtensa/core-dc232b/xtensa-modules.inc.c +14 -42
140 lines not on this page · raw message
target/xtensa/core-dc233c/xtensa-modules.inc.c +14 -42
140 lines not on this page · raw message
target/xtensa/core-de212/xtensa-modules.inc.c +12 -36
120 lines not on this page · raw message
target/xtensa/core-fsf/xtensa-modules.inc.c +8 -24
@@ -1379,9 +1379,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_arr_encode (uint32 *valp) { -int error; - error = (*valp & ~0xf ) !=0 ; -return error; +return (*valp & ~0xf ) !=0 ; } static int
@@ -1393,9 +1391,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_ars_encode (uint32 *valp) { -int error; - error = (*valp & ~0xf ) !=0 ; -return error; +return (*valp & ~0xf ) !=0 ; } static int
@@ -1407,9 +1403,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_art_encode (uint32 *valp) { -int error; - error = (*valp & ~0xf ) !=0 ; -return error; +return (*valp & ~0xf ) !=0 ; } static int
@@ -1421,9 +1415,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_ar0_encode (uint32 *valp) { -int error; - error = (*valp & ~0x3f ) !=0 ; -return error; +return (*valp & ~0x3f ) !=0 ; } static int
@@ -1435,9 +1427,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_ar4_encode (uint32 *valp) { -int error; - error = (*valp & ~0x3f ) !=0 ; -return error; +return (*valp & ~0x3f ) !=0 ; } static int
@@ -1449,9 +1439,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_ar8_encode (uint32 *valp) { -int error; - error = (*valp & ~0x3f ) !=0 ; -return error; +return (*valp & ~0x3f ) !=0 ; } static int
@@ -1463,9 +1451,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_ar12_encode (uint32 *valp) { -int error; - error = (*valp & ~0x3f ) !=0 ; -return error; +return (*valp & ~0x3f ) !=0 ; } static int
@@ -1477,9 +1463,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)static int Operand_ars_entry_encode (uint32 *valp) { -int error; - error = (*valp & ~0x3f ) !=0 ; -return error; +return (*valp & ~0x3f ) !=0 ; } static int
target/xtensa/core-sample_controller/xtensa-modules.inc.c +6 -18
@@ -1570,9 +1570,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED)static int OperandSem_opnd_sem_AR_encode (uint32 *valp) { -int error; - error = (*valp >=32 ); -return error; +return (*valp >=32 ); } static int
@@ -1584,9 +1582,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED)static int OperandSem_opnd_sem_AR_0_encode (uint32 *valp) { -int error; - error = (*valp >=32 ); -return error; +return (*valp >=32 ); } static int
@@ -1598,9 +1594,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)static int OperandSem_opnd_sem_AR_1_encode (uint32 *valp) { -int error; - error = (*valp >=32 ); -return error; +return (*valp >=32 ); } static int
@@ -1612,9 +1606,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)static int OperandSem_opnd_sem_AR_2_encode (uint32 *valp) { -int error; - error = (*valp >=32 ); -return error; +return (*valp >=32 ); } static int
@@ -1626,9 +1618,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)static int OperandSem_opnd_sem_AR_3_encode (uint32 *valp) { -int error; - error = (*valp >=32 ); -return error; +return (*valp >=32 ); } static int
@@ -1640,9 +1630,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)static int OperandSem_opnd_sem_AR_4_encode (uint32 *valp) { -int error; - error = (*valp >=32 ); -return error; +return (*valp >=32 ); } static int
target/xtensa/translate.c +2 -5
@@ -1271,11 +1271,8 @@ XtensaOpcodeOps * xtensa_find_opcode_ops(const XtensaOpcodeTranslators *t, const char *name) { - XtensaOpcodeOps *ops; - - ops =bsearch (name, t->opcode, t->num_opcodes, -sizeof (XtensaOpcodeOps), compare_opcode_ops); -return ops; + return bsearch(name, t->opcode, t->num_opcodes, + sizeof(XtensaOpcodeOps ), compare_opcode_ops); } static void translate_abs(DisasContext *dc, const uint32_t arg[],
tests/m48t59-test.c +1 -5
@@ -256,8 +256,6 @@ static void base_setup(void)int main (int argc,char **argv) { -int ret; -base_setup ();g_test_init (&argc, &argv,NULL );
@@ -267,7 +265,5 @@ int main(int argc, char **argv)qtest_add_func ("/rtc/bcd-check-time" , bcd_check_time); }qtest_add_func ("/rtc/fuzz-registers" , fuzz_registers); - ret =g_test_run (); - -return ret; +return g_test_run (); }
tests/test-thread-pool.c +1 -5
@@ -224,8 +224,6 @@ static void test_cancel_async(void)int main (int argc,char **argv) { -int ret; -qemu_init_main_loop (&error_abort); ctx =qemu_get_current_aio_context (); pool =aio_get_thread_pool (ctx);
@@ -238,7 +236,5 @@ int main(int argc, char **argv)g_test_add_func ("/thread-pool/cancel" , test_cancel);g_test_add_func ("/thread-pool/cancel-async" , test_cancel_async); - ret =g_test_run (); - -return ret; +return g_test_run (); }
util/uri.c +1 -4
@@ -1065,10 +1065,7 @@ URI *uri_parse_raw(const char *str, int raw)*/ URI *uri_new (void ) { -URI *ret; - - ret =g_new0 (URI ,1 ); -return ret; +return g_new0 (URI ,1 ); }/**
Signature · 1 line
2.11.0
Peter Maydell
AppliedQuoted 17 lines · Michael Tokarev
Hello!
This is a next trivial-patches pull request. It's been a while since the last pull, and quite some changes has been accumulated.
Please consider pulling/applying.
Thanks,
/mjt
The following changes since commit
5bcf917ee37a5efbef99f091a96db54a5276becb:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180518' into staging (2018-05-18 18:25:29 +0100)
are available in the git repository at:
Quoted 9 lines
git://git.corpit.ru/qemu.gittags/trivial-patches-fetchfor you to fetch changes up to
9a232487aab8a7640ff8853d7d8d7c27106b44f8:acpi: fix a comment about
aml_call0()(2018-05-20 08:58:58 +0300)----------------------------------------------------------------
trivial patches for 2018-05-20
Applied, thanks.
-- PMM
Re: [Qemu-devel] [PULL 20/22] gdbstub: Handle errors in gdb_accept()
In reply to Michael TokarevQuoted 39 lines · Michael Tokarev
From: Peter Maydell <[email protected]>
In
gdb_accept(), we both fail to check all errors (notably that fromsocket_set_nodelay(), as Coverity notes in CID 1005666), and fail to return an error status back to our caller. Correct both of these things, so that errors inaccept()result in our stopping with a useful error message rather than ignoring it.Signed-off-by Peter Maydell <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Thomas Huth <[email protected]>Signed-off-by Michael Tokarev <[email protected]>--- gdbstub.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)gdbstub.c +2
-2@@ -1814,7 +1814,7 @@ void gdb_signalled(CPUArchState *env, int sig)put_packet (s, buf); } -static void gdb_accept (void ) +static bool gdb_accept (void ) {GDBState *s;struct sockaddr_in sockaddr;@@ -1826,7 +1826,7 @@ static void gdb_accept(void) fd =accept (gdbserver_fd, (struct sockaddr *)&sockaddr, &len);if (fd <0 && errno !=EINTR ) {perror ("accept" ); -return ; +return false; }else if (fd >=0 ) {qemu_set_cloexec (fd);break ;
gdbstub.c static void gdb_accept(void) · line 1839
Quoted 7 lines
gdbstub.c +3
-1@@ -1834,7 +1834,10 @@ static void gdb_accept(void) }/* set short latency */ -socket_set_nodelay (fd); +if (socket_set_nodelay (fd)) { +perror ("setsockopt" ); +return false;
Coverity notes that this leaks fd.
Paolo
Quoted 26 lines
gdbstub.c +7
-1+ } s =g_malloc0 (sizeof (GDBState)); s->c_cpu = first_cpu;@@ -1843,6 +1846,7 @@ static void gdb_accept(void) gdb_has_xml = false; gdbserver_state = s; +return true; }static int gdbserver_open (int port)@@ -1883,7 +1887,11 @@ int gdbserver_start(int port)if (gdbserver_fd <0 )return -1 ;/* accept connections */ -gdb_accept (); +if (!gdb_accept ()) { +close (gdbserver_fd); + gdbserver_fd =-1 ; +return -1 ; + }return 0 ; }
Re: [Qemu-devel] [Qemu-trivial] [PULL 20/22] gdbstub: Handle errors in gdb_accept()
Quoted 42 lines · Paolo Bonzini
Quoted 41 lines · Michael Tokarev
From: Peter Maydell <[email protected]>
In
gdb_accept(), we both fail to check all errors (notably that fromsocket_set_nodelay(), as Coverity notes in CID 1005666), and fail to return an error status back to our caller. Correct both of these things, so that errors inaccept()result in our stopping with a useful error message rather than ignoring it.Signed-off-by Peter Maydell <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Thomas Huth <[email protected]>Signed-off-by Michael Tokarev <[email protected]>--- gdbstub.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)gdbstub.c +2
-2@@ -1814,7 +1814,7 @@ void gdb_signalled(CPUArchState *env, int sig)put_packet (s, buf); } -static void gdb_accept (void ) +static bool gdb_accept (void ) {GDBState *s;struct sockaddr_in sockaddr;@@ -1826,7 +1826,7 @@ static void gdb_accept(void) fd =accept (gdbserver_fd, (struct sockaddr *)&sockaddr, &len);if (fd <0 && errno !=EINTR ) {perror ("accept" ); -return ; +return false; }else if (fd >=0 ) {qemu_set_cloexec (fd);break ;@@ -1834,7 +1834,10 @@ static void gdb_accept(void) }
Quoted 7 lines
gdbstub.c static void gdb_accept(void) · line 1839
Quoted 5 lines
gdbstub.c +3
-1/* set short latency */ -socket_set_nodelay (fd); +if (socket_set_nodelay (fd)) { +perror ("setsockopt" ); +return false;Coverity notes that this leaks fd.
Oops didn't noticed. It this is so trivial than Coverity could directly send the fix to the list, like modern compilers.
Quoted 24 lines
Quoted 24 lines
gdbstub.c +7
-1+ } s =g_malloc0 (sizeof (GDBState)); s->c_cpu = first_cpu;@@ -1843,6 +1846,7 @@ static void gdb_accept(void) gdb_has_xml = false; gdbserver_state = s; +return true; }static int gdbserver_open (int port)@@ -1883,7 +1887,11 @@ int gdbserver_start(int port)if (gdbserver_fd <0 )return -1 ;/* accept connections */ -gdb_accept (); +if (!gdb_accept ()) { +close (gdbserver_fd); + gdbserver_fd =-1 ; +return -1 ; + }return 0 ; }