]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/ukboot: Allocate bootstrap LCPU auxiliary stack
authorSergiu Moga <sergiu@unikraft.io>
Thu, 9 Nov 2023 19:16:03 +0000 (21:16 +0200)
committerSergiu Moga <sergiu@unikraft.io>
Sat, 25 Nov 2023 11:06:54 +0000 (13:06 +0200)
If shcheduling/multithreading is not enabled, allocate an auxiliary
stack for bootstrap LCPU. Otherwise, the LCPU will have the same
auxiliary stack as the thread that runs on it and this allocation is
not needed.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
lib/ukboot/Makefile.uk
lib/ukboot/boot.c

index fe1d20490715d3baf96e368d2402b85248b701a0..4efbeb2992965cca9b5148746e96846a66ca18d5 100644 (file)
@@ -2,6 +2,8 @@ $(eval $(call addlib_s,libukboot,$(CONFIG_LIBUKBOOT)))
 
 CINCLUDES-$(CONFIG_LIBUKBOOT)          += -I$(LIBUKBOOT_BASE)/include
 CXXINCLUDES-$(CONFIG_LIBUKBOOT)        += -I$(LIBUKBOOT_BASE)/include
+LIBUKBOOT_ASINCLUDES-y        += -I$(UK_PLAT_COMMON_BASE)/include
+LIBUKBOOT_CINCLUDES-y         += -I$(UK_PLAT_COMMON_BASE)/include
 
 LIBUKBOOT_SRCS-y += $(LIBUKBOOT_BASE)/boot.c
 LIBUKBOOT_SRCS-y += $(LIBUKBOOT_BASE)/version.c
index c37508b894233e4bda63545bf05057d655b2b55e..184cb8a397a1d1cde33a581af816075714bdc3ab 100644 (file)
 #include <uk/plat/tls.h>
 #include "banner.h"
 
+#if CONFIG_LIBUKBOOT_NOSCHED
+#include <uk/plat/common/lcpu.h>
+#endif /* CONFIG_LIBUKBOOT_NOSCHED */
+
 #if CONFIG_LIBUKINTCTLR
 #include <uk/intctlr.h>
 #endif /* CONFIG_LIBUKINTCTLR */
@@ -252,7 +256,7 @@ void ukplat_entry(int argc, char *argv[])
 #endif
 #if CONFIG_LIBUKSCHED
        struct uk_sched *s = NULL;
-#endif
+#endif /* CONFIG_LIBUKSCHED */
        uk_ctor_func_t *ctorfn;
        uk_init_func_t *initfn;
        int i;
@@ -337,7 +341,15 @@ void ukplat_entry(int argc, char *argv[])
        if (unlikely(!s))
                UK_CRASH("Failed to initialize scheduling\n");
        uk_sched_start(s);
-#endif /* !CONFIG_LIBUKBOOT_NOSCHED */
+#else /* CONFIG_LIBUKBOOT_NOSCHED */
+       struct lcpu *bsp_lcpu = lcpu_get_current();
+       UK_ASSERT(bsp_lcpu);
+       bsp_lcpu->auxsp = ukplat_auxsp_alloc(a,
+#if defined(CONFIG_LIBUKBOOT_HEAP_BASE) && defined(CONFIG_LIBUKVMEM)
+                                            &kernel_vas,
+#endif /* !CONFIG_LIBUKBOOT_HEAP_BASE && CONFIG_LIBUKVMEM */
+                                            0);  /* Default auxsp size */
+#endif /* CONFIG_LIBUKBOOT_NOSCHED */
 
        /* Enable interrupts before starting the application */
        ukplat_lcpu_enable_irq();