From: Li, ZhenHua <lizhenhua@hp.com>
Subject: ia64, mm: add WB/UC check for early_ioremap
Patch-mainline: after 3.9
Git-commit: a4279e6202bbd08ac6038234571ac639c98879cf
References: bnc#807677

On ia64 system , the function early_ioremap returned to uncached memory
without checking. This causes efi error and kernel failed in booting.
So I add a check to test whether memory has EFI_MEMORY_WB set.
And the function kern_mem_attribute can be called in early_ function.

See the document Documentation/ia64/aliasing.txt for more details.

Signed-off-by: Li, Zhen-Hua <zhen-hual@hp.com>

[This is the simpler version of that patch without renaming
__ioremap() to __ioremap_uc().]
Acked-by: Raymund Will <rw@suse.de>

---
 arch/ia64/mm/ioremap.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/ia64/mm/ioremap.c
+++ b/arch/ia64/mm/ioremap.c
@@ -24,6 +24,10 @@ __ioremap (unsigned long phys_addr)
 void __iomem *
 early_ioremap (unsigned long phys_addr, unsigned long size)
 {
+	u64 attr;
+	attr = kern_mem_attribute(phys_addr, size);
+	if (attr & EFI_MEMORY_WB)
+		return (void __iomem *) phys_to_virt(phys_addr);
 	return __ioremap(phys_addr);
 }
 
