--- zzzz-none-000/linux-3.10.107/arch/mips/kernel/mips-mt.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/arch/mips/kernel/mips-mt.c 2021-11-10 11:53:54.000000000 +0000 @@ -30,7 +30,11 @@ __setup("maxvpes=", maxvpes); +#ifdef CONFIG_MIPS_MT_TC_LIMIT +int tclimit = CONFIG_MIPS_MT_TC_LIMIT; +#else int tclimit; +#endif static int __init maxtcs(char *str) { @@ -46,7 +50,7 @@ * Takes an argument which taken to be a pre-call MVPControl value. */ -void mips_mt_regdump(unsigned long mvpctl) +void mips_mt_regdump(unsigned long dummy __maybe_unused) { unsigned long flags; unsigned long vpflags; @@ -55,72 +59,110 @@ int ntc; int i; int tc; + int curr_tc = -1; unsigned long haltval; unsigned long tcstatval; + unsigned long vpe[16][6]; + unsigned long tcreg[16][8]; #ifdef CONFIG_MIPS_MT_SMTC void smtc_soft_dump(void); #endif /* CONFIG_MIPT_MT_SMTC */ local_irq_save(flags); - vpflags = dvpe(); - printk("=== MIPS MT State Dump ===\n"); - printk("-- Global State --\n"); - printk(" MVPControl Passed: %08lx\n", mvpctl); - printk(" MVPControl Read: %08lx\n", vpflags); - printk(" MVPConf0 : %08lx\n", (mvpconf0 = read_c0_mvpconf0())); - nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1; - ntc = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1; - printk("-- per-VPE State --\n"); + /**-------------------------------------------------------------------------------**\ + * START-CRITICAL START-CRITICAL START-CRITICAL START-CRITICAL START-CRITICAL + * Achtung kritischer Abschnitt - hier keine printks (ergo spinlocks etc.) verwenden + * -> Deadlock-Gefahr! + \*--------------------------------------------------------------------------------**/ + vpflags = dvpe(); + mvpconf0 = read_c0_mvpconf0(); + nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1; + ntc = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1; for (i = 0; i < nvpe; i++) { for (tc = 0; tc < ntc; tc++) { settc(tc); if ((read_tc_c0_tcbind() & TCBIND_CURVPE) == i) { - printk(" VPE %d\n", i); - printk(" VPEControl : %08lx\n", - read_vpe_c0_vpecontrol()); - printk(" VPEConf0 : %08lx\n", - read_vpe_c0_vpeconf0()); - printk(" VPE%d.Status : %08lx\n", - i, read_vpe_c0_status()); - printk(" VPE%d.EPC : %08lx %pS\n", - i, read_vpe_c0_epc(), - (void *) read_vpe_c0_epc()); - printk(" VPE%d.Cause : %08lx\n", - i, read_vpe_c0_cause()); - printk(" VPE%d.Config7 : %08lx\n", - i, read_vpe_c0_config7()); + vpe[i][0] = read_vpe_c0_vpecontrol(); + vpe[i][1] = read_vpe_c0_vpeconf0(); + vpe[i][2] = read_vpe_c0_status(); + vpe[i][3] = read_vpe_c0_epc(); + vpe[i][4] = read_vpe_c0_cause(); + vpe[i][5] = read_vpe_c0_config7(); break; /* Next VPE */ } } } - printk("-- per-TC State --\n"); for (tc = 0; tc < ntc; tc++) { settc(tc); if (read_tc_c0_tcbind() == read_c0_tcbind()) { /* Are we dumping ourself? */ - haltval = 0; /* Then we're not halted, and mustn't be */ + haltval = 0; /* Then we're not halted, and mustn't be */ tcstatval = flags; /* And pre-dump TCStatus is flags */ - printk(" TC %d (current TC with VPE EPC above)\n", tc); + curr_tc = tc; } else { haltval = read_tc_c0_tchalt(); write_tc_c0_tchalt(1); tcstatval = read_tc_c0_tcstatus(); - printk(" TC %d\n", tc); } - printk(" TCStatus : %08lx\n", tcstatval); - printk(" TCBind : %08lx\n", read_tc_c0_tcbind()); - printk(" TCRestart : %08lx %pS\n", - read_tc_c0_tcrestart(), (void *) read_tc_c0_tcrestart()); - printk(" TCHalt : %08lx\n", haltval); - printk(" TCContext : %08lx\n", read_tc_c0_tccontext()); - if (!haltval) - write_tc_c0_tchalt(0); + tcreg[tc][0] = tcstatval; + tcreg[tc][1] = read_tc_c0_tcbind(); + tcreg[tc][2] = read_tc_c0_tcrestart(); + tcreg[tc][3] = haltval; + tcreg[tc][4] = read_tc_c0_tccontext(); +#if defined(CONFIG_AVM_ENHANCED) + if(!haltval) { + tcreg[tc][5] = read_tc_gpr_sp(); + tcreg[tc][6] = read_tc_gpr_gp(); + tcreg[tc][7] = read_tc_gpr_ra(); + } +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ + if(!haltval) { + write_tc_c0_tchalt(0); + } + } + evpe(vpflags); + /*-------------------------------------------------------------------------------*\ + * END-CRITICAL END-CRITICAL END-CRITICAL END-CRITICAL END-CRITICAL + \*-------------------------------------------------------------------------------*/ + printk(KERN_EMERG"=== MIPS MT State Dump ===\n"); + printk(KERN_EMERG"-- Global State --\n"); + printk(KERN_EMERG" MVPControl Read: %08lx\n", vpflags); + printk(KERN_EMERG" MVPConf0 : %08lx\n", mvpconf0); + printk(KERN_EMERG"-- per-VPE State --\n"); + for (i = 0; i < nvpe; i++) { + printk(KERN_EMERG"VPE %d\n", i); + printk(KERN_EMERG" VPEControl : %08lx\n", vpe[i][0]); + printk(KERN_EMERG" VPEConf0 : %08lx\n", vpe[i][1]); + printk(KERN_EMERG" VPE%d.Status : %08lx\n", i, vpe[i][2]); + printk(KERN_EMERG" VPE%d.EPC : %08lx %pS\n", i, vpe[i][3], (void *)vpe[i][3]); + printk(KERN_EMERG" VPE%d.Cause : %08lx\n", i, vpe[i][4]); + printk(KERN_EMERG" VPE%d.Config7 : %08lx\n", i, vpe[i][5]); + } + printk(KERN_EMERG"-- per-TC State --\n"); + for (tc = 0; tc < ntc; tc++) { + if (curr_tc == tc) { + /* Are we dumping ourself? */ + printk(KERN_EMERG"TC %d (current TC with VPE EPC above)\n", tc); + } else { + printk(KERN_EMERG"TC %d\n", tc); + } + printk(KERN_EMERG" TCStatus : %08lx\n", tcreg[tc][0]); + printk(KERN_EMERG" TCBind : %08lx\n", tcreg[tc][1]); + printk(KERN_EMERG" TCRestart: %08lx %pS\n", tcreg[tc][2], (void *) tcreg[tc][2]); + printk(KERN_EMERG" TCHalt : %08lx\n", tcreg[tc][3]); + printk(KERN_EMERG" TCContext: %08lx\n", tcreg[tc][4]); +#if defined(CONFIG_AVM_ENHANCED) + if(!tcreg[tc][3]) { + printk(KERN_EMERG" SP: %08lx\n", tcreg[tc][5]); + printk(KERN_EMERG" GP: %08lx\n", tcreg[tc][6]); + printk(KERN_EMERG" RA: %08lx %pS\n", tcreg[tc][7], (void *)tcreg[tc][7]); + } +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ } #ifdef CONFIG_MIPS_MT_SMTC - smtc_soft_dump(); +/*--- smtc_soft_dump(); ---*/ #endif /* CONFIG_MIPT_MT_SMTC */ - printk("===========================\n"); - evpe(vpflags); + printk(KERN_EMERG"===========================\n"); local_irq_restore(flags); } @@ -160,8 +202,13 @@ __setup("config7=", config7_set); /* Experimental cache flush control parameters that should go away some day */ +#if defined(CONFIG_AVM_ENHANCED) +int mt_protiflush = 1; /*--- flush-operation atomar, da wir merkwuerdige Abstuerze haben (ReservedInstructions, falsche Befehle interpretiert) (JZ-24997) ---*/ +int mt_protdflush = 1; /*--- flush-operation atomar (s.o.) ---*/ +#else/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ int mt_protiflush; int mt_protdflush; +#endif/*--- #else ---*//*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ int mt_n_iflushes = 1; int mt_n_dflushes = 1;