[RESEND PATCH v3 6/9] ghes: Introduce a flag ghes_present

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce a flag ghes_present to differentiate between the system ROM
really not offering GHES vs. the ghes module not running. The true of
ghes_present means ghes_probe() has been called.

If ghes_edac is not enabled (but ghes is enabled) on a system with GHES
present & preferred, no edac driver gets registered.

Suggested-by: Toshi Kani <toshi.kani@xxxxxxx>
Signed-off-by: Jia He <justin.he@xxxxxxx>
---
 drivers/acpi/apei/ghes.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 327386f3cf33..31c674639e86 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -114,6 +114,8 @@ static int __init setup_ghes_edac_load(char *str)
 }
 __setup("ghes_edac_force=", setup_ghes_edac_load);
 
+static bool ghes_present;
+
 static ATOMIC_NOTIFIER_HEAD(ghes_report_chain);
 
 static inline bool is_hest_type_generic_v2(struct ghes *ghes)
@@ -1407,6 +1409,8 @@ static int ghes_probe(struct platform_device *ghes_dev)
 	list_add_tail(&ghes->elist, &ghes_devs);
 	mutex_unlock(&ghes_devs_mutex);
 
+	ghes_present = true;
+
 	/* Handle any pending errors right away */
 	spin_lock_irqsave(&ghes_notify_lock_irq, flags);
 	ghes_proc(ghes);
@@ -1541,6 +1545,9 @@ bool ghes_edac_preferred(void)
 {
 	int idx = -1;
 
+	if (!ghes_present)
+		return false;
+
 	if (IS_ENABLED(CONFIG_X86)) {
 		idx = acpi_match_platform_list(plat_list);
 		if (idx < 0 && !ghes_edac_force)
-- 
2.25.1




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux