From patchwork Thu Mar 7 14:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13585774 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55B11C48BF6 for ; Thu, 7 Mar 2024 14:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NyjxNT0wCJZdeKr3kg4RyYm6N2Ty38wHzESrLvSEkBY=; b=lHeROp5TMqg7W1 KFtlxjwB8GXr1IHMCgIyId4BWYzGE2sSC2eV5AFbo2ImWfK3YRk0Z+a311PEoqiZkCetY/GWUECy0 mluxkrGVL7j79qNI8lhjEZw1JfNVpHP8pXjE4usKMXApt7fqcbCj86H23kCwWexFa4P2eIqsQ7cuP Y4rAsm5AyS7qMWL+HdjaWBwa9RW1HjCeGY+53ZGuNXmh91gcZIoae0amCHzMPWD9SzdvNlr5NBZR6 kwI4KXouz6umx9Culj6NsK+XRLG/WB4zdQqdaVTOyZjCIzYi7/V/ADduUrTjVIYEdfKDSVA1a0wyP tMI+GnEOStLgv+YPp5/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riEde-000000051NF-1pgR; Thu, 07 Mar 2024 14:22:26 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riEdP-0000000518x-2nB3 for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2024 14:22:13 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5132010e5d1so1286020e87.0 for ; Thu, 07 Mar 2024 06:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709821329; x=1710426129; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0hQVFeBxn1IenYJfJewA7K4YjroRXq1981Lcc541jow=; b=NPXwEk9kR8CHxxQXNjq9nCF1ESju/ofGZPNn97IsS31iUVNRO7FHTiLEt8siKG5IBh 0U50OR/EUZ/vPeVBpsIMn6OlQYg2ut4c6mAuAYn+XWIWld/qCp9/FSi6LMNXHSHdt1xi A4p4YueJAoCc2jlgFSpXVff6LLF8pLT3Yit4WjTswcIE4QCN6iZ+jynOdlSUsoCvCWQh N/SPMrDMDq32XttK7aKdTllhgxZL7SlaPrnCrAObQ9afKgy0kcxhGBYWy72Rh3hzpczV MP1x4UBU7YQRv9tE+a0aj21qdV/mfAf+kc0KRbneKwCmMxYwv/Xyu1AD0ipa9T5UXLrr Y19g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709821329; x=1710426129; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0hQVFeBxn1IenYJfJewA7K4YjroRXq1981Lcc541jow=; b=PlbJxfzUmttEeGtE/sp9XHeTvtQ27P6Ts5yebCLLciXbHCTsiaL6tYgQEH7uEWWhVd p//RKj9k53bCIwnFRiYiG21ppEiG/wj4DoAs/k8yzYCwCrLSogmuhelFSaImSoeol4js /yjhRetR6cPMKNujf8M3mXf/CqNdAJ4Vgh4UPajn9Ru2ZZ88feEfYWkGg530Cb8XK9Ij WL6yRIErMV1SSeWyUWXsZ8poEgRGdt5uiBpZGLCFH2KmGVHb1JZp+CjUJfG7ZY87Mp0Q wgfpKzYRNJh9zAqQE2dpArFW1qme3HAGNzxgMcVIf7v+zDEU2xqDNXphAmH8MV0nqQvE fHCw== X-Gm-Message-State: AOJu0Ywh/v5qT/hngrn4XPzRCKRZo4dyiooZN+5sD1NPrfU7hirRIII8 mM2R4qG/JnDWR2VS7nq5gMdh5ckaXbHc4mqod6/NCnhSqeBpc25FtUDj89Lh+Ls= X-Google-Smtp-Source: AGHT+IEQGnmVcalNP3Hec44WlB/kQtAuRD4bDECAOf1RXnT2QXtjQ6JZsUFXdFMtMvyH8obZ0o6x1g== X-Received: by 2002:a05:6512:e94:b0:512:da6d:23aa with SMTP id bi20-20020a0565120e9400b00512da6d23aamr1760365lfb.67.1709821329648; Thu, 07 Mar 2024 06:22:09 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id x11-20020a19e00b000000b005133b381a5csm2417137lfg.90.2024.03.07.06.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 06:22:09 -0800 (PST) From: Linus Walleij Date: Thu, 07 Mar 2024 15:22:04 +0100 Subject: [PATCH v2 5/9] ARM: delay: Turn delay functions into static inlines MIME-Version: 1.0 Message-Id: <20240307-arm32-cfi-v2-5-cc74ea0306b3@linaro.org> References: <20240307-arm32-cfi-v2-0-cc74ea0306b3@linaro.org> In-Reply-To: <20240307-arm32-cfi-v2-0-cc74ea0306b3@linaro.org> To: Russell King , Sami Tolvanen , Kees Cook , Nathan Chancellor , Nick Desaulniers , Ard Biesheuvel , Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, Linus Walleij X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240307_062211_865481_D595DFFF X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The members of the vector table arm_delay_ops are called directly using defines, but this is really confusing for KCFI. Wrap the calls in static inlines and tag them with __nocfi so things start to work. Without this patch, platforms without a delay timer will not boot (sticks in calibrating loop etc). Signed-off-by: Linus Walleij --- arch/arm/include/asm/delay.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h index 1d069e558d8d..7d611b810b6c 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h @@ -55,7 +55,10 @@ extern struct arm_delay_ops { unsigned long ticks_per_jiffy; } arm_delay_ops; -#define __delay(n) arm_delay_ops.delay(n) +static inline void __nocfi __delay(unsigned long n) +{ + arm_delay_ops.delay(n); +} /* * This function intentionally does not exist; if you see references to @@ -76,8 +79,15 @@ extern void __bad_udelay(void); * first constant multiplications gets optimized away if the delay is * a constant) */ -#define __udelay(n) arm_delay_ops.udelay(n) -#define __const_udelay(n) arm_delay_ops.const_udelay(n) +static inline void __nocfi __udelay(unsigned long n) +{ + arm_delay_ops.udelay(n); +} + +static inline void __nocfi __const_udelay(unsigned long n) +{ + arm_delay_ops.const_udelay(n); +} #define udelay(n) \ (__builtin_constant_p(n) ? \