Skip to contentSkip to conversation

FU exceptions should carry a cause (IC)

RFC PATCH Applied Balbir Singh 2 participants 6 messages Nov 10, 2016 – Nov 11, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 FU exceptions should carry a cause (IC)

As per the ISA we need a cause for FU exceptions.Executing a tabort r9 for example in libc, causes a EXCP_FU exception. We don't wire up the IC (cause) when we post the exception. The cause is required for the kernel to do the right thing. I caught this issue while testing the latest kernel against Cedrics' latest pnv ipmi branch.

---
 target-ppc/excp_helper.c | 1 +
 1 file changed, 1 insertion(+)
target-ppc/excp_helper.c +1 -0
index 808760b..cccea8d 100644
@@ -427,6 +427,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
     case POWERPC_EXCP_VPU:       /* Vector unavailable exception             */
     case POWERPC_EXCP_VSXU:       /* VSX unavailable exception               */
     case POWERPC_EXCP_FU:         /* Facility unavailable exception          */
+        env->spr[SPR_FSCR] |= ((target_ulong)env->error_code << 56);
         break;
     case POWERPC_EXCP_PIT:       /* Programmable interval timer interrupt    */
         LOG_EXCP("PIT exception\n");
Signature · 1 line
2.9.3
Applied
#1 lore raw
Quoted 9 lines · Balbir Singh

As per the ISA we need a cause for FU exceptions.Executing a tabort r9 for example in libc, causes a EXCP_FU exception. We don't wire up the IC (cause) when we post the exception. The cause is required for the kernel to do the right thing. I caught this issue while testing the latest kernel against Cedrics' latest pnv ipmi branch.

Applied to ppc-for-2.8

Quoted 16 lines
---
 target-ppc/excp_helper.c | 1 +
 1 file changed, 1 insertion(+)
target-ppc/excp_helper.c +1 -0
index 808760b..cccea8d 100644
@@ -427,6 +427,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
     case POWERPC_EXCP_VPU:       /* Vector unavailable exception             */
     case POWERPC_EXCP_VSXU:       /* VSX unavailable exception               */
     case POWERPC_EXCP_FU:         /* Facility unavailable exception          */
+        env->spr[SPR_FSCR] |= ((target_ulong)env->error_code << 56);
         break;
     case POWERPC_EXCP_PIT:       /* Programmable interval timer interrupt    */
         LOG_EXCP("PIT exception\n");
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#2 lore raw
Quoted 9 lines · David Gibson
Quoted 8 lines · Balbir Singh

As per the ISA we need a cause for FU exceptions.Executing a tabort r9 for example in libc, causes a EXCP_FU exception. We don't wire up the IC (cause) when we post the exception. The cause is required for the kernel to do the right thing. I caught this issue while testing the latest kernel against Cedrics' latest pnv ipmi branch.

Quoted 3 lines
Quoted 1 line

Applied to ppc-for-2.8

Or not..

This causes compile breakage for the ppc32 targets.

Quoted 18 lines
Quoted 17 lines
---
 target-ppc/excp_helper.c | 1 +
 1 file changed, 1 insertion(+)
target-ppc/excp_helper.c +1 -0
index 808760b..cccea8d 100644
@@ -427,6 +427,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
     case POWERPC_EXCP_VPU:       /* Vector unavailable exception             */
     case POWERPC_EXCP_VSXU:       /* VSX unavailable exception               */
     case POWERPC_EXCP_FU:         /* Facility unavailable exception          */
+        env->spr[SPR_FSCR] |= ((target_ulong)env->error_code << 56);
         break;
     case POWERPC_EXCP_PIT:       /* Programmable interval timer interrupt    */
         LOG_EXCP("PIT exception\n");
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw
Quoted 10 lines · David Gibson
Quoted 9 lines · David Gibson
Quoted 8 lines · Balbir Singh

As per the ISA we need a cause for FU exceptions.Executing a tabort r9 for example in libc, causes a EXCP_FU exception. We don't wire up the IC (cause) when we post the exception. The cause is required for the kernel to do the right thing. I caught this issue while testing the latest kernel against Cedrics' latest pnv ipmi branch.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Applied to ppc-for-2.8

Or not..

This causes compile breakage for the ppc32 targets.

Sorry, I'll double check, I did a minimal compile. I'll redo and repost

Balbir Singh.

#4 lore raw

PATCH v2 1/1 FU exceptions should carry a cause (IC)

As per the ISA we need a cause and executing a tabort r9 in libc for example causes a EXCP_FU exception, we don't wire up the IC (cause) when we post the exception. The cause is required for the kernel to do the right thing. The fix applies only to 64 bit ppc targets.

---
Changelog v2:
Make the code 64 bit specific

 target-ppc/excp_helper.c | 3 +++
 1 file changed, 3 insertions(+)
target-ppc/excp_helper.c +3 -0
index 808760b..93369d4 100644
@@ -427,6 +427,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
     case POWERPC_EXCP_VPU:       /* Vector unavailable exception             */
     case POWERPC_EXCP_VSXU:       /* VSX unavailable exception               */
     case POWERPC_EXCP_FU:         /* Facility unavailable exception          */
+#ifdef TARGET_PPC64
+        env->spr[SPR_FSCR] |= ((target_ulong)env->error_code << 56);
+#endif
         break;
     case POWERPC_EXCP_PIT:       /* Programmable interval timer interrupt    */
         LOG_EXCP("PIT exception\n");
Signature · 1 line
2.9.3
Applied
#5 lore raw
Quoted 9 lines · Balbir Singh

As per the ISA we need a cause and executing a tabort r9 in libc for example causes a EXCP_FU exception, we don't wire up the IC (cause) when we post the exception. The cause is required for the kernel to do the right thing. The fix applies only to 64 bit ppc targets.

Applied to ppc-for-2.8.

Quoted 21 lines

---
Changelog v2:
Make the code 64 bit specific

 target-ppc/excp_helper.c | 3 +++
 1 file changed, 3 insertions(+)
target-ppc/excp_helper.c +3 -0
index 808760b..93369d4 100644
@@ -427,6 +427,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
     case POWERPC_EXCP_VPU:       /* Vector unavailable exception             */
     case POWERPC_EXCP_VSXU:       /* VSX unavailable exception               */
     case POWERPC_EXCP_FU:         /* Facility unavailable exception          */
+#ifdef TARGET_PPC64
+        env->spr[SPR_FSCR] |= ((target_ulong)env->error_code << 56);
+#endif
         break;
     case POWERPC_EXCP_PIT:       /* Programmable interval timer interrupt    */
         LOG_EXCP("PIT exception\n");
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson