Skip to contentSkip to conversation

kvm-userspace: Fix kvm-originated warnings

PATCH Applied Jan Kiszka 2 participants 4 messages Feb 6, 2009 – Feb 8, 2009 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH v2 1/1 kvm-userspace: Fix kvm-originated warnings

[ New version, fixing another brand-new warning. Again, if something should be split out into a separate patch, just let me know. ]

This patch kills the last warnings (caused by kvm changes) that I see on a x86-64 host when building x86_64-softmmu and also i386-softmmu without kvm.

---

 qemu/block-raw-posix.c   |    1 -
 qemu/block.c             |   10 ----------
 qemu/hw/extboot.c        |    2 +-
 qemu/kvm-tpr-opt.c       |    2 +-
 qemu/net.c               |    2 +-
 qemu/qemu-kvm.c          |   11 ++++++-----
 qemu/target-i386/cpu.h   |    2 +-
 qemu/vl.c                |    7 ++++---
 user/test/x86/access.c   |    4 ++--
 user/test/x86/emulator.c |    1 -
 user/test/x86/vmexit.c   |    2 +-
 11 files changed, 17 insertions(+), 27 deletions(-)
qemu/block-raw-posix.c +0 -1
index 50685b6..8ab27d8 100644
@@ -527,7 +527,6 @@ static int posix_aio_init(void)
 {
     sigset_t mask;
     PosixAioState *s;
-    int fds[2];
     struct qemu_paioinit ai;
   
     if (posix_aio_state)
qemu/block.c +0 -10
index f6a1180..453e77c 100644
@@ -1005,16 +1005,6 @@ void bdrv_flush(BlockDriverState *bs)
         bdrv_flush(bs->backing_hd);
 }
 
-void bdrv_iterate_writeable(void (*it)(BlockDriverState *bs))
-{
-    BlockDriverState *bs;
-
-    for (bs = bdrv_first; bs != NULL; bs = bs->next)
-        if (bs->drv && !bdrv_is_read_only(bs) && 
-            (!bdrv_is_removable(bs) || bdrv_is_inserted(bs)))
-	    it(bs);
-}
-
 void bdrv_flush_all(void)
 {
     BlockDriverState *bs;
qemu/hw/extboot.c +1 -1
index 056fb59..ada0fdd 100644
@@ -76,7 +76,7 @@ static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
     union extboot_cmd *cmd = (void *)(phys_ram_base + ((value & 0xFFFF) << 4));
     BlockDriverState *bs = opaque;
     int cylinders, heads, sectors, err;
-    int64_t nb_sectors;
+    uint64_t nb_sectors;
 
     get_translated_chs(bs, &cylinders, &heads, &sectors);
 
qemu/kvm-tpr-opt.c +1 -1
index 44b453f..246e08d 100644
@@ -112,7 +112,7 @@ static struct vapic_bios vapic_bios;
 static uint32_t real_tpr;
 static uint32_t bios_addr;
 static uint32_t vapic_phys;
-static int bios_enabled;
+static uint32_t bios_enabled;
 static uint32_t vbios_desc_phys;
 
 static void update_vbios_real_tpr(void)
qemu/net.c +1 -1
index b4c92da..4b0bc0b 100644
@@ -767,7 +767,7 @@ static int tap_can_send(void *opaque)
 
 static int tap_send_packet(TAPState *s)
 {
-    uint8_t *buf = s->buf;
+    uint8_t *buf = (uint8_t *)s->buf;
     int size = s->size;
 
 #ifdef IFF_VNET_HDR
qemu/qemu-kvm.c +6 -5
index 97f4a81..0317ea6 100644
@@ -102,12 +102,12 @@ static void on_vcpu(CPUState *env, void (*func)(void *data), void *data)
 
 static void inject_interrupt(void *data)
 {
-    cpu_interrupt(current_env, (int)data);
+    cpu_interrupt(current_env, (long)data);
 }
 
 void kvm_inject_interrupt(CPUState *env, int mask)
 {
-    on_vcpu(env, inject_interrupt, (void *)mask);
+    on_vcpu(env, inject_interrupt, (void *)(long)mask);
 }
 
 void kvm_update_interrupt_request(CPUState *env)
@@ -319,7 +319,7 @@ static void resume_all_threads(void)
     }
 }
 
-static void kvm_vm_state_change_handler(void *context, int running)
+static void kvm_vm_state_change_handler(void *context, int running, int reason)
 {
     if (running)
 	resume_all_threads();
@@ -616,7 +616,8 @@ int kvm_main_loop(void)
 }
 
 #ifdef KVM_CAP_SET_GUEST_DEBUG
-int kvm_debug(void *opaque, void *data, struct kvm_debug_exit_arch *arch_info)
+static int kvm_debug(void *opaque, void *data,
+                     struct kvm_debug_exit_arch *arch_info)
 {
     int handle = kvm_arch_debug(arch_info);
     struct CPUState *env = data;
@@ -1006,7 +1007,7 @@ struct kvm_set_guest_debug_data {
     int err;
 };
 
-void kvm_invoke_set_guest_debug(void *data)
+static void kvm_invoke_set_guest_debug(void *data)
 {
     struct kvm_set_guest_debug_data *dbg_data = data;
 
qemu/target-i386/cpu.h +1 -1
index 28c86e5..1338f5c 100644
@@ -670,7 +670,7 @@ typedef struct CPUX86State {
     /* in order to simplify APIC support, we leave this pointer to the
        user */
     struct APICState *apic_state;
-    int mp_state;
+    uint32_t mp_state;
 } CPUX86State;
 
 CPUX86State *cpu_x86_init(const char *cpu_model);
qemu/vl.c +4 -3
index 93ed5fe..0ba9ef5 100644
@@ -4725,7 +4725,7 @@ void qemu_get_launch_info(int *argc, char ***argv, int *opt_daemonize, const cha
     *opt_incoming = incoming;
 }
 
-
+#ifdef USE_KVM
 static int gethugepagesize(void)
 {
     int ret, fd;
@@ -4812,13 +4812,14 @@ static void *alloc_mem_area(size_t memory, unsigned long *len, const char *path)
     *len = memory;
     return area;
 }
+#endif
 
 static void *qemu_alloc_physram(unsigned long memory)
 {
     void *area = NULL;
+#ifdef USE_KVM
     unsigned long map_len = memory;
 
-#ifdef USE_KVM
     if (mem_path)
 	area = alloc_mem_area(memory, &map_len, mem_path);
 #endif
@@ -5670,7 +5671,7 @@ int main(int argc, char **argv, char **envp)
     }
 #endif
 
-#if USE_KVM
+#ifdef USE_KVM
     if (kvm_enabled()) {
 	if (kvm_qemu_init() < 0) {
 	    fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
user/test/x86/access.c +2 -2
index 0e61597..49f74b3 100644
@@ -551,7 +551,7 @@ int ac_test_exec(ac_test_t *at)
     return r;
 }
 
-int ac_test_run()
+int ac_test_run(void)
 {
     static ac_test_t at;
     int tests, successes;
@@ -574,7 +574,7 @@ int main()
     int r;
 
     printf("starting test\n\n");
-    smp_init(ac_test_run);
+    smp_init((void(*)(void))ac_test_run);
     r = ac_test_run();
     return r ? 0 : 1;
 }
user/test/x86/emulator.c +0 -1
index bbe55a7..c6adbb5 100644
@@ -134,7 +134,6 @@ void test_pop(void *mem)
 {
 	unsigned long tmp;
 	unsigned long *stack_top = mem + 4096;
-	unsigned long *new_stack_top;
 	unsigned long memw = 0x123456789abcdeful;
 	static unsigned long tmp2;
 
user/test/x86/vmexit.c +1 -1
index 0662f34..bd57bfa 100644
@@ -1,5 +1,5 @@
 
-#include "printf.h"
+#include "libcflat.h"
 
 static inline unsigned long long rdtsc()
 {
author
#1 lore raw

PATCH 1/1 libkvm: Fix return of kvm_commit_irq_routes

Quoted 3 lines · Jan Kiszka

This patch kills the last warnings (caused by kvm changes) that I see on a x86-64 host when building x86_64-softmmu and also i386-softmmu without kvm.

Not true, I missed another new warning that could be more problematic than the rest:

-------->

[PATCH] libkvm: Fix return of kvm_commit_irq_routes

---

 libkvm/libkvm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
libkvm/libkvm.c +1 -0
index 80300c9..92ffe10 100644
@@ -1267,6 +1267,7 @@ int kvm_commit_irq_routes(kvm_context_t kvm)
 	r = ioctl(kvm->vm_fd, KVM_SET_GSI_ROUTING, kvm->irq_routes);
 	if (r == -1)
 		r = -errno;
+	return r;
 #else
 	return -ENOSYS;
 #endif
Applied
#2 lore raw

Re: [PATCH] libkvm: Fix return of kvm_commit_irq_routes

Quoted 10 lines · Jan Kiszka
Quoted 4 lines · Jan Kiszka

This patch kills the last warnings (caused by kvm changes) that I see on a x86-64 host when building x86_64-softmmu and also i386-softmmu without kvm.

Not true, I missed another new warning that could be more problematic than the rest:

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function
Applied
#3 lore raw
In reply to Jan Kiszka
Quoted 7 lines · Jan Kiszka

[ New version, fixing another brand-new warning. Again, if something should be split out into a separate patch, just let me know. ]

This patch kills the last warnings (caused by kvm changes) that I see on a x86-64 host when building x86_64-softmmu and also i386-softmmu without kvm.

Applied, thanks. I split the patch into two for qemu/ and user/.

Signature · 1 line
error compiling committee.c: too many arguments to function