0009-riscv-hang-if-relocation-of-secondary-harts-fails.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 8ac39e2974d9f1395969a500e692f45717c4ccf2 Mon Sep 17 00:00:00 2001
  2. From: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
  3. Date: Sun, 17 Mar 2019 19:28:40 +0100
  4. Subject: [PATCH 09/18] riscv: hang if relocation of secondary harts fails
  5. Print an error message and hang if smp_call_function() returns an error,
  6. indicating that relocation of the secondary harts has failed.
  7. Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
  8. Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
  9. Tested-by: Bin Meng <bmeng.cn@gmail.com>
  10. Reviewed-by: Anup Patel <anup.patel@wdc.com>
  11. ---
  12. arch/riscv/cpu/start.S | 13 ++++++++++++-
  13. 1 file changed, 12 insertions(+), 1 deletion(-)
  14. diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S
  15. index 5ac899b141..a4433fbd6b 100644
  16. --- a/arch/riscv/cpu/start.S
  17. +++ b/arch/riscv/cpu/start.S
  18. @@ -33,6 +33,10 @@
  19. #define SYM_SIZE 0x18
  20. #endif
  21. +.section .data
  22. +secondary_harts_relocation_error:
  23. + .ascii "Relocation of secondary harts has failed, error %d\n"
  24. +
  25. .section .text
  26. .globl _start
  27. _start:
  28. @@ -274,8 +278,15 @@ relocate_secondary_harts:
  29. mv a2, s3
  30. jal smp_call_function
  31. + /* hang if relocation of secondary harts has failed */
  32. + beqz a0, 1f
  33. + mv a1, a0
  34. + la a0, secondary_harts_relocation_error
  35. + jal printf
  36. + jal hang
  37. +
  38. /* restore relocation offset */
  39. - mv t6, s5
  40. +1: mv t6, s5
  41. #endif
  42. /*
  43. --
  44. 2.21.0