linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Misc. bug fixes for ppc32
       [not found] <20100819042023.GC13965@verge.net.au>
@ 2010-08-19  4:56 ` Matthew McClintock
  2010-08-20  8:27   ` Simon Horman
  2010-08-19  4:56 ` [PATCH v2 1/3] Ramdisk address was not copied correctly on kexec'ed kernel Matthew McClintock
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 5+ messages in thread
From: Matthew McClintock @ 2010-08-19  4:56 UTC (permalink / raw)
  To: kexec
  Cc: muvarov, linuxppc-dev, Kumar Gala, Sebastian Andrzej Siewior,
	Matthew McClintock

This patch series fixes a few issues I have discovered with my previous
patch series. Nothing new has been added.

v2: Missed signoff, removed initializing variable twice

Matthew McClintock (3):
  Ramdisk address was not copied correctly on kexec'ed kernel
  Prevent multiple reservations for cpu-release-addr
  Prevent initrd-start and initrd-end from appearing multiple times

 kexec/arch/ppc/fixup_dtb.c |   50 ++++++++++++++++++++++++-------------------
 kexec/arch/ppc/kexec-ppc.c |    2 +-
 2 files changed, 29 insertions(+), 23 deletions(-)

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

* [PATCH v2 1/3] Ramdisk address was not copied correctly on kexec'ed kernel
       [not found] <20100819042023.GC13965@verge.net.au>
  2010-08-19  4:56 ` [PATCH v2 0/3] Misc. bug fixes for ppc32 Matthew McClintock
@ 2010-08-19  4:56 ` Matthew McClintock
  2010-08-19  4:56 ` [PATCH v2 2/3] Prevent multiple reservations for cpu-release-addr Matthew McClintock
  2010-08-19  4:56 ` [PATCH v2 3/3] Prevent initrd-start and initrd-end from appearing multiple times Matthew McClintock
  3 siblings, 0 replies; 5+ messages in thread
From: Matthew McClintock @ 2010-08-19  4:56 UTC (permalink / raw)
  To: kexec
  Cc: muvarov, linuxppc-dev, Kumar Gala, Sebastian Andrzej Siewior,
	Matthew McClintock


Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 kexec/arch/ppc/fixup_dtb.c |    2 +-
 kexec/arch/ppc/kexec-ppc.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c
index 26c23a3..09f9ac1 100644
--- a/kexec/arch/ppc/fixup_dtb.c
+++ b/kexec/arch/ppc/fixup_dtb.c
@@ -311,7 +311,7 @@ static void fixup_initrd(char *blob_buf)
 				return;
 		}
 
-		tmp = ramdisk_base + ramdisk_size + 1;
+		tmp = ramdisk_base + ramdisk_size;
 		err = fdt_setprop(blob_buf, nodeoffset,
 			"linux,initrd-end", &tmp, sizeof(tmp));
 		if (err < 0) {
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index c36c7b3..ab76d6f 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -481,7 +481,7 @@ static int get_devtree_details(unsigned long kexec_flags)
 
 			if ((initrd_end - initrd_start) != 0 ) {
 				initrd_base = initrd_start;
-				initrd_size = initrd_end - initrd_start + 1;
+				initrd_size = initrd_end - initrd_start;
 			}
 
 			if (reuse_initrd) {
-- 
1.6.0.6

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

* [PATCH v2 2/3] Prevent multiple reservations for cpu-release-addr
       [not found] <20100819042023.GC13965@verge.net.au>
  2010-08-19  4:56 ` [PATCH v2 0/3] Misc. bug fixes for ppc32 Matthew McClintock
  2010-08-19  4:56 ` [PATCH v2 1/3] Ramdisk address was not copied correctly on kexec'ed kernel Matthew McClintock
@ 2010-08-19  4:56 ` Matthew McClintock
  2010-08-19  4:56 ` [PATCH v2 3/3] Prevent initrd-start and initrd-end from appearing multiple times Matthew McClintock
  3 siblings, 0 replies; 5+ messages in thread
From: Matthew McClintock @ 2010-08-19  4:56 UTC (permalink / raw)
  To: kexec
  Cc: muvarov, linuxppc-dev, Kumar Gala, Sebastian Andrzej Siewior,
	Matthew McClintock

Currently, we can add a lot of reservations over a small range, this
does a simple check to verify the previous entry is not the same
as the current one and skips it if so

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 kexec/arch/ppc/fixup_dtb.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c
index 09f9ac1..910a3f0 100644
--- a/kexec/arch/ppc/fixup_dtb.c
+++ b/kexec/arch/ppc/fixup_dtb.c
@@ -139,6 +139,7 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t
 {
 	int ret, i;
 	int nodeoffset;
+	u64 val = 0;
 
 	/* If this is a KEXEC kernel we add all regions since they will
 	 * all need to be saved */
@@ -175,20 +176,25 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t
 	while (nodeoffset != -FDT_ERR_NOTFOUND) {
 		const void *buf;
 		int sz, ret;
-		u64 val = 0;
+		u64 tmp;
 
 		buf = fdt_getprop(blob_buf, nodeoffset, "cpu-release-addr", &sz);
-		if (sz == 4) {
-			val = *(u32 *)buf;
-		} else if (sz == 8) {
-			val = *(u64 *)buf;
-		}
 
-		if (val) {
-			ret = fdt_add_mem_rsv(blob_buf, PAGE_ALIGN(val-PAGE_SIZE), PAGE_SIZE);
-			if (ret)
-				printf("%s: Unable to add reserve for cpu-release-addr!\n",
-					fdt_strerror(ret));
+		if (buf) {
+			if (sz == 4) {
+				tmp = *(u32 *)buf;
+			} else if (sz == 8) {
+				tmp = *(u64 *)buf;
+			}
+
+			/* crude check to see if last value is repeated */
+			if (_ALIGN_DOWN(tmp, PAGE_SIZE) != _ALIGN_DOWN(val, PAGE_SIZE)) {
+				val = tmp;
+				ret = fdt_add_mem_rsv(blob_buf, _ALIGN_DOWN(val, PAGE_SIZE), PAGE_SIZE);
+				if (ret)
+					printf("%s: Unable to add reserve for cpu-release-addr!\n",
+						fdt_strerror(ret));
+			}
 		}
 
 		nodeoffset = fdt_node_offset_by_prop_value(blob_buf, nodeoffset,
-- 
1.6.0.6

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

* [PATCH v2 3/3] Prevent initrd-start and initrd-end from appearing multiple times
       [not found] <20100819042023.GC13965@verge.net.au>
                   ` (2 preceding siblings ...)
  2010-08-19  4:56 ` [PATCH v2 2/3] Prevent multiple reservations for cpu-release-addr Matthew McClintock
@ 2010-08-19  4:56 ` Matthew McClintock
  3 siblings, 0 replies; 5+ messages in thread
From: Matthew McClintock @ 2010-08-19  4:56 UTC (permalink / raw)
  To: kexec
  Cc: muvarov, linuxppc-dev, Kumar Gala, Sebastian Andrzej Siewior,
	Matthew McClintock

We always remove the old entry, and add it back if it is needed
on for the kexec'ed kernel

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 kexec/arch/ppc/fixup_dtb.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c
index 910a3f0..205fd77 100644
--- a/kexec/arch/ppc/fixup_dtb.c
+++ b/kexec/arch/ppc/fixup_dtb.c
@@ -160,7 +160,7 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t
 				goto out;
 			}
 		}
-	} else {
+	} else if (ramdisk || reuse_initrd) {
 		/* Otherwise we just add back the ramdisk and the device tree
 		 * is already in the list */
 		ret = fdt_add_mem_rsv(blob_buf, ramdisk_base, ramdisk_size);
@@ -300,13 +300,16 @@ static void fixup_initrd(char *blob_buf)
 
 	nodeoffset = fdt_path_offset(blob_buf, "/chosen");
 
-	if ((reuse_initrd || ramdisk) &&
-		((ramdisk_base != 0) && (ramdisk_size != 0))) {
-		if (nodeoffset < 0) {
-			printf("fdt_initrd: %s\n", fdt_strerror(nodeoffset));
-			return;
-		}
+	if (nodeoffset < 0) {
+		printf("fdt_initrd: %s\n", fdt_strerror(nodeoffset));
+		return;
+	}
+
+	fdt_delprop(blob_buf, nodeoffset, "linux,initrd-start");
+	fdt_delprop(blob_buf, nodeoffset, "linux,initrd-end");
 
+	if ((reuse_initrd || ramdisk) &&
+	   ((ramdisk_base != 0) && (ramdisk_size != 0))) {
 		tmp = ramdisk_base;
 		err = fdt_setprop(blob_buf, nodeoffset,
 			"linux,initrd-start", &tmp, sizeof(tmp));
@@ -325,9 +328,6 @@ static void fixup_initrd(char *blob_buf)
 				fdt_strerror(err));
 				return;
 		}
-	} else {
-		fdt_delprop(blob_buf, nodeoffset, "linux,initrd-start");
-		fdt_delprop(blob_buf, nodeoffset, "linux,initrd-end");
 	}
 }
 
-- 
1.6.0.6

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

* Re: [PATCH v2 0/3] Misc. bug fixes for ppc32
  2010-08-19  4:56 ` [PATCH v2 0/3] Misc. bug fixes for ppc32 Matthew McClintock
@ 2010-08-20  8:27   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2010-08-20  8:27 UTC (permalink / raw)
  To: Matthew McClintock
  Cc: muvarov, linuxppc-dev, Kumar Gala, kexec,
	Sebastian Andrzej Siewior

On Wed, Aug 18, 2010 at 11:56:48PM -0500, Matthew McClintock wrote:
> This patch series fixes a few issues I have discovered with my previous
> patch series. Nothing new has been added.

Thanks, all applied.

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

end of thread, other threads:[~2010-08-20  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20100819042023.GC13965@verge.net.au>
2010-08-19  4:56 ` [PATCH v2 0/3] Misc. bug fixes for ppc32 Matthew McClintock
2010-08-20  8:27   ` Simon Horman
2010-08-19  4:56 ` [PATCH v2 1/3] Ramdisk address was not copied correctly on kexec'ed kernel Matthew McClintock
2010-08-19  4:56 ` [PATCH v2 2/3] Prevent multiple reservations for cpu-release-addr Matthew McClintock
2010-08-19  4:56 ` [PATCH v2 3/3] Prevent initrd-start and initrd-end from appearing multiple times Matthew McClintock

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