From patchwork Thu Dec 5 04:23:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1204467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47T2fL3Q0nz9sPJ for ; Thu, 5 Dec 2019 15:23:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.ru Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47T2fL1Gd6zDqXd for ; Thu, 5 Dec 2019 15:23:54 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.ru Received: from ozlabs.ru (unknown [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 47T2fF16zHzDqXL for ; Thu, 5 Dec 2019 15:23:48 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 6F279AE8000F; Wed, 4 Dec 2019 23:22:14 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Thu, 5 Dec 2019 15:23:15 +1100 Message-Id: <20191205042315.57703-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 Subject: [SLOF] [PATCH slof] ibm, client-architecture-support: Fix stack handling X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" 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 --- 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 33ea765c152b..6512d57d50ec 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 3e4c1b34b8af..5ece270f7c0b 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? ;