From patchwork Mon Mar 11 09:15:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13588397 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 1B922C5475B for ; Mon, 11 Mar 2024 09:16:17 +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=0SQjousCDXDkxOlBJ2ocfnM1o3srohN6EuFvnzEeHog=; b=GfwRRgjTkm2oed hoHTYxbkxS+b+BmO1ogaStXHP3r9ZbgKpv+e09xVqGmaAPt/bcwC7N+XpnVpPEhAFLKhSwWgdI3Be I2fDsjrj55htsXIAekRiJCXe6oGLzS62eB5DmiTaz1fBoKjlFQWuxlDK5f4xOuGKGfMCL8mZp2Hvs yljYmojYoukY5bO0HvzbKHecg1433kl7xy/svPZEIigSUZf1hg75Cg+SbWQ07/I1fSoFUygRVJwck bQSNcagriYTpjBO6waCDs7D/OzxQAEj0VjDDefT94XakZaTKjQ1a4EZ+h8QLezGdVmxF6EHe2kl5W ByGqhcMxkpjLgsKILD7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjblH-00000000mZK-1ZI7; Mon, 11 Mar 2024 09:15:59 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjbl5-00000000mPZ-41pu for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2024 09:15:49 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a45ba1f8e89so451843066b.1 for ; Mon, 11 Mar 2024 02:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710148543; x=1710753343; 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=x8Pxmb+SJtaf6Rq8IgIflwtKkppPo4bfFWLJbSoBsFk=; b=RLDjUOM3NmHhtyAoCdxTjzboF4RpQo/PDwppR3+PBOJk4t4xM29cjK8paeHB+4RJ90 0aeKAVFBkCE7+BiP1ocCXaL35Epi9lqMBpE9z+x2UUoOMNA2QNBmHpN5YVI/F+SapigI a/mf/YKKji7uGehnfwxp8bouIoVRudxZEvTjUgdd/jnJBZgmVg/39eh47g3yF0LHYZ7m W26qh0g2GtPLbeOoWUYTXm4PctZEXFPKv81mqmCR75S4xbhyqa3qrCPqrusi4YoLIMHe VK81mnEyI016lySu9RI7uFBdUitfhVeiyQFcDbVjoGlq1Ba+C70m3wBf77eTIfm8uI63 HIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710148543; x=1710753343; 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=x8Pxmb+SJtaf6Rq8IgIflwtKkppPo4bfFWLJbSoBsFk=; b=fwR7foZiMWB8Ac9LB5KToXwCXe8bcX/oI4DylHe4/1nQM7vN6YQRtsEXsSbHBVmBSq TzEKcdrXgM6/H0z0U1CSNDvIesUwl44cRkHNxUZ6B3tOK6XBZFcr2t+3HdgOH5ULJOXF Uc9MNIICMNfeLy701qZtuQh6a/5S3faCDGtVmy0Koq4auBtD/XRmlzp5PyucB0JnVrhD V/oQ6VLtInpLIxq+3Mh0baxZ2hGPgC78mZ6yVQ2uYtKCa5IzXpNWHT00wLb7fg4EUbfi yAkHFSPXFYJgjEB0UVXGofVXtmkG/0mhREKugeNo7+FhQYxpMArEr66M2qoaPl2jsXcl 2yuA== X-Gm-Message-State: AOJu0Yy9EKK2/JBfpwkq9nUsbMtEQt8BJxVf3l1qDdMvwSu9Fr+gOc7Q djmLR86J1piLKvayfja2TVAWILQ01WRS+Fq4m5fcx2F7fGQ/fZAoZM+LYIlrOsI= X-Google-Smtp-Source: AGHT+IEgUpLUiQYBzj6rw7ZfjfkrB+vk/A/4W98MEgaqVFmfJCSsdg3NGfsTATbDZleEH7zdiiDcfw== X-Received: by 2002:a17:906:f34e:b0:a45:a9da:cc38 with SMTP id hg14-20020a170906f34e00b00a45a9dacc38mr2950488ejb.7.1710148542891; Mon, 11 Mar 2024 02:15:42 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 02:15:42 -0700 (PDT) From: Linus Walleij Date: Mon, 11 Mar 2024 10:15:39 +0100 Subject: [PATCH v3 2/9] ARM: tlbflush: Make TLB flushes into static inlines MIME-Version: 1.0 Message-Id: <20240311-arm32-cfi-v3-2-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_161625_4281CDE0 X-CRM114-Status: GOOD ( 13.23 ) 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 Instead of just using defines to define the TLB flush functions, use static inlines. This has the upside that we can tag those as __nocfi so we can execute a CFI-enabled kernel. Move the variables around a bit so the functions can find their global variable cpu_tlb. Signed-off-by: Linus Walleij --- arch/arm/include/asm/tlbflush.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index 38c6e4a2a0b6..7340518ee0e9 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h @@ -210,13 +210,23 @@ struct cpu_tlb_fns { unsigned long tlb_flags; }; +extern struct cpu_tlb_fns cpu_tlb; + +#define __cpu_tlb_flags cpu_tlb.tlb_flags + /* * Select the calling method */ #ifdef MULTI_TLB -#define __cpu_flush_user_tlb_range cpu_tlb.flush_user_range -#define __cpu_flush_kern_tlb_range cpu_tlb.flush_kern_range +static inline void __nocfi __cpu_flush_user_tlb_range(unsigned long s, unsigned long e, struct vm_area_struct *vma) +{ + cpu_tlb.flush_user_range(s, e, vma); +} +static inline void __nocfi __cpu_flush_kern_tlb_range(unsigned long s, unsigned long e) +{ + cpu_tlb.flush_kern_range(s, e); +} #else @@ -228,10 +238,6 @@ extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long); #endif -extern struct cpu_tlb_fns cpu_tlb; - -#define __cpu_tlb_flags cpu_tlb.tlb_flags - /* * TLB Management * ==============