Pārlūkot izejas kodu

Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-10-08' into staging

trivial patches for 2015-10-08

# gpg: Signature made Thu 08 Oct 2015 17:51:05 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"

* remotes/mjt/tags/pull-trivial-patches-2015-10-08:
  tests: Unique test path for /string-visitor/output
  linux-user: Remove type casts to union type
  linux-user: Use g_new() & friends where that makes obvious sense
  rocker: Use g_new() & friends where that makes obvious sense
  .travis.yml: Run make check for all targets, not just some
  hw: char: Remove unnecessary variable
  hw: timer: Remove unnecessary variable
  qapi: add missing @
  MAINTAINERS: Add NSIS file for W32, W64 hosts
  target-ppc: Remove unnecessary variable
  target-microblaze: Remove unnecessary variable
  s/cpu_get_real_ticks/cpu_get_host_ticks/
  pc: check for underflow in load_linux
  pci-assign: do not include sys/io.h
  block/ssh: remove dead code
  imx_serial: Generate interrupt on tx empty if enabled
  sdhci: Change debug prints to compile unconditionally
  sdhci: use PRIx64 for uint64_t type
  Add .dir-locals.el file to configure emacs coding style

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Peter Maydell 10 gadi atpakaļ
vecāks
revīzija
8be6e623a2

+ 2 - 0
.dir-locals.el

@@ -0,0 +1,2 @@
+((c-mode . ((c-file-style . "stroustrup")
+	    (indent-tabs-mode . nil))))

+ 1 - 9
.travis.yml

@@ -54,15 +54,7 @@ matrix:
   include:
   include:
     # Make check target (we only do this once)
     # Make check target (we only do this once)
     - env:
     - env:
-        - TARGETS=alpha-softmmu,arm-softmmu,aarch64-softmmu,cris-softmmu,
-                  i386-softmmu,x86_64-softmmu,m68k-softmmu,microblaze-softmmu,
-                  microblazeel-softmmu,mips-softmmu,mips64-softmmu,
-                  mips64el-softmmu,mipsel-softmmu,or32-softmmu,ppc-softmmu,
-                  ppc64-softmmu,ppcemb-softmmu,s390x-softmmu,sh4-softmmu,
-                  sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,
-                  unicore32-softmmu,unicore32-linux-user,
-                  lm32-softmmu,moxie-softmmu,tricore-softmmu,xtensa-softmmu,
-                  xtensaeb-softmmu
+        - TARGETS=alpha-softmmu,arm-softmmu,aarch64-softmmu,cris-softmmu,i386-softmmu,x86_64-softmmu,m68k-softmmu,microblaze-softmmu,microblazeel-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,or32-softmmu,ppc-softmmu,ppc64-softmmu,ppcemb-softmmu,s390x-softmmu,sh4-softmmu,sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,unicore32-softmmu,unicore32-linux-user,lm32-softmmu,moxie-softmmu,tricore-softmmu,xtensa-softmmu,xtensaeb-softmmu
           TEST_CMD="make check"
           TEST_CMD="make check"
       compiler: gcc
       compiler: gcc
     # Debug related options
     # Debug related options

+ 1 - 0
MAINTAINERS

@@ -275,6 +275,7 @@ L: qemu-devel@nongnu.org
 M: Stefan Weil <sw@weilnetz.de>
 M: Stefan Weil <sw@weilnetz.de>
 S: Maintained
 S: Maintained
 F: *win32*
 F: *win32*
+F: qemu.nsi
 
 
 ARM Machines
 ARM Machines
 ------------
 ------------

+ 1 - 4
block/ssh.c

@@ -193,7 +193,7 @@ sftp_error_report(BDRVSSHState *s, const char *fs, ...)
 static int parse_uri(const char *filename, QDict *options, Error **errp)
 static int parse_uri(const char *filename, QDict *options, Error **errp)
 {
 {
     URI *uri = NULL;
     URI *uri = NULL;
-    QueryParams *qp = NULL;
+    QueryParams *qp;
     int i;
     int i;
 
 
     uri = uri_parse(filename);
     uri = uri_parse(filename);
@@ -249,9 +249,6 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
     return 0;
     return 0;
 
 
  err:
  err:
-    if (qp) {
-      query_params_free(qp);
-    }
     if (uri) {
     if (uri) {
       uri_free(uri);
       uri_free(uri);
     }
     }

+ 1 - 1
bsd-user/main.c

@@ -108,7 +108,7 @@ void cpu_list_unlock(void)
 
 
 uint64_t cpu_get_tsc(CPUX86State *env)
 uint64_t cpu_get_tsc(CPUX86State *env)
 {
 {
-    return cpu_get_real_ticks();
+    return cpu_get_host_ticks();
 }
 }
 
 
 static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
 static void write_dt(void *ptr, unsigned long addr, unsigned long limit,

+ 3 - 3
cpus.c

@@ -199,7 +199,7 @@ int64_t cpu_get_ticks(void)
 
 
     ticks = timers_state.cpu_ticks_offset;
     ticks = timers_state.cpu_ticks_offset;
     if (timers_state.cpu_ticks_enabled) {
     if (timers_state.cpu_ticks_enabled) {
-        ticks += cpu_get_real_ticks();
+        ticks += cpu_get_host_ticks();
     }
     }
 
 
     if (timers_state.cpu_ticks_prev > ticks) {
     if (timers_state.cpu_ticks_prev > ticks) {
@@ -247,7 +247,7 @@ void cpu_enable_ticks(void)
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     if (!timers_state.cpu_ticks_enabled) {
     if (!timers_state.cpu_ticks_enabled) {
-        timers_state.cpu_ticks_offset -= cpu_get_real_ticks();
+        timers_state.cpu_ticks_offset -= cpu_get_host_ticks();
         timers_state.cpu_clock_offset -= get_clock();
         timers_state.cpu_clock_offset -= get_clock();
         timers_state.cpu_ticks_enabled = 1;
         timers_state.cpu_ticks_enabled = 1;
     }
     }
@@ -263,7 +263,7 @@ void cpu_disable_ticks(void)
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     if (timers_state.cpu_ticks_enabled) {
     if (timers_state.cpu_ticks_enabled) {
-        timers_state.cpu_ticks_offset += cpu_get_real_ticks();
+        timers_state.cpu_ticks_offset += cpu_get_host_ticks();
         timers_state.cpu_clock_offset = cpu_get_clock_locked();
         timers_state.cpu_clock_offset = cpu_get_clock_locked();
         timers_state.cpu_ticks_enabled = 0;
         timers_state.cpu_ticks_enabled = 0;
     }
     }

+ 1 - 3
hw/char/etraxfs_ser.c

@@ -182,15 +182,13 @@ static void serial_receive(void *opaque, const uint8_t *buf, int size)
 static int serial_can_receive(void *opaque)
 static int serial_can_receive(void *opaque)
 {
 {
     ETRAXSerial *s = opaque;
     ETRAXSerial *s = opaque;
-    int r;
 
 
     /* Is the receiver enabled?  */
     /* Is the receiver enabled?  */
     if (!(s->regs[RW_REC_CTRL] & (1 << 3))) {
     if (!(s->regs[RW_REC_CTRL] & (1 << 3))) {
         return 0;
         return 0;
     }
     }
 
 
-    r = sizeof(s->rx_fifo) - s->rx_fifo_len;
-    return r;
+    return sizeof(s->rx_fifo) - s->rx_fifo_len;
 }
 }
 
 
 static void serial_event(void *opaque, int event)
 static void serial_event(void *opaque, int event)

+ 3 - 1
hw/char/imx_serial.c

@@ -66,7 +66,9 @@ static void imx_update(IMXSerialState *s)
     uint32_t flags;
     uint32_t flags;
 
 
     flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
     flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
-    if (!(s->ucr1 & UCR1_TXMPTYEN)) {
+    if (s->ucr1 & UCR1_TXMPTYEN) {
+        flags |= (s->uts1 & UTS1_TXEMPTY);
+    } else {
         flags &= ~USR1_TRDY;
         flags &= ~USR1_TRDY;
     }
     }
 
 

+ 0 - 1
hw/i386/kvm/pci-assign.c

@@ -22,7 +22,6 @@
  */
  */
 #include <stdio.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unistd.h>
-#include <sys/io.h>
 #include <sys/mman.h>
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/stat.h>

+ 4 - 0
hw/i386/pc.c

@@ -985,6 +985,10 @@ static void load_linux(PCMachineState *pcms,
         setup_size = 4;
         setup_size = 4;
     }
     }
     setup_size = (setup_size+1)*512;
     setup_size = (setup_size+1)*512;
+    if (setup_size > kernel_size) {
+        fprintf(stderr, "qemu: invalid kernel header\n");
+        exit(1);
+    }
     kernel_size -= setup_size;
     kernel_size -= setup_size;
 
 
     setup  = g_malloc(setup_size);
     setup  = g_malloc(setup_size);

+ 1 - 1
hw/intc/xics.c

@@ -848,7 +848,7 @@ static target_ulong h_xirr_x(PowerPCCPU *cpu, sPAPRMachineState *spapr,
     uint32_t xirr = icp_accept(ss);
     uint32_t xirr = icp_accept(ss);
 
 
     args[0] = xirr;
     args[0] = xirr;
-    args[1] = cpu_get_real_ticks();
+    args[1] = cpu_get_host_ticks();
     return H_SUCCESS;
     return H_SUCCESS;
 }
 }
 
 

+ 1 - 1
hw/net/rocker/rocker.c

@@ -1362,7 +1362,7 @@ static int pci_rocker_init(PCIDevice *dev)
         r->fp_ports = ROCKER_FP_PORTS_MAX;
         r->fp_ports = ROCKER_FP_PORTS_MAX;
     }
     }
 
 
-    r->rings = g_malloc(sizeof(DescRing *) * rocker_pci_ring_count(r));
+    r->rings = g_new(DescRing *, rocker_pci_ring_count(r));
     if (!r->rings) {
     if (!r->rings) {
         goto err_rings_alloc;
         goto err_rings_alloc;
     }
     }

+ 2 - 2
hw/net/rocker/rocker_desc.c

@@ -142,7 +142,7 @@ bool desc_ring_set_size(DescRing *ring, uint32_t size)
     ring->size = size;
     ring->size = size;
     ring->head = ring->tail = 0;
     ring->head = ring->tail = 0;
 
 
-    ring->info = g_realloc(ring->info, size * sizeof(DescInfo));
+    ring->info = g_renew(DescInfo, ring->info, size);
     if (!ring->info) {
     if (!ring->info) {
         return false;
         return false;
     }
     }
@@ -345,7 +345,7 @@ DescRing *desc_ring_alloc(Rocker *r, int index)
 {
 {
     DescRing *ring;
     DescRing *ring;
 
 
-    ring = g_malloc0(sizeof(DescRing));
+    ring = g_new0(DescRing, 1);
     if (!ring) {
     if (!ring) {
         return NULL;
         return NULL;
     }
     }

+ 1 - 1
hw/net/rocker/rocker_fp.c

@@ -218,7 +218,7 @@ FpPort *fp_port_alloc(Rocker *r, char *sw_name,
                       MACAddr *start_mac, unsigned int index,
                       MACAddr *start_mac, unsigned int index,
                       NICPeers *peers)
                       NICPeers *peers)
 {
 {
-    FpPort *port = g_malloc0(sizeof(FpPort));
+    FpPort *port = g_new0(FpPort, 1);
 
 
     if (!port) {
     if (!port) {
         return NULL;
         return NULL;

+ 4 - 5
hw/net/rocker/rocker_of_dpa.c

@@ -367,7 +367,7 @@ static OfDpaFlow *of_dpa_flow_alloc(uint64_t cookie)
     OfDpaFlow *flow;
     OfDpaFlow *flow;
     int64_t now = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) / 1000;
     int64_t now = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) / 1000;
 
 
-    flow = g_malloc0(sizeof(OfDpaFlow));
+    flow = g_new0(OfDpaFlow, 1);
     if (!flow) {
     if (!flow) {
         return NULL;
         return NULL;
     }
     }
@@ -811,7 +811,7 @@ static int of_dpa_group_get_stats(OfDpa *of_dpa, uint32_t id)
 
 
 static OfDpaGroup *of_dpa_group_alloc(uint32_t id)
 static OfDpaGroup *of_dpa_group_alloc(uint32_t id)
 {
 {
-    OfDpaGroup *group = g_malloc0(sizeof(OfDpaGroup));
+    OfDpaGroup *group = g_new0(OfDpaGroup, 1);
 
 
     if (!group) {
     if (!group) {
         return NULL;
         return NULL;
@@ -2039,15 +2039,14 @@ static int of_dpa_cmd_add_l2_flood(OfDpa *of_dpa, OfDpaGroup *group,
     group->l2_flood.group_count =
     group->l2_flood.group_count =
         rocker_tlv_get_le16(group_tlvs[ROCKER_TLV_OF_DPA_GROUP_COUNT]);
         rocker_tlv_get_le16(group_tlvs[ROCKER_TLV_OF_DPA_GROUP_COUNT]);
 
 
-    tlvs = g_malloc0((group->l2_flood.group_count + 1) *
-                     sizeof(RockerTlv *));
+    tlvs = g_new0(RockerTlv *, group->l2_flood.group_count + 1);
     if (!tlvs) {
     if (!tlvs) {
         return -ROCKER_ENOMEM;
         return -ROCKER_ENOMEM;
     }
     }
 
 
     g_free(group->l2_flood.group_ids);
     g_free(group->l2_flood.group_ids);
     group->l2_flood.group_ids =
     group->l2_flood.group_ids =
-        g_malloc0(group->l2_flood.group_count * sizeof(uint32_t));
+        g_new0(uint32_t, group->l2_flood.group_count);
     if (!group->l2_flood.group_ids) {
     if (!group->l2_flood.group_ids) {
         err = -ROCKER_ENOMEM;
         err = -ROCKER_ENOMEM;
         goto err_out;
         goto err_out;

+ 2 - 2
hw/ppc/ppc.c

@@ -834,7 +834,7 @@ static void cpu_ppc_set_tb_clk (void *opaque, uint32_t freq)
 static void timebase_pre_save(void *opaque)
 static void timebase_pre_save(void *opaque)
 {
 {
     PPCTimebase *tb = opaque;
     PPCTimebase *tb = opaque;
-    uint64_t ticks = cpu_get_real_ticks();
+    uint64_t ticks = cpu_get_host_ticks();
     PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu);
     PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu);
 
 
     if (!first_ppc_cpu->env.tb_env) {
     if (!first_ppc_cpu->env.tb_env) {
@@ -878,7 +878,7 @@ static int timebase_post_load(void *opaque, int version_id)
                                      NANOSECONDS_PER_SECOND);
                                      NANOSECONDS_PER_SECOND);
     guest_tb = tb_remote->guest_timebase + MIN(0, migration_duration_tb);
     guest_tb = tb_remote->guest_timebase + MIN(0, migration_duration_tb);
 
 
-    tb_off_adj = guest_tb - cpu_get_real_ticks();
+    tb_off_adj = guest_tb - cpu_get_host_ticks();
 
 
     tb_off = first_ppc_cpu->env.tb_env->tb_offset;
     tb_off = first_ppc_cpu->env.tb_env->tb_offset;
     trace_ppc_tb_adjust(tb_off, tb_off_adj, tb_off_adj - tb_off,
     trace_ppc_tb_adjust(tb_off, tb_off_adj, tb_off_adj - tb_off,

+ 23 - 20
hw/sd/sdhci.c

@@ -22,6 +22,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
  */
 
 
+#include <inttypes.h>
 #include "hw/hw.h"
 #include "hw/hw.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/blockdev.h"
@@ -36,24 +37,24 @@
 #define SDHC_DEBUG                        0
 #define SDHC_DEBUG                        0
 #endif
 #endif
 
 
-#if SDHC_DEBUG == 0
-    #define DPRINT_L1(fmt, args...)       do { } while (0)
-    #define DPRINT_L2(fmt, args...)       do { } while (0)
-    #define ERRPRINT(fmt, args...)        do { } while (0)
-#elif SDHC_DEBUG == 1
-    #define DPRINT_L1(fmt, args...)       \
-        do {fprintf(stderr, "QEMU SDHC: "fmt, ## args); } while (0)
-    #define DPRINT_L2(fmt, args...)       do { } while (0)
-    #define ERRPRINT(fmt, args...)        \
-        do {fprintf(stderr, "QEMU SDHC ERROR: "fmt, ## args); } while (0)
-#else
-    #define DPRINT_L1(fmt, args...)       \
-        do {fprintf(stderr, "QEMU SDHC: "fmt, ## args); } while (0)
-    #define DPRINT_L2(fmt, args...)       \
-        do {fprintf(stderr, "QEMU SDHC: "fmt, ## args); } while (0)
-    #define ERRPRINT(fmt, args...)        \
-        do {fprintf(stderr, "QEMU SDHC ERROR: "fmt, ## args); } while (0)
-#endif
+#define DPRINT_L1(fmt, args...) \
+    do { \
+        if (SDHC_DEBUG) { \
+            fprintf(stderr, "QEMU SDHC: " fmt, ## args); \
+        } \
+    } while (0)
+#define DPRINT_L2(fmt, args...) \
+    do { \
+        if (SDHC_DEBUG > 1) { \
+            fprintf(stderr, "QEMU SDHC: " fmt, ## args); \
+        } \
+    } while (0)
+#define ERRPRINT(fmt, args...) \
+    do { \
+        if (SDHC_DEBUG) { \
+            fprintf(stderr, "QEMU SDHC ERROR: " fmt, ## args); \
+        } \
+    } while (0)
 
 
 /* Default SD/MMC host controller features information, which will be
 /* Default SD/MMC host controller features information, which will be
  * presented in CAPABILITIES register of generic SD host controller at reset.
  * presented in CAPABILITIES register of generic SD host controller at reset.
@@ -719,7 +720,8 @@ static void sdhci_do_adma(SDHCIState *s)
             break;
             break;
         case SDHC_ADMA_ATTR_ACT_LINK:   /* link to next descriptor table */
         case SDHC_ADMA_ATTR_ACT_LINK:   /* link to next descriptor table */
             s->admasysaddr = dscr.addr;
             s->admasysaddr = dscr.addr;
-            DPRINT_L1("ADMA link: admasysaddr=0x%lx\n", s->admasysaddr);
+            DPRINT_L1("ADMA link: admasysaddr=0x%" PRIx64 "\n",
+                      s->admasysaddr);
             break;
             break;
         default:
         default:
             s->admasysaddr += dscr.incr;
             s->admasysaddr += dscr.incr;
@@ -727,7 +729,8 @@ static void sdhci_do_adma(SDHCIState *s)
         }
         }
 
 
         if (dscr.attr & SDHC_ADMA_ATTR_INT) {
         if (dscr.attr & SDHC_ADMA_ATTR_INT) {
-            DPRINT_L1("ADMA interrupt: admasysaddr=0x%lx\n", s->admasysaddr);
+            DPRINT_L1("ADMA interrupt: admasysaddr=0x%" PRIx64 "\n",
+                      s->admasysaddr);
             if (s->norintstsen & SDHC_NISEN_DMA) {
             if (s->norintstsen & SDHC_NISEN_DMA) {
                 s->norintsts |= SDHC_NIS_DMA;
                 s->norintsts |= SDHC_NIS_DMA;
             }
             }

+ 1 - 3
hw/timer/m48t59.c

@@ -590,10 +590,8 @@ static void nvram_writel (void *opaque, hwaddr addr, uint32_t value)
 static uint32_t nvram_readb (void *opaque, hwaddr addr)
 static uint32_t nvram_readb (void *opaque, hwaddr addr)
 {
 {
     M48t59State *NVRAM = opaque;
     M48t59State *NVRAM = opaque;
-    uint32_t retval;
 
 
-    retval = m48t59_read(NVRAM, addr);
-    return retval;
+    return m48t59_read(NVRAM, addr);
 }
 }
 
 
 static uint32_t nvram_readw (void *opaque, hwaddr addr)
 static uint32_t nvram_readw (void *opaque, hwaddr addr)

+ 10 - 10
include/qemu/timer.h

@@ -857,7 +857,7 @@ int64_t cpu_icount_to_ns(int64_t icount);
 
 
 #if defined(_ARCH_PPC)
 #if defined(_ARCH_PPC)
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     int64_t retval;
     int64_t retval;
 #ifdef _ARCH_PPC64
 #ifdef _ARCH_PPC64
@@ -883,7 +883,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 
 #elif defined(__i386__)
 #elif defined(__i386__)
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     int64_t val;
     int64_t val;
     asm volatile ("rdtsc" : "=A" (val));
     asm volatile ("rdtsc" : "=A" (val));
@@ -892,7 +892,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 
 #elif defined(__x86_64__)
 #elif defined(__x86_64__)
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     uint32_t low,high;
     uint32_t low,high;
     int64_t val;
     int64_t val;
@@ -905,7 +905,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 
 #elif defined(__hppa__)
 #elif defined(__hppa__)
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     int val;
     int val;
     asm volatile ("mfctl %%cr16, %0" : "=r"(val));
     asm volatile ("mfctl %%cr16, %0" : "=r"(val));
@@ -914,7 +914,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 
 #elif defined(__ia64)
 #elif defined(__ia64)
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     int64_t val;
     int64_t val;
     asm volatile ("mov %0 = ar.itc" : "=r"(val) :: "memory");
     asm volatile ("mov %0 = ar.itc" : "=r"(val) :: "memory");
@@ -923,7 +923,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 
 #elif defined(__s390__)
 #elif defined(__s390__)
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     int64_t val;
     int64_t val;
     asm volatile("stck 0(%1)" : "=m" (val) : "a" (&val) : "cc");
     asm volatile("stck 0(%1)" : "=m" (val) : "a" (&val) : "cc");
@@ -932,7 +932,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 
 #elif defined(__sparc__)
 #elif defined(__sparc__)
 
 
-static inline int64_t cpu_get_real_ticks (void)
+static inline int64_t cpu_get_host_ticks (void)
 {
 {
 #if defined(_LP64)
 #if defined(_LP64)
     uint64_t        rval;
     uint64_t        rval;
@@ -970,7 +970,7 @@ static inline int64_t cpu_get_real_ticks (void)
                               : "=r" (value));          \
                               : "=r" (value));          \
     }
     }
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     /* On kernels >= 2.6.25 rdhwr <reg>, $2 and $3 are emulated */
     /* On kernels >= 2.6.25 rdhwr <reg>, $2 and $3 are emulated */
     uint32_t count;
     uint32_t count;
@@ -986,7 +986,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 
 #elif defined(__alpha__)
 #elif defined(__alpha__)
 
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
 {
     uint64_t cc;
     uint64_t cc;
     uint32_t cur, ofs;
     uint32_t cur, ofs;
@@ -1001,7 +1001,7 @@ static inline int64_t cpu_get_real_ticks(void)
 /* The host CPU doesn't have an easily accessible cycle counter.
 /* The host CPU doesn't have an easily accessible cycle counter.
    Just return a monotonically increasing value.  This will be
    Just return a monotonically increasing value.  This will be
    totally wrong, but hopefully better than nothing.  */
    totally wrong, but hopefully better than nothing.  */
-static inline int64_t cpu_get_real_ticks (void)
+static inline int64_t cpu_get_host_ticks (void)
 {
 {
     static int64_t ticks = 0;
     static int64_t ticks = 0;
     return ticks++;
     return ticks++;

+ 1 - 1
linux-user/elfload.c

@@ -2853,7 +2853,7 @@ static int fill_note_info(struct elf_note_info *info,
     TaskState *ts = (TaskState *)cpu->opaque;
     TaskState *ts = (TaskState *)cpu->opaque;
     int i;
     int i;
 
 
-    info->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote));
+    info->notes = g_new0(struct memelfnote, NUMNOTES);
     if (info->notes == NULL)
     if (info->notes == NULL)
         return (-ENOMEM);
         return (-ENOMEM);
     info->prstatus = g_malloc0(sizeof (*info->prstatus));
     info->prstatus = g_malloc0(sizeof (*info->prstatus));

+ 3 - 3
linux-user/main.c

@@ -215,7 +215,7 @@ void cpu_list_unlock(void)
 
 
 uint64_t cpu_get_tsc(CPUX86State *env)
 uint64_t cpu_get_tsc(CPUX86State *env)
 {
 {
-    return cpu_get_real_ticks();
+    return cpu_get_host_ticks();
 }
 }
 
 
 static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
 static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
@@ -1425,7 +1425,7 @@ void cpu_loop (CPUSPARCState *env)
 #ifdef TARGET_PPC
 #ifdef TARGET_PPC
 static inline uint64_t cpu_ppc_get_tb(CPUPPCState *env)
 static inline uint64_t cpu_ppc_get_tb(CPUPPCState *env)
 {
 {
-    return cpu_get_real_ticks();
+    return cpu_get_host_ticks();
 }
 }
 
 
 uint64_t cpu_ppc_load_tbl(CPUPPCState *env)
 uint64_t cpu_ppc_load_tbl(CPUPPCState *env)
@@ -4270,7 +4270,7 @@ int main(int argc, char **argv, char **envp)
     }
     }
     target_argv[target_argc] = NULL;
     target_argv[target_argc] = NULL;
 
 
-    ts = g_malloc0 (sizeof(TaskState));
+    ts = g_new0(TaskState, 1);
     init_task_state(ts);
     init_task_state(ts);
     /* build Task State */
     /* build Task State */
     ts->info = info;
     ts->info = info;

+ 5 - 5
linux-user/syscall.c

@@ -2728,8 +2728,9 @@ static inline abi_long host_to_target_semarray(int semid, abi_ulong target_addr,
 }
 }
 
 
 static inline abi_long do_semctl(int semid, int semnum, int cmd,
 static inline abi_long do_semctl(int semid, int semnum, int cmd,
-                                 union target_semun target_su)
+                                 abi_ulong target_arg)
 {
 {
+    union target_semun target_su = { .buf = target_arg };
     union semun arg;
     union semun arg;
     struct semid_ds dsarg;
     struct semid_ds dsarg;
     unsigned short *array = NULL;
     unsigned short *array = NULL;
@@ -3251,8 +3252,7 @@ static abi_long do_ipc(unsigned int call, abi_long first,
          * ptr argument. */
          * ptr argument. */
         abi_ulong atptr;
         abi_ulong atptr;
         get_user_ual(atptr, ptr);
         get_user_ual(atptr, ptr);
-        ret = do_semctl(first, second, third,
-                (union target_semun) atptr);
+        ret = do_semctl(first, second, third, atptr);
         break;
         break;
     }
     }
 
 
@@ -4566,7 +4566,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
         new_thread_info info;
         new_thread_info info;
         pthread_attr_t attr;
         pthread_attr_t attr;
 
 
-        ts = g_malloc0(sizeof(TaskState));
+        ts = g_new0(TaskState, 1);
         init_task_state(ts);
         init_task_state(ts);
         /* we create a new CPU instance. */
         /* we create a new CPU instance. */
         new_env = cpu_copy(env);
         new_env = cpu_copy(env);
@@ -7550,7 +7550,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #endif
 #ifdef TARGET_NR_semctl
 #ifdef TARGET_NR_semctl
     case TARGET_NR_semctl:
     case TARGET_NR_semctl:
-        ret = do_semctl(arg1, arg2, arg3, (union target_semun)(abi_ulong)arg4);
+        ret = do_semctl(arg1, arg2, arg3, arg4);
         break;
         break;
 #endif
 #endif
 #ifdef TARGET_NR_msgctl
 #ifdef TARGET_NR_msgctl

+ 1 - 1
qapi/block.json

@@ -6,7 +6,7 @@
 { 'include': 'block-core.json' }
 { 'include': 'block-core.json' }
 
 
 ##
 ##
-# BiosAtaTranslation:
+# @BiosAtaTranslation:
 #
 #
 # Policy that BIOS should use to interpret cylinder/head/sector
 # Policy that BIOS should use to interpret cylinder/head/sector
 # addresses.  Note that Bochs BIOS and SeaBIOS will not actually
 # addresses.  Note that Bochs BIOS and SeaBIOS will not actually

+ 1 - 1
target-alpha/sys_helper.c

@@ -34,7 +34,7 @@ uint64_t helper_load_pcc(CPUAlphaState *env)
 #else
 #else
     /* In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist.  Just pass through the host cpu
     /* In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist.  Just pass through the host cpu
        clock ticks.  Also, don't bother taking PCC_OFS into account.  */
        clock ticks.  Also, don't bother taking PCC_OFS into account.  */
-    return (uint32_t)cpu_get_real_ticks();
+    return (uint32_t)cpu_get_host_ticks();
 #endif
 #endif
 }
 }
 
 

+ 1 - 3
target-microblaze/op_helper.c

@@ -150,9 +150,7 @@ uint32_t helper_clz(uint32_t t0)
 
 
 uint32_t helper_carry(uint32_t a, uint32_t b, uint32_t cf)
 uint32_t helper_carry(uint32_t a, uint32_t b, uint32_t cf)
 {
 {
-    uint32_t ncf;
-    ncf = compute_carry(a, b, cf);
-    return ncf;
+    return compute_carry(a, b, cf);
 }
 }
 
 
 static inline int div_prepare(CPUMBState *env, uint32_t a, uint32_t b)
 static inline int div_prepare(CPUMBState *env, uint32_t a, uint32_t b)

+ 1 - 2
target-ppc/kvm.c

@@ -1782,8 +1782,7 @@ uint32_t kvmppc_get_tbfreq(void)
 
 
     ns++;
     ns++;
 
 
-    retval = atoi(ns);
-    return retval;
+    return atoi(ns);
 }
 }
 
 
 bool kvmppc_get_host_serial(char **value)
 bool kvmppc_get_host_serial(char **value)

+ 8 - 8
tests/test-string-output-visitor.c

@@ -248,39 +248,39 @@ int main(int argc, char **argv)
 
 
     output_visitor_test_add("/string-visitor/output/int",
     output_visitor_test_add("/string-visitor/output/int",
                             &out_visitor_data, test_visitor_out_int, false);
                             &out_visitor_data, test_visitor_out_int, false);
-    output_visitor_test_add("/string-visitor/output/int",
+    output_visitor_test_add("/string-visitor/output/int-human",
                             &out_visitor_data, test_visitor_out_int, true);
                             &out_visitor_data, test_visitor_out_int, true);
     output_visitor_test_add("/string-visitor/output/bool",
     output_visitor_test_add("/string-visitor/output/bool",
                             &out_visitor_data, test_visitor_out_bool, false);
                             &out_visitor_data, test_visitor_out_bool, false);
-    output_visitor_test_add("/string-visitor/output/bool",
+    output_visitor_test_add("/string-visitor/output/bool-human",
                             &out_visitor_data, test_visitor_out_bool, true);
                             &out_visitor_data, test_visitor_out_bool, true);
     output_visitor_test_add("/string-visitor/output/number",
     output_visitor_test_add("/string-visitor/output/number",
                             &out_visitor_data, test_visitor_out_number, false);
                             &out_visitor_data, test_visitor_out_number, false);
-    output_visitor_test_add("/string-visitor/output/number",
+    output_visitor_test_add("/string-visitor/output/number-human",
                             &out_visitor_data, test_visitor_out_number, true);
                             &out_visitor_data, test_visitor_out_number, true);
     output_visitor_test_add("/string-visitor/output/string",
     output_visitor_test_add("/string-visitor/output/string",
                             &out_visitor_data, test_visitor_out_string, false);
                             &out_visitor_data, test_visitor_out_string, false);
-    output_visitor_test_add("/string-visitor/output/string",
+    output_visitor_test_add("/string-visitor/output/string-human",
                             &out_visitor_data, test_visitor_out_string, true);
                             &out_visitor_data, test_visitor_out_string, true);
     output_visitor_test_add("/string-visitor/output/no-string",
     output_visitor_test_add("/string-visitor/output/no-string",
                             &out_visitor_data, test_visitor_out_no_string,
                             &out_visitor_data, test_visitor_out_no_string,
                             false);
                             false);
-    output_visitor_test_add("/string-visitor/output/no-string",
+    output_visitor_test_add("/string-visitor/output/no-string-human",
                             &out_visitor_data, test_visitor_out_no_string,
                             &out_visitor_data, test_visitor_out_no_string,
                             true);
                             true);
     output_visitor_test_add("/string-visitor/output/enum",
     output_visitor_test_add("/string-visitor/output/enum",
                             &out_visitor_data, test_visitor_out_enum, false);
                             &out_visitor_data, test_visitor_out_enum, false);
-    output_visitor_test_add("/string-visitor/output/enum",
+    output_visitor_test_add("/string-visitor/output/enum-human",
                             &out_visitor_data, test_visitor_out_enum, true);
                             &out_visitor_data, test_visitor_out_enum, true);
     output_visitor_test_add("/string-visitor/output/enum-errors",
     output_visitor_test_add("/string-visitor/output/enum-errors",
                             &out_visitor_data, test_visitor_out_enum_errors,
                             &out_visitor_data, test_visitor_out_enum_errors,
                             false);
                             false);
-    output_visitor_test_add("/string-visitor/output/enum-errors",
+    output_visitor_test_add("/string-visitor/output/enum-errors-human",
                             &out_visitor_data, test_visitor_out_enum_errors,
                             &out_visitor_data, test_visitor_out_enum_errors,
                             true);
                             true);
     output_visitor_test_add("/string-visitor/output/intList",
     output_visitor_test_add("/string-visitor/output/intList",
                             &out_visitor_data, test_visitor_out_intList, false);
                             &out_visitor_data, test_visitor_out_intList, false);
-    output_visitor_test_add("/string-visitor/output/intList",
+    output_visitor_test_add("/string-visitor/output/intList-human",
                             &out_visitor_data, test_visitor_out_intList, true);
                             &out_visitor_data, test_visitor_out_intList, true);
 
 
     g_test_run();
     g_test_run();