summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile.objs2
-rw-r--r--balloon.c10
-rw-r--r--balloon.h1
-rw-r--r--console.c2
-rw-r--r--console.h5
-rw-r--r--hw/9pfs/virtio-9p-coth.c4
-rw-r--r--hw/virtio-balloon.c2
-rw-r--r--oslib-posix.c14
-rw-r--r--target-unicore32/translate.c16
-rw-r--r--tcg/ppc64/tcg-target.c2
-rw-r--r--ui/vnc-tls.c68
-rw-r--r--vl.c1
12 files changed, 94 insertions, 33 deletions
diff --git a/Makefile.objs b/Makefile.objs
index 26b885bfeb..a529a11e7f 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -390,6 +390,8 @@ trace-nested-y += control.o
 
 trace-obj-y += $(addprefix trace/, $(trace-nested-y))
 
+$(trace-obj-y): $(GENERATED_HEADERS)
+
 ######################################################################
 # smartcard
 
diff --git a/balloon.c b/balloon.c
index f56fdc1c4b..a2133dba75 100644
--- a/balloon.c
+++ b/balloon.c
@@ -52,6 +52,16 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func,
     return 0;
 }
 
+void qemu_remove_balloon_handler(void *opaque)
+{
+    if (balloon_opaque != opaque) {
+        return;
+    }
+    balloon_event_fn = NULL;
+    balloon_stat_fn = NULL;
+    balloon_opaque = NULL;
+}
+
 static int qemu_balloon(ram_addr_t target)
 {
     if (!balloon_event_fn) {
diff --git a/balloon.h b/balloon.h
index 3df14e645a..f59e2881f6 100644
--- a/balloon.h
+++ b/balloon.h
@@ -22,6 +22,7 @@ typedef void (QEMUBalloonStatus)(void *opaque, MonitorCompletion cb,
 
 int qemu_add_balloon_handler(QEMUBalloonEvent *event_func,
 			     QEMUBalloonStatus *stat_func, void *opaque);
+void qemu_remove_balloon_handler(void *opaque);
 
 void monitor_print_balloon(Monitor *mon, const QObject *data);
 int do_info_balloon(Monitor *mon, MonitorCompletion cb, void *opaque);
diff --git a/console.c b/console.c
index 500b3fbc77..5c7a93b655 100644
--- a/console.c
+++ b/console.c
@@ -343,6 +343,7 @@ static const uint32_t dmask4[4] = {
 
 static uint32_t color_table[2][8];
 
+#ifndef CONFIG_CURSES
 enum color_names {
     COLOR_BLACK   = 0,
     COLOR_RED     = 1,
@@ -353,6 +354,7 @@ enum color_names {
     COLOR_CYAN    = 6,
     COLOR_WHITE   = 7
 };
+#endif
 
 static const uint32_t color_table_rgb[2][8] = {
     {   /* dark */
diff --git a/console.h b/console.h
index 67d137384e..9c1487e041 100644
--- a/console.h
+++ b/console.h
@@ -328,7 +328,12 @@ static inline int ds_get_bytes_per_pixel(DisplayState *ds)
     return ds->surface->pf.bytes_per_pixel;
 }
 
+#ifdef CONFIG_CURSES
+#include <curses.h>
+typedef chtype console_ch_t;
+#else
 typedef unsigned long console_ch_t;
+#endif
 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
 {
     if (!(ch & 0xff))
diff --git a/hw/9pfs/virtio-9p-coth.c b/hw/9pfs/virtio-9p-coth.c
index ae05658632..25556cc6a7 100644
--- a/hw/9pfs/virtio-9p-coth.c
+++ b/hw/9pfs/virtio-9p-coth.c
@@ -67,10 +67,6 @@ int v9fs_init_worker_threads(void)
     /* Leave signal handling to the iothread.  */
     pthread_sigmask(SIG_SETMASK, &set, &oldset);
 
-    /* init thread system if not already initialized */
-    if (!g_thread_get_initialized()) {
-        g_thread_init(NULL);
-    }
     if (qemu_pipe(notifier_fds) == -1) {
         ret = -1;
         goto err_out;
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index 072a88a382..5f8f4bdb9f 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -303,6 +303,8 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev)
 void virtio_balloon_exit(VirtIODevice *vdev)
 {
     VirtIOBalloon *s = DO_UPCAST(VirtIOBalloon, vdev, vdev);
+
+    qemu_remove_balloon_handler(s);
     unregister_savevm(s->qdev, "virtio-balloon", s);
     virtio_cleanup(vdev);
 }
diff --git a/oslib-posix.c b/oslib-posix.c
index 196099cc77..a304fb0f53 100644
--- a/oslib-posix.c
+++ b/oslib-posix.c
@@ -35,6 +35,13 @@
 extern int daemon(int, int);
 #endif
 
+#if defined(__linux__) && defined(__x86_64__)
+   /* Use 2MB alignment so transparent hugepages can be used by KVM */
+#  define QEMU_VMALLOC_ALIGN (512 * 4096)
+#else
+#  define QEMU_VMALLOC_ALIGN getpagesize()
+#endif
+
 #include "config-host.h"
 #include "sysemu.h"
 #include "trace.h"
@@ -80,7 +87,12 @@ void *qemu_memalign(size_t alignment, size_t size)
 void *qemu_vmalloc(size_t size)
 {
     void *ptr;
-    ptr = qemu_memalign(getpagesize(), size);
+    size_t align = QEMU_VMALLOC_ALIGN;
+
+    if (size < align) {
+        align = getpagesize();
+    }
+    ptr = qemu_memalign(align, size);
     trace_qemu_vmalloc(size, ptr);
     return ptr;
 }
diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c
index 4ecb0f1704..4d0aa43da2 100644
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -1788,7 +1788,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
      * E    : 5
      */
     switch (insn >> 29) {
-    case 0b000:
+    case 0x0:
         if (UCOP_SET(5) && UCOP_SET(8) && !UCOP_SET(28)) {
             do_mult(env, s, insn);
             break;
@@ -1798,7 +1798,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
             do_misc(env, s, insn);
             break;
         }
-    case 0b001:
+    case 0x1:
         if (((UCOP_OPCODES >> 2) == 2) && !UCOP_SET_S) {
             do_misc(env, s, insn);
             break;
@@ -1806,7 +1806,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
         do_datap(env, s, insn);
         break;
 
-    case 0b010:
+    case 0x2:
         if (UCOP_SET(8) && UCOP_SET(5)) {
             do_ldst_hwsb(env, s, insn);
             break;
@@ -1814,24 +1814,24 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
         if (UCOP_SET(8) || UCOP_SET(5)) {
             ILLEGAL;
         }
-    case 0b011:
+    case 0x3:
         do_ldst_ir(env, s, insn);
         break;
 
-    case 0b100:
+    case 0x4:
         if (UCOP_SET(8)) {
             ILLEGAL; /* extended instructions */
         }
         do_ldst_m(env, s, insn);
         break;
-    case 0b101:
+    case 0x5:
         do_branch(env, s, insn);
         break;
-    case 0b110:
+    case 0x6:
         /* Coprocessor.  */
         disas_coproc_insn(env, s, insn);
         break;
-    case 0b111:
+    case 0x7:
         if (!UCOP_SET(28)) {
             disas_coproc_insn(env, s, insn);
             break;
diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
index d831684803..e3c63adc3e 100644
--- a/tcg/ppc64/tcg-target.c
+++ b/tcg/ppc64/tcg-target.c
@@ -1560,7 +1560,7 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,
         break;
 
     case INDEX_op_ext32u_i64:
-        tcg_out_rld (s, RLDICR, args[0], args[1], 0, 32);
+        tcg_out_rld (s, RLDICL, args[0], args[1], 0, 32);
         break;
 
     case INDEX_op_setcond_i32:
diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c
index 2e2456e3ac..ffbd1725a4 100644
--- a/ui/vnc-tls.c
+++ b/ui/vnc-tls.c
@@ -283,13 +283,57 @@ int vnc_tls_validate_certificate(struct VncState *vs)
     return 0;
 }
 
+#if defined(GNUTLS_VERSION_NUMBER) && \
+    GNUTLS_VERSION_NUMBER >= 0x020200 /* 2.2.0 */
+
+static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)
+{
+    const char *priority = x509 ? "NORMAL" : "NORMAL:+ANON-DH";
+    int rc;
+
+    rc = gnutls_priority_set_direct(s, priority, NULL);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+    return 0;
+}
+
+#else
+
+static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)
+{
+    static const int cert_types[] = { GNUTLS_CRT_X509, 0 };
+    static const int protocols[] = {
+        GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0
+    };
+    static const int kx_anon[] = { GNUTLS_KX_ANON_DH, 0 };
+    static const int kx_x509[] = {
+        GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA,
+        GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0
+    };
+    int rc;
+
+    rc = gnutls_kx_set_priority(s, x509 ? kx_x509 : kx_anon);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+
+    rc = gnutls_certificate_type_set_priority(s, cert_types);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+
+    rc = gnutls_protocol_set_priority(s, protocols);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+    return 0;
+}
+
+#endif
 
 int vnc_tls_client_setup(struct VncState *vs,
                          int needX509Creds) {
-    static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
-    static const int protocol_priority[]= { GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0 };
-    static const int kx_anon[] = {GNUTLS_KX_ANON_DH, 0};
-    static const int kx_x509[] = {GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0};
 
     VNC_DEBUG("Do TLS setup\n");
     if (vnc_tls_initialize() < 0) {
@@ -310,21 +354,7 @@ int vnc_tls_client_setup(struct VncState *vs,
             return -1;
         }
 
-        if (gnutls_kx_set_priority(vs->tls.session, needX509Creds ? kx_x509 : kx_anon) < 0) {
-            gnutls_deinit(vs->tls.session);
-            vs->tls.session = NULL;
-            vnc_client_error(vs);
-            return -1;
-        }
-
-        if (gnutls_certificate_type_set_priority(vs->tls.session, cert_type_priority) < 0) {
-            gnutls_deinit(vs->tls.session);
-            vs->tls.session = NULL;
-            vnc_client_error(vs);
-            return -1;
-        }
-
-        if (gnutls_protocol_set_priority(vs->tls.session, protocol_priority) < 0) {
+        if (vnc_set_gnutls_priority(vs->tls.session, needX509Creds) < 0) {
             gnutls_deinit(vs->tls.session);
             vs->tls.session = NULL;
             vnc_client_error(vs);
diff --git a/vl.c b/vl.c
index c9e1975b20..b773d2f126 100644
--- a/vl.c
+++ b/vl.c
@@ -2200,6 +2200,7 @@ int main(int argc, char **argv, char **envp)
     error_set_progname(argv[0]);
 
     g_mem_set_vtable(&mem_trace);
+    g_thread_init(NULL);
 
     init_clocks();