From patchwork Sun Feb 25 20:08:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13571024 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 A9AB5C47DD9 for ; Sun, 25 Feb 2024 20:08:46 +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=L5qoXcNINrUQmv HLal3xsw7A5BHIxjY1pVLAIoRK06cBBnMkuCMBOOva4LuS8zESa90uOhzA4ie5vWIKKmakD/3V9MD g8m835Tvk7F0I4OvxC4zyABPm+FZFvwOVdnOBKkLsi4/wY/dYvaPJAeh5m9LvT3SV0AvLVZs56OpF b2lOnosZ/egQDSal4YJg+b9dquxk8WtxlYVO0CXoO/LXrXqGaCYcz2m+bEijJu4DAttdB/Xg8uvT7 CyfDYlosCmZIHrAONVEzmN3/FJH636bqLtnCCyt2XMojEinFzPoAaZrUdKxKuol9RFl0uqT3WQvsy JwR3MJGJ0IMUEtRqY4mQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reKnc-0000000Fcpx-0RKf; Sun, 25 Feb 2024 20:08:36 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reKnI-0000000FcjP-2sfS for linux-arm-kernel@lists.infradead.org; Sun, 25 Feb 2024 20:08:18 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a3e7f7b3d95so274252866b.3 for ; Sun, 25 Feb 2024 12:08:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708891694; x=1709496494; 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=dgqZvqtEkEnm6JHeGB6xteYe7pWwhs0huHSX2aHmsIl4nLMjyGXTfnlsIcOHiLYato tqVizPpwTGIzNAxzDPWy9ZCYAgQVpn1GVf7YaLxYOxweSRt9SwHFMX6MOWLpCSVF2/cd o65fsXmvSzlIrbLMbtxcsigNZ8onQ/R2iGUvHzUHuaiA1znrZBHorjh5RJB1erBjHPKH 1demXGXUJ6E9G40E6eQBg7qONNCmvZ34FPkyMadKowEZGnwnyCkZTj8jcI2ceF8aXTba JD+r/TZScAvJH04x52+1YHxEgKyR7gRWQckKuxc2fWt8dUMgvir1CbBlZkeNec/0bFXA Jv8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708891694; x=1709496494; 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=mxg2sVFFJUFsaSFuTM+bm5d5qmxO5Aj67yvxIYZkel5aGtqETS1xQka3tS+uFBkB8c E1YJjslaUzfeakJ/O5p9FVu/g9xGltCOH8p+h1+Emx6bpqA4NpVE3pMrMJIscuffQ3/A Sb2vevb4PwoometmVNbfiFUbYiESZ7An5zOzvmFaL6LT8/UO/LDx/WEhSlNLgNP7/gZk vKb2+J7d6QxEayzcp3KixWhWWQ+2xCnWvU+gboTjtYhWbiLCvLcOSChj72D7c7rD1gZC 8ywCNwxPkn5WAYkQ+stOL6s2syl5/o6UXCrEAX55l9BPGGJ7XsSs8CZVYh0g95hmgfpK t11Q== X-Gm-Message-State: AOJu0YwOkSK6/pgwCzsCsSHwY7J8uijgpUoHBLqeJwoHty21+ut+3KwE tVD1wTKALdEah9NNXqJANd3+hxLRx4uT2fqNrR7EqlqslycZL23MYIGGMCE4Z/o= X-Google-Smtp-Source: AGHT+IF9H5P6JRdDN+PJTJcjkkqLAA9eKjemJxWKrfZTcfu2fwQ6Fg4JGDKRQi0oSxCd/8pdja2YVg== X-Received: by 2002:a17:906:13d2:b0:a43:1ee2:4345 with SMTP id g18-20020a17090613d200b00a431ee24345mr1634442ejc.75.1708891693861; Sun, 25 Feb 2024 12:08:13 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id hu14-20020a170907a08e00b00a4340138ab5sm504621ejc.5.2024.02.25.12.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 12:08:13 -0800 (PST) From: Linus Walleij Date: Sun, 25 Feb 2024 21:08:11 +0100 Subject: [PATCH 2/7] ARM: tlbflush: Make TLB flushes into static inlines MIME-Version: 1.0 Message-Id: <20240225-arm32-cfi-v1-2-6943306f065b@linaro.org> References: <20240225-arm32-cfi-v1-0-6943306f065b@linaro.org> In-Reply-To: <20240225-arm32-cfi-v1-0-6943306f065b@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-20240225_120816_763441_6A58E3DA X-CRM114-Status: GOOD ( 12.82 ) 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 * ==============