Skip to contentSkip to conversation

powerpc/8xx: exception InstructionAccess does not exist on MPC8xx

PATCH Superseded Christophe Leroy 3 participants 9 messages Sep 17, 2014 – Sep 19, 2014 PowerPC

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 3/21 powerpc/8xx: exception InstructionAccess does not exist on MPC8xx

Exception InstructionAccess does not exist on MPC8xx. No need to branch there from somewhere else. Handling can be done directly in InstructionTLBError Exception.

---
Changes in v2:
- None

Changes in v3:
- arch/powerpc/mm/fault.c uses the vector number, so make sure it understand the new ones.

 arch/powerpc/kernel/head_8xx.S | 17 +++++++----------
 arch/powerpc/mm/fault.c        |  1 +
 2 files changed, 8 insertions(+), 10 deletions(-)
arch/powerpc/kernel/head_8xx.S +7 -10
index 3af6db1..fbe5d10 100644
@@ -234,15 +234,9 @@ DataAccess:
 	EXC_XFER_LITE(0x300, handle_page_fault)
 
 /* Instruction access exception.
- * This is "never generated" by the MPC8xx.  We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
  */
-	. = 0x400
-InstructionAccess:
-	EXCEPTION_PROLOG
-	mr	r4,r12
-	mr	r5,r9
-	EXC_XFER_LITE(0x400, handle_page_fault)
+	EXCEPTION(0x400, InstructionAccess, unknown_exception, EXC_XFER_STD)
 
 /* External interrupt */
 	EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -382,7 +376,7 @@ InstructionTLBMiss:
 #endif
 	mfspr	r10, SPRN_SPRG_SCRATCH2
 	EXCEPTION_EPILOG_0
-	b	InstructionAccess
+	b	InstructionTLBError
 
 	. = 0x1200
 DataStoreTLBMiss:
@@ -477,7 +471,10 @@ DataStoreTLBMiss:
  */
 	. = 0x1300
 InstructionTLBError:
-	b	InstructionAccess
+	EXCEPTION_PROLOG
+	mr	r4,r12
+	mr	r5,r9
+	EXC_XFER_LITE(0x1300, handle_page_fault)
 
 /* This is the data TLB error on the MPC8xx.  This could be due to
  * many reasons, including a dirty update to a pte.  We can catch that
arch/powerpc/mm/fault.c +1 -0
index 51ab9e7..4d63c96 100644
@@ -526,6 +526,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
 		break;
 	case 0x400:
 	case 0x480:
+	case 0x1300:
 		printk(KERN_ALERT "Unable to handle kernel paging request for "
 			"instruction fetch\n");
 		break;
Signature · 1 line
2.1.0
#1 lore raw

Christophe Leroy <[email protected]> wrote on 2014/09/17 18:36:57:

Quoted 2 lines

Exception InstructionAccess does not exist on MPC8xx. No need to branch

there from somewhere else.

Quoted 10 lines

Handling can be done directly in InstructionTLBError Exception.

---
Changes in v2:
- None

Changes in v3:
- arch/powerpc/mm/fault.c uses the vector number, so make sure it

understand

Review

Quoted 7 lines

the new ones.

 arch/powerpc/kernel/head_8xx.S | 17 +++++++----------
 arch/powerpc/mm/fault.c        |  1 +
 2 files changed, 8 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/kernel/head_8xx.S

Quoted 31 lines

index 3af6db1..fbe5d10 100644

arch/powerpc/kernel/head_8xx.S +3 -9
@@ -234,15 +234,9 @@ DataAccess:
    EXC_XFER_LITE(0x300, handle_page_fault)
 
 /* Instruction access exception.
- * This is "never generated" by the MPC8xx.  We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
  */
-   . = 0x400
-InstructionAccess:
-   EXCEPTION_PROLOG
-   mr   r4,r12
-   mr   r5,r9
-   EXC_XFER_LITE(0x400, handle_page_fault)
+   EXCEPTION(0x400, InstructionAccess, unknown_exception, EXC_XFER_STD)
 
 /* External interrupt */
    EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -382,7 +376,7 @@ InstructionTLBMiss:
 #endif
    mfspr   r10, SPRN_SPRG_SCRATCH2
    EXCEPTION_EPILOG_0
-   b   InstructionAccess
+   b   InstructionTLBError
 
    . = 0x1200
 DataStoreTLBMiss:

arch/powerpc/kernel/head_8xx.S DataStoreTLBMiss: · line 477

Quoted 8 lines
arch/powerpc/kernel/head_8xx.S +4 -1
@@ -477,7 +471,10 @@ DataStoreTLBMiss:
  */
    . = 0x1300
 InstructionTLBError:
-   b   InstructionAccess
+   EXCEPTION_PROLOG
+   mr   r4,r12
+   mr   r5,r9
+   EXC_XFER_LITE(0x1300, handle_page_fault)

Still don't like that you change the vector number, every other ppc uses the
standard number.

Can you not just lie here(EXC_XFER_LITE(0x400, handle_page_fault))? Move the code to InstructionAccess too and let TLBError branch there.

If not I think you should keep the old/current way?

Same for DataTLB Miss/Error

arch/powerpc/mm/fault.c void bad_page_fault(struct pt_regs *regs, unsigned

Quoted 8 lines
arch/powerpc/kernel/head_8xx.S +0 -0
 /* This is the data TLB error on the MPC8xx.  This could be due to
  * many reasons, including a dirty update to a pte.  We can catch that
arch/powerpc/mm/fault.c +0 -0
index 51ab9e7..4d63c96 100644
@@ -526,6 +526,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned 

long address, int sig)

Quoted 10 lines
arch/powerpc/mm/fault.c +1 -0
       break;
    case 0x400:
    case 0x480:
+   case 0x1300:
       printk(KERN_ALERT "Unable to handle kernel paging request for "
          "instruction fetch\n");
       break;
Signature · 1 line
2.1.0
#2 lore raw
Quoted 65 lines · Joakim Tjernlund

Christophe Leroy <[email protected]> wrote on 2014/09/17 18:36:57:

Quoted 1 line

Exception InstructionAccess does not exist on MPC8xx. No need to branch

there from somewhere else.

Quoted 10 lines

Handling can be done directly in InstructionTLBError Exception.

---
Changes in v2:
- None

Changes in v3:
- arch/powerpc/mm/fault.c uses the vector number, so make sure it

understand

Review

Quoted 7 lines

the new ones.

  arch/powerpc/kernel/head_8xx.S | 17 +++++++----------
  arch/powerpc/mm/fault.c        |  1 +
  2 files changed, 8 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/kernel/head_8xx.S

Quoted 31 lines

index 3af6db1..fbe5d10 100644

arch/powerpc/kernel/head_8xx.S +3 -9
@@ -234,15 +234,9 @@ DataAccess:
     EXC_XFER_LITE(0x300, handle_page_fault)
 
  /* Instruction access exception.
- * This is "never generated" by the MPC8xx.  We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
   */
-   . = 0x400
-InstructionAccess:
-   EXCEPTION_PROLOG
-   mr   r4,r12
-   mr   r5,r9
-   EXC_XFER_LITE(0x400, handle_page_fault)
+   EXCEPTION(0x400, InstructionAccess, unknown_exception, EXC_XFER_STD)
 
  /* External interrupt */
     EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -382,7 +376,7 @@ InstructionTLBMiss:
  #endif
     mfspr   r10, SPRN_SPRG_SCRATCH2
     EXCEPTION_EPILOG_0
-   b   InstructionAccess
+   b   InstructionTLBError
 
     . = 0x1200
  DataStoreTLBMiss:

arch/powerpc/kernel/head_8xx.S DataStoreTLBMiss: · line 477

Quoted 8 lines
arch/powerpc/kernel/head_8xx.S +4 -1
@@ -477,7 +471,10 @@ DataStoreTLBMiss:
   */
     . = 0x1300
  InstructionTLBError:
-   b   InstructionAccess
+   EXCEPTION_PROLOG
+   mr   r4,r12
+   mr   r5,r9
+   EXC_XFER_LITE(0x1300, handle_page_fault)

Still don't like that you change the vector number, every other ppc uses the
standard number.

Quoted 2 lines

Can you not just lie here(EXC_XFER_LITE(0x400, handle_page_fault))? Move the code to InstructionAccess too and let TLBError branch there.

My issue was that if I do EXC_XFER_LITE(0x400, handle_page_fault), I can't leave the

    EXCEPTION(0x400, InstructionAccess, unknown_exception, 

EXC_XFER_STD) at address .400
Otherwise, I get twice the same label.

What about the following patch then ? Would this be acceptable ?

@@ -234,15 +234,13 @@ DataAccess:

     EXC_XFER_LITE(0x300, handle_page_fault)

/* Instruction access exception.
- * This is "never generated" by the MPC8xx. We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
*/

     . = 0x400
 InstructionAccess:
     EXCEPTION_PROLOG
-    mr    r4,r12
-    mr    r5,r9
-    EXC_XFER_LITE(0x400, handle_page_fault)
+    addi    r3,r1,STACK_FRAME_OVERHEAD
+    EXC_XFER_STD(0x401, unknown_exception)

/* External interrupt */

     EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)

@@ -382,7 +380,7 @@ InstructionTLBMiss:
#endif
mfspr r10, SPRN_SPRG_SCRATCH2
EXCEPTION_EPILOG_0

-    b    InstructionAccess
+    b    InstructionTLBError
     . = 0x1200
 DataStoreTLBMiss:
@@ -477,7 +475,11 @@ DataStoreTLBMiss:
  */
     . = 0x1300
 InstructionTLBError:
-    b    InstructionAccess
+    EXCEPTION_PROLOG
+    mr    r4,r12
+    mr    r5,r9
+    /* 0x400 is InstructionAccess exception, needed by bad_page_fault() */
+    EXC_XFER_LITE(0x400, handle_page_fault)

/* This is the data TLB error on the MPC8xx. This could be due to
* many reasons, including a dirty update to a pte. We can catch that

Quoted 23 lines

If not I think you should keep the old/current way?

Same for DataTLB Miss/Error

arch/powerpc/mm/fault.c void bad_page_fault(struct pt_regs *regs, unsigned

Quoted 7 lines
arch/powerpc/kernel/head_8xx.S +0 -0
  /* This is the data TLB error on the MPC8xx.  This could be due to
   * many reasons, including a dirty update to a pte.  We can catch that
arch/powerpc/mm/fault.c +0 -0
index 51ab9e7..4d63c96 100644
@@ -526,6 +526,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned

long address, int sig)

Quoted 10 lines
arch/powerpc/mm/fault.c +1 -0
        break;
     case 0x400:
     case 0x480:
+   case 0x1300:
        printk(KERN_ALERT "Unable to handle kernel paging request for "
           "instruction fetch\n");
        break;
Signature · 1 line
2.1.0
#3 lore raw

leroy christophe <[email protected]> wrote on 2014/09/18 18:42:14:

Quoted 3 lines

=20
Le 18/09/2014 17:15, Joakim Tjernlund a =E9crit :

Quoted 1 line

Christophe Leroy <[email protected]> wrote on 2014/09/17=20

18:36:57:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Exception InstructionAccess does not exist on MPC8xx. No need to=20

branch

Quoted 26 lines
Quoted 26 lines

there from somewhere else.

Quoted 10 lines

Handling can be done directly in InstructionTLBError Exception.

---
Changes in v2:
- None

Changes in v3:
- arch/powerpc/mm/fault.c uses the vector number, so make sure it

understand

Review

Quoted 7 lines

the new ones.

  arch/powerpc/kernel/head=5F8xx.S | 17 +++++++----------
  arch/powerpc/mm/fault.c        |  1 +
  2 files changed, 8 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/kernel/head=5F8xx.S

Quoted 6 lines

index 3af6db1..fbe5d10 100644

arch/powerpc/kernel/head=5F8xx.S +0 -0
@@ -234,15 +234,9 @@ DataAccess:
     EXC=5FXFER=5FLITE(0x300, handle=5Fpage=5Ffault)
 
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/powerpc/kernel/head=5F8xx.S +1 -2
  /* Instruction access exception.
- * This is "never generated" by the MPC8xx.  We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
Quoted 8 lines

arch/powerpc/kernel/head=5F8xx.S DataAccess: · line 239

Quoted 8 lines
arch/powerpc/kernel/head=5F8xx.S +1 -6
   */
-   . =3D 0x400
-InstructionAccess:
-   EXCEPTION=5FPROLOG
-   mr   r4,r12
-   mr   r5,r9
-   EXC=5FXFER=5FLITE(0x400, handle=5Fpage=5Ffault)
+   EXCEPTION(0x400, InstructionAccess, unknown=5Fexception,=20

EXC=5FXFER=5FSTD)

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
arch/powerpc/kernel/head=5F8xx.S +1 -1
  /* External interrupt */
     EXCEPTION(0x500, HardwareInterrupt, do=5FIRQ, EXC=5FXFER=5FLITE)
@@ -382,7 +376,7 @@ InstructionTLBMiss:
  #endif
     mfspr   r10, SPRN=5FSPRG=5FSCRATCH2
     EXCEPTION=5FEPILOG=5F0
-   b   InstructionAccess
+   b   InstructionTLBError
 
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/powerpc/kernel/head=5F8xx.S +0 -0
     . =3D 0x1200
  DataStoreTLBMiss:
@@ -477,7 +471,10 @@ DataStoreTLBMiss:
   */
Quoted 8 lines

arch/powerpc/kernel/head=5F8xx.S DataStoreTLBMiss: · line 477

Quoted 7 lines
arch/powerpc/kernel/head=5F8xx.S +4 -1
     . =3D 0x1300
  InstructionTLBError:
-   b   InstructionAccess
+   EXCEPTION=5FPROLOG
+   mr   r4,r12
+   mr   r5,r9
+   EXC=5FXFER=5FLITE(0x1300, handle=5Fpage=5Ffault)

Still don't like that you change the vector number, every other ppc=20

uses

Quoted 4 lines
Quoted 4 lines

the
standard number.

Can you not just lie here(EXC=5FXFER=5FLITE(0x400, handle=5Fpage=5Ffaul=

t))?

Quoted 2 lines
Quoted 1 line

Move the code to InstructionAccess too and let TLBError branch there.

My issue was that if I do EXC=5FXFER=5FLITE(0x400, handle=5Fpage=5Ffault)=

, I=20

Quoted 18 lines

can't leave the

     EXCEPTION(0x400, InstructionAccess, unknown=5Fexception,=20

EXC=5FXFER=5FSTD) at address .400
Otherwise, I get twice the same label.
=20
What about the following patch then ? Would this be acceptable ? =20

(quoted diff) +0 -0
@@ -234,15 +234,13 @@ DataAccess:
      EXC=5FXFER=5FLITE(0x300, handle=5Fpage=5Ffault)

=20
/* Instruction access exception.
- * This is "never generated" by the MPC8xx. We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
*/

      . =3D 0x400

InstructionAccess:
EXCEPTION=5FPROLOG

Review

Quoted 5 lines
(quoted diff) +2 -3
-    mr    r4,r12
-    mr    r5,r9
-    EXC=5FXFER=5FLITE(0x400, handle=5Fpage=5Ffault)
+    addi    r3,r1,STACK=5FFRAME=5FOVERHEAD
+    EXC=5FXFER=5FSTD(0x401, unknown=5Fexception)

Since this is never generated I think it is OK. Nedds some more commenst though, why the 401 etc.

Quoted 13 lines

=20
/* External interrupt */

      EXCEPTION(0x500, HardwareInterrupt, do=5FIRQ, EXC=5FXFER=5FLITE)
arch/powerpc/kernel/head_8xx.S +1 -1
@@ -382,7 +380,7 @@ InstructionTLBMiss:
  #endif
      mfspr    r10, SPRN=5FSPRG=5FSCRATCH2
      EXCEPTION=5FEPILOG=5F0
-    b    InstructionAccess
+    b    InstructionTLBError

=20

      . =3D 0x1200

DataStoreTLBMiss:

arch/powerpc/kernel/head_8xx.S DataStoreTLBMiss: · line 481

Quoted 8 lines
arch/powerpc/kernel/head_8xx.S +4 -1
@@ -477,7 +475,11 @@ DataStoreTLBMiss:
   */
      . =3D 0x1300
  InstructionTLBError:
-    b    InstructionAccess
+    EXCEPTION=5FPROLOG
+    mr    r4,r12
+    mr    r5,r9
+    /* 0x400 is InstructionAccess exception, needed by bad=5Fpage=5Ffaul=

t()=20
*/

Review DataStoreTLBMiss: · line 482

Quoted 1 line
(quoted diff) +1 -0
+    EXC=5FXFER=5FLITE(0x400, handle=5Fpage=5Ffault)

You should have the code in TLBMiss and have the TLBError branch there as that is the common case.=20

Quoted 12 lines

=20
/* This is the data TLB error on the MPC8xx. This could be due to
* many reasons, including a dirty update to a pte. We can catch that
=20
=20

Quoted 7 lines

If not I think you should keep the old/current way?

Same for DataTLB Miss/Error

Quoted 2 lines
arch/powerpc/kernel/head=5F8xx.S +0 -0
  /* This is the data TLB error on the MPC8xx.  This could be due to
   * many reasons, including a dirty update to a pte.  We can catch=20

that

Quoted 5 lines
Quoted 5 lines

arch/powerpc/mm/fault.c void bad=5Fpage=5Ffault(struct pt=5Fregs *regs,=20

Quoted 5 lines
arch/powerpc/mm/fault.c +0 -0
index 51ab9e7..4d63c96 100644
@@ -526,6 +526,7 @@ void bad=5Fpage=5Ffault(struct pt=5Fregs *regs,=20

unsigned

Quoted 6 lines
Quoted 6 lines

long address, int sig)

Quoted 5 lines
arch/powerpc/mm/fault.c +1 -0
        break;
     case 0x400:
     case 0x480:
+   case 0x1300:
        printk(KERN=5FALERT "Unable to handle kernel paging request fo=

r=20
"

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
arch/powerpc/mm/fault.c +0 -1
           "instruction fetch\n");
        break;
--=20

2.1.0

=20

#4 lore raw
Quoted 122 lines · Joakim Tjernlund

leroy christophe <[email protected]> wrote on 2014/09/18 18:42:14:

Quoted 2 lines · Joakim Tjernlund
Quoted 1 line

Christophe Leroy <[email protected]> wrote on 2014/09/17

18:36:57:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Exception InstructionAccess does not exist on MPC8xx. No need to

branch

Quoted 26 lines
Quoted 26 lines

there from somewhere else.

Quoted 10 lines

Handling can be done directly in InstructionTLBError Exception.

---
Changes in v2:
- None

Changes in v3:
- arch/powerpc/mm/fault.c uses the vector number, so make sure it

understand

Review

Quoted 7 lines

the new ones.

   arch/powerpc/kernel/head_8xx.S | 17 +++++++----------
   arch/powerpc/mm/fault.c        |  1 +
   2 files changed, 8 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/kernel/head_8xx.S

Quoted 6 lines

index 3af6db1..fbe5d10 100644

arch/powerpc/kernel/head_8xx.S +0 -0
@@ -234,15 +234,9 @@ DataAccess:
      EXC_XFER_LITE(0x300, handle_page_fault)
 
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/powerpc/kernel/head_8xx.S +1 -2
   /* Instruction access exception.
- * This is "never generated" by the MPC8xx.  We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
Quoted 8 lines

arch/powerpc/kernel/head_8xx.S DataAccess:

Quoted 8 lines
arch/powerpc/kernel/head_8xx.S +1 -6
    */
-   . = 0x400
-InstructionAccess:
-   EXCEPTION_PROLOG
-   mr   r4,r12
-   mr   r5,r9
-   EXC_XFER_LITE(0x400, handle_page_fault)
+   EXCEPTION(0x400, InstructionAccess, unknown_exception,

EXC_XFER_STD)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
arch/powerpc/kernel/head_8xx.S +1 -1
   /* External interrupt */
      EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -382,7 +376,7 @@ InstructionTLBMiss:
   #endif
      mfspr   r10, SPRN_SPRG_SCRATCH2
      EXCEPTION_EPILOG_0
-   b   InstructionAccess
+   b   InstructionTLBError
 
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/powerpc/kernel/head_8xx.S +0 -0
      . = 0x1200
   DataStoreTLBMiss:
@@ -477,7 +471,10 @@ DataStoreTLBMiss:
    */
Quoted 8 lines

arch/powerpc/kernel/head_8xx.S DataStoreTLBMiss: · line 477

Quoted 7 lines
arch/powerpc/kernel/head_8xx.S +4 -1
      . = 0x1300
   InstructionTLBError:
-   b   InstructionAccess
+   EXCEPTION_PROLOG
+   mr   r4,r12
+   mr   r5,r9
+   EXC_XFER_LITE(0x1300, handle_page_fault)

Still don't like that you change the vector number, every other ppc

uses

Quoted 19 lines
Quoted 5 lines

the
standard number.

Can you not just lie here(EXC_XFER_LITE(0x400, handle_page_fault))? Move the code to InstructionAccess too and let TLBError branch there.

My issue was that if I do EXC_XFER_LITE(0x400, handle_page_fault), I can't leave the

      EXCEPTION(0x400, InstructionAccess, unknown_exception,

EXC_XFER_STD) at address .400
Otherwise, I get twice the same label.

What about the following patch then ? Would this be acceptable ?

arch/powerpc/kernel/head_8xx.S +0 -2
@@ -234,15 +234,13 @@ DataAccess:
       EXC_XFER_LITE(0x300, handle_page_fault)
 
   /* Instruction access exception.
- * This is "never generated" by the MPC8xx.  We jump to it for other
- * translation errors.

arch/powerpc/kernel/head_8xx.S DataAccess: · line 243

Quoted 10 lines
arch/powerpc/kernel/head_8xx.S +3 -3
+ * This is "never generated" by the MPC8xx.
    */
       . = 0x400
   InstructionAccess:
       EXCEPTION_PROLOG
-    mr    r4,r12
-    mr    r5,r9
-    EXC_XFER_LITE(0x400, handle_page_fault)
+    addi    r3,r1,STACK_FRAME_OVERHEAD
+    EXC_XFER_STD(0x401, unknown_exception)

Since this is never generated I think it is OK. Nedds some more commenst though, why the 401 etc.

Quoted 12 lines
arch/powerpc/kernel/head_8xx.S +1 -1
   /* External interrupt */
       EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -382,7 +380,7 @@ InstructionTLBMiss:
   #endif
       mfspr    r10, SPRN_SPRG_SCRATCH2
       EXCEPTION_EPILOG_0
-    b    InstructionAccess
+    b    InstructionTLBError
 
       . = 0x1200
   DataStoreTLBMiss:

arch/powerpc/kernel/head_8xx.S DataStoreTLBMiss: · line 481

Quoted 8 lines
arch/powerpc/kernel/head_8xx.S +4 -1
@@ -477,7 +475,11 @@ DataStoreTLBMiss:
    */
       . = 0x1300
   InstructionTLBError:
-    b    InstructionAccess
+    EXCEPTION_PROLOG
+    mr    r4,r12
+    mr    r5,r9
+    /* 0x400 is InstructionAccess exception, needed by bad_page_fault()

*/

Quoted 3 lines

Review DataStoreTLBMiss: · line 482

Quoted 1 line
(quoted diff) +1 -0
+    EXC_XFER_LITE(0x400, handle_page_fault)

You should have the code in TLBMiss and have the TLBError branch there as that is the common case.

As far as I remember, I tried it already but we don't have enough space in TLBmiss for that. We can only have 40 instructions.

Quoted 18 lines
Quoted 11 lines
arch/powerpc/kernel/head_8xx.S +0 -0
   /* This is the data TLB error on the MPC8xx.  This could be due to
    * many reasons, including a dirty update to a pte.  We can catch that
 
Quoted 7 lines

If not I think you should keep the old/current way?

Same for DataTLB Miss/Error

Quoted 2 lines
arch/powerpc/kernel/head_8xx.S +0 -0
   /* This is the data TLB error on the MPC8xx.  This could be due to
    * many reasons, including a dirty update to a pte.  We can catch

that

Quoted 5 lines
Quoted 5 lines

arch/powerpc/mm/fault.c void bad_page_fault(struct pt_regs *regs,

Quoted 5 lines
arch/powerpc/mm/fault.c +0 -0
index 51ab9e7..4d63c96 100644
@@ -526,6 +526,7 @@ void bad_page_fault(struct pt_regs *regs,

unsigned

Quoted 12 lines
Quoted 6 lines
Quoted 6 lines

long address, int sig)

Quoted 5 lines
arch/powerpc/mm/fault.c +1 -0
         break;
      case 0x400:
      case 0x480:
+   case 0x1300:
         printk(KERN_ALERT "Unable to handle kernel paging request for

"

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
arch/powerpc/mm/fault.c +0 -0
            "instruction fetch\n");
         break;
Signature · 1 line
2.1.0

---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

#5 lore raw

christophe leroy <[email protected]> wrote on 2014/09/18 21:11:01:

Quoted 4 lines · Joakim Tjernlund
Quoted 1 line

leroy christophe <[email protected]> wrote on 2014/09/18

18:42:14:

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines · Joakim Tjernlund
Quoted 1 line

Christophe Leroy <[email protected]> wrote on 2014/09/17

18:36:57:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Exception InstructionAccess does not exist on MPC8xx. No need to

branch

Quoted 4 lines
Quoted 4 lines

there from somewhere else.

Quoted 3 lines

Handling can be done directly in InstructionTLBError Exception.

Quoted 11 lines
Quoted 11 lines

arch/powerpc/kernel/head_8xx.S DataStoreTLBMiss: · line 481

Quoted 11 lines
       . = 0x1200

DataStoreTLBMiss:

arch/powerpc/kernel/head_8xx.S +4 -1
@@ -477,7 +475,11 @@ DataStoreTLBMiss:
    */
       . = 0x1300
   InstructionTLBError:
-    b    InstructionAccess
+    EXCEPTION_PROLOG
+    mr    r4,r12
+    mr    r5,r9
+    /* 0x400 is InstructionAccess exception, needed by 

bad_page_fault()

Quoted 3 lines
Quoted 3 lines

*/

Review DataStoreTLBMiss: · line 482

Quoted 1 line
(quoted diff) +1 -0
+    EXC_XFER_LITE(0x400, handle_page_fault)

You should have the code in TLBMiss and have the TLBError branch there

as

Quoted 3 lines
Quoted 1 line

that is the common case.

As far as I remember, I tried it already but we don't have enough space in TLBmiss for that. We can only have 40 instructions.

Do your other optimizations first, then you might have space :)

Jocke

#6 lore raw
Quoted 26 lines · Joakim Tjernlund

christophe leroy <[email protected]> wrote on 2014/09/18 21:11:01:

Quoted 3 lines · Joakim Tjernlund
Quoted 1 line

leroy christophe <[email protected]> wrote on 2014/09/18

18:42:14:

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines · Joakim Tjernlund
Quoted 1 line

Christophe Leroy <[email protected]> wrote on 2014/09/17

18:36:57:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Exception InstructionAccess does not exist on MPC8xx. No need to

branch

Quoted 4 lines
Quoted 4 lines

there from somewhere else.

Quoted 3 lines

Handling can be done directly in InstructionTLBError Exception.

Quoted 11 lines
Quoted 11 lines

arch/powerpc/kernel/head_8xx.S DataStoreTLBMiss: · line 481

Quoted 11 lines
        . = 0x1200
    DataStoreTLBMiss:
arch/powerpc/kernel/head_8xx.S +4 -1
@@ -477,7 +475,11 @@ DataStoreTLBMiss:
     */
        . = 0x1300
    InstructionTLBError:
-    b    InstructionAccess
+    EXCEPTION_PROLOG
+    mr    r4,r12
+    mr    r5,r9
+    /* 0x400 is InstructionAccess exception, needed by

bad_page_fault()

Quoted 10 lines
Quoted 3 lines
Quoted 3 lines

*/

Review DataStoreTLBMiss: · line 482

Quoted 1 line
(quoted diff) +1 -0
+    EXC_XFER_LITE(0x400, handle_page_fault)

You should have the code in TLBMiss and have the TLBError branch there

as

Quoted 3 lines
Quoted 1 line

that is the common case.

As far as I remember, I tried it already but we don't have enough space in TLBmiss for that. We can only have 40 instructions.

Do your other optimizations first, then you might have space :)

Even with the optimisation first, there is no chance to fit ITLBError instructions after ITLBMiss and before DTLBMiss. After optimisation, TLBMiss goes from 0x1100 to 0x1174. TLBError goes from 0x1300 to 0x13b4. DTLBMiss is at 0x1200 And this is without CPU6 ERRATA. So this is hopeless I believe.

Christophe

#7 lore raw
In reply to leroy christophe
Quoted 21 lines · leroy christophe
Quoted 19 lines · Joakim Tjernlund

Christophe Leroy <[email protected]> wrote on 2014/09/17 18:36:57:

Quoted 1 line

Exception InstructionAccess does not exist on MPC8xx. No need to branch

there from somewhere else.

Quoted 10 lines

Handling can be done directly in InstructionTLBError Exception.

---
Changes in v2:
- None

Changes in v3:
- arch/powerpc/mm/fault.c uses the vector number, so make sure it

understand

Quoted 5 lines

the new ones.

  arch/powerpc/kernel/head_8xx.S | 17 +++++++----------
  arch/powerpc/mm/fault.c        |  1 +
  2 files changed, 8 insertions(+), 10 deletions(-)

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

Still don't like that you change the vector number, every other ppc uses

the
standard number.

Quoted 8 lines
Quoted 2 lines

Can you not just lie here(EXC_XFER_LITE(0x400, handle_page_fault))? Move the code to InstructionAccess too and let TLBError branch there.

My issue was that if I do EXC_XFER_LITE(0x400, handle_page_fault), I can't leave the

    EXCEPTION(0x400, InstructionAccess, unknown_exception, 

EXC_XFER_STD) at address .400
Otherwise, I get twice the same label.

What about the following patch then ? Would this be acceptable ?

I don't like what I propose two hours ago indeed.
Is it really worth trying to implement code for vectors 0x300 and 0x400 which are clearly stated in the Reference Manual as never being generated by the HW ?. If I just don't put anything at 0x300 and 0x400 is that OK ?
Otherwise I have to put some code that will branch to TLBerror code, but writing dead code doesn't enchant me.

Christophe

Quoted 41 lines
arch/powerpc/kernel/head_8xx.S +8 -7
@@ -234,15 +234,13 @@ DataAccess:
     EXC_XFER_LITE(0x300, handle_page_fault)
 
 /* Instruction access exception.
- * This is "never generated" by the MPC8xx.  We jump to it for other
- * translation errors.
+ * This is "never generated" by the MPC8xx.
  */
     . = 0x400
 InstructionAccess:
     EXCEPTION_PROLOG
-    mr    r4,r12
-    mr    r5,r9
-    EXC_XFER_LITE(0x400, handle_page_fault)
+    addi    r3,r1,STACK_FRAME_OVERHEAD
+    EXC_XFER_STD(0x401, unknown_exception)
 
 /* External interrupt */
     EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -382,7 +380,7 @@ InstructionTLBMiss:
 #endif
     mfspr    r10, SPRN_SPRG_SCRATCH2
     EXCEPTION_EPILOG_0
-    b    InstructionAccess
+    b    InstructionTLBError
 
     . = 0x1200
 DataStoreTLBMiss:
@@ -477,7 +475,11 @@ DataStoreTLBMiss:
  */
     . = 0x1300
 InstructionTLBError:
-    b    InstructionAccess
+    EXCEPTION_PROLOG
+    mr    r4,r12
+    mr    r5,r9
+    /* 0x400 is InstructionAccess exception, needed by 

bad_page_fault() */
+ EXC_XFER_LITE(0x400, handle_page_fault)

Quoted 29 lines

/* This is the data TLB error on the MPC8xx. This could be due to
* many reasons, including a dirty update to a pte. We can catch that

Quoted 24 lines

If not I think you should keep the old/current way?

Same for DataTLB Miss/Error

arch/powerpc/mm/fault.c void bad_page_fault(struct pt_regs *regs, unsigned

Quoted 8 lines

/* This is the data TLB error on the MPC8xx. This could be due to
* many reasons, including a dirty update to a pte. We can catch
that

arch/powerpc/mm/fault.c +0 -0
index 51ab9e7..4d63c96 100644
@@ -526,6 +526,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned

long address, int sig)

Quoted 10 lines
arch/powerpc/mm/fault.c +1 -0
        break;
     case 0x400:
     case 0x480:
+   case 0x1300:
        printk(KERN_ALERT "Unable to handle kernel paging request for "
           "instruction fetch\n");
        break;
Signature · 1 line
2.1.0

---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

#8 lore raw
Quoted 36 lines · christophe leroy
Quoted 21 lines · leroy christophe
Quoted 19 lines · Joakim Tjernlund

Christophe Leroy <[email protected]> wrote on 2014/09/17 18:36:57:

Quoted 1 line

Exception InstructionAccess does not exist on MPC8xx. No need to branch

there from somewhere else.

Quoted 10 lines

Handling can be done directly in InstructionTLBError Exception.

---
Changes in v2:
- None

Changes in v3:
- arch/powerpc/mm/fault.c uses the vector number, so make sure it

understand

Quoted 5 lines

the new ones.

  arch/powerpc/kernel/head_8xx.S | 17 +++++++----------
  arch/powerpc/mm/fault.c        |  1 +
  2 files changed, 8 insertions(+), 10 deletions(-)

[...]

Quoted 13 lines
Quoted 7 lines
Quoted 2 lines

Still don't like that you change the vector number, every other ppc uses

the
standard number.

Can you not just lie here(EXC_XFER_LITE(0x400, handle_page_fault))? Move the code to InstructionAccess too and let TLBError branch there.

My issue was that if I do EXC_XFER_LITE(0x400, handle_page_fault), I can't leave the

    EXCEPTION(0x400, InstructionAccess, unknown_exception, 

EXC_XFER_STD) at address .400
Otherwise, I get twice the same label.

Quoted 8 lines
Quoted 1 line

What about the following patch then ? Would this be acceptable ?

I don't like what I propose two hours ago indeed.
Is it really worth trying to implement code for vectors 0x300 and 0x400 which are clearly stated in the Reference Manual as never being generated by the HW ?.
If I just don't put anything at 0x300 and 0x400 is that OK ? Otherwise I have to put some code that will branch to TLBerror code, but writing dead code doesn't enchant me.

No, just have the one set of exception handlers that hardware will generate, and use the exception codes that Linux expects. E.g. exception codes are a giant lie on booke as well.

It would be nice if we documented what linux wanted, though, instead of using magic numbers, and assuming it's the same as classic -- which especially fails when it's an exception type that doesn't exist on classic or book3s.

-Scott