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

[Minios-devel] [UNIKRAFT PATCHv5 33/46] plat/kvm: Initialize device tree for Arm64


  • To: <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <simon.kuenzer@xxxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Fri, 10 Aug 2018 07:08:23 +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, 10 Aug 2018 07:10:38 +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>

Arm64 entry code passed the base address of device tree
to _libkvmplat_start. We will check the device tree header
and then save the address for further usage.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
 plat/kvm/Config.uk   |  1 +
 plat/kvm/arm/setup.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
index c07f39b..c792ea1 100644
--- a/plat/kvm/Config.uk
+++ b/plat/kvm/Config.uk
@@ -6,6 +6,7 @@ menuconfig PLAT_KVM
        select LIBUKALLOC
        select LIBUKTIMECONV
        select LIBNOLIBC if !HAVE_LIBC
+       select LIBFDT if ARCH_ARM_64
        help
                 Create a Unikraft image that runs as a KVM guest
 
diff --git a/plat/kvm/arm/setup.c b/plat/kvm/arm/setup.c
index e2ece8e..19a90ae 100644
--- a/plat/kvm/arm/setup.c
+++ b/plat/kvm/arm/setup.c
@@ -18,9 +18,24 @@
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include <libfdt.h>
 #include <uk/assert.h>
 
+void *_libkvmplat_dtb;
+
+static void _init_dtb(void *dtb_pointer)
+{
+       int ret;
+
+       if ((ret = fdt_check_header(dtb_pointer)))
+               UK_CRASH("Invalid DTB: %s\n", fdt_strerror(ret));
+
+       _libkvmplat_dtb = dtb_pointer;
+       uk_printd(DLVL_INFO, "Found device tree on: %p\n", dtb_pointer);
+}
+
 void _libkvmplat_start(void *dtb_pointer)
 {
+       _init_dtb(dtb_pointer);
        uk_printd(DLVL_INFO, "Entering from KVM (arm64)...\n");
 }
-- 
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®.