blob: 888bb67070ac6d1139a7f06f5958e180680511ef [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",
James Hoganc2537ed2015-02-06 10:56:27 +000029 "MSA FPE",
James Hogan1c0cd662015-02-06 10:56:27 +000030 "FPE",
James Hoganc2537ed2015-02-06 10:56:27 +000031 "MSA Disabled",
Sanjay Lal3c20ef52012-11-21 18:34:07 -080032 "D-Cache Flushes",
33};
34
35char *kvm_cop0_str[N_MIPS_COPROC_REGS] = {
36 "Index",
37 "Random",
38 "EntryLo0",
39 "EntryLo1",
40 "Context",
41 "PG Mask",
42 "Wired",
43 "HWREna",
44 "BadVAddr",
45 "Count",
46 "EntryHI",
47 "Compare",
48 "Status",
49 "Cause",
50 "EXC PC",
51 "PRID",
52 "Config",
53 "LLAddr",
54 "Watch Lo",
55 "Watch Hi",
56 "X Context",
57 "Reserved",
58 "Impl Dep",
59 "Debug",
60 "DEPC",
61 "PerfCnt",
62 "ErrCtl",
63 "CacheErr",
64 "TagLo",
65 "TagHi",
66 "ErrorEPC",
67 "DESAVE"
68};
69
Deng-Cheng Zhud98403a2014-06-26 12:11:36 -070070void kvm_mips_dump_stats(struct kvm_vcpu *vcpu)
Sanjay Lal3c20ef52012-11-21 18:34:07 -080071{
72#ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS
73 int i, j;
74
Deng-Cheng Zhu6ad78a52014-06-26 12:11:35 -070075 kvm_info("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id);
Sanjay Lal3c20ef52012-11-21 18:34:07 -080076 for (i = 0; i < N_MIPS_COPROC_REGS; i++) {
77 for (j = 0; j < N_MIPS_COPROC_SEL; j++) {
78 if (vcpu->arch.cop0->stat[i][j])
Deng-Cheng Zhu6ad78a52014-06-26 12:11:35 -070079 kvm_info("%s[%d]: %lu\n", kvm_cop0_str[i], j,
80 vcpu->arch.cop0->stat[i][j]);
Sanjay Lal3c20ef52012-11-21 18:34:07 -080081 }
82 }
83#endif
Sanjay Lal3c20ef52012-11-21 18:34:07 -080084}