diff mbox series

[6/7] MIPS: ip22: Drop addr_is_ram

Message ID 20190808075013.4852-7-jiaxun.yang@flygoat.com (mailing list archive)
State Superseded
Headers show
Series [1/7] MIPS: init: Drop boot_mem_map | expand

Commit Message

Jiaxun Yang Aug. 8, 2019, 7:50 a.m. UTC
It can be replaced by memblock_is_region_memory.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/sgi-ip22/ip28-berr.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/arch/mips/sgi-ip22/ip28-berr.c b/arch/mips/sgi-ip22/ip28-berr.c
index c0cf7baee36d..d4150ab8d140 100644
--- a/arch/mips/sgi-ip22/ip28-berr.c
+++ b/arch/mips/sgi-ip22/ip28-berr.c
@@ -12,6 +12,7 @@ 
 #include <linux/sched/debug.h>
 #include <linux/sched/signal.h>
 #include <linux/seq_file.h>
+#include <linux/memblock.h>
 
 #include <asm/addrspace.h>
 #include <asm/traps.h>
@@ -300,23 +301,6 @@  static void print_buserr(const struct pt_regs *regs)
 	       field, regs->cp0_epc, field, regs->regs[31]);
 }
 
-/*
- * Check, whether MC's (virtual) DMA address caused the bus error.
- * See "Virtual DMA Specification", Draft 1.5, Feb 13 1992, SGI
- */
-
-static int addr_is_ram(unsigned long addr, unsigned sz)
-{
-	int i;
-
-	for (i = 0; i < boot_mem_map.nr_map; i++) {
-		unsigned long a = boot_mem_map.map[i].addr;
-		if (a <= addr && addr+sz <= a+boot_mem_map.map[i].size)
-			return 1;
-	}
-	return 0;
-}
-
 static int check_microtlb(u32 hi, u32 lo, unsigned long vaddr)
 {
 	/* This is likely rather similar to correct code ;-) */
@@ -331,7 +315,7 @@  static int check_microtlb(u32 hi, u32 lo, unsigned long vaddr)
 			/* PTEIndex is VPN-low (bits [22:14]/[20:12] ?) */
 			unsigned long pte = (lo >> 6) << 12; /* PTEBase */
 			pte += 8*((vaddr >> pgsz) & 0x1ff);
-			if (addr_is_ram(pte, 8)) {
+			if (memblock_is_region_memory(pte, 8)) {
 				/*
 				 * Note: Since DMA hardware does look up
 				 * translation on its own, this PTE *must*