Skip to content

Commit 59529bb

Browse files
Huang Yiweiwilldeacon
authored andcommitted
firmware: SDEI: Allow sdei initialization without ACPI_APEI_GHES
SDEI usually initialize with the ACPI table, but on platforms where ACPI is not used, the SDEI feature can still be used to handle specific firmware calls or other customized purposes. Therefore, it is not necessary for ARM_SDE_INTERFACE to depend on ACPI_APEI_GHES. In commit dc4e8c0 ("ACPI: APEI: explicit init of HEST and GHES in acpi_init()"), to make APEI ready earlier, sdei_init was moved into acpi_ghes_init instead of being a standalone initcall, adding ACPI_APEI_GHES dependency to ARM_SDE_INTERFACE. This restricts the flexibility and usability of SDEI. This patch corrects the dependency in Kconfig and splits sdei_init() into two separate functions: sdei_init() and acpi_sdei_init(). sdei_init() will be called by arch_initcall and will only initialize the platform driver, while acpi_sdei_init() will initialize the device from acpi_ghes_init() when ACPI is ready. This allows the initialization of SDEI without ACPI_APEI_GHES enabled. Fixes: dc4e8c0 ("ACPI: APEI: explicit init of HEST and GHES in apci_init()") Cc: Shuai Xue <xueshuai@linux.alibaba.com> Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com> Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/20250507045757.2658795-1-quic_hyiwei@quicinc.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 0af2f6b commit 59529bb

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

drivers/acpi/apei/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ config ACPI_APEI_GHES
2323
select ACPI_HED
2424
select IRQ_WORK
2525
select GENERIC_ALLOCATOR
26+
select ARM_SDE_INTERFACE if ARM64
2627
help
2728
Generic Hardware Error Source provides a way to report
2829
platform hardware errors (such as that from chipset). It

drivers/acpi/apei/ghes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ void __init acpi_ghes_init(void)
17151715
{
17161716
int rc;
17171717

1718-
sdei_init();
1718+
acpi_sdei_init();
17191719

17201720
if (acpi_disabled)
17211721
return;

drivers/firmware/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ config ARM_SCPI_PROTOCOL
3131
config ARM_SDE_INTERFACE
3232
bool "ARM Software Delegated Exception Interface (SDEI)"
3333
depends on ARM64
34-
depends on ACPI_APEI_GHES
3534
help
3635
The Software Delegated Exception Interface (SDEI) is an ARM
3736
standard for registering callbacks from the platform firmware

drivers/firmware/arm_sdei.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,13 +1062,12 @@ static bool __init sdei_present_acpi(void)
10621062
return true;
10631063
}
10641064

1065-
void __init sdei_init(void)
1065+
void __init acpi_sdei_init(void)
10661066
{
10671067
struct platform_device *pdev;
10681068
int ret;
10691069

1070-
ret = platform_driver_register(&sdei_driver);
1071-
if (ret || !sdei_present_acpi())
1070+
if (!sdei_present_acpi())
10721071
return;
10731072

10741073
pdev = platform_device_register_simple(sdei_driver.driver.name,
@@ -1081,6 +1080,12 @@ void __init sdei_init(void)
10811080
}
10821081
}
10831082

1083+
static int __init sdei_init(void)
1084+
{
1085+
return platform_driver_register(&sdei_driver);
1086+
}
1087+
arch_initcall(sdei_init);
1088+
10841089
int sdei_event_handler(struct pt_regs *regs,
10851090
struct sdei_registered_event *arg)
10861091
{

include/linux/arm_sdei.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ 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);
49+
void __init acpi_sdei_init(void);
5050
void sdei_handler_abort(void);
5151
#else
5252
static inline int sdei_mask_local_cpu(void) { return 0; }
5353
static inline int sdei_unmask_local_cpu(void) { return 0; }
54-
static inline void sdei_init(void) { }
54+
static inline void acpi_sdei_init(void) { }
5555
static inline void sdei_handler_abort(void) { }
5656
#endif /* CONFIG_ARM_SDE_INTERFACE */
5757

0 commit comments

Comments
 (0)