[Skiboot] [PATCH v2 1/2] core/init: Add prlog calls to make use of fwts annotations

Pridhiviraj Paidipeddi ppaidipe at linux.vnet.ibm.com
Wed Nov 23 19:32:05 AEDT 2016


Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe at linux.vnet.ibm.com>
---
changes from v1:
	- Changed the assertion handling to make use of fwts annotations.

 core/init.c | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/core/init.c b/core/init.c
index 9d4ab60..4d7fd68 100644
--- a/core/init.c
+++ b/core/init.c
@@ -667,24 +667,30 @@ static void per_thread_sanity_checks(void)
 {
 	struct cpu_thread *cpu = this_cpu();
 
-	/**
-	 * @fwts-label NonZeroHRMOR
-	 * @fwts-advice The contents of the hypervisor real mode offset register
-	 * (HRMOR) is bitwise orded with the address of any hypervisor real mode
-	 * (i.e Skiboot) memory accesses. Skiboot does not support operating
-	 * with a non-zero HRMOR and setting it will break some things (e.g
-	 * XSCOMs) in hard-to-debug ways.
-	 */
-	assert(mfspr(SPR_HRMOR) == 0);
+	if(mfspr(SPR_HRMOR) != 0) {
+		/**
+		 * @fwts-label NonZeroHRMOR
+		 * @fwts-advice The contents of the hypervisor real mode offset register
+		 * (HRMOR) is bitwise orded with the address of any hypervisor real mode
+		 * (i.e Skiboot) memory accesses. Skiboot does not support operating
+		 * with a non-zero HRMOR and setting it will break some things (e.g
+		 * XSCOMs) in hard-to-debug ways.
+		 */
+		prlog(PR_EMERG, "INIT: Non-zero HRMOR found\n");
+		assert(false);
+	}
 
-	/**
-	 * @fwts-label UnknownSecondary
-	 * @fwts-advice The boot CPU attampted to call in a secondary thread
-	 * without initialising the corresponding cpu_thread structure. This may
-	 * happen if the HDAT or devicetree reports too few threads or cores for
-	 * this processor.
-	 */
-	assert(cpu->state != cpu_state_no_cpu);
+	if(cpu->state == cpu_state_no_cpu) {
+		/**
+		 * @fwts-label UnknownSecondary
+		 * @fwts-advice The boot CPU attampted to call in a secondary thread
+		 * without initialising the corresponding cpu_thread structure. This may
+		 * happen if the HDAT or devicetree reports too few threads or cores for
+		 * this processor.
+		 */
+		prlog(PR_EMERG, "INIT: Unknown secondary thread called...\n");
+		assert(false);
+	}
 }
 
 /* Called from head.S, thus no prototype. */
-- 
2.7.4



More information about the Skiboot mailing list