Sanjay Lal | 3c20ef5 | 2012-11-21 18:34:07 -0800 | [diff] [blame] | 1 | /* |
Deng-Cheng Zhu | d116e81 | 2014-06-26 12:11:34 -0700 | [diff] [blame] | 2 | * 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 Lal | 3c20ef5 | 2012-11-21 18:34:07 -0800 | [diff] [blame] | 11 | |
| 12 | #include <linux/kvm_host.h> |
| 13 | |
Sanjay Lal | 3c20ef5 | 2012-11-21 18:34:07 -0800 | [diff] [blame] | 14 | char *kvm_cop0_str[N_MIPS_COPROC_REGS] = { |
| 15 | "Index", |
| 16 | "Random", |
| 17 | "EntryLo0", |
| 18 | "EntryLo1", |
| 19 | "Context", |
| 20 | "PG Mask", |
| 21 | "Wired", |
| 22 | "HWREna", |
| 23 | "BadVAddr", |
| 24 | "Count", |
| 25 | "EntryHI", |
| 26 | "Compare", |
| 27 | "Status", |
| 28 | "Cause", |
| 29 | "EXC PC", |
| 30 | "PRID", |
| 31 | "Config", |
| 32 | "LLAddr", |
| 33 | "Watch Lo", |
| 34 | "Watch Hi", |
| 35 | "X Context", |
| 36 | "Reserved", |
| 37 | "Impl Dep", |
| 38 | "Debug", |
| 39 | "DEPC", |
| 40 | "PerfCnt", |
| 41 | "ErrCtl", |
| 42 | "CacheErr", |
| 43 | "TagLo", |
| 44 | "TagHi", |
| 45 | "ErrorEPC", |
| 46 | "DESAVE" |
| 47 | }; |
| 48 | |
Deng-Cheng Zhu | d98403a | 2014-06-26 12:11:36 -0700 | [diff] [blame] | 49 | void kvm_mips_dump_stats(struct kvm_vcpu *vcpu) |
Sanjay Lal | 3c20ef5 | 2012-11-21 18:34:07 -0800 | [diff] [blame] | 50 | { |
| 51 | #ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS |
| 52 | int i, j; |
| 53 | |
Deng-Cheng Zhu | 6ad78a5 | 2014-06-26 12:11:35 -0700 | [diff] [blame] | 54 | kvm_info("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id); |
Sanjay Lal | 3c20ef5 | 2012-11-21 18:34:07 -0800 | [diff] [blame] | 55 | for (i = 0; i < N_MIPS_COPROC_REGS; i++) { |
| 56 | for (j = 0; j < N_MIPS_COPROC_SEL; j++) { |
| 57 | if (vcpu->arch.cop0->stat[i][j]) |
Deng-Cheng Zhu | 6ad78a5 | 2014-06-26 12:11:35 -0700 | [diff] [blame] | 58 | kvm_info("%s[%d]: %lu\n", kvm_cop0_str[i], j, |
| 59 | vcpu->arch.cop0->stat[i][j]); |
Sanjay Lal | 3c20ef5 | 2012-11-21 18:34:07 -0800 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | #endif |
Sanjay Lal | 3c20ef5 | 2012-11-21 18:34:07 -0800 | [diff] [blame] | 63 | } |