mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 01:24:47 +07:00
a0995c0805
Currently, there are several issues with how MPU is setup: 1. We won't boot if MPU is missing 2. We won't boot if use XIP 3. Further extension of MPU setup requires asm skills The 1st point can be relaxed, so we can continue with boot CPU even if MPU is missed and fail boot for secondaries only. To address the 2nd point we could create region covering CONFIG_XIP_PHYS_ADDR - _end and that might work for the first stage of MPU enable, but due to MPU's alignment requirement we could cover too much, IOW we need more flexibility in how we're partitioning memory regions... and it'd be hardly possible to archive because of the 3rd point. This patch is trying to address 1st and 3rd issues and paves the path for 2nd and further improvements. The most visible change introduced with this patch is that we start using mpu_rgn_info array (as it was supposed?), so change in MPU setup done by boot CPU is recorded there and feed to secondaries. It allows us to keep minimal region setup for boot CPU and do the rest in C. Since we start programming MPU regions in C evaluation of MPU constrains (number of regions supported and minimal region order) can be done once, which in turn open possibility to free-up "probe" region early. Tested-by: Szemző András <sza@esh.hu> Tested-by: Alexandre TORGUE <alexandre.torgue@st.com> Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
128 lines
3.1 KiB
C
128 lines
3.1 KiB
C
/*
|
|
* arch/arm/include/asm/smp.h
|
|
*
|
|
* Copyright (C) 2004-2005 ARM Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#ifndef __ASM_ARM_SMP_H
|
|
#define __ASM_ARM_SMP_H
|
|
|
|
#include <linux/threads.h>
|
|
#include <linux/cpumask.h>
|
|
#include <linux/thread_info.h>
|
|
|
|
#ifndef CONFIG_SMP
|
|
# error "<asm/smp.h> included in non-SMP build"
|
|
#endif
|
|
|
|
#define raw_smp_processor_id() (current_thread_info()->cpu)
|
|
|
|
struct seq_file;
|
|
|
|
/*
|
|
* generate IPI list text
|
|
*/
|
|
extern void show_ipi_list(struct seq_file *, int);
|
|
|
|
/*
|
|
* Called from assembly code, this handles an IPI.
|
|
*/
|
|
asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);
|
|
|
|
/*
|
|
* Called from C code, this handles an IPI.
|
|
*/
|
|
void handle_IPI(int ipinr, struct pt_regs *regs);
|
|
|
|
/*
|
|
* Setup the set of possible CPUs (via set_cpu_possible)
|
|
*/
|
|
extern void smp_init_cpus(void);
|
|
|
|
|
|
/*
|
|
* Provide a function to raise an IPI cross call on CPUs in callmap.
|
|
*/
|
|
extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
|
|
|
|
/*
|
|
* Called from platform specific assembly code, this is the
|
|
* secondary CPU entry point.
|
|
*/
|
|
asmlinkage void secondary_start_kernel(void);
|
|
|
|
|
|
/*
|
|
* Initial data for bringing up a secondary CPU.
|
|
*/
|
|
struct secondary_data {
|
|
union {
|
|
struct mpu_rgn_info *mpu_rgn_info;
|
|
u64 pgdir;
|
|
};
|
|
unsigned long swapper_pg_dir;
|
|
void *stack;
|
|
};
|
|
extern struct secondary_data secondary_data;
|
|
extern volatile int pen_release;
|
|
extern void secondary_startup(void);
|
|
extern void secondary_startup_arm(void);
|
|
|
|
extern int __cpu_disable(void);
|
|
|
|
extern void __cpu_die(unsigned int cpu);
|
|
|
|
extern void arch_send_call_function_single_ipi(int cpu);
|
|
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
|
|
extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
|
|
|
|
extern int register_ipi_completion(struct completion *completion, int cpu);
|
|
|
|
struct smp_operations {
|
|
#ifdef CONFIG_SMP
|
|
/*
|
|
* Setup the set of possible CPUs (via set_cpu_possible)
|
|
*/
|
|
void (*smp_init_cpus)(void);
|
|
/*
|
|
* Initialize cpu_possible map, and enable coherency
|
|
*/
|
|
void (*smp_prepare_cpus)(unsigned int max_cpus);
|
|
|
|
/*
|
|
* Perform platform specific initialisation of the specified CPU.
|
|
*/
|
|
void (*smp_secondary_init)(unsigned int cpu);
|
|
/*
|
|
* Boot a secondary CPU, and assign it the specified idle task.
|
|
* This also gives us the initial stack to use for this CPU.
|
|
*/
|
|
int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
int (*cpu_kill)(unsigned int cpu);
|
|
void (*cpu_die)(unsigned int cpu);
|
|
bool (*cpu_can_disable)(unsigned int cpu);
|
|
int (*cpu_disable)(unsigned int cpu);
|
|
#endif
|
|
#endif
|
|
};
|
|
|
|
struct of_cpu_method {
|
|
const char *method;
|
|
const struct smp_operations *ops;
|
|
};
|
|
|
|
#define CPU_METHOD_OF_DECLARE(name, _method, _ops) \
|
|
static const struct of_cpu_method __cpu_method_of_table_##name \
|
|
__used __section(__cpu_method_of_table) \
|
|
= { .method = _method, .ops = _ops }
|
|
/*
|
|
* set platform specific SMP operations
|
|
*/
|
|
extern void smp_set_ops(const struct smp_operations *);
|
|
|
|
#endif /* ifndef __ASM_ARM_SMP_H */
|