Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47B23C54EE9 for ; Tue, 13 Sep 2022 18:31:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2CAB984AED; Tue, 13 Sep 2022 20:31:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PD9bO/ZQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 26A2C8020D; Tue, 13 Sep 2022 20:31:46 +0200 (CEST) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6A8B484A8A for ; Tue, 13 Sep 2022 20:31:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-wr1-x42e.google.com with SMTP id h8so15194670wrf.3 for ; Tue, 13 Sep 2022 11:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=B4KrhPv6I/6vsX4NzKVoWywbYfMRz/fT8xb3DlNGF+g=; b=PD9bO/ZQOWypQqBxnpKr8TJfqwiA1HvuIJjSeVu5VUSNkpPIPpFgS3AGRsxkROqk5h 7okfJU42rCuvFbke1+fssDqCDklySXkAMH2rBz4X8E0yCaVpB0bJr5j1avmPJsVNBIyp Z5VpztmbNgFvjFuiRNgK3TE9N1whSv7dXk42DpsGBHykyMZtWDolJQ/ATuFeDmY31SMr 15n/XAq8OoorBW6B7ZKl4av7djEdvcd/T8pXY8MfjH6R5C/RQz22WG7THeF29pv6QPcg 3SdJGgNAdSXr89zVojaLvFQYb06hhAYNe1tAHeRfPTilK/OJuKWFm/LehsQO8DCGBuwv VcNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=B4KrhPv6I/6vsX4NzKVoWywbYfMRz/fT8xb3DlNGF+g=; b=5rQGNnONRvFk+iYtyQxHR2gaPnpBERYLxF52qjTjArveBWT+vmHpAdhyPWBiI7Gvj2 5V1wZpSs4lTNOxAFvW2jTXMehV1/m80CnakbawWUvRB0kwZqPP2KmUwtcwDQL2s506oV 9gGHeQ43vhGJjKXE3SZfebm2m80zM9bVFu4s4sVCMABTmL6Sl/ywWpFlC3Z33uLHy9BU HozG3NPv+hitNQrqsF/MJZLJiFvTPJGzxb4P+7bTJuwcXthC1qY6hqfJZKS5j7DdPyDt uCCGK2ZQ1PBMWVf6nCiHsPHhW+EzgArxTWoyi84qBlKE9hzvU3VJYdlHGdJ2xLAiRSA9 Y8FA== X-Gm-Message-State: ACgBeo3UjWYWdGsuHmvL75ka3uVnbisUbrPKh8OcpNrgp7AMFC+68wEx ZRcmRJiaOH2d/jwz0R94zdO3KIww11U= X-Google-Smtp-Source: AA6agR4pckYVFwj8Pv5y+16LAhVtTFcj+l/oKhuGKCUvwFY1EKvxWOVRRM5plPN7rXClEjA6L35A3g== X-Received: by 2002:adf:e781:0:b0:228:b44c:d0f7 with SMTP id n1-20020adfe781000000b00228b44cd0f7mr18084623wrm.243.1663093902817; Tue, 13 Sep 2022 11:31:42 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c700:bc00:2edf:22a1:3a82:86b4]) by smtp.gmail.com with ESMTPSA id o14-20020a5d684e000000b002287d99b455sm11156044wrw.15.2022.09.13.11.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Sep 2022 11:31:42 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Holger Brunck , Marek Vasut , Michal Simek , Rick Chen , Simon Glass , Wolfgang Denk Subject: [PATCH v2 1/4] common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code Date: Tue, 13 Sep 2022 21:31:26 +0300 Message-Id: <20220913183129.14184-1-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently commented out, so there are no users for this macro: #if 1 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2") #else /* We could use plain global data, but the resulting code is bigger */ #define XTRN_DECLARE_GLOBAL_DATA_PTR extern #define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \ gd_t *gd #endif Remove all references to this macro, but add a documentation note regarding the possibility of using plain global data for the GD pointer. Signed-off-by: Ovidiu Panait --- Changes in v2: - update global data documentation with the info provided by Wolfgang arch/powerpc/include/asm/global_data.h | 6 ------ common/board_f.c | 11 ----------- doc/develop/global_data.rst | 5 +++++ 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h index 6709e692e6..6ed21c781f 100644 --- a/arch/powerpc/include/asm/global_data.h +++ b/arch/powerpc/include/asm/global_data.h @@ -92,12 +92,6 @@ struct arch_global_data { #include -#if 1 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2") -#else /* We could use plain global data, but the resulting code is bigger */ -#define XTRN_DECLARE_GLOBAL_DATA_PTR extern -#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \ - gd_t *gd -#endif #endif /* __ASM_GBL_DATA_H */ diff --git a/common/board_f.c b/common/board_f.c index 18e2246733..f4238d4c90 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -57,18 +57,7 @@ #include #include -/* - * Pointer to initial global data area - * - * Here we initialize it if needed. - */ -#ifdef XTRN_DECLARE_GLOBAL_DATA_PTR -#undef XTRN_DECLARE_GLOBAL_DATA_PTR -#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */ -DECLARE_GLOBAL_DATA_PTR = (gd_t *)(CONFIG_SYS_INIT_GD_ADDR); -#else DECLARE_GLOBAL_DATA_PTR; -#endif /* * TODO(sjg@chromium.org): IMO this code should be diff --git a/doc/develop/global_data.rst b/doc/develop/global_data.rst index 2ac893de49..d143f27eed 100644 --- a/doc/develop/global_data.rst +++ b/doc/develop/global_data.rst @@ -36,6 +36,11 @@ On most architectures the global data pointer is stored in a register. The sandbox, x86_64, and Xtensa are notable exceptions. +Current implementation uses a register for the GD pointer because this results +in smaller code. However, using plain global data for the GD pointer would be +possible too (and simpler, as it does not require the reservation of a specific +register for it), but the resulting code is bigger. + Clang for ARM does not support assigning a global register. When using Clang gd is defined as an inline function using assembly code. This adds a few bytes to the code size. -- 2.25.1