s390/smp: keep the original lowcore for CPU 0

Now that CPU 0 is not hotpluggable, it is not necessary to support
freeing its stacks. Delete all the code that migrates it to new stacks
and a new lowcore.

Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Ilya Leoshkevich 2023-07-31 17:07:11 +02:00 committed by Vasily Gorbik
parent 496bb034f4
commit 3570ee046c
3 changed files with 0 additions and 64 deletions

View File

@ -59,7 +59,6 @@ static inline void smp_cpus_done(unsigned int max_cpus)
{
}
extern int smp_reinit_ipl_cpu(void);
extern int smp_rescan_cpus(void);
extern void __noreturn cpu_die(void);
extern void __cpu_die(unsigned int cpu);

View File

@ -381,12 +381,6 @@ void stack_free(unsigned long stack)
#endif
}
void __init __noreturn arch_call_rest_init(void)
{
smp_reinit_ipl_cpu();
rest_init();
}
static unsigned long __init stack_alloc_early(void)
{
unsigned long stack;

View File

@ -1256,60 +1256,3 @@ out:
return rc;
}
subsys_initcall(s390_smp_init);
static __always_inline void set_new_lowcore(struct lowcore *lc)
{
union register_pair dst, src;
u32 pfx;
src.even = (unsigned long) &S390_lowcore;
src.odd = sizeof(S390_lowcore);
dst.even = (unsigned long) lc;
dst.odd = sizeof(*lc);
pfx = __pa(lc);
asm volatile(
" mvcl %[dst],%[src]\n"
" spx %[pfx]\n"
: [dst] "+&d" (dst.pair), [src] "+&d" (src.pair)
: [pfx] "Q" (pfx)
: "memory", "cc");
}
int __init smp_reinit_ipl_cpu(void)
{
unsigned long async_stack, nodat_stack, mcck_stack;
struct lowcore *lc, *lc_ipl;
unsigned long flags, cr0;
u64 mcesad;
lc_ipl = lowcore_ptr[0];
lc = (struct lowcore *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
nodat_stack = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
async_stack = stack_alloc();
mcck_stack = stack_alloc();
if (!lc || !nodat_stack || !async_stack || !mcck_stack || nmi_alloc_mcesa(&mcesad))
panic("Couldn't allocate memory");
local_irq_save(flags);
local_mcck_disable();
set_new_lowcore(lc);
S390_lowcore.nodat_stack = nodat_stack + STACK_INIT_OFFSET;
S390_lowcore.async_stack = async_stack + STACK_INIT_OFFSET;
S390_lowcore.mcck_stack = mcck_stack + STACK_INIT_OFFSET;
__ctl_store(cr0, 0, 0);
__ctl_clear_bit(0, 28); /* disable lowcore protection */
S390_lowcore.mcesad = mcesad;
__ctl_load(cr0, 0, 0);
if (abs_lowcore_map(0, lc, false))
panic("Couldn't remap absolute lowcore");
lowcore_ptr[0] = lc;
local_mcck_enable();
local_irq_restore(flags);
memblock_free_late(__pa(lc_ipl->mcck_stack - STACK_INIT_OFFSET), THREAD_SIZE);
memblock_free_late(__pa(lc_ipl->async_stack - STACK_INIT_OFFSET), THREAD_SIZE);
memblock_free_late(__pa(lc_ipl->nodat_stack - STACK_INIT_OFFSET), THREAD_SIZE);
memblock_free_late(__pa(lc_ipl), sizeof(*lc_ipl));
return 0;
}