[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCHv4 39/43] plat/kvm: Swith away from boot stack


  • To: <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <simon.kuenzer@xxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Fri, 6 Jul 2018 09:03:52 +0000
  • Authentication-results: spf=fail (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
  • Cc: Kaly.Xin@xxxxxxx, nd@xxxxxxx, wei.chen@xxxxxxx
  • Delivery-date: Fri, 06 Jul 2018 09:06:03 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

The boot stack is used for system initialization. This size
is limited, after we have done the initialization, we should
switch away from it as soon as possible. We will use the
memory top as the new stack's top address.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
 plat/kvm/arm/entry64.S | 11 +++++++++++
 plat/kvm/arm/setup.c   | 17 +++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/plat/kvm/arm/entry64.S b/plat/kvm/arm/entry64.S
index 2ef7e2d..62a91de 100644
--- a/plat/kvm/arm/entry64.S
+++ b/plat/kvm/arm/entry64.S
@@ -69,3 +69,14 @@ ENTRY(_libkvmplat_entry)
        ldr x0, =_dtb
        b _libkvmplat_start
 END(_libkvmplat_entry)
+
+ENTRY(_libkvmplat_newstack)
+       /* Setup new stack */
+       mov sp, x0
+
+       /* Setup parameter for _libkvmplat_entry2 */
+       mov x0, x2
+
+       /* Branch to _libkvmplat_entry2 */
+       br x1
+END(_libkvmplat_newstack)
diff --git a/plat/kvm/arm/setup.c b/plat/kvm/arm/setup.c
index b7f3e47..079a67d 100644
--- a/plat/kvm/arm/setup.c
+++ b/plat/kvm/arm/setup.c
@@ -49,6 +49,9 @@ void *_libkvmplat_dtb;
 
 int psci_method;
 
+extern void _libkvmplat_newstack(uint64_t stack_start,
+                       void (*tramp)(void *), void *arg);
+
 static void _init_dtb(void *dtb_pointer)
 {
        int ret;
@@ -171,6 +174,11 @@ static void _init_cpufeatures(void)
        /* TODO */
 }
 
+static void _libkvmplat_entry2(void *arg __attribute__((unused)))
+{
+       ukplat_entry_argp(NULL, cmdline, sizeof(cmdline));
+}
+
 void _libkvmplat_start(void *dtb_pointer)
 {
        _init_dtb(dtb_pointer);
@@ -191,4 +199,13 @@ void _libkvmplat_start(void *dtb_pointer)
        uk_printd(DLVL_INFO, "pagetable start: %p\n", _libkvmplat_pagetable);
        uk_printd(DLVL_INFO, "     heap start: %p\n", _libkvmplat_heap_start);
        uk_printd(DLVL_INFO, "      stack top: %p\n", _libkvmplat_stack_top);
+
+       /*
+        * Switch away from the bootstrap stack as early as possible.
+        */
+       uk_printd(DLVL_INFO, "Switch from bootstrap stack to stack @%p\n",
+                               _libkvmplat_stack_top);
+
+       _libkvmplat_newstack((uint64_t) _libkvmplat_stack_top,
+                               _libkvmplat_entry2, NULL);
 }
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.