Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755168AbbKXViw (ORCPT ); Tue, 24 Nov 2015 16:38:52 -0500 Received: from g9t5008.houston.hp.com ([15.240.92.66]:34011 "EHLO g9t5008.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755142AbbKXVic (ORCPT ); Tue, 24 Nov 2015 16:38:32 -0500 From: Toshi Kani To: akpm@linux-foundation.org, rjw@rjwysocki.net, dan.j.williams@intel.com Cc: tony.luck@intel.com, bp@alien8.de, vishal.l.verma@intel.com, linux-mm@kvack.org, linux-nvdimm@ml01.01.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Toshi Kani Subject: [PATCH v3 2/3] resource: Add region_intersects_pmem() Date: Tue, 24 Nov 2015 15:33:37 -0700 Message-Id: <1448404418-28800-3-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1448404418-28800-1-git-send-email-toshi.kani@hpe.com> References: <1448404418-28800-1-git-send-email-toshi.kani@hpe.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2157 Lines: 60 Add region_intersects_pmem(), which checks if a specified address range is persistent memory registered as "Persistent Memory" in the iomem_resource list. Note, it does not support legacy persistent memory registered as "Persistent Memory (legacy)". It can be supported by extending this function or a separate function, if necessary. This interface is exported so that it can be called from modules, such as the EINJ driver. Signed-off-by: Toshi Kani Reviewed-by: Dan Williams Cc: Andrew Morton Cc: Vishal Verma --- include/linux/mm.h | 1 + kernel/resource.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index c776af3..3825879 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -365,6 +365,7 @@ enum { int region_intersects(resource_size_t offset, size_t size, const char *type, unsigned long flags); int region_intersects_ram(resource_size_t offset, size_t size); +int region_intersects_pmem(resource_size_t offset, size_t size); /* Support for virtually mapped pages */ struct page *vmalloc_to_page(const void *addr); diff --git a/kernel/resource.c b/kernel/resource.c index 15c133e..5230e63 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -548,6 +548,18 @@ int region_intersects_ram(resource_size_t start, size_t size) } EXPORT_SYMBOL_GPL(region_intersects_ram); +/* + * region_intersects_pmem() checks if a specified address range is + * persistent memory, registered as "Persistent Memory", in the + * iomem_resource list. + */ +int region_intersects_pmem(resource_size_t start, size_t size) +{ + return region_intersects(start, size, "Persistent Memory", + IORESOURCE_MEM); +} +EXPORT_SYMBOL_GPL(region_intersects_pmem); + void __weak arch_remove_reservations(struct resource *avail) { } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/