platsmp.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * SMP operations for Alpine platform.
  3. *
  4. * Copyright (C) 2015 Annapurna Labs Ltd.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #include <linux/init.h>
  17. #include <linux/errno.h>
  18. #include <linux/io.h>
  19. #include <linux/of.h>
  20. #include <asm/smp_plat.h>
  21. #include "alpine_cpu_pm.h"
  22. static int alpine_boot_secondary(unsigned int cpu, struct task_struct *idle)
  23. {
  24. phys_addr_t addr;
  25. addr = virt_to_phys(secondary_startup);
  26. if (addr > (phys_addr_t)(uint32_t)(-1)) {
  27. pr_err("FAIL: resume address over 32bit (%pa)", &addr);
  28. return -EINVAL;
  29. }
  30. return alpine_cpu_wakeup(cpu_logical_map(cpu), (uint32_t)addr);
  31. }
  32. static void __init alpine_smp_prepare_cpus(unsigned int max_cpus)
  33. {
  34. alpine_cpu_pm_init();
  35. }
  36. static const struct smp_operations alpine_smp_ops __initconst = {
  37. .smp_prepare_cpus = alpine_smp_prepare_cpus,
  38. .smp_boot_secondary = alpine_boot_secondary,
  39. };
  40. CPU_METHOD_OF_DECLARE(alpine_smp, "al,alpine-smp", &alpine_smp_ops);