18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_HARDIRQ_H 38c2ecf20Sopenharmony_ci#define _ASM_X86_HARDIRQ_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/threads.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_citypedef struct { 88c2ecf20Sopenharmony_ci u16 __softirq_pending; 98c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_KVM_INTEL) 108c2ecf20Sopenharmony_ci u8 kvm_cpu_l1tf_flush_l1d; 118c2ecf20Sopenharmony_ci#endif 128c2ecf20Sopenharmony_ci unsigned int __nmi_count; /* arch dependent */ 138c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_LOCAL_APIC 148c2ecf20Sopenharmony_ci unsigned int apic_timer_irqs; /* arch dependent */ 158c2ecf20Sopenharmony_ci unsigned int irq_spurious_count; 168c2ecf20Sopenharmony_ci unsigned int icr_read_retry_count; 178c2ecf20Sopenharmony_ci#endif 188c2ecf20Sopenharmony_ci#ifdef CONFIG_HAVE_KVM 198c2ecf20Sopenharmony_ci unsigned int kvm_posted_intr_ipis; 208c2ecf20Sopenharmony_ci unsigned int kvm_posted_intr_wakeup_ipis; 218c2ecf20Sopenharmony_ci unsigned int kvm_posted_intr_nested_ipis; 228c2ecf20Sopenharmony_ci#endif 238c2ecf20Sopenharmony_ci unsigned int x86_platform_ipis; /* arch dependent */ 248c2ecf20Sopenharmony_ci unsigned int apic_perf_irqs; 258c2ecf20Sopenharmony_ci unsigned int apic_irq_work_irqs; 268c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP 278c2ecf20Sopenharmony_ci unsigned int irq_resched_count; 288c2ecf20Sopenharmony_ci unsigned int irq_call_count; 298c2ecf20Sopenharmony_ci#endif 308c2ecf20Sopenharmony_ci unsigned int irq_tlb_count; 318c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_THERMAL_VECTOR 328c2ecf20Sopenharmony_ci unsigned int irq_thermal_count; 338c2ecf20Sopenharmony_ci#endif 348c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_MCE_THRESHOLD 358c2ecf20Sopenharmony_ci unsigned int irq_threshold_count; 368c2ecf20Sopenharmony_ci#endif 378c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_MCE_AMD 388c2ecf20Sopenharmony_ci unsigned int irq_deferred_error_count; 398c2ecf20Sopenharmony_ci#endif 408c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_HV_CALLBACK_VECTOR 418c2ecf20Sopenharmony_ci unsigned int irq_hv_callback_count; 428c2ecf20Sopenharmony_ci#endif 438c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_HYPERV) 448c2ecf20Sopenharmony_ci unsigned int irq_hv_reenlightenment_count; 458c2ecf20Sopenharmony_ci unsigned int hyperv_stimer0_count; 468c2ecf20Sopenharmony_ci#endif 478c2ecf20Sopenharmony_ci} ____cacheline_aligned irq_cpustat_t; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciDECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define __ARCH_IRQ_STAT 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define inc_irq_stat(member) this_cpu_inc(irq_stat.member) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciextern void ack_bad_irq(unsigned int irq); 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ciextern u64 arch_irq_stat_cpu(unsigned int cpu); 588c2ecf20Sopenharmony_ci#define arch_irq_stat_cpu arch_irq_stat_cpu 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ciextern u64 arch_irq_stat(void); 618c2ecf20Sopenharmony_ci#define arch_irq_stat arch_irq_stat 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_KVM_INTEL) 658c2ecf20Sopenharmony_cistatic inline void kvm_set_cpu_l1tf_flush_l1d(void) 668c2ecf20Sopenharmony_ci{ 678c2ecf20Sopenharmony_ci __this_cpu_write(irq_stat.kvm_cpu_l1tf_flush_l1d, 1); 688c2ecf20Sopenharmony_ci} 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistatic __always_inline void kvm_clear_cpu_l1tf_flush_l1d(void) 718c2ecf20Sopenharmony_ci{ 728c2ecf20Sopenharmony_ci __this_cpu_write(irq_stat.kvm_cpu_l1tf_flush_l1d, 0); 738c2ecf20Sopenharmony_ci} 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistatic __always_inline bool kvm_get_cpu_l1tf_flush_l1d(void) 768c2ecf20Sopenharmony_ci{ 778c2ecf20Sopenharmony_ci return __this_cpu_read(irq_stat.kvm_cpu_l1tf_flush_l1d); 788c2ecf20Sopenharmony_ci} 798c2ecf20Sopenharmony_ci#else /* !IS_ENABLED(CONFIG_KVM_INTEL) */ 808c2ecf20Sopenharmony_cistatic inline void kvm_set_cpu_l1tf_flush_l1d(void) { } 818c2ecf20Sopenharmony_ci#endif /* IS_ENABLED(CONFIG_KVM_INTEL) */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#endif /* _ASM_X86_HARDIRQ_H */ 84