@@ -43,6 +43,7 @@
#include <linux/hash.h>
#include <linux/kern_levels.h>
#include <linux/kthread.h>
+#include <linux/dmem.h>
#include <asm/page.h>
#include <asm/memtype.h>
@@ -19,11 +19,18 @@
unsigned int try_max, unsigned int *result_nr);
void dmem_free_pages(phys_addr_t addr, unsigned int dpages_nr);
+bool is_dmem_pfn(unsigned long pfn);
#define dmem_free_page(addr) dmem_free_pages(addr, 1)
#else
static inline int dmem_reserve_init(void)
{
return 0;
}
+
+static inline bool is_dmem_pfn(unsigned long pfn)
+{
+ return 0;
+}
+
#endif
#endif /* _LINUX_DMEM_H */
@@ -972,3 +972,10 @@ void dmem_free_pages(phys_addr_t addr, unsigned int dpages_nr)
}
EXPORT_SYMBOL(dmem_free_pages);
+bool is_dmem_pfn(unsigned long pfn)
+{
+ struct dmem_node *dnode;
+
+ return !!find_dmem_region(__pfn_to_phys(pfn), &dnode);
+}
+EXPORT_SYMBOL(is_dmem_pfn);