qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel qemu-devel <qemu-devel@nongnu.org>
Cc: Caraman Mihai Claudiu-B02008 <B02008@freescale.com>,
	qemu-ppc Mailing List <qemu-ppc@nongnu.org>
Subject: [Qemu-devel] [PATCH 7/8] PPC: Turn hardcoded reset mask into env variable
Date: Wed, 20 Jun 2012 22:11:50 +0200	[thread overview]
Message-ID: <1340223111-13449-8-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1340223111-13449-1-git-send-email-agraf@suse.de>

Some machines have MSR bits they reset with as enabled. Don't hardcode the
logic, but let the individual core implementations save their own reset
mask into an env variable.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/cpu.h            |    1 +
 target-ppc/translate_init.c |   14 ++++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 652a35a..acf5816 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1043,6 +1043,7 @@ struct CPUPPCState {
 #if defined(TARGET_PPC64)
     struct ppc_segment_page_sizes sps;
 #endif
+    uint64_t reset_msr;
 
 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
     target_phys_addr_t vpa;
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 57027a2..efa05fc 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -6273,6 +6273,7 @@ static void init_proc_970 (CPUPPCState *env)
     env->slb_nr = 32;
 #endif
     init_excp_970(env);
+    env->reset_msr = (1ULL < MSR_SF);
     env->dcache_line_size = 128;
     env->icache_line_size = 128;
     /* Allocate hardware IRQ controller */
@@ -6375,6 +6376,7 @@ static void init_proc_970FX (CPUPPCState *env)
     env->slb_nr = 64;
 #endif
     init_excp_970(env);
+    env->reset_msr = (1ULL < MSR_SF);
     env->dcache_line_size = 128;
     env->icache_line_size = 128;
     /* Allocate hardware IRQ controller */
@@ -6465,6 +6467,7 @@ static void init_proc_970GX (CPUPPCState *env)
     env->slb_nr = 32;
 #endif
     init_excp_970(env);
+    env->reset_msr = (1ULL < MSR_SF);
     env->dcache_line_size = 128;
     env->icache_line_size = 128;
     /* Allocate hardware IRQ controller */
@@ -6555,6 +6558,7 @@ static void init_proc_970MP (CPUPPCState *env)
     env->slb_nr = 32;
 #endif
     init_excp_970(env);
+    env->reset_msr = (1ULL < MSR_SF);
     env->dcache_line_size = 128;
     env->icache_line_size = 128;
     /* Allocate hardware IRQ controller */
@@ -6640,6 +6644,7 @@ static void init_proc_POWER7 (CPUPPCState *env)
     env->slb_nr = 32;
 #endif
     init_excp_POWER7(env);
+    env->reset_msr = (1ULL < MSR_SF);
     env->dcache_line_size = 128;
     env->icache_line_size = 128;
     /* Allocate hardware IRQ controller */
@@ -6686,6 +6691,7 @@ static void init_proc_620 (CPUPPCState *env)
     /* Memory management */
     gen_low_BATs(env);
     init_excp_620(env);
+    env->reset_msr = (1ULL < MSR_SF);
     env->dcache_line_size = 64;
     env->icache_line_size = 64;
     /* Allocate hardware IRQ controller */
@@ -9306,6 +9312,7 @@ static void init_ppc_proc (CPUPPCState *env, const ppc_def_t *def)
     env->nb_BATs = 0;
     env->nb_tlb = 0;
     env->nb_ways = 0;
+    env->reset_msr = 0;
     env->tlb_type = TLB_NONE;
 #endif
     /* Register SPR common to all PowerPC implementations */
@@ -10246,7 +10253,7 @@ static void ppc_cpu_reset(CPUState *s)
 
     pcc->parent_reset(s);
 
-    msr = (target_ulong)0;
+    msr = (target_ulong)env->reset_msr;
     if (0) {
         /* XXX: find a suitable condition to enable the hypervisor mode */
         msr |= (target_ulong)MSR_HVB;
@@ -10272,11 +10279,6 @@ static void ppc_cpu_reset(CPUState *s)
     }
 #endif
     env->msr = msr & env->msr_mask;
-#if defined(TARGET_PPC64)
-    if (env->mmu_model & POWERPC_MMU_64) {
-        env->msr |= (1ULL << MSR_SF);
-    }
-#endif
     hreg_compute_hflags(env);
     env->reserve_addr = (target_ulong)-1ULL;
     /* Be sure no exception or interrupt is pending */
-- 
1.6.0.2

  parent reply	other threads:[~2012-06-20 20:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 20:11 [Qemu-devel] [PATCH 0/8] PPC: e5500 emulation Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 1/8] dt: make setprop argument static Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 2/8] PPC: e500: allow users to set the /compatible property via -machine Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 3/8] uImage: increase the gzip load size Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 4/8] PPC: Add some booke SPR defines Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 5/8] PPC: Add support for MSR_CM Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 6/8] PPC: BookE: Implement EPR SPR Alexander Graf
2012-06-20 20:11 ` Alexander Graf [this message]
2012-06-21 18:09   ` [Qemu-devel] [PATCH 7/8] PPC: Turn hardcoded reset mask into env variable Blue Swirl
2012-06-21 19:04     ` Alexander Graf
2012-06-21 18:16   ` Peter Maydell
2012-06-20 20:11 ` [Qemu-devel] [PATCH 8/8] PPC: Add e5500 CPU target Alexander Graf
2012-06-20 22:26   ` Scott Wood
2012-06-20 22:59     ` Alexander Graf
2012-06-20 23:07       ` Scott Wood
2012-06-20 23:10         ` Alexander Graf
2012-06-20 23:28           ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340223111-13449-8-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=B02008@freescale.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).