From patchwork Wed Mar 27 19:39:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1067363 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OygyrGTs"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44TyzK2P1Zz9sNg for ; Thu, 28 Mar 2019 06:40:54 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 56250C21E90; Wed, 27 Mar 2019 19:40:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0624BC21DF3; Wed, 27 Mar 2019 19:40:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B4EC3C21DA1; Wed, 27 Mar 2019 19:40:43 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by lists.denx.de (Postfix) with ESMTPS id 3FBBAC21DED for ; Wed, 27 Mar 2019 19:40:43 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id y13so2315576wrd.3 for ; Wed, 27 Mar 2019 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CDgelYvjiutqmDIXxDpHoqrF+NEdX8yLa0geDxnGqKk=; b=OygyrGTsbcStm9nLE4lEzBoxY0rzaBaHNUGl0Ug8IgfClUktY/F/2P84KdOXAGXEI6 bmYnEW1h2/d+Ku0jczoMKdLyZQNdQdVKRrt5iTqGvQBHNtm3d85ioH37sO2NmZLTBtuk 4CfLrLiNaDYft3sD+PWqVRIhXResj14t9xcdEudD8LBj31hzKfVKJJOPPR7A174v3J98 aqvYomFsiDImFuO5/Zv9Xhdby8Dki1UaYZox/AybCJYIM+cC6y9+3MpUkLH2jKCtdoJh R8CX8V3aGaiJFKUCjMdofy6Uh3W/NTNSMxpfQgWV+mFf65Y+Xp+9cnFYfEA4vEt6j1NE hlXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CDgelYvjiutqmDIXxDpHoqrF+NEdX8yLa0geDxnGqKk=; b=mCP6bzZW+6BHT6AAdz78uHSjC4QYSdcg6HGLRrQO3mG+TWdAU2K23FvBM12LDI0nbQ XPMyQkv8gA0IAxLer1qXUyFnEdqYmQPVT74VKEMpL2p8og2m/no/Nbz+nACdEkVDIwZR mx+jgzNYzr+sswrzAXd6LXjCooeJ/IqhB+pcFKDxsQuwc1EVwnxZbKLCafG+wSBfPecb 4Dr1YauObNyAMPnhgjcvhIWSILJ8zQ6JKkptMYgoUS9DVZHQhL8ywF0sopNf9GrNZuYj RNcD+AlmrzDcjtErJuJQYDgynp7YsSSVsr4ee/J1YgZtsz9FLM4p9uFYNdROhpSqOw0T 0Cyg== X-Gm-Message-State: APjAAAVHVtFuJ/baP+9JUPhjDwjZCcvlxzA1lSV6znq6c/M24KGCjPFj HwIxXJ814/9HglFMJgiaAPSrkHH/ X-Google-Smtp-Source: APXvYqyUtf5d6Blr4ZKv6xiHAOWGzOV6/Mg2/hBKYh+E3tBpr/W3Jy2dbbcTZpCvgliOM4DonTgK3w== X-Received: by 2002:a5d:6947:: with SMTP id r7mr23232431wrw.167.1553715642811; Wed, 27 Mar 2019 12:40:42 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:113a:1a5f:8497:9ca8]) by smtp.gmail.com with ESMTPSA id v16sm27324357wro.48.2019.03.27.12.40.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2019 12:40:42 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Wed, 27 Mar 2019 20:39:02 +0100 Message-Id: <20190327193907.30654-2-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190327193907.30654-1-simon.k.r.goldschmidt@gmail.com> References: <20190327193907.30654-1-simon.k.r.goldschmidt@gmail.com> Cc: Tien Fong Chee , Fabio Estevam Subject: [U-Boot] [PATCH v3 1/6] spl: add Kconfig option to clear bss early X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This introduces a new Kconfig option SPL_CLEAR_BSS_F. If enabled, it clears the bss before calling board_init_f() instead of clearing it before calling board_init_r(). This also ensures that variables placed in BSS can be shared between board_init_f() and board_init_r() in SPL. Such global variables are used, for example, when loading things from FAT before SDRAM is available: the full heap required for FAT uses global variables and clearing BSS after board_init_f() would reset the heap state. An example for such a usage is socfpa_arria10 where an FPGA configuration is required before SDRAM can be used. Make the new option depend on ARM for now until more implementations follow. Signed-off-by: Simon Goldschmidt --- Changes in v3: - improve commit message to show why CONFIG_CLEAR_BSS_F is needed Changes in v2: - make CONFIG_SPL_CLEAR_BSS_F depend on ARM for now common/spl/Kconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 206c24076d..6a4270516a 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -156,6 +156,18 @@ config SPL_STACK_R_MALLOC_SIMPLE_LEN to give board_init_r() a larger heap then the initial heap in SRAM which is limited to SYS_MALLOC_F_LEN bytes. +config SPL_CLEAR_BSS_F + bool "Clear BSS section before calling board_init_f" + depends on ARM + help + The BSS section is initialized to zero. In SPL, this is normally done + before calling board_init_r(). + For platforms using BSS in board_init_f() already, enable this to + clear the BSS section before calling board_init_f() instead of + clearing it before calling board_init_r(). This also ensures that + variables placed in BSS can be shared between board_init_f() and + board_init_r(). + config SPL_SEPARATE_BSS bool "BSS section is in a different memory region from text" help