From 070c7607f62f9623be9ff14623a43b0ca195c572 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Tue, 31 Mar 2015 14:49:09 -0400 Subject: [PATCH 01/42] tpm: Cast 64bit variables to int when used in DPRINTF Cast 64bit variables to int when used in DPRINTF. They only contain 32bit of data. Signed-off-by: Stefan Berger Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- hw/tpm/tpm_tis.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 815c8eace1..cb9c7c87af 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -421,7 +421,7 @@ static void tpm_tis_dump_state(void *opaque, hwaddr addr) for (idx = 0; regs[idx] != 0xfff; idx++) { DPRINTF("tpm_tis: 0x%04x : 0x%08x\n", regs[idx], - (uint32_t)tpm_tis_mmio_read(opaque, base + regs[idx], 4)); + (int)tpm_tis_mmio_read(opaque, base + regs[idx], 4)); } DPRINTF("tpm_tis: read offset : %d\n" @@ -555,7 +555,7 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr, val >>= shift; } - DPRINTF("tpm_tis: read.%u(%08x) = %08x\n", size, (int)addr, (uint32_t)val); + DPRINTF("tpm_tis: read.%u(%08x) = %08x\n", size, (int)addr, (int)val); return val; } @@ -578,7 +578,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, uint16_t len; uint32_t mask = (size == 1) ? 0xff : ((size == 2) ? 0xffff : ~0); - DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr, (uint32_t)val); + DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr, (int)val); if (locty == 4 && !hw_access) { DPRINTF("tpm_tis: Access to locality 4 only allowed from hardware\n"); @@ -815,7 +815,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, /* drop the byte */ } else { DPRINTF("tpm_tis: Data to send to TPM: %08x (size=%d)\n", - val, size); + (int)val, size); if (tis->loc[locty].state == TPM_TIS_STATE_READY) { tis->loc[locty].state = TPM_TIS_STATE_RECEPTION; tpm_tis_sts_set(&tis->loc[locty], From 4d1ba9c4f8a4d68b9d053946d551ffa8f1006b77 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Tue, 31 Mar 2015 14:49:10 -0400 Subject: [PATCH 02/42] tpm: Modify DPRINTF to enable -Wformat checking Modify DPRINTF to always enable -Wformat checking. Signed-off-by: Stefan Berger Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- hw/tpm/tpm_passthrough.c | 14 ++++++-------- hw/tpm/tpm_tis.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c index 2a45071e36..73ca906282 100644 --- a/hw/tpm/tpm_passthrough.c +++ b/hw/tpm/tpm_passthrough.c @@ -34,15 +34,13 @@ #include "sysemu/tpm_backend_int.h" #include "tpm_tis.h" -/* #define DEBUG_TPM */ +#define DEBUG_TPM 0 -#ifdef DEBUG_TPM -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_TPM) { \ + fprintf(stderr, fmt, ## __VA_ARGS__); \ + } \ +} while (0); #define TYPE_TPM_PASSTHROUGH "tpm-passthrough" #define TPM_PASSTHROUGH(obj) \ diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index cb9c7c87af..4b6d601204 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -30,15 +30,13 @@ #include "qemu-common.h" #include "qemu/main-loop.h" -/*#define DEBUG_TIS */ +#define DEBUG_TIS 0 -#ifdef DEBUG_TIS -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_TIS) { \ + printf(fmt, ## __VA_ARGS__); \ + } \ +} while (0); /* whether the STS interrupt is supported */ #define RAISE_STS_IRQ From 4188e39055bfaf6d76b7d98294b0aeb8e4f3082d Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Thu, 9 Apr 2015 02:04:10 +0800 Subject: [PATCH 03/42] bitops : fix coding style don't mix tab and space. The rule is 4 spaces Signed-off-by: Chih-Min Chao Reviewed-by: Gerd Hoffmann Signed-off-by: Michael Tokarev --- include/qemu/bitops.h | 61 ++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 90ca8df4e2..8abdcf9077 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -20,10 +20,10 @@ #define BITS_PER_BYTE CHAR_BIT #define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE) -#define BIT(nr) (1UL << (nr)) -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +#define BIT(nr) (1UL << (nr)) +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) /** * set_bit - Set a bit in memory @@ -32,10 +32,10 @@ */ static inline void set_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); - *p |= mask; + *p |= mask; } /** @@ -45,10 +45,10 @@ static inline void set_bit(long nr, unsigned long *addr) */ static inline void clear_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); - *p &= ~mask; + *p &= ~mask; } /** @@ -58,10 +58,10 @@ static inline void clear_bit(long nr, unsigned long *addr) */ static inline void change_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); - *p ^= mask; + *p ^= mask; } /** @@ -71,12 +71,12 @@ static inline void change_bit(long nr, unsigned long *addr) */ static inline int test_and_set_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); - unsigned long old = *p; + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); + unsigned long old = *p; - *p = old | mask; - return (old & mask) != 0; + *p = old | mask; + return (old & mask) != 0; } /** @@ -86,12 +86,12 @@ static inline int test_and_set_bit(long nr, unsigned long *addr) */ static inline int test_and_clear_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); - unsigned long old = *p; + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); + unsigned long old = *p; - *p = old & ~mask; - return (old & mask) != 0; + *p = old & ~mask; + return (old & mask) != 0; } /** @@ -101,12 +101,12 @@ static inline int test_and_clear_bit(long nr, unsigned long *addr) */ static inline int test_and_change_bit(long nr, unsigned long *addr) { - unsigned long mask = BIT_MASK(nr); - unsigned long *p = addr + BIT_WORD(nr); - unsigned long old = *p; + unsigned long mask = BIT_MASK(nr); + unsigned long *p = addr + BIT_WORD(nr); + unsigned long old = *p; - *p = old ^ mask; - return (old & mask) != 0; + *p = old ^ mask; + return (old & mask) != 0; } /** @@ -116,7 +116,7 @@ static inline int test_and_change_bit(long nr, unsigned long *addr) */ static inline int test_bit(long nr, const unsigned long *addr) { - return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); + return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); } /** @@ -136,7 +136,8 @@ unsigned long find_last_bit(const unsigned long *addr, * @size: The bitmap size in bits */ unsigned long find_next_bit(const unsigned long *addr, - unsigned long size, unsigned long offset); + unsigned long size, + unsigned long offset); /** * find_next_zero_bit - find the next cleared bit in a memory region From 494cb81741f867319f11ecfa0949168baf9f01d7 Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Thu, 9 Apr 2015 02:04:11 +0800 Subject: [PATCH 04/42] ui/vnc : fix coding style reported by checkpatch.pl Signed-off-by: Chih-Min Chao Reviewed-by: Gerd Hoffmann Signed-off-by: Michael Tokarev --- ui/vnc-auth-vencrypt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c index a420ccbd1d..65f1afae46 100644 --- a/ui/vnc-auth-vencrypt.c +++ b/ui/vnc-auth-vencrypt.c @@ -65,7 +65,8 @@ static void start_auth_vencrypt_subauth(VncState *vs) static void vnc_tls_handshake_io(void *opaque); -static int vnc_start_vencrypt_handshake(struct VncState *vs) { +static int vnc_start_vencrypt_handshake(struct VncState *vs) +{ int ret; if ((ret = gnutls_handshake(vs->tls.session)) < 0) { @@ -100,7 +101,8 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs) { return 0; } -static void vnc_tls_handshake_io(void *opaque) { +static void vnc_tls_handshake_io(void *opaque) +{ struct VncState *vs = (struct VncState *)opaque; VNC_DEBUG("Handshake IO continue\n"); From 4769a881cbe1130e7ba4650471ef37e2cf998a9c Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Thu, 9 Apr 2015 02:04:12 +0800 Subject: [PATCH 05/42] ui/vnc : remove 'struct' of 'typedef struct' Signed-off-by: Chih-Min Chao Reviewed-by: Gerd Hoffmann Signed-off-by: Michael Tokarev --- ui/vnc-auth-vencrypt.c | 4 ++-- ui/vnc-tls.c | 10 +++++----- ui/vnc-ws.c | 4 ++-- ui/vnc.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c index 65f1afae46..03ea48a69c 100644 --- a/ui/vnc-auth-vencrypt.c +++ b/ui/vnc-auth-vencrypt.c @@ -65,7 +65,7 @@ static void start_auth_vencrypt_subauth(VncState *vs) static void vnc_tls_handshake_io(void *opaque); -static int vnc_start_vencrypt_handshake(struct VncState *vs) +static int vnc_start_vencrypt_handshake(VncState *vs) { int ret; @@ -103,7 +103,7 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs) static void vnc_tls_handshake_io(void *opaque) { - struct VncState *vs = (struct VncState *)opaque; + VncState *vs = (VncState *)opaque; VNC_DEBUG("Handshake IO continue\n"); vnc_start_vencrypt_handshake(vs); diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c index eddd39b08e..028fc4db1f 100644 --- a/ui/vnc-tls.c +++ b/ui/vnc-tls.c @@ -68,7 +68,7 @@ static int vnc_tls_initialize(void) static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport, const void *data, size_t len) { - struct VncState *vs = (struct VncState *)transport; + VncState *vs = (VncState *)transport; int ret; retry: @@ -85,7 +85,7 @@ static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport, static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport, void *data, size_t len) { - struct VncState *vs = (struct VncState *)transport; + VncState *vs = (VncState *)transport; int ret; retry: @@ -170,7 +170,7 @@ static gnutls_certificate_credentials_t vnc_tls_initialize_x509_cred(VncDisplay } -int vnc_tls_validate_certificate(struct VncState *vs) +int vnc_tls_validate_certificate(VncState *vs) { int ret; unsigned int status; @@ -332,7 +332,7 @@ static int vnc_set_gnutls_priority(gnutls_session_t s, int x509) #endif -int vnc_tls_client_setup(struct VncState *vs, +int vnc_tls_client_setup(VncState *vs, int needX509Creds) { VNC_DEBUG("Do TLS setup\n"); if (vnc_tls_initialize() < 0) { @@ -410,7 +410,7 @@ int vnc_tls_client_setup(struct VncState *vs, } -void vnc_tls_client_cleanup(struct VncState *vs) +void vnc_tls_client_cleanup(VncState *vs) { if (vs->tls.session) { gnutls_deinit(vs->tls.session); diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c index 62eb97fe76..38a1b8b646 100644 --- a/ui/vnc-ws.c +++ b/ui/vnc-ws.c @@ -24,7 +24,7 @@ #ifdef CONFIG_VNC_TLS #include "qemu/sockets.h" -static int vncws_start_tls_handshake(struct VncState *vs) +static int vncws_start_tls_handshake(VncState *vs) { int ret = gnutls_handshake(vs->tls.session); @@ -63,7 +63,7 @@ static int vncws_start_tls_handshake(struct VncState *vs) void vncws_tls_handshake_io(void *opaque) { - struct VncState *vs = (struct VncState *)opaque; + VncState *vs = (VncState *)opaque; if (!vs->tls.session) { VNC_DEBUG("TLS Websocket setup\n"); diff --git a/ui/vnc.c b/ui/vnc.c index cffb5b74b3..9f8ecd0c33 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1046,7 +1046,7 @@ static void vnc_dpy_cursor_define(DisplayChangeListener *dcl, } } -static int find_and_clear_dirty_height(struct VncState *vs, +static int find_and_clear_dirty_height(VncState *vs, int y, int last_x, int x, int height) { int h; From 9425c004fe287bfe95e2bf64634d6a618c2b596c Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Thu, 9 Apr 2015 02:04:13 +0800 Subject: [PATCH 06/42] ui/console : remove 'struct' from 'typedef struct' type Signed-off-by: Chih-Min Chao Reviewed-by: Gerd Hoffmann Signed-off-by: Michael Tokarev --- ui/console.c | 4 ++-- ui/spice-display.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/console.c b/ui/console.c index 29275136c7..f5295c4688 100644 --- a/ui/console.c +++ b/ui/console.c @@ -269,7 +269,7 @@ void graphic_hw_invalidate(QemuConsole *con) } } -static void ppm_save(const char *filename, struct DisplaySurface *ds, +static void ppm_save(const char *filename, DisplaySurface *ds, Error **errp) { int width = pixman_image_get_width(ds->image); @@ -1535,7 +1535,7 @@ void dpy_text_update(QemuConsole *con, int x, int y, int w, int h) void dpy_text_resize(QemuConsole *con, int w, int h) { DisplayState *s = con->ds; - struct DisplayChangeListener *dcl; + DisplayChangeListener *dcl; if (!qemu_console_is_visible(con)) { return; diff --git a/ui/spice-display.c b/ui/spice-display.c index c71a059e35..e293ec20fe 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -718,7 +718,7 @@ static void display_update(DisplayChangeListener *dcl, } static void display_switch(DisplayChangeListener *dcl, - struct DisplaySurface *surface) + DisplaySurface *surface) { SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); qemu_spice_display_switch(ssd, surface); From c9f88ce330c3d9107adfabdde33bdf10dcc05934 Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Thu, 9 Apr 2015 02:04:14 +0800 Subject: [PATCH 07/42] hw/display : remove 'struct' from 'typedef QXL struct' Signed-off-by: Chih-Min Chao Reviewed-by: Gerd Hoffmann Signed-off-by: Michael Tokarev --- hw/display/qxl.c | 2 +- ui/spice-display.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index b6d65b9487..0cd314c931 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -696,7 +696,7 @@ static inline void qxl_push_free_res(PCIQXLDevice *d, int flush) /* called from spice server thread context only */ static void interface_release_resource(QXLInstance *sin, - struct QXLReleaseInfoExt ext) + QXLReleaseInfoExt ext) { PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); QXLReleaseRing *ring; diff --git a/ui/spice-display.c b/ui/spice-display.c index e293ec20fe..9c63132054 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -539,7 +539,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) info->n_surfaces = ssd->num_surfaces; } -static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) +static int interface_get_command(QXLInstance *sin, QXLCommandExt *ext) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); SimpleSpiceUpdate *update; @@ -566,7 +566,7 @@ static int interface_req_cmd_notification(QXLInstance *sin) } static void interface_release_resource(QXLInstance *sin, - struct QXLReleaseInfoExt rext) + QXLReleaseInfoExt rext) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); SimpleSpiceUpdate *update; @@ -589,7 +589,7 @@ static void interface_release_resource(QXLInstance *sin, } } -static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *ext) +static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); int ret; From 631b22ea206300f09b9d1bb9249169e0f0092639 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 9 Apr 2015 20:32:39 +0200 Subject: [PATCH 08/42] misc: Fix new collection of typos All of them were reported by codespell. Most typos are in comments, one is in an error message. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael Tokarev --- hw/block/virtio-blk.c | 2 +- hw/misc/edu.c | 2 +- hw/net/virtio-net.c | 2 +- hw/ppc/spapr.c | 2 +- qga/qapi-schema.json | 2 +- target-s390x/mmu_helper.c | 8 ++++---- target-s390x/translate.c | 2 +- tests/libqos/ahci.c | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 9546fd2919..e6afe9763d 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -515,7 +515,7 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) type = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); /* VIRTIO_BLK_T_OUT defines the command direction. VIRTIO_BLK_T_BARRIER - * is an optional flag. Altough a guest should not send this flag if + * is an optional flag. Although a guest should not send this flag if * not negotiated we ignored it in the past. So keep ignoring it. */ switch (type & ~(VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_BARRIER)) { case VIRTIO_BLK_T_IN: diff --git a/hw/misc/edu.c b/hw/misc/edu.c index f601069e82..fe50b42af7 100644 --- a/hw/misc/edu.c +++ b/hw/misc/edu.c @@ -279,7 +279,7 @@ static const MemoryRegionOps edu_mmio_ops = { }; /* - * We purposedly use a thread, so that users are forced to wait for the status + * We purposely use a thread, so that users are forced to wait for the status * register. */ static void *edu_fact_thread(void *opaque) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 59f76bcf76..67ab228e41 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1590,7 +1590,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) n->max_queues = MAX(n->nic_conf.peers.queues, 1); if (n->max_queues * 2 + 1 > VIRTIO_PCI_QUEUE_MAX) { error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " - "must be a postive integer less than %d.", + "must be a positive integer less than %d.", n->max_queues, (VIRTIO_PCI_QUEUE_MAX - 1) / 2); virtio_cleanup(vdev); return; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 61ddc7994d..644689a6ae 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1029,7 +1029,7 @@ static int spapr_post_load(void *opaque, int version_id) sPAPREnvironment *spapr = (sPAPREnvironment *)opaque; int err = 0; - /* In earlier versions, there was no seperate qdev for the PAPR + /* In earlier versions, there was no separate qdev for the PAPR * RTC, so the RTC offset was stored directly in sPAPREnvironment. * So when migrating from those versions, poke the incoming offset * value into the RTC device */ diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 95f49e369c..5c4cd40a92 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -808,7 +808,7 @@ # # An enumeration of memory block operation result. # -# @sucess: the operation of online/offline memory block is successful. +# @success: the operation of online/offline memory block is successful. # @not-found: can't find the corresponding memoryXXX directory in sysfs. # @operation-not-supported: for some old kernels, it does not support # online or offline memory block. diff --git a/target-s390x/mmu_helper.c b/target-s390x/mmu_helper.c index b061c85aff..7baf5e9c53 100644 --- a/target-s390x/mmu_helper.c +++ b/target-s390x/mmu_helper.c @@ -303,8 +303,8 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr, * @param asc address space control (one of the PSW_ASC_* modes) * @param raddr the translated address is stored to this pointer * @param flags the PAGE_READ/WRITE/EXEC flags are stored to this pointer - * @param exc true = inject a program check if a fault occured - * @return 0 if the translation was successfull, -1 if a fault occured + * @param exc true = inject a program check if a fault occurred + * @return 0 if the translation was successful, -1 if a fault occurred */ int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t asc, target_ulong *raddr, int *flags, bool exc) @@ -436,9 +436,9 @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, * s390_cpu_virt_mem_rw: * @laddr: the logical start address * @hostbuf: buffer in host memory. NULL = do only checks w/o copying - * @len: length that should be transfered + * @len: length that should be transferred * @is_write: true = write, false = read - * Returns: 0 on success, non-zero if an exception occured + * Returns: 0 on success, non-zero if an exception occurred * * Copy from/to guest memory using logical addresses. Note that we inject a * program interrupt in case there is an error while accessing the memory. diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 4f82edde5b..8784112f4e 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -2990,7 +2990,7 @@ static ExitStatus op_sam(DisasContext *s, DisasOps *o) break; } - /* Bizzare but true, we check the address of the current insn for the + /* Bizarre but true, we check the address of the current insn for the specification exception, not the next to be executed. Thus the PoO documents that Bad Things Happen two bytes before the end. */ if (s->pc & ~mask) { diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index a18c12bcc1..843cf72980 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -364,7 +364,7 @@ void ahci_port_clear(AHCIQState *ahci, uint8_t port) ahci_px_wreg(ahci, port, AHCI_PX_IS, reg); g_assert_cmphex(ahci_px_rreg(ahci, port, AHCI_PX_IS), ==, 0); - /* Wipe the FIS-Recieve Buffer */ + /* Wipe the FIS-Receive Buffer */ qmemset(ahci->port[port].fb, 0x00, 0x100); } @@ -442,7 +442,7 @@ void ahci_port_check_pio_sanity(AHCIQState *ahci, uint8_t port, { PIOSetupFIS *pio = g_malloc0(0x20); - /* We cannot check the Status or E_Status registers, becuase + /* We cannot check the Status or E_Status registers, because * the status may have again changed between the PIO Setup FIS * and the conclusion of the command with the D2H Register FIS. */ memread(ahci->port[port].fb + 0x20, pio, 0x20); From f2fbb40ea32445b281696a1b3f16de670951de2e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 13 Apr 2015 17:28:26 +0200 Subject: [PATCH 09/42] range: remove useless inclusions Signed-off-by: Paolo Bonzini Signed-off-by: Michael Tokarev --- dma-helpers.c | 1 - hw/acpi/pcihp.c | 1 - hw/i386/acpi-build.c | 1 - include/hw/i386/ich9.h | 1 - include/hw/pci-host/q35.h | 1 - 5 files changed, 5 deletions(-) diff --git a/dma-helpers.c b/dma-helpers.c index 19901a80ec..4faec5d0ca 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -10,7 +10,6 @@ #include "sysemu/block-backend.h" #include "sysemu/dma.h" #include "trace.h" -#include "qemu/range.h" #include "qemu/thread.h" #include "qemu/main-loop.h" diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 77e1126f8f..1e11af906d 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -31,7 +31,6 @@ #include "hw/pci/pci.h" #include "hw/acpi/acpi.h" #include "sysemu/sysemu.h" -#include "qemu/range.h" #include "exec/ioport.h" #include "exec/address-spaces.h" #include "hw/pci/pci_bus.h" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2aaf21a3e5..a36135705c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -26,7 +26,6 @@ #include "qemu-common.h" #include "qemu/bitmap.h" #include "qemu/osdep.h" -#include "qemu/range.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" #include "qom/cpu.h" diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index 59ea25b49a..c17157869f 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -2,7 +2,6 @@ #define HW_ICH9_H #include "hw/hw.h" -#include "qemu/range.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "hw/i386/pc.h" diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index 025d6e69af..96d4cdc713 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -23,7 +23,6 @@ #define HW_Q35_H #include "hw/hw.h" -#include "qemu/range.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "hw/i386/pc.h" From 1897b212b780a02a5605ad934a6dd16c76571fe3 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 13 Apr 2015 17:28:27 +0200 Subject: [PATCH 10/42] qemu-config: remove stray inclusions of hw/ files Signed-off-by: Paolo Bonzini Signed-off-by: Michael Tokarev --- util/qemu-config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/util/qemu-config.c b/util/qemu-config.c index a393a3d785..30d6dcf526 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -3,10 +3,8 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/qmp/qerror.h" -#include "hw/qdev.h" #include "qapi/error.h" #include "qmp-commands.h" -#include "hw/i386/pc.h" static QemuOptsList *vm_config_groups[32]; static QemuOptsList *drive_config_groups[4]; From 29b558d87710a962203a45d9dd57bf7eab19dca0 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Wed, 15 Apr 2015 10:18:55 -0400 Subject: [PATCH 11/42] tpm: fix coding style Fix coding style in one instance. Signed-off-by: Stefan Berger Signed-off-by: Michael Tokarev --- hw/tpm/tpm_tis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 4b6d601204..b8235d5c9f 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -842,7 +842,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, (tis->loc[locty].sts & TPM_TIS_STS_EXPECT)) { /* we have a packet length - see if we have all of it */ #ifdef RAISE_STS_IRQ - bool needIrq = !(tis->loc[locty].sts & TPM_TIS_STS_VALID); + bool need_irq = !(tis->loc[locty].sts & TPM_TIS_STS_VALID); #endif len = tpm_tis_get_size_from_buffer(&tis->loc[locty].w_buffer); if (len > tis->loc[locty].w_offset) { @@ -853,7 +853,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr, tpm_tis_sts_set(&tis->loc[locty], TPM_TIS_STS_VALID); } #ifdef RAISE_STS_IRQ - if (needIrq) { + if (need_irq) { tpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID); } #endif From c2cb2b041b56e113e43da78528c9dfd8257e0206 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Fri, 24 Apr 2015 19:41:26 +0200 Subject: [PATCH 12/42] hostmem: Fix mem-path property name in error report The subtle difference between "property not found" and "property not set" is already confusing enough. Signed-off-by: Jan Kiszka Reviewed-by: Peter Crosthwaite Signed-off-by: Michael Tokarev --- backends/hostmem-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 51799943f1..4b55361010 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -43,7 +43,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) return; } if (!fb->mem_path) { - error_setg(errp, "mem_path property not set"); + error_setg(errp, "mem-path property not set"); return; } #ifndef CONFIG_LINUX From 825976153ee4c787326e0beb31144906f0a3c210 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Mon, 27 Apr 2015 11:12:49 +0300 Subject: [PATCH 13/42] qemu-options: trivial spelling fix (messsage) Signed-off-by: Michael Tokarev Reviewed-by: Eric Blake --- qemu-options.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-options.hx b/qemu-options.hx index 319d971260..ec356f65c1 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3106,7 +3106,7 @@ executed often has little or no correlation with actual performance. to synchronise the host clock and the virtual clock. The goal is to have a guest running at the real frequency imposed by the shift option. Whenever the guest clock is behind the host clock and if -@option{align=on} is specified then we print a messsage to the user +@option{align=on} is specified then we print a message to the user to inform about the delay. Currently this option does not work when @option{shift} is @code{auto}. Note: The sync algorithm will work for those shift values for which From 9dcfda1298662223af1b99f7aef1bcf94df134a8 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 14 Mar 2015 07:19:29 +0100 Subject: [PATCH 14/42] vmxnet: Remove unused function vmxnet_rx_pkt_get_num_frags() The function is not used anymore and thus can be deleted. Signed-off-by: Thomas Huth Cc: Dmitry Fleytman Signed-off-by: Michael Tokarev --- hw/net/vmxnet_rx_pkt.c | 7 ------- hw/net/vmxnet_rx_pkt.h | 9 --------- 2 files changed, 16 deletions(-) diff --git a/hw/net/vmxnet_rx_pkt.c b/hw/net/vmxnet_rx_pkt.c index a40e346293..acbca6a3db 100644 --- a/hw/net/vmxnet_rx_pkt.c +++ b/hw/net/vmxnet_rx_pkt.c @@ -172,13 +172,6 @@ bool vmxnet_rx_pkt_has_virt_hdr(struct VmxnetRxPkt *pkt) return pkt->has_virt_hdr; } -uint16_t vmxnet_rx_pkt_get_num_frags(struct VmxnetRxPkt *pkt) -{ - assert(pkt); - - return pkt->vec_len; -} - uint16_t vmxnet_rx_pkt_get_vlan_tag(struct VmxnetRxPkt *pkt) { assert(pkt); diff --git a/hw/net/vmxnet_rx_pkt.h b/hw/net/vmxnet_rx_pkt.h index 6b2c60ef10..5f8352a468 100644 --- a/hw/net/vmxnet_rx_pkt.h +++ b/hw/net/vmxnet_rx_pkt.h @@ -113,15 +113,6 @@ bool vmxnet_rx_pkt_is_vlan_stripped(struct VmxnetRxPkt *pkt); */ bool vmxnet_rx_pkt_has_virt_hdr(struct VmxnetRxPkt *pkt); -/** - * returns number of frags attached to the packet - * - * @pkt: packet - * @ret: number of frags - * - */ -uint16_t vmxnet_rx_pkt_get_num_frags(struct VmxnetRxPkt *pkt); - /** * attach data to rx packet * From 04768b985e8da35cba67b60dab02865a4d8ecdca Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 14 Mar 2015 07:19:30 +0100 Subject: [PATCH 15/42] pci: Remove unused function ich9_d2pbr_init() The function ich9_d2pbr_init() is completely unused and thus can be deleted. Signed-off-by: Thomas Huth Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael Tokarev --- hw/pci-bridge/i82801b11.c | 21 --------------------- include/hw/i386/ich9.h | 1 - 2 files changed, 22 deletions(-) diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c index 14cd7fd405..7e79bc01ef 100644 --- a/hw/pci-bridge/i82801b11.c +++ b/hw/pci-bridge/i82801b11.c @@ -101,27 +101,6 @@ static const TypeInfo i82801b11_bridge_info = { .class_init = i82801b11_bridge_class_init, }; -PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus) -{ - PCIDevice *d; - PCIBridge *br; - char buf[16]; - DeviceState *qdev; - - d = pci_create_multifunction(bus, devfn, true, "i82801b11-bridge"); - if (!d) { - return NULL; - } - br = PCI_BRIDGE(d); - qdev = DEVICE(d); - - snprintf(buf, sizeof(buf), "pci.%d", sec_bus); - pci_bridge_map_irq(br, buf, pci_swizzle_map_irq_fn); - qdev_init_nofail(qdev); - - return pci_bridge_get_sec_bus(br); -} - static void d2pbr_register(void) { type_register_static(&i82801b11_bridge_info); diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index c17157869f..f4e522cc1f 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -18,7 +18,6 @@ void ich9_lpc_set_irq(void *opaque, int irq_num, int level); int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx); PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin); void ich9_lpc_pm_init(PCIDevice *pci_lpc); -PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus); I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base); #define ICH9_CC_SIZE (16 * 1024) /* 16KB */ From 26b93109c0dff55aab67da66ebbace2cc39becfc Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 14 Mar 2015 07:19:31 +0100 Subject: [PATCH 16/42] monitor: Remove unused functions The functions ringbuf_read_completion() and monitor_get_rs() are not used anywhere anymore, so let's remove them. Signed-off-by: Thomas Huth Cc: Luiz Capitulino Signed-off-by: Michael Tokarev --- hmp.h | 1 - include/monitor/monitor.h | 1 - monitor.c | 13 ------------- 3 files changed, 15 deletions(-) diff --git a/hmp.h b/hmp.h index 2b9308be7c..12acb6d414 100644 --- a/hmp.h +++ b/hmp.h @@ -109,7 +109,6 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str); void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str); void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str); void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str); -void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str); void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str); void migrate_set_capability_completion(ReadLineState *rs, int nb_args, diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 1c06bed39d..df67d56ec0 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -47,7 +47,6 @@ typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); void monitor_set_error(Monitor *mon, QError *qerror); void monitor_read_command(Monitor *mon, int show_prompt); -ReadLineState *monitor_get_rs(Monitor *mon); int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, void *opaque); diff --git a/monitor.c b/monitor.c index 31369d3b09..d831d984d8 100644 --- a/monitor.c +++ b/monitor.c @@ -4390,14 +4390,6 @@ static void ringbuf_completion(ReadLineState *rs, const char *str) qapi_free_ChardevInfoList(start); } -void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str) -{ - if (nb_args != 2) { - return; - } - ringbuf_completion(rs, str); -} - void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str) { if (nb_args != 2) { @@ -5392,11 +5384,6 @@ static void bdrv_password_cb(void *opaque, const char *password, monitor_read_command(mon, 1); } -ReadLineState *monitor_get_rs(Monitor *mon) -{ - return mon->rs; -} - int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, BlockCompletionFunc *completion_cb, void *opaque) From ec29ea1b2b5ffed569d52393ad8e8d3f4215b9b3 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 14 Mar 2015 07:19:32 +0100 Subject: [PATCH 17/42] usb: Remove unused functions Delete set_usb_string(), usb_ep_get_ifnum(), usb_ep_get_max_packet_size() usb_ep_get_max_streams() and usb_ep_set_pipeline() since they are not used anymore. Signed-off-by: Thomas Huth Reviewed-by: Gerd Hoffmann Signed-off-by: Michael Tokarev --- hw/usb/core.c | 41 ----------------------------------------- include/hw/usb.h | 5 ----- 2 files changed, 46 deletions(-) diff --git a/hw/usb/core.c b/hw/usb/core.c index cf34755bba..d0025db60d 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -331,23 +331,6 @@ void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p) usb_packet_complete(s, p); } -/* XXX: fix overflow */ -int set_usb_string(uint8_t *buf, const char *str) -{ - int len, i; - uint8_t *q; - - q = buf; - len = strlen(str); - *q++ = 2 * len + 2; - *q++ = 3; - for(i = 0; i < len; i++) { - *q++ = str[i]; - *q++ = 0; - } - return q - buf; -} - USBDevice *usb_find_device(USBPort *port, uint8_t addr) { USBDevice *dev = port->dev; @@ -749,12 +732,6 @@ void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type) uep->type = type; } -uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - return uep->ifnum; -} - void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); @@ -782,12 +759,6 @@ void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep, uep->max_packet_size = size * microframes; } -int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - return uep->max_packet_size; -} - void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); @@ -801,18 +772,6 @@ void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw) } } -int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - return uep->max_streams; -} - -void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled) -{ - struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); - uep->pipeline = enabled; -} - void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); diff --git a/include/hw/usb.h b/include/hw/usb.h index 5be29375a2..c8b6e7b571 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -445,15 +445,11 @@ void usb_ep_reset(USBDevice *dev); void usb_ep_dump(USBDevice *dev); struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep); uint8_t usb_ep_get_type(USBDevice *dev, int pid, int ep); -uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep); void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type); void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum); void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep, uint16_t raw); -int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep); void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw); -int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep); -void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled); void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted); USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep, uint64_t id); @@ -469,7 +465,6 @@ void usb_port_reset(USBPort *port); void usb_device_reset(USBDevice *dev); void usb_wakeup(USBEndpoint *ep, unsigned int stream); void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p); -int set_usb_string(uint8_t *buf, const char *str); /* usb-linux.c */ USBDevice *usb_host_device_open(USBBus *bus, const char *devname); From 3bf2af7b40281f73d0e33ecca4095078feed07b1 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 14 Mar 2015 07:19:33 +0100 Subject: [PATCH 18/42] util: Remove unused functions Delete the unused functions qemu_signalfd_available(), qemu_send_full() and qemu_recv_full(). Signed-off-by: Thomas Huth Signed-off-by: Michael Tokarev --- include/qemu-common.h | 4 --- include/qemu/compatfd.h | 1 - util/compatfd.c | 19 ------------ util/osdep.c | 66 ----------------------------------------- 4 files changed, 90 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 1b5cffb403..6b373ff7e3 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -217,10 +217,6 @@ void *qemu_oom_check(void *ptr); ssize_t qemu_write_full(int fd, const void *buf, size_t count) QEMU_WARN_UNUSED_RESULT; -ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags) - QEMU_WARN_UNUSED_RESULT; -ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) - QEMU_WARN_UNUSED_RESULT; #ifndef _WIN32 int qemu_pipe(int pipefd[2]); diff --git a/include/qemu/compatfd.h b/include/qemu/compatfd.h index 6b04877b97..fc3791520f 100644 --- a/include/qemu/compatfd.h +++ b/include/qemu/compatfd.h @@ -39,6 +39,5 @@ struct qemu_signalfd_siginfo { }; int qemu_signalfd(const sigset_t *mask); -bool qemu_signalfd_available(void); #endif diff --git a/util/compatfd.c b/util/compatfd.c index 341ada638f..e8571502be 100644 --- a/util/compatfd.c +++ b/util/compatfd.c @@ -108,22 +108,3 @@ int qemu_signalfd(const sigset_t *mask) return qemu_signalfd_compat(mask); } - -bool qemu_signalfd_available(void) -{ -#ifdef CONFIG_SIGNALFD - sigset_t mask; - int fd; - bool ok; - sigemptyset(&mask); - errno = 0; - fd = syscall(SYS_signalfd, -1, &mask, _NSIG / 8); - ok = (errno != ENOSYS); - if (fd >= 0) { - close(fd); - } - return ok; -#else - return false; -#endif -} diff --git a/util/osdep.c b/util/osdep.c index b2bd1542c5..f938b69466 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -310,72 +310,6 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen) return ret; } -/* - * A variant of send(2) which handles partial write. - * - * Return the number of bytes transferred, which is only - * smaller than `count' if there is an error. - * - * This function won't work with non-blocking fd's. - * Any of the possibilities with non-bloking fd's is bad: - * - return a short write (then name is wrong) - * - busy wait adding (errno == EAGAIN) to the loop - */ -ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags) -{ - ssize_t ret = 0; - ssize_t total = 0; - - while (count) { - ret = send(fd, buf, count, flags); - if (ret < 0) { - if (errno == EINTR) { - continue; - } - break; - } - - count -= ret; - buf += ret; - total += ret; - } - - return total; -} - -/* - * A variant of recv(2) which handles partial write. - * - * Return the number of bytes transferred, which is only - * smaller than `count' if there is an error. - * - * This function won't work with non-blocking fd's. - * Any of the possibilities with non-bloking fd's is bad: - * - return a short write (then name is wrong) - * - busy wait adding (errno == EAGAIN) to the loop - */ -ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) -{ - ssize_t ret = 0; - ssize_t total = 0; - - while (count) { - ret = qemu_recv(fd, buf, count, flags); - if (ret <= 0) { - if (ret < 0 && errno == EINTR) { - continue; - } - break; - } - - count -= ret; - buf += ret; - total += ret; - } - - return total; -} - void qemu_set_version(const char *version) { qemu_version = version; From ef1d27f4b17c4238ed3395724026910973026d2b Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 18:38:18 -0700 Subject: [PATCH 19/42] arm: cpu.h: Remove unused typdefs These CP accessor function prototypes are unused. Remove them. Signed-off-by: Peter Crosthwaite Signed-off-by: Michael Tokarev --- target-arm/cpu.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index d63d9b20f1..8df0b6a39c 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -93,11 +93,6 @@ #define ARM_CPU_VIRQ 2 #define ARM_CPU_VFIQ 3 -typedef void ARMWriteCPFunc(void *opaque, int cp_info, - int srcreg, int operand, uint32_t value); -typedef uint32_t ARMReadCPFunc(void *opaque, int cp_info, - int dstreg, int operand); - struct arm_boot_info; #define NB_MMU_MODES 7 From 5ecaa4ed882aa6040d2ddbfc6f487d8b4bcd3b83 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 19:14:26 -0700 Subject: [PATCH 20/42] configure: alphabetize tricore in target list tricore was out of alphabetical order in the target list. Fix. Signed-off-by: Peter Crosthwaite Acked-by: Bastian Koppelmann Signed-off-by: Michael Tokarev --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 75a4def8b5..255d85bf1d 100755 --- a/configure +++ b/configure @@ -5193,8 +5193,6 @@ case "$target_name" in TARGET_BASE_ARCH=mips echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak ;; - tricore) - ;; moxie) ;; or32) @@ -5245,6 +5243,8 @@ case "$target_name" in s390x) gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml" ;; + tricore) + ;; unicore32) ;; xtensa|xtensaeb) From d3e4abdddfcf70b2e678de1c6b9b1c6cd3ce541e Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 27 Apr 2015 13:32:35 +0200 Subject: [PATCH 21/42] docs/atomics.txt: fix two typos Cc: Paolo Bonzini Signed-off-by: Laszlo Ersek Signed-off-by: Michael Tokarev --- docs/atomics.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/atomics.txt b/docs/atomics.txt index 6f2997bc65..ef285e3c2a 100644 --- a/docs/atomics.txt +++ b/docs/atomics.txt @@ -281,7 +281,7 @@ note that the other barrier may actually be in a driver that runs in the guest! For the purposes of pairing, smp_read_barrier_depends() and smp_rmb() -both count as read barriers. A read barriers shall pair with a write +both count as read barriers. A read barrier shall pair with a write barrier or a full barrier; a write barrier shall pair with a read barrier or a full barrier. A full barrier can pair with anything. For example: @@ -294,7 +294,7 @@ For example: smp_rmb(); y = a; -Note that the "writing" thread are accessing the variables in the +Note that the "writing" thread is accessing the variables in the opposite order as the "reading" thread. This is expected: stores before the write barrier will normally match the loads after the read barrier, and vice versa. The same is true for more than 2 From 28507a415a9b1e897aa8cdab658c6cdc00eff6cd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 27 Apr 2015 12:34:18 +0200 Subject: [PATCH 22/42] libcacard: stop including qemu-common.h This is a small step towards making libcacard standalone. Signed-off-by: Paolo Bonzini Signed-off-by: Michael Tokarev --- libcacard/cac.c | 5 ++++- libcacard/card_7816.c | 4 +++- libcacard/event.c | 2 +- libcacard/vcard.c | 4 +++- libcacard/vcard_emul_nss.c | 2 +- libcacard/vreader.c | 4 +++- libcacard/vscclient.c | 8 +++++++- 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/libcacard/cac.c b/libcacard/cac.c index f38fdceddd..bc84534f9c 100644 --- a/libcacard/cac.c +++ b/libcacard/cac.c @@ -5,7 +5,10 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" + +#include +#include #include "cac.h" #include "vcard.h" diff --git a/libcacard/card_7816.c b/libcacard/card_7816.c index 814fa1662f..22fd334d15 100644 --- a/libcacard/card_7816.c +++ b/libcacard/card_7816.c @@ -5,7 +5,9 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" + +#include #include "vcard.h" #include "vcard_emul.h" diff --git a/libcacard/event.c b/libcacard/event.c index 4c551e4e38..63f4057fe5 100644 --- a/libcacard/event.c +++ b/libcacard/event.c @@ -5,7 +5,7 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" #include "vcard.h" #include "vreader.h" diff --git a/libcacard/vcard.c b/libcacard/vcard.c index d140a8ed1a..1a87208f3d 100644 --- a/libcacard/vcard.c +++ b/libcacard/vcard.c @@ -5,7 +5,9 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qemu-common.h" +#include "glib-compat.h" + +#include #include "vcard.h" #include "vcard_emul.h" diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c index 950edee069..6955f690b3 100644 --- a/libcacard/vcard_emul_nss.c +++ b/libcacard/vcard_emul_nss.c @@ -25,7 +25,7 @@ #include #include -#include "qemu-common.h" +#include "glib-compat.h" #include "vcard.h" #include "card_7816t.h" diff --git a/libcacard/vreader.c b/libcacard/vreader.c index 0315dd8920..9725f46a74 100644 --- a/libcacard/vreader.c +++ b/libcacard/vreader.c @@ -10,7 +10,9 @@ #endif #define G_LOG_DOMAIN "libcacard" -#include "qemu-common.h" +#include "glib-compat.h" + +#include #include "vcard.h" #include "vcard_emul.h" diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index fa6041de99..0652684437 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -10,14 +10,20 @@ * See the COPYING.LIB file in the top-level directory. */ +#include +#include +#include #ifndef _WIN32 #include #include #include +#include #define closesocket(x) close(x) +#else +#include #endif -#include "qemu-common.h" +#include "glib-compat.h" #include "vscard_common.h" From f66759d3aec208651a7ad0cd37f4fec8d86fa7c1 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Mon, 27 Apr 2015 16:29:58 +0300 Subject: [PATCH 23/42] libcacard: do not use full paths for include files in the same dir Signed-off-by: Michael Tokarev Reviewed-by: Paolo Bonzini --- libcacard/vcard_emul_nss.c | 2 +- libcacard/vcardt.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c index 6955f690b3..d9761eedc2 100644 --- a/libcacard/vcard_emul_nss.c +++ b/libcacard/vcard_emul_nss.c @@ -33,7 +33,7 @@ #include "vreader.h" #include "vevent.h" -#include "libcacard/vcardt_internal.h" +#include "vcardt_internal.h" typedef enum { diff --git a/libcacard/vcardt.c b/libcacard/vcardt.c index 9ce4648f8c..c67de2f3c1 100644 --- a/libcacard/vcardt.c +++ b/libcacard/vcardt.c @@ -2,9 +2,9 @@ #include #include -#include "libcacard/vcardt.h" +#include "vcardt.h" -#include "libcacard/vcardt_internal.h" +#include "vcardt_internal.h" /* create an ATR with appropriate historical bytes */ #define ATR_TS_DIRECT_CONVENTION 0x3b From a0970d91c94241c74b2b8027268d2a7e8fe19ae3 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 12:10:19 -0700 Subject: [PATCH 24/42] defconfigs: Piggyback microblazeel on microblaze Theres no difference in defconfig. Going forward microblazeel should superset microblaze so use an include. Signed-off-by: Peter Crosthwaite Reviewed-by: Edgar E. Iglesias Signed-off-by: Michael Tokarev --- default-configs/microblazeel-softmmu.mak | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/default-configs/microblazeel-softmmu.mak b/default-configs/microblazeel-softmmu.mak index acf22c5bb3..2fcf442fc7 100644 --- a/default-configs/microblazeel-softmmu.mak +++ b/default-configs/microblazeel-softmmu.mak @@ -1,11 +1,3 @@ # Default configuration for microblazeel-softmmu -CONFIG_PTIMER=y -CONFIG_PFLASH_CFI01=y -CONFIG_SERIAL=y -CONFIG_XILINX=y -CONFIG_XILINX_AXI=y -CONFIG_XILINX_SPI=y -CONFIG_XILINX_ETHLITE=y -CONFIG_SSI=y -CONFIG_SSI_M25P80=y +include microblaze-softmmu.mak From 19191a6bc537b2290e18430e1877de9c2db20510 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 12:10:20 -0700 Subject: [PATCH 25/42] microblaze: mmu: Delete flip_um fn prototype This is not implemented or used. Signed-off-by: Peter Crosthwaite Reviewed-by: Edgar E. Iglesias Signed-off-by: Michael Tokarev --- target-microblaze/mmu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/target-microblaze/mmu.h b/target-microblaze/mmu.h index 3f74dda0b0..3b7a9983d5 100644 --- a/target-microblaze/mmu.h +++ b/target-microblaze/mmu.h @@ -82,7 +82,6 @@ struct microblaze_mmu_lookup } err; }; -void mmu_flip_um(CPUMBState *env, unsigned int um); unsigned int mmu_translate(struct microblaze_mmu *mmu, struct microblaze_mmu_lookup *lu, target_ulong vaddr, int rw, int mmu_idx); From b133b09a9d8ae280bba279a1aba9af73a805e198 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 12:10:21 -0700 Subject: [PATCH 26/42] microblaze: cpu: Remote unused cpu_get_pc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function is not used by anything. Remove. Signed-off-by: Peter Crosthwaite Reviewed-by: Edgar E. Iglesias Reviewed-by: Alex Bennée Signed-off-by: Michael Tokarev --- target-microblaze/cpu.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 7d06227730..2c18b49dff 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -333,11 +333,6 @@ static inline int cpu_interrupts_enabled(CPUMBState *env) #include "exec/cpu-all.h" -static inline target_ulong cpu_get_pc(CPUMBState *env) -{ - return env->sregs[SR_PC]; -} - static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc, target_ulong *cs_base, int *flags) { From 004f979fbb83397349c9158946ec5d4f0036632b Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 12:10:22 -0700 Subject: [PATCH 27/42] microblaze: cpu: Remove unused CC_OP enum This enum is not used by anything. Remove. Signed-off-by: Peter Crosthwaite Reviewed-by: Edgar E. Iglesias Signed-off-by: Michael Tokarev --- target-microblaze/cpu.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 2c18b49dff..f21da2f205 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -284,12 +284,6 @@ int cpu_mb_exec(CPUMBState *s); int cpu_mb_signal_handler(int host_signum, void *pinfo, void *puc); -enum { - CC_OP_DYNAMIC, /* Use env->cc_op */ - CC_OP_FLAGS, - CC_OP_CMP, -}; - /* FIXME: MB uses variable pages down to 1K but linux only uses 4k. */ #define TARGET_PAGE_BITS 12 #define MMAP_SHIFT TARGET_PAGE_BITS From 059ec9aa34fd3c5bfe65141741c671b3e80ac6e7 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 12:10:23 -0700 Subject: [PATCH 28/42] microblaze: cpu: Delete EXCP_NMI This define is unused. Remove. Signed-off-by: Peter Crosthwaite Reviewed-by: Edgar E. Iglesias Signed-off-by: Michael Tokarev --- target-microblaze/cpu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index f21da2f205..6522af7532 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -36,7 +36,6 @@ typedef struct CPUMBState CPUMBState; #define ELF_MACHINE EM_MICROBLAZE -#define EXCP_NMI 1 #define EXCP_MMU 2 #define EXCP_IRQ 3 #define EXCP_BREAK 4 From 2161be35ce57ed5b0da0b98f902d003bfebac2c9 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Wed, 29 Apr 2015 08:34:29 +0300 Subject: [PATCH 29/42] microblaze: cpu: Renumber EXCP_* constants to close gap After removal of EXCP_NMI there's a gap in EXCP_* numbering. Let's remove it. Signed-off-by: Michael Tokarev Reviewed-by: Edgar E. Iglesias --- target-microblaze/cpu.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 6522af7532..d3895975d8 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -36,11 +36,11 @@ typedef struct CPUMBState CPUMBState; #define ELF_MACHINE EM_MICROBLAZE -#define EXCP_MMU 2 -#define EXCP_IRQ 3 -#define EXCP_BREAK 4 -#define EXCP_HW_BREAK 5 -#define EXCP_HW_EXCP 6 +#define EXCP_MMU 1 +#define EXCP_IRQ 2 +#define EXCP_BREAK 3 +#define EXCP_HW_BREAK 4 +#define EXCP_HW_EXCP 5 /* MicroBlaze-specific interrupt pending bits. */ #define CPU_INTERRUPT_NMI CPU_INTERRUPT_TGT_EXT_3 From 93100f67c723f5812d0fa9a026208cf320ef46e6 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Sun, 26 Apr 2015 12:10:24 -0700 Subject: [PATCH 30/42] microblaze: cpu: delete unused cpu_interrupts_enabled This function is unused. Remove. Signed-off-by: Peter Crosthwaite Signed-off-by: Michael Tokarev --- target-microblaze/cpu.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index d3895975d8..4ea04acc4d 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -319,11 +319,6 @@ static inline int cpu_mmu_index (CPUMBState *env) int mb_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw, int mmu_idx); -static inline int cpu_interrupts_enabled(CPUMBState *env) -{ - return env->sregs[SR_MSR] & MSR_IE; -} - #include "exec/cpu-all.h" static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc, From c28e399cadbeaa996e2a3d334368edd4cd6b6889 Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 27 Apr 2015 12:45:28 -0400 Subject: [PATCH 31/42] cpus: use first_cpu macro instead of QTAILQ_FIRST(&cpus) Signed-off-by: Emilio G. Cota Signed-off-by: Michael Tokarev --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index e6dcae31f5..62d157a85c 100644 --- a/cpus.c +++ b/cpus.c @@ -1016,7 +1016,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) qemu_cond_signal(&qemu_cpu_cond); /* wait for initial kick-off after machine start */ - while (QTAILQ_FIRST(&cpus)->stopped) { + while (first_cpu->stopped) { qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); /* process any pending work */ From dfbf272b77cfb6b74131746a67c82271ab009f2f Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 27 Apr 2015 12:45:29 -0400 Subject: [PATCH 32/42] input: remove unused mouse_handlers list Signed-off-by: Emilio G. Cota Signed-off-by: Michael Tokarev --- ui/input-legacy.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/input-legacy.c b/ui/input-legacy.c index 2d4ca19740..3e9bb380e5 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -57,8 +57,6 @@ struct QEMUPutLEDEntry { static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers); -static QTAILQ_HEAD(, QEMUPutMouseEntry) mouse_handlers = - QTAILQ_HEAD_INITIALIZER(mouse_handlers); int index_from_key(const char *key) { From 63d229c32b72767461262ade78a5cb98dbe0f1b4 Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 27 Apr 2015 12:45:30 -0400 Subject: [PATCH 33/42] qemu-char: remove unused list node from FDCharDriver Signed-off-by: Emilio G. Cota Signed-off-by: Michael Tokarev --- qemu-char.c | 1 - 1 file changed, 1 deletion(-) diff --git a/qemu-char.c b/qemu-char.c index a405d76c31..d0c1564306 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -973,7 +973,6 @@ typedef struct FDCharDriver { CharDriverState *chr; GIOChannel *fd_in, *fd_out; int max_size; - QTAILQ_ENTRY(FDCharDriver) node; } FDCharDriver; /* Called with chr_write_lock held. */ From b1201addc7ceb8f1fcdc378071ec6f5ab5b3f7ab Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 27 Apr 2015 12:45:32 -0400 Subject: [PATCH 34/42] coroutine: remove unnecessary parentheses in qemu_co_queue_empty Signed-off-by: Emilio G. Cota Signed-off-by: Michael Tokarev --- qemu-coroutine-lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c index e4860ae42f..6b4903334b 100644 --- a/qemu-coroutine-lock.c +++ b/qemu-coroutine-lock.c @@ -108,7 +108,7 @@ bool qemu_co_enter_next(CoQueue *queue) bool qemu_co_queue_empty(CoQueue *queue) { - return (QTAILQ_FIRST(&queue->entries) == NULL); + return QTAILQ_FIRST(&queue->entries) == NULL; } void qemu_co_mutex_init(CoMutex *mutex) From 52a53afebd2604af957d50fd4f3ce2012350a40d Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 27 Apr 2015 12:45:33 -0400 Subject: [PATCH 35/42] linux-user/elfload: use QTAILQ_FOREACH instead of open-coding it Signed-off-by: Emilio G. Cota Signed-off-by: Michael Tokarev --- linux-user/elfload.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 399c021337..0ba97062b7 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2887,8 +2887,7 @@ static int write_note_info(struct elf_note_info *info, int fd) return (error); /* write prstatus for each thread */ - for (ets = info->thread_list.tqh_first; ets != NULL; - ets = ets->ets_link.tqe_next) { + QTAILQ_FOREACH(ets, &info->thread_list, ets_link) { if ((error = write_note(&ets->notes[0], fd)) != 0) return (error); } From 5403432f39fc09ce1973cc8c1a62e16502358bf7 Mon Sep 17 00:00:00 2001 From: John Snow Date: Tue, 28 Apr 2015 15:20:41 -0400 Subject: [PATCH 36/42] qmp-commands: Fix typo Just a trivial patch to correct a QMP example in qmp-commands.hx. Signed-off-by: John Snow Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- qmp-commands.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmp-commands.hx b/qmp-commands.hx index 213508fe5d..d4a837c89b 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2380,7 +2380,7 @@ Example: "virtual-size":2048000, "backing_file":"base.qcow2", "full-backing-filename":"disks/base.qcow2", - "backing-filename-format:"qcow2", + "backing-filename-format":"qcow2", "snapshots":[ { "id": "1", @@ -3847,7 +3847,7 @@ Example: "virtual-size":2048000, "backing_file":"base.qcow2", "full-backing-filename":"disks/base.qcow2", - "backing-filename-format:"qcow2", + "backing-filename-format":"qcow2", "snapshots":[ { "id": "1", From 3ad9fd5a257794d516db515c217c78a5806112fe Mon Sep 17 00:00:00 2001 From: Gonglei Date: Tue, 28 Apr 2015 17:11:02 +0800 Subject: [PATCH 37/42] target-mips: fix memory leak Coveristy reports that variable prom_buf/params_buf going out of scope leaks the storage it points to. Cc: Aurelien Jarno Cc: Leon Alrae Signed-off-by: Gonglei Reviewed-by: Leon Alrae Signed-off-by: Michael Tokarev --- hw/mips/mips_fulong2e.c | 1 + hw/mips/mips_malta.c | 1 + hw/mips/mips_r4k.c | 1 + 3 files changed, 3 insertions(+) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 4aae64a9ec..dea941ad88 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -168,6 +168,7 @@ static int64_t load_kernel (CPUMIPSState *env) rom_add_blob_fixed("prom", prom_buf, prom_size, cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR)); + g_free(prom_buf); return kernel_entry; } diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index b0fa71a514..482250d85d 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -861,6 +861,7 @@ static int64_t load_kernel (void) rom_add_blob_fixed("prom", prom_buf, prom_size, cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR)); + g_free(prom_buf); return kernel_entry; } diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 66e2a58e86..f4dcacd862 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -139,6 +139,7 @@ static int64_t load_kernel(void) rom_add_blob_fixed("params", params_buf, params_size, (16 << 20) - 264); + g_free(params_buf); return entry; } From ab7c5aaf31213f5fc96018514e3d258e951d520f Mon Sep 17 00:00:00 2001 From: Gonglei Date: Tue, 28 Apr 2015 17:11:04 +0800 Subject: [PATCH 38/42] vhost-user: remove superfluous '\n' around error_report() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gonglei Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- hw/virtio/vhost-user.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index aefe0bbaaf..e7ab8293d1 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -128,7 +128,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { - error_report("Failed to read msg header. Read %d instead of %d.\n", r, + error_report("Failed to read msg header. Read %d instead of %d.", r, size); goto fail; } @@ -136,7 +136,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) /* validate received flags */ if (msg->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) { error_report("Failed to read msg header." - " Flags 0x%x instead of 0x%x.\n", msg->flags, + " Flags 0x%x instead of 0x%x.", msg->flags, VHOST_USER_REPLY_MASK | VHOST_USER_VERSION); goto fail; } @@ -144,7 +144,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) /* validate message size is sane */ if (msg->size > VHOST_USER_PAYLOAD_SIZE) { error_report("Failed to read msg header." - " Size %d exceeds the maximum %zu.\n", msg->size, + " Size %d exceeds the maximum %zu.", msg->size, VHOST_USER_PAYLOAD_SIZE); goto fail; } @@ -155,7 +155,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { error_report("Failed to read msg payload." - " Read %d instead of %d.\n", r, msg->size); + " Read %d instead of %d.", r, msg->size); goto fail; } } @@ -235,8 +235,8 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, msg.memory.nregions = fd_num; if (!fd_num) { - error_report("Failed initializing vhost-user memory map\n" - "consider using -object memory-backend-file share=on\n"); + error_report("Failed initializing vhost-user memory map, " + "consider using -object memory-backend-file share=on"); return -1; } @@ -280,7 +280,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, } break; default: - error_report("vhost-user trying to send unhandled ioctl\n"); + error_report("vhost-user trying to send unhandled ioctl"); return -1; break; } @@ -296,27 +296,27 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, if (msg_request != msg.request) { error_report("Received unexpected msg type." - " Expected %d received %d\n", msg_request, msg.request); + " Expected %d received %d", msg_request, msg.request); return -1; } switch (msg_request) { case VHOST_USER_GET_FEATURES: if (msg.size != sizeof(m.u64)) { - error_report("Received bad msg size.\n"); + error_report("Received bad msg size."); return -1; } *((__u64 *) arg) = msg.u64; break; case VHOST_USER_GET_VRING_BASE: if (msg.size != sizeof(m.state)) { - error_report("Received bad msg size.\n"); + error_report("Received bad msg size."); return -1; } memcpy(arg, &msg.state, sizeof(struct vhost_vring_state)); break; default: - error_report("Received unexpected msg type.\n"); + error_report("Received unexpected msg type."); return -1; break; } From 2ed0c3dad769ab747e1f5448b70eeaf134c76982 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Mon, 27 Apr 2015 18:59:04 +0200 Subject: [PATCH 39/42] kvm: Silence warning from valgrind valgrind complains here about uninitialized bytes with the following message: ==17814== Syscall param ioctl(generic) points to uninitialised byte(s) ==17814== at 0x466A780: ioctl (in /usr/lib64/power8/libc-2.17.so) ==17814== by 0x100735B7: kvm_vm_ioctl (kvm-all.c:1920) ==17814== by 0x10074583: kvm_set_ioeventfd_mmio (kvm-all.c:574) Let's fix it by using a proper struct initializer in kvm_set_ioeventfd_mmio(). Signed-off-by: Thomas Huth Signed-off-by: Michael Tokarev --- kvm-all.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 2a717e5b50..37cc2cf9d3 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -552,13 +552,13 @@ static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val, bool assign, uint32_t size, bool datamatch) { int ret; - struct kvm_ioeventfd iofd; - - iofd.datamatch = datamatch ? adjust_ioeventfd_endianness(val, size) : 0; - iofd.addr = addr; - iofd.len = size; - iofd.flags = 0; - iofd.fd = fd; + struct kvm_ioeventfd iofd = { + .datamatch = datamatch ? adjust_ioeventfd_endianness(val, size) : 0, + .addr = addr, + .len = size, + .flags = 0, + .fd = fd, + }; if (!kvm_enabled()) { return -ENOSYS; From fee068e4f190a36ef3bda9aa7c802f90434ef8e5 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Wed, 29 Apr 2015 00:52:21 -0700 Subject: [PATCH 40/42] tcg: Delete unused cpu_pc_from_tb() No code uses the cpu_pc_from_tb() function. Delete from tricore and arm which each provide an unused implementation. Update the comment in tcg.h to reflect that this is obsoleted by synchronize_from_tb. Signed-off-by: Peter Crosthwaite Signed-off-by: Michael Tokarev --- target-arm/cpu.h | 9 --------- target-tricore/cpu.h | 5 ----- tcg/tcg.h | 6 ++++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 8df0b6a39c..d4a589964e 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -1874,15 +1874,6 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, #include "exec/exec-all.h" -static inline void cpu_pc_from_tb(CPUARMState *env, TranslationBlock *tb) -{ - if (ARM_TBFLAG_AARCH64_STATE(tb->flags)) { - env->pc = tb->pc; - } else { - env->regs[15] = tb->pc; - } -} - enum { QEMU_PSCI_CONDUIT_DISABLED = 0, QEMU_PSCI_CONDUIT_SMC = 1, diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h index 90bf0069b5..c14b5f9016 100644 --- a/target-tricore/cpu.h +++ b/target-tricore/cpu.h @@ -395,9 +395,4 @@ int cpu_tricore_handle_mmu_fault(CPUState *cpu, target_ulong address, #include "exec/exec-all.h" -static inline void cpu_pc_from_tb(CPUTriCoreState *env, TranslationBlock *tb) -{ - env->PC = tb->pc; -} - #endif /*__TRICORE_CPU_H__ */ diff --git a/tcg/tcg.h b/tcg/tcg.h index add7f7524d..3d004ba276 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -859,8 +859,10 @@ static inline size_t tcg_current_code_size(TCGContext *s) * state is correctly synchronised and ready for execution of the next * TB (and in particular the guest PC is the address to execute next). * Otherwise, we gave up on execution of this TB before it started, and - * the caller must fix up the CPU state by calling cpu_pc_from_tb() - * with the next-TB pointer we return. + * the caller must fix up the CPU state by calling the CPU's + * synchronize_from_tb() method with the next-TB pointer we return (falling + * back to calling the CPU's set_pc method with tb->pb if no + * synchronize_from_tb() method exists). * * Note that TCG targets may use a different definition of tcg_qemu_tb_exec * to this default (which just calls the prologue.code emitted by From 4d850406a859d3a5dcfca74eb9caa76ccc064ab3 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Thu, 5 Mar 2015 11:05:20 +0800 Subject: [PATCH 41/42] microblaze: fix memory leak When not assign a -dtb argument, the variable dtb_filename storage returned from qemu_find_file(), which should be freed after use. Alternatively we define a local variable filename, with 'char *' type, free after use. Signed-off-by: Gonglei Reviewed-by: Peter Crosthwaite Reviewed-by: Edgar E. Iglesias Signed-off-by: Michael Tokarev --- hw/microblaze/boot.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 38c59dbe9d..4c44317b65 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -113,15 +113,15 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, const char *kernel_filename; const char *kernel_cmdline; const char *dtb_arg; + char *filename = NULL; machine_opts = qemu_get_machine_opts(); kernel_filename = qemu_opt_get(machine_opts, "kernel"); kernel_cmdline = qemu_opt_get(machine_opts, "append"); dtb_arg = qemu_opt_get(machine_opts, "dtb"); - if (dtb_arg) { /* Preference a -dtb argument */ - dtb_filename = dtb_arg; - } else { /* default to pcbios dtb as passed by machine_init */ - dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); + /* default to pcbios dtb as passed by machine_init */ + if (!dtb_arg) { + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); } boot_info.machine_cpu_reset = machine_cpu_reset; @@ -203,7 +203,8 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, boot_info.initrd_start, boot_info.initrd_end, kernel_cmdline, - dtb_filename); + /* Preference a -dtb argument */ + dtb_arg ? dtb_arg : filename); } - + g_free(filename); } From 553029351bac9f5b4f9ea72793e55f02e7677ec2 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Thu, 30 Apr 2015 00:38:52 -0700 Subject: [PATCH 42/42] openrisc: cpu: Remove unused cpu_get_pc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function is not used by anything. Remove. Signed-off-by: Peter Crosthwaite Reviewed-by: Alex Bennée Signed-off-by: Michael Tokarev --- target-openrisc/cpu.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index b25324bc89..9e23cd0500 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -415,9 +415,4 @@ static inline int cpu_mmu_index(CPUOpenRISCState *env) #include "exec/exec-all.h" -static inline target_ulong cpu_get_pc(CPUOpenRISCState *env) -{ - return env->pc; -} - #endif /* CPU_OPENRISC_H */