Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_HARDIRQ_H
0003 #define _ASM_X86_HARDIRQ_H
0004 
0005 #include <linux/threads.h>
0006 
0007 typedef struct {
0008     u16      __softirq_pending;
0009 #if IS_ENABLED(CONFIG_KVM_INTEL)
0010     u8       kvm_cpu_l1tf_flush_l1d;
0011 #endif
0012     unsigned int __nmi_count;   /* arch dependent */
0013 #ifdef CONFIG_X86_LOCAL_APIC
0014     unsigned int apic_timer_irqs;   /* arch dependent */
0015     unsigned int irq_spurious_count;
0016     unsigned int icr_read_retry_count;
0017 #endif
0018 #ifdef CONFIG_HAVE_KVM
0019     unsigned int kvm_posted_intr_ipis;
0020     unsigned int kvm_posted_intr_wakeup_ipis;
0021     unsigned int kvm_posted_intr_nested_ipis;
0022 #endif
0023     unsigned int x86_platform_ipis; /* arch dependent */
0024     unsigned int apic_perf_irqs;
0025     unsigned int apic_irq_work_irqs;
0026 #ifdef CONFIG_SMP
0027     unsigned int irq_resched_count;
0028     unsigned int irq_call_count;
0029 #endif
0030     unsigned int irq_tlb_count;
0031 #ifdef CONFIG_X86_THERMAL_VECTOR
0032     unsigned int irq_thermal_count;
0033 #endif
0034 #ifdef CONFIG_X86_MCE_THRESHOLD
0035     unsigned int irq_threshold_count;
0036 #endif
0037 #ifdef CONFIG_X86_MCE_AMD
0038     unsigned int irq_deferred_error_count;
0039 #endif
0040 #ifdef CONFIG_X86_HV_CALLBACK_VECTOR
0041     unsigned int irq_hv_callback_count;
0042 #endif
0043 #if IS_ENABLED(CONFIG_HYPERV)
0044     unsigned int irq_hv_reenlightenment_count;
0045     unsigned int hyperv_stimer0_count;
0046 #endif
0047 } ____cacheline_aligned irq_cpustat_t;
0048 
0049 DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
0050 
0051 #define __ARCH_IRQ_STAT
0052 
0053 #define inc_irq_stat(member)    this_cpu_inc(irq_stat.member)
0054 
0055 extern void ack_bad_irq(unsigned int irq);
0056 
0057 extern u64 arch_irq_stat_cpu(unsigned int cpu);
0058 #define arch_irq_stat_cpu   arch_irq_stat_cpu
0059 
0060 extern u64 arch_irq_stat(void);
0061 #define arch_irq_stat       arch_irq_stat
0062 
0063 
0064 #if IS_ENABLED(CONFIG_KVM_INTEL)
0065 static inline void kvm_set_cpu_l1tf_flush_l1d(void)
0066 {
0067     __this_cpu_write(irq_stat.kvm_cpu_l1tf_flush_l1d, 1);
0068 }
0069 
0070 static __always_inline void kvm_clear_cpu_l1tf_flush_l1d(void)
0071 {
0072     __this_cpu_write(irq_stat.kvm_cpu_l1tf_flush_l1d, 0);
0073 }
0074 
0075 static __always_inline bool kvm_get_cpu_l1tf_flush_l1d(void)
0076 {
0077     return __this_cpu_read(irq_stat.kvm_cpu_l1tf_flush_l1d);
0078 }
0079 #else /* !IS_ENABLED(CONFIG_KVM_INTEL) */
0080 static inline void kvm_set_cpu_l1tf_flush_l1d(void) { }
0081 #endif /* IS_ENABLED(CONFIG_KVM_INTEL) */
0082 
0083 #endif /* _ASM_X86_HARDIRQ_H */