Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2430057imj; Mon, 18 Feb 2019 05:59:11 -0800 (PST) X-Google-Smtp-Source: AHgI3IYjyW9rBmVJ7hoYxxdArbQKLG+shel3Ep623pVDAx0Grjm1x8Ie94H9Bm73+ZW6q+uuyh1N X-Received: by 2002:a63:fb0a:: with SMTP id o10mr19019469pgh.259.1550498351197; Mon, 18 Feb 2019 05:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550498351; cv=none; d=google.com; s=arc-20160816; b=LyLF5IfOw/ThUCtzcDBP5mImXAsJq+H9OkjlB42XzwXn3GBZKt5qGwX7q7aM+2SuUT E7Af3PkIaTLP3OCG0cXT14rNC4IPz+Kt1CGOkq5QecFDjDnVLcBlCEfWV9kGxkRdaxJB oVYtScR084msoZCbnLXbOC47PKPrb/gRVptfkcsrW5PsHoR84gmyilJg7yRXJz9v0f7f 5ZDxnGGzoY58Q7PrtzTD6IztNqG0m5yY3/aQHOAFXMa/idVpH4EPCf28uY7L0QPihKxM FaPhI6LvmNHMgKkmHsBuqaqrnpNR2k0SA04MtPiqyJBhUe0dpUGoQx5LdZEZoKGXcouA AMnw== 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=21fLpyf6EEvvUvvAIogE6uqPA3TRbBUb4zR1agJHhnU=; b=ipY+gS531nNXsnMQIz6RvO39grYjCwrVRX3WAbGkmrw+ATeplZOnHn4ciDWMNk6+Jz udhiWA2ociGiJ6S9Aife/FF1iXNusGtlmV/ESbGCHsqyLhJP/ywpgrZhQTM4QICIOZLI HBgDSWWJuDGrRHqwifqmxS/yBSKdpAgzoN7GwKrQqci6p5ydUBJujnXQLFgRZXdUewt1 Z4+OlEr1ZURYgkqPgLy1kABgQBh7LHhNiXQ8AjPgKxx+8DhEOqClucq3Ofa6fGV8ElJi 4x+MO8mX3ZQQJJg4/bvOmyfKlnQ5EBJ+pLCmQdVnDYQPzFsnF57dlwVz6ZOThGH5ieB0 LLSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jELYqDfp; 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 b8si12685354ple.5.2019.02.18.05.58.54; Mon, 18 Feb 2019 05:59:11 -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=jELYqDfp; 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 S2388214AbfBRN6A (ORCPT + 99 others); Mon, 18 Feb 2019 08:58:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:38444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388163AbfBRN5y (ORCPT ); Mon, 18 Feb 2019 08:57:54 -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 7EF2F217D9; Mon, 18 Feb 2019 13:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498273; bh=q7ST0jRM+VcF16zwKY0r8fCrCjMPtw4NfFJZQVm9XBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jELYqDfpg20lEmUlwWhjbmqIHC7mrXNf3SSNWzd4VCZnsK3ARVzqj23BmXWeUMuPs OEnAyEFzD4AjicyTqHf4SX4aEKJz8J/YRlBe2Q9pKzVs3H+v5zrCJNmtOyxj0r+3P6 LUW1cMIUaa5slEnmp173gXJhLeK25CHdnKDTfsDY= 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.9 16/58] ARM: add PROC_VTABLE and PROC_TABLE macros Date: Mon, 18 Feb 2019 14:43:37 +0100 Message-Id: <20190218133509.809567593@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133508.567416115@linuxfoundation.org> References: <20190218133508.567416115@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.9-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 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 19939e88efca..a1a71b068edc 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) __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 8d5c3a118abe..2eebb67fa08b 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