xen: Port Xen grant table driver from mini-os
Make required updates to run on u-boot.
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
diff --git a/board/xen/xenguest_arm64/xenguest_arm64.c b/board/xen/xenguest_arm64/xenguest_arm64.c
index c87ef70..cd36938 100644
--- a/board/xen/xenguest_arm64/xenguest_arm64.c
+++ b/board/xen/xenguest_arm64/xenguest_arm64.c
@@ -21,6 +21,7 @@
#include <linux/compiler.h>
+#include <xen/gnttab.h>
#include <xen/hvm.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -63,6 +64,8 @@
struct fdt_resource res;
const void *blob = gd->fdt_blob;
u64 gfn;
+ phys_addr_t gnttab_base;
+ phys_size_t gnttab_sz;
/*
* Add "magic" region which is used by Xen to provide some essentials
@@ -96,6 +99,16 @@
PTE_BLOCK_INNER_SHARE);
i++;
+ /* Get Xen's suggested physical page assignments for the grant table. */
+ get_gnttab_base(&gnttab_base, &gnttab_sz);
+
+ xen_mem_map[i].virt = gnttab_base;
+ xen_mem_map[i].phys = gnttab_base;
+ xen_mem_map[i].size = gnttab_sz;
+ xen_mem_map[i].attrs = (PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+ PTE_BLOCK_INNER_SHARE);
+ i++;
+
mem = get_next_memory_node(blob, -1);
if (mem < 0) {
printf("%s: Missing /memory node\n", __func__);