From 16b3bfa4f74942d9c2f49159715008d8d93c0f2d Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 7 Jan 2020 00:40:35 +0000 Subject: [PATCH 1/2] ibm, client-architecture-support: Fix stack handling RH-Author: David Gibson Message-id: <20200107004037.421470-2-dgibson@redhat.com> Patchwork-id: 93280 O-Subject: [RHEL-AV-8.2.0 SLOF PATCH 1/2] ibm, client-architecture-support: Fix stack handling Bugzilla: 1778704 RH-Acked-by: Laurent Vivier RH-Acked-by: Thomas Huth RH-Acked-by: Miroslav Rezanina From: Alexey Kardashevskiy fdt-fix-cas-node returns the end address after it's finished which the caller (ibm,client-architecture-support) does not use or drop. This renames fdt-fix-cas-node to (fdt-fix-cas-node) and adds a wrapper on top of that which does the drop. This will be used later for 2-pass tree patching. While at this, exit the function if memory allocation failed. Signed-off-by: Alexey Kardashevskiy (cherry picked from commit c50195e007319bf39c5315289ab93a2d7d02828b) Signed-off-by: David Gibson Signed-off-by: Danilo C. L. de Paula --- board-qemu/slof/archsupport.fs | 8 ++++++-- board-qemu/slof/fdt.fs | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/board-qemu/slof/archsupport.fs b/board-qemu/slof/archsupport.fs index 33ea765..6512d57 100644 --- a/board-qemu/slof/archsupport.fs +++ b/board-qemu/slof/archsupport.fs @@ -18,7 +18,11 @@ \ to come back to right boot device \ Allocate memory for H_CALL cas-buffer-size alloc-mem ( vec memaddr ) - dup 0= IF ." out of memory during ibm,client-architecture-support" cr THEN + dup 0= IF + ." out of memory during ibm,client-architecture-support" cr + 2drop TRUE + EXIT + THEN swap over cas-buffer-size ( memaddr vec memaddr size ) \ make h_call to hypervisor hv-cas 0= IF ( memaddr ) @@ -28,7 +32,7 @@ dup 4 + fdt-init fdt-check-header fdt-struct fdt-fix-cas-node - fdt-fix-cas-success NOT + fdt-fix-cas-success NOT ( memaddr err? ) s" /" find-node fdt-fix-phandles ELSE FALSE diff --git a/board-qemu/slof/fdt.fs b/board-qemu/slof/fdt.fs index 3e4c1b3..5ece270 100644 --- a/board-qemu/slof/fdt.fs +++ b/board-qemu/slof/fdt.fs @@ -394,7 +394,7 @@ r> drop find-node ?dup 0 <> IF set-node THEN ; -: fdt-fix-cas-node ( start -- end ) +: (fdt-fix-cas-node) ( start -- end ) recursive fdt-next-tag dup OF_DT_BEGIN_NODE <> IF ." Error " cr @@ -435,7 +435,7 @@ r> drop ELSE dup OF_DT_BEGIN_NODE = IF drop ( drop tag ) 4 - - fdt-fix-cas-node + (fdt-fix-cas-node) get-parent set-node fdt-debug IF ." Returning back " pwd cr THEN ELSE @@ -449,6 +449,10 @@ r> drop drop \ drop tag ; +: fdt-fix-cas-node ( start -- ) + (fdt-fix-cas-node) drop +; + : fdt-fix-cas-success fdt-cas-fix? ; -- 1.8.3.1