smp.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * SMP Support
  4. *
  5. * Copyright (C) 1999 VA Linux Systems
  6. * Copyright (C) 1999 Walt Drummond <[email protected]>
  7. * (c) Copyright 2001-2003, 2005 Hewlett-Packard Development Company, L.P.
  8. * David Mosberger-Tang <[email protected]>
  9. * Bjorn Helgaas <[email protected]>
  10. */
  11. #ifndef _ASM_IA64_SMP_H
  12. #define _ASM_IA64_SMP_H
  13. #include <linux/init.h>
  14. #include <linux/threads.h>
  15. #include <linux/kernel.h>
  16. #include <linux/cpumask.h>
  17. #include <linux/bitops.h>
  18. #include <linux/irqreturn.h>
  19. #include <asm/param.h>
  20. #include <asm/processor.h>
  21. #include <asm/ptrace.h>
  22. static inline unsigned int
  23. ia64_get_lid (void)
  24. {
  25. union {
  26. struct {
  27. unsigned long reserved : 16;
  28. unsigned long eid : 8;
  29. unsigned long id : 8;
  30. unsigned long ignored : 32;
  31. } f;
  32. unsigned long bits;
  33. } lid;
  34. lid.bits = ia64_getreg(_IA64_REG_CR_LID);
  35. return lid.f.id << 8 | lid.f.eid;
  36. }
  37. #define hard_smp_processor_id() ia64_get_lid()
  38. #ifdef CONFIG_SMP
  39. #define raw_smp_processor_id() (current_thread_info()->cpu)
  40. extern struct smp_boot_data {
  41. int cpu_count;
  42. int cpu_phys_id[NR_CPUS];
  43. } smp_boot_data __initdata;
  44. extern char no_int_routing;
  45. extern cpumask_t cpu_core_map[NR_CPUS];
  46. DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
  47. extern int smp_num_siblings;
  48. extern void __iomem *ipi_base_addr;
  49. extern volatile int ia64_cpu_to_sapicid[];
  50. #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
  51. extern unsigned long ap_wakeup_vector;
  52. /*
  53. * Function to map hard smp processor id to logical id. Slow, so don't use this in
  54. * performance-critical code.
  55. */
  56. static inline int
  57. cpu_logical_id (int cpuid)
  58. {
  59. int i;
  60. for (i = 0; i < NR_CPUS; ++i)
  61. if (cpu_physical_id(i) == cpuid)
  62. break;
  63. return i;
  64. }
  65. /* Upping and downing of CPUs */
  66. extern int __cpu_disable (void);
  67. extern void __cpu_die (unsigned int cpu);
  68. extern void cpu_die (void) __attribute__ ((noreturn));
  69. extern void __init smp_build_cpu_map(void);
  70. extern void __init init_smp_config (void);
  71. extern void smp_do_timer (struct pt_regs *regs);
  72. extern irqreturn_t handle_IPI(int irq, void *dev_id);
  73. extern void smp_send_reschedule (int cpu);
  74. extern void identify_siblings (struct cpuinfo_ia64 *);
  75. extern int is_multithreading_enabled(void);
  76. extern void arch_send_call_function_single_ipi(int cpu);
  77. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  78. #else /* CONFIG_SMP */
  79. #define cpu_logical_id(i) 0
  80. #define cpu_physical_id(i) ia64_get_lid()
  81. #endif /* CONFIG_SMP */
  82. #endif /* _ASM_IA64_SMP_H */