All of lore.kernel.org
 help / color / mirror / Atom feed
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/6] ARM: mm: LPAE: use phys_addr_t appropriately in p2v and v2p conversions
Date: Wed, 31 Jul 2013 12:44:41 -0400	[thread overview]
Message-ID: <1375289086-5315-2-git-send-email-santosh.shilimkar@ti.com> (raw)
In-Reply-To: <1375289086-5315-1-git-send-email-santosh.shilimkar@ti.com>

Fix remainder types used when converting back and forth between
physical and virtual addresses.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Russell King <linux@arm.linux.org.uk>

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 arch/arm/include/asm/memory.h |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index e750a93..c133bd9 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -185,22 +185,32 @@ extern unsigned long __pv_phys_offset;
 	: "=r" (to)					\
 	: "r" (from), "I" (type))
 
-static inline unsigned long __virt_to_phys(unsigned long x)
+static inline phys_addr_t __virt_to_phys(unsigned long x)
 {
 	unsigned long t;
 	__pv_stub(x, t, "add", __PV_BITS_31_24);
 	return t;
 }
 
-static inline unsigned long __phys_to_virt(unsigned long x)
+static inline unsigned long __phys_to_virt(phys_addr_t x)
 {
 	unsigned long t;
 	__pv_stub(x, t, "sub", __PV_BITS_31_24);
 	return t;
 }
+
 #else
-#define __virt_to_phys(x)	((x) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)
+
+static inline phys_addr_t __virt_to_phys(unsigned long x)
+{
+	return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET;
+}
+
+static inline unsigned long __phys_to_virt(phys_addr_t x)
+{
+	return x - PHYS_OFFSET + PAGE_OFFSET;
+}
+
 #endif
 #endif
 #endif /* __ASSEMBLY__ */
@@ -238,14 +248,14 @@ static inline phys_addr_t virt_to_phys(const volatile void *x)
 
 static inline void *phys_to_virt(phys_addr_t x)
 {
-	return (void *)(__phys_to_virt((unsigned long)(x)));
+	return (void *)__phys_to_virt(x);
 }
 
 /*
  * Drivers should NOT use these either.
  */
 #define __pa(x)			__virt_to_phys((unsigned long)(x))
-#define __va(x)			((void *)__phys_to_virt((unsigned long)(x)))
+#define __va(x)			((void *)__phys_to_virt((phys_addr_t)(x)))
 #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
 
 /*
-- 
1.7.9.5

  reply	other threads:[~2013-07-31 16:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 16:44 [PATCH v2 0/6] ARM: mm: Extend the runtime patch stub for PAE systems Santosh Shilimkar
2013-07-31 16:44 ` Santosh Shilimkar [this message]
2013-07-31 16:44 ` [PATCH v2 2/6] ARM: mm: Introduce virt_to_idmap() with an arch hook Santosh Shilimkar
2013-08-03  1:53   ` Nicolas Pitre
2013-08-03 19:03     ` Santosh Shilimkar
2013-07-31 16:44 ` [PATCH v2 3/6] ARM: mm: Move the idmap print to appropriate place in the code Santosh Shilimkar
2013-08-03  1:55   ` Nicolas Pitre
2013-07-31 16:44 ` [PATCH v2 4/6] ARM: mm: LPAE: Correct virt_to_phys patching for 64 bit physical addresses Santosh Shilimkar
2013-07-31 18:31   ` Sricharan R
2013-08-03  3:32     ` Nicolas Pitre
2013-08-03  3:28   ` Nicolas Pitre
2013-08-03 12:47     ` Sricharan R
2013-08-03 14:01       ` Nicolas Pitre
2013-08-03 19:25         ` Santosh Shilimkar
2013-08-04  5:32           ` Nicolas Pitre
2013-08-05 14:38             ` Santosh Shilimkar
2013-08-03 14:05       ` Russell King - ARM Linux
2013-08-03 14:09         ` Russell King - ARM Linux
2013-08-03 19:15           ` Santosh Shilimkar
2013-08-09 19:37             ` Santosh Shilimkar
2013-07-31 16:44 ` [PATCH v2 5/6] ARM: mm: Update runtime patching code to THUMB2 mode Santosh Shilimkar
2013-08-03  3:40   ` Nicolas Pitre
2013-08-03 12:51     ` Sricharan R
2013-07-31 16:44 ` [PATCH v2 6/6] ARM: mm: Recreate kernel mappings in early_paging_init() Santosh Shilimkar
2013-08-03  1:52 ` [PATCH v2 0/6] ARM: mm: Extend the runtime patch stub for PAE systems Nicolas Pitre
2013-08-03 19:02   ` Santosh Shilimkar

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=1375289086-5315-2-git-send-email-santosh.shilimkar@ti.com \
    --to=santosh.shilimkar@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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.