Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2532093imu; Thu, 29 Nov 2018 06:30:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/XRFWSxyvJr0+6Kii7w2SZ3pdbe1LBeASYj3QvTJGoU9I5ImeVBrIP0TOmwZTQgnv3X8hWY X-Received: by 2002:a63:4d66:: with SMTP id n38mr1438106pgl.270.1543501806888; Thu, 29 Nov 2018 06:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501806; cv=none; d=google.com; s=arc-20160816; b=ZW5svsnLYaLzlYRo/5j5i9A8vn02yZT6c/+Q903AG4rsDx4iwxXWO/mTk47t1lYDva NJjdzmeK/e4Oc1bDX2/BsXLIg5+bzW0sgTLw7cYpI9H+t5BfbwxjPVMBgqZLVVw66Pn1 D47qvCOYCBWbv1hGQPV9lwKoePHeme/4knKEXDXLOnUpD3Y6A4Yr/u92bW4r/wI201Ez xU8b2iWUKOGQiiL/Tett8nh9g6XdTN8wmYiPkh4mcwMBcKYQqXpfZrrK4TKRzwDbdrfk AuwZktoW390InB8aJkuXHXMyP2iF7kKYBASHsVP/j4IuBnf8+eDRy8HxXYC+g38Eox3Q CRSA== 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=dVCYtqEtWCET+cWK3SAjy3cM3PnCNYcZRgeLN2+tfd0=; b=umkxh1kLUe+8VGTAoM3h6QXM96m7GsOLtrS+2Uq4rQcgUDF1HMxBnBX2yH3TuoElkc xwrIRzxJkxQWH6Xvyr/Lzc8GNnIGoK3yyKbOWSyZq3lMIu/sIxHFW25NFImBbUDnJQq4 cs1q0t4qn6PdPBh/FXAl5UHaPqZQKrdJBMuiAnO7k9kwjdlozEgH9BOrJDpqCLW8KD48 z8WjTIWbJLU/Uz+Z645dGotLoVeo6e0F73Ia5zhIJVdlf44vxUrEqDFV6AR0ke2iW1MS qjNKukvaRS6XlKxCViRxZpB2/GmLB2rorL7758n8ALrvbNZ04RdWBtGH7htyppnuxbDY QHFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="kTrwG/zg"; 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 r11si2323359pli.175.2018.11.29.06.29.51; Thu, 29 Nov 2018 06:30:06 -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="kTrwG/zg"; 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 S2387799AbeK3BdP (ORCPT + 99 others); Thu, 29 Nov 2018 20:33:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:33732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731824AbeK3BdO (ORCPT ); Thu, 29 Nov 2018 20:33:14 -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 501602133F; Thu, 29 Nov 2018 14:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501661; bh=AzQptXLu087Rx2xhbgDKi/AlFHqaklz4Vm9PJO9/JV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTrwG/zgTuyx4LTdqPnXJs93a5EBwoUuDUpI1EKELkOVfuOZzwA4S520riAGw4Ltd 89jMte3F2Sh/G0Eh6yyMUcAvNYn48Pn1QWezglOZAqstsH6OiipSqmuR6N7fai7mWm zuB2ZHZewXvQ+OBwOE0Y/RdlAYV5ciryJGBl+31w= 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.14 056/100] ARM: add PROC_VTABLE and PROC_TABLE macros Date: Thu, 29 Nov 2018 15:12:26 +0100 Message-Id: <20181129140103.980728609@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140058.768942700@linuxfoundation.org> References: <20181129140058.768942700@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.14-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 8e9a3e40d949..753e26960e6f 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