smp.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2012 Regents of the University of California
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _ASM_RISCV_SMP_H
  14. #define _ASM_RISCV_SMP_H
  15. /* This both needs asm-offsets.h and is used when generating it. */
  16. #ifndef GENERATING_ASM_OFFSETS
  17. #include <asm/asm-offsets.h>
  18. #endif
  19. #include <linux/cpumask.h>
  20. #include <linux/irqreturn.h>
  21. #ifdef CONFIG_SMP
  22. /* SMP initialization hook for setup_arch */
  23. void __init setup_smp(void);
  24. /* Hook for the generic smp_call_function_many() routine. */
  25. void arch_send_call_function_ipi_mask(struct cpumask *mask);
  26. /* Hook for the generic smp_call_function_single() routine. */
  27. void arch_send_call_function_single_ipi(int cpu);
  28. /*
  29. * This is particularly ugly: it appears we can't actually get the definition
  30. * of task_struct here, but we need access to the CPU this task is running on.
  31. * Instead of using C we're using asm-offsets.h to get the current processor
  32. * ID.
  33. */
  34. #define raw_smp_processor_id() (*((int*)((char*)get_current() + TASK_TI_CPU)))
  35. #endif /* CONFIG_SMP */
  36. #endif /* _ASM_RISCV_SMP_H */