lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  1 Jun 2015 12:12:20 -0700
From:	"Jonathan (Zhixiong) Zhang" <zjzhang@...eaurora.org>
To:	rjw@...ysocki.net, lenb@...nel.org, ying.huang@...el.com,
	leif.lindholm@...aro.org, al.stone@...aro.org, fu.wei@...aro.org
Cc:	"Jonathan (Zhixiong) Zhang" <zjzhang@...eaurora.org>,
	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-msm@...r.kernel.org, linaro-acpi@...ts.linaro.org,
	vgandhi@...eaurora.org
Subject: [PATCH V2 3/3] acpi, apei: use EFI memmap to map GHES memory

From: "Jonathan (Zhixiong) Zhang" <zjzhang@...eaurora.org>

With ACPI APEI firmware first handling, generic hardware error
record is updated by firmware in GHES memory region. When firmware
updated GHES memory region in DDR without going through cache,
Linux reads stale data from cache.

GHES memory region should be mapped with cache attributes
according to EFI memory map when applicable. If firmware updates
DDR directly, EFI memory map has GHES memory region defined as
uncached; If firmware updates cache, EFI memory map has 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@...eaurora.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists