linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: linux-m68k@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH 3/3] [RFC] m68k: Add System RAM to /proc/iomem
Date: Tue, 17 Sep 2013 12:01:33 +0200	[thread overview]
Message-ID: <1379412095-7213-4-git-send-email-geert@linux-m68k.org> (raw)
In-Reply-To: <1379412095-7213-1-git-send-email-geert@linux-m68k.org>

We've resisted adding System RAM to /proc/iomem because it is the wrong
place for it.  Unfortunately we continue to find tools that rely on this
behaviour (e.g. kdump) so give up and add it in.

As the ST-RAM Pool is now a child of the first System RAM resource, it must
be switched from request_resource() to insert_resource().

Cfr. commit c40dd2f76644016ca7677545fc846ec2470d70a1 ("powerpc: Add System
RAM to /proc/iomem").

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/atari/stram.c     |    2 +-
 arch/m68k/kernel/setup_mm.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 0810c8d..74eaed4 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -102,7 +102,7 @@ void __init atari_stram_reserve_pages(void *start_mem)
 
 	stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
 	stram_pool.end = stram_pool.start + pool_size - 1;
-	request_resource(&iomem_resource, &stram_pool);
+	insert_resource(&iomem_resource, &stram_pool);
 
 	pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
 		 pool_size, &stram_pool);
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index cb7b0c9..55d718a 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -215,6 +215,27 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 #endif
 }
 
+/*
+ * System memory should not be in /proc/iomem but various tools expect it
+ * (e.g. kdump).
+ */
+static int __init add_system_ram_resources(void)
+{
+	int i;
+
+	for (i = 0; i < m68k_num_memory; i++) {
+		struct resource *res;
+		res = alloc_bootmem(sizeof(struct resource));
+		res->name = "System RAM";
+		res->start = m68k_memory[i].addr;
+		res->end = m68k_memory[i].addr + m68k_memory[i].size - 1;
+		res->flags = IORESOURCE_MEM;
+		WARN_ON(request_resource(&iomem_resource, res) < 0);
+	}
+
+	return 0;
+}
+
 void __init setup_arch(char **cmdline_p)
 {
 #ifndef CONFIG_SUN3
@@ -344,6 +365,8 @@ void __init setup_arch(char **cmdline_p)
 
 	paging_init();
 
+	add_system_ram_resources();
+
 #ifndef CONFIG_SUN3
 	for (i = 1; i < m68k_num_memory; i++)
 		free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
-- 
1.7.9.5


  parent reply	other threads:[~2013-09-17 10:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 10:01 Preliminary kexec support for Linux/m68k Geert Uytterhoeven
2013-09-17 10:01 ` [PATCH 1/3] m68k: Add preliminary kexec support Geert Uytterhoeven
2013-09-17 10:01 ` [PATCH 2/3] m68k: Add support to export bootinfo in procfs Geert Uytterhoeven
2013-09-17 10:01 ` Geert Uytterhoeven [this message]
2013-09-17 10:01 ` [PATCH 1/2] kexec: Let slurp_file_len() return the number of bytes read Geert Uytterhoeven
2013-09-19 14:40   ` Dave Young
2013-09-17 10:01 ` [PATCH 2/2] kexec: Add preliminary m68k support Geert Uytterhoeven
2013-09-19  9:20 ` Preliminary kexec support for Linux/m68k Geert Uytterhoeven
2013-09-19 21:00   ` Simon Horman
2013-09-19 21:07 ` Simon Horman
2013-09-20  7:15   ` Geert Uytterhoeven
2013-09-20 19:18     ` Simon Horman

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=1379412095-7213-4-git-send-email-geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.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).