Blackfin: optimize double fault boot checking
authorMike Frysinger <vapier@gentoo.org>
Mon, 30 May 2011 03:12:51 +0000 (23:12 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 23 Jul 2011 05:10:43 +0000 (01:10 -0400)
This moves the double fault data used at boot time into a single struct
which can then easily be addressed with indexed loads rather than having
to explicitly load multiple addresses.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/include/asm/pda.h
arch/blackfin/kernel/asm-offsets.c
arch/blackfin/kernel/setup.c
arch/blackfin/mach-bf561/secondary.S
arch/blackfin/mach-common/head.S
arch/blackfin/mach-common/smp.c

index d49bb261d9b7c89a2e6e714b62c8b085a06decec..28c2498c9c987a61c36a63f724194540c07e5a14 100644 (file)
@@ -54,6 +54,16 @@ struct blackfin_pda {                        /* Per-processor Data Area */
 #endif
 };
 
+struct blackfin_initial_pda {
+       void *retx;
+#ifdef CONFIG_DEBUG_DOUBLEFAULT
+       void *dcplb_doublefault_addr;
+       void *icplb_doublefault_addr;
+       void *retx_doublefault;
+       unsigned seqstat_doublefault;
+#endif
+};
+
 extern struct blackfin_pda cpu_pda[];
 
 #endif /* __ASSEMBLY__ */
index bd32c09b9349b789068015afa3999a9abd720f89..17e35465a4167bec3eee1f962c44ae152025ac25 100644 (file)
@@ -138,6 +138,16 @@ int main(void)
        DEFINE(PDA_DF_SEQSTAT, offsetof(struct blackfin_pda, seqstat_doublefault));
        DEFINE(PDA_DF_RETX, offsetof(struct blackfin_pda, retx_doublefault));
 #endif
+
+       /* PDA initial management */
+       DEFINE(PDA_INIT_RETX, offsetof(struct blackfin_initial_pda, retx));
+#ifdef CONFIG_DEBUG_DOUBLEFAULT
+       DEFINE(PDA_INIT_DF_DCPLB, offsetof(struct blackfin_initial_pda, dcplb_doublefault_addr));
+       DEFINE(PDA_INIT_DF_ICPLB, offsetof(struct blackfin_initial_pda, icplb_doublefault_addr));
+       DEFINE(PDA_INIT_DF_SEQSTAT, offsetof(struct blackfin_initial_pda, seqstat_doublefault));
+       DEFINE(PDA_INIT_DF_RETX, offsetof(struct blackfin_initial_pda, retx_doublefault));
+#endif
+
 #ifdef CONFIG_SMP
        /* Inter-core lock (in L2 SRAM) */
        DEFINE(SIZEOF_CORELOCK, sizeof(struct corelock_slot));
index 536bd9d7e0cfb80392e3ed43b8ac8f6fb106fce0..dfa2525a442d76318044acc65f51bb07b683b863 100644 (file)
@@ -54,8 +54,7 @@ EXPORT_SYMBOL(mtd_size);
 #endif
 
 char __initdata command_line[COMMAND_LINE_SIZE];
-void __initdata *init_retx, *init_saved_retx, *init_saved_seqstat,
-       *init_saved_icplb_fault_addr, *init_saved_dcplb_fault_addr;
+struct blackfin_initial_pda __initdata initial_pda;
 
 /* boot memmap, for parsing "memmap=" */
 #define BFIN_MEMMAP_MAX                128 /* number of entries in bfin_memmap */
@@ -957,13 +956,16 @@ void __init setup_arch(char **cmdline_p)
                printk(KERN_EMERG "Recovering from DOUBLE FAULT event\n");
 #ifdef CONFIG_DEBUG_DOUBLEFAULT
                /* We assume the crashing kernel, and the current symbol table match */
-               printk(KERN_EMERG " While handling exception (EXCAUSE = 0x%x) at %pF\n",
-                       (int)init_saved_seqstat & SEQSTAT_EXCAUSE, init_saved_retx);
-               printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pF\n", init_saved_dcplb_fault_addr);
-               printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pF\n", init_saved_icplb_fault_addr);
+               printk(KERN_EMERG " While handling exception (EXCAUSE = %#x) at %pF\n",
+                       initial_pda.seqstat_doublefault & SEQSTAT_EXCAUSE,
+                       initial_pda.retx_doublefault);
+               printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pF\n",
+                       initial_pda.dcplb_doublefault_addr);
+               printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pF\n",
+                       initial_pda.icplb_doublefault_addr);
 #endif
                printk(KERN_NOTICE " The instruction at %pF caused a double exception\n",
-                       init_retx);
+                       initial_pda.retx);
        } else if (_bfin_swrst & RESET_WDOG)
                printk(KERN_INFO "Recovering from Watchdog event\n");
        else if (_bfin_swrst & RESET_SOFTWARE)
index 348c9191d19f490a780b49324c8087d50056d101..01e5408620ac60f39b9d4f7e720caa74b48d4ca0 100644 (file)
@@ -76,37 +76,25 @@ ENTRY(_coreb_trampoline_start)
        SSYNC;
 
        /* in case of double faults, save a few things */
-       p0.l = _init_retx_coreb;
-       p0.h = _init_retx_coreb;
-       R0 = RETX;
-       [P0] = R0;
-
+       p1.l = _initial_pda_coreb;
+       p1.h = _initial_pda_coreb;
+       r4 = RETX;
 #ifdef CONFIG_DEBUG_DOUBLEFAULT
        /* Only save these if we are storing them,
         * This happens here, since L1 gets clobbered
         * below
         */
        GET_PDA(p0, r0);
-       r5 = [p0 + PDA_DF_RETX];
-       p1.l = _init_saved_retx_coreb;
-       p1.h = _init_saved_retx_coreb;
-       [p1] = r5;
-
-       r5 = [p0 + PDA_DF_DCPLB];
-       p1.l = _init_saved_dcplb_fault_addr_coreb;
-       p1.h = _init_saved_dcplb_fault_addr_coreb;
-       [p1] = r5;
-
-       r5 = [p0 + PDA_DF_ICPLB];
-       p1.l = _init_saved_icplb_fault_addr_coreb;
-       p1.h = _init_saved_icplb_fault_addr_coreb;
-       [p1] = r5;
-
-       r5 = [p0 + PDA_DF_SEQSTAT];
-       p1.l = _init_saved_seqstat_coreb;
-       p1.h = _init_saved_seqstat_coreb;
-       [p1] = r5;
+       r0 = [p0 + PDA_DF_RETX];
+       r1 = [p0 + PDA_DF_DCPLB];
+       r2 = [p0 + PDA_DF_ICPLB];
+       r3 = [p0 + PDA_DF_SEQSTAT];
+       [p1 + PDA_INIT_DF_RETX] = r0;
+       [p1 + PDA_INIT_DF_DCPLB] = r1;
+       [p1 + PDA_INIT_DF_ICPLB] = r2;
+       [p1 + PDA_INIT_DF_SEQSTAT] = r3;
 #endif
+       [p1 + PDA_INIT_RETX] = r4;
 
        /* Initialize stack pointer */
        sp.l = lo(INITIAL_STACK);
index 76de5724c1e3a27ec2fd2d13a6a7ed0232e05e19..8b4d9885440359a6871801fa0affc74da3c78904 100644 (file)
@@ -85,37 +85,25 @@ ENTRY(__start)
        SSYNC;
 
        /* in case of double faults, save a few things */
-       p0.l = _init_retx;
-       p0.h = _init_retx;
-       R0 = RETX;
-       [P0] = R0;
-
+       p1.l = _initial_pda;
+       p1.h = _initial_pda;
+       r4 = RETX;
 #ifdef CONFIG_DEBUG_DOUBLEFAULT
        /* Only save these if we are storing them,
         * This happens here, since L1 gets clobbered
         * below
         */
        GET_PDA(p0, r0);
-       r5 = [p0 + PDA_DF_RETX];
-       p1.l = _init_saved_retx;
-       p1.h = _init_saved_retx;
-       [p1] = r5;
-
-       r5 = [p0 + PDA_DF_DCPLB];
-       p1.l = _init_saved_dcplb_fault_addr;
-       p1.h = _init_saved_dcplb_fault_addr;
-       [p1] = r5;
-
-       r5 = [p0 + PDA_DF_ICPLB];
-       p1.l = _init_saved_icplb_fault_addr;
-       p1.h = _init_saved_icplb_fault_addr;
-       [p1] = r5;
-
-       r5 = [p0 + PDA_DF_SEQSTAT];
-       p1.l = _init_saved_seqstat;
-       p1.h = _init_saved_seqstat;
-       [p1] = r5;
+       r0 = [p0 + PDA_DF_RETX];
+       r1 = [p0 + PDA_DF_DCPLB];
+       r2 = [p0 + PDA_DF_ICPLB];
+       r3 = [p0 + PDA_DF_SEQSTAT];
+       [p1 + PDA_INIT_DF_RETX] = r0;
+       [p1 + PDA_INIT_DF_DCPLB] = r1;
+       [p1 + PDA_INIT_DF_ICPLB] = r2;
+       [p1 + PDA_INIT_DF_SEQSTAT] = r3;
 #endif
+       [p1 + PDA_INIT_RETX] = r4;
 
        /* Initialize stack pointer */
        sp.l = _init_thread_union + THREAD_SIZE;
index 35e7e1eb0188f58de9fe39ed50af1538b5802e69..1c143a4de5f50a9b012607049411b184cb794816 100644 (file)
@@ -45,9 +45,7 @@ struct corelock_slot corelock __attribute__ ((__section__(".l2.bss")));
 unsigned long blackfin_iflush_l1_entry[NR_CPUS];
 #endif
 
-void __cpuinitdata *init_retx_coreb, *init_saved_retx_coreb,
-       *init_saved_seqstat_coreb, *init_saved_icplb_fault_addr_coreb,
-       *init_saved_dcplb_fault_addr_coreb;
+struct blackfin_initial_pda __cpuinitdata initial_pda_coreb;
 
 #define BFIN_IPI_RESCHEDULE   0
 #define BFIN_IPI_CALL_FUNC    1
@@ -369,13 +367,16 @@ void __cpuinit secondary_start_kernel(void)
        if (_bfin_swrst & SWRST_DBL_FAULT_B) {
                printk(KERN_EMERG "CoreB Recovering from DOUBLE FAULT event\n");
 #ifdef CONFIG_DEBUG_DOUBLEFAULT
-               printk(KERN_EMERG " While handling exception (EXCAUSE = 0x%x) at %pF\n",
-                       (int)init_saved_seqstat_coreb & SEQSTAT_EXCAUSE, init_saved_retx_coreb);
-               printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pF\n", init_saved_dcplb_fault_addr_coreb);
-               printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pF\n", init_saved_icplb_fault_addr_coreb);
+               printk(KERN_EMERG " While handling exception (EXCAUSE = %#x) at %pF\n",
+                       initial_pda_coreb.seqstat_doublefault & SEQSTAT_EXCAUSE,
+                       initial_pda_coreb.retx_doublefault);
+               printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pF\n",
+                       initial_pda_coreb.dcplb_doublefault_addr);
+               printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pF\n",
+                       initial_pda_coreb.icplb_doublefault_addr);
 #endif
                printk(KERN_NOTICE " The instruction at %pF caused a double exception\n",
-                       init_retx_coreb);
+                       initial_pda_coreb.retx);
        }
 
        /*