Skip to content

Commit dc4e8c0

Browse files
axiqiarafaeljw
authored andcommitted
ACPI: APEI: explicit init of HEST and GHES in apci_init()
From commit e147133 ("ACPI / APEI: Make hest.c manage the estatus memory pool") was merged, ghes_init() relies on acpi_hest_init() to manage the estatus memory pool. On the other hand, ghes_init() relies on sdei_init() to detect the SDEI version and (un)register events. The dependencies are as follows: ghes_init() => acpi_hest_init() => acpi_bus_init() => acpi_init() ghes_init() => sdei_init() HEST is not PCI-specific and initcall ordering is implicit and not well-defined within a level. Based on above, remove acpi_hest_init() from acpi_pci_root_init() and convert ghes_init() and sdei_init() from initcalls to explicit calls in the following order: acpi_hest_init() ghes_init() sdei_init() Signed-off-by: Shuai Xue <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7e57714 commit dc4e8c0

File tree

7 files changed

+18
-26
lines changed

7 files changed

+18
-26
lines changed

drivers/acpi/apei/ghes.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,33 +1457,35 @@ static struct platform_driver ghes_platform_driver = {
14571457
.remove = ghes_remove,
14581458
};
14591459

1460-
static int __init ghes_init(void)
1460+
void __init ghes_init(void)
14611461
{
14621462
int rc;
14631463

1464+
sdei_init();
1465+
14641466
if (acpi_disabled)
1465-
return -ENODEV;
1467+
return;
14661468

14671469
switch (hest_disable) {
14681470
case HEST_NOT_FOUND:
1469-
return -ENODEV;
1471+
return;
14701472
case HEST_DISABLED:
14711473
pr_info(GHES_PFX "HEST is not enabled!\n");
1472-
return -EINVAL;
1474+
return;
14731475
default:
14741476
break;
14751477
}
14761478

14771479
if (ghes_disable) {
14781480
pr_info(GHES_PFX "GHES is not enabled!\n");
1479-
return -EINVAL;
1481+
return;
14801482
}
14811483

14821484
ghes_nmi_init_cxt();
14831485

14841486
rc = platform_driver_register(&ghes_platform_driver);
14851487
if (rc)
1486-
goto err;
1488+
return;
14871489

14881490
rc = apei_osc_setup();
14891491
if (rc == 0 && osc_sb_apei_support_acked)
@@ -1494,9 +1496,4 @@ static int __init ghes_init(void)
14941496
pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit.\n");
14951497
else
14961498
pr_info(GHES_PFX "Failed to enable APEI firmware first mode.\n");
1497-
1498-
return 0;
1499-
err:
1500-
return rc;
15011499
}
1502-
device_initcall(ghes_init);

drivers/acpi/bus.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,8 @@ static int __init acpi_init(void)
13311331

13321332
pci_mmcfg_late_init();
13331333
acpi_iort_init();
1334+
acpi_hest_init();
1335+
ghes_init();
13341336
acpi_scan_init();
13351337
acpi_ec_init();
13361338
acpi_debugfs_init();

drivers/acpi/pci_root.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include <linux/slab.h>
2323
#include <linux/dmi.h>
2424
#include <linux/platform_data/x86/apple.h>
25-
#include <acpi/apei.h> /* for acpi_hest_init() */
26-
2725
#include "internal.h"
2826

2927
#define ACPI_PCI_ROOT_CLASS "pci_bridge"
@@ -943,7 +941,6 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
943941

944942
void __init acpi_pci_root_init(void)
945943
{
946-
acpi_hest_init();
947944
if (acpi_pci_disabled)
948945
return;
949946

drivers/firmware/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ config ARM_SCPI_POWER_DOMAIN
4040
config ARM_SDE_INTERFACE
4141
bool "ARM Software Delegated Exception Interface (SDEI)"
4242
depends on ARM64
43+
depends on ACPI_APEI_GHES
4344
help
4445
The Software Delegated Exception Interface (SDEI) is an ARM
4546
standard for registering callbacks from the platform firmware

drivers/firmware/arm_sdei.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,14 +1059,14 @@ static bool __init sdei_present_acpi(void)
10591059
return true;
10601060
}
10611061

1062-
static int __init sdei_init(void)
1062+
void __init sdei_init(void)
10631063
{
10641064
struct platform_device *pdev;
10651065
int ret;
10661066

10671067
ret = platform_driver_register(&sdei_driver);
10681068
if (ret || !sdei_present_acpi())
1069-
return ret;
1069+
return;
10701070

10711071
pdev = platform_device_register_simple(sdei_driver.driver.name,
10721072
0, NULL, 0);
@@ -1076,17 +1076,8 @@ static int __init sdei_init(void)
10761076
pr_info("Failed to register ACPI:SDEI platform device %d\n",
10771077
ret);
10781078
}
1079-
1080-
return ret;
10811079
}
10821080

1083-
/*
1084-
* On an ACPI system SDEI needs to be ready before HEST:GHES tries to register
1085-
* its events. ACPI is initialised from a subsys_initcall(), GHES is initialised
1086-
* by device_initcall(). We want to be called in the middle.
1087-
*/
1088-
subsys_initcall_sync(sdei_init);
1089-
10901081
int sdei_event_handler(struct pt_regs *regs,
10911082
struct sdei_registered_event *arg)
10921083
{

include/acpi/apei.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ extern int hest_disable;
2727
extern int erst_disable;
2828
#ifdef CONFIG_ACPI_APEI_GHES
2929
extern bool ghes_disable;
30+
void __init ghes_init(void);
3031
#else
3132
#define ghes_disable 1
33+
static inline void ghes_init(void) { }
3234
#endif
3335

3436
#ifdef CONFIG_ACPI_APEI
3537
void __init acpi_hest_init(void);
3638
#else
37-
static inline void acpi_hest_init(void) { return; }
39+
static inline void acpi_hest_init(void) { }
3840
#endif
3941

4042
int erst_write(const struct cper_record_header *record);

include/linux/arm_sdei.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ int sdei_unregister_ghes(struct ghes *ghes);
4646
/* For use by arch code when CPU hotplug notifiers are not appropriate. */
4747
int sdei_mask_local_cpu(void);
4848
int sdei_unmask_local_cpu(void);
49+
void __init sdei_init(void);
4950
#else
5051
static inline int sdei_mask_local_cpu(void) { return 0; }
5152
static inline int sdei_unmask_local_cpu(void) { return 0; }
53+
static inline void sdei_init(void) { }
5254
#endif /* CONFIG_ARM_SDE_INTERFACE */
5355

5456

0 commit comments

Comments
 (0)