stats.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  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. */
  11. #include <linux/kvm_host.h>
  12. char *kvm_mips_exit_types_str[MAX_KVM_MIPS_EXIT_TYPES] = {
  13. "WAIT",
  14. "CACHE",
  15. "Signal",
  16. "Interrupt",
  17. "COP0/1 Unusable",
  18. "TLB Mod",
  19. "TLB Miss (LD)",
  20. "TLB Miss (ST)",
  21. "Address Err (ST)",
  22. "Address Error (LD)",
  23. "System Call",
  24. "Reserved Inst",
  25. "Break Inst",
  26. "Trap Inst",
  27. "MSA FPE",
  28. "FPE",
  29. "MSA Disabled",
  30. "D-Cache Flushes",
  31. };
  32. char *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. void kvm_mips_dump_stats(struct kvm_vcpu *vcpu)
  67. {
  68. #ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS
  69. int i, j;
  70. kvm_info("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id);
  71. for (i = 0; i < N_MIPS_COPROC_REGS; i++) {
  72. for (j = 0; j < N_MIPS_COPROC_SEL; j++) {
  73. if (vcpu->arch.cop0->stat[i][j])
  74. kvm_info("%s[%d]: %lu\n", kvm_cop0_str[i], j,
  75. vcpu->arch.cop0->stat[i][j]);
  76. }
  77. }
  78. #endif
  79. }