irq.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Common interrupt code for 32 and 64 bit
  4. */
  5. #include <linux/cpu.h>
  6. #include <linux/interrupt.h>
  7. #include <linux/kernel_stat.h>
  8. #include <linux/of.h>
  9. #include <linux/seq_file.h>
  10. #include <linux/smp.h>
  11. #include <linux/ftrace.h>
  12. #include <linux/delay.h>
  13. #include <linux/export.h>
  14. #include <linux/irq.h>
  15. #include <asm/irq_stack.h>
  16. #include <asm/apic.h>
  17. #include <asm/io_apic.h>
  18. #include <asm/irq.h>
  19. #include <asm/mce.h>
  20. #include <asm/hw_irq.h>
  21. #include <asm/desc.h>
  22. #include <asm/traps.h>
  23. #include <asm/thermal.h>
  24. #include <asm/posted_intr.h>
  25. #include <asm/irq_remapping.h>
  26. #if defined(CONFIG_X86_LOCAL_APIC) || defined(CONFIG_X86_THERMAL_VECTOR)
  27. #define CREATE_TRACE_POINTS
  28. #include <asm/trace/irq_vectors.h>
  29. #endif
  30. DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
  31. EXPORT_PER_CPU_SYMBOL(irq_stat);
  32. atomic_t irq_err_count;
  33. /*
  34. * 'what should we do if we get a hw irq event on an illegal vector'.
  35. * each architecture has to answer this themselves.
  36. */
  37. void ack_bad_irq(unsigned int irq)
  38. {
  39. if (printk_ratelimit())
  40. pr_err("unexpected IRQ trap at vector %02x\n", irq);
  41. /*
  42. * Currently unexpected vectors happen only on SMP and APIC.
  43. * We _must_ ack these because every local APIC has only N
  44. * irq slots per priority level, and a 'hanging, unacked' IRQ
  45. * holds up an irq slot - in excessive cases (when multiple
  46. * unexpected vectors occur) that might lock up the APIC
  47. * completely.
  48. * But only ack when the APIC is enabled -AK
  49. */
  50. apic_eoi();
  51. }
  52. #define irq_stats(x) (&per_cpu(irq_stat, x))
  53. /*
  54. * /proc/interrupts printing for arch specific interrupts
  55. */
  56. int arch_show_interrupts(struct seq_file *p, int prec)
  57. {
  58. int j;
  59. seq_printf(p, "%*s: ", prec, "NMI");
  60. for_each_online_cpu(j)
  61. seq_printf(p, "%10u ", irq_stats(j)->__nmi_count);
  62. seq_puts(p, " Non-maskable interrupts\n");
  63. #ifdef CONFIG_X86_LOCAL_APIC
  64. seq_printf(p, "%*s: ", prec, "LOC");
  65. for_each_online_cpu(j)
  66. seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs);
  67. seq_puts(p, " Local timer interrupts\n");
  68. seq_printf(p, "%*s: ", prec, "SPU");
  69. for_each_online_cpu(j)
  70. seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count);
  71. seq_puts(p, " Spurious interrupts\n");
  72. seq_printf(p, "%*s: ", prec, "PMI");
  73. for_each_online_cpu(j)
  74. seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs);
  75. seq_puts(p, " Performance monitoring interrupts\n");
  76. seq_printf(p, "%*s: ", prec, "IWI");
  77. for_each_online_cpu(j)
  78. seq_printf(p, "%10u ", irq_stats(j)->apic_irq_work_irqs);
  79. seq_puts(p, " IRQ work interrupts\n");
  80. seq_printf(p, "%*s: ", prec, "RTR");
  81. for_each_online_cpu(j)
  82. seq_printf(p, "%10u ", irq_stats(j)->icr_read_retry_count);
  83. seq_puts(p, " APIC ICR read retries\n");
  84. if (x86_platform_ipi_callback) {
  85. seq_printf(p, "%*s: ", prec, "PLT");
  86. for_each_online_cpu(j)
  87. seq_printf(p, "%10u ", irq_stats(j)->x86_platform_ipis);
  88. seq_puts(p, " Platform interrupts\n");
  89. }
  90. #endif
  91. #ifdef CONFIG_SMP
  92. seq_printf(p, "%*s: ", prec, "RES");
  93. for_each_online_cpu(j)
  94. seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count);
  95. seq_puts(p, " Rescheduling interrupts\n");
  96. seq_printf(p, "%*s: ", prec, "CAL");
  97. for_each_online_cpu(j)
  98. seq_printf(p, "%10u ", irq_stats(j)->irq_call_count);
  99. seq_puts(p, " Function call interrupts\n");
  100. seq_printf(p, "%*s: ", prec, "TLB");
  101. for_each_online_cpu(j)
  102. seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count);
  103. seq_puts(p, " TLB shootdowns\n");
  104. #endif
  105. #ifdef CONFIG_X86_THERMAL_VECTOR
  106. seq_printf(p, "%*s: ", prec, "TRM");
  107. for_each_online_cpu(j)
  108. seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count);
  109. seq_puts(p, " Thermal event interrupts\n");
  110. #endif
  111. #ifdef CONFIG_X86_MCE_THRESHOLD
  112. seq_printf(p, "%*s: ", prec, "THR");
  113. for_each_online_cpu(j)
  114. seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count);
  115. seq_puts(p, " Threshold APIC interrupts\n");
  116. #endif
  117. #ifdef CONFIG_X86_MCE_AMD
  118. seq_printf(p, "%*s: ", prec, "DFR");
  119. for_each_online_cpu(j)
  120. seq_printf(p, "%10u ", irq_stats(j)->irq_deferred_error_count);
  121. seq_puts(p, " Deferred Error APIC interrupts\n");
  122. #endif
  123. #ifdef CONFIG_X86_MCE
  124. seq_printf(p, "%*s: ", prec, "MCE");
  125. for_each_online_cpu(j)
  126. seq_printf(p, "%10u ", per_cpu(mce_exception_count, j));
  127. seq_puts(p, " Machine check exceptions\n");
  128. seq_printf(p, "%*s: ", prec, "MCP");
  129. for_each_online_cpu(j)
  130. seq_printf(p, "%10u ", per_cpu(mce_poll_count, j));
  131. seq_puts(p, " Machine check polls\n");
  132. #endif
  133. #ifdef CONFIG_X86_HV_CALLBACK_VECTOR
  134. if (test_bit(HYPERVISOR_CALLBACK_VECTOR, system_vectors)) {
  135. seq_printf(p, "%*s: ", prec, "HYP");
  136. for_each_online_cpu(j)
  137. seq_printf(p, "%10u ",
  138. irq_stats(j)->irq_hv_callback_count);
  139. seq_puts(p, " Hypervisor callback interrupts\n");
  140. }
  141. #endif
  142. #if IS_ENABLED(CONFIG_HYPERV)
  143. if (test_bit(HYPERV_REENLIGHTENMENT_VECTOR, system_vectors)) {
  144. seq_printf(p, "%*s: ", prec, "HRE");
  145. for_each_online_cpu(j)
  146. seq_printf(p, "%10u ",
  147. irq_stats(j)->irq_hv_reenlightenment_count);
  148. seq_puts(p, " Hyper-V reenlightenment interrupts\n");
  149. }
  150. if (test_bit(HYPERV_STIMER0_VECTOR, system_vectors)) {
  151. seq_printf(p, "%*s: ", prec, "HVS");
  152. for_each_online_cpu(j)
  153. seq_printf(p, "%10u ",
  154. irq_stats(j)->hyperv_stimer0_count);
  155. seq_puts(p, " Hyper-V stimer0 interrupts\n");
  156. }
  157. #endif
  158. seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
  159. #if defined(CONFIG_X86_IO_APIC)
  160. seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
  161. #endif
  162. #if IS_ENABLED(CONFIG_KVM)
  163. seq_printf(p, "%*s: ", prec, "PIN");
  164. for_each_online_cpu(j)
  165. seq_printf(p, "%10u ", irq_stats(j)->kvm_posted_intr_ipis);
  166. seq_puts(p, " Posted-interrupt notification event\n");
  167. seq_printf(p, "%*s: ", prec, "NPI");
  168. for_each_online_cpu(j)
  169. seq_printf(p, "%10u ",
  170. irq_stats(j)->kvm_posted_intr_nested_ipis);
  171. seq_puts(p, " Nested posted-interrupt event\n");
  172. seq_printf(p, "%*s: ", prec, "PIW");
  173. for_each_online_cpu(j)
  174. seq_printf(p, "%10u ",
  175. irq_stats(j)->kvm_posted_intr_wakeup_ipis);
  176. seq_puts(p, " Posted-interrupt wakeup event\n");
  177. #endif
  178. #ifdef CONFIG_X86_POSTED_MSI
  179. seq_printf(p, "%*s: ", prec, "PMN");
  180. for_each_online_cpu(j)
  181. seq_printf(p, "%10u ",
  182. irq_stats(j)->posted_msi_notification_count);
  183. seq_puts(p, " Posted MSI notification event\n");
  184. #endif
  185. return 0;
  186. }
  187. /*
  188. * /proc/stat helpers
  189. */
  190. u64 arch_irq_stat_cpu(unsigned int cpu)
  191. {
  192. u64 sum = irq_stats(cpu)->__nmi_count;
  193. #ifdef CONFIG_X86_LOCAL_APIC
  194. sum += irq_stats(cpu)->apic_timer_irqs;
  195. sum += irq_stats(cpu)->irq_spurious_count;
  196. sum += irq_stats(cpu)->apic_perf_irqs;
  197. sum += irq_stats(cpu)->apic_irq_work_irqs;
  198. sum += irq_stats(cpu)->icr_read_retry_count;
  199. if (x86_platform_ipi_callback)
  200. sum += irq_stats(cpu)->x86_platform_ipis;
  201. #endif
  202. #ifdef CONFIG_SMP
  203. sum += irq_stats(cpu)->irq_resched_count;
  204. sum += irq_stats(cpu)->irq_call_count;
  205. #endif
  206. #ifdef CONFIG_X86_THERMAL_VECTOR
  207. sum += irq_stats(cpu)->irq_thermal_count;
  208. #endif
  209. #ifdef CONFIG_X86_MCE_THRESHOLD
  210. sum += irq_stats(cpu)->irq_threshold_count;
  211. #endif
  212. #ifdef CONFIG_X86_HV_CALLBACK_VECTOR
  213. sum += irq_stats(cpu)->irq_hv_callback_count;
  214. #endif
  215. #if IS_ENABLED(CONFIG_HYPERV)
  216. sum += irq_stats(cpu)->irq_hv_reenlightenment_count;
  217. sum += irq_stats(cpu)->hyperv_stimer0_count;
  218. #endif
  219. #ifdef CONFIG_X86_MCE
  220. sum += per_cpu(mce_exception_count, cpu);
  221. sum += per_cpu(mce_poll_count, cpu);
  222. #endif
  223. return sum;
  224. }
  225. u64 arch_irq_stat(void)
  226. {
  227. u64 sum = atomic_read(&irq_err_count);
  228. return sum;
  229. }
  230. static __always_inline void handle_irq(struct irq_desc *desc,
  231. struct pt_regs *regs)
  232. {
  233. if (IS_ENABLED(CONFIG_X86_64))
  234. generic_handle_irq_desc(desc);
  235. else
  236. __handle_irq(desc, regs);
  237. }
  238. static struct irq_desc *reevaluate_vector(int vector)
  239. {
  240. struct irq_desc *desc = __this_cpu_read(vector_irq[vector]);
  241. if (!IS_ERR_OR_NULL(desc))
  242. return desc;
  243. if (desc == VECTOR_UNUSED)
  244. pr_emerg_ratelimited("No irq handler for %d.%u\n", smp_processor_id(), vector);
  245. else
  246. __this_cpu_write(vector_irq[vector], VECTOR_UNUSED);
  247. return NULL;
  248. }
  249. static __always_inline bool call_irq_handler(int vector, struct pt_regs *regs)
  250. {
  251. struct irq_desc *desc = __this_cpu_read(vector_irq[vector]);
  252. if (likely(!IS_ERR_OR_NULL(desc))) {
  253. handle_irq(desc, regs);
  254. return true;
  255. }
  256. /*
  257. * Reevaluate with vector_lock held to prevent a race against
  258. * request_irq() setting up the vector:
  259. *
  260. * CPU0 CPU1
  261. * interrupt is raised in APIC IRR
  262. * but not handled
  263. * free_irq()
  264. * per_cpu(vector_irq, CPU1)[vector] = VECTOR_SHUTDOWN;
  265. *
  266. * request_irq() common_interrupt()
  267. * d = this_cpu_read(vector_irq[vector]);
  268. *
  269. * per_cpu(vector_irq, CPU1)[vector] = desc;
  270. *
  271. * if (d == VECTOR_SHUTDOWN)
  272. * this_cpu_write(vector_irq[vector], VECTOR_UNUSED);
  273. *
  274. * This requires that the same vector on the same target CPU is
  275. * handed out or that a spurious interrupt hits that CPU/vector.
  276. */
  277. lock_vector_lock();
  278. desc = reevaluate_vector(vector);
  279. unlock_vector_lock();
  280. if (!desc)
  281. return false;
  282. handle_irq(desc, regs);
  283. return true;
  284. }
  285. /*
  286. * common_interrupt() handles all normal device IRQ's (the special SMP
  287. * cross-CPU interrupts have their own entry points).
  288. */
  289. DEFINE_IDTENTRY_IRQ(common_interrupt)
  290. {
  291. struct pt_regs *old_regs = set_irq_regs(regs);
  292. /* entry code tells RCU that we're not quiescent. Check it. */
  293. RCU_LOCKDEP_WARN(!rcu_is_watching(), "IRQ failed to wake up RCU");
  294. if (unlikely(!call_irq_handler(vector, regs)))
  295. apic_eoi();
  296. set_irq_regs(old_regs);
  297. }
  298. #ifdef CONFIG_X86_LOCAL_APIC
  299. /* Function pointer for generic interrupt vector handling */
  300. void (*x86_platform_ipi_callback)(void) = NULL;
  301. /*
  302. * Handler for X86_PLATFORM_IPI_VECTOR.
  303. */
  304. DEFINE_IDTENTRY_SYSVEC(sysvec_x86_platform_ipi)
  305. {
  306. struct pt_regs *old_regs = set_irq_regs(regs);
  307. apic_eoi();
  308. trace_x86_platform_ipi_entry(X86_PLATFORM_IPI_VECTOR);
  309. inc_irq_stat(x86_platform_ipis);
  310. if (x86_platform_ipi_callback)
  311. x86_platform_ipi_callback();
  312. trace_x86_platform_ipi_exit(X86_PLATFORM_IPI_VECTOR);
  313. set_irq_regs(old_regs);
  314. }
  315. #endif
  316. #if IS_ENABLED(CONFIG_KVM)
  317. static void dummy_handler(void) {}
  318. static void (*kvm_posted_intr_wakeup_handler)(void) = dummy_handler;
  319. void kvm_set_posted_intr_wakeup_handler(void (*handler)(void))
  320. {
  321. if (handler)
  322. kvm_posted_intr_wakeup_handler = handler;
  323. else {
  324. kvm_posted_intr_wakeup_handler = dummy_handler;
  325. synchronize_rcu();
  326. }
  327. }
  328. EXPORT_SYMBOL_GPL(kvm_set_posted_intr_wakeup_handler);
  329. /*
  330. * Handler for POSTED_INTERRUPT_VECTOR.
  331. */
  332. DEFINE_IDTENTRY_SYSVEC_SIMPLE(sysvec_kvm_posted_intr_ipi)
  333. {
  334. apic_eoi();
  335. inc_irq_stat(kvm_posted_intr_ipis);
  336. }
  337. /*
  338. * Handler for POSTED_INTERRUPT_WAKEUP_VECTOR.
  339. */
  340. DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_posted_intr_wakeup_ipi)
  341. {
  342. apic_eoi();
  343. inc_irq_stat(kvm_posted_intr_wakeup_ipis);
  344. kvm_posted_intr_wakeup_handler();
  345. }
  346. /*
  347. * Handler for POSTED_INTERRUPT_NESTED_VECTOR.
  348. */
  349. DEFINE_IDTENTRY_SYSVEC_SIMPLE(sysvec_kvm_posted_intr_nested_ipi)
  350. {
  351. apic_eoi();
  352. inc_irq_stat(kvm_posted_intr_nested_ipis);
  353. }
  354. #endif
  355. #ifdef CONFIG_X86_POSTED_MSI
  356. /* Posted Interrupt Descriptors for coalesced MSIs to be posted */
  357. DEFINE_PER_CPU_ALIGNED(struct pi_desc, posted_msi_pi_desc);
  358. void intel_posted_msi_init(void)
  359. {
  360. u32 destination;
  361. u32 apic_id;
  362. this_cpu_write(posted_msi_pi_desc.nv, POSTED_MSI_NOTIFICATION_VECTOR);
  363. /*
  364. * APIC destination ID is stored in bit 8:15 while in XAPIC mode.
  365. * VT-d spec. CH 9.11
  366. */
  367. apic_id = this_cpu_read(x86_cpu_to_apicid);
  368. destination = x2apic_enabled() ? apic_id : apic_id << 8;
  369. this_cpu_write(posted_msi_pi_desc.ndst, destination);
  370. }
  371. /*
  372. * De-multiplexing posted interrupts is on the performance path, the code
  373. * below is written to optimize the cache performance based on the following
  374. * considerations:
  375. * 1.Posted interrupt descriptor (PID) fits in a cache line that is frequently
  376. * accessed by both CPU and IOMMU.
  377. * 2.During posted MSI processing, the CPU needs to do 64-bit read and xchg
  378. * for checking and clearing posted interrupt request (PIR), a 256 bit field
  379. * within the PID.
  380. * 3.On the other side, the IOMMU does atomic swaps of the entire PID cache
  381. * line when posting interrupts and setting control bits.
  382. * 4.The CPU can access the cache line a magnitude faster than the IOMMU.
  383. * 5.Each time the IOMMU does interrupt posting to the PIR will evict the PID
  384. * cache line. The cache line states after each operation are as follows:
  385. * CPU IOMMU PID Cache line state
  386. * ---------------------------------------------------------------
  387. *...read64 exclusive
  388. *...lock xchg64 modified
  389. *... post/atomic swap invalid
  390. *...-------------------------------------------------------------
  391. *
  392. * To reduce L1 data cache miss, it is important to avoid contention with
  393. * IOMMU's interrupt posting/atomic swap. Therefore, a copy of PIR is used
  394. * to dispatch interrupt handlers.
  395. *
  396. * In addition, the code is trying to keep the cache line state consistent
  397. * as much as possible. e.g. when making a copy and clearing the PIR
  398. * (assuming non-zero PIR bits are present in the entire PIR), it does:
  399. * read, read, read, read, xchg, xchg, xchg, xchg
  400. * instead of:
  401. * read, xchg, read, xchg, read, xchg, read, xchg
  402. */
  403. static __always_inline bool handle_pending_pir(u64 *pir, struct pt_regs *regs)
  404. {
  405. int i, vec = FIRST_EXTERNAL_VECTOR;
  406. unsigned long pir_copy[4];
  407. bool handled = false;
  408. for (i = 0; i < 4; i++)
  409. pir_copy[i] = READ_ONCE(pir[i]);
  410. for (i = 0; i < 4; i++) {
  411. if (!pir_copy[i])
  412. continue;
  413. pir_copy[i] = arch_xchg(&pir[i], 0);
  414. handled = true;
  415. }
  416. if (handled) {
  417. for_each_set_bit_from(vec, pir_copy, FIRST_SYSTEM_VECTOR)
  418. call_irq_handler(vec, regs);
  419. }
  420. return handled;
  421. }
  422. /*
  423. * Performance data shows that 3 is good enough to harvest 90+% of the benefit
  424. * on high IRQ rate workload.
  425. */
  426. #define MAX_POSTED_MSI_COALESCING_LOOP 3
  427. /*
  428. * For MSIs that are delivered as posted interrupts, the CPU notifications
  429. * can be coalesced if the MSIs arrive in high frequency bursts.
  430. */
  431. DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
  432. {
  433. struct pt_regs *old_regs = set_irq_regs(regs);
  434. struct pi_desc *pid;
  435. int i = 0;
  436. pid = this_cpu_ptr(&posted_msi_pi_desc);
  437. inc_irq_stat(posted_msi_notification_count);
  438. irq_enter();
  439. /*
  440. * Max coalescing count includes the extra round of handle_pending_pir
  441. * after clearing the outstanding notification bit. Hence, at most
  442. * MAX_POSTED_MSI_COALESCING_LOOP - 1 loops are executed here.
  443. */
  444. while (++i < MAX_POSTED_MSI_COALESCING_LOOP) {
  445. if (!handle_pending_pir(pid->pir64, regs))
  446. break;
  447. }
  448. /*
  449. * Clear outstanding notification bit to allow new IRQ notifications,
  450. * do this last to maximize the window of interrupt coalescing.
  451. */
  452. pi_clear_on(pid);
  453. /*
  454. * There could be a race of PI notification and the clearing of ON bit,
  455. * process PIR bits one last time such that handling the new interrupts
  456. * are not delayed until the next IRQ.
  457. */
  458. handle_pending_pir(pid->pir64, regs);
  459. apic_eoi();
  460. irq_exit();
  461. set_irq_regs(old_regs);
  462. }
  463. #endif /* X86_POSTED_MSI */
  464. #ifdef CONFIG_HOTPLUG_CPU
  465. /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
  466. void fixup_irqs(void)
  467. {
  468. unsigned int vector;
  469. struct irq_desc *desc;
  470. struct irq_data *data;
  471. struct irq_chip *chip;
  472. irq_migrate_all_off_this_cpu();
  473. /*
  474. * We can remove mdelay() and then send spurious interrupts to
  475. * new cpu targets for all the irqs that were handled previously by
  476. * this cpu. While it works, I have seen spurious interrupt messages
  477. * (nothing wrong but still...).
  478. *
  479. * So for now, retain mdelay(1) and check the IRR and then send those
  480. * interrupts to new targets as this cpu is already offlined...
  481. */
  482. mdelay(1);
  483. /*
  484. * We can walk the vector array of this cpu without holding
  485. * vector_lock because the cpu is already marked !online, so
  486. * nothing else will touch it.
  487. */
  488. for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
  489. if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
  490. continue;
  491. if (is_vector_pending(vector)) {
  492. desc = __this_cpu_read(vector_irq[vector]);
  493. raw_spin_lock(&desc->lock);
  494. data = irq_desc_get_irq_data(desc);
  495. chip = irq_data_get_irq_chip(data);
  496. if (chip->irq_retrigger) {
  497. chip->irq_retrigger(data);
  498. __this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED);
  499. }
  500. raw_spin_unlock(&desc->lock);
  501. }
  502. if (__this_cpu_read(vector_irq[vector]) != VECTOR_RETRIGGERED)
  503. __this_cpu_write(vector_irq[vector], VECTOR_UNUSED);
  504. }
  505. }
  506. #endif
  507. #ifdef CONFIG_X86_THERMAL_VECTOR
  508. static void smp_thermal_vector(void)
  509. {
  510. if (x86_thermal_enabled())
  511. intel_thermal_interrupt();
  512. else
  513. pr_err("CPU%d: Unexpected LVT thermal interrupt!\n",
  514. smp_processor_id());
  515. }
  516. DEFINE_IDTENTRY_SYSVEC(sysvec_thermal)
  517. {
  518. trace_thermal_apic_entry(THERMAL_APIC_VECTOR);
  519. inc_irq_stat(irq_thermal_count);
  520. smp_thermal_vector();
  521. trace_thermal_apic_exit(THERMAL_APIC_VECTOR);
  522. apic_eoi();
  523. }
  524. #endif