Skip to contentSkip to conversation

e500v2 36 bit large physical HID0[EN_MAS7_UPDATE]

PATCH In review Micha Nelissen 5 participants 12 messages Jun 16, 2010 – Jun 22, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e500v2 36 bit large physical HID0[EN_MAS7_UPDATE]

Hi,

Attached is a patch to fix large physical address support for the e500v2 core. When >4GB addresses are used, the MAS7 register needs to be valid for tlbsx instruction usage.

Please review and apply.

Micha

arch/powerpc/include/asm/reg.h +1 -0
diff -u -ru linux-2.6.34/arch/powerpc/include/asm/reg.h linux-2.6.34-fix/arch/powerpc/include/asm/reg.h
@@ -272,6 +272,7 @@
 #define HID0_DAPUEN	(1<<8)		/* Debug APU enable */
 #define HID0_SGE	(1<<7)		/* Store Gathering Enable */
 #define HID0_SIED	(1<<7)		/* Serial Instr. Execution [Disable] */
+#define HID0_EN_MAS7_UPDATE (1<<7)      /* tlbre/tlbsx update MAS7 - e500v2 */
 #define HID0_DCFA	(1<<6)		/* Data Cache Flush Assist */
 #define HID0_LRSTK	(1<<4)		/* Link register stack - 745x */
 #define HID0_BTIC	(1<<5)		/* Branch Target Instr Cache Enable */
arch/powerpc/kernel/head_fsl_booke.S +7 -0
diff -u -ru linux-2.6.34/arch/powerpc/kernel/head_fsl_booke.S linux-2.6.34-fix/arch/powerpc/kernel/head_fsl_booke.S
@@ -328,6 +328,13 @@
 	oris	r2,r2,HID0_DOZE@h
 	mtspr	SPRN_HID0, r2
 #endif
+#ifdef CONFIG_PTE_64BIT
+BEGIN_MMU_FTR_SECTION
+	mfspr	r2,SPRN_HID0
+	ori	r2,r2,HID0_EN_MAS7_UPDATE@l
+	mtspr	SPRN_HID0, r2
+END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
+#endif
 
 #if !defined(CONFIG_BDI_SWITCH)
 	/*
#1 lore raw
Quoted 4 lines

-----Original Message-----
From:

linuxppc-dev-bounces+poonam.aggrwal=3Dfreescale.com@lists.ozlabs.org

Quoted 2 lines

[mailto:linuxppc-dev- [email protected]] On Behalf Of

Micha

Quoted 8 lines

Nelissen
Sent: Wednesday, June 16, 2010 12:29 PM
To: [email protected]
Subject: [PATCH] e500v2 36 bit large physical HID0[EN_MAS7_UPDATE] =20
Hi,
=20
Attached is a patch to fix large physical address support for the

e500v2

Quoted 1 line

core. When >4GB addresses are used, the MAS7 register needs to be

valid

Quoted 3 lines

for tlbsx instruction usage.
=20
Please review and apply.

[Aggrwal Poonam] This is already being done by u-boot, should linux set it again?

Quoted 2 lines

=20
Micha

#2 lore raw
Quoted 3 lines · Aggrwal Poonam-B10812 wrote:
Quoted 1 line

Attached is a patch to fix large physical address support for the

This is already being done by u-boot, should linux set it again?

Yikes! Took me 5 min to reformat your email.

Our version of U-boot does not but it's not latest greatest.

IMHO:
1) Linux should not be dependent on U-boot or any other bootloader, or at least as possible
2) U-boot cannot (and does not want to) know whether Linux is going to use large physical addresses.

Regards,

Micha

#3 lore raw
Quoted 11 lines

-----Original Message-----
From: Micha Nelissen [mailto:[email protected]]
Sent: Wednesday, June 16, 2010 2:55 PM
To: Aggrwal Poonam-B10812; [email protected]
Subject: Re: [PATCH] e500v2 36 bit large physical HID0[EN_MAS7_UPDATE] =20

Quoted 2 lines · Aggrwal Poonam-B10812 wrote:
Quoted 1 line

Attached is a patch to fix large physical address support for the

Quoted 8 lines
Quoted 1 line

This is already being done by u-boot, should linux set it again?

=20
Yikes! Took me 5 min to reformat your email.
=20
Our version of U-boot does not but it's not latest greatest. =20
IMHO:
1) Linux should not be dependent on U-boot or any other bootloader, or

at

Quoted 4 lines

least as possible
2) U-boot cannot (and does not want to) know whether Linux is going to use large physical addresses.
=20

Not sure of other platforms but on 85xx platforms on which I am currently working u-boot does LAW and eLBC programming for 36bit physical address. Hence=20
possibly u-boot has to made aware of large physical address space. Please correct me if I am wrong.

Quoted 3 lines

Regards,
=20
Micha

#4 lore raw
Quoted 4 lines · Aggrwal Poonam-B10812 wrote:

Not sure of other platforms but on 85xx platforms on which I am
currently working u-boot does LAW and eLBC programming for 36bit
physical address. Hence possibly u-boot has to made aware of large physical address space. Please correct me if I am wrong.

Yes, I can understand this for SDRAM and local flash interface. For RapidIO we have (local) patches to pass the law address range in the dtb. Perhaps also for PCI-express this might be done; U-boot has nothing to with these high speed interfaces (in our case at least).

Micha

#5 lore raw
Quoted 10 lines

-----Original Message-----
From: Micha Nelissen [mailto:[email protected]]
Sent: Wednesday, June 16, 2010 5:04 PM
To: Aggrwal Poonam-B10812
Cc: [email protected]
Subject: Re: [PATCH] e500v2 36 bit large physical HID0[EN_MAS7_UPDATE] =20
Aggrwal Poonam-B10812 wrote:

Quoted 8 lines
Quoted 5 lines

Not sure of other platforms but on 85xx platforms on which I am currently working u-boot does LAW and eLBC programming for 36bit physical address. Hence possibly u-boot has to made aware of large physical address space.
Please correct me if I am wrong.

=20
Yes, I can understand this for SDRAM and local flash interface. For RapidIO we have (local) patches to pass the law address range in the

dtb.

Quoted 2 lines

Perhaps also for PCI-express this might be done; U-boot has nothing to with these high speed interfaces (in our case at least).

You are correct , for PCIe and SRIO kinds of interfaces Linux reprograms the address windows.
Thanks
Poonam

Quoted 2 lines

=20
Micha

#6 lore raw
In reply to Micha Nelissen
Quoted 5 lines · Micha Nelissen

IMHO:
1) Linux should not be dependent on U-boot or any other bootloader, or at least as possible
2) U-boot cannot (and does not want to) know whether Linux is going to use large physical addresses.

To quote The Dude: "Yeah, well, you know, that's just, like, your opinion, man."

I'm sorry, but Linux does depend on the boot loader, and U-Boot does need to know whether Linux is going to use 36-bit addressing. That's just the way it works. Linux patches that repeat what U-Boot already does just so that you don't need to update your U-boot are going to be rejected.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#7 lore raw
Quoted 2 lines · Timur Tabi

I'm sorry, but Linux does depend on the boot loader, and U-Boot does need to know whether Linux is going to use 36-bit addressing.

Why?

Quoted 2 lines

That's
just the way it works.

What a great design philosophy!

Quoted 3 lines

Linux patches that repeat what U-Boot already
does just so that you don't need to update your U-boot are going to be rejected.

Who said anything about not wanting/needing to upgrade U-boot?

Micha

#9 lore raw
In reply to Micha Nelissen
Quoted 3 lines · Micha Nelissen

Hi,
=20
Attached is a patch to fix large physical address support for the =

e500v2 core. When >4GB addresses are used, the MAS7 register needs to be = valid for tlbsx instruction usage.

Quoted 5 lines

=20
Please review and apply.
=20
Micha
diff -u -ru linux-2.6.34/arch/powerpc/include/asm/reg.h =

linux-2.6.34-fix/arch/powerpc/include/asm/reg.h

Quoted 1 line

--- linux-2.6.34/arch/powerpc/include/asm/reg.h 2010-05-16 =

23:17:36.000000000 +0200

Quoted 1 line

+++ linux-2.6.34-fix/arch/powerpc/include/asm/reg.h 2010-06-16 =

08:43:28.000000000 +0200

arch/powerpc/include/asm/reg.h line 274

Quoted 4 lines
arch/powerpc/include/asm/reg.h +0 -0
@@ -272,6 +272,7 @@
 #define HID0_DAPUEN	(1<<8)		/* Debug APU enable */
 #define HID0_SGE	(1<<7)		/* Store Gathering Enable */
 #define HID0_SIED	(1<<7)		/* Serial Instr. Execution =

[Disable] */

Review line 275

Quoted 1 line
(quoted diff) +1 -0
+#define HID0_EN_MAS7_UPDATE (1<<7)      /* tlbre/tlbsx update MAS7 - =

e500v2 */

arch/powerpc/include/asm/reg.h

Quoted 3 lines
arch/powerpc/include/asm/reg.h +0 -0
 #define HID0_DCFA	(1<<6)		/* Data Cache Flush Assist */
 #define HID0_LRSTK	(1<<4)		/* Link register stack - 745x */
 #define HID0_BTIC	(1<<5)		/* Branch Target Instr Cache =

Enable */

Quoted 1 line

diff -u -ru linux-2.6.34/arch/powerpc/kernel/head_fsl_booke.S =

linux-2.6.34-fix/arch/powerpc/kernel/head_fsl_booke.S

Quoted 1 line

--- linux-2.6.34/arch/powerpc/kernel/head_fsl_booke.S 2010-05-16 =

23:17:36.000000000 +0200

Quoted 1 line

+++ linux-2.6.34-fix/arch/powerpc/kernel/head_fsl_booke.S =

2010-06-16 08:45:10.000000000 +0200

arch/powerpc/kernel/head_fsl_booke.S line 337

Quoted 11 lines
arch/powerpc/kernel/head_fsl_booke.S +7 -0
@@ -328,6 +328,13 @@
 	oris	r2,r2,HID0_DOZE@h
 	mtspr	SPRN_HID0, r2
 #endif
+#ifdef CONFIG_PTE_64BIT
+BEGIN_MMU_FTR_SECTION
+	mfspr	r2,SPRN_HID0
+	ori	r2,r2,HID0_EN_MAS7_UPDATE@l
+	mtspr	SPRN_HID0, r2
+END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
+#endif

If you want to do this, do it in:

arch/powerpc/kernel/cpu_setup_fsl_booke.S

- k=

#10 lore raw
Quoted 10 lines · Kumar Gala

Review

Quoted 6 lines
(quoted diff) +6 -0
+BEGIN_MMU_FTR_SECTION
+	mfspr	r2,SPRN_HID0
+	ori	r2,r2,HID0_EN_MAS7_UPDATE@l
+	mtspr	SPRN_HID0, r2
+END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
+#endif

If you want to do this, do it in:

arch/powerpc/kernel/cpu_setup_fsl_booke.S

Do you mean like attached? I had to change the order of the '_GLOBAL' definitions __setup_cpu_e500v1/__setup_cpu_e500v2 since this bit is e500v2 only.

Thanks,

Micha

arch/powerpc/kernel/cpu_setup_fsl_booke.S +7 -1
Index: linux/arch/powerpc/kernel/cpu_setup_fsl_booke.S
===================================================================
@@ -57,8 +57,14 @@
 	ori	r3,r3,HID0_DAPUEN@l
 	mtspr	SPRN_HID0,r3
 	b	__setup_e200_ivors
+_GLOBAL(__setup_cpu_e500v2)
+#ifdef CONFIG_PTE_64BIT
+	/* enable mas7 register for tlbre/tlbsx */
+	mfspr	r2,SPRN_HID0
+	ori 	r2,r2,HID0_EN_MAS7_UPDATE@l
+	mtspr	SPRN_HID0,r2
+#endif
 _GLOBAL(__setup_cpu_e500v1)
-_GLOBAL(__setup_cpu_e500v2)
 	mflr	r4
 	bl	__e500_icache_setup
 	bl	__e500_dcache_setup
arch/powerpc/include/asm/reg.h +1 -0
Index: linux/arch/powerpc/include/asm/reg.h
===================================================================
@@ -276,6 +276,7 @@
 #define HID0_DAPUEN	(1<<8)		/* Debug APU enable */
 #define HID0_SGE	(1<<7)		/* Store Gathering Enable */
 #define HID0_SIED	(1<<7)		/* Serial Instr. Execution [Disable] */
+#define HID0_EN_MAS7_UPDATE (1<<7)	/* Enable MAS7 reg for tlbre/tlbsx */
 #define HID0_DCFA	(1<<6)		/* Data Cache Flush Assist */
 #define HID0_LRSTK	(1<<4)		/* Link register stack - 745x */
 #define HID0_BTIC	(1<<5)		/* Branch Target Instr Cache Enable */
#11 lore raw
Quoted 1 line · Micha Nelissen

Do you mean like attached? I had to change the order of the '_GLOBAL' definitions __setup_cpu_e500v1/__setup_cpu_e500v2 since this bit is e500v2 only.

Hmm, maybe need to use r0 or r3 instead of r2?

Micha

arch/powerpc/kernel/cpu_setup_fsl_booke.S +7 -1
Index: linux/arch/powerpc/kernel/cpu_setup_fsl_booke.S
===================================================================
@@ -57,8 +57,14 @@
 	ori	r3,r3,HID0_DAPUEN@l
 	mtspr	SPRN_HID0,r3
 	b	__setup_e200_ivors
+_GLOBAL(__setup_cpu_e500v2)
+#ifdef CONFIG_PTE_64BIT
+	/* enable mas7 register for tlbre/tlbsx */
+	mfspr	r0,SPRN_HID0
+	ori 	r0,r0,HID0_EN_MAS7_UPDATE@l
+	mtspr	SPRN_HID0,r0
+#endif
 _GLOBAL(__setup_cpu_e500v1)
-_GLOBAL(__setup_cpu_e500v2)
 	mflr	r4
 	bl	__e500_icache_setup
 	bl	__e500_dcache_setup
arch/powerpc/include/asm/reg.h +1 -0
Index: linux/arch/powerpc/include/asm/reg.h
===================================================================
@@ -276,6 +276,7 @@
 #define HID0_DAPUEN	(1<<8)		/* Debug APU enable */
 #define HID0_SGE	(1<<7)		/* Store Gathering Enable */
 #define HID0_SIED	(1<<7)		/* Serial Instr. Execution [Disable] */
+#define HID0_EN_MAS7_UPDATE (1<<7)	/* Enable MAS7 reg for tlbre/tlbsx */
 #define HID0_DCFA	(1<<6)		/* Data Cache Flush Assist */
 #define HID0_LRSTK	(1<<4)		/* Link register stack - 745x */
 #define HID0_BTIC	(1<<5)		/* Branch Target Instr Cache Enable */
#8 lore raw
In reply to Timur Tabi
Quoted 1 line · Timur Tabi

I'm sorry, but Linux does depend on the boot loader,

In some ways, but we try not to do so too gratuitously.

Quoted 2 lines

and U-Boot does need to know whether Linux is going to use 36-bit addressing.

U-Boot knows whether it puts things over 4GiB. If Linux is going to change the LAWs in what was previously a 32-bit physical system, it doesn't seem unreasonable for it to set EN_MAS7_UPDATE.

Quoted 3 lines

That's just the way it works. Linux patches that repeat what U-Boot already does just so that you don't need to update your U-boot are going to be rejected.

Why'd we do cuboot then? Or any other compatibility measure (e.g. working with old device trees) or board-specific non-OS-specific init thing which might be better off done in firmware (e.g. setting up I/O pins to match what's on the board)?

Firmware is harder to upgrade than a kernel, sometimes it's not worth it.

Especially if new firmware won't boot old OSes, which could be the case with EN_MAS7_UPDATE on a non-36-bit-aware OS (compatibility is the reason that bit exists).

-Scott