Skip to contentSkip to conversation

powerpc/fsl-corenet: remove dead variant symbols

PATCH New Scott Wood 3 participants 11 messages Aug 14, 2012 – Aug 21, 2012

Subsystems (2)
lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 1/3 powerpc/fsl-corenet: remove dead variant symbols

These are not supported as individual build targets, but instead are supported by another target.

The dead p4040 defines in particular had bitrotted significantly.

---
 arch/powerpc/cpu/mpc85xx/Makefile         |    3 --
 arch/powerpc/include/asm/config_mpc85xx.h |   68 ++---------------------------
 arch/powerpc/include/asm/immap_85xx.h     |    2 +-
 drivers/net/fm/Makefile                   |    1 -
 include/configs/P2041RDB.h                |    2 +-
 include/configs/P4080DS.h                 |    1 +
 include/configs/P5020DS.h                 |    2 +-
 7 files changed, 7 insertions(+), 72 deletions(-)
arch/powerpc/cpu/mpc85xx/Makefile +0 -3
index 34f6c54..2b3a435 100644
@@ -64,7 +64,6 @@ COBJS-$(CONFIG_P1024)	+= ddr-gen3.o
 COBJS-$(CONFIG_P1025)	+= ddr-gen3.o
 COBJS-$(CONFIG_P2010)	+= ddr-gen3.o
 COBJS-$(CONFIG_P2020)	+= ddr-gen3.o
-COBJS-$(CONFIG_PPC_P2040)	+= ddr-gen3.o
 COBJS-$(CONFIG_PPC_P2041)	+= ddr-gen3.o
 COBJS-$(CONFIG_PPC_P3041)	+= ddr-gen3.o
 COBJS-$(CONFIG_PPC_P3060)	+= ddr-gen3.o
@@ -80,7 +79,6 @@ COBJS-$(CONFIG_PCI)	+= pci.o
 COBJS-$(CONFIG_SYS_DPAA_QBMAN) += portals.o
 
 # various SoC specific assignments
-COBJS-$(CONFIG_PPC_P2040) += p2041_ids.o
 COBJS-$(CONFIG_PPC_P2041) += p2041_ids.o
 COBJS-$(CONFIG_PPC_P3041) += p3041_ids.o
 COBJS-$(CONFIG_PPC_P3060) += p3060_ids.o
@@ -114,7 +112,6 @@ COBJS-$(CONFIG_P1024)	+= p1021_serdes.o
 COBJS-$(CONFIG_P1025)	+= p1021_serdes.o
 COBJS-$(CONFIG_P2010)	+= p2020_serdes.o
 COBJS-$(CONFIG_P2020)	+= p2020_serdes.o
-COBJS-$(CONFIG_PPC_P2040) += p2041_serdes.o
 COBJS-$(CONFIG_PPC_P2041) += p2041_serdes.o
 COBJS-$(CONFIG_PPC_P3041) += p3041_serdes.o
 COBJS-$(CONFIG_PPC_P3060) += p3060_serdes.o
arch/powerpc/include/asm/config_mpc85xx.h +3 -65

86 lines not on this page · raw message

arch/powerpc/include/asm/immap_85xx.h +1 -1
index 53d563e..b49ee9b 100644
@@ -1772,7 +1772,7 @@ typedef struct ccsr_gur {
 #define FSL_CORENET_RCWSR11_EC2_FM1_DTSEC2		0x00080000
 #define FSL_CORENET_RCWSR11_EC2_USB2			0x00100000
 #endif
-#if defined(CONFIG_PPC_P2040) || defined(CONFIG_PPC_P2041) \
+#if defined(CONFIG_PPC_P2041) \
 	|| defined(CONFIG_PPC_P3041) || defined(CONFIG_PPC_P5020)
 #define FSL_CORENET_RCWSR11_EC1_FM1_DTSEC4_RGMII	0x00000000
 #define FSL_CORENET_RCWSR11_EC1_FM1_DTSEC4_MII		0x00800000
drivers/net/fm/Makefile +0 -1
index 072b178..83ba580 100644
@@ -36,7 +36,6 @@ COBJS-y += tgec_phy.o
 COBJS-$(CONFIG_P1017)	+= p1023.o
 COBJS-$(CONFIG_P1023)	+= p1023.o
 # The P204x, P304x, and P5020 are the same
-COBJS-$(CONFIG_PPC_P2040) += p5020.o
 COBJS-$(CONFIG_PPC_P2041) += p5020.o
 COBJS-$(CONFIG_PPC_P3041) += p5020.o
 COBJS-$(CONFIG_PPC_P3060) += p3060.o
include/configs/P2041RDB.h +1 -1
index 1c0eb74..8a393c2 100644
@@ -22,7 +22,7 @@
 
 /*
  * P2041 RDB board configuration file
- *
+ * Also supports P2040 RDB
  */
 #ifndef __CONFIG_H
 #define __CONFIG_H
include/configs/P4080DS.h +1 -0
index 4a2e475..d6f2f5c 100644
@@ -22,6 +22,7 @@
 
 /*
  * P4080 DS board configuration file
+ * Also supports P4040 DS
  */
 #define CONFIG_P4080DS
 #define CONFIG_PHYS_64BIT
include/configs/P5020DS.h +1 -1
index 4afc4f1..8625f76 100644
@@ -22,7 +22,7 @@
 
 /*
  * P5020 DS board configuration file
- *
+ * Also supports P5010 DS
  */
 #define CONFIG_P5020DS
 #define CONFIG_PHYS_64BIT
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/3 powerpc/85xx: clear out TLB on boot

Instead of just shooting down the entry that covers CCSR, clear out every TLB entry that isn't the one that we're executing out of.

---
 arch/powerpc/cpu/mpc85xx/start.S     |   76 +++++++++++++++++++---------------
 arch/powerpc/include/asm/mmu.h       |    4 ++
 arch/powerpc/include/asm/processor.h |    1 +
 3 files changed, 48 insertions(+), 33 deletions(-)
arch/powerpc/cpu/mpc85xx/start.S +43 -33
index 6aabc30..742eade 100644
@@ -406,12 +406,11 @@ l2_disabled:
  * Search for the TLB that covers the code we're executing, and shrink it
  * so that it covers only this 4K page.  That will ensure that any other
  * TLB we create won't interfere with it.  We assume that the TLB exists,
- * which is why we don't check the Valid bit of MAS1.
+ * which is why we don't check the Valid bit of MAS1.  We also assume
+ * it is in TLB1.
  *
  * This is necessary, for example, when booting from the on-chip ROM,
  * which (oddly) creates a single 4GB TLB that covers CCSR and DDR.
- * If we don't shrink this TLB now, then we'll accidentally delete it
- * in "purge_old_ccsr_tlb" below.
  */
 	bl	nexti		/* Find our address */
 nexti:	mflr	r1		/* R1 = our PC */
@@ -421,11 +420,15 @@ nexti:	mflr	r1		/* R1 = our PC */
 	msync
 	tlbsx	0, r1		/* This must succeed */
 
+	mfspr	r14, MAS0	/* Save ESEL for later */
+	rlwinm	r14, r14, 16, 0xfff
+
 	/* Set the size of the TLB to 4KB */
 	mfspr	r3, MAS1
 	li	r2, 0xF00
 	andc	r3, r3, r2	/* Clear the TSIZE bits */
 	ori	r3, r3, MAS1_TSIZE(BOOKE_PAGESZ_4K)@l
+	oris	r3, r3, MAS1_IPROT at h
 	mtspr	MAS1, r3
 
 	/*
@@ -452,6 +455,39 @@ nexti:	mflr	r1		/* R1 = our PC */
 	tlbwe
 
 /*
+ * Clear out any other TLB entries that may exist, to avoid conflicts.
+ * Our TLB entry is in r14.
+ */
+	li	r0, TLBIVAX_ALL | TLBIVAX_TLB0
+	tlbivax 0, r0
+	tlbsync
+
+	mfspr	r4, SPRN_TLB1CFG
+	rlwinm	r4, r4, 0, TLBnCFG_NENTRY_MASK
+
+	li	r3, 0
+	mtspr	MAS1, r3
+1:	cmpw	r3, r14
+#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB) && !defined(CONFIG_NAND_SPL)
+	cmpwi	cr1, r3, CONFIG_SYS_PPC_E500_DEBUG_TLB
+	cror	cr0, cr0, cr1
+#endif
+	rlwinm	r5, r3, 16, MAS0_ESEL_MSK
+	addi	r3, r3, 1
+	beq	1b		/* skip the entry we're executing from */
+
+	oris	r5, r5, MAS0_TLBSEL(1)@h
+	mtspr	MAS0, r5
+
+	isync
+	tlbwe
+	isync
+	msync
+
+	cmpw	r3, r4
+	blt	1b
+
+/*
  * Relocate CCSR, if necessary.  We relocate CCSR if (obviously) the default
  * location is not where we want it.  This typically happens on a 36-bit
  * system, where we want to move CCSR to near the top of 36-bit address space.
@@ -469,41 +505,15 @@ nexti:	mflr	r1		/* R1 = our PC */
 #error "CONFIG_SYS_CCSRBAR_PHYS_HIGH and CONFIG_SYS_CCSRBAR_PHYS_LOW) must be defined."
 #endif
 
-purge_old_ccsr_tlb:
-	lis	r8, CONFIG_SYS_CCSRBAR at h
-	ori	r8, r8, CONFIG_SYS_CCSRBAR at l
-	lis	r9, (CONFIG_SYS_CCSRBAR + 0x1000)@h
-	ori	r9, r9, (CONFIG_SYS_CCSRBAR + 0x1000)@l
-
-	/*
-	 * In a multi-stage boot (e.g. NAND boot), a previous stage may have
-	 * created a TLB for CCSR, which will interfere with our relocation
-	 * code.  Since we're going to create a new TLB for CCSR anyway,
-	 * it should be safe to delete this old TLB here.  We have to search
-	 * for it, though.
-	 */
-
-	li	r1, 0
-	mtspr	MAS6, r1	/* Search the current address space and PID */
-	isync
-	msync
-	tlbsx	0, r8
-	mfspr	r1, MAS1
-	andis.  r2, r1, MAS1_VALID at h	/* Check for the Valid bit */
-	beq     1f			/* Skip if no TLB found */
-
-	rlwinm	r1, r1, 0, 1, 31	/* Clear Valid bit */
-	mtspr	MAS1, r1
-	isync
-	msync
-	tlbwe
-1:
-
 create_ccsr_new_tlb:
 	/*
 	 * Create a TLB for the new location of CCSR.  Register R8 is reserved
 	 * for the virtual address of this TLB (CONFIG_SYS_CCSRBAR).
 	 */
+	lis	r8, CONFIG_SYS_CCSRBAR at h
+	ori	r8, r8, CONFIG_SYS_CCSRBAR at l
+	lis	r9, (CONFIG_SYS_CCSRBAR + 0x1000)@h
+	ori	r9, r9, (CONFIG_SYS_CCSRBAR + 0x1000)@l
 	lis     r0, FSL_BOOKE_MAS0(0, 0, 0)@h
 	ori     r0, r0, FSL_BOOKE_MAS0(0, 0, 0)@l
 	lis     r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@h
arch/powerpc/include/asm/mmu.h +4 -0
index 209103e..2e0e292 100644
@@ -475,6 +475,10 @@ extern void print_bats(void);
 #define BOOKE_PAGESZ_256GB	14
 #define BOOKE_PAGESZ_1TB	15
 
+#define TLBIVAX_ALL		4
+#define TLBIVAX_TLB0		0
+#define TLBIVAX_TLB1		8
+
 #ifdef CONFIG_E500
 #ifndef __ASSEMBLY__
 extern void set_tlb(u8 tlb, u32 epn, u64 rpn,
arch/powerpc/include/asm/processor.h +1 -0
index dc009d6..0de3685 100644
@@ -513,6 +513,7 @@
 
 #define SPRN_TLB0CFG	0x2B0	/* TLB 0 Config Register */
 #define SPRN_TLB1CFG	0x2B1	/* TLB 1 Config Register */
+#define   TLBnCFG_NENTRY_MASK	0x00000fff
 #define SPRN_TLB0PS	0x158	/* TLB 0 Page Size Register */
 #define SPRN_TLB1PS	0x159	/* TLB 1 Page Size Register */
 #define SPRN_MMUCSR0	0x3f4	/* MMU control and status register 0 */
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v2 1/1 powerpc/85xx: clear out TLB on boot

Instead of just shooting down the entry that covers CCSR, clear out every TLB entry that isn't the one that we're executing out of.

---
v2: fix cror operands

 arch/powerpc/cpu/mpc85xx/start.S     |   76 +++++++++++++++++++---------------
 arch/powerpc/include/asm/mmu.h       |    4 ++
 arch/powerpc/include/asm/processor.h |    1 +
 3 files changed, 48 insertions(+), 33 deletions(-)
arch/powerpc/cpu/mpc85xx/start.S +43 -33
index 6aabc30..8ed98bc 100644
@@ -406,12 +406,11 @@ l2_disabled:
  * Search for the TLB that covers the code we're executing, and shrink it
  * so that it covers only this 4K page.  That will ensure that any other
  * TLB we create won't interfere with it.  We assume that the TLB exists,
- * which is why we don't check the Valid bit of MAS1.
+ * which is why we don't check the Valid bit of MAS1.  We also assume
+ * it is in TLB1.
  *
  * This is necessary, for example, when booting from the on-chip ROM,
  * which (oddly) creates a single 4GB TLB that covers CCSR and DDR.
- * If we don't shrink this TLB now, then we'll accidentally delete it
- * in "purge_old_ccsr_tlb" below.
  */
 	bl	nexti		/* Find our address */
 nexti:	mflr	r1		/* R1 = our PC */
@@ -421,11 +420,15 @@ nexti:	mflr	r1		/* R1 = our PC */
 	msync
 	tlbsx	0, r1		/* This must succeed */
 
+	mfspr	r14, MAS0	/* Save ESEL for later */
+	rlwinm	r14, r14, 16, 0xfff
+
 	/* Set the size of the TLB to 4KB */
 	mfspr	r3, MAS1
 	li	r2, 0xF00
 	andc	r3, r3, r2	/* Clear the TSIZE bits */
 	ori	r3, r3, MAS1_TSIZE(BOOKE_PAGESZ_4K)@l
+	oris	r3, r3, MAS1_IPROT at h
 	mtspr	MAS1, r3
 
 	/*
@@ -452,6 +455,39 @@ nexti:	mflr	r1		/* R1 = our PC */
 	tlbwe
 
 /*
+ * Clear out any other TLB entries that may exist, to avoid conflicts.
+ * Our TLB entry is in r14.
+ */
+	li	r0, TLBIVAX_ALL | TLBIVAX_TLB0
+	tlbivax 0, r0
+	tlbsync
+
+	mfspr	r4, SPRN_TLB1CFG
+	rlwinm	r4, r4, 0, TLBnCFG_NENTRY_MASK
+
+	li	r3, 0
+	mtspr	MAS1, r3
+1:	cmpw	r3, r14
+#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB) && !defined(CONFIG_NAND_SPL)
+	cmpwi	cr1, r3, CONFIG_SYS_PPC_E500_DEBUG_TLB
+	cror	cr0*4+eq, cr0*4+eq, cr1*4+eq
+#endif
+	rlwinm	r5, r3, 16, MAS0_ESEL_MSK
+	addi	r3, r3, 1
+	beq	1b		/* skip the entry we're executing from */
+
+	oris	r5, r5, MAS0_TLBSEL(1)@h
+	mtspr	MAS0, r5
+
+	isync
+	tlbwe
+	isync
+	msync
+
+	cmpw	r3, r4
+	blt	1b
+
+/*
  * Relocate CCSR, if necessary.  We relocate CCSR if (obviously) the default
  * location is not where we want it.  This typically happens on a 36-bit
  * system, where we want to move CCSR to near the top of 36-bit address space.
@@ -469,41 +505,15 @@ nexti:	mflr	r1		/* R1 = our PC */
 #error "CONFIG_SYS_CCSRBAR_PHYS_HIGH and CONFIG_SYS_CCSRBAR_PHYS_LOW) must be defined."
 #endif
 
-purge_old_ccsr_tlb:
-	lis	r8, CONFIG_SYS_CCSRBAR at h
-	ori	r8, r8, CONFIG_SYS_CCSRBAR at l
-	lis	r9, (CONFIG_SYS_CCSRBAR + 0x1000)@h
-	ori	r9, r9, (CONFIG_SYS_CCSRBAR + 0x1000)@l
-
-	/*
-	 * In a multi-stage boot (e.g. NAND boot), a previous stage may have
-	 * created a TLB for CCSR, which will interfere with our relocation
-	 * code.  Since we're going to create a new TLB for CCSR anyway,
-	 * it should be safe to delete this old TLB here.  We have to search
-	 * for it, though.
-	 */
-
-	li	r1, 0
-	mtspr	MAS6, r1	/* Search the current address space and PID */
-	isync
-	msync
-	tlbsx	0, r8
-	mfspr	r1, MAS1
-	andis.  r2, r1, MAS1_VALID at h	/* Check for the Valid bit */
-	beq     1f			/* Skip if no TLB found */
-
-	rlwinm	r1, r1, 0, 1, 31	/* Clear Valid bit */
-	mtspr	MAS1, r1
-	isync
-	msync
-	tlbwe
-1:
-
 create_ccsr_new_tlb:
 	/*
 	 * Create a TLB for the new location of CCSR.  Register R8 is reserved
 	 * for the virtual address of this TLB (CONFIG_SYS_CCSRBAR).
 	 */
+	lis	r8, CONFIG_SYS_CCSRBAR at h
+	ori	r8, r8, CONFIG_SYS_CCSRBAR at l
+	lis	r9, (CONFIG_SYS_CCSRBAR + 0x1000)@h
+	ori	r9, r9, (CONFIG_SYS_CCSRBAR + 0x1000)@l
 	lis     r0, FSL_BOOKE_MAS0(0, 0, 0)@h
 	ori     r0, r0, FSL_BOOKE_MAS0(0, 0, 0)@l
 	lis     r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@h
arch/powerpc/include/asm/mmu.h +4 -0
index 209103e..2e0e292 100644
@@ -475,6 +475,10 @@ extern void print_bats(void);
 #define BOOKE_PAGESZ_256GB	14
 #define BOOKE_PAGESZ_1TB	15
 
+#define TLBIVAX_ALL		4
+#define TLBIVAX_TLB0		0
+#define TLBIVAX_TLB1		8
+
 #ifdef CONFIG_E500
 #ifndef __ASSEMBLY__
 extern void set_tlb(u8 tlb, u32 epn, u64 rpn,
arch/powerpc/include/asm/processor.h +1 -0
index dc009d6..0de3685 100644
@@ -513,6 +513,7 @@
 
 #define SPRN_TLB0CFG	0x2B0	/* TLB 0 Config Register */
 #define SPRN_TLB1CFG	0x2B1	/* TLB 1 Config Register */
+#define   TLBnCFG_NENTRY_MASK	0x00000fff
 #define SPRN_TLB0PS	0x158	/* TLB 0 Page Size Register */
 #define SPRN_TLB1PS	0x159	/* TLB 1 Page Size Register */
 #define SPRN_MMUCSR0	0x3f4	/* MMU control and status register 0 */
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v3 1/1 powerpc/85xx: clear out TLB on boot

Instead of just shooting down the entry that covers CCSR, clear out every TLB entry that isn't the one that we're executing out of.

---
v3: Don't skip the "last TLB entry" check when skipping a TLB entry in the invalidation loop. Sorry about the rapid updates -- this should be the last one for this patch unless someone notices a problem.

Prabhakar, can you test that this doesn't break debugging?

 arch/powerpc/cpu/mpc85xx/start.S     |   76 +++++++++++++++++++---------------
 arch/powerpc/include/asm/mmu.h       |    4 ++
 arch/powerpc/include/asm/processor.h |    1 +
 3 files changed, 48 insertions(+), 33 deletions(-)
arch/powerpc/cpu/mpc85xx/start.S +43 -33
index 6aabc30..5f4d19f 100644
@@ -406,12 +406,11 @@ l2_disabled:
  * Search for the TLB that covers the code we're executing, and shrink it
  * so that it covers only this 4K page.  That will ensure that any other
  * TLB we create won't interfere with it.  We assume that the TLB exists,
- * which is why we don't check the Valid bit of MAS1.
+ * which is why we don't check the Valid bit of MAS1.  We also assume
+ * it is in TLB1.
  *
  * This is necessary, for example, when booting from the on-chip ROM,
  * which (oddly) creates a single 4GB TLB that covers CCSR and DDR.
- * If we don't shrink this TLB now, then we'll accidentally delete it
- * in "purge_old_ccsr_tlb" below.
  */
 	bl	nexti		/* Find our address */
 nexti:	mflr	r1		/* R1 = our PC */
@@ -421,11 +420,15 @@ nexti:	mflr	r1		/* R1 = our PC */
 	msync
 	tlbsx	0, r1		/* This must succeed */
 
+	mfspr	r14, MAS0	/* Save ESEL for later */
+	rlwinm	r14, r14, 16, 0xfff
+
 	/* Set the size of the TLB to 4KB */
 	mfspr	r3, MAS1
 	li	r2, 0xF00
 	andc	r3, r3, r2	/* Clear the TSIZE bits */
 	ori	r3, r3, MAS1_TSIZE(BOOKE_PAGESZ_4K)@l
+	oris	r3, r3, MAS1_IPROT at h
 	mtspr	MAS1, r3
 
 	/*
@@ -452,6 +455,39 @@ nexti:	mflr	r1		/* R1 = our PC */
 	tlbwe
 
 /*
+ * Clear out any other TLB entries that may exist, to avoid conflicts.
+ * Our TLB entry is in r14.
+ */
+	li	r0, TLBIVAX_ALL | TLBIVAX_TLB0
+	tlbivax 0, r0
+	tlbsync
+
+	mfspr	r4, SPRN_TLB1CFG
+	rlwinm	r4, r4, 0, TLBnCFG_NENTRY_MASK
+
+	li	r3, 0
+	mtspr	MAS1, r3
+1:	cmpw	r3, r14
+#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB) && !defined(CONFIG_NAND_SPL)
+	cmpwi	cr1, r3, CONFIG_SYS_PPC_E500_DEBUG_TLB
+	cror	cr0*4+eq, cr0*4+eq, cr1*4+eq
+#endif
+	rlwinm	r5, r3, 16, MAS0_ESEL_MSK
+	addi	r3, r3, 1
+	beq	2f		/* skip the entry we're executing from */
+
+	oris	r5, r5, MAS0_TLBSEL(1)@h
+	mtspr	MAS0, r5
+
+	isync
+	tlbwe
+	isync
+	msync
+
+2:	cmpw	r3, r4
+	blt	1b
+
+/*
  * Relocate CCSR, if necessary.  We relocate CCSR if (obviously) the default
  * location is not where we want it.  This typically happens on a 36-bit
  * system, where we want to move CCSR to near the top of 36-bit address space.
@@ -469,41 +505,15 @@ nexti:	mflr	r1		/* R1 = our PC */
 #error "CONFIG_SYS_CCSRBAR_PHYS_HIGH and CONFIG_SYS_CCSRBAR_PHYS_LOW) must be defined."
 #endif
 
-purge_old_ccsr_tlb:
-	lis	r8, CONFIG_SYS_CCSRBAR at h
-	ori	r8, r8, CONFIG_SYS_CCSRBAR at l
-	lis	r9, (CONFIG_SYS_CCSRBAR + 0x1000)@h
-	ori	r9, r9, (CONFIG_SYS_CCSRBAR + 0x1000)@l
-
-	/*
-	 * In a multi-stage boot (e.g. NAND boot), a previous stage may have
-	 * created a TLB for CCSR, which will interfere with our relocation
-	 * code.  Since we're going to create a new TLB for CCSR anyway,
-	 * it should be safe to delete this old TLB here.  We have to search
-	 * for it, though.
-	 */
-
-	li	r1, 0
-	mtspr	MAS6, r1	/* Search the current address space and PID */
-	isync
-	msync
-	tlbsx	0, r8
-	mfspr	r1, MAS1
-	andis.  r2, r1, MAS1_VALID at h	/* Check for the Valid bit */
-	beq     1f			/* Skip if no TLB found */
-
-	rlwinm	r1, r1, 0, 1, 31	/* Clear Valid bit */
-	mtspr	MAS1, r1
-	isync
-	msync
-	tlbwe
-1:
-
 create_ccsr_new_tlb:
 	/*
 	 * Create a TLB for the new location of CCSR.  Register R8 is reserved
 	 * for the virtual address of this TLB (CONFIG_SYS_CCSRBAR).
 	 */
+	lis	r8, CONFIG_SYS_CCSRBAR at h
+	ori	r8, r8, CONFIG_SYS_CCSRBAR at l
+	lis	r9, (CONFIG_SYS_CCSRBAR + 0x1000)@h
+	ori	r9, r9, (CONFIG_SYS_CCSRBAR + 0x1000)@l
 	lis     r0, FSL_BOOKE_MAS0(0, 0, 0)@h
 	ori     r0, r0, FSL_BOOKE_MAS0(0, 0, 0)@l
 	lis     r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@h
arch/powerpc/include/asm/mmu.h +4 -0
index 209103e..2e0e292 100644
@@ -475,6 +475,10 @@ extern void print_bats(void);
 #define BOOKE_PAGESZ_256GB	14
 #define BOOKE_PAGESZ_1TB	15
 
+#define TLBIVAX_ALL		4
+#define TLBIVAX_TLB0		0
+#define TLBIVAX_TLB1		8
+
 #ifdef CONFIG_E500
 #ifndef __ASSEMBLY__
 extern void set_tlb(u8 tlb, u32 epn, u64 rpn,
arch/powerpc/include/asm/processor.h +1 -0
index dc009d6..0de3685 100644
@@ -513,6 +513,7 @@
 
 #define SPRN_TLB0CFG	0x2B0	/* TLB 0 Config Register */
 #define SPRN_TLB1CFG	0x2B1	/* TLB 1 Config Register */
+#define   TLBnCFG_NENTRY_MASK	0x00000fff
 #define SPRN_TLB0PS	0x158	/* TLB 0 Page Size Register */
 #define SPRN_TLB1PS	0x159	/* TLB 1 Page Size Register */
 #define SPRN_MMUCSR0	0x3f4	/* MMU control and status register 0 */
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v3 1/1 powerpc/85xx: clear out TLB on boot

Quoted 12 lines · Scott Wood

Instead of just shooting down the entry that covers CCSR, clear out every TLB entry that isn't the one that we're executing out of.

---
v3: Don't skip the "last TLB entry" check when skipping a TLB entry in the invalidation loop. Sorry about the rapid updates -- this should be the last one for this patch unless someone notices a problem.

Prabhakar, can you test that this doesn't break debugging?

Verified debugging on P1010RDB with NOR, NAND boot and SPI boot.

No debug is breaking

Thanks,
Prabhakar

author
#5 lore raw

PATCH 3/3 powerpc/fsl-corenet: work around erratum A004510

In reply to Scott Wood

Erratum A004510 says that under certain load conditions, modified cache lines can be discarded, causing data corruption.

To work around this, several CCSR and DCSR register updates need to be made in a careful manner, so that there is no other transaction in corenet when the update is made.

The update is made from a locked cacheline, with a delay before to flush any previous activity, and a delay after to flush the CCSR/DCSR update. We can't use a readback because that would be another corenet transaction, which is not allowed.

We lock the subsequent cacheline to prevent it from being fetched while we're executing the previous cacheline. It is filled with nops so that a branch doesn't cause us to fetch another cacheline.

Ordinarily we are running in a cache-inhibited mapping at this point, so we temporarily change that. We make it guarded so that we should never see a speculative load, and we never do an explicit load. Thus, only the I-cache should ever fill from this mapping, and we flush/unlock it afterward. Thus we should avoid problems from any potential cache aliasing between inhibited and non-inhibited mappings.

NOTE that if PAMU is used with this patch, it will need to use a dedicated LAW as described in the erratum. This is the responsibility of the OS that sets up PAMU.

---
 README                                    |   25 +++
 arch/powerpc/cpu/mpc85xx/cmd_errata.c     |    3 +
 arch/powerpc/cpu/mpc85xx/release.S        |   27 +++
 arch/powerpc/cpu/mpc85xx/start.S          |  284 +++++++++++++++++++++++++++++
 arch/powerpc/include/asm/config_mpc85xx.h |   17 ++
 arch/powerpc/include/asm/processor.h      |    2 +
 6 files changed, 358 insertions(+)
README +25 -0
index fb9d904..abfb019 100644
@@ -383,6 +383,31 @@ The following options need to be configured:
 		symbol should be set to the TLB1 entry to be used for this
 		purpose.
 
+		CONFIG_SYS_FSL_ERRATUM_A004510
+
+		Enables a workaround for erratum A004510.  If set,
+		then CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV and
+		CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY must be set.
+
+		CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV
+		CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV2 (optional)
+
+		Defines one or two SoC revisions (low 8 bits of SVR)
+		for which the A004510 workaround should be applied.
+
+		The rest of SVR is either not relevant to the decision
+		of whether the erratum is present (e.g. p2040 versus
+		p2041) or is implied by the build target, which controls
+		whether CONFIG_SYS_FSL_ERRATUM_A004510 is set.
+
+		See Freescale App Note 4493 for more information about
+		this erratum.
+
+		CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY
+
+		This is the value to write into CCSR offset 0x18600
+		according to the A004510 workaround.
+
 - Generic CPU options:
 		CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN
 
arch/powerpc/cpu/mpc85xx/cmd_errata.c +3 -0
index 4e1a54a..b88b43d 100644
@@ -120,6 +120,9 @@ static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0))
 		puts("Work-around for Erratum NMG ETSEC129 enabled\n");
 #endif
+#ifdef CONFIG_SYS_FSL_ERRATUM_A004510
+	puts("Work-around for Erratum A004510 enabled\n");
+#endif
 	return 0;
 }
 
arch/powerpc/cpu/mpc85xx/release.S +27 -0
index 1860684..b19beeb 100644
@@ -74,6 +74,33 @@ __secondary_start_page:
 	mtspr	977,r3
 #endif
 
+#ifdef CONFIG_SYS_FSL_ERRATUM_A004510
+	mfspr	r3,SPRN_SVR
+	rlwinm	r3,r3,0,0xff
+	li	r4,CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV
+	cmpw	r3,r4
+	beq	1f
+
+#ifdef CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV2
+	li	r4,CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV2
+	cmpw	r3,r4
+	beq	1f
+#endif
+
+	/* Not a supported revision affected by erratum */
+	b	2f
+
+1:	/* Erratum says set bits 55:60 to 001001 */
+	msync
+	isync
+	mfspr	r3,976
+	li	r4,0x48
+	rlwimi	r3,r4,0,0x1f8
+	mtspr	976,r3
+	isync
+2:
+#endif
+
 	/* Enable branch prediction */
 	lis	r3,BUCSR_ENABLE at h
 	ori	r3,r3,BUCSR_ENABLE at l
arch/powerpc/cpu/mpc85xx/start.S +284 -0

302 lines not on this page · raw message

arch/powerpc/include/asm/config_mpc85xx.h +17 -0
index 17bba26..fd30f15 100644
@@ -357,6 +357,10 @@
 #define CONFIG_SYS_FSL_SRIO_MAX_PORTS	2
 #define CONFIG_SYS_FSL_SRIO_OB_WIN_NUM	9
 #define CONFIG_SYS_FSL_SRIO_IB_WIN_NUM	5
+#define CONFIG_SYS_FSL_ERRATUM_A004510
+#define CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV	0x10
+#define CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV2	0x11
+#define CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY 0xf0000000
 
 #elif defined(CONFIG_PPC_P3041)
 #define CONFIG_MAX_CPUS			4
@@ -381,6 +385,10 @@
 #define CONFIG_SYS_FSL_SRIO_MAX_PORTS	2
 #define CONFIG_SYS_FSL_SRIO_OB_WIN_NUM	9
 #define CONFIG_SYS_FSL_SRIO_IB_WIN_NUM	5
+#define CONFIG_SYS_FSL_ERRATUM_A004510
+#define CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV	0x10
+#define CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV2	0x11
+#define CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY 0xf0000000
 
 #elif defined(CONFIG_PPC_P3060)
 #define CONFIG_MAX_CPUS			8
@@ -400,6 +408,9 @@
 #define CONFIG_SYS_FSL_SRIO_MAX_PORTS	2
 #define CONFIG_SYS_FSL_SRIO_OB_WIN_NUM	9
 #define CONFIG_SYS_FSL_SRIO_IB_WIN_NUM	5
+#define CONFIG_SYS_FSL_ERRATUM_A004510
+#define CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV	0x10
+#define CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY 0xff000000
 
 #elif defined(CONFIG_PPC_P4080) /* also supports P4040 */
 #define CONFIG_MAX_CPUS			8
@@ -436,6 +447,9 @@
 #define CONFIG_SYS_FSL_SRIO_IB_WIN_NUM	5
 #define CONFIG_SYS_FSL_RMU
 #define CONFIG_SYS_FSL_SRIO_MSG_UNIT_NUM	2
+#define CONFIG_SYS_FSL_ERRATUM_A004510
+#define CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV	0x20
+#define CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY 0xff000000
 
 #elif defined(CONFIG_PPC_P5020) /* also supports P5010 */
 #define CONFIG_MAX_CPUS			2
@@ -459,6 +473,9 @@
 #define CONFIG_SYS_FSL_SRIO_MAX_PORTS	2
 #define CONFIG_SYS_FSL_SRIO_OB_WIN_NUM	9
 #define CONFIG_SYS_FSL_SRIO_IB_WIN_NUM	5
+#define CONFIG_SYS_FSL_ERRATUM_A004510
+#define CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV	0x10
+#define CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY 0xc0000000
 
 #elif defined(CONFIG_BSC9131)
 #define CONFIG_MAX_CPUS			1
arch/powerpc/include/asm/processor.h +2 -0
index 0de3685..60a11ea 100644
@@ -486,11 +486,13 @@
 #define SPRN_L2CFG0	0x207	/* L2 Cache Configuration Register 0 */
 #define SPRN_L1CSR0	0x3f2	/* L1 Data Cache Control and Status Register 0 */
 #define   L1CSR0_CPE		0x00010000	/* Data Cache Parity Enable */
+#define   L1CSR0_CUL		0x00000400	/* (D-)Cache Unable to Lock */
 #define   L1CSR0_DCLFR		0x00000100	/* D-Cache Lock Flash Reset */
 #define   L1CSR0_DCFI		0x00000002	/* Data Cache Flash Invalidate */
 #define   L1CSR0_DCE		0x00000001	/* Data Cache Enable */
 #define SPRN_L1CSR1	0x3f3	/* L1 Instruction Cache Control and Status Register 1 */
 #define   L1CSR1_CPE		0x00010000	/* Instruction Cache Parity Enable */
+#define   L1CSR1_ICUL		0x00000400	/* I-Cache Unable to Lock */
 #define   L1CSR1_ICLFR		0x00000100	/* I-Cache Lock Flash Reset */
 #define   L1CSR1_ICFI		0x00000002	/* Instruction Cache Flash Invalidate */
 #define   L1CSR1_ICE		0x00000001	/* Instruction Cache Enable */
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 1/3 powerpc/fsl-corenet: remove dead variant symbols

In reply to Scott Wood
Quoted 7 lines · Scott Wood

These are not supported as individual build targets, but instead are supported by another target.

The dead p4040 defines in particular had bitrotted significantly.

---

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/Makefile         |    3 --
arch/powerpc/include/asm/config_mpc85xx.h |   68 ++---------------------------
arch/powerpc/include/asm/immap_85xx.h     |    2 +-
drivers/net/fm/Makefile                   |    1 -
include/configs/P2041RDB.h                |    2 +-
include/configs/P4080DS.h                 |    1 +
include/configs/P5020DS.h                 |    2 +-
7 files changed, 7 insertions(+), 72 deletions(-)

I had put these in for customer specific boards... I understand we might have bit rot, but I guess I'd rather we added:

P2040RDB, P4040DS, and P5010DS to boards.cfg to test these SoC builds than remove the code.

- k

author
#7 lore raw

PATCH 1/3 powerpc/fsl-corenet: remove dead variant symbols

Quoted 19 lines · Kumar Gala
Quoted 7 lines · Scott Wood

These are not supported as individual build targets, but instead are supported by another target.

The dead p4040 defines in particular had bitrotted significantly.

---

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/Makefile         |    3 --
arch/powerpc/include/asm/config_mpc85xx.h |   68 ++---------------------------
arch/powerpc/include/asm/immap_85xx.h     |    2 +-
drivers/net/fm/Makefile                   |    1 -
include/configs/P2041RDB.h                |    2 +-
include/configs/P4080DS.h                 |    1 +
include/configs/P5020DS.h                 |    2 +-
7 files changed, 7 insertions(+), 72 deletions(-)
Quoted 1 line

I had put these in for customer specific boards...

Why wouldn't they use the p2041/p4080/p5020 symbol? The point is we support both at runtime.

Quoted 3 lines

I understand we might have bit rot, but I guess I'd rather we added:

P2040RDB, P4040DS, and P5010DS to boards.cfg to test these SoC builds than remove the code.

I disagree. That adds extra builds to test and maintain for no real gain.

-Scott

#8 lore raw

PATCH 1/3 powerpc/fsl-corenet: remove dead variant symbols

Quoted 22 lines · Scott Wood
Quoted 19 lines · Kumar Gala
Quoted 7 lines · Scott Wood

These are not supported as individual build targets, but instead are supported by another target.

The dead p4040 defines in particular had bitrotted significantly.

---

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/Makefile         |    3 --
arch/powerpc/include/asm/config_mpc85xx.h |   68 ++---------------------------
arch/powerpc/include/asm/immap_85xx.h     |    2 +-
drivers/net/fm/Makefile                   |    1 -
include/configs/P2041RDB.h                |    2 +-
include/configs/P4080DS.h                 |    1 +
include/configs/P5020DS.h                 |    2 +-
7 files changed, 7 insertions(+), 72 deletions(-)
Quoted 1 line

I had put these in for customer specific boards...

Quoted 8 lines

Why wouldn't they use the p2041/p4080/p5020 symbol? The point is we support both at runtime.

Quoted 3 lines

I understand we might have bit rot, but I guess I'd rather we added:

P2040RDB, P4040DS, and P5010DS to boards.cfg to test these SoC builds than remove the code.

I disagree. That adds extra builds to test and maintain for no real gain.

It was an attempt to try and reduce some confusion for customers if they happen to utilize a P4040/P2040/P5010.

We have the same issue with P1/P2 SoCs and single core vs dual core devices.

- k

author
#9 lore raw

PATCH 1/3 powerpc/fsl-corenet: remove dead variant symbols

Quoted 28 lines · Kumar Gala
Quoted 25 lines · Scott Wood
Quoted 19 lines · Kumar Gala
Quoted 7 lines · Scott Wood

These are not supported as individual build targets, but instead are supported by another target.

The dead p4040 defines in particular had bitrotted significantly.

---

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/Makefile         |    3 --
arch/powerpc/include/asm/config_mpc85xx.h |   68 ++---------------------------
arch/powerpc/include/asm/immap_85xx.h     |    2 +-
drivers/net/fm/Makefile                   |    1 -
include/configs/P2041RDB.h                |    2 +-
include/configs/P4080DS.h                 |    1 +
include/configs/P5020DS.h                 |    2 +-
7 files changed, 7 insertions(+), 72 deletions(-)
Quoted 1 line

I had put these in for customer specific boards...

Why wouldn't they use the p2041/p4080/p5020 symbol? The point is we support both at runtime.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I understand we might have bit rot, but I guess I'd rather we added:

P2040RDB, P4040DS, and P5010DS to boards.cfg to test these SoC builds than remove the code.

I disagree. That adds extra builds to test and maintain for no real gain.

It was an attempt to try and reduce some confusion for customers if they happen to utilize a P4040/P2040/P5010.

Well, I did add comments saying "this also supports <foo>". I think documentation is the way to deal with this, or maybe a target name alias mechanism if we're really having problems with customers unable to figure this out.

If we do add separate builds I predict they will receive approximately zero test coverage beyond the occasional (now slightly slower) MAKEALL.

Quoted 1 line

We have the same issue with P1/P2 SoCs and single core vs dual core devices.

I'd be happy to see those extra builds go away too.

-Scott

#10 lore raw

PATCH 1/3 powerpc/fsl-corenet: remove dead variant symbols

Quoted 42 lines · Scott Wood
Quoted 28 lines · Kumar Gala
Quoted 25 lines · Scott Wood
Quoted 19 lines · Kumar Gala
Quoted 7 lines · Scott Wood

These are not supported as individual build targets, but instead are supported by another target.

The dead p4040 defines in particular had bitrotted significantly.

---

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/Makefile         |    3 --
arch/powerpc/include/asm/config_mpc85xx.h |   68 ++---------------------------
arch/powerpc/include/asm/immap_85xx.h     |    2 +-
drivers/net/fm/Makefile                   |    1 -
include/configs/P2041RDB.h                |    2 +-
include/configs/P4080DS.h                 |    1 +
include/configs/P5020DS.h                 |    2 +-
7 files changed, 7 insertions(+), 72 deletions(-)
Quoted 1 line

I had put these in for customer specific boards...

Why wouldn't they use the p2041/p4080/p5020 symbol? The point is we support both at runtime.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I understand we might have bit rot, but I guess I'd rather we added:

P2040RDB, P4040DS, and P5010DS to boards.cfg to test these SoC builds than remove the code.

I disagree. That adds extra builds to test and maintain for no real gain.

It was an attempt to try and reduce some confusion for customers if they happen to utilize a P4040/P2040/P5010.

Well, I did add comments saying "this also supports <foo>". I think documentation is the way to deal with this, or maybe a target name alias mechanism if we're really having problems with customers unable to figure this out.

Quoted 8 lines

If we do add separate builds I predict they will receive approximately zero test coverage beyond the occasional (now slightly slower) MAKEALL.

Quoted 1 line

We have the same issue with P1/P2 SoCs and single core vs dual core devices.

I'd be happy to see those extra builds go away too.

-Scott

Ok, I'll bite.

- k