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

[Minios-devel] [UNIKRAFT PATCHv6 31/37] plat/kvm: Swith away from boot stack


  • To: <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <simon.kuenzer@xxxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Fri, 14 Sep 2018 07:57:04 +0000
  • Authentication-results: spf=pass (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=bestguesspass action=none header.from=arm.com;
  • Cc: Kaly.Xin@xxxxxxx, nd@xxxxxxx, wei.chen@xxxxxxx
  • Delivery-date: Fri, 14 Sep 2018 07:58:58 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

From: Wei Chen <Wei.Chen@xxxxxxx>

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>
Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 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 850b7e8..f1bbeb6 100644
--- a/plat/kvm/arm/entry64.S
+++ b/plat/kvm/arm/entry64.S
@@ -94,3 +94,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 3927507..7423e8b 100644
--- a/plat/kvm/arm/setup.c
+++ b/plat/kvm/arm/setup.c
@@ -36,6 +36,9 @@ static char cmdline[MAX_CMDLINE_SIZE];
 
 smcc_psci_callfn_t smcc_psci_call;
 
+extern void _libkvmplat_newstack(uint64_t stack_start,
+                       void (*tramp)(void *), void *arg);
+
 static void _init_dtb(void *dtb_pointer)
 {
        int ret;
@@ -178,6 +181,11 @@ enocmdl:
        strcpy(cmdline, CONFIG_UK_NAME);
 }
 
+static void _libkvmplat_entry2(void *arg __attribute__((unused)))
+{
+       ukplat_entry_argp(NULL, (char *)cmdline, strlen(cmdline));
+}
+
 void _libkvmplat_start(void *dtb_pointer)
 {
        _init_dtb(dtb_pointer);
@@ -198,4 +206,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®.