[RFC PATCH 11/12] PAT 64b: devmem do not read pages not mapped in identity map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enable valid_phys_addr_range for x86_64 and check whether the identity
mapping exists before reading /dev/mem. For reserved regions there is no
identity mappings any more and then cannot be read from /dev/mem.

Side effect is that dd of entire memory will not work any more, once there are
reserved holes in memory space.

TBD: Read reserved regions as 0xffff or something, and continue reading
across holes, till we reach the high_memory (end of memory).

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Suresh Siddha <[email protected]>
---

Index: linux-2.6.24-rc/arch/x86/kernel/e820_64.c
===================================================================
--- linux-2.6.24-rc.orig/arch/x86/kernel/e820_64.c
+++ linux-2.6.24-rc/arch/x86/kernel/e820_64.c
@@ -220,6 +220,11 @@ int is_memory_all_valid(unsigned long st
 }
 EXPORT_SYMBOL_GPL(is_memory_all_valid);
 
+int valid_phys_addr_range(unsigned long addr, size_t count)
+{
+	return is_memory_all_valid(addr, addr + count);
+}
+
 /* 
  * Find a free area in a specific range. 
  */ 
Index: linux-2.6.24-rc/include/asm-x86/io_64.h
===================================================================
--- linux-2.6.24-rc.orig/include/asm-x86/io_64.h
+++ linux-2.6.24-rc/include/asm-x86/io_64.h
@@ -265,6 +265,15 @@ extern int iommu_bio_merge;
  */
 #define xlate_dev_kmem_ptr(p)	p
 
+#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
+extern int valid_phys_addr_range (unsigned long addr, size_t count);
+
+static inline int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
+{
+	return 1;
+}
+
+
 #endif /* __KERNEL__ */
 
 #endif

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux