Patchwork [05/15] s390x: Enable s390x-softmmu target

login
register
mail settings
Submitter Alexander Graf
Date April 4, 2011, 2:32 p.m.
Message ID <1301927544-32767-6-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/89630/
State New
Headers show

Comments

Alexander Graf - April 4, 2011, 2:32 p.m.
This patch adds some code paths for running s390x guest OSs without the
need for KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 cpu-exec.c          |    8 ++++++++
 target-s390x/exec.h |   20 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
Aurelien Jarno - April 10, 2011, 8:34 p.m.
On Mon, Apr 04, 2011 at 04:32:14PM +0200, Alexander Graf wrote:
> This patch adds some code paths for running s390x guest OSs without the
> need for KVM.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  cpu-exec.c          |    8 ++++++++
>  target-s390x/exec.h |   20 ++++++++++++++++++++
>  2 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 5cc9379..ebc8cba 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -343,6 +343,8 @@ int cpu_exec(CPUState *env1)
>                      do_interrupt(env);
>  #elif defined(TARGET_M68K)
>                      do_interrupt(0);
> +#elif defined(TARGET_S390X)
> +                    do_interrupt(env);
>  #endif
>                      env->exception_index = -1;
>  #endif
> @@ -551,6 +553,12 @@ int cpu_exec(CPUState *env1)
>                          do_interrupt(1);
>                          next_tb = 0;
>                      }
> +#elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY)
> +                    if ((interrupt_request & CPU_INTERRUPT_HARD) &&
> +                        (env->psw.mask & PSW_MASK_EXT)) {
> +                        do_interrupt(env);
> +                        next_tb = 0;
> +                    }
>  #endif

This should be somehow consistent with cpu_has_work() (from exec.h)
which currently has "// guess". The current versions of cpu_has_work()
ignore env->psw.mask so wake-up the CPU even if the external interrupt
are masked. Does it matches the real hardware?

>                     /* Don't use the cached interupt_request value,
>                        do_interrupt may have updated the EXITTB flag. */
> diff --git a/target-s390x/exec.h b/target-s390x/exec.h
> index f7893f3..6fe64a6 100644
> --- a/target-s390x/exec.h
> +++ b/target-s390x/exec.h
> @@ -34,6 +34,26 @@ static inline int cpu_has_work(CPUState *env)
>      return env->interrupt_request & CPU_INTERRUPT_HARD; // guess
>  }
>  
> +static inline void regs_to_env(void)
> +{
> +}
> +
> +static inline void env_to_regs(void)
> +{
> +}
> +
> +static inline int cpu_halted(CPUState *env)
> +{
> +    if (!env->halted) {
> +       return 0;
> +    }
> +    if (cpu_has_work(env)) {
> +        env->halted = 0;
> +        return 0;
> +    }
> +    return EXCP_HALTED;
> +}
> +

This has been removed in eda48c344f35e5bd511dea3e8be56fb08c19b399 .
There is no need to reintroduce it.

>  static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock* tb)
>  {
>      env->psw.addr = tb->pc;
> -- 
> 1.6.0.2
> 
> 
>

Patch

diff --git a/cpu-exec.c b/cpu-exec.c
index 5cc9379..ebc8cba 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -343,6 +343,8 @@  int cpu_exec(CPUState *env1)
                     do_interrupt(env);
 #elif defined(TARGET_M68K)
                     do_interrupt(0);
+#elif defined(TARGET_S390X)
+                    do_interrupt(env);
 #endif
                     env->exception_index = -1;
 #endif
@@ -551,6 +553,12 @@  int cpu_exec(CPUState *env1)
                         do_interrupt(1);
                         next_tb = 0;
                     }
+#elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY)
+                    if ((interrupt_request & CPU_INTERRUPT_HARD) &&
+                        (env->psw.mask & PSW_MASK_EXT)) {
+                        do_interrupt(env);
+                        next_tb = 0;
+                    }
 #endif
                    /* Don't use the cached interupt_request value,
                       do_interrupt may have updated the EXITTB flag. */
diff --git a/target-s390x/exec.h b/target-s390x/exec.h
index f7893f3..6fe64a6 100644
--- a/target-s390x/exec.h
+++ b/target-s390x/exec.h
@@ -34,6 +34,26 @@  static inline int cpu_has_work(CPUState *env)
     return env->interrupt_request & CPU_INTERRUPT_HARD; // guess
 }
 
+static inline void regs_to_env(void)
+{
+}
+
+static inline void env_to_regs(void)
+{
+}
+
+static inline int cpu_halted(CPUState *env)
+{
+    if (!env->halted) {
+       return 0;
+    }
+    if (cpu_has_work(env)) {
+        env->halted = 0;
+        return 0;
+    }
+    return EXCP_HALTED;
+}
+
 static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock* tb)
 {
     env->psw.addr = tb->pc;