From patchwork Fri Apr 4 13:50:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 878199 Delivered-To: patch@linaro.org Received: by 2002:a5d:6dae:0:b0:38f:210b:807b with SMTP id u14csp3793556wrs; Fri, 4 Apr 2025 06:51:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnlFmG5T2gih2pFGZDvs++S8aCE9vCupTaB9ujiscJYDNs8OE8yUaWwq3uY6jwQGhEqXdvtw==@linaro.org X-Google-Smtp-Source: AGHT+IGTtuxpBVXkNEngT2iX+44SJeGLFinH2+Xk03qt5uKauAxLSaNGYMfksxRt//k0psFLq3EK X-Received: by 2002:a05:6122:6593:b0:516:230b:eec with SMTP id 71dfb90a1353d-52765c89280mr1771313e0c.5.1743774664213; Fri, 04 Apr 2025 06:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1743774664; cv=none; d=google.com; s=arc-20240605; b=SysxS/wBSHvVPItz8/NaFq3w788C7JiEvNyCTvzBf2NDfUgfuzsVvedgYIwznpMfqy ziECOWbIqu/KCZjsPd+RNvlzH09NsmXEuqNytcrkUHZO6HBtxbSaVsnCo2YHlWDTgRtX nWltBaB/ivCeESjctOyviqtQ0kCc16gVu8zYiYyKTisJbgy9pib0mSsO0ByVouRe0o0F BOEK+/iJ0JuQmYnmK8iGj+GvMl661QLqoFFK/39ItsKVJokaDhsEF5cZHRLBvmkVT5t+ N9912NTgJH5Xtlife8aM8NoRhRevSaRzuf9T39bakvv5p+PuYXUbTc8/jIUkWw/BADOM 7s/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=BD1wUKKCrbUmp6rla3NY493cuhq1KXNYy19SiPqkWpg=; fh=h6aAVEeZBlEjv+vPa+An2K+XRkhpZcjcZcS2M4TGdaU=; b=dqZCSlNEeg7p2fuZYapXF89WuLqvUcVpL1tfRDN71AT0T3leXY2gP9iTZA14LNP0rc bkOHLnGMqbMettnZeCadRZxMSetze5G62Obdxfi0X/4XUmmWKMV0847V70hgbOIyKbaM /eNXhD7HJyXHxqac6AEpJmdxA3POBO6sXMFxznZa9zhIs0tU2gD8VBPcQia3gmHkpw62 RgWiBZrmY7m0qsaDx08kX2mwyCCTp8uuULrRRDiTivzuZOhRMC7vTfh2MX8JDBOe4IAs J+qa+zB1mU6i272zFQcwKv/P6J5YqdpuzXph2tuVeWDl+L2NxxD+EolYKS42icBEW1As oDuw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SFDDHFlX; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 71dfb90a1353d-5275afcab59si1158456e0c.254.2025.04.04.06.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Apr 2025 06:51:04 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SFDDHFlX; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8EA6E829C3; Fri, 4 Apr 2025 15:50:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="SFDDHFlX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FDD4829C7; Fri, 4 Apr 2025 15:50:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (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 E6B5B82991 for ; Fri, 4 Apr 2025 15:50:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wr1-x442.google.com with SMTP id ffacd0b85a97d-39727fe912cso999765f8f.3 for ; Fri, 04 Apr 2025 06:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743774655; x=1744379455; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BD1wUKKCrbUmp6rla3NY493cuhq1KXNYy19SiPqkWpg=; b=SFDDHFlX+rF7fnjj1ZksSXYHJfFUADimOqkcuHR/sfd1eI1KMMhDO9ugiGGN8V5KAa F/HTmuEo7iaYs4qfnmUfiKXr1Zdb9cjkjfwLCuoqnHurfxJaniooBSjTlra2g0jU6I4G yJBsO1rWIZzNc8BPUysURSvsGFteHqCx4lVYPKsDD6j+rzNs/+/F3Id2p3qvaYiDdy7v /F7Jl8LLqmZjNl5NV8LIjoIFKYnoSmaTVjODQ6oZmcuUqo6Btj6Znja4zqZz1LYxPGIw YR+U0KXkuHbZe7sW+rhlRr8chfGfv26n7wjYE+V2PrGQIxXPr8JdA8X3fyducy4Ds8K/ RA/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743774655; x=1744379455; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BD1wUKKCrbUmp6rla3NY493cuhq1KXNYy19SiPqkWpg=; b=ENmg7o+AIyHiw++oSFnPkVPy1S+F0W4YpjFkmP/s7Y5hO+SGa71EyB+9IENDP7+3oH XAuf2np6WVCoFawstCBr7Rem8ygh3+I0i8sIOPAiCwYCETAVc5Uw5Cz3yr49k6YJKXj2 fNwI5sUGUrbeL/mPMAr9hcSwcWBb49oSoiflEMDMO1sZhfkUcMJF8tqlWMdYPzHp9Vb6 DFG6ErFnj3FkPBzwGfCyvKyIw14FngjDhhkFlGhJagcuX+CgpHMT+WASlbKvCvze+D6j cTgW3FWUOplRHI1+KqXUiAL1gn66Lx7PnAxlYUBq8MA1+PsrKGxE5qPfrqOxVHPtk9Oz zzsA== X-Gm-Message-State: AOJu0YzxiTy5OOWFslUbRaxacTlSzeowWJiJsJ+tUwXu3TC9t8DHxIHN SK1bTyoTHcSauNuGUkzT+LVd390wk8SxCyeYPWiji1t4Qvri2o2BnodDdq9VVWKLIpGRZGLQPzW uWb1wN+q+ X-Gm-Gg: ASbGncvr7nByHc2XINLRmWJCjv3Bi6wtS3eDkfXTArMeS0WIOrIyEuSGfSf04o5UYY/ n95p7NEIKrfN8uVf/wE8ipxbAumS/N3WqZrxc7zd2obBfpJkzJ67jGo1bHtmR2pdK1A13/E/dIe vzxkh91Wv3ez0XbaPsWlEQN9M05crRFgOAdCw7ZGlqWY0LSzuN+P8tGWu4M4gk7Lc0w1PLvjrgJ +mmHFXZRi5+tL+2xOYucIzrosm+LiDNhFcKM8xG9B7yKq3t9Gi/eckn0T6tKJB4v2XsreDB+bgB srogI1GQwlQUQPjk/ZOephxb1yDub0NSOdNW01KTkwpO8CpvIzfh3w== X-Received: by 2002:a5d:5c84:0:b0:391:3094:d696 with SMTP id ffacd0b85a97d-39cba980b93mr2885926f8f.54.1743774655174; Fri, 04 Apr 2025 06:50:55 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:70d5:66af:ee2d:db3a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c301a7064sm4531821f8f.34.2025.04.04.06.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Apr 2025 06:50:54 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Jerome Forissier Subject: [PATCH v6 0/3] Static initcalls Date: Fri, 4 Apr 2025 15:50:34 +0200 Message-ID: <20250404135038.2134570-1-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This series replaces the dynamic initcalls (with function pointers) with static calls, and gets rid of initcall_run_list(), init_sequence_f, init_sequence_f_r and init_sequence_r. This makes the code simpler and the binary slighlty smaller: -2281 bytes/-0.21 % with LTO enabled and -510 bytes/-0.05 % with LTO disabled (xilinx_zynqmp_kria_defconfig). Execution time doesn't seem to change noticeably. There is no impact on the SPL. The inline assembly fixes, although they look unrelated, are triggered on some platforms with LTO enabled. For example: kirkwood_defconfig. CI: https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/25514 Changes in v6: - Rebase on next branch Changes in v5: - Fix mistake in initcall_run_r(): CONFIG_IS_ENABLED(SYS_EARLY_PCI_INIT) should have been !CONFIG_IS_ENABLED(...). As a result, several CI tests were failing. (Tom R.) - Restore fixes in test/py/tests/test_trace.py and arch/sh/lib/board.c which had unexpectedly disappeared from v4 and caused CI errors. - Fix CI error caused by wrong conditionals on the fix_fdt() call: tools/buildman/buildman -o /tmp -seP powerpc [...] common/board_f.c:752:12: error: 'fix_fdt' defined but not used [-Werror=unused-function] - Add "arm: asm/system.h: mrc and mcr need .arm if __thumb2__ is not set" to fix a build error with LTO detecting mcr/mrc instructions emitted in Thumb mode on a CPU that doesn't support it: make sheevaplug_defconfig make -j$(nproc) CROSS_COMPILE="ccache arm-linux-gnueabi-" [...] LTO u-boot {standard input}: Assembler messages: {standard input}:9241: Error: selected processor does not support `mcr p15,1,r0,c15,c11,0' in Thumb mode {standard input}:19196: Error: selected processor does not support `mrc p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19223: Error: selected processor does not support `mcr p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19241: Error: selected processor does not support `mrc p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19268: Error: selected processor does not support `mcr p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19286: Error: selected processor does not support `mrc p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19321: Error: selected processor does not support `mcr p15,1,r3,c15,c1,0' in Thumb mode {standard input}:19341: Error: selected processor does not support `mrc p15,0,r3,c1,c0,0' in Thumb mode {standard input}:19372: Error: selected processor does not support `mcr p15,0,r3,c1,c0,0' in Thumb mode make[1]: *** [/tmp/ccu1wZWX.mk:11: /tmp/ccIab81n.ltrans3.ltrans.o] Error 1 Changes in v4: - Fold all changes to board_init_*() into a single patch - Use '#if CONFIG_IS_ENABLED(FOO) INITCALL(init_foo) #endif' instead of 'CONFIG_IS_ENABLED(FOO, (INITCALL(init_foo);));' (Caleb C., Simon G.). As a consequence, drop Michal's patch ("common: board: Simplify array with function pointers with CONFIG_IS_ENABLED"). - Rebase on next Changes in v3: - Use printf() rather than debug() to report initcall failures (Quentin S.) - initcall_run_f(): replace one erroneous call to WATCHDOG_INIT() with WATCHDOG_RESET() (Ilias A.) - Fix relocate_code() in arch/sh/lib/board.c to address CI failures with r2dplus (https://lists.denx.de/pipermail/u-boot/2025-January/576213.html) (Tom R.) - Add comments to initcall_run_f() and initcall_run_r() (Simon G.) Changes in v2: - INTICALL() and INITCALL_EVT() now call hang() immediately on error - Fixed typo: s/intcall_run_f_r/initcall_run_f_r/ Jerome Forissier (3): arm: asm/system.h: mrc and mcr need .arm if __thumb2__ is not set common: board: make initcalls static initcall: remove initcall_run_list() arch/arm/include/asm/system.h | 22 +- arch/arm/lib/cache.c | 5 +- arch/arm/mach-kirkwood/include/mach/cpu.h | 9 +- arch/sh/lib/board.c | 9 +- common/board_f.c | 223 +++++++++---------- common/board_r.c | 247 +++++++++++----------- include/initcall.h | 45 ++-- lib/Makefile | 1 - lib/initcall.c | 102 --------- test/py/tests/test_trace.py | 8 +- 10 files changed, 295 insertions(+), 376 deletions(-) delete mode 100644 lib/initcall.c