xref: /openbmc/linux/arch/mips/kvm/stats.c (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1d7d5b05fSDeng-Cheng Zhu /*
2d7d5b05fSDeng-Cheng Zhu  * This file is subject to the terms and conditions of the GNU General Public
3d7d5b05fSDeng-Cheng Zhu  * License.  See the file "COPYING" in the main directory of this archive
4d7d5b05fSDeng-Cheng Zhu  * for more details.
5d7d5b05fSDeng-Cheng Zhu  *
6d7d5b05fSDeng-Cheng Zhu  * KVM/MIPS: COP0 access histogram
7d7d5b05fSDeng-Cheng Zhu  *
8d7d5b05fSDeng-Cheng Zhu  * Copyright (C) 2012  MIPS Technologies, Inc.  All rights reserved.
9d7d5b05fSDeng-Cheng Zhu  * Authors: Sanjay Lal <sanjayl@kymasys.com>
10d7d5b05fSDeng-Cheng Zhu  */
11d7d5b05fSDeng-Cheng Zhu 
12d7d5b05fSDeng-Cheng Zhu #include <linux/kvm_host.h>
13d7d5b05fSDeng-Cheng Zhu 
14d7d5b05fSDeng-Cheng Zhu char *kvm_cop0_str[N_MIPS_COPROC_REGS] = {
15d7d5b05fSDeng-Cheng Zhu 	"Index",
16d7d5b05fSDeng-Cheng Zhu 	"Random",
17d7d5b05fSDeng-Cheng Zhu 	"EntryLo0",
18d7d5b05fSDeng-Cheng Zhu 	"EntryLo1",
19d7d5b05fSDeng-Cheng Zhu 	"Context",
20d7d5b05fSDeng-Cheng Zhu 	"PG Mask",
21d7d5b05fSDeng-Cheng Zhu 	"Wired",
22d7d5b05fSDeng-Cheng Zhu 	"HWREna",
23d7d5b05fSDeng-Cheng Zhu 	"BadVAddr",
24d7d5b05fSDeng-Cheng Zhu 	"Count",
25d7d5b05fSDeng-Cheng Zhu 	"EntryHI",
26d7d5b05fSDeng-Cheng Zhu 	"Compare",
27d7d5b05fSDeng-Cheng Zhu 	"Status",
28d7d5b05fSDeng-Cheng Zhu 	"Cause",
29d7d5b05fSDeng-Cheng Zhu 	"EXC PC",
30d7d5b05fSDeng-Cheng Zhu 	"PRID",
31d7d5b05fSDeng-Cheng Zhu 	"Config",
32d7d5b05fSDeng-Cheng Zhu 	"LLAddr",
33d7d5b05fSDeng-Cheng Zhu 	"Watch Lo",
34d7d5b05fSDeng-Cheng Zhu 	"Watch Hi",
35d7d5b05fSDeng-Cheng Zhu 	"X Context",
36d7d5b05fSDeng-Cheng Zhu 	"Reserved",
37d7d5b05fSDeng-Cheng Zhu 	"Impl Dep",
38d7d5b05fSDeng-Cheng Zhu 	"Debug",
39d7d5b05fSDeng-Cheng Zhu 	"DEPC",
40d7d5b05fSDeng-Cheng Zhu 	"PerfCnt",
41d7d5b05fSDeng-Cheng Zhu 	"ErrCtl",
42d7d5b05fSDeng-Cheng Zhu 	"CacheErr",
43d7d5b05fSDeng-Cheng Zhu 	"TagLo",
44d7d5b05fSDeng-Cheng Zhu 	"TagHi",
45d7d5b05fSDeng-Cheng Zhu 	"ErrorEPC",
46d7d5b05fSDeng-Cheng Zhu 	"DESAVE"
47d7d5b05fSDeng-Cheng Zhu };
48d7d5b05fSDeng-Cheng Zhu 
kvm_mips_dump_stats(struct kvm_vcpu * vcpu)49d7d5b05fSDeng-Cheng Zhu void kvm_mips_dump_stats(struct kvm_vcpu *vcpu)
50d7d5b05fSDeng-Cheng Zhu {
51d7d5b05fSDeng-Cheng Zhu #ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS
52d7d5b05fSDeng-Cheng Zhu 	int i, j;
53d7d5b05fSDeng-Cheng Zhu 
54d7d5b05fSDeng-Cheng Zhu 	kvm_info("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id);
55d7d5b05fSDeng-Cheng Zhu 	for (i = 0; i < N_MIPS_COPROC_REGS; i++) {
56d7d5b05fSDeng-Cheng Zhu 		for (j = 0; j < N_MIPS_COPROC_SEL; j++) {
57*3a6dbb69SThomas Bogendoerfer 			if (vcpu->arch.cop0.stat[i][j])
58d7d5b05fSDeng-Cheng Zhu 				kvm_info("%s[%d]: %lu\n", kvm_cop0_str[i], j,
59*3a6dbb69SThomas Bogendoerfer 					 vcpu->arch.cop0.stat[i][j]);
60d7d5b05fSDeng-Cheng Zhu 		}
61d7d5b05fSDeng-Cheng Zhu 	}
62d7d5b05fSDeng-Cheng Zhu #endif
63d7d5b05fSDeng-Cheng Zhu }
64