These commits were created to make APEI tables testable. All should be pushed to some test brunch so anybody could test it on his own, reused etc.
Tomasz Nowicki (3): acpi, apei, erst: Reserve no cachable region for persistent storage. acpi, apei, einj: Hack EINJ driver to enable injection GHES and kernel panic from userspace. apci, apei, arm64: Make some space for APEI blob.
arch/arm64/boot/dts/foundation-v8-acpi.dts | 2 +- drivers/acpi/apei/einj.c | 27 +++++++++++++++++++++++++++ drivers/acpi/apei/erst.c | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-)
Since buffer for persistent storage is placed in RAM (only for test purpose) dumping dmesg log to this region and reset machine right away will not flush cache to memory. Setting region as non-cachable allow to omit this problem. --- drivers/acpi/apei/erst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 8f2904a..a39c356 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -1176,7 +1176,7 @@ static int __init erst_init(void) goto err_unmap_reg; } rc = -ENOMEM; - erst_erange.vaddr = ioremap_cache(erst_erange.base, + erst_erange.vaddr = ioremap_nocache(erst_erange.base, erst_erange.size); if (!erst_erange.vaddr) goto err_release_erange;
There are couple of reasons why such hack was applied: o lack of UEFI thus no firmware region is reserved to exchange info about error between firmware and OS o EINJ table should operate on registers but GPIO interrupts are availabled now
We set aside some pretend physical space (that is described the same in the tables) and fill in with some error info e.g. memory error. Then it should be triggered. The easiest way to trigger hardware error is to call AML method directly which in turn notify HED (hardware error device). Later on, HED call SCI handler, traverse all GHES list, match appropriate GHES and start to parse.
Signed-off-by: Tomasz Nowicki tomasz.nowicki@linaro.org --- drivers/acpi/apei/einj.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index fb57d03..d51c8a6 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -645,10 +645,33 @@ DEFINE_SIMPLE_ATTRIBUTE(error_type_fops, error_type_get,
static int error_inject_set(void *data, u64 val) { +#if defined (CONFIG_ARM) || defined (CONFIG_ARM64) + /* + * Simulate error injection by calling AML control method directly. + * We need this hack because of lack in GPIO functionality. + */ + int status = ACPI_EINJ_SUCCESS; + + /* Reserve valu=1 for error trigger */ + if (val == 1) { + status = acpi_evaluate_object(NULL, "\_SB.TRIG", NULL, NULL); + if (status != ACPI_EINJ_SUCCESS) + pr_err("Failure during AML control method.\n"); + } + + /* Reserve valu=2 panic triggered by user */ + if (val == 2) { + panic_timeout = 5; + panic("Panic cosed by user ! Only for test purpose !"); + } + + return status; +#else if (!error_type) return -EINVAL;
return einj_error_inject(error_type, error_param1, error_param2); +#endif }
DEFINE_SIMPLE_ATTRIBUTE(error_inject_fops, NULL, @@ -700,6 +723,7 @@ static int __init einj_init(void) einj_debug_dir = debugfs_create_dir("einj", apei_get_debugfs_dir()); if (!einj_debug_dir) goto err_cleanup; +#if !defined (CONFIG_ARM) && !defined (CONFIG_ARM64) fentry = debugfs_create_file("available_error_type", S_IRUSR, einj_debug_dir, NULL, &available_error_type_fops); @@ -709,11 +733,13 @@ static int __init einj_init(void) einj_debug_dir, NULL, &error_type_fops); if (!fentry) goto err_cleanup; +#endif fentry = debugfs_create_file("error_inject", S_IWUSR, einj_debug_dir, NULL, &error_inject_fops); if (!fentry) goto err_cleanup;
+#if !defined (CONFIG_ARM) && !defined (CONFIG_ARM64) apei_resources_init(&einj_resources); einj_exec_ctx_init(&ctx); rc = apei_exec_collect_resources(&ctx, &einj_resources); @@ -756,6 +782,7 @@ static int __init einj_init(void) if (!fentry) goto err_unmap; } +#endif
pr_info(EINJ_PFX "Error INJection is initialized.\n");
Foundation model cover RAM memory totally, so we just shrink it a little for APEI blob. --- arch/arm64/boot/dts/foundation-v8-acpi.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/foundation-v8-acpi.dts b/arch/arm64/boot/dts/foundation-v8-acpi.dts index 2d9332c..78ca197 100644 --- a/arch/arm64/boot/dts/foundation-v8-acpi.dts +++ b/arch/arm64/boot/dts/foundation-v8-acpi.dts @@ -58,7 +58,7 @@
memory@80000000 { device_type = "memory"; - reg = <0x00000000 0x80000000 0 0x80000000>, + reg = <0x00000000 0x80000000 0 0x7fff0000>, <0x00000008 0x80000000 0 0x80000000>; };
On 09/06/2013 08:07 AM, Tomasz Nowicki wrote:
These commits were created to make APEI tables testable. All should be pushed to some test brunch so anybody could test it on his own, reused etc.
Tomasz Nowicki (3): acpi, apei, erst: Reserve no cachable region for persistent storage. acpi, apei, einj: Hack EINJ driver to enable injection GHES and kernel panic from userspace. apci, apei, arm64: Make some space for APEI blob.
arch/arm64/boot/dts/foundation-v8-acpi.dts | 2 +- drivers/acpi/apei/einj.c | 27 +++++++++++++++++++++++++++ drivers/acpi/apei/erst.c | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-)
So I think these patches are okay as they are. Are you working on this for UEFI, also? I'd like to see a separate patch enabling this to work for the UEFI case also as soon as we can.
Otherwise,
Acked-by: Al Stone al.stone@linaro.org