msm: pil: Correctly check for overwriting memory

memblock_is_region_memory() checks to see if the region specified
is fully contained within a memory block (i.e. it is a subset of
a memblock). For PIL use cases we want to know if the region
we're loading the image into overlaps with a memory region that
the kernel is actively using. Use memblock_overlaps_memory() to
check for this case.

While we're here update the error message to be more informative
by printing the address range that failed to pass.

Change-Id: I543fb04624dbf8698ce8ef8ca2726145c5e6069e
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/peripheral-loader.c b/arch/arm/mach-msm/peripheral-loader.c
index 0ecea85..7208a48 100644
--- a/arch/arm/mach-msm/peripheral-loader.c
+++ b/arch/arm/mach-msm/peripheral-loader.c
@@ -137,8 +137,11 @@
 	const struct firmware *fw = NULL;
 	const u8 *data;
 
-	if (memblock_is_region_memory(phdr->p_paddr, phdr->p_memsz)) {
-		dev_err(&pil->dev, "Kernel memory would be overwritten");
+	if (memblock_overlaps_memory(phdr->p_paddr, phdr->p_memsz)) {
+		dev_err(&pil->dev,
+			"kernel memory would be overwritten [%#08lx, %#08lx)\n",
+			(unsigned long)phdr->p_paddr,
+			(unsigned long)(phdr->p_paddr + phdr->p_memsz));
 		return -EPERM;
 	}