From: Huang Ying <ying.huang@intel.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-kernel@vger.kernel.org, Tony Luck <tony.luck@intel.com>,
ying.huang@intel.com, linux-acpi@vger.kernel.org
Subject: [PATCH 6/9] ACPI, Add RAM mapping support to ACPI atomic IO support
Date: Tue, 8 Nov 2011 10:39:31 +0800 [thread overview]
Message-ID: <1320719974-3598-7-git-send-email-ying.huang@intel.com> (raw)
In-Reply-To: <1320719974-3598-1-git-send-email-ying.huang@intel.com>
On one of our testing machine, the following EINJ command lines:
# echo 0x10000000 > param1
# echo 0xfffffffffffff000 > param2
# echo 0x8 > error_type
# echo 1 > error_inject
Will get:
echo: write error: Input/output error
The EIO comes from:
rc = apei_exec_pre_map_gars(&trigger_ctx);
The root cause is as follow. Normally, ACPI atomic IO support is used
to access IO memory. But in EINJ of that machine, it is used to
access RAM to trigger the injected error. And the ioremap() called by
apei_exec_pre_map_gars() can not map the RAM.
This patch add RAM mapping support to ACPI atomic IO support to
satisfy EINJ requirement.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Tested-by: Tony Luck <tony.luck@intel.com>
---
drivers/acpi/atomicio.c | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -32,6 +32,8 @@
#include <linux/rculist.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
+#include <linux/mm.h>
+#include <linux/highmem.h>
#include <acpi/atomicio.h>
#define ACPI_PFX "ACPI: "
@@ -97,6 +99,30 @@ static void __iomem *__acpi_try_ioremap(
return NULL;
}
+static void __iomem *acpi_map(phys_addr_t pg_off, unsigned long pg_sz)
+{
+ unsigned long pfn;
+
+ pfn = pg_off >> PAGE_SHIFT;
+ if (page_is_ram(pfn)) {
+ if (pg_sz > PAGE_SIZE)
+ return NULL;
+ return (void __iomem __force *)kmap(pfn_to_page(pfn));
+ } else
+ return ioremap(pg_off, pg_sz);
+}
+
+static void acpi_unmap(phys_addr_t pg_off, void __iomem *vaddr)
+{
+ unsigned long pfn;
+
+ pfn = pg_off >> PAGE_SHIFT;
+ if (page_is_ram(pfn))
+ kunmap(pfn_to_page(pfn));
+ else
+ iounmap(vaddr);
+}
+
/*
* Used to pre-map the specified IO memory area. First try to find
* whether the area is already pre-mapped, if it is, increase the
@@ -119,7 +145,7 @@ static void __iomem *acpi_pre_map(phys_a
pg_off = paddr & PAGE_MASK;
pg_sz = ((paddr + size + PAGE_SIZE - 1) & PAGE_MASK) - pg_off;
- vaddr = ioremap(pg_off, pg_sz);
+ vaddr = acpi_map(pg_off, pg_sz);
if (!vaddr)
return NULL;
map = kmalloc(sizeof(*map), GFP_KERNEL);
@@ -135,7 +161,7 @@ static void __iomem *acpi_pre_map(phys_a
vaddr = __acpi_try_ioremap(paddr, size);
if (vaddr) {
spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
- iounmap(map->vaddr);
+ acpi_unmap(pg_off, map->vaddr);
kfree(map);
return vaddr;
}
@@ -144,7 +170,7 @@ static void __iomem *acpi_pre_map(phys_a
return map->vaddr + (paddr - map->paddr);
err_unmap:
- iounmap(vaddr);
+ acpi_unmap(pg_off, vaddr);
return NULL;
}
@@ -177,7 +203,7 @@ static void acpi_post_unmap(phys_addr_t
return;
synchronize_rcu();
- iounmap(map->vaddr);
+ acpi_unmap(map->paddr, map->vaddr);
kfree(map);
}
next prev parent reply other threads:[~2011-11-08 2:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 2:39 [PATCH 0/8] ACPI, APEI patches for 3.2 (Resend) Huang Ying
2011-11-08 2:39 ` [PATCH 1/9] ACPI, APEI, Print resource errors in conventional format Huang Ying
2011-11-08 2:39 ` [PATCH 2/9] ACPI, APEI, Remove table not found message Huang Ying
2011-11-08 2:39 ` [PATCH 3/9] ACPI, Record ACPI NVS regions Huang Ying
2011-11-08 15:40 ` Bjorn Helgaas
2011-11-08 2:39 ` [PATCH 4/9] ACPI, APEI, Resolve false conflict between ACPI NVS and APEI Huang Ying
2011-11-18 1:41 ` Thomas Renninger
2011-11-08 2:39 ` [PATCH 5/9] ACPI, APEI, EINJ, Fix resource conflict on some machine Huang Ying
2011-11-08 2:39 ` Huang Ying [this message]
2011-11-08 21:38 ` [PATCH 6/9] ACPI, Add RAM mapping support to ACPI atomic IO support Myron Stowe
2012-01-17 9:51 ` Len Brown
2011-11-08 2:39 ` [PATCH 7/9] ACPI, APEI, EINJ, Refine the fix of resource conflict Huang Ying
2011-11-08 2:39 ` [PATCH 8/9] ACPI, APEI, GHES: Add PCIe AER recovery support Huang Ying
2011-11-08 2:39 ` [PATCH 9/9] ACPI, APEI, GHES, Distinguish interleaved error report in kernel log Huang Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320719974-3598-7-git-send-email-ying.huang@intel.com \
--to=ying.huang@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).