[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 3/9] PPC: e500: initialize GPRs as per epapr
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 3/9] PPC: e500: initialize GPRs as per epapr |
Date: |
Mon, 6 May 2013 17:25:11 +0200 |
From: Bharat Bhushan <address@hidden>
ePAPR defines the initial values of cpu registers.
This patch initialize the GPRs as per ePAPR specification.
This resolves the issue of guest reboot/reset (guest hang on reboot).
Signed-off-by: Bharat Bhushan <address@hidden>
[agraf: add whitespace line]
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/e500.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index c1bdb6b..2d474e5 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -37,6 +37,7 @@
#include "qemu/host-utils.h"
#include "hw/pci-host/ppce500.h"
+#define EPAPR_MAGIC (0x45504150)
#define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
#define UIMAGE_LOAD_BASE 0
#define DTC_LOAD_PAD 0x1800000
@@ -393,11 +394,10 @@ static inline hwaddr booke206_page_size_to_tlb(uint64_t
size)
return 63 - clz64(size >> 10);
}
-static void mmubooke_create_initial_mapping(CPUPPCState *env)
+static int booke206_initial_map_tsize(CPUPPCState *env)
{
struct boot_info *bi = env->load_info;
- ppcmas_tlb_t *tlb = booke206_get_tlbm(env, 1, 0, 0);
- hwaddr size, dt_end;
+ hwaddr dt_end;
int ps;
/* Our initial TLB entry needs to cover everything from 0 to
@@ -408,6 +408,24 @@ static void mmubooke_create_initial_mapping(CPUPPCState
*env)
/* e500v2 can only do even TLB size bits */
ps++;
}
+ return ps;
+}
+
+static uint64_t mmubooke_initial_mapsize(CPUPPCState *env)
+{
+ int tsize;
+
+ tsize = booke206_initial_map_tsize(env);
+ return (1ULL << 10 << tsize);
+}
+
+static void mmubooke_create_initial_mapping(CPUPPCState *env)
+{
+ ppcmas_tlb_t *tlb = booke206_get_tlbm(env, 1, 0, 0);
+ hwaddr size;
+ int ps;
+
+ ps = booke206_initial_map_tsize(env);
size = (ps << MAS1_TSIZE_SHIFT);
tlb->mas1 = MAS1_VALID | size;
tlb->mas2 = 0;
@@ -444,6 +462,12 @@ static void ppce500_cpu_reset(void *opaque)
cs->halted = 0;
env->gpr[1] = (16<<20) - 8;
env->gpr[3] = bi->dt_base;
+ env->gpr[4] = 0;
+ env->gpr[5] = 0;
+ env->gpr[6] = EPAPR_MAGIC;
+ env->gpr[7] = mmubooke_initial_mapsize(env);
+ env->gpr[8] = 0;
+ env->gpr[9] = 0;
env->nip = bi->entry;
mmubooke_create_initial_mapping(env);
}
--
1.6.0.2
- [Qemu-ppc] [PULL 1.5 0/9] ppc patch queue 2013-05-06, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 8/9] PPC: e500: correct params->ram_size with ram_size, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 7/9] target-ppc: Add read and write of PPR SPR, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 3/9] PPC: e500: initialize GPRs as per epapr,
Alexander Graf <=
- [Qemu-ppc] [PATCH 1/9] pseries: Factor out check for out-of-bounds LIOBN, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 9/9] spapr_llan: fix device reenabling, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 5/9] PPC: Add MMU type for 2.06 with AMR but no TB pages, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 2/9] pseries: Fix debug message for out-of-bounds address in H_PUT_TCE, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 6/9] target-ppc: Fix invalid SPR read/write warnings, Alexander Graf, 2013/05/06
- [Qemu-ppc] [PATCH 4/9] pseries: Update SLOF firmware image, Alexander Graf, 2013/05/06
- Re: [Qemu-ppc] [PULL 1.5 0/9] ppc patch queue 2013-05-06, Aurelien Jarno, 2013/05/06