diff mbox series

[1/2] core/init: Don't checksum MPIPL data areas

Message ID 20191011042742.2555-1-oohall@gmail.com
State Accepted
Headers show
Series [1/2] core/init: Don't checksum MPIPL data areas | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (1785745d5a7eaefd7d0c135f2a3b0f5d86aefec5)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran Oct. 11, 2019, 4:27 a.m. UTC
Right now the romem checksum runs from _start until the start of our
data area. This spans the area used for the MPIPL data structures since
they're included in the SPIRA-H data area.

Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
We might be able to move the MPIPL tables to after the .rodata
section in the linker script.
---
 core/init.c       | 6 +++++-
 include/skiboot.h | 1 +
 skiboot.lds.S     | 9 +++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

Comments

Vasant Hegde Oct. 11, 2019, 10:19 a.m. UTC | #1
On 10/11/19 9:57 AM, Oliver O'Halloran wrote:
> Right now the romem checksum runs from _start until the start of our
> data area. This spans the area used for the MPIPL data structures since
> they're included in the SPIRA-H data area.
> 
> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
> We might be able to move the MPIPL tables to after the .rodata
> section in the linker script.

Yes. I will look into it later.

I had completely missed checksum_romem() and reboot path. Thanks for the fix.

Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

-Vasant
Oliver O'Halloran Oct. 15, 2019, 3:39 a.m. UTC | #2
On Fri, Oct 11, 2019 at 9:19 PM Vasant Hegde
<hegdevasant@linux.vnet.ibm.com> wrote:
>
> On 10/11/19 9:57 AM, Oliver O'Halloran wrote:
> > Right now the romem checksum runs from _start until the start of our
> > data area. This spans the area used for the MPIPL data structures since
> > they're included in the SPIRA-H data area.
> >
> > Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> > ---
> > We might be able to move the MPIPL tables to after the .rodata
> > section in the linker script.
>

> Yes. I will look into it later.

Ok, no hurry.

> I had completely missed checksum_romem() and reboot path. Thanks for the fix.
>
> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>
> -Vasant
>

Series merged to master as a4e0f636ea8c179d68c14d96ca36e165406a452e
diff mbox series

Patch

diff --git a/core/init.c b/core/init.c
index 62d9c709fac9..c2d7324622db 100644
--- a/core/init.c
+++ b/core/init.c
@@ -927,8 +927,12 @@  static void checksum_romem(void)
 	if (chip_quirk(QUIRK_SLOW_SIM))
 		return;
 
-	csum = mem_csum(_start, _romem_end);
+	csum = mem_csum(_start, _head_end);
 	romem_csum ^= csum;
+
+	csum = mem_csum(_stext, _romem_end);
+	romem_csum ^= csum;
+
 	csum = mem_csum(__builtin_kernel_start, __builtin_kernel_end);
 	romem_csum ^= csum;
 }
diff --git a/include/skiboot.h b/include/skiboot.h
index 686ba9dc8411..10b43e8c37f8 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -37,6 +37,7 @@  extern struct mem_region *mem_region_next(struct mem_region *region);
 
 /* Misc linker script symbols */
 extern char _start[];
+extern char _head_end[];
 extern char _stext[];
 extern char _etext[];
 extern char __sym_map_end[];
diff --git a/skiboot.lds.S b/skiboot.lds.S
index 8890d69aa804..32139b2c5b7f 100644
--- a/skiboot.lds.S
+++ b/skiboot.lds.S
@@ -69,6 +69,13 @@  SECTIONS
 		KEEP(*(.spirah.data))
 	}
 
+	_head_end = .;
+
+	/*
+	 * The following sections are read-write at runtime. We need
+	 * to skip over them when checksumming the skiboot images
+	 * before a fast-reboot.
+	 */
 	. = PROC_DUMP_AREA_OFF;
 	.procdump : {
 		KEEP(*(.procdump.data))
@@ -94,6 +101,8 @@  SECTIONS
 		KEEP(*(.cpuctrl.data))
 	}
 
+	/* ...and back to RO */
+
 	. = ALIGN(0x10);
 	_stext = .;
  	.text : {