From: "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org>
To: rjw@rjwysocki.net, lenb@kernel.org, ying.huang@intel.com
Cc: "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linaro-acpi@lists.linaro.org
Subject: [PATCH 2/2] acpi, apei: use EFI memmap to map GHES memory
Date: Mon, 4 May 2015 14:02:15 -0700 [thread overview]
Message-ID: <1430773335-22897-3-git-send-email-zjzhang@codeaurora.org> (raw)
In-Reply-To: <1430773335-22897-1-git-send-email-zjzhang@codeaurora.org>
From: "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org>
With ACPI APEI firmware first handling, generic hardware error
record is updated by firmware in GHES memory region. After firmware
updated GHES memory region, Linux reads stale data from cache.
GHES memory region should be mapped with cache attributes defined
by EFI memory map when applicable. If firmware updates DDR directly,
EFI memory map would have GHES memory region defined as uncached;
If firmware updates cache, EFI memory map would have GHES memory
region defined as cached.
When EFI is configued, map IRQ page using efi_remap() provided by
EFI subsystem.
Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
---
drivers/acpi/apei/ghes.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index e82d0976a5d0..56875ca76aa7 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -48,6 +48,7 @@
#include <linux/pci.h>
#include <linux/aer.h>
#include <linux/nmi.h>
+#include <linux/efi.h>
#include <acpi/ghes.h>
#include <acpi/apei.h>
@@ -159,6 +160,7 @@ static void __iomem *ghes_ioremap_pfn_nmi(u64 pfn)
return (void __iomem *)vaddr;
}
+#ifndef CONFIG_EFI
static void __iomem *ghes_ioremap_pfn_irq(u64 pfn)
{
unsigned long vaddr;
@@ -169,6 +171,7 @@ static void __iomem *ghes_ioremap_pfn_irq(u64 pfn)
return (void __iomem *)vaddr;
}
+#endif
static void ghes_iounmap_nmi(void __iomem *vaddr_ptr)
{
@@ -180,6 +183,7 @@ static void ghes_iounmap_nmi(void __iomem *vaddr_ptr)
arch_apei_flush_tlb_one(vaddr);
}
+#ifndef CONFIG_EFI
static void ghes_iounmap_irq(void __iomem *vaddr_ptr)
{
unsigned long vaddr = (unsigned long __force)vaddr_ptr;
@@ -189,6 +193,7 @@ static void ghes_iounmap_irq(void __iomem *vaddr_ptr)
unmap_kernel_range_noflush(vaddr, PAGE_SIZE);
arch_apei_flush_tlb_one(vaddr);
}
+#endif
static int ghes_estatus_pool_init(void)
{
@@ -309,7 +314,11 @@ static void ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len,
vaddr = ghes_ioremap_pfn_nmi(paddr >> PAGE_SHIFT);
} else {
spin_lock_irqsave(&ghes_ioremap_lock_irq, flags);
+#ifdef CONFIG_EFI
+ vaddr = efi_remap(paddr & PAGE_MASK, PAGE_SIZE);
+#else
vaddr = ghes_ioremap_pfn_irq(paddr >> PAGE_SHIFT);
+#endif
}
trunk = PAGE_SIZE - offset;
trunk = min(trunk, len);
@@ -324,7 +333,11 @@ static void ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len,
ghes_iounmap_nmi(vaddr);
raw_spin_unlock(&ghes_ioremap_lock_nmi);
} else {
+#ifdef CONFIG_EFI
+ iounmap(vaddr);
+#else
ghes_iounmap_irq(vaddr);
+#endif
spin_unlock_irqrestore(&ghes_ioremap_lock_irq, flags);
}
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
prev parent reply other threads:[~2015-05-04 21:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 21:02 [PATCH 0/2] map GHES memory region with EFI memory map Jonathan (Zhixiong) Zhang
[not found] ` <1430773335-22897-1-git-send-email-zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-05-04 21:02 ` [PATCH 1/2] efi: arch, x86: arch, ia64: rearrange EFI memmap related functions Jonathan (Zhixiong) Zhang
[not found] ` <1430773335-22897-2-git-send-email-zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-05-27 12:31 ` Matt Fleming
[not found] ` <20150527123103.GC3030-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-05-27 19:35 ` Zhang, Jonathan Zhixiong
2015-05-04 21:02 ` Jonathan (Zhixiong) Zhang [this message]
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=1430773335-22897-3-git-send-email-zjzhang@codeaurora.org \
--to=zjzhang@codeaurora.org \
--cc=lenb@kernel.org \
--cc=linaro-acpi@lists.linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=ying.huang@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