0007-riscv-boot-images-passed-to-bootm-on-all-harts.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From f28ad250e6ef95ca58490b4e8651749d4f7e5c06 Mon Sep 17 00:00:00 2001
  2. From: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
  3. Date: Sun, 17 Mar 2019 19:28:38 +0100
  4. Subject: [PATCH 07/18] riscv: boot images passed to bootm on all harts
  5. Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
  6. Reviewed-by: Anup Patel <anup.patel@wdc.com>
  7. Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
  8. Tested-by: Bin Meng <bmeng.cn@gmail.com>
  9. ---
  10. arch/riscv/lib/bootm.c | 13 ++++++++++++-
  11. 1 file changed, 12 insertions(+), 1 deletion(-)
  12. diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
  13. index f36b8702ef..efbd3e23e7 100644
  14. --- a/arch/riscv/lib/bootm.c
  15. +++ b/arch/riscv/lib/bootm.c
  16. @@ -13,6 +13,7 @@
  17. #include <image.h>
  18. #include <asm/byteorder.h>
  19. #include <asm/csr.h>
  20. +#include <asm/smp.h>
  21. #include <dm/device.h>
  22. #include <dm/root.h>
  23. #include <u-boot/zlib.h>
  24. @@ -81,6 +82,9 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
  25. {
  26. void (*kernel)(ulong hart, void *dtb);
  27. int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
  28. +#ifdef CONFIG_SMP
  29. + int ret;
  30. +#endif
  31. kernel = (void (*)(ulong, void *))images->ep;
  32. @@ -92,8 +96,15 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
  33. announce_and_cleanup(fake);
  34. if (!fake) {
  35. - if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
  36. + if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
  37. +#ifdef CONFIG_SMP
  38. + ret = smp_call_function(images->ep,
  39. + (ulong)images->ft_addr, 0);
  40. + if (ret)
  41. + hang();
  42. +#endif
  43. kernel(gd->arch.boot_hart, images->ft_addr);
  44. + }
  45. }
  46. }
  47. --
  48. 2.21.0