From patchwork Fri Jan 24 09:10:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 859553 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp689785wrq; Fri, 24 Jan 2025 01:10:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWQhEwB95E/qnarMA2KP/KkFIIyZCkxZJdppmmV1FnUlzvuYuHch3l7krDzMayh1nVMlAlcRQ==@linaro.org X-Google-Smtp-Source: AGHT+IEe6S7dDkWTB2Yr1KWYkA/1n21feUyJ65pKmUtE6ALNPho0J5NmMGAm63L1hdE+QYZM5NHZ X-Received: by 2002:a05:6402:50cb:b0:5da:d16:7388 with SMTP id 4fb4d7f45d1cf-5db7d30063emr30579812a12.17.1737709850268; Fri, 24 Jan 2025 01:10:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737709850; cv=none; d=google.com; s=arc-20240605; b=NmoG3QcLGnADZ+VYsEJBn/MskVQUTM6qDdc1Z4TzQUujl1IH+1MHSXSlYI2PAzbz0Q NXfk04osVd3Sw5KeghQeYYXOtkpoxpczuRJkdjU+WK0eCXen1YFS91GZYovycplE39Og RlJKXfBPPDmxsK753FXqJKjWSOEwzitjA0DJl3HU9Y8c3RNF7ueFmGHYik3lT/eBBk1U MrkjrfDHYLHzN7DC3A9TU+pF8Ce5pECJNNpe04sxFg2L4Bd2kYPmS+elEyvs9/SWiO1B okpGpuWr9UnhpAqYQhUYMNJMsA3VZs9hts072CyjFdsGep564AVWrxVN6o/OiLq4yRRP PQyg== 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=J3KO4swjELW6T4fiFLqeZQ0/BucYdmvh5JuDKtSnbDc=; fh=h6aAVEeZBlEjv+vPa+An2K+XRkhpZcjcZcS2M4TGdaU=; b=F9g9RkmLamyhyctigLqMRC7Aa8KpU+QlWXfHh6IMTZDp12MoAzmLKzzMMeIQETIpHQ CpT9OOEJw33tw5TaQNZbs7OGUSRCK6K/NaPxflEb0XMohWwKtkmAlcpchWe/wHf6Bqmq TuhoW63DHbrRvg4Yj/pW1pdNp22/uIth9Lwzd12Z5q0GgR1fezm6WdC8HtwMmqG1kKvg KuaAsL/R5W6OVewRfxVja6Hr/fMaGjvsgPc1t84hS3Sj+rm9U4JL6zYaiNQW8AIDenPh a5tLYebbSbDPyglp/RvFbQRw0Iln4psLVsy4cok6oI4b+6A3+bRr0XMAA38907f2uxfM axNg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="whM/Vbg4"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5dc186ac022si1025689a12.356.2025.01.24.01.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 01:10:50 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="whM/Vbg4"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 2A3D980817; Fri, 24 Jan 2025 10:10:49 +0100 (CET) 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="whM/Vbg4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0D9818083F; Fri, 24 Jan 2025 10:10:48 +0100 (CET) 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-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 838B780780 for ; Fri, 24 Jan 2025 10:10:45 +0100 (CET) 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-wm1-x342.google.com with SMTP id 5b1f17b1804b1-438a39e659cso11626935e9.2 for ; Fri, 24 Jan 2025 01:10:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737709845; x=1738314645; 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=J3KO4swjELW6T4fiFLqeZQ0/BucYdmvh5JuDKtSnbDc=; b=whM/Vbg4IKfm1Mc/JGeDKdOm6OehgZbfzuFn17hGcgUVihwyAmZjc8wMCiWwcr1x1E DvYkyznuVsTAgVvuNNQnfPalRxx5hydc8CIwAcdt/QyGrgghDF7ckbhGm7niJ2kHHYFj ykP5L5KA6lBfFwACf5QVQ3CRktg0Y02BEbrmrRv1rUFWJCx/Cw9dQK9YV083C4rdHhcs eAHR7W4bc6TngtRHtIClwdiyuZBvJfSvbPBpZq2LlgZq9AlBc3gHtnGKjZJ1PkSDEoNI xLXHMoofwH79yChFd0uaTZPTt6vGWIPrlv30aAtZkP5aDzwRzi1tF5QOWW9sYkM965dK c4Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737709845; x=1738314645; 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=J3KO4swjELW6T4fiFLqeZQ0/BucYdmvh5JuDKtSnbDc=; b=bGDrFUjC6feMNLzhlXxQmjYkMj1u4Sut3RHNmRvw2QKRtgzBG63mIO2pqJTrvx82cN zZKRM0EhFORkkeG9u+XDnCgw0KZ/QwLQH7Ll9QAkeRBfSdCvRO9pZsKI1+AQOHA9lS+3 mCpOnlzLohXEpsqqN8ar9/zvxin3OKssBLjPEww1jcUewuZ4+nAoF37+gdxhOm1iQkwN PWjkAvkdSDXDVWsDVkU0VeqYUqwyWT6tCeKuwktc6t4bBPqm6sZms85FsgxetlfZxyTt CksC1Fy+no6LYJ4SGi5mTgXcqtzPSeWDyJ+/3YuJlPOj/OeCiCUqSc8x5Y0QNYV7madL iFCg== X-Gm-Message-State: AOJu0YziHshau6wF9Uzto7vfWmwj6w8YapBjqZaaJd1yAPb0RvE8DNYq JchYTb/LcgbY+XcaLOEG9tAVUAiPNz793sbe1h/2OagXrL1jwx4B902coE4gp34vE/g45LShUAz RayQof6hZ X-Gm-Gg: ASbGncsua/kOXM1WPyXzZoHGBDC2u4wywphKGVFQrimHxPB9wu7cOSb41IQzSXM1on0 7RnP0mi74VuvIp/XXBUjViNBzsKpfvDgy728jE+ZKpcxrIXZRxvYNIcnZC/KrEocr8kBFDuHIjl ETcSHOhcuU3BRAi3F+Mm8AddkxZ5mWJGVOejnybY4XoBEjxs/XjOPodHUWVUl56kkkwdXc9Wp3i vIBwS8BxifvuUbD3x1uIKVjQ3WNSnnvzJK1GHBTbW3T4Tb9d42fdeK3L79FFNcIvTwZypmS1W7+ F4cfL0neMusXdA== X-Received: by 2002:a05:600c:1f0b:b0:434:f270:a4f0 with SMTP id 5b1f17b1804b1-4389142e1a3mr226379325e9.21.1737709844784; Fri, 24 Jan 2025 01:10:44 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:e9c0:313f:f99a:cc15]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd575468sm18943385e9.39.2025.01.24.01.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 01:10:44 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Jerome Forissier Subject: [PATCH v2 0/3] Static initcalls Date: Fri, 24 Jan 2025 10:10:26 +0100 Message-ID: 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. Azure CI passed [1] except: - World build, imx8ulp_evk (and other imx*): "bl31.bin: Can't open: No such file or directory" - World build, xilinx_zynqmp_kria: "file not found: pmu_obj.bin" ...which are clearly unrelated to this series. [1] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=10405 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 | 251 +++++++++++----------- include/initcall.h | 45 ++-- lib/Makefile | 1 - lib/initcall.c | 102 --------- test/py/tests/test_trace.py | 8 +- 10 files changed, 297 insertions(+), 378 deletions(-) delete mode 100644 lib/initcall.c