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

[ImageBuilder v2] Add support for 64-bit addresses/sizes


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 10 Oct 2022 09:29:47 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/RAfJpdwynmbz/rlQlWCjryMbpbTDFitdlWEPh1RlAQ=; b=cVN013k3gJGLmFgsh0AFgQZKCLC6W4A+N2Ow9oghoq6cntitoRj7sMb2xGcPtdcxNbcq6thZUC5op6/2kBySrIcbTIqdeubyEx1HWbBfkFM7ZK59/UF1CxBFT2iZBM3vampkHIVrA4QcMDpSO8WPeVsQ0F9hiDxcFLUk6XwU0ZJJotQ3kjH5moJqdL0JzxTAMB3tt9FYHe70tpq0H42J9lX3h5E1T+xnPQHuWP06+Cka2K44vjVVeo0QlwqEvAZdFdB9zFB4d9PcL1pHHmrR2+zHtAdIVxAHlS61y8JKYnh7xZITE+IVfvDuj/fmeuAgW9a9mCCWOr8PmZMkpXKj5Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z67TUcNQKzIfbwKP5sQTnuLFlbqa7beqiafxZORXa7cF88nYhJJZVkwzBzLpnFfsrxqJuwMfGLQ4hGqoEqpMfzK+0VeoPzgTQh4GDzfJ++m2TcAUP10MILyOmFczegXEG2JRtjFV1XD8tIr1oCZILrujavc1Qxtq1ecr/gDtcaKjlTxshS2QjrugrdkD4Yrk+2MYdTY2wBzXTFynwcfSfk3VIepIuYO9uea9C+BUKVAtBu04f3L4D+aj6lrvN2kyAJibHSS1DWEY+0ddZqo4e0S2MzUyYeI2REUyTsI3oU6r7cPZDfwBzQIxDTVnjmQuk7ImIu5WEUehVCVqKB25Mg==
  • Cc: <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Mon, 10 Oct 2022 07:30:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

At the moment, ImageBuilder assumes that all addresses/sizes are
32-bit max. It sets #{address,size}-cells to 0x2 and puts 0x0 as the
value for the first cell. Because of that, we cannot specify
MEMORY_START and MEMORY_END to be above 32-bits (e.g. to place the images
in the upper memory bank).

Add support to properly handle 64-bit addresses/sizes:
 - add function split_into_halves to split the value passed as a first
   argument into upper and lower halves. These are then set as values for
   variables passed respetively as the second and third argument,
 - add function split_addr_size to split address and size and form a
   string to be passed to dt_set as data argument for reg property.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
Changes in v2:
- redesign a patch based on master-next instead of NXP dynamic assignment patch
---
 scripts/uboot-script-gen | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index b24dca2b7f7e..09d237d192c1 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -22,6 +22,29 @@ function dt_mknode()
     fi
 }
 
+# Usage:
+# split_into_halves <value> <variable_to_store_upper> <variable_to_store_lower>
+function split_into_halves()
+{
+    local value=$1
+    local upper=$2
+    local lower=$3
+
+    eval "$upper=$(printf "0x%X\n" $(($value >> 32)))"
+    eval "$lower=$(printf "0x%X\n" $(($value & 0xFFFFFFFF)))"
+}
+
+function split_addr_size()
+{
+    local addr=$1
+    local size=$2
+
+    split_into_halves $addr addr_upper addr_lower
+    split_into_halves $size size_upper size_lower
+
+    echo "$addr_upper $addr_lower $size_upper $size_lower"
+}
+
 # data_type is either
 #   int
 #   hex
@@ -93,7 +116,7 @@ function add_device_tree_kernel()
 
     dt_mknode "$path" "module$addr"
     dt_set "$path/module$addr" "compatible" "str_a" "multiboot,kernel 
multiboot,module"
-    dt_set "$path/module$addr" "reg" "hex"  "0x0 $addr 0x0 $(printf "0x%x" 
$size)"
+    dt_set "$path/module$addr" "reg" "hex"  "$(split_addr_size $addr $size)"
     dt_set "$path/module$addr" "bootargs" "str" "$bootargs"
 }
 
@@ -106,7 +129,7 @@ function add_device_tree_ramdisk()
 
     dt_mknode "$path"  "module$addr"
     dt_set "$path/module$addr" "compatible" "str_a" "multiboot,ramdisk 
multiboot,module"
-    dt_set "$path/module$addr" "reg" "hex"  "0x0 $addr 0x0 $(printf "0x%x" 
$size)"
+    dt_set "$path/module$addr" "reg" "hex"  "$(split_addr_size $addr $size)"
 }
 
 
@@ -118,7 +141,7 @@ function add_device_tree_passthrough()
 
     dt_mknode "$path"  "module$addr"
     dt_set "$path/module$addr" "compatible" "str_a" "multiboot,device-tree 
multiboot,module"
-    dt_set "$path/module$addr" "reg" "hex"  "0x0 $addr 0x0 $(printf "0x%x" 
$size)"
+    dt_set "$path/module$addr" "reg" "hex"  "$(split_addr_size $addr $size)"
 }
 
 function add_device_tree_mem()
@@ -260,7 +283,7 @@ function xen_device_tree_editing()
     then
         dt_mknode "/chosen" "dom0"
         dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage 
xen,multiboot-module multiboot,module"
-        dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf 
"0x%x" $dom0_kernel_size)"
+        dt_set "/chosen/dom0" "reg" "hex" "$(split_addr_size $dom0_kernel_addr 
$dom0_kernel_size)"
         dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD"
     fi
 
@@ -268,7 +291,7 @@ function xen_device_tree_editing()
     then
         dt_mknode "/chosen" "dom0-ramdisk"
         dt_set "/chosen/dom0-ramdisk" "compatible" "str_a" "xen,linux-initrd 
xen,multiboot-module multiboot,module"
-        dt_set "/chosen/dom0-ramdisk" "reg" "hex" "0x0 $ramdisk_addr 0x0 
$(printf "0x%x" $ramdisk_size)"
+        dt_set "/chosen/dom0-ramdisk" "reg" "hex" "$(split_addr_size 
$ramdisk_addr $ramdisk_size)"
     fi
 
     i=0
-- 
2.25.1




 


Rackspace

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