qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 24/32] check wether kqemu is enabled in open cod


From: Jan Kiszka
Subject: [Qemu-devel] Re: [PATCH 24/32] check wether kqemu is enabled in open code
Date: Thu, 23 Oct 2008 15:38:45 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

Glauber Costa wrote:
> kqemu 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.
> 
> Signed-off-by: Glauber Costa <address@hidden>
> ---
>  cpu-exec.c |    2 +-
>  kqemu.c    |   21 +++++++++++++++++++++
>  kqemu.h    |    3 +++
>  3 files changed, 25 insertions(+), 1 deletions(-)
> 
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 18908d5..b47cf43 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -599,7 +599,7 @@ int cpu_exec(CPUState *env1)
>                  {
>                      if (next_tb != 0 &&
>  #ifdef USE_KQEMU
> -                        (env->kqemu_enabled != 2) &&
> +                        (!kqemu_kernel_enabled(env)) &&
>  #endif

If this ifdef is still here to foster rethinking of the check - OK :).
Otherwise I would suggest to wrap kqemu_kernel_enabled for the
!USE_KQEMU case.

>                          tb->page_addr[1] == -1) {
>                      tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb 
> & 3, tb);
> diff --git a/kqemu.c b/kqemu.c
> index 16ebe7d..f99a4f1 100644
> --- a/kqemu.c
> +++ b/kqemu.c
> @@ -126,6 +126,27 @@ static int is_cpuid_supported(void)
>  }
>  #endif
>  
> +/* 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;
> +}
> +
>  static void kqemu_update_cpuid(CPUState *env)
>  {
>      int critical_features_mask, features, ext_features, ext_features_mask;
> diff --git a/kqemu.h b/kqemu.h
> index cf14179..62ba1d9 100644
> --- a/kqemu.h
> +++ b/kqemu.h
> @@ -157,6 +157,9 @@ struct kqemu_phys_mem {
>  #define KQEMU_SET_PHYS_MEM     _IOW('q', 5, struct kqemu_phys_mem)
>  #endif
>  
> +int kqemu_is_enabled(CPUState *env);
> +int kqemu_kernel_enabled(CPUState *env);
> +
>  typedef struct KQEMUCPUstate {
>      int kqemu_enabled;
>      int last_io_time;

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux




reply via email to

[Prev in Thread] Current Thread [Next in Thread]