kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM failing to compile with --disable-kvm
@ 2008-10-02 12:49 Glauber Costa
  2008-10-02 12:49 ` [PATCH 1/2] provide a kvm_qemu_memory_alias() function Glauber Costa
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Glauber Costa @ 2008-10-02 12:49 UTC (permalink / raw)
  To: kvm; +Cc: avi, aliguori

Father Avi,

is it better now?



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

* [PATCH 1/2] provide a kvm_qemu_memory_alias() function
  2008-10-02 12:49 [PATCH 0/2] KVM failing to compile with --disable-kvm Glauber Costa
@ 2008-10-02 12:49 ` Glauber Costa
  2008-10-02 12:49 ` [PATCH 2/2] fix compilation with --disable-kvm Glauber Costa
  2008-10-02 13:40 ` [PATCH 0/2] KVM failing to compile " Avi Kivity
  2 siblings, 0 replies; 7+ messages in thread
From: Glauber Costa @ 2008-10-02 12:49 UTC (permalink / raw)
  To: kvm; +Cc: avi, aliguori

Following the pattern we already do, provide a qemu_kvm wrapper to
the memory aliases x86 functions. Reason is that we don't want to have
references to the context spread over qemu.

The destroy alias function is completely removed from libkvm/libkvm.c,
since no one in the code base uses it directly.

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 qemu/qemu-kvm-x86.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 5daedd1..9390a40 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -27,6 +27,18 @@ static int kvm_has_msr_star;
 
 static int lm_capable_kernel;
 
+int kvm_qemu_create_memory_alias(uint64_t phys_start,
+                                 uint64_t len,
+                                 uint64_t target_phys)
+{
+    return kvm_create_memory_alias(kvm_context, phys_start, len, target_phys);
+}
+
+int kvm_qemu_destroy_memory_alias(uint64_t phys_start)
+{
+	return kvm_destroy_memory_alias(kvm_context, phys_start);
+}
+
 int kvm_arch_qemu_create_context(void)
 {
     int i;
-- 
1.5.5.1


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

* [PATCH 2/2] fix compilation with --disable-kvm
  2008-10-02 12:49 [PATCH 0/2] KVM failing to compile with --disable-kvm Glauber Costa
  2008-10-02 12:49 ` [PATCH 1/2] provide a kvm_qemu_memory_alias() function Glauber Costa
@ 2008-10-02 12:49 ` Glauber Costa
  2008-10-02 13:43   ` Avi Kivity
  2008-10-02 13:40 ` [PATCH 0/2] KVM failing to compile " Avi Kivity
  2 siblings, 1 reply; 7+ messages in thread
From: Glauber Costa @ 2008-10-02 12:49 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] 7+ messages in thread

* Re: [PATCH 0/2] KVM failing to compile with --disable-kvm
  2008-10-02 12:49 [PATCH 0/2] KVM failing to compile with --disable-kvm Glauber Costa
  2008-10-02 12:49 ` [PATCH 1/2] provide a kvm_qemu_memory_alias() function Glauber Costa
  2008-10-02 12:49 ` [PATCH 2/2] fix compilation with --disable-kvm Glauber Costa
@ 2008-10-02 13:40 ` Avi Kivity
  2 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2008-10-02 13:40 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm, aliguori

Glauber Costa wrote:
> Father Avi,
>
> is it better now?
>
>   

Yes, applied. thanks.

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


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

* Re: [PATCH 2/2] fix compilation with --disable-kvm
  2008-10-02 12:49 ` [PATCH 2/2] fix compilation with --disable-kvm Glauber Costa
@ 2008-10-02 13:43   ` Avi Kivity
  2008-10-02 13:46     ` Glauber Costa
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2008-10-02 13:43 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm, aliguori

Glauber Costa wrote:
>  
> -    kvm_save_registers(mon_cpu);
> +    if (kvm_enabled())
> +        kvm_save_registers(mon_cpu);
>  
>   

If I'm not mistaken, this relies on the optimizer to remove the call to 
kvm_save_registers().  Compilation with -O0 will break.

I think a better solution is to have kvm_save_registers() contain the 
kvm_enabled() check, and also be defined to an empty function if kvm is 
disabled at compile time.

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


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

* Re: [PATCH 2/2] fix compilation with --disable-kvm
  2008-10-02 13:43   ` Avi Kivity
@ 2008-10-02 13:46     ` Glauber Costa
  2008-10-02 13:55       ` Avi Kivity
  0 siblings, 1 reply; 7+ messages in thread
From: Glauber Costa @ 2008-10-02 13:46 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, aliguori

On Thu, Oct 02, 2008 at 04:43:06PM +0300, Avi Kivity wrote:
> Glauber Costa wrote:
>>  -    kvm_save_registers(mon_cpu);
>> +    if (kvm_enabled())
>> +        kvm_save_registers(mon_cpu);
>>    
>
> If I'm not mistaken, this relies on the optimizer to remove the call to  
> kvm_save_registers().  Compilation with -O0 will break.
>
> I think a better solution is to have kvm_save_registers() contain the  
> kvm_enabled() check, and also be defined to an empty function if kvm is  
> disabled at compile time.
ok master. Will redo.
>
> -- 
> error compiling committee.c: too many arguments to function
>

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

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

Glauber Costa wrote:
> On Thu, Oct 02, 2008 at 04:43:06PM +0300, Avi Kivity wrote:
>   
>> Glauber Costa wrote:
>>     
>>>  -    kvm_save_registers(mon_cpu);
>>> +    if (kvm_enabled())
>>> +        kvm_save_registers(mon_cpu);
>>>    
>>>       
>> If I'm not mistaken, this relies on the optimizer to remove the call to  
>> kvm_save_registers().  Compilation with -O0 will break.
>>
>> I think a better solution is to have kvm_save_registers() contain the  
>> kvm_enabled() check, and also be defined to an empty function if kvm is  
>> disabled at compile time.
>>     
> ok master. Will redo.
>   

I applied it already (since it fixes an issue), so base it on 
kvm-userspace.git (once I push).

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


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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-02 12:49 [PATCH 0/2] KVM failing to compile with --disable-kvm Glauber Costa
2008-10-02 12:49 ` [PATCH 1/2] provide a kvm_qemu_memory_alias() function Glauber Costa
2008-10-02 12:49 ` [PATCH 2/2] fix compilation with --disable-kvm Glauber Costa
2008-10-02 13:43   ` Avi Kivity
2008-10-02 13:46     ` Glauber Costa
2008-10-02 13:55       ` Avi Kivity
2008-10-02 13:40 ` [PATCH 0/2] KVM failing to compile " Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).