Skip to content

Commit

Permalink
s390/sclp: Initialize sclp subsystem via arch_cpu_finalize_init()
Browse files Browse the repository at this point in the history
[ Upstream commit 3bcc8a1 ]

With the switch to GENERIC_CPU_DEVICES an early call to the sclp subsystem
was added to smp_prepare_cpus(). This will usually succeed since the sclp
subsystem is implicitly initialized early enough if an sclp based console
is present.

If no such console is present the initialization happens with an
arch_initcall(); in such cases calls to the sclp subsystem will fail.
For CPU detection this means that the fallback sigp loop will be used
permanently to detect CPUs instead of the preferred READ_CPU_INFO sclp
request.

Fix this by adding an explicit early sclp_init() call via
arch_cpu_finalize_init().

Reported-by: Sheshu Ramanandan <[email protected]>
Fixes: 4a39f12 ("s390/smp: Switch to GENERIC_CPU_DEVICES")
Reviewed-by: Peter Oberparleiter <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Alexander Gordeev <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
hcahca authored and gregkh committed Feb 8, 2025
1 parent a24764c commit 62ac92c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions arch/s390/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ config S390
select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
select ARCH_ENABLE_MEMORY_HOTREMOVE
select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
select ARCH_HAS_CPU_FINALIZE_INIT
select ARCH_HAS_CURRENT_STACK_POINTER
select ARCH_HAS_DEBUG_VIRTUAL
select ARCH_HAS_DEBUG_VM_PGTABLE
Expand Down
1 change: 1 addition & 0 deletions arch/s390/include/asm/sclp.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void sclp_early_printk(const char *s);
void __sclp_early_printk(const char *s, unsigned int len);
void sclp_emergency_printk(const char *s);

int sclp_init(void);
int sclp_early_get_memsize(unsigned long *mem);
int sclp_early_get_hsa_size(unsigned long *hsa_size);
int _sclp_get_core_info(struct sclp_core_info *info);
Expand Down
5 changes: 5 additions & 0 deletions arch/s390/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,3 +1006,8 @@ void __init setup_arch(char **cmdline_p)
/* Add system specific data to the random pool */
setup_randomness();
}

void __init arch_cpu_finalize_init(void)
{
sclp_init();
}
12 changes: 2 additions & 10 deletions drivers/s390/char/sclp.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ static void sclp_request_timeout(bool force_restart);
static void sclp_process_queue(void);
static void __sclp_make_read_req(void);
static int sclp_init_mask(int calculate);
static int sclp_init(void);

static void
__sclp_queue_read_req(void)
Expand Down Expand Up @@ -1251,8 +1250,7 @@ static struct platform_driver sclp_pdrv = {

/* Initialize SCLP driver. Return zero if driver is operational, non-zero
* otherwise. */
static int
sclp_init(void)
int sclp_init(void)
{
unsigned long flags;
int rc = 0;
Expand Down Expand Up @@ -1305,13 +1303,7 @@ sclp_init(void)

static __init int sclp_initcall(void)
{
int rc;

rc = platform_driver_register(&sclp_pdrv);
if (rc)
return rc;

return sclp_init();
return platform_driver_register(&sclp_pdrv);
}

arch_initcall(sclp_initcall);

0 comments on commit 62ac92c

Please sign in to comment.