diff mbox

[2/3] x86: add a is_e820_ram() helper

Message ID 1427299449-26722-3-git-send-email-hch@lst.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christoph Hellwig March 25, 2015, 4:04 p.m. UTC
This will allow to deal with persistent memory which needs to be
treated like ram in many, but not all cases.

Based on an earlier patch from Dave Jiang <dave.jiang@intel.com>.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/x86/kernel/e820.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Dan Williams March 26, 2015, 2:15 a.m. UTC | #1
On Wed, Mar 25, 2015 at 9:04 AM, Christoph Hellwig <hch@lst.de> wrote:
> This will allow to deal with persistent memory which needs to be
> treated like ram in many, but not all cases.

Random thought, type-12 memory happens to correspond to "legacy"
NVDIMM systems with smaller capacities.  Perhaps "new NVDIMM" should
not be is_e820_ram() by default?

> Based on an earlier patch from Dave Jiang <dave.jiang@intel.com>.

...which was based on an earlier patch by me, its been nearly 4 years
to come full circle.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig March 26, 2015, 8:01 a.m. UTC | #2
On Wed, Mar 25, 2015 at 07:15:42PM -0700, Dan Williams wrote:
> Random thought, type-12 memory happens to correspond to "legacy"
> NVDIMM systems with smaller capacities.  Perhaps "new NVDIMM" should
> not be is_e820_ram() by default?

Let's look into that once we can see the spec..

> > Based on an earlier patch from Dave Jiang <dave.jiang@intel.com>.
> 
> ...which was based on an earlier patch by me, its been nearly 4 years
> to come full circle.

That's the attribution in the patch I have access to.  I can add you
to the credits if you want.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dan Williams March 26, 2015, 1:57 p.m. UTC | #3
On Thu, Mar 26, 2015 at 1:01 AM, Christoph Hellwig <hch@lst.de> wrote:
> On Wed, Mar 25, 2015 at 07:15:42PM -0700, Dan Williams wrote:
>> Random thought, type-12 memory happens to correspond to "legacy"
>> NVDIMM systems with smaller capacities.  Perhaps "new NVDIMM" should
>> not be is_e820_ram() by default?
>
> Let's look into that once we can see the spec..
>
>> > Based on an earlier patch from Dave Jiang <dave.jiang@intel.com>.
>>
>> ...which was based on an earlier patch by me, its been nearly 4 years
>> to come full circle.
>
> That's the attribution in the patch I have access to.  I can add you
> to the credits if you want.

Yes, please attribute Dave and myself.

...and for the series: Acked-by: Dan Williams <dan.j.williams@intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig March 26, 2015, 2:32 p.m. UTC | #4
On Thu, Mar 26, 2015 at 06:57:56AM -0700, Dan Williams wrote:
> Yes, please attribute Dave and myself.
> 
> ...and for the series: Acked-by: Dan Williams <dan.j.williams@intel.com>

Ok, I will resend the series with the updated attribution.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 46201de..de088e3 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -48,6 +48,11 @@  unsigned long pci_mem_start = 0xaeedbabe;
 EXPORT_SYMBOL(pci_mem_start);
 #endif
 
+static inline bool is_e820_ram(__u32 type)
+{
+	return type == E820_RAM;
+}
+
 /*
  * This function checks if any part of the range <start,end> is mapped
  * with type.
@@ -688,7 +693,7 @@  void __init e820_mark_nosave_regions(unsigned long limit_pfn)
 			register_nosave_region(pfn, PFN_UP(ei->addr));
 
 		pfn = PFN_DOWN(ei->addr + ei->size);
-		if (ei->type != E820_RAM && ei->type != E820_RESERVED_KERN)
+		if (!is_e820_ram(ei->type) && ei->type != E820_RESERVED_KERN)
 			register_nosave_region(PFN_UP(ei->addr), pfn);
 
 		if (pfn >= limit_pfn)
@@ -748,7 +753,7 @@  u64 __init early_reserve_e820(u64 size, u64 align)
 /*
  * Find the highest page frame number we have available
  */
-static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
+static unsigned long __init e820_end_pfn(unsigned long limit_pfn)
 {
 	int i;
 	unsigned long last_pfn = 0;
@@ -759,7 +764,7 @@  static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
 		unsigned long start_pfn;
 		unsigned long end_pfn;
 
-		if (ei->type != type)
+		if (!is_e820_ram(ei->type))
 			continue;
 
 		start_pfn = ei->addr >> PAGE_SHIFT;
@@ -784,12 +789,12 @@  static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
 }
 unsigned long __init e820_end_of_ram_pfn(void)
 {
-	return e820_end_pfn(MAX_ARCH_PFN, E820_RAM);
+	return e820_end_pfn(MAX_ARCH_PFN);
 }
 
 unsigned long __init e820_end_of_low_ram_pfn(void)
 {
-	return e820_end_pfn(1UL<<(32 - PAGE_SHIFT), E820_RAM);
+	return e820_end_pfn(1UL<<(32 - PAGE_SHIFT));
 }
 
 static void early_panic(char *msg)