All of lore.kernel.org
 help / color / mirror / Atom feed
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org
Subject: [PATCH 5/5] Fix PHYS_OFFSET for 64-bits kernels with 32-bits symbols
Date: Mon,  4 Jun 2007 17:46:35 +0200	[thread overview]
Message-ID: <11809719962417-git-send-email-fbuihuu@gmail.com> (raw)
In-Reply-To: <1180971995757-git-send-email-fbuihuu@gmail.com>

From: Franck Bui-Huu <fbuihuu@gmail.com>

The current implementation of __pa() for 64-bits kernels with 32-bits
symbols is broken. In this configuration, we need 2 values for
PAGE_OFFSET, one in XKPHYS and the other in CKSEG0 space.

When the value in CKSEG0 space is used, it doesn't take into account
of PHYS_OFFSET. Even worse we can't redefine this value.

The patch restores CPHYSADDR() but in __pa()'s implementation because
it removes the need of 2 PAGE_OFFSET.

OTOH, CPHYSADDR() is quite bad when dealing with mapped kernels. So
this patch assumes there's no need to deal with such kernel in 64-bits
world.

Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
 include/asm-mips/page.h |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 09c60d5..b92dd8c 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -143,11 +143,15 @@ typedef struct { unsigned long pgprot; } pgprot_t;
  * __pa()/__va() should be used only during mem init.
  */
 #if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
-#define __pa_page_offset(x)	((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
+#define __pa(x)								\
+({									\
+    unsigned long __x = (unsigned long)(x);				\
+    __x < CKSEG0 ? XPHYSADDR(__x) : CPHYSADDR(__x);			\
+})
 #else
-#define __pa_page_offset(x)	PAGE_OFFSET
+#define __pa(x)								\
+    ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
 #endif
-#define __pa(x)		((unsigned long)(x) - __pa_page_offset(x) + PHYS_OFFSET)
 #define __va(x)		((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
 #define __pa_symbol(x)	__pa(RELOC_HIDE((unsigned long)(x),0))
 
-- 
1.5.1.4

  parent reply	other threads:[~2007-06-04 15:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-04 15:46 [PATCH 0/5] PHYS_OFFSET fix and cleanup [take #2] Franck Bui-Huu
2007-06-04 15:46 ` [PATCH 1/5] Allow generic spaces.h to be included by platform specific ones Franck Bui-Huu
2007-06-07  7:32   ` Ralf Baechle
2007-06-04 15:46 ` [PATCH 2/5] Clean up asm-mips/mach-generic/spaces.h Franck Bui-Huu
2007-06-07  7:32   ` Ralf Baechle
2007-06-04 15:46 ` [PATCH 3/5] Make PAGE_OFFSET aware of PHYS_OFFSET Franck Bui-Huu
2007-06-07  7:32   ` Ralf Baechle
2007-06-04 15:46 ` [PATCH 4/5] Move PHY_OFFSET definition in spaces.h Franck Bui-Huu
2007-06-07  7:32   ` Ralf Baechle
2007-06-04 15:46 ` Franck Bui-Huu [this message]
2007-06-07  7:32   ` [PATCH 5/5] Fix PHYS_OFFSET for 64-bits kernels with 32-bits symbols Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11809719962417-git-send-email-fbuihuu@gmail.com \
    --to=vagabon.xyz@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.