FILE
timing.h
File preview with syntax highlighting.
linux-6.19.14/arch/powerpc/kvm/timing.h
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * 4 * Copyright IBM Corp. 2008 5 * 6 * Authors: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> 7 */ 8 9#ifndef __POWERPC_KVM_EXITTIMING_H__ 10#define __POWERPC_KVM_EXITTIMING_H__ 11 12#include <linux/kvm_host.h> 13 14#ifdef CONFIG_KVM_EXIT_TIMING 15void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu); 16void kvmppc_update_timing_stats(struct kvm_vcpu *vcpu); 17int kvmppc_create_vcpu_debugfs_e500(struct kvm_vcpu *vcpu, 18 struct dentry *debugfs_dentry); 19 20static inline void kvmppc_set_exit_type(struct kvm_vcpu *vcpu, int type) 21{ 22 vcpu->arch.last_exit_type = type; 23} 24 25#else 26/* if exit timing is not configured there is no need to build the c file */ 27static inline void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu) {} 28static inline void kvmppc_update_timing_stats(struct kvm_vcpu *vcpu) {} 29static inline int kvmppc_create_vcpu_debugfs_e500(struct kvm_vcpu *vcpu, 30 struct dentry *debugfs_dentry) 31{ 32 return 0; 33} 34static inline void kvmppc_set_exit_type(struct kvm_vcpu *vcpu, int type) {} 35#endif /* CONFIG_KVM_EXIT_TIMING */ 36 37/* account the exit in kvm_stats */ 38static inline void kvmppc_account_exit_stat(struct kvm_vcpu *vcpu, int type) 39{ 40 /* type has to be known at build time for optimization */ 41 BUILD_BUG_ON(!__builtin_constant_p(type)); 42 switch (type) { 43 case EXT_INTR_EXITS: 44 vcpu->stat.ext_intr_exits++; 45 break; 46 case DEC_EXITS: 47 vcpu->stat.dec_exits++; 48 break; 49 case EMULATED_INST_EXITS: 50 vcpu->stat.emulated_inst_exits++; 51 break; 52 case DSI_EXITS: 53 vcpu->stat.dsi_exits++; 54 break; 55 case ISI_EXITS: 56 vcpu->stat.isi_exits++; 57 break; 58 case SYSCALL_EXITS: 59 vcpu->stat.syscall_exits++; 60 break; 61 case DTLB_REAL_MISS_EXITS: 62 vcpu->stat.dtlb_real_miss_exits++; 63 break; 64 case DTLB_VIRT_MISS_EXITS: 65 vcpu->stat.dtlb_virt_miss_exits++; 66 break; 67 case MMIO_EXITS: 68 vcpu->stat.mmio_exits++; 69 break; 70 case ITLB_REAL_MISS_EXITS: 71 vcpu->stat.itlb_real_miss_exits++; 72 break; 73 case ITLB_VIRT_MISS_EXITS: 74 vcpu->stat.itlb_virt_miss_exits++; 75 break; 76 case SIGNAL_EXITS: 77 vcpu->stat.signal_exits++; 78 break; 79 case DBELL_EXITS: 80 vcpu->stat.dbell_exits++; 81 break; 82 case GDBELL_EXITS: 83 vcpu->stat.gdbell_exits++; 84 break; 85 } 86} 87 88/* wrapper to set exit time and account for it in kvm_stats */ 89static inline void kvmppc_account_exit(struct kvm_vcpu *vcpu, int type) 90{ 91 kvmppc_set_exit_type(vcpu, type); 92 kvmppc_account_exit_stat(vcpu, type); 93} 94 95#endif /* __POWERPC_KVM_EXITTIMING_H__ */
~/
Read-only file preview.