From patchwork Thu Mar 7 14:22:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13585771 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 181A1C48BF6 for ; Thu, 7 Mar 2024 14:22:25 +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=s4nEnVTg2q+8Bv /Hx/X1XlEVLn4XYkV0ajULuuSC50/Z74fcyODfEuuBZNiND/FOy2YARb5Aaq8IgLV+e7mpRu///nA QUNcjgltzsPOiROy1gUsN//gBADj8kJHBHB77mywB7Usdhh9EEpc72vhkjd6FSoxhHj79udpoH3Z+ dZ1H98pNtYwD+7TzgWxz2kav3P4pFyMnRuCCyYG5Rv2r2VtWREfna9iCSUOvkn0HIwuiAKsFw1rGT NZUfHI7fGhM8jdQCIDdPUJ9oF5u+8udV73OE/X2bmxeGyGJLERGXIV9z1VIydnUaZsOPSmld/FpYS YbuBhmcwVoEvHRE+McEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riEdQ-000000051BB-3Aey; Thu, 07 Mar 2024 14:22:12 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riEdK-0000000515V-3Awz for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2024 14:22:08 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5135e8262e4so1028552e87.0 for ; Thu, 07 Mar 2024 06:22:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709821325; x=1710426125; 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=HFmtD/GVyp9OdznqZAbsHGPNBUiU/1RuQDWu7PoOo03a2/G1a77gw2v+YiH5+3t/jJ cH9apzWk3MFNz+thJl+PO2NRPufIKZZRrQ4yYbzxm6ydSqpFF6mfnyQy2bIGpjW18Nas pkF/TXag6EYMgonvDaLQZgds8GELIg7isNGaqu/+bQRtUe4e3zTArV9Sl/9TfwQw9L1r P6bT7XMu/Ejjmh0jCh0XlG4WJU6QzGq2UeJwY7ZbFbm9wCzLbAuB2eJaac4SDsUOiXxp t1au6/denQ59ANhmsdg/JMFcP/R7p+jcFe/dh+UjNd1sbjWB9u85mMHXWbk+PjsEDMe9 fk3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709821325; x=1710426125; 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=alyQNSNrgWiMAaZCMzEyU43AbWHRqg6K9uJp6st4o7oL+3dA/y7ozoxbfHzjCsLsBx pacIGJT0/nxZfDOxIkwz56QSsisr0w6zWHoRlTWslPbMkzKDc54p+GURkGxYWiSTRg5r R34rddk0GnOlcoDK0DSIekM5qosbhXxTkS/bq3EP9PYRCXXRmEZA392Tyus93M3mhwRn 1eoGc+OsqOjXY2qn3hPde3KR36FHkWnVJqIvu/ZaQxQVs1Kc6IRqTmgQOY9SoyjczME6 MQ+HXe+r56aLhbk+wPpWIBzvLzgNc1nvfmQhjPXF+KFcSbWsZc5VsQLv/GoSL+iicxg0 yQSA== X-Gm-Message-State: AOJu0YxOLsSN9prXhFlgQmNjk7CJOxgj9dEuEx55Fuae7/7QsqvEu6+Z 19zSMWqlpa+3TX0hWxNs/gYiyLANWEERg4dfPlEKpOairvzWfI+qQVEX181DIfQ= X-Google-Smtp-Source: AGHT+IEsEJyP5Gecw/WvzollfZYjFKnEe7nllK/88gszUJ80WnmTVHMiLEEuKZmKX560jolbjhl1ug== X-Received: by 2002:a05:6512:3d26:b0:513:1c47:5381 with SMTP id d38-20020a0565123d2600b005131c475381mr2115492lfv.2.1709821324688; Thu, 07 Mar 2024 06:22:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 06:22:04 -0800 (PST) From: Linus Walleij Date: Thu, 07 Mar 2024 15:22:01 +0100 Subject: [PATCH v2 2/9] ARM: tlbflush: Make TLB flushes into static inlines MIME-Version: 1.0 Message-Id: <20240307-arm32-cfi-v2-2-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_062206_861319_DAB58C62 X-CRM114-Status: GOOD ( 13.42 ) 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 * ==============