mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-16 21:36:41 +07:00
3c865dd9c1
The TLB registers are dumped in a couble of places:
- sysrq_tlbdump_single() - when dumping TLB state.
- do_mcheck() - in response to a machine check error.
The main TLB registers also differ between r3k and r4k, but r4k appears
to be assumed.
Refactor this code into a dump_tlb_regs() function, implemented for both
r3k and r4k, and used by both of the above functions.
Fixes: d1e9a4f547
("MIPS: Add SysRq operation to dump TLBs on all CPUs")
Suggested-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10721/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
/*
|
|
* MIPS specific sysrq operations.
|
|
*
|
|
* Copyright (C) 2015 Imagination Technologies Ltd.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/sysrq.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
#include <asm/cpu-features.h>
|
|
#include <asm/mipsregs.h>
|
|
#include <asm/tlbdebug.h>
|
|
|
|
/*
|
|
* Dump TLB entries on all CPUs.
|
|
*/
|
|
|
|
static DEFINE_SPINLOCK(show_lock);
|
|
|
|
static void sysrq_tlbdump_single(void *dummy)
|
|
{
|
|
unsigned long flags;
|
|
|
|
spin_lock_irqsave(&show_lock, flags);
|
|
|
|
pr_info("CPU%d:\n", smp_processor_id());
|
|
dump_tlb_regs();
|
|
pr_info("\n");
|
|
dump_tlb_all();
|
|
pr_info("\n");
|
|
|
|
spin_unlock_irqrestore(&show_lock, flags);
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
static void sysrq_tlbdump_othercpus(struct work_struct *dummy)
|
|
{
|
|
smp_call_function(sysrq_tlbdump_single, NULL, 0);
|
|
}
|
|
|
|
static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);
|
|
#endif
|
|
|
|
static void sysrq_handle_tlbdump(int key)
|
|
{
|
|
sysrq_tlbdump_single(NULL);
|
|
#ifdef CONFIG_SMP
|
|
schedule_work(&sysrq_tlbdump);
|
|
#endif
|
|
}
|
|
|
|
static struct sysrq_key_op sysrq_tlbdump_op = {
|
|
.handler = sysrq_handle_tlbdump,
|
|
.help_msg = "show-tlbs(x)",
|
|
.action_msg = "Show TLB entries",
|
|
.enable_mask = SYSRQ_ENABLE_DUMP,
|
|
};
|
|
|
|
static int __init mips_sysrq_init(void)
|
|
{
|
|
return register_sysrq_key('x', &sysrq_tlbdump_op);
|
|
}
|
|
arch_initcall(mips_sysrq_init);
|