diff mbox series

[ImageBuilder,v2,1/2] uboot-script-gen: Add XEN_STATIC_HEAP

Message ID 20230316090921.338472-2-jiamei.xie@arm.com (mailing list archive)
State Superseded
Headers show
Series uboot-script-gen: Add support for static heap and shared memory | expand

Commit Message

Jiamei Xie March 16, 2023, 9:09 a.m. UTC
From: jiamei Xie <jiamei.xie@arm.com>

Add a new config parameter to configure Xen static heap.
XEN_STATIC_HEAP="baseaddr1 size1 ... baseaddrN sizeN"
if specified, indicates the host physical address regions
[baseaddr, baseaddr + size) to be reserved as Xen static heap.

For instance, XEN_STATIC_HEAP="0x50000000 0x30000000", if specified,
indicates the host memory region starting from paddr 0x50000000
with a size of 0x30000000 to be reserved as static heap.

Signed-off-by: jiamei Xie <jiamei.xie@arm.com>
---
Changes from v1:
 - Rename STATIC_HEAP to XEN_STATIC_HEAP and move it right after
   XEN_CMD documentation.
 - Use split_value function instead of opencoding it.
---
 README.md                |  4 ++++
 scripts/uboot-script-gen | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

Comments

Michal Orzel March 16, 2023, 9:15 a.m. UTC | #1
On 16/03/2023 10:09, jiamei.xie wrote:
> 
> 
> From: jiamei Xie <jiamei.xie@arm.com>
> 
> Add a new config parameter to configure Xen static heap.
> XEN_STATIC_HEAP="baseaddr1 size1 ... baseaddrN sizeN"
> if specified, indicates the host physical address regions
> [baseaddr, baseaddr + size) to be reserved as Xen static heap.
> 
> For instance, XEN_STATIC_HEAP="0x50000000 0x30000000", if specified,
> indicates the host memory region starting from paddr 0x50000000
> with a size of 0x30000000 to be reserved as static heap.
> 
> Signed-off-by: jiamei Xie <jiamei.xie@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal
Stefano Stabellini March 17, 2023, 1:05 a.m. UTC | #2
On Thu, 16 Mar 2023, Michal Orzel wrote:
> On 16/03/2023 10:09, jiamei.xie wrote:
> > From: jiamei Xie <jiamei.xie@arm.com>
> > 
> > Add a new config parameter to configure Xen static heap.
> > XEN_STATIC_HEAP="baseaddr1 size1 ... baseaddrN sizeN"
> > if specified, indicates the host physical address regions
> > [baseaddr, baseaddr + size) to be reserved as Xen static heap.
> > 
> > For instance, XEN_STATIC_HEAP="0x50000000 0x30000000", if specified,
> > indicates the host memory region starting from paddr 0x50000000
> > with a size of 0x30000000 to be reserved as static heap.
> > 
> > Signed-off-by: jiamei Xie <jiamei.xie@arm.com>
> Reviewed-by: Michal Orzel <michal.orzel@amd.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>
diff mbox series

Patch

diff --git a/README.md b/README.md
index 814a004..78b83f1 100644
--- a/README.md
+++ b/README.md
@@ -97,6 +97,10 @@  Where:
 - XEN_CMD specifies the command line arguments used for Xen.  If not
   set, the default one will be used.
 
+- XEN_STATIC_HEAP="baseaddr1 size1 ... baseaddrN sizeN"
+  if specified, indicates the host physical address regions
+  [baseaddr, baseaddr + size) to be reserved as Xen static heap.
+
 - PASSTHROUGH_DTS_REPO specifies the git repository and/or the directory
   which contains the partial device trees. This is optional. However, if
   this is specified, then DOMU_PASSTHROUGH_PATHS[number] need to be specified.
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index f07e334..cca3e59 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -189,6 +189,21 @@  function add_device_tree_static_mem()
     dt_set "$path" "xen,static-mem" "hex" "${cells[*]}"
 }
 
+function add_device_tree_xen_static_heap()
+{
+    local path=$1
+    local regions=$2
+    local cells=()
+    local val
+
+    for val in ${regions[@]}
+    do
+        cells+=("$(split_value $val)")
+    done
+
+    dt_set "$path" "xen,static-heap" "hex" "${cells[*]}"
+}
+
 function add_device_tree_cpupools()
 {
     local cpu
@@ -344,6 +359,11 @@  function xen_device_tree_editing()
     then
         add_device_tree_cpupools
     fi
+
+    if test "${XEN_STATIC_HEAP}"
+    then
+        add_device_tree_xen_static_heap "/chosen" "${XEN_STATIC_HEAP}"
+    fi
 }
 
 function linux_device_tree_editing()