linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: julien.thierry@arm.com (Julien Thierry)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] ARM: add PROC_VTABLE macro
Date: Thu, 20 Sep 2018 10:07:39 +0100	[thread overview]
Message-ID: <cd30b9d1-169f-40db-8b07-71c0302a6de8@arm.com> (raw)
In-Reply-To: <E1g2Z6Z-0003el-5M@rmk-PC.armlinux.org.uk>

Hi Russell,

On 19/09/18 10:49, Russell King wrote:
> 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.
> 

Reviewed-by: Julien Thierry <julien.thierry@arm.com>

> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>   arch/arm/include/asm/proc-fns.h | 36 ++++++++++++++++++++++++------------
>   arch/arm/kernel/setup.c         |  4 +---
>   2 files changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
> index 30c499146320..571a1346245b 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,26 @@ 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
> +
> +extern struct processor processor;
> +#define PROC_VTABLE(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_VTABLE(dcache_clean_area)
> +#define cpu_set_pte_ext			PROC_VTABLE(set_pte_ext)
> +#define cpu_do_switch_mm		PROC_VTABLE(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
> +#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 05a4eb6b0d01..c214bd14a1fe 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
> 

-- 
Julien Thierry

  reply	other threads:[~2018-09-20  9:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19  9:48 [PATCH 0/5] Spectre big.Little updates Russell King - ARM Linux
2018-09-19  9:48 ` [PATCH 1/5] ARM: make lookup_processor_type() non-__init Russell King
2018-09-20  9:07   ` Julien Thierry
2018-09-19  9:48 ` [PATCH 2/5] ARM: split out processor lookup Russell King
2018-09-20  9:05   ` Julien Thierry
2018-09-19  9:49 ` [PATCH 3/5] ARM: clean up per-processor check_bugs method call Russell King
2018-09-20  9:06   ` Julien Thierry
2018-09-19  9:49 ` [PATCH 4/5] ARM: add PROC_VTABLE macro Russell King
2018-09-20  9:07   ` Julien Thierry [this message]
2018-09-19  9:49 ` [PATCH 5/5] ARM: spectre-v2: per-CPU vtables to work around big.Little systems Russell King
2018-09-20  9:04   ` Julien Thierry
2018-09-20  9:21     ` Russell King - ARM Linux
2018-09-20  9:28       ` Julien Thierry
2018-10-05  9:09   ` Marek Szyprowski
2018-10-05  9:35     ` Krzysztof Kozlowski
2018-10-05  9:46     ` Russell King - ARM Linux
2018-10-30 10:50       ` Russell King - ARM Linux
2018-10-31 15:21         ` Marek Szyprowski
2018-10-31 18:12           ` Russell King - ARM Linux
2018-11-02 17:17         ` Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd30b9d1-169f-40db-8b07-71c0302a6de8@arm.com \
    --to=julien.thierry@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).