Skip to contentSkip to conversation

ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

PATCH In review Stefan Roese 4 participants 6 messages Jan 19, 2007 – Jan 29, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

[PATCH] ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

On systems that supply a real 64bit address (with CONFIG_RESOURCES_64BIT enabled), don't use the fixup function. This allows us to use the fixup function when no ERPN is specified and use the 64 bit address when the ERPN is supplied.

---
commit d615194752d1729211296a3afbf5adb94f2b8444
tree 11f5db07bce1cb3adc4d4be8b4d5b09076221656
parent c32ef45a856a08df6942c5efa1e8abc6e4b9ee0e
author Stefan Roese <[email protected]> Fri, 19 Jan 2007 09:02:28 +0100 committer Stefan Roese <[email protected]> Fri, 19 Jan 2007 09:02:28 +0100

 arch/ppc/mm/pgtable.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
arch/ppc/mm/pgtable.c +13 -3
index 354a940..1ef63da 100644
@@ -156,9 +156,19 @@ ioremap64(unsigned long long addr, unsigned long size)
 void __iomem *
 ioremap(phys_addr_t addr, unsigned long size)
 {
-	phys_addr_t addr64 = fixup_bigphys_addr(addr, size);
-
-	return ioremap64(addr64, size);
+	/*
+	 * On systems that supply a real 64bit address
+	 * (with CONFIG_RESOURCES_64BIT enabled), don't use the
+	 * fixup function.
+	 * This allows us to use the fixup function when no ERPN
+	 * is specified and use the 64 bit address when the ERPN
+	 * is suppied.
+	 */
+	if ((unsigned long long)addr && 0xffffffff00000000ULL)
+		return ioremap64(addr, size);
+	else
+		return ioremap64(fixup_bigphys_addr(addr, size),
+				 size);
 }
 #endif /* CONFIG_PHYS_64BIT */
 
#1 lore raw
Quoted 6 lines · Stefan Roese

[PATCH] ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

On systems that supply a real 64bit address (with CONFIG_RESOURCES_64BIT enabled), don't use the fixup function. This allows us to use the fixup function when no ERPN is specified and use the 64 bit address when the ERPN is supplied.

Good idea.

Quoted 6 lines

void __iomem *
ioremap(phys_addr_t addr, unsigned long size)
{

arch/ppc/mm/pgtable.c +0 -3
-	phys_addr_t addr64 = fixup_bigphys_addr(addr, size);
-
-	return ioremap64(addr64, size);

arch/ppc/mm/pgtable.c ioremap64(unsigned long long addr, unsigned long size) · line 168

Quoted 10 lines
arch/ppc/mm/pgtable.c +10 -0
+	/*
+	 * On systems that supply a real 64bit address
+	 * (with CONFIG_RESOURCES_64BIT enabled), don't use the
+	 * fixup function.
+	 * This allows us to use the fixup function when no ERPN
+	 * is specified and use the 64 bit address when the ERPN
+	 * is suppied.
+	 */
+	if ((unsigned long long)addr && 0xffffffff00000000ULL)
+		return ioremap64(addr, size);

Erm... don't you want:

addr & 0xffffffff00000000ULL

What you have now is a logical and that will likely result in it always being true...

josh

#2 lore raw

Hi Josh,

Quoted 29 lines · Josh Boyer
Quoted 6 lines · Stefan Roese

[PATCH] ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

On systems that supply a real 64bit address (with CONFIG_RESOURCES_64BIT enabled), don't use the fixup function. This allows us to use the fixup function when no ERPN is specified and use the 64 bit address when the ERPN is supplied.

Good idea.

Quoted 6 lines

void __iomem *
ioremap(phys_addr_t addr, unsigned long size)
{

arch/ppc/mm/pgtable.c +0 -3
-	phys_addr_t addr64 = fixup_bigphys_addr(addr, size);
-
-	return ioremap64(addr64, size);

arch/ppc/mm/pgtable.c ioremap64(unsigned long long addr, unsigned long size) · line 168

Quoted 10 lines
arch/ppc/mm/pgtable.c +10 -0
+	/*
+	 * On systems that supply a real 64bit address
+	 * (with CONFIG_RESOURCES_64BIT enabled), don't use the
+	 * fixup function.
+	 * This allows us to use the fixup function when no ERPN
+	 * is specified and use the 64 bit address when the ERPN
+	 * is suppied.
+	 */
+	if ((unsigned long long)addr && 0xffffffff00000000ULL)
+		return ioremap64(addr, size);

Erm... don't you want:

Quoted 4 lines

addr & 0xffffffff00000000ULL

What you have now is a logical and that will likely result in it always being true...

Of course. Thanks for spotting it. I'll resend the patch tomorrow.

Best regards,
Stefan

#3 lore raw

PATCH 1/1 ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

In reply to Josh Boyer

[PATCH] ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

On systems that supply a real 64bit address (with CONFIG_RESOURCES_64BIT enabled), don't use the fixup function. This allows us to use the fixup function when no ERPN is specified and use the 64 bit address when the ERPN is supplied.

---
commit 1d49664db83cbf3a982846745eaaa4a1eb2e429f
tree 596eb295efef6c996f140778491111dfd90fc968
parent 5263bf65d6342e12ab716db8e529501670979321
author Stefan Roese <[email protected]> Mon, 29 Jan 2007 09:37:37 +0100 committer Stefan Roese <[email protected]> Mon, 29 Jan 2007 09:37:37 +0100

 arch/ppc/mm/pgtable.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
arch/ppc/mm/pgtable.c +13 -3
index 354a940..2f9a311 100644
@@ -156,9 +156,19 @@ ioremap64(unsigned long long addr, unsigned long size)
 void __iomem *
 ioremap(phys_addr_t addr, unsigned long size)
 {
-	phys_addr_t addr64 = fixup_bigphys_addr(addr, size);
-
-	return ioremap64(addr64, size);
+	/*
+	 * On systems that supply a real 64bit address
+	 * (with CONFIG_RESOURCES_64BIT enabled), don't use the
+	 * fixup function.
+	 * This allows us to use the fixup function when no ERPN
+	 * is specified and use the 64 bit address when the ERPN
+	 * is suppied.
+	 */
+	if ((unsigned long long)addr & 0xffffffff00000000ULL)
+		return ioremap64(addr, size);
+	else
+		return ioremap64(fixup_bigphys_addr(addr, size),
+				 size);
 }
 #endif /* CONFIG_PHYS_64BIT */
 
#4 lore raw

Hello.

Quoted 8 lines · Stefan Roese

[PATCH] ppc: ioremap() on PPC44x platforms now accepts 64bit addresses

On systems that supply a real 64bit address (with CONFIG_RESOURCES_64BIT enabled), don't use the fixup function. This allows us to use the fixup function when no ERPN is specified and use the 64 bit address when the ERPN is supplied.

[...]

Quoted 11 lines
arch/ppc/mm/pgtable.c +0 -3
index 354a940..2f9a311 100644
@@ -156,9 +156,19 @@ ioremap64(unsigned long long addr, unsigned long size)
 void __iomem *
 ioremap(phys_addr_t addr, unsigned long size)
 {
-	phys_addr_t addr64 = fixup_bigphys_addr(addr, size);
-
-	return ioremap64(addr64, size);

arch/ppc/mm/pgtable.c ioremap64(unsigned long long addr, unsigned long size) · line 168

Quoted 10 lines
arch/ppc/mm/pgtable.c +10 -0
+	/*
+	 * On systems that supply a real 64bit address
+	 * (with CONFIG_RESOURCES_64BIT enabled), don't use the
+	 * fixup function.
+	 * This allows us to use the fixup function when no ERPN
+	 * is specified and use the 64 bit address when the ERPN
+	 * is suppied.
+	 */
+	if ((unsigned long long)addr & 0xffffffff00000000ULL)
+		return ioremap64(addr, size);

I'm sorry but is this actually needed? From looking at the
arch/ppc/syslib/ibm44x_common.c and include/asm-ppc/ibm44x.h I got an impression that fixup_bigphys_addr() returns addresses >= 4GB intact anyway

arch/ppc/mm/pgtable.c ioremap64(unsigned long long addr, unsigned long size) · line 173

Quoted 5 lines
arch/ppc/mm/pgtable.c +3 -0
+	else
+		return ioremap64(fixup_bigphys_addr(addr, size),
+				 size);
 }
 #endif /* CONFIG_PHYS_64BIT */

WBR, Sergei

#5 lore raw

Hi Sergei,

Quoted 17 lines · Sergei Shtylyov
Quoted 17 lines
arch/ppc/mm/pgtable.c +0 -0
index 354a940..2f9a311 100644
@@ -156,9 +156,19 @@ ioremap64(unsigned long long addr, unsigned long

size) void __iomem *
ioremap(phys_addr_t addr, unsigned long size)
{

arch/ppc/mm/pgtable.c +6 -3
-	phys_addr_t addr64 = fixup_bigphys_addr(addr, size);
-
-	return ioremap64(addr64, size);
+	/*
+	 * On systems that supply a real 64bit address
+	 * (with CONFIG_RESOURCES_64BIT enabled), don't use the
+	 * fixup function.
+	 * This allows us to use the fixup function when no ERPN
+	 * is specified and use the 64 bit address when the ERPN
Quoted 8 lines

arch/ppc/mm/pgtable.c ioremap64(unsigned long long addr, unsigned long size) · line 168

Quoted 4 lines
arch/ppc/mm/pgtable.c +4 -0
+	 * is suppied.
+	 */
+	if ((unsigned long long)addr & 0xffffffff00000000ULL)
+		return ioremap64(addr, size);

I'm sorry but is this actually needed? From looking at the
arch/ppc/syslib/ibm44x_common.c and include/asm-ppc/ibm44x.h I got an impression that fixup_bigphys_addr() returns addresses >= 4GB intact anyway

Hmmm. It seems that you are correct here (again). I was in a hurry since I did this stuff right before going on vacation. So please forget about this patch once and for all.

Sorry about the noise.

Best regards,
Stefan