DBG(" <- setup_system()\n");
 }
 
-static u64 slb0_limit(void)
+/* This returns the limit below which memory accesses to the linear
+ * mapping are guarnateed not to cause a TLB or SLB miss. This is
+ * used to allocate interrupt or emergency stacks for which our
+ * exception entry path doesn't deal with being interrupted.
+ */
+static u64 safe_stack_limit(void)
 {
-       if (mmu_has_feature(MMU_FTR_1T_SEGMENT)) {
+#ifdef CONFIG_PPC_BOOK3E
+       /* Freescale BookE bolts the entire linear mapping */
+       if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
+               return linear_map_top;
+       /* Other BookE, we assume the first GB is bolted */
+       return 1ul << 30;
+#else
+       /* BookS, the first segment is bolted */
+       if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
                return 1UL << SID_SHIFT_1T;
-       }
        return 1UL << SID_SHIFT;
+#endif
 }
 
 static void __init irqstack_early_init(void)
 {
-       u64 limit = slb0_limit();
+       u64 limit = safe_stack_limit();
        unsigned int i;
 
        /*
         * bringup, we need to get at them in real mode. This means they
         * must also be within the RMO region.
         */
-       limit = min(slb0_limit(), ppc64_rma_size);
+       limit = min(safe_stack_limit(), ppc64_rma_size);
 
        for_each_possible_cpu(i) {
                unsigned long sp;