irq_ia64.c 15 KB

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