diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-03-03 12:14:36 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-03-05 15:25:44 -0500 |
commit | d9cbe09d39aa13f6924dc5fb88325de7ef01a72e (patch) | |
tree | 8d2e60e548272353fbfa8bd9ac705cdfac918efc /drivers/nvdimm/pfn.h | |
parent | bc94b99636dc7bcccce439a9fb9c00065e2e2627 (diff) |
libnvdimm, pmem: fix 'pfn' support for section-misaligned namespaces
The altmap for a section-misaligned namespace needs to arrange for the
base_pfn to be section-aligned. As a result the 'reserve' region (pfns
from base that do not have a struct page) must be increased. Otherwise
we trip the altmap validation check in __add_pages:
if (altmap->base_pfn != phys_start_pfn
|| vmem_altmap_offset(altmap) > nr_pages) {
pr_warn_once("memory add fail, invalid altmap\n");
return -EINVAL;
}
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/pfn.h')
-rw-r--r-- | drivers/nvdimm/pfn.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/nvdimm/pfn.h b/drivers/nvdimm/pfn.h index cc243754acef..6ee707e5b279 100644 --- a/drivers/nvdimm/pfn.h +++ b/drivers/nvdimm/pfn.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define __NVDIMM_PFN_H | 15 | #define __NVDIMM_PFN_H |
16 | 16 | ||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/mmzone.h> | ||
18 | 19 | ||
19 | #define PFN_SIG_LEN 16 | 20 | #define PFN_SIG_LEN 16 |
20 | #define PFN_SIG "NVDIMM_PFN_INFO\0" | 21 | #define PFN_SIG "NVDIMM_PFN_INFO\0" |
@@ -32,4 +33,16 @@ struct nd_pfn_sb { | |||
32 | u8 padding[4012]; | 33 | u8 padding[4012]; |
33 | __le64 checksum; | 34 | __le64 checksum; |
34 | }; | 35 | }; |
36 | |||
37 | #ifdef CONFIG_SPARSEMEM | ||
38 | #define PFN_SECTION_ALIGN_DOWN(x) SECTION_ALIGN_DOWN(x) | ||
39 | #define PFN_SECTION_ALIGN_UP(x) SECTION_ALIGN_UP(x) | ||
40 | #else | ||
41 | /* | ||
42 | * In this case ZONE_DEVICE=n and we will disable 'pfn' device support, | ||
43 | * but we still want pmem to compile. | ||
44 | */ | ||
45 | #define PFN_SECTION_ALIGN_DOWN(x) (x) | ||
46 | #define PFN_SECTION_ALIGN_UP(x) (x) | ||
47 | #endif | ||
35 | #endif /* __NVDIMM_PFN_H */ | 48 | #endif /* __NVDIMM_PFN_H */ |