Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2428232imj; Mon, 18 Feb 2019 05:57:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IaddBB1s4r/TksteZvEz3+paaseiwBrJarT2zzurneWkd/DPPiV9GX1fWpYV/P9h8iDgZ1Y X-Received: by 2002:a17:902:bcc7:: with SMTP id o7mr16911529pls.89.1550498224298; Mon, 18 Feb 2019 05:57:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550498224; cv=none; d=google.com; s=arc-20160816; b=GMB1L6W6cnN5FzJRmKeykhqMbiG4UpCBkLib3P7s1GdvLxwX6EifLxB2dtWhEH9xZH hVVNkAPcSq+t7eC40crKvtu1d/29kAseUHeULtFvTXIO0RimeTbDb8Ak4eduV7xXoHlp vl4lz4p9zhg4fIXSk9GH+z1A12hyEKmpD46xuKDrx/TWmxXpmSGcqTNixcQMSCvHZOgP QUGgcdgIADcSrxbs3HGvOyrLT37/JM+sicaSQfOakSA54rXeQ2YYngOh4ZLGFGGm+o5b podws4D8n6n7F8zbT4vU6J5AnuZNy+5uhDRplC5e2/iOsNOLRYxBS05iu53dIQoeIDV0 B5iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=02+zGbozv63moVSUlNcyRkRYtXaoi+FutraXI+y+itU=; b=pF0vCYq46g/Z0C4GPoJx+Khkc1giRwT1pRM9x1cbawXnTegsfh2w9z4gxKrAoWZGvW sxNcfUfFAHvvAh3kF7pqPsq89spGStQfvABdFdmTIvAZPddJWo1HtZIqN4f34wjsi2+w ZAa3oI4s6bY+P5pYXkM+IoZEXrZnb/ffMjFN+bh941G3qGjXkHtJ1UwNj2O2sqH0LGNW h9eqPKE9x7mbmK9ImlgCh6676RVKmNSrbjNqDUk3OIj9BE+6qMiiQuUQQZUGIBqpA2VD PaxfixO19LOZ/aw2NW13pN2UmU5/l2Xh3YXQSjvV2DfKMnNIuTL80yh6t1S2ODUbS2YI wUKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q6wubXjw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si13956649plh.245.2019.02.18.05.56.48; Mon, 18 Feb 2019 05:57:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q6wubXjw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732206AbfBRNyq (ORCPT + 99 others); Mon, 18 Feb 2019 08:54:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:34676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733274AbfBRNyo (ORCPT ); Mon, 18 Feb 2019 08:54:44 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F03B920842; Mon, 18 Feb 2019 13:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498083; bh=JfD0qXbbvKeyVZzurIiqCH3gRgW/tUnlgrAywxm9m4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q6wubXjwHTVkhbyq33aoAaz1SewTXpbE00sW7J+eP7lko0v9wTyth3ronIfY0m9qd UyPJz/EU6n6g8Vt1kHflBbMwgKyDbbgZuWZ/By7vDMD7D/qxT4AOZAKLPePmh5SG9Z zemDmyOAKnkxHSjW4Rzoi0+x3ZrBbRFSyoqy7XKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julien Thierry , Russell King , "David A. Long" , Sasha Levin Subject: [PATCH 4.14 18/62] ARM: add PROC_VTABLE and PROC_TABLE macros Date: Mon, 18 Feb 2019 14:43:24 +0100 Message-Id: <20190218133507.405335285@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ Commit e209950fdd065d2cc46e6338e47e52841b830cba upstream. Allow the way we access members of the processor vtable to be changed at compile time. We will need to move to per-CPU vtables to fix the Spectre variant 2 issues on big.Little systems. However, we have a couple of calls that do not need the vtable treatment, and indeed cause a kernel warning due to the (later) use of smp_processor_id(), so also introduce the PROC_TABLE macro for these which always use CPU 0's function pointers. Reviewed-by: Julien Thierry Signed-off-by: Russell King Signed-off-by: David A. Long Reviewed-by: Julien Thierry Tested-by: Julien Thierry Signed-off-by: Sasha Levin --- arch/arm/include/asm/proc-fns.h | 39 ++++++++++++++++++++++----------- arch/arm/kernel/setup.c | 4 +--- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h index 30c499146320..c259cc49c641 100644 --- a/arch/arm/include/asm/proc-fns.h +++ b/arch/arm/include/asm/proc-fns.h @@ -23,7 +23,7 @@ struct mm_struct; /* * Don't change this structure - ASM code relies on it. */ -extern struct processor { +struct processor { /* MISC * get data abort address/flags */ @@ -79,9 +79,13 @@ extern struct processor { unsigned int suspend_size; void (*do_suspend)(void *); void (*do_resume)(void *); -} processor; +}; #ifndef MULTI_CPU +static inline void init_proc_vtable(const struct processor *p) +{ +} + extern void cpu_proc_init(void); extern void cpu_proc_fin(void); extern int cpu_do_idle(void); @@ -98,18 +102,27 @@ extern void cpu_reset(unsigned long addr, bool hvc) __attribute__((noreturn)); extern void cpu_do_suspend(void *); extern void cpu_do_resume(void *); #else -#define cpu_proc_init processor._proc_init -#define cpu_check_bugs processor.check_bugs -#define cpu_proc_fin processor._proc_fin -#define cpu_reset processor.reset -#define cpu_do_idle processor._do_idle -#define cpu_dcache_clean_area processor.dcache_clean_area -#define cpu_set_pte_ext processor.set_pte_ext -#define cpu_do_switch_mm processor.switch_mm -/* These three are private to arch/arm/kernel/suspend.c */ -#define cpu_do_suspend processor.do_suspend -#define cpu_do_resume processor.do_resume +extern struct processor processor; +#define PROC_VTABLE(f) processor.f +#define PROC_TABLE(f) processor.f +static inline void init_proc_vtable(const struct processor *p) +{ + processor = *p; +} + +#define cpu_proc_init PROC_VTABLE(_proc_init) +#define cpu_check_bugs PROC_VTABLE(check_bugs) +#define cpu_proc_fin PROC_VTABLE(_proc_fin) +#define cpu_reset PROC_VTABLE(reset) +#define cpu_do_idle PROC_VTABLE(_do_idle) +#define cpu_dcache_clean_area PROC_TABLE(dcache_clean_area) +#define cpu_set_pte_ext PROC_TABLE(set_pte_ext) +#define cpu_do_switch_mm PROC_VTABLE(switch_mm) + +/* These two are private to arch/arm/kernel/suspend.c */ +#define cpu_do_suspend PROC_VTABLE(do_suspend) +#define cpu_do_resume PROC_VTABLE(do_resume) #endif extern void cpu_resume(void); diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 1a041ad4881e..c1588e31aa83 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -693,9 +693,7 @@ static void __init setup_processor(void) cpu_name = list->cpu_name; __cpu_architecture = __get_cpu_architecture(); -#ifdef MULTI_CPU - processor = *list->proc; -#endif + init_proc_vtable(list->proc); #ifdef MULTI_TLB cpu_tlb = *list->tlb; #endif -- 2.19.1