linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support
@ 2011-06-27  8:25 Huang Ying
  2011-06-27  8:25 ` [PATCH -v2 1/4] ACPI, APEI, GHES, Prevent GHES to be built as module Huang Ying
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Huang Ying @ 2011-06-27  8:25 UTC (permalink / raw)
  To: Len Brown
  Cc: linux-kernel, Andi Kleen, Tony Luck, ying.huang, linux-acpi,
	mjg59

Changes:

- Change error message for WHEA _OSC call according to Matthew's comments

[PATCH -v2 1/4] ACPI, APEI, GHES, Prevent GHES to be built as module
[PATCH -v2 2/4] ACPI, APEI, GHES, Support disable GHES at boot time
[PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call
[PATCH -v2 4/4] ACPI, APEI, Add WHEA _OSC support

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH -v2 1/4] ACPI, APEI, GHES, Prevent GHES to be built as module
  2011-06-27  8:25 [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support Huang Ying
@ 2011-06-27  8:25 ` Huang Ying
  2011-06-27  8:25 ` [PATCH -v2 2/4] ACPI, APEI, GHES, Support disable GHES at boot time Huang Ying
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Huang Ying @ 2011-06-27  8:25 UTC (permalink / raw)
  To: Len Brown
  Cc: linux-kernel, Andi Kleen, Tony Luck, ying.huang, linux-acpi,
	mjg59

GHES (Generic Hardware Error Source) is used to process hardware error
notification in firmware first mode.  But because firmware first mode
can be turned on but can not be turned off, it is unreasonable to
unload the GHES module with firmware first mode turned on.  To avoid
confusion, this patch makes GHES can be enable/disable in
configuration time, but not built as module and unload at run time.

Signed-off-by: Huang Ying <ying.huang@intel.com>
---
 drivers/acpi/apei/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/acpi/apei/Kconfig
+++ b/drivers/acpi/apei/Kconfig
@@ -10,7 +10,7 @@ config ACPI_APEI
 	  error injection.
 
 config ACPI_APEI_GHES
-	tristate "APEI Generic Hardware Error Source"
+	bool "APEI Generic Hardware Error Source"
 	depends on ACPI_APEI && X86
 	select ACPI_HED
 	help

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH -v2 2/4] ACPI, APEI, GHES, Support disable GHES at boot time
  2011-06-27  8:25 [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support Huang Ying
  2011-06-27  8:25 ` [PATCH -v2 1/4] ACPI, APEI, GHES, Prevent GHES to be built as module Huang Ying
@ 2011-06-27  8:25 ` Huang Ying
  2011-06-27  8:25 ` [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call Huang Ying
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Huang Ying @ 2011-06-27  8:25 UTC (permalink / raw)
  To: Len Brown
  Cc: linux-kernel, Andi Kleen, Tony Luck, ying.huang, linux-acpi,
	mjg59

Some machine may have broken firmware so that GHES and firmware first
mode should be disabled.  This patch adds support to that.

Signed-off-by: Huang Ying <ying.huang@intel.com>
---
 drivers/acpi/apei/ghes.c |    8 ++++++++
 drivers/acpi/apei/hest.c |   17 +++++++++--------
 include/acpi/apei.h      |    1 +
 3 files changed, 18 insertions(+), 8 deletions(-)

--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -77,6 +77,9 @@ struct ghes {
 	};
 };
 
+int ghes_disable;
+module_param_named(disable, ghes_disable, bool, 0);
+
 static int ghes_panic_timeout	__read_mostly = 30;
 
 /*
@@ -665,6 +668,11 @@ static int __init ghes_init(void)
 		return -EINVAL;
 	}
 
+	if (ghes_disable) {
+		pr_info(GHES_PFX "GHES is not enabled!\n");
+		return -EINVAL;
+	}
+
 	rc = ghes_ioremap_init();
 	if (rc)
 		goto err;
--- a/drivers/acpi/apei/hest.c
+++ b/drivers/acpi/apei/hest.c
@@ -230,16 +230,17 @@ void __init acpi_hest_init(void)
 		goto err;
 	}
 
-	rc = apei_hest_parse(hest_parse_ghes_count, &ghes_count);
-	if (rc)
-		goto err;
-
-	rc = hest_ghes_dev_register(ghes_count);
-	if (!rc) {
-		pr_info(HEST_PFX "Table parsing has been initialized.\n");
-		return;
+	if (!ghes_disable) {
+		rc = apei_hest_parse(hest_parse_ghes_count, &ghes_count);
+		if (rc)
+			goto err;
+		rc = hest_ghes_dev_register(ghes_count);
+		if (rc)
+			goto err;
 	}
 
+	pr_info(HEST_PFX "Table parsing has been initialized.\n");
+	return;
 err:
 	hest_disable = 1;
 }
--- a/include/acpi/apei.h
+++ b/include/acpi/apei.h
@@ -18,6 +18,7 @@
 
 extern int hest_disable;
 extern int erst_disable;
+extern int ghes_disable;
 
 #ifdef CONFIG_ACPI_APEI
 void __init acpi_hest_init(void);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call
  2011-06-27  8:25 [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support Huang Ying
  2011-06-27  8:25 ` [PATCH -v2 1/4] ACPI, APEI, GHES, Prevent GHES to be built as module Huang Ying
  2011-06-27  8:25 ` [PATCH -v2 2/4] ACPI, APEI, GHES, Support disable GHES at boot time Huang Ying
@ 2011-06-27  8:25 ` Huang Ying
  2011-07-04 10:28   ` Thomas Renninger
  2011-06-27  8:26 ` [PATCH -v2 4/4] ACPI, APEI, Add WHEA _OSC support Huang Ying
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Huang Ying @ 2011-06-27  8:25 UTC (permalink / raw)
  To: Len Brown
  Cc: linux-kernel, Andi Kleen, Tony Luck, ying.huang, linux-acpi,
	mjg59

In APEI firmware first mode, hardware error is reported by hardware to
firmware firstly, then firmware reports the error to Linux in a GHES
error record via POLL/SCI/IRQ/NMI etc.

This may result in some issues if OS has no full APEI support.  So
some firmware implementation will work in a back-compatible mode by
default.  Where firmware will only notify OS in old-fashion, without
GHES record.  For example, for a fatal hardware error, only NMI is
signaled, no GHES record.

To gain full APEI power on these machines, APEI bit in generic _OSC
call can be specified to tell firmware that Linux has full APEI
support.  This patch adds the APEI bit support in generic _OSC call.

Signed-off-by: Huang Ying <ying.huang@intel.com>
---
 drivers/acpi/bus.c   |   16 ++++++++++++++--
 include/linux/acpi.h |    2 ++
 2 files changed, 16 insertions(+), 2 deletions(-)

--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -39,6 +39,7 @@
 #include <linux/pci.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
+#include <acpi/apei.h>
 #include <linux/dmi.h>
 #include <linux/suspend.h>
 
@@ -519,6 +520,7 @@ out_kfree:
 }
 EXPORT_SYMBOL(acpi_run_osc);
 
+bool osc_sb_apei_support_acked;
 static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
 static void acpi_bus_osc_support(void)
 {
@@ -541,11 +543,21 @@ static void acpi_bus_osc_support(void)
 #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 	capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT;
 #endif
+
+#ifdef CONFIG_ACPI_APEI_GHES
+	if (!ghes_disable)
+		capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_APEI_SUPPORT;
+#endif
 	if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
 		return;
-	if (ACPI_SUCCESS(acpi_run_osc(handle, &context)))
+	if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) {
+		u32 *capbuf_ret = context.ret.pointer;
+		if (context.ret.length > OSC_SUPPORT_TYPE)
+			osc_sb_apei_support_acked =
+				capbuf_ret[OSC_SUPPORT_TYPE] & OSC_SB_APEI_SUPPORT;
 		kfree(context.ret.pointer);
-	/* do we need to check the returned cap? Sounds no */
+	}
+	/* do we need to check other returned cap? Sounds no */
 }
 
 /* --------------------------------------------------------------------------
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -282,6 +282,8 @@ acpi_status acpi_run_osc(acpi_handle han
 
 extern bool osc_sb_apei_support_acked;
 
+extern bool osc_sb_apei_support_acked;
+
 /* PCI defined _OSC bits */
 /* _OSC DW1 Definition (OS Support Fields) */
 #define OSC_EXT_PCI_CONFIG_SUPPORT		1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH -v2 4/4] ACPI, APEI, Add WHEA _OSC support
  2011-06-27  8:25 [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support Huang Ying
                   ` (2 preceding siblings ...)
  2011-06-27  8:25 ` [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call Huang Ying
@ 2011-06-27  8:26 ` Huang Ying
  2011-06-27 20:38 ` [PATCH -v2 0/4] ACPI, APEI, Add APEI related " Andi Kleen
  2011-06-28 16:58 ` Matthew Garrett
  5 siblings, 0 replies; 9+ messages in thread
From: Huang Ying @ 2011-06-27  8:26 UTC (permalink / raw)
  To: Len Brown
  Cc: linux-kernel, Andi Kleen, Tony Luck, ying.huang, linux-acpi,
	mjg59

APEI firmware first mode must be turned on explicitly on some
machines, otherwise there may be no GHES hardware error record for
hardware error notification.  APEI bit in generic _OSC call can be
used to do that, but on some machine, a special WHEA _OSC call must be
used.  This patch adds the support to that WHEA _OSC call.

Signed-off-by: Huang Ying <ying.huang@intel.com>
---
 drivers/acpi/apei/apei-base.c     |   26 ++++++++++++++++++++++++++
 drivers/acpi/apei/apei-internal.h |    2 ++
 drivers/acpi/apei/ghes.c          |   10 ++++++++++
 3 files changed, 38 insertions(+)

--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -604,3 +604,29 @@ struct dentry *apei_get_debugfs_dir(void
 	return dapei;
 }
 EXPORT_SYMBOL_GPL(apei_get_debugfs_dir);
+
+int apei_osc_setup(void)
+{
+	static u8 whea_uuid_str[] = "ed855e0c-6c90-47bf-a62a-26de0fc5ad5c";
+	acpi_handle handle;
+	u32 capbuf[3];
+	struct acpi_osc_context context = {
+		.uuid_str	= whea_uuid_str,
+		.rev		= 1,
+		.cap.length	= sizeof(capbuf),
+		.cap.pointer	= capbuf,
+	};
+
+	capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
+	capbuf[OSC_SUPPORT_TYPE] = 0;
+	capbuf[OSC_CONTROL_TYPE] = 0;
+
+	if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))
+	    || ACPI_FAILURE(acpi_run_osc(handle, &context)))
+		return -EIO;
+	else {
+		kfree(context.ret.pointer);
+		return 0;
+	}
+}
+EXPORT_SYMBOL_GPL(apei_osc_setup);
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -124,4 +124,6 @@ void apei_estatus_print(const char *pfx,
 			const struct acpi_hest_generic_status *estatus);
 int apei_estatus_check_header(const struct acpi_hest_generic_status *estatus);
 int apei_estatus_check(const struct acpi_hest_generic_status *estatus);
+
+int apei_osc_setup(void);
 #endif
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -681,6 +681,16 @@ static int __init ghes_init(void)
 	if (rc)
 		goto err_ioremap_exit;
 
+	rc = apei_osc_setup();
+	if (rc == 0 && osc_sb_apei_support_acked)
+		pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit and WHEA _OSC.\n");
+	else if (rc == 0 && !osc_sb_apei_support_acked)
+		pr_info(GHES_PFX "APEI firmware first mode is enabled by WHEA _OSC.\n");
+	else if (rc && osc_sb_apei_support_acked)
+		pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit.\n");
+	else
+		pr_info(GHES_PFX "Failed to enable APEI firmware first mode.\n");
+
 	return 0;
 err_ioremap_exit:
 	ghes_ioremap_exit();

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support
  2011-06-27  8:25 [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support Huang Ying
                   ` (3 preceding siblings ...)
  2011-06-27  8:26 ` [PATCH -v2 4/4] ACPI, APEI, Add WHEA _OSC support Huang Ying
@ 2011-06-27 20:38 ` Andi Kleen
  2011-06-28 16:58 ` Matthew Garrett
  5 siblings, 0 replies; 9+ messages in thread
From: Andi Kleen @ 2011-06-27 20:38 UTC (permalink / raw)
  To: Huang Ying; +Cc: Len Brown, linux-kernel, Tony Luck, linux-acpi, mjg59

Huang Ying <ying.huang@intel.com> writes:

> Changes:
>
> - Change error message for WHEA _OSC call according to Matthew's comments
>
> [PATCH -v2 1/4] ACPI, APEI, GHES, Prevent GHES to be built as module
> [PATCH -v2 2/4] ACPI, APEI, GHES, Support disable GHES at boot time
> [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call
> [PATCH -v2 4/4] ACPI, APEI, Add WHEA _OSC support

FWIW I reviewed the patch-kit and it all looks good to me.

Reviewed-by: Andi Kleen <ak@linux.intel.com>

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support
  2011-06-27  8:25 [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support Huang Ying
                   ` (4 preceding siblings ...)
  2011-06-27 20:38 ` [PATCH -v2 0/4] ACPI, APEI, Add APEI related " Andi Kleen
@ 2011-06-28 16:58 ` Matthew Garrett
  5 siblings, 0 replies; 9+ messages in thread
From: Matthew Garrett @ 2011-06-28 16:58 UTC (permalink / raw)
  To: Huang Ying; +Cc: Len Brown, linux-kernel, Andi Kleen, Tony Luck, linux-acpi

These all look good to me.

Reviewed-by: Matthew Garrett <mjg@redhat.com>

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call
  2011-06-27  8:25 ` [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call Huang Ying
@ 2011-07-04 10:28   ` Thomas Renninger
  2011-07-05  0:24     ` Huang Ying
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Renninger @ 2011-07-04 10:28 UTC (permalink / raw)
  To: Huang Ying
  Cc: Len Brown, linux-kernel, Andi Kleen, Tony Luck, linux-acpi, mjg59

On Monday, June 27, 2011 10:25:59 AM Huang Ying wrote:

>  extern bool osc_sb_apei_support_acked;
>  
> +extern bool osc_sb_apei_support_acked;
> +
double osc_sb_apei_support_acked declaration?

   Thomas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call
  2011-07-04 10:28   ` Thomas Renninger
@ 2011-07-05  0:24     ` Huang Ying
  0 siblings, 0 replies; 9+ messages in thread
From: Huang Ying @ 2011-07-05  0:24 UTC (permalink / raw)
  To: Thomas Renninger
  Cc: Len Brown, linux-kernel@vger.kernel.org, Andi Kleen, Luck, Tony,
	linux-acpi@vger.kernel.org, mjg59@srcf.ucam.org

Hi, Thomas,

On 07/04/2011 06:28 PM, Thomas Renninger wrote:
> On Monday, June 27, 2011 10:25:59 AM Huang Ying wrote:
> 
>>  extern bool osc_sb_apei_support_acked;
>>  
>> +extern bool osc_sb_apei_support_acked;
>> +
> double osc_sb_apei_support_acked declaration?

Sorry, I have some issue with patch management.  Will fix it in the new
version.

Best Regards,
Huang Ying

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-07-05  0:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-27  8:25 [PATCH -v2 0/4] ACPI, APEI, Add APEI related _OSC support Huang Ying
2011-06-27  8:25 ` [PATCH -v2 1/4] ACPI, APEI, GHES, Prevent GHES to be built as module Huang Ying
2011-06-27  8:25 ` [PATCH -v2 2/4] ACPI, APEI, GHES, Support disable GHES at boot time Huang Ying
2011-06-27  8:25 ` [PATCH -v2 3/4] ACPI, APEI, Add APEI bit support in generic _OSC call Huang Ying
2011-07-04 10:28   ` Thomas Renninger
2011-07-05  0:24     ` Huang Ying
2011-06-27  8:26 ` [PATCH -v2 4/4] ACPI, APEI, Add WHEA _OSC support Huang Ying
2011-06-27 20:38 ` [PATCH -v2 0/4] ACPI, APEI, Add APEI related " Andi Kleen
2011-06-28 16:58 ` Matthew Garrett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).