Update qemu accel
cover Update qemu accel
Hi guys,
I have the following patches that I'm about to commit to the QemuAccel tree, in case you have no further comments.
Most of them are small fixes. I particularly don't like one of them:
* check wether kqemu is enabled in open code
this patch should not exist, but I think this is the simplest solution right now.
I'm reverting the patch that moves ram allocation to before accel start, since it broke qemu. This is theorectically needed for kvm, but I think we can rid of this need in KVM. We're working on it.
The only new thing in here is the inclusion of a accel_opaque into the CPUState field. both kqemu and kvm (and possibly others too) have code that fits well inside the CPUState, and it makes sense to have an opaque to account for them.
Comments welcome.
======================================================
Glauber Costa (7):
protect accel.h from multiple inclusion use accel_trace_io in calling sites. use break_loop accel
give noaccel a name
check wether kqemu is enabled in open code provide an opaque for accelerator in cpu state Revert "don't allocate ram before accel starts"
accel.c | 2 +- accel.h | 7 ++++++- cpu-defs.h | 1 + cpu-exec.c | 11 +++-------- exec-all.h | 10 ++++++++-- kqemu.c | 36 +++++++++++++++++++++++++++++++----- kqemu.h | 6 ++++++ softmmu_template.h | 10 ++++------ target-i386/cpu.h | 5 ----- target-i386/op_helper.c | 2 +- vl.c | 11 ++++++----- 11 files changed, 67 insertions(+), 34 deletions(-)
accel.c +1 -1
@@ -21,7 +21,7 @@ CPUState *noaccel_get_env(void)/* Accelerator wrapper for the no-accel (raw qemu) case */ QEMUAccel noaccel = { - .name =NULL , + .name ="noaccel" , .cpu_interrupt = accel_nop, .init_env = accel_nop, .get_env = noaccel_get_env,
accel.h +6 -1
@@ -1,3 +1,6 @@ +#ifndef _ACCEL_H_ +#define _ACCEL_H_ + typedef struct QEMUAccel { char *name; void (*cpu_interrupt)(CPUState *env);
@@ -35,6 +38,8 @@ extern int _accel_nop(void);extern int noaccel_info (CPUState *env,char *buf);extern CPUState *noaccel_get_env (void ); +#define accel_opaque_field (env, type, field) ((type *)env->accel_opaque)->field +#ifdef USE_KQEMU extern QEMUAccel kqemu_accel;#endif
@@ -144,4 +149,4 @@ static inline int accel_break_loop(CPUState *env) }extern void accel_add (const char *name); - +#endif
cpu-defs.h +1 -0
@@ -197,6 +197,7 @@ typedef struct icount_decr_u16 {int thread_id; \/* user data */ \void *opaque; \ +void *accel_opaque; \ \const char *cpu_model_str;
cpu-exec.c +3 -8
@@ -36,6 +36,7 @@#include <signal.h> #include <sys/ucontext.h> #endif +#include "accel.h" #if defined(__sparc__) && !defined(HOST_SOLARIS )// Work around ugly bugs in glibc that mangle global register contents
@@ -605,7 +606,7 @@ int cpu_exec(CPUState *env1) {if (next_tb !=0 && #ifdef USE_KQEMU - (env->kqemu_enabled !=2 ) && + (!kqemu_kernel_enabled (env)) && #endif tb->page_addr[1 ] ==-1 ) {tb_add_jump ((TranslationBlock *)(next_tb & ~3 ), next_tb &3 , tb);
@@ -653,13 +654,7 @@ int cpu_exec(CPUState *env1) }/* reset soft MMU for next block (it can currently only be set by a memory fault) */ -#if defined(USE_KQEMU ) -#define MIN_CYCLE_BEFORE_SWITCH (100 * 1000) -if (kqemu_is_ok (env) && - (cpu_get_time_fast () - env->last_io_time) >=MIN_CYCLE_BEFORE_SWITCH ) { -cpu_loop_exit (); - } -#endif +accel_break_loop (env); }/* for(;;) */ }else {env_to_regs ();
exec-all.h +8 -2
@@ -370,16 +370,22 @@ void kqemu_set_phys_mem(uint64_t start_addr, ram_addr_t size,void kqemu_cpu_interrupt (CPUState *env);void kqemu_record_dump (void ); +int kqemu_is_enabled (CPUState *env); +int kqemu_kernel_enabled (CPUState *env); +extern uint32_t kqemu_comm_base; +#include "accel.h" +#include <kqemu.h> +static inline int kqemu_is_ok (CPUState *env) { -return (env->kqemu_enabled && +return (kqemu_is_enabled (env) && (env->cr[0 ] &CR0_PE_MASK ) && !(env->hflags &HF_INHIBIT_IRQ_MASK ) && (env->eflags &IF_MASK ) && !(env->eflags &VM_MASK ) && - (env->kqemu_enabled ==2 || + (kqemu_kernel_enabled (env) || ((env->hflags &HF_CPL_MASK ) ==3 && (env->eflags &IOPL_MASK ) !=IOPL_MASK ))); }
kqemu.c +31 -5
@@ -62,6 +62,8 @@#define KQEMU_DEVICE "/dev/kqemu"#endif +struct kqemu_cpu_opaque kqemu_opaque; +static void qpi_init (void );#ifdef _WIN32
@@ -247,7 +249,31 @@ int kqemu_start(void)void kqemu_init_env (CPUState *env) {kqemu_update_cpuid (env); - env->kqemu_enabled = kqemu_allowed; +/* SMP currently not supported, so this is okay */ + kqemu_opaque.kqemu_enabled = kqemu_allowed; + env->accel_opaque = &kqemu_opaque; +} + +/* FIXME: Should not be needed, since ideally, QEMUAccel would avoid all kqemu tests +* altogether +*/ +int kqemu_is_enabled (CPUState *env) +{ +if (strcasecmp (current_accel->name,"kqemu" )) { +return 0 ; + } + +return kqemu_opaque_field (env, kqemu_enabled); + +} + +int kqemu_kernel_enabled (CPUState *env) +{ +if (strcasecmp (current_accel->name,"kqemu" )) { +return 0 ; + } + +return kqemu_opaque_field (env, kqemu_enabled) ==2 ; }void kqemu_flush_page (CPUState *env,target_ulong addr)
@@ -277,7 +303,7 @@ int kqemu_info(CPUState *env, char *buf) {int val, len; val =0 ; - val = env->kqemu_enabled; + val =kqemu_opaque_field (env, kqemu_enabled); len =sprintf (buf,"kqemu support: " ); buf += len;
@@ -436,14 +462,14 @@ void kqemu_set_phys_mem(uint64_t start_addr, ram_addr_t size,void kqemu_trace_io (CPUState *env) {if (env) - env->last_io_time =cpu_get_time_fast (); +kqemu_opaque_field (env, last_io_time) =cpu_get_time_fast (); }int kqemu_break_loop (CPUState *env) {#define MIN_CYCLE_BEFORE_SWITCH (100 * 1000)if (kqemu_is_ok (env) && - (cpu_get_time_fast () - env->last_io_time) >=MIN_CYCLE_BEFORE_SWITCH ) { + (cpu_get_time_fast () -kqemu_opaque_field (env, last_io_time)) >=MIN_CYCLE_BEFORE_SWITCH ) {return 1 ; }return 0 ;
@@ -854,7 +880,7 @@ int kqemu_cpu_exec(CPUState *env) cpl = (env->hflags &HF_CPL_MASK ); kenv->cpl = cpl; kenv->nb_pages_to_flush = nb_pages_to_flush; - kenv->user_only = (env->kqemu_enabled ==1 ); + kenv->user_only = (kqemu_opaque_field (env, kqemu_enabled) ==1 ); kenv->nb_ram_pages_to_update = nb_ram_pages_to_update; nb_ram_pages_to_update =0 ; kenv->nb_modified_ram_pages = nb_modified_ram_pages;
kqemu.h +6 -0
@@ -38,6 +38,12 @@ extern int64_t kqemu_ret_int_count;extern int64_t kqemu_ret_excp_count;extern int64_t kqemu_ret_intr_count; +struct kqemu_cpu_opaque { +int kqemu_enabled; +int last_io_time; +}; +#define kqemu_opaque_field (env, field) accel_opaque_field(env, struct kqemu_cpu_opaque, field) +struct kqemu_segment_cache {uint16_t selector;uint16_t padding1;
softmmu_template.h +4 -6
@@ -47,6 +47,8 @@#define ADDR_READ addr_read#endif +#include "accel.h" +static DATA_TYPE glue (glue (slow_ld ,SUFFIX ),MMUSUFFIX )(target_ulong addr,int mmu_idx,void *retaddr);
@@ -75,9 +77,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, res |= (uint64_t )io_mem_read[index][2 ](io_mem_opaque[index], physaddr +4 ) <<32 ;#endif #endif /* SHIFT > 2 */ -#ifdef USE_KQEMU - env->last_io_time =cpu_get_time_fast (); -#endif +accel_trace_io (env);return res; }
@@ -220,9 +220,7 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, io_mem_write[index][2 ](io_mem_opaque[index], physaddr +4 , val >>32 );#endif #endif /* SHIFT > 2 */ -#ifdef USE_KQEMU - env->last_io_time =cpu_get_time_fast (); -#endif +accel_trace_io (env); } void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
target-i386/cpu.h +0 -5
@@ -590,11 +590,6 @@ typedef struct CPUX86State {uint32_t cpuid_ext3_features;uint32_t cpuid_apic_id; -#ifdef USE_KQEMU -int kqemu_enabled; -int last_io_time; -#endif -/* in order to simplify APIC support, we leave this pointer to the user */ struct APICState *apic_state;
target-i386/op_helper.c +1 -1
@@ -3168,7 +3168,7 @@ void helper_rdmsr(void)#endif #ifdef USE_KQEMU case MSR_QPI_COMMBASE : -if (env->kqemu_enabled) { +if (kqemu_opaque_field (env, kqemu_enabled)) { val = kqemu_comm_base; }else { val =0 ;
vl.c +6 -5
@@ -9050,6 +9050,12 @@ int main(int argc, char **argv) phys_ram_size += ram_size; } + phys_ram_base =qemu_vmalloc (phys_ram_size); +if (!phys_ram_base) { +fprintf (stderr,"Could not allocate physical memory\n" ); +exit (1 ); + } +/* init the dynamic translator */ cpu_exec_init_all (tb_size *1024 *1024 );
@@ -9058,11 +9064,6 @@ int main(int argc, char **argv)exit (1 ); } - phys_ram_base =qemu_vmalloc (phys_ram_size); -if (!phys_ram_base) { -fprintf (stderr,"Could not allocate physical memory\n" ); -exit (1 ); - }bdrv_init ();
PATCH 1/7 protect accel.h from multiple inclusion
Allow it to be included multiple times.
--- accel.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
accel.h +4 -1
@@ -1,3 +1,6 @@ +#ifndef _ACCEL_H_ +#define _ACCEL_H_ + typedef struct QEMUAccel { char *name; void (*cpu_interrupt)(CPUState *env);
@@ -144,4 +147,4 @@ static inline int accel_break_loop(CPUState *env) }extern void accel_add (const char *name); - +#endif
Signature · 1 line
1.5.5.1
PATCH 2/7 use accel_trace_io in calling sites.
In reply to Glauber Costasoftmmu_template.h does an explicit reference to kqemu to perform an operation for which an accel is available. Use it.
--- softmmu_template.h | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
softmmu_template.h +4 -6
@@ -47,6 +47,8 @@#define ADDR_READ addr_read#endif +#include "accel.h" +static DATA_TYPE glue (glue (slow_ld ,SUFFIX ),MMUSUFFIX )(target_ulong addr,int mmu_idx,void *retaddr);
@@ -75,9 +77,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, res |= (uint64_t )io_mem_read[index][2 ](io_mem_opaque[index], physaddr +4 ) <<32 ;#endif #endif /* SHIFT > 2 */ -#ifdef USE_KQEMU - env->last_io_time =cpu_get_time_fast (); -#endif +accel_trace_io (env);return res; }
@@ -220,9 +220,7 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, io_mem_write[index][2 ](io_mem_opaque[index], physaddr +4 , val >>32 );#endif #endif /* SHIFT > 2 */ -#ifdef USE_KQEMU - env->last_io_time =cpu_get_time_fast (); -#endif +accel_trace_io (env); } void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
Signature · 1 line
1.5.5.1
PATCH 3/7 use break_loop accel
In reply to Glauber Costain cpu_exec.c, use the already available accelerator to get rid of kqemu reference.
--- cpu-exec.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
cpu-exec.c +2 -7
@@ -36,6 +36,7 @@#include <signal.h> #include <sys/ucontext.h> #endif +#include "accel.h" #if defined(__sparc__) && !defined(HOST_SOLARIS )// Work around ugly bugs in glibc that mangle global register contents
@@ -653,13 +654,7 @@ int cpu_exec(CPUState *env1) }/* reset soft MMU for next block (it can currently only be set by a memory fault) */ -#if defined(USE_KQEMU ) -#define MIN_CYCLE_BEFORE_SWITCH (100 * 1000) -if (kqemu_is_ok (env) && - (cpu_get_time_fast () - env->last_io_time) >=MIN_CYCLE_BEFORE_SWITCH ) { -cpu_loop_exit (); - } -#endif +accel_break_loop (env); }/* for(;;) */ }else {env_to_regs ();
Signature · 1 line
1.5.5.1
PATCH 4/7 give noaccel a name
In reply to Glauber Costaotherwise, string comparisons to check for the current accelerator may break.
--- accel.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
accel.c +1 -1
@@ -21,7 +21,7 @@ CPUState *noaccel_get_env(void)/* Accelerator wrapper for the no-accel (raw qemu) case */ QEMUAccel noaccel = { - .name =NULL , + .name ="noaccel" , .cpu_interrupt = accel_nop, .init_env = accel_nop, .get_env = noaccel_get_env,
Signature · 1 line
1.5.5.1
[Qemu-devel] Re: [PATCH 4/7] give noaccel a name
Quoted 14 lines · Glauber Costa
otherwise, string comparisons to check for the current accelerator may break.
Signed-off-by Glauber Costa <[email protected]>--- accel.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)accel.c +0
-0
accel.c CPUState *noaccel_get_env(void) · line 27
Quoted 8 lines
accel.c +1
-1@@ -21,7 +21,7 @@ CPUState *noaccel_get_env(void)/* Accelerator wrapper for the no-accel (raw qemu) case */ QEMUAccel noaccel = { - .name =NULL , + .name ="noaccel" , .cpu_interrupt = accel_nop, .init_env = accel_nop, .get_env = noaccel_get_env,
Maybe "none" or "tcg" or "emulation"?
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
[Qemu-devel] Re: [PATCH 4/7] give noaccel a name
Quoted 15 lines · Avi Kivity
Quoted 14 lines · Glauber Costa
otherwise, string comparisons to check for the current accelerator may break.
Signed-off-by Glauber Costa <[email protected]>--- accel.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)accel.c +0
-0@@ -21,7 +21,7 @@ CPUState *noaccel_get_env(void)
Quoted 10 lines
accel.c CPUState *noaccel_get_env(void) · line 27
Quoted 8 lines
accel.c +1
-1/* Accelerator wrapper for the no-accel (raw qemu) case */ QEMUAccel noaccel = { - .name =NULL , + .name ="noaccel" , .cpu_interrupt = accel_nop, .init_env = accel_nop, .get_env = noaccel_get_env,Maybe "none" or "tcg" or "emulation"?
I think none is okay.
Quoted 4 lines
Signature · 2 lines
-- Do not meddle in the internals of kernels, for they are subtle and quick to panic.
PATCH 5/7 check wether kqemu is enabled in open code
In reply to Glauber Costakqemu is still too much spread around. The proper fix usually involves rethinking a bit of kqemu logic so for now, just check whether or not kqemu is enabled. If the kqemu accelerator is not present, consider it not. Otherwise, check env field.
--- cpu-exec.c | 2 +- exec-all.h | 7 +++++-- kqemu.c | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-)
cpu-exec.c +1 -1
@@ -606,7 +606,7 @@ int cpu_exec(CPUState *env1) {if (next_tb !=0 && #ifdef USE_KQEMU - (env->kqemu_enabled !=2 ) && + (!kqemu_kernel_enabled (env)) && #endif tb->page_addr[1 ] ==-1 ) {tb_add_jump ((TranslationBlock *)(next_tb & ~3 ), next_tb &3 , tb);
exec-all.h +5 -2
@@ -370,16 +370,19 @@ void kqemu_set_phys_mem(uint64_t start_addr, ram_addr_t size,void kqemu_cpu_interrupt (CPUState *env);void kqemu_record_dump (void ); +int kqemu_is_enabled (CPUState *env); +int kqemu_kernel_enabled (CPUState *env); +extern uint32_t kqemu_comm_base;static inline int kqemu_is_ok (CPUState *env) { -return (env->kqemu_enabled && +return (kqemu_is_enabled (env) && (env->cr[0 ] &CR0_PE_MASK ) && !(env->hflags &HF_INHIBIT_IRQ_MASK ) && (env->eflags &IF_MASK ) && !(env->eflags &VM_MASK ) && - (env->kqemu_enabled ==2 || + (kqemu_kernel_enabled (env) || ((env->hflags &HF_CPL_MASK ) ==3 && (env->eflags &IOPL_MASK ) !=IOPL_MASK ))); }
kqemu.c +21 -0
@@ -250,6 +250,27 @@ void kqemu_init_env(CPUState *env) env->kqemu_enabled = kqemu_allowed; } +/* FIXME: Should not be needed, since ideally, QEMUAccel would avoid all kqemu tests +* altogether +*/ +int kqemu_is_enabled (CPUState *env) +{ +if (strcasecmp (current_accel->name,"kqemu" )) { +return 0 ; + } + +return env->kqemu_enabled; + +} + +int kqemu_kernel_enabled (CPUState *env) +{ +if (strcasecmp (current_accel->name,"kqemu" )) { +return 0 ; + } +return env->kqemu_enabled ==2 ; +} +void kqemu_flush_page (CPUState *env,target_ulong addr) {#if defined(DEBUG )
Signature · 1 line
1.5.5.1
PATCH 6/7 provide an opaque for accelerator in cpu state
In reply to Glauber CostaConvert kqemu to use it. We also provide a small macro to easy the access to the accelerator fields.
--- accel.h | 2 ++ cpu-defs.h | 1 + exec-all.h | 3 +++ kqemu.c | 19 ++++++++++++------- kqemu.h | 6 ++++++ target-i386/cpu.h | 5 ----- target-i386/op_helper.c | 2 +- 7 files changed, 25 insertions(+), 13 deletions(-)
accel.h +2 -0
@@ -38,6 +38,8 @@ extern int _accel_nop(void);extern int noaccel_info (CPUState *env,char *buf);extern CPUState *noaccel_get_env (void ); +#define accel_opaque_field (env, type, field) ((type *)env->accel_opaque)->field +#ifdef USE_KQEMU extern QEMUAccel kqemu_accel;#endif
cpu-defs.h +1 -0
@@ -197,6 +197,7 @@ typedef struct icount_decr_u16 {int thread_id; \/* user data */ \void *opaque; \ +void *accel_opaque; \ \const char *cpu_model_str;
exec-all.h +3 -0
@@ -375,6 +375,9 @@ int kqemu_kernel_enabled(CPUState *env);extern uint32_t kqemu_comm_base; +#include "accel.h" +#include <kqemu.h> +static inline int kqemu_is_ok (CPUState *env) { return(kqemu_is_enabled(env) &&
kqemu.c +12 -7
@@ -62,6 +62,8 @@#define KQEMU_DEVICE "/dev/kqemu"#endif +struct kqemu_cpu_opaque kqemu_opaque; +static void qpi_init (void );#ifdef _WIN32
@@ -247,7 +249,9 @@ int kqemu_start(void)void kqemu_init_env (CPUState *env) {kqemu_update_cpuid (env); - env->kqemu_enabled = kqemu_allowed; +/* SMP currently not supported, so this is okay */ + kqemu_opaque.kqemu_enabled = kqemu_allowed; + env->accel_opaque = &kqemu_opaque; }/* FIXME: Should not be needed, since ideally, QEMUAccel would avoid all kqemu tests
@@ -259,7 +263,7 @@ int kqemu_is_enabled(CPUState *env)return 0 ; } -return env->kqemu_enabled; +return kqemu_opaque_field (env, kqemu_enabled); }
@@ -268,7 +272,8 @@ int kqemu_kernel_enabled(CPUState *env)if (strcasecmp (current_accel->name,"kqemu" )) {return 0 ; } -return env->kqemu_enabled ==2 ; + +return kqemu_opaque_field (env, kqemu_enabled) ==2 ; }void kqemu_flush_page (CPUState *env,target_ulong addr)
@@ -298,7 +303,7 @@ int kqemu_info(CPUState *env, char *buf) {int val, len; val =0 ; - val = env->kqemu_enabled; + val =kqemu_opaque_field (env, kqemu_enabled); len =sprintf (buf,"kqemu support: " ); buf += len;
@@ -457,14 +462,14 @@ void kqemu_set_phys_mem(uint64_t start_addr, ram_addr_t size,void kqemu_trace_io (CPUState *env) {if (env) - env->last_io_time =cpu_get_time_fast (); +kqemu_opaque_field (env, last_io_time) =cpu_get_time_fast (); }int kqemu_break_loop (CPUState *env) {#define MIN_CYCLE_BEFORE_SWITCH (100 * 1000)if (kqemu_is_ok (env) && - (cpu_get_time_fast () - env->last_io_time) >=MIN_CYCLE_BEFORE_SWITCH ) { + (cpu_get_time_fast () -kqemu_opaque_field (env, last_io_time)) >=MIN_CYCLE_BEFORE_SWITCH ) {return 1 ; }return 0 ;
@@ -875,7 +880,7 @@ int kqemu_cpu_exec(CPUState *env) cpl = (env->hflags &HF_CPL_MASK ); kenv->cpl = cpl; kenv->nb_pages_to_flush = nb_pages_to_flush; - kenv->user_only = (env->kqemu_enabled ==1 ); + kenv->user_only = (kqemu_opaque_field (env, kqemu_enabled) ==1 ); kenv->nb_ram_pages_to_update = nb_ram_pages_to_update; nb_ram_pages_to_update =0 ; kenv->nb_modified_ram_pages = nb_modified_ram_pages;
kqemu.h +6 -0
@@ -38,6 +38,12 @@ extern int64_t kqemu_ret_int_count;extern int64_t kqemu_ret_excp_count;extern int64_t kqemu_ret_intr_count; +struct kqemu_cpu_opaque { +int kqemu_enabled; +int last_io_time; +}; +#define kqemu_opaque_field (env, field) accel_opaque_field(env, struct kqemu_cpu_opaque, field) +struct kqemu_segment_cache {uint16_t selector;uint16_t padding1;
target-i386/cpu.h +0 -5
@@ -590,11 +590,6 @@ typedef struct CPUX86State {uint32_t cpuid_ext3_features;uint32_t cpuid_apic_id; -#ifdef USE_KQEMU -int kqemu_enabled; -int last_io_time; -#endif -/* in order to simplify APIC support, we leave this pointer to the user */ struct APICState *apic_state;
target-i386/op_helper.c +1 -1
@@ -3168,7 +3168,7 @@ void helper_rdmsr(void)#endif #ifdef USE_KQEMU case MSR_QPI_COMMBASE : -if (env->kqemu_enabled) { +if (kqemu_opaque_field (env, kqemu_enabled)) { val = kqemu_comm_base; }else { val =0 ;
Signature · 1 line
1.5.5.1
PATCH 7/7 Revert "don't allocate ram before accel starts"
In reply to Glauber CostaThis reverts commit 369b6634b36d267480a064ab038948f5b44e8c9f.
--- vl.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)
vl.c +6 -5
@@ -9050,6 +9050,12 @@ int main(int argc, char **argv) phys_ram_size += ram_size; } + phys_ram_base =qemu_vmalloc (phys_ram_size); +if (!phys_ram_base) { +fprintf (stderr,"Could not allocate physical memory\n" ); +exit (1 ); + } +/* init the dynamic translator */ cpu_exec_init_all (tb_size *1024 *1024 );
@@ -9058,11 +9064,6 @@ int main(int argc, char **argv)exit (1 ); } - phys_ram_base =qemu_vmalloc (phys_ram_size); -if (!phys_ram_base) { -fprintf (stderr,"Could not allocate physical memory\n" ); -exit (1 ); - }bdrv_init ();
Signature · 1 line
1.5.5.1
Quoted 14 lines · Glauber Costa
Hi guys,
I have the following patches that I'm about to commit to the QemuAccel tree, in case you have no further comments.
Most of them are small fixes. I particularly don't like one of them:
* check wether kqemu is enabled in open codethis patch should not exist, but I think this is the simplest solution right now.
I'm reverting the patch that moves ram allocation to before accel start, since it broke qemu. This is theorectically needed for kvm, but I think we can rid of this need in KVM. We're working on it.
Quoted 6 lines
The only new thing in here is the inclusion of a
accel_opaqueinto the CPUState field. both kqemu and kvm (and possibly others too) have code that fits well inside the CPUState, and it makes sense to have an opaque to account for them.Comments welcome.
Can you post the whole accel series to qemu-devel? I've looked through recent trees and I don't see anything that prevents it from being merged.
Regards,
Anthony Liguori