irq_ia64.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/arch/ia64/kernel/irq_ia64.c
  4. *
  5. * Copyright (C) 1998-2001 Hewlett-Packard Co
  6. * Stephane Eranian <eranian@hpl.hp.com>
  7. * David Mosberger-Tang <davidm@hpl.hp.com>
  8. *
  9. * 6/10/99: Updated to bring in sync with x86 version to facilitate
  10. * support for SMP and different interrupt controllers.
  11. *
  12. * 09/15/00 Goutham Rao <goutham.rao@intel.com> Implemented pci_irq_to_vector
  13. * PCI to vector allocation routine.
  14. * 04/14/2004 Ashok Raj <ashok.raj@intel.com>
  15. * Added CPU Hotplug handling for IPF.
  16. */
  17. #include <linux/module.h>
  18. #include <linux/jiffies.h>
  19. #include <linux/errno.h>
  20. #include <linux/init.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/ioport.h>
  23. #include <linux/kernel_stat.h>
  24. #include <linux/ptrace.h>
  25. #include <linux/signal.h>
  26. #include <linux/smp.h>
  27. #include <linux/threads.h>
  28. #include <linux/bitops.h>
  29. #include <linux/irq.h>
  30. #include <linux/ratelimit.h>
  31. #include <linux/acpi.h>
  32. #include <linux/sched.h>
  33. #include <asm/delay.h>
  34. #include <asm/intrinsics.h>
  35. #include <asm/io.h>
  36. #include <asm/hw_irq.h>
  37. #include <asm/machvec.h>
  38. #include <asm/pgtable.h>
  39. #include <asm/tlbflush.h>
  40. #ifdef CONFIG_PERFMON
  41. # include <asm/perfmon.h>
  42. #endif
  43. #define IRQ_DEBUG 0
  44. #define IRQ_VECTOR_UNASSIGNED (0)
  45. #define IRQ_UNUSED (0)
  46. #define IRQ_USED (1)
  47. #define IRQ_RSVD (2)
  48. /* These can be overridden in platform_irq_init */
  49. int ia64_first_device_vector = IA64_DEF_FIRST_DEVICE_VECTOR;
  50. int ia64_last_device_vector = IA64_DEF_LAST_DEVICE_VECTOR;
  51. /* default base addr of IPI table */
  52. void __iomem *ipi_base_addr = ((void __iomem *)
  53. (__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR));
  54. static cpumask_t vector_allocation_domain(int cpu);
  55. /*
  56. * Legacy IRQ to IA-64 vector translation table.
  57. */
  58. __u8 isa_irq_to_vector_map[16] = {
  59. /* 8259 IRQ translation, first 16 entries */
  60. 0x2f, 0x20, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29,
  61. 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21
  62. };
  63. EXPORT_SYMBOL(isa_irq_to_vector_map);
  64. DEFINE_SPINLOCK(vector_lock);
  65. struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = {
  66. [0 ... NR_IRQS - 1] = {
  67. .vector = IRQ_VECTOR_UNASSIGNED,
  68. .domain = CPU_MASK_NONE
  69. }
  70. };
  71. DEFINE_PER_CPU(int[IA64_NUM_VECTORS], vector_irq) = {
  72. [0 ... IA64_NUM_VECTORS - 1] = -1
  73. };
  74. static cpumask_t vector_table[IA64_NUM_VECTORS] = {
  75. [0 ... IA64_NUM_VECTORS - 1] = CPU_MASK_NONE
  76. };
  77. static int irq_status[NR_IRQS] = {
  78. [0 ... NR_IRQS -1] = IRQ_UNUSED
  79. };
  80. static inline int find_unassigned_irq(void)
  81. {
  82. int irq;
  83. for (irq = IA64_FIRST_DEVICE_VECTOR; irq < NR_IRQS; irq++)
  84. if (irq_status[irq] == IRQ_UNUSED)
  85. return irq;
  86. return -ENOSPC;
  87. }
  88. static inline int find_unassigned_vector(cpumask_t domain)
  89. {
  90. cpumask_t mask;
  91. int pos, vector;
  92. cpumask_and(&mask, &domain, cpu_online_mask);
  93. if (cpumask_empty(&mask))
  94. return -EINVAL;
  95. for (pos = 0; pos < IA64_NUM_DEVICE_VECTORS; pos++) {
  96. vector = IA64_FIRST_DEVICE_VECTOR + pos;
  97. cpumask_and(&mask, &domain, &vector_table[vector]);
  98. if (!cpumask_empty(&mask))
  99. continue;
  100. return vector;
  101. }
  102. return -ENOSPC;
  103. }
  104. static int __bind_irq_vector(int irq, int vector, cpumask_t domain)
  105. {
  106. cpumask_t mask;
  107. int cpu;
  108. struct irq_cfg *cfg = &irq_cfg[irq];
  109. BUG_ON((unsigned)irq >= NR_IRQS);
  110. BUG_ON((unsigned)vector >= IA64_NUM_VECTORS);
  111. cpumask_and(&mask, &domain, cpu_online_mask);
  112. if (cpumask_empty(&mask))
  113. return -EINVAL;
  114. if ((cfg->vector == vector) && cpumask_equal(&cfg->domain, &domain))
  115. return 0;
  116. if (cfg->vector != IRQ_VECTOR_UNASSIGNED)
  117. return -EBUSY;
  118. for_each_cpu(cpu, &mask)
  119. per_cpu(vector_irq, cpu)[vector] = irq;
  120. cfg->vector = vector;
  121. cfg->domain = domain;
  122. irq_status[irq] = IRQ_USED;
  123. cpumask_or(&vector_table[vector], &vector_table[vector], &domain);
  124. return 0;
  125. }
  126. int bind_irq_vector(int irq, int vector, cpumask_t domain)
  127. {
  128. unsigned long flags;
  129. int ret;
  130. spin_lock_irqsave(&vector_lock, flags);
  131. ret = __bind_irq_vector(irq, vector, domain);
  132. spin_unlock_irqrestore(&vector_lock, flags);
  133. return ret;
  134. }
  135. static void __clear_irq_vector(int irq)
  136. {
  137. int vector, cpu;
  138. cpumask_t domain;
  139. struct irq_cfg *cfg = &irq_cfg[irq];
  140. BUG_ON((unsigned)irq >= NR_IRQS);
  141. BUG_ON(cfg->vector == IRQ_VECTOR_UNASSIGNED);
  142. vector = cfg->vector;
  143. domain = cfg->domain;
  144. for_each_cpu_and(cpu, &cfg->domain, cpu_online_mask)
  145. per_cpu(vector_irq, cpu)[vector] = -1;
  146. cfg->vector = IRQ_VECTOR_UNASSIGNED;
  147. cfg->domain = CPU_MASK_NONE;
  148. irq_status[irq] = IRQ_UNUSED;
  149. cpumask_andnot(&vector_table[vector], &vector_table[vector], &domain);
  150. }
  151. static void clear_irq_vector(int irq)
  152. {
  153. unsigned long flags;
  154. spin_lock_irqsave(&vector_lock, flags);
  155. __clear_irq_vector(irq);
  156. spin_unlock_irqrestore(&vector_lock, flags);
  157. }
  158. int
  159. ia64_native_assign_irq_vector (int irq)
  160. {
  161. unsigned long flags;
  162. int vector, cpu;
  163. cpumask_t domain = CPU_MASK_NONE;
  164. vector = -ENOSPC;
  165. spin_lock_irqsave(&vector_lock, flags);
  166. for_each_online_cpu(cpu) {
  167. domain = vector_allocation_domain(cpu);
  168. vector = find_unassigned_vector(domain);
  169. if (vector >= 0)
  170. break;
  171. }
  172. if (vector < 0)
  173. goto out;
  174. if (irq == AUTO_ASSIGN)
  175. irq = vector;
  176. BUG_ON(__bind_irq_vector(irq, vector, domain));
  177. out:
  178. spin_unlock_irqrestore(&vector_lock, flags);
  179. return vector;
  180. }
  181. void
  182. ia64_native_free_irq_vector (int vector)
  183. {
  184. if (vector < IA64_FIRST_DEVICE_VECTOR ||
  185. vector > IA64_LAST_DEVICE_VECTOR)
  186. return;
  187. clear_irq_vector(vector);
  188. }
  189. int
  190. reserve_irq_vector (int vector)
  191. {
  192. if (vector < IA64_FIRST_DEVICE_VECTOR ||
  193. vector > IA64_LAST_DEVICE_VECTOR)
  194. return -EINVAL;
  195. return !!bind_irq_vector(vector, vector, CPU_MASK_ALL);
  196. }
  197. /*
  198. * Initialize vector_irq on a new cpu. This function must be called
  199. * with vector_lock held.
  200. */
  201. void __setup_vector_irq(int cpu)
  202. {
  203. int irq, vector;
  204. /* Clear vector_irq */
  205. for (vector = 0; vector < IA64_NUM_VECTORS; ++vector)
  206. per_cpu(vector_irq, cpu)[vector] = -1;
  207. /* Mark the inuse vectors */
  208. for (irq = 0; irq < NR_IRQS; ++irq) {
  209. if (!cpumask_test_cpu(cpu, &irq_cfg[irq].domain))
  210. continue;
  211. vector = irq_to_vector(irq);
  212. per_cpu(vector_irq, cpu)[vector] = irq;
  213. }
  214. }
  215. #if defined(CONFIG_SMP) && (defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG))
  216. static enum vector_domain_type {
  217. VECTOR_DOMAIN_NONE,
  218. VECTOR_DOMAIN_PERCPU
  219. } vector_domain_type = VECTOR_DOMAIN_NONE;
  220. static cpumask_t vector_allocation_domain(int cpu)
  221. {
  222. if (vector_domain_type == VECTOR_DOMAIN_PERCPU)
  223. return *cpumask_of(cpu);
  224. return CPU_MASK_ALL;
  225. }
  226. static int __irq_prepare_move(int irq, int cpu)
  227. {
  228. struct irq_cfg *cfg = &irq_cfg[irq];
  229. int vector;
  230. cpumask_t domain;
  231. if (cfg->move_in_progress || cfg->move_cleanup_count)
  232. return -EBUSY;
  233. if (cfg->vector == IRQ_VECTOR_UNASSIGNED || !cpu_online(cpu))
  234. return -EINVAL;
  235. if (cpumask_test_cpu(cpu, &cfg->domain))
  236. return 0;
  237. domain = vector_allocation_domain(cpu);
  238. vector = find_unassigned_vector(domain);
  239. if (vector < 0)
  240. return -ENOSPC;
  241. cfg->move_in_progress = 1;
  242. cfg->old_domain = cfg->domain;
  243. cfg->vector = IRQ_VECTOR_UNASSIGNED;
  244. cfg->domain = CPU_MASK_NONE;
  245. BUG_ON(__bind_irq_vector(irq, vector, domain));
  246. return 0;
  247. }
  248. int irq_prepare_move(int irq, int cpu)
  249. {
  250. unsigned long flags;
  251. int ret;
  252. spin_lock_irqsave(&vector_lock, flags);
  253. ret = __irq_prepare_move(irq, cpu);
  254. spin_unlock_irqrestore(&vector_lock, flags);
  255. return ret;
  256. }
  257. void irq_complete_move(unsigned irq)
  258. {
  259. struct irq_cfg *cfg = &irq_cfg[irq];
  260. cpumask_t cleanup_mask;
  261. int i;
  262. if (likely(!cfg->move_in_progress))
  263. return;
  264. if (unlikely(cpumask_test_cpu(smp_processor_id(), &cfg->old_domain)))
  265. return;
  266. cpumask_and(&cleanup_mask, &cfg->old_domain, cpu_online_mask);
  267. cfg->move_cleanup_count = cpumask_weight(&cleanup_mask);
  268. for_each_cpu(i, &cleanup_mask)
  269. platform_send_ipi(i, IA64_IRQ_MOVE_VECTOR, IA64_IPI_DM_INT, 0);
  270. cfg->move_in_progress = 0;
  271. }
  272. static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)
  273. {
  274. int me = smp_processor_id();
  275. ia64_vector vector;
  276. unsigned long flags;
  277. for (vector = IA64_FIRST_DEVICE_VECTOR;
  278. vector < IA64_LAST_DEVICE_VECTOR; vector++) {
  279. int irq;
  280. struct irq_desc *desc;
  281. struct irq_cfg *cfg;
  282. irq = __this_cpu_read(vector_irq[vector]);
  283. if (irq < 0)
  284. continue;
  285. desc = irq_to_desc(irq);
  286. cfg = irq_cfg + irq;
  287. raw_spin_lock(&desc->lock);
  288. if (!cfg->move_cleanup_count)
  289. goto unlock;
  290. if (!cpumask_test_cpu(me, &cfg->old_domain))
  291. goto unlock;
  292. spin_lock_irqsave(&vector_lock, flags);
  293. __this_cpu_write(vector_irq[vector], -1);
  294. cpumask_clear_cpu(me, &vector_table[vector]);
  295. spin_unlock_irqrestore(&vector_lock, flags);
  296. cfg->move_cleanup_count--;
  297. unlock:
  298. raw_spin_unlock(&desc->lock);
  299. }
  300. return IRQ_HANDLED;
  301. }
  302. static struct irqaction irq_move_irqaction = {
  303. .handler = smp_irq_move_cleanup_interrupt,
  304. .name = "irq_move"
  305. };
  306. static int __init parse_vector_domain(char *arg)
  307. {
  308. if (!arg)
  309. return -EINVAL;
  310. if (!strcmp(arg, "percpu")) {
  311. vector_domain_type = VECTOR_DOMAIN_PERCPU;
  312. no_int_routing = 1;
  313. }
  314. return 0;
  315. }
  316. early_param("vector", parse_vector_domain);
  317. #else
  318. static cpumask_t vector_allocation_domain(int cpu)
  319. {
  320. return CPU_MASK_ALL;
  321. }
  322. #endif
  323. void destroy_and_reserve_irq(unsigned int irq)
  324. {
  325. unsigned long flags;
  326. irq_init_desc(irq);
  327. spin_lock_irqsave(&vector_lock, flags);
  328. __clear_irq_vector(irq);
  329. irq_status[irq] = IRQ_RSVD;
  330. spin_unlock_irqrestore(&vector_lock, flags);
  331. }
  332. /*
  333. * Dynamic irq allocate and deallocation for MSI
  334. */
  335. int create_irq(void)
  336. {
  337. unsigned long flags;
  338. int irq, vector, cpu;
  339. cpumask_t domain = CPU_MASK_NONE;
  340. irq = vector = -ENOSPC;
  341. spin_lock_irqsave(&vector_lock, flags);
  342. for_each_online_cpu(cpu) {
  343. domain = vector_allocation_domain(cpu);
  344. vector = find_unassigned_vector(domain);
  345. if (vector >= 0)
  346. break;
  347. }
  348. if (vector < 0)
  349. goto out;
  350. irq = find_unassigned_irq();
  351. if (irq < 0)
  352. goto out;
  353. BUG_ON(__bind_irq_vector(irq, vector, domain));
  354. out:
  355. spin_unlock_irqrestore(&vector_lock, flags);
  356. if (irq >= 0)
  357. irq_init_desc(irq);
  358. return irq;
  359. }
  360. void destroy_irq(unsigned int irq)
  361. {
  362. irq_init_desc(irq);
  363. clear_irq_vector(irq);
  364. }
  365. #ifdef CONFIG_SMP
  366. # define IS_RESCHEDULE(vec) (vec == IA64_IPI_RESCHEDULE)
  367. # define IS_LOCAL_TLB_FLUSH(vec) (vec == IA64_IPI_LOCAL_TLB_FLUSH)
  368. #else
  369. # define IS_RESCHEDULE(vec) (0)
  370. # define IS_LOCAL_TLB_FLUSH(vec) (0)
  371. #endif
  372. /*
  373. * That's where the IVT branches when we get an external
  374. * interrupt. This branches to the correct hardware IRQ handler via
  375. * function ptr.
  376. */
  377. void
  378. ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
  379. {
  380. struct pt_regs *old_regs = set_irq_regs(regs);
  381. unsigned long saved_tpr;
  382. #if IRQ_DEBUG
  383. {
  384. unsigned long bsp, sp;
  385. /*
  386. * Note: if the interrupt happened while executing in
  387. * the context switch routine (ia64_switch_to), we may
  388. * get a spurious stack overflow here. This is
  389. * because the register and the memory stack are not
  390. * switched atomically.
  391. */
  392. bsp = ia64_getreg(_IA64_REG_AR_BSP);
  393. sp = ia64_getreg(_IA64_REG_SP);
  394. if ((sp - bsp) < 1024) {
  395. static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
  396. if (__ratelimit(&ratelimit)) {
  397. printk("ia64_handle_irq: DANGER: less than "
  398. "1KB of free stack space!!\n"
  399. "(bsp=0x%lx, sp=%lx)\n", bsp, sp);
  400. }
  401. }
  402. }
  403. #endif /* IRQ_DEBUG */
  404. /*
  405. * Always set TPR to limit maximum interrupt nesting depth to
  406. * 16 (without this, it would be ~240, which could easily lead
  407. * to kernel stack overflows).
  408. */
  409. irq_enter();
  410. saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
  411. ia64_srlz_d();
  412. while (vector != IA64_SPURIOUS_INT_VECTOR) {
  413. int irq = local_vector_to_irq(vector);
  414. if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
  415. smp_local_flush_tlb();
  416. kstat_incr_irq_this_cpu(irq);
  417. } else if (unlikely(IS_RESCHEDULE(vector))) {
  418. scheduler_ipi();
  419. kstat_incr_irq_this_cpu(irq);
  420. } else {
  421. ia64_setreg(_IA64_REG_CR_TPR, vector);
  422. ia64_srlz_d();
  423. if (unlikely(irq < 0)) {
  424. printk(KERN_ERR "%s: Unexpected interrupt "
  425. "vector %d on CPU %d is not mapped "
  426. "to any IRQ!\n", __func__, vector,
  427. smp_processor_id());
  428. } else
  429. generic_handle_irq(irq);
  430. /*
  431. * Disable interrupts and send EOI:
  432. */
  433. local_irq_disable();
  434. ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
  435. }
  436. ia64_eoi();
  437. vector = ia64_get_ivr();
  438. }
  439. /*
  440. * This must be done *after* the ia64_eoi(). For example, the keyboard softirq
  441. * handler needs to be able to wait for further keyboard interrupts, which can't
  442. * come through until ia64_eoi() has been done.
  443. */
  444. irq_exit();
  445. set_irq_regs(old_regs);
  446. }
  447. #ifdef CONFIG_HOTPLUG_CPU
  448. /*
  449. * This function emulates a interrupt processing when a cpu is about to be
  450. * brought down.
  451. */
  452. void ia64_process_pending_intr(void)
  453. {
  454. ia64_vector vector;
  455. unsigned long saved_tpr;
  456. extern unsigned int vectors_in_migration[NR_IRQS];
  457. vector = ia64_get_ivr();
  458. irq_enter();
  459. saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
  460. ia64_srlz_d();
  461. /*
  462. * Perform normal interrupt style processing
  463. */
  464. while (vector != IA64_SPURIOUS_INT_VECTOR) {
  465. int irq = local_vector_to_irq(vector);
  466. if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
  467. smp_local_flush_tlb();
  468. kstat_incr_irq_this_cpu(irq);
  469. } else if (unlikely(IS_RESCHEDULE(vector))) {
  470. kstat_incr_irq_this_cpu(irq);
  471. } else {
  472. struct pt_regs *old_regs = set_irq_regs(NULL);
  473. ia64_setreg(_IA64_REG_CR_TPR, vector);
  474. ia64_srlz_d();
  475. /*
  476. * Now try calling normal ia64_handle_irq as it would have got called
  477. * from a real intr handler. Try passing null for pt_regs, hopefully
  478. * it will work. I hope it works!.
  479. * Probably could shared code.
  480. */
  481. if (unlikely(irq < 0)) {
  482. printk(KERN_ERR "%s: Unexpected interrupt "
  483. "vector %d on CPU %d not being mapped "
  484. "to any IRQ!!\n", __func__, vector,
  485. smp_processor_id());
  486. } else {
  487. vectors_in_migration[irq]=0;
  488. generic_handle_irq(irq);
  489. }
  490. set_irq_regs(old_regs);
  491. /*
  492. * Disable interrupts and send EOI
  493. */
  494. local_irq_disable();
  495. ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
  496. }
  497. ia64_eoi();
  498. vector = ia64_get_ivr();
  499. }
  500. irq_exit();
  501. }
  502. #endif
  503. #ifdef CONFIG_SMP
  504. static irqreturn_t dummy_handler (int irq, void *dev_id)
  505. {
  506. BUG();
  507. }
  508. static struct irqaction ipi_irqaction = {
  509. .handler = handle_IPI,
  510. .name = "IPI"
  511. };
  512. /*
  513. * KVM uses this interrupt to force a cpu out of guest mode
  514. */
  515. static struct irqaction resched_irqaction = {
  516. .handler = dummy_handler,
  517. .name = "resched"
  518. };
  519. static struct irqaction tlb_irqaction = {
  520. .handler = dummy_handler,
  521. .name = "tlb_flush"
  522. };
  523. #endif
  524. void
  525. ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action)
  526. {
  527. unsigned int irq;
  528. irq = vec;
  529. BUG_ON(bind_irq_vector(irq, vec, CPU_MASK_ALL));
  530. irq_set_status_flags(irq, IRQ_PER_CPU);
  531. irq_set_chip(irq, &irq_type_ia64_lsapic);
  532. if (action)
  533. setup_irq(irq, action);
  534. irq_set_handler(irq, handle_percpu_irq);
  535. }
  536. void __init
  537. ia64_native_register_ipi(void)
  538. {
  539. #ifdef CONFIG_SMP
  540. register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
  541. register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction);
  542. register_percpu_irq(IA64_IPI_LOCAL_TLB_FLUSH, &tlb_irqaction);
  543. #endif
  544. }
  545. void __init
  546. init_IRQ (void)
  547. {
  548. #ifdef CONFIG_ACPI
  549. acpi_boot_init();
  550. #endif
  551. ia64_register_ipi();
  552. register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
  553. #ifdef CONFIG_SMP
  554. #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG)
  555. if (vector_domain_type != VECTOR_DOMAIN_NONE)
  556. register_percpu_irq(IA64_IRQ_MOVE_VECTOR, &irq_move_irqaction);
  557. #endif
  558. #endif
  559. #ifdef CONFIG_PERFMON
  560. pfm_init_percpu();
  561. #endif
  562. platform_irq_init();
  563. }
  564. void
  565. ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect)
  566. {
  567. void __iomem *ipi_addr;
  568. unsigned long ipi_data;
  569. unsigned long phys_cpu_id;
  570. phys_cpu_id = cpu_physical_id(cpu);
  571. /*
  572. * cpu number is in 8bit ID and 8bit EID
  573. */
  574. ipi_data = (delivery_mode << 8) | (vector & 0xff);
  575. ipi_addr = ipi_base_addr + ((phys_cpu_id << 4) | ((redirect & 1) << 3));
  576. writeq(ipi_data, ipi_addr);
  577. }