All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix compilation with --disable-kvm
  2008-09-30 21:47 [PATCH 0/2] --disable-kvm currently not working Glauber Costa
@ 2008-09-30 21:47 ` Glauber Costa
  0 siblings, 0 replies; 4+ messages in thread
From: Glauber Costa @ 2008-09-30 21:47 UTC (permalink / raw)
  To: kvm; +Cc: avi, aliguori

Currently, kvm is failing to build with --disable-kvm.
this patch fixes the issue.

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 qemu/gdbstub.c       |   15 ++++++++++-----
 qemu/hw/acpi.c       |    6 +++++-
 qemu/hw/cirrus_vga.c |    7 +++----
 qemu/monitor.c       |    6 ++++--
 4 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/qemu/gdbstub.c b/qemu/gdbstub.c
index d57cd61..d65f1cf 100644
--- a/qemu/gdbstub.c
+++ b/qemu/gdbstub.c
@@ -994,10 +994,12 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
             addr = strtoull(p, (char **)&p, 16);
 #if defined(TARGET_I386)
             env->eip = addr;
-            kvm_load_registers(env);
+            if (kvm_enabled())
+                kvm_load_registers(env);
 #elif defined (TARGET_PPC)
             env->nip = addr;
-            kvm_load_registers(env);
+            if (kvm_enabled())
+                kvm_load_registers(env);
 #elif defined (TARGET_SPARC)
             env->pc = addr;
             env->npc = addr + 4;
@@ -1033,7 +1035,8 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
             addr = strtoull(p, (char **)&p, 16);
 #if defined(TARGET_I386)
             env->eip = addr;
-            kvm_load_registers(env);
+            if (kvm_enabled())
+                kvm_load_registers(env);
 #elif defined (TARGET_PPC)
             env->nip = addr;
             kvm_load_registers(env);
@@ -1078,7 +1081,8 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
         }
         break;
     case 'g':
-        kvm_save_registers(env);
+        if (kvm_enabled())
+            kvm_save_registers(env);
         reg_size = cpu_gdb_read_registers(env, mem_buf);
         memtohex(buf, mem_buf, reg_size);
         put_packet(s, buf);
@@ -1088,7 +1092,8 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
         len = strlen(p) / 2;
         hextomem((uint8_t *)registers, p, len);
         cpu_gdb_write_registers(env, mem_buf, len);
-        kvm_load_registers(env);
+        if (kvm_enabled())
+            kvm_load_registers(env);
         put_packet(s, "OK");
         break;
     case 'm':
diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 05f5dc0..a51fcb7 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -726,7 +726,11 @@ void qemu_system_cpu_hot_add(int cpu, int state)
 {
     CPUState *env;
 
-    if ((state) && (!qemu_kvm_cpu_env(cpu))) {
+    if (state 
+#ifdef USE_KVM
+        && (!qemu_kvm_cpu_env(cpu))
+#endif
+    ) {
         env = pc_new_cpu(cpu, model, 1);
         if (!env) {
             fprintf(stderr, "cpu %d creation failed\n", cpu);
diff --git a/qemu/hw/cirrus_vga.c b/qemu/hw/cirrus_vga.c
index 4f3aef9..dac0731 100644
--- a/qemu/hw/cirrus_vga.c
+++ b/qemu/hw/cirrus_vga.c
@@ -2677,14 +2677,13 @@ static void kvm_update_vga_alias(CirrusVGAState *s, int ok, int bank)
 	if (!s->aliases_enabled
 	    || base != s->aliased_bank_base[bank]
 	    || limit != s->aliased_bank_limit[bank]) {
-	    kvm_create_memory_alias(kvm_context,
-				    0xa0000 + bank * 0x8000,
-				    limit, base);
+	    kvm_qemu_create_memory_alias(0xa0000 + bank * 0x8000,
+                                     limit, base);
 	    s->aliased_bank_base[bank] = base;
 	    s->aliased_bank_limit[bank] = limit;
 	}
     } else {
-	kvm_destroy_memory_alias(kvm_context, 0xa0000 + bank * 0x8000);
+	kvm_qemu_destroy_memory_alias(0xa0000 + bank * 0x8000);
     }
 }
 
diff --git a/qemu/monitor.c b/qemu/monitor.c
index d6b3da6..97b5cbe 100644
--- a/qemu/monitor.c
+++ b/qemu/monitor.c
@@ -292,7 +292,8 @@ static CPUState *mon_get_cpu(void)
         mon_set_cpu(0);
     }
 
-    kvm_save_registers(mon_cpu);
+    if (kvm_enabled())
+        kvm_save_registers(mon_cpu);
 
     return mon_cpu;
 }
@@ -320,7 +321,8 @@ static void do_info_cpus(void)
     mon_get_cpu();
 
     for(env = first_cpu; env != NULL; env = env->next_cpu) {
-        kvm_save_registers(env);
+        if (kvm_enabled())
+            kvm_save_registers(env);
         term_printf("%c CPU #%d:",
                     (env == mon_cpu) ? '*' : ' ',
                     env->cpu_index);
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] fix compilation with --disable-kvm
@ 2008-10-02 14:21 Glauber Costa
  2008-10-02 14:31 ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Glauber Costa @ 2008-10-02 14:21 UTC (permalink / raw)
  To: kvm; +Cc: avi, aliguori

Currently, kvm is failing to build with --disable-kvm.
this patch fixes the issue.

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 qemu/hw/acpi.c       |    6 +++++-
 qemu/hw/cirrus_vga.c |    7 +++----
 qemu/qemu-kvm.h      |    2 ++
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 05f5dc0..7a7a534 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -726,7 +726,11 @@ void qemu_system_cpu_hot_add(int cpu, int state)
 {
     CPUState *env;
 
-    if ((state) && (!qemu_kvm_cpu_env(cpu))) {
+    if (state
+#ifdef USE_KVM
+        && (!qemu_kvm_cpu_env(cpu))
+#endif
+    ) {
         env = pc_new_cpu(cpu, model, 1);
         if (!env) {
             fprintf(stderr, "cpu %d creation failed\n", cpu);
diff --git a/qemu/hw/cirrus_vga.c b/qemu/hw/cirrus_vga.c
index 4f3aef9..dac0731 100644
--- a/qemu/hw/cirrus_vga.c
+++ b/qemu/hw/cirrus_vga.c
@@ -2677,14 +2677,13 @@ static void kvm_update_vga_alias(CirrusVGAState *s, int ok, int bank)
 	if (!s->aliases_enabled
 	    || base != s->aliased_bank_base[bank]
 	    || limit != s->aliased_bank_limit[bank]) {
-	    kvm_create_memory_alias(kvm_context,
-				    0xa0000 + bank * 0x8000,
-				    limit, base);
+	    kvm_qemu_create_memory_alias(0xa0000 + bank * 0x8000,
+                                     limit, base);
 	    s->aliased_bank_base[bank] = base;
 	    s->aliased_bank_limit[bank] = limit;
 	}
     } else {
-	kvm_destroy_memory_alias(kvm_context, 0xa0000 + bank * 0x8000);
+	kvm_qemu_destroy_memory_alias(0xa0000 + bank * 0x8000);
     }
 }
 
diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h
index fd9d5d1..330b2dc 100644
--- a/qemu/qemu-kvm.h
+++ b/qemu/qemu-kvm.h
@@ -107,6 +107,8 @@ extern kvm_context_t kvm_context;
 #define qemu_kvm_irqchip_in_kernel() (0)
 #define qemu_kvm_pit_in_kernel() (0)
 #define qemu_kvm_has_sync_mmu() (0)
+#define kvm_load_registers(env) do {} while(0)
+#define kvm_save_registers(env) do {} while(0)
 #endif
 
 void kvm_mutex_unlock(void);
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix compilation with --disable-kvm
  2008-10-02 14:21 [PATCH] fix compilation with --disable-kvm Glauber Costa
@ 2008-10-02 14:31 ` Avi Kivity
  2008-10-02 15:11   ` Glauber Costa
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2008-10-02 14:31 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm, aliguori

Glauber Costa wrote:
> Currently, kvm is failing to build with --disable-kvm.
> this patch fixes the issue.
>
>   

Replaced, thanks.

>  #define qemu_kvm_irqchip_in_kernel() (0)
>  #define qemu_kvm_pit_in_kernel() (0)
>  #define qemu_kvm_has_sync_mmu() (0)
> +#define kvm_load_registers(env) do {} while(0)
> +#define kvm_save_registers(env) do {} while(0)
>  #endif
>   

The alias functions want to be here too?

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix compilation with --disable-kvm
  2008-10-02 14:31 ` Avi Kivity
@ 2008-10-02 15:11   ` Glauber Costa
  0 siblings, 0 replies; 4+ messages in thread
From: Glauber Costa @ 2008-10-02 15:11 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Glauber Costa, kvm, aliguori

On Thu, Oct 2, 2008 at 11:31 AM, Avi Kivity <avi@redhat.com> wrote:
> Glauber Costa wrote:
>>
>> Currently, kvm is failing to build with --disable-kvm.
>> this patch fixes the issue.
>>
>>
>
> Replaced, thanks.
>
>>  #define qemu_kvm_irqchip_in_kernel() (0)
>>  #define qemu_kvm_pit_in_kernel() (0)
>>  #define qemu_kvm_has_sync_mmu() (0)
>> +#define kvm_load_registers(env) do {} while(0)
>> +#define kvm_save_registers(env) do {} while(0)
>>  #endif
>>
>
> The alias functions want to be here too?
maybe, but it should not require a kvm context anyway, when called
from qemu code.

>
> --
> error compiling committee.c: too many arguments to function
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-02 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-02 14:21 [PATCH] fix compilation with --disable-kvm Glauber Costa
2008-10-02 14:31 ` Avi Kivity
2008-10-02 15:11   ` Glauber Costa
  -- strict thread matches above, loose matches on Subject: below --
2008-09-30 21:47 [PATCH 0/2] --disable-kvm currently not working Glauber Costa
2008-09-30 21:47 ` [PATCH] fix compilation with --disable-kvm Glauber Costa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.