Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2540719imu; Thu, 29 Nov 2018 06:37:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/V/9XqJGKyRLb7pviHC7IZnMKmhxkR+k2AQCFe7O7jwlhKiSW7CHkt4nGsCOPZjRYXvy2xH X-Received: by 2002:a63:4566:: with SMTP id u38mr1457635pgk.4.1543502221866; Thu, 29 Nov 2018 06:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502221; cv=none; d=google.com; s=arc-20160816; b=MZaNzV7uqXDtX3JC9xqQ2yZCbpdSH56rQPrimWjTI09ZmfO9kAMjSUuvk84FBcXc+r PyLW6iQeLbZu2d6H+vJxU51Xhtj2JUbLa+M5ZZAkTK3IY0Ii6X5rUZPsKFhu0I1aAKXq EXWjqmedoMzwjkI/dAd49Q1agO02uuGF/nj0n89wFFEJ7DSSb5nM9A8ptD9Flgnvj/QO 1ystPeAqgx9vXsL212P0xrhrC2hWMlQA582U+rCH9fhKW2iIYrY6KuM9L/QoZFl8sOu3 2Mx/uj59EzDiv8Azomb1lGyCIQrOc3OxfmxCayt+28cYPA2V0PnBAkF9/zKYQx/sHjuE D3LA== 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=Ia9mSDJgl5zqMA55VnteWPuKu2Mg4Ysib79FFqDD2J0=; b=dEmRawMgZ3FujhWaTMwbcxNPLzQMS89VI8TOmzNtVQmblDjC6klabMyDA3pUvaq57r kgObOIbEayfqEs7ZPB9rFLVka1aByl6di10l95JYCoBzEw8R7r7pHfyuxmNbwtEAnE+I M2oAyHdCU8/5X/SkqlvZycBGMql2KAG7V7WLb5G1a4TLwUB5hg0SVM799UQVMPwYXQLz Qn+WIlSmUrwKGIHZnIEOG7Ztq/0tft5YNA7cS0Mj3ej49V2h+3CxxUCFmD6231dqUZFo wmC44BTNOh1z8JPd4gwiWP6mkcxHho1FIIRW27eEjutcdRJQ+4JatPzK55KOSanKDkW2 7U+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BUjMXkdE; 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 f22si2150254pgm.81.2018.11.29.06.36.47; Thu, 29 Nov 2018 06:37:01 -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=BUjMXkdE; 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 S2389188AbeK3BhL (ORCPT + 99 others); Thu, 29 Nov 2018 20:37:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:39946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729111AbeK3BhK (ORCPT ); Thu, 29 Nov 2018 20:37:10 -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 6734C2146D; Thu, 29 Nov 2018 14:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501896; bh=NVnJZ5WNLU74c5dGqcWGc08hNrlqwJQBN6rVEkwgXY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BUjMXkdEuHnNxvxjdd7guEEmi1TAfiMK8eskZZsYSEPoUJNI+inGOpR1PFs+bqKQK Tw8wwFPFx+LiZjsGpHroJOcn+OielhAyAnR846bqECcZhNrCW9qEJCH5vRVDgBJRfl UE2V/maGp1er/1j/i1jUSqkZ+tw1ZQyRrHalfUF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julien Thierry , Russell King , Sasha Levin Subject: [PATCH 4.19 084/110] ARM: add PROC_VTABLE and PROC_TABLE macros Date: Thu, 29 Nov 2018 15:12:55 +0100 Message-Id: <20181129135924.643942557@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129135921.231283053@linuxfoundation.org> References: <20181129135921.231283053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit e209950fdd065d2cc46e6338e47e52841b830cba ] 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: 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 4c249cb261f3..6b9d191da868 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -686,9 +686,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.17.1