| 
									
										
										
										
											2012-11-21 18:34:07 -08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2014-06-26 12:11:34 -07:00
										 |  |  |  * This file is subject to the terms and conditions of the GNU General Public | 
					
						
							|  |  |  |  * License.  See the file "COPYING" in the main directory of this archive | 
					
						
							|  |  |  |  * for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * KVM/MIPS: COP0 access histogram | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2012  MIPS Technologies, Inc.  All rights reserved. | 
					
						
							|  |  |  |  * Authors: Sanjay Lal <sanjayl@kymasys.com> | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-11-21 18:34:07 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <linux/kvm_host.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *kvm_mips_exit_types_str[MAX_KVM_MIPS_EXIT_TYPES] = { | 
					
						
							|  |  |  | 	"WAIT", | 
					
						
							|  |  |  | 	"CACHE", | 
					
						
							|  |  |  | 	"Signal", | 
					
						
							|  |  |  | 	"Interrupt", | 
					
						
							|  |  |  | 	"COP0/1 Unusable", | 
					
						
							|  |  |  | 	"TLB Mod", | 
					
						
							|  |  |  | 	"TLB Miss (LD)", | 
					
						
							|  |  |  | 	"TLB Miss (ST)", | 
					
						
							|  |  |  | 	"Address Err (ST)", | 
					
						
							|  |  |  | 	"Address Error (LD)", | 
					
						
							|  |  |  | 	"System Call", | 
					
						
							|  |  |  | 	"Reserved Inst", | 
					
						
							|  |  |  | 	"Break Inst", | 
					
						
							| 
									
										
										
										
											2015-02-06 16:03:57 +00:00
										 |  |  | 	"Trap Inst", | 
					
						
							| 
									
										
										
										
											2015-02-06 10:56:27 +00:00
										 |  |  | 	"MSA FPE", | 
					
						
							| 
									
										
										
										
											2015-02-06 10:56:27 +00:00
										 |  |  | 	"FPE", | 
					
						
							| 
									
										
										
										
											2015-02-06 10:56:27 +00:00
										 |  |  | 	"MSA Disabled", | 
					
						
							| 
									
										
										
										
											2012-11-21 18:34:07 -08:00
										 |  |  | 	"D-Cache Flushes", | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *kvm_cop0_str[N_MIPS_COPROC_REGS] = { | 
					
						
							|  |  |  | 	"Index", | 
					
						
							|  |  |  | 	"Random", | 
					
						
							|  |  |  | 	"EntryLo0", | 
					
						
							|  |  |  | 	"EntryLo1", | 
					
						
							|  |  |  | 	"Context", | 
					
						
							|  |  |  | 	"PG Mask", | 
					
						
							|  |  |  | 	"Wired", | 
					
						
							|  |  |  | 	"HWREna", | 
					
						
							|  |  |  | 	"BadVAddr", | 
					
						
							|  |  |  | 	"Count", | 
					
						
							|  |  |  | 	"EntryHI", | 
					
						
							|  |  |  | 	"Compare", | 
					
						
							|  |  |  | 	"Status", | 
					
						
							|  |  |  | 	"Cause", | 
					
						
							|  |  |  | 	"EXC PC", | 
					
						
							|  |  |  | 	"PRID", | 
					
						
							|  |  |  | 	"Config", | 
					
						
							|  |  |  | 	"LLAddr", | 
					
						
							|  |  |  | 	"Watch Lo", | 
					
						
							|  |  |  | 	"Watch Hi", | 
					
						
							|  |  |  | 	"X Context", | 
					
						
							|  |  |  | 	"Reserved", | 
					
						
							|  |  |  | 	"Impl Dep", | 
					
						
							|  |  |  | 	"Debug", | 
					
						
							|  |  |  | 	"DEPC", | 
					
						
							|  |  |  | 	"PerfCnt", | 
					
						
							|  |  |  | 	"ErrCtl", | 
					
						
							|  |  |  | 	"CacheErr", | 
					
						
							|  |  |  | 	"TagLo", | 
					
						
							|  |  |  | 	"TagHi", | 
					
						
							|  |  |  | 	"ErrorEPC", | 
					
						
							|  |  |  | 	"DESAVE" | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-26 12:11:36 -07:00
										 |  |  | void kvm_mips_dump_stats(struct kvm_vcpu *vcpu) | 
					
						
							| 
									
										
										
										
											2012-11-21 18:34:07 -08:00
										 |  |  | { | 
					
						
							|  |  |  | #ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS
 | 
					
						
							|  |  |  | 	int i, j; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-26 12:11:35 -07:00
										 |  |  | 	kvm_info("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id); | 
					
						
							| 
									
										
										
										
											2012-11-21 18:34:07 -08:00
										 |  |  | 	for (i = 0; i < N_MIPS_COPROC_REGS; i++) { | 
					
						
							|  |  |  | 		for (j = 0; j < N_MIPS_COPROC_SEL; j++) { | 
					
						
							|  |  |  | 			if (vcpu->arch.cop0->stat[i][j]) | 
					
						
							| 
									
										
										
										
											2014-06-26 12:11:35 -07:00
										 |  |  | 				kvm_info("%s[%d]: %lu\n", kvm_cop0_str[i], j, | 
					
						
							|  |  |  | 					 vcpu->arch.cop0->stat[i][j]); | 
					
						
							| 
									
										
										
										
											2012-11-21 18:34:07 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } |