--disable-kvm currently not working
cover --disable-kvm currently not working
Current compilations with --disable-kvm are broken. I'm spliting the fix in two patches for clearity. The first one does some code movement in qemu-kvm-x86.c, while the other just do fixes to the current code base.
PATCH 1/1 fix compilation with --disable-kvm
Currently, kvm is failing to build with --disable-kvm. this patch fixes the issue.
--- 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(-)
qemu/gdbstub.c +10 -5
@@ -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' :
qemu/hw/acpi.c +5 -1
@@ -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);
qemu/hw/cirrus_vga.c +3 -4
@@ -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 ); } }
qemu/monitor.c +4 -2
@@ -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);
Signature · 1 line
1.5.5.1
PATCH 1/1 provide a kvm_qemu_memory_alias() function
In reply to Glauber CostaFollowing 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.
--- libkvm/libkvm-x86.c | 5 ----- qemu/qemu-kvm-x86.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-)
libkvm/libkvm-x86.c +0 -5
@@ -206,11 +206,6 @@ int kvm_create_memory_alias(kvm_context_t kvm,return 0 ; } -int kvm_destroy_memory_alias (kvm_context_t kvm,uint64_t phys_start) -{ -return kvm_create_memory_alias (kvm, phys_start,0 ,0 ); -} -#ifdef KVM_CAP_IRQCHIP int kvm_get_lapic (kvm_context_t kvm,int vcpu,struct kvm_lapic_state *s)
qemu/qemu-kvm-x86.c +12 -0
@@ -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_create_memory_alias (kvm_context, phys_start,0 ,0 ); +} +int kvm_arch_qemu_create_context (void ) {int i;
Signature · 1 line
1.5.5.1
Re: [PATCH] provide a kvm_qemu_memory_alias() function
Quoted 9 lines · Glauber Costa
Following the pattern we already do, provide a
qemu_kvmwrapper 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.
libkvm/libkvm-x86.c int kvm_create_memory_alias(kvm_context_t kvm, · line 213
Quoted 5 lines
libkvm/libkvm-x86.c +0
-5-int kvm_destroy_memory_alias (kvm_context_t kvm,uint64_t phys_start) -{ -return kvm_create_memory_alias (kvm, phys_start,0 ,0 ); -} -
This exists so that readers don't have to wander why you're calling kvm_create_memory_alias when you actually want to destroy one.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
Re: [PATCH] provide a kvm_qemu_memory_alias() function
Quoted 9 lines · Avi Kivity
Quoted 8 lines · Glauber Costa
Following the pattern we already do, provide a
qemu_kvmwrapper 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.
Quoted 9 lines
libkvm/libkvm-x86.c int kvm_create_memory_alias(kvm_context_t kvm, · line 213
Quoted 6 lines
-int
kvm_destroy_memory_alias(kvm_context_t kvm, uint64_t phys_start)libkvm/libkvm-x86.c +0
-4-{ -return kvm_create_memory_alias (kvm, phys_start,0 ,0 ); -} -This exists so that readers don't have to wander why you're calling
kvm_create_memory_aliaswhen you actually want to destroy one.
So what? I'm replacing it with a kvm_qemu_destroy... that does the very same thing, in the very same way.
only difference is the presence/absence of context.
Quoted 10 lines
--
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Glauber Costa. "Free as in Freedom" http://glommer.net "The less confident you are, the more serious you have to act."
Re: [PATCH] provide a kvm_qemu_memory_alias() function
Quoted 22 lines · Glauber Costa
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Glauber Costa
Following the pattern we already do, provide a
qemu_kvmwrapper 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.Quoted 10 lines
libkvm/libkvm-x86.c int kvm_create_memory_alias(kvm_context_t kvm, · line 213
Quoted 7 lines
-int
kvm_destroy_memory_alias(kvm_context_t kvm, uint64_t phys_start)libkvm/libkvm-x86.c +0
-4-{ -return kvm_create_memory_alias (kvm, phys_start,0 ,0 ); -} -This exists so that readers don't have to wander why you're calling
kvm_create_memory_aliaswhen you actually want to destroy one.
Quoted 4 lines
So what? I'm replacing it with a
kvm_qemu_destroy... that does the very same thing, in the very same way.
only difference is the presence/absence of context.
libkvm exists to provide a sane API to applications. Using kvm_create_memory_alias() to destroy aliases is not a sane API.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 4 lines · Glauber Costa
Current compilations with --disable-kvm are broken. I'm spliting the fix in two patches for clearity. The first one does some code movement in
qemu-kvm-x86.c, while the other just do fixes to the current code base.
oh god, forgot to do format-patch -n _again_ ;-(
avi, should I resend? Since there are only two of them , it's pretty straightforward.
Quoted 7 lines
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Glauber Costa. "Free as in Freedom" http://glommer.net "The less confident you are, the more serious you have to act."