From patchwork Mon Mar 11 09:15:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13588400 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 E8FA7C54E58 for ; Mon, 11 Mar 2024 09:16:23 +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=LeKqES0mce12VQ ruizxgVFBAIIY1SdznQstgzWqzxHMu58YjwZ/OAa4a12K7SEVEmOze2iALZ32L0c4+xzS2L0LXlrm VCyO5AeiRQlimjMUjinud5n2CTyMJ4PZIsvBuw27YWXT+qU8GIGlz+PzwziKsdbEXGAUcFknJ+wFD npIIxJ+4J8jCKofLrPEfjC0vlA4/LOTvhNywXBTcnbSw+CFdIJQ1YtxzPrfcktS/443gNVlqwcCdm wyzacfusx9k1swC+aUZh66sMKOPPl9UUO0WaYDelXCax5EqVEqCogX8gOZFzyFPF/vTlcLPUuQOiP +7EpE34MKnn9n3dGpwdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjblM-00000000mdN-1O20; Mon, 11 Mar 2024 09:16:04 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjbl6-00000000mR8-11e8 for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2024 09:15:52 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-566e869f631so4710181a12.0 for ; Mon, 11 Mar 2024 02:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710148547; x=1710753347; 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=bdrf/gg+hRjebkhgRKHaTcd3kj3lcgRgofkebDRxRWJ6JfHHYDID2aGFCmF4L9H376 JNt1smrjJWTlpA1WTwRYgXEgotQES8JbpVkndqIi82ZC2fMKIoVScQ9L3hujcroRezRi kAFu0UN1qgNSvYKlqhdtp1pfC4qgEgAbrYhG45oLGGq8+YxcQgk+OMYcBT/pOHoN4/EA uc4zn2x3zVkLxlXllkawPCxNEhCeAl8rpjW00LlE6Azx+ROXUnS1Tiz50dWhlhrOcC3h OI2i9wOD8nJfmSEU2MsfelakSnB8pOzodc5r+eNMb4AK/382/6BSfaM+qg7GMJGklEVS ERgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710148547; x=1710753347; 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=nRhbNDjish0Bl8FYQ1vu4wXHwrQ6yMKF9UIqza+m01MCDjSl4TUbIIxbDdc6OVQRTq HRfAo3oXXzjGn8B1FBf0/cViMA9QI0zBU5dD7GgEIM13zQkg+lPYm3v0dGEuu97WXiHl IACwF1FWxw8l/MDlz9gdytU/ZWxpUlOnK7U82DbKXznVsMJ8UtBs10Fj+Y4pbxT9F/IM 2/D7e1xTc2MCG7PzF7lkMsnlkvY+VUe4mVawD2221xmGO4P8LiC7nT+EIQ784Yl75VtV O8PAkAAPu27EmsLBv1dMKpPpAp/3vRz+lZfjXt0j0zM9SDgVoO3gBGRTu0KuIS5R8AtY B06A== X-Gm-Message-State: AOJu0YwRG/SqKPQPCz4xydjZ4ZW79W3QLIHVE8eIgfqdVg1GQWYpMdz1 KESr7cvs77k1op5rZndnQo4Dq+S5iSGpSCW9Mb1oSV6ky1YpotcESIcitqEEuqg= X-Google-Smtp-Source: AGHT+IFDXnaYHHTTgZuS1DCu5RDa1CgSEWMP0DDGbrndqbxQOnJOhpVIekT1w4Oo9V+VkBJC3FDrvg== X-Received: by 2002:a17:907:c247:b0:a45:5328:8432 with SMTP id tj7-20020a170907c24700b00a4553288432mr4898816ejc.50.1710148546796; Mon, 11 Mar 2024 02:15:46 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id js23-20020a170906ca9700b00a4617f1ccf3sm1601256ejb.169.2024.03.11.02.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 02:15:46 -0700 (PDT) From: Linus Walleij Date: Mon, 11 Mar 2024 10:15:42 +0100 Subject: [PATCH v3 5/9] ARM: delay: Turn delay functions into static inlines MIME-Version: 1.0 Message-Id: <20240311-arm32-cfi-v3-5-224a0f0a45c2@linaro.org> References: <20240311-arm32-cfi-v3-0-224a0f0a45c2@linaro.org> In-Reply-To: <20240311-arm32-cfi-v3-0-224a0f0a45c2@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-20240311_021548_459533_C37B5762 X-CRM114-Status: GOOD ( 13.01 ) 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) ? \