From patchwork Thu Mar 26 08:32:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 6096931 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1AFD49F399 for ; Thu, 26 Mar 2015 08:34:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41AAB203F3 for ; Thu, 26 Mar 2015 08:34:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B28E203F1 for ; Thu, 26 Mar 2015 08:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbbCZId1 (ORCPT ); Thu, 26 Mar 2015 04:33:27 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:46658 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752189AbbCZIdW (ORCPT ); Thu, 26 Mar 2015 04:33:22 -0400 Received: from [83.175.99.196] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yb3E8-0006un-S9; Thu, 26 Mar 2015 08:33:21 +0000 From: Christoph Hellwig 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, axboe@kernel.dk, boaz@plexistor.com Subject: [PATCH 2/3] x86: add a is_e820_ram() helper Date: Thu, 26 Mar 2015 09:32:43 +0100 Message-Id: <1427358764-6126-3-git-send-email-hch@lst.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427358764-6126-1-git-send-email-hch@lst.de> References: <1427358764-6126-1-git-send-email-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 . Signed-off-by: Christoph Hellwig Tested-by: Ross Zwisler --- 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 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)