blob: dd90b0a9218183f8601911fcc8d8256c8edc0118 [file] [log] [blame]
Sanjay Lal3c20ef52012-11-21 18:34:07 -08001/*
Deng-Cheng Zhud116e812014-06-26 12:11:34 -07002 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * KVM/MIPS: COP0 access histogram
7 *
8 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
9 * Authors: Sanjay Lal <sanjayl@kymasys.com>
10 */
Sanjay Lal3c20ef52012-11-21 18:34:07 -080011
12#include <linux/kvm_host.h>
13
14char *kvm_mips_exit_types_str[MAX_KVM_MIPS_EXIT_TYPES] = {
15 "WAIT",
16 "CACHE",
17 "Signal",
18 "Interrupt",
19 "COP0/1 Unusable",
20 "TLB Mod",
21 "TLB Miss (LD)",
22 "TLB Miss (ST)",
23 "Address Err (ST)",
24 "Address Error (LD)",
25 "System Call",
26 "Reserved Inst",
27 "Break Inst",
James Hogan0a560422015-02-06 16:03:57 +000028 "Trap Inst",
Sanjay Lal3c20ef52012-11-21 18:34:07 -080029 "D-Cache Flushes",
30};
31
32char *kvm_cop0_str[N_MIPS_COPROC_REGS] = {
33 "Index",
34 "Random",
35 "EntryLo0",
36 "EntryLo1",
37 "Context",
38 "PG Mask",
39 "Wired",
40 "HWREna",
41 "BadVAddr",
42 "Count",
43 "EntryHI",
44 "Compare",
45 "Status",
46 "Cause",
47 "EXC PC",
48 "PRID",
49 "Config",
50 "LLAddr",
51 "Watch Lo",
52 "Watch Hi",
53 "X Context",
54 "Reserved",
55 "Impl Dep",
56 "Debug",
57 "DEPC",
58 "PerfCnt",
59 "ErrCtl",
60 "CacheErr",
61 "TagLo",
62 "TagHi",
63 "ErrorEPC",
64 "DESAVE"
65};
66
Deng-Cheng Zhud98403a2014-06-26 12:11:36 -070067void kvm_mips_dump_stats(struct kvm_vcpu *vcpu)
Sanjay Lal3c20ef52012-11-21 18:34:07 -080068{
69#ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS
70 int i, j;
71
Deng-Cheng Zhu6ad78a52014-06-26 12:11:35 -070072 kvm_info("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id);
Sanjay Lal3c20ef52012-11-21 18:34:07 -080073 for (i = 0; i < N_MIPS_COPROC_REGS; i++) {
74 for (j = 0; j < N_MIPS_COPROC_SEL; j++) {
75 if (vcpu->arch.cop0->stat[i][j])
Deng-Cheng Zhu6ad78a52014-06-26 12:11:35 -070076 kvm_info("%s[%d]: %lu\n", kvm_cop0_str[i], j,
77 vcpu->arch.cop0->stat[i][j]);
Sanjay Lal3c20ef52012-11-21 18:34:07 -080078 }
79 }
80#endif
Sanjay Lal3c20ef52012-11-21 18:34:07 -080081}