linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: mark pages that don't exist as nosave
@ 2007-05-08  9:25 Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2007-05-08  9:25 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev list

On some powerpc architectures (notably 64-bit powermac) there is a memory
hole, for example on powermacs between 2G and 4G. Since we use the flat
memory model regardless, these pages must be marked as nosave (for suspend
to disk.)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>

---
Tested on powerbook and G5 powermac, this patch is required for suspend
to disk on G5 as well due to the memory hole.

---
 arch/powerpc/mm/mem.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

--- powerpc.orig/arch/powerpc/mm/mem.c	2007-05-08 11:18:12.279080051 +0200
+++ powerpc/arch/powerpc/mm/mem.c	2007-05-08 11:22:02.559080051 +0200
@@ -31,6 +31,7 @@
 #include <linux/highmem.h>
 #include <linux/initrd.h>
 #include <linux/pagemap.h>
+#include <linux/suspend.h>
 
 #include <asm/pgalloc.h>
 #include <asm/prom.h>
@@ -276,6 +277,28 @@ void __init do_init_bootmem(void)
 	init_bootmem_done = 1;
 }
 
+/* mark pages that don't exist as nosave */
+static int __init mark_nonram_nosave(void)
+{
+	unsigned long lmb_next_region_start_pfn,
+		      lmb_region_max_pfn;
+	int i;
+
+	for (i = 0; i < lmb.memory.cnt - 1; i++) {
+		lmb_region_max_pfn =
+			(lmb.memory.region[i].base >> PAGE_SHIFT) +
+			(lmb.memory.region[i].size >> PAGE_SHIFT);
+		lmb_next_region_start_pfn =
+			lmb.memory.region[i+1].base >> PAGE_SHIFT;
+
+		if (lmb_region_max_pfn < lmb_next_region_start_pfn)
+			register_nosave_region(lmb_region_max_pfn,
+					       lmb_next_region_start_pfn);
+	}
+
+	return 0;
+}
+
 /*
  * paging_init() sets up the page tables - in fact we've already done this.
  */
@@ -307,6 +330,8 @@ void __init paging_init(void)
 	max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
 #endif
 	free_area_init_nodes(max_zone_pfns);
+
+	mark_nonram_nosave();
 }
 #endif /* ! CONFIG_NEED_MULTIPLE_NODES */
 

^ permalink raw reply	[flat|nested] 2+ messages in thread
* patches for 2.6.22
@ 2007-04-27 11:25 Paul Mackerras
  2007-05-03 12:25 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Mackerras @ 2007-04-27 11:25 UTC (permalink / raw)
  To: linuxppc-dev

I have pushed out some more patches to the for-2.6.22 branch of the
powerpc.git repository.  I intend in the next couple of days to ask
Linus to pull that branch.

If anyone has patches that I haven't picked up yet which they think
should go into 2.6.22, please send me either a pointer to the
patches if previously posted to linuxppc-dev, or post them to
linuxppc-dev.  Note that I don't read linuxppc-embedded, and I rely on
platform maintainers to forward any patches that are ready for
inclusion to me and the linuxppc-dev list.

I'm willing to take arch/ppc patches that fix bugs or generally keep
the existing platforms there working.  I don't want to put large lumps
of new code in there, though.

Due to a mistake on my part (I put in the pasemi RNG driver) I have
had to rebase some of the patches in for-2.6.22 branch, so if you have
done a pull of the for-2.6.22 or master branches in the last 5 hours,
please do a pull -f to get the new set.

Paul.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-08  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08  9:25 [PATCH] powerpc: mark pages that don't exist as nosave Johannes Berg
  -- strict thread matches above, loose matches on Subject: below --
2007-04-27 11:25 patches for 2.6.22 Paul Mackerras
2007-05-03 12:25 ` Johannes Berg
2007-05-03 12:29   ` [PATCH] powerpc: mark pages that don't exist as nosave Johannes Berg

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).