^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _ASM_X86_HARDIRQ_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ASM_X86_HARDIRQ_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/threads.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) u16 __softirq_pending;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #if IS_ENABLED(CONFIG_KVM_INTEL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) u8 kvm_cpu_l1tf_flush_l1d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) unsigned int __nmi_count; /* arch dependent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifdef CONFIG_X86_LOCAL_APIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) unsigned int apic_timer_irqs; /* arch dependent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) unsigned int irq_spurious_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned int icr_read_retry_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #ifdef CONFIG_HAVE_KVM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned int kvm_posted_intr_ipis;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) unsigned int kvm_posted_intr_wakeup_ipis;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned int kvm_posted_intr_nested_ipis;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) unsigned int x86_platform_ipis; /* arch dependent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned int apic_perf_irqs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unsigned int apic_irq_work_irqs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) unsigned int irq_resched_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned int irq_call_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned int irq_tlb_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #ifdef CONFIG_X86_THERMAL_VECTOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned int irq_thermal_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #ifdef CONFIG_X86_MCE_THRESHOLD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) unsigned int irq_threshold_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #ifdef CONFIG_X86_MCE_AMD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) unsigned int irq_deferred_error_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #ifdef CONFIG_X86_HV_CALLBACK_VECTOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned int irq_hv_callback_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #if IS_ENABLED(CONFIG_HYPERV)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned int irq_hv_reenlightenment_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) unsigned int hyperv_stimer0_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) } ____cacheline_aligned irq_cpustat_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define __ARCH_IRQ_STAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define inc_irq_stat(member) this_cpu_inc(irq_stat.member)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) extern void ack_bad_irq(unsigned int irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) extern u64 arch_irq_stat_cpu(unsigned int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define arch_irq_stat_cpu arch_irq_stat_cpu
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern u64 arch_irq_stat(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define arch_irq_stat arch_irq_stat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #if IS_ENABLED(CONFIG_KVM_INTEL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) static inline void kvm_set_cpu_l1tf_flush_l1d(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) __this_cpu_write(irq_stat.kvm_cpu_l1tf_flush_l1d, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static __always_inline void kvm_clear_cpu_l1tf_flush_l1d(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) __this_cpu_write(irq_stat.kvm_cpu_l1tf_flush_l1d, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) static __always_inline bool kvm_get_cpu_l1tf_flush_l1d(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) return __this_cpu_read(irq_stat.kvm_cpu_l1tf_flush_l1d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #else /* !IS_ENABLED(CONFIG_KVM_INTEL) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) static inline void kvm_set_cpu_l1tf_flush_l1d(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #endif /* IS_ENABLED(CONFIG_KVM_INTEL) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #endif /* _ASM_X86_HARDIRQ_H */