From: Christoph Hellwig <hch@lst.de>
To: linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, x86@kernel.org
Cc: ross.zwisler@linux.intel.com, boaz@plexistor.com, axboe@kernel.dk
Subject: [PATCH 2/3] x86: add a is_e820_ram() helper
Date: Wed, 25 Mar 2015 17:04:08 +0100 [thread overview]
Message-ID: <1427299449-26722-3-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1427299449-26722-1-git-send-email-hch@lst.de>
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(-)
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)
--
1.9.1
next prev parent reply other threads:[~2015-03-25 16:04 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 16:04 another pmem variant Christoph Hellwig
2015-03-25 16:04 ` [PATCH 1/3] pmem: Initial version of persistent memory driver Christoph Hellwig
2015-03-25 20:19 ` Paul Bolle
2015-03-25 20:26 ` Ross Zwisler
2015-03-26 8:04 ` Christoph Hellwig
2015-03-25 20:21 ` Ross Zwisler
2015-03-26 8:06 ` Christoph Hellwig
2015-05-04 16:43 ` Ross Zwisler
2015-05-07 7:26 ` Christoph Hellwig
2015-05-07 8:35 ` Boaz Harrosh
2015-03-25 16:04 ` Christoph Hellwig [this message]
2015-03-26 2:15 ` [Linux-nvdimm] [PATCH 2/3] x86: add a is_e820_ram() helper Dan Williams
2015-03-26 8:01 ` Christoph Hellwig
2015-03-26 13:57 ` Dan Williams
2015-03-26 14:32 ` Christoph Hellwig
2015-03-25 16:04 ` [PATCH 3/3] x86: add support for the non-standard protected e820 type Christoph Hellwig
2015-03-25 19:47 ` Elliott, Robert (Server Storage)
2015-03-26 8:02 ` Christoph Hellwig
2015-03-25 20:23 ` Ross Zwisler
2015-03-25 20:29 ` [Linux-nvdimm] " Dan Williams
2015-03-25 20:25 ` Ross Zwisler
2015-03-26 8:03 ` Christoph Hellwig
2015-03-25 20:35 ` [Linux-nvdimm] " Dan Williams
2015-03-25 16:33 ` [Linux-nvdimm] another pmem variant Dan Williams
2015-03-25 16:44 ` Christoph Hellwig
2015-03-25 17:00 ` Dan Williams
2015-03-25 17:04 ` Christoph Hellwig
2015-03-25 17:18 ` Dan Williams
2015-04-13 9:01 ` Greg KH
2015-04-13 16:02 ` Dan Williams
2015-03-25 18:09 ` Brooks, Adam J
2015-03-25 18:46 ` Christoph Hellwig
2015-03-25 21:02 ` Ross Zwisler
-- strict thread matches above, loose matches on Subject: below --
2015-03-26 8:32 another pmem variant V2 Christoph Hellwig
2015-03-26 8:32 ` [PATCH 2/3] x86: add a is_e820_ram() helper Christoph Hellwig
2015-03-26 9:02 ` Ingo Molnar
2015-03-26 9:34 ` Christoph Hellwig
2015-03-26 10:04 ` Ingo Molnar
2015-03-26 10:19 ` Christoph Hellwig
2015-03-26 10:28 ` Ingo Molnar
2015-03-26 10:29 ` Christoph Hellwig
2015-03-26 15:49 ` Boaz Harrosh
2015-03-26 16:43 ` Christoph Hellwig
2015-03-26 18:46 ` Elliott, Robert (Server Storage)
2015-03-26 20:53 ` Ross Zwisler
2015-03-26 22:59 ` Yinghai Lu
2015-03-27 8:10 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427299449-26722-3-git-send-email-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=boaz@plexistor.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@ml01.01.org \
--cc=ross.zwisler@linux.intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).