On 2023/10/7 8:11, D Scott Phillips wrote:
Sudeep Holla <sudeep.holla@xxxxxxx> writes:
Move all of the ARM-specific initialization into one function namely
acpi_arm_init(), so it is not necessary to modify/update bus.c every
time a new piece of it is added.
Cc: Lorenzo Pieralisi <lpieralisi@xxxxxxxxxx>
Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx>
Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Reviewed-by: Robin Murphy <robin.murphy@xxxxxxx>
Reviewed-by: Hanjun Guo <guohanjun@xxxxxxxxxx>
Link: https://lore.kernel.org/r/CAJZ5v0iBZRZmV_oU+VurqxnVMbFN_ttqrL=cLh0sUH+=u0PYsw@xxxxxxxxxxxxxx
Signed-off-by: Sudeep Holla <sudeep.holla@xxxxxxx>
---
drivers/acpi/arm64/Makefile | 2 +-
drivers/acpi/arm64/agdi.c | 2 +-
drivers/acpi/arm64/apmt.c | 2 +-
drivers/acpi/arm64/init.c | 13 +++++++++++++
drivers/acpi/arm64/init.h | 6 ++++++
drivers/acpi/arm64/iort.c | 1 +
drivers/acpi/bus.c | 7 +------
include/linux/acpi.h | 6 ++++++
include/linux/acpi_agdi.h | 13 -------------
include/linux/acpi_apmt.h | 19 -------------------
include/linux/acpi_iort.h | 2 --
11 files changed, 30 insertions(+), 43 deletions(-)
create mode 100644 drivers/acpi/arm64/init.c
create mode 100644 drivers/acpi/arm64/init.h
delete mode 100644 include/linux/acpi_agdi.h
delete mode 100644 include/linux/acpi_apmt.h
[...]
diff --git a/drivers/acpi/arm64/init.c b/drivers/acpi/arm64/init.c
new file mode 100644
index 000000000000..d3ce53dda122
--- /dev/null
+++ b/drivers/acpi/arm64/init.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/acpi.h>
+#include "init.h"
+
+void __init acpi_arm_init(void)
+{
+ if (IS_ENABLED(CONFIG_ACPI_AGDI))
+ acpi_agdi_init();
+ if (IS_ENABLED(CONFIG_ACPI_APMT))
+ acpi_apmt_init();
+ if (IS_ENABLED(CONFIG_ACPI_IORT))
+ acpi_iort_init();
+}
[...]
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index d161ff707de4..7a1eaf8c7bde 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -26,9 +26,6 @@
#include <asm/mpspec.h>
#include <linux/dmi.h>
#endif
-#include <linux/acpi_agdi.h>
-#include <linux/acpi_apmt.h>
-#include <linux/acpi_iort.h>
#include <linux/acpi_viot.h>
#include <linux/pci.h>
#include <acpi/apei.h>
@@ -1408,7 +1405,7 @@ static int __init acpi_init(void)
acpi_init_ffh();
pci_mmcfg_late_init();
- acpi_iort_init();
+ acpi_arm_init();
acpi_viot_early_init();
acpi_hest_init();
acpi_ghes_init();
@@ -1420,8 +1417,6 @@ static int __init acpi_init(void)
acpi_debugger_init();
acpi_setup_sb_notify_handler();
acpi_viot_init();
- acpi_agdi_init();
- acpi_apmt_init();
Hi Sudeep, this moves acpi_agdi_init() before acpi_ghes_init().
sdei initialization currently happens from ghes_init, so agdi devices
using SDEI can no longer probe:
| [ 0.515864] sdei: Failed to create event 1073741825: -5
| [ 0.515866] agdi agdi.0: Failed to register for SDEI event 1073741825
| [ 0.515867] agdi: probe of agdi.0 failed with error -5
| ...
| [ 0.516022] sdei: SDEIv1.0 (0x0) detected in firmware.
How about just move acpi_arm_init() to the place of after
acpi_ghes_init()?
I checked the functions in acpi_arm_init(), there are no other
dependencies except sdei_init().
Thanks
Hanjun