Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: mbizon@freebox.fr, linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH] Always use virt_to_phys() when translating kernel addresses
Date: Mon, 19 Mar 2007 10:41:46 +0100	[thread overview]
Message-ID: <45FE5ADA.3030309@innova-card.com> (raw)

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

This patch fixes two places where we used plain 'x - PAGE_OFFSET' to
achieve virtual to physical address convertion. This type of convertion
is no more allowed since commit 6f284a2ce7b8bc49cb8455b1763357897a899abb.

Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---

 Ralf,

 Could you apply this patch. Unfortunately I failed to report back these
 changes when submitting the original patch, and without it, platforms
 which are using (or trying to use) PHYS_OFFSET will break.

 Thanks,
		Franck

 include/asm-mips/pgtable-64.h |    2 +-
 include/asm-mips/pgtable.h    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index a5b1871..49f5a1a 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -199,7 +199,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
 {
 	return pud_val(pud);
 }
-#define pud_phys(pud)		(pud_val(pud) - PAGE_OFFSET)
+#define pud_phys(pud)		virt_to_phys((void *)pud_val(pud))
 #define pud_page(pud)		(pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
 
 /* Find an entry in the second-level page table.. */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 3fcfd79..0d3295f 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -75,7 +75,7 @@ extern void paging_init(void);
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
  */
-#define pmd_phys(pmd)		(pmd_val(pmd) - PAGE_OFFSET)
+#define pmd_phys(pmd)		virt_to_phys((void *)pmd_val(pmd))
 #define pmd_page(pmd)		(pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
 #define pmd_page_vaddr(pmd)	pmd_val(pmd)
 
-- 
1.4.4.3.ge6d4

             reply	other threads:[~2007-03-19  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19  9:41 Franck Bui-Huu [this message]
2007-03-19 16:02 ` [PATCH] Always use virt_to_phys() when translating kernel addresses Maxime Bizon
2007-03-19 16:16   ` Franck Bui-Huu
2007-03-19 16:36     ` [PATCH] Always use virt_to_phys() when translating kernel addresses [take #2] Franck Bui-Huu
2007-03-19 22:28       ` 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=45FE5ADA.3030309@innova-card.com \
    --to=vagabon.xyz@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=mbizon@freebox.fr \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox