diff mbox

ARM: use phys_addr_t in pfn_to_kaddr()

Message ID 1435072386-13527-1-git-send-email-vitalya@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vitaly Andrianov June 23, 2015, 3:13 p.m. UTC
This patch fixes pfn_to_kaddr() to use phys_addr_t.  Without this,
this macro is broken on LPAE systems. For physical addresses above
first 4GB result of shifting pfn with PAGE_SHIFT may be truncated.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
---
 arch/arm/include/asm/memory.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Santosh Shilimkar June 24, 2015, 7:22 p.m. UTC | #1
On 6/23/2015 8:13 AM, Vitaly Andrianov wrote:
> This patch fixes pfn_to_kaddr() to use phys_addr_t.  Without this,
> this macro is broken on LPAE systems. For physical addresses above
> first 4GB result of shifting pfn with PAGE_SHIFT may be truncated.
>
> Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
> ---
Looks a valid fix.

RMK, Nico, what you say ?

>   arch/arm/include/asm/memory.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
> index 184def0..063ef31 100644
> --- a/arch/arm/include/asm/memory.h
> +++ b/arch/arm/include/asm/memory.h
> @@ -291,7 +291,7 @@ static inline void *phys_to_virt(phys_addr_t x)
>    */
>   #define __pa(x)			__virt_to_phys((unsigned long)(x))
>   #define __va(x)			((void *)__phys_to_virt((phys_addr_t)(x)))
> -#define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
> +#define pfn_to_kaddr(pfn)	__va((phys_addr_t)(pfn) << PAGE_SHIFT)
>
>   extern phys_addr_t (*arch_virt_to_idmap)(unsigned long x);
>
>
Nicolas Pitre June 25, 2015, 4:33 p.m. UTC | #2
On Wed, 24 Jun 2015, santosh shilimkar wrote:

> On 6/23/2015 8:13 AM, Vitaly Andrianov wrote:
> > This patch fixes pfn_to_kaddr() to use phys_addr_t.  Without this,
> > this macro is broken on LPAE systems. For physical addresses above
> > first 4GB result of shifting pfn with PAGE_SHIFT may be truncated.
> >
> > Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
> > ---
> Looks a valid fix.
> 
> RMK, Nico, what you say ?

Looks fine to me.

Acked-by: Nicolas Pitre <nico@linaro.org>


> 
> >   arch/arm/include/asm/memory.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
> > index 184def0..063ef31 100644
> > --- a/arch/arm/include/asm/memory.h
> > +++ b/arch/arm/include/asm/memory.h
> > @@ -291,7 +291,7 @@ static inline void *phys_to_virt(phys_addr_t x)
> >   */
> >   #define __pa(x)			__virt_to_phys((unsigned long)(x))
> >   #define __va(x)			((void
> >   *)__phys_to_virt((phys_addr_t)(x)))
> > -#define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
> > +#define pfn_to_kaddr(pfn)	__va((phys_addr_t)(pfn) << PAGE_SHIFT)
> >
> >   extern phys_addr_t (*arch_virt_to_idmap)(unsigned long x);
> >
> >
> 
>
Santosh Shilimkar June 25, 2015, 6:43 p.m. UTC | #3
On 6/25/2015 9:33 AM, Nicolas Pitre wrote:
> On Wed, 24 Jun 2015, santosh shilimkar wrote:
>
>> On 6/23/2015 8:13 AM, Vitaly Andrianov wrote:
>>> This patch fixes pfn_to_kaddr() to use phys_addr_t.  Without this,
>>> this macro is broken on LPAE systems. For physical addresses above
>>> first 4GB result of shifting pfn with PAGE_SHIFT may be truncated.
>>>
>>> Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
>>> ---
>> Looks a valid fix.
>>
>> RMK, Nico, what you say ?
>
> Looks fine to me.
>
> Acked-by: Nicolas Pitre <nico@linaro.org>
>
Thanks Nico.

Vitaly,
I suggest you to drop this patch into RMK's patch system with
mine and Nico's ack.

Regards,
Santosh
diff mbox

Patch

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 184def0..063ef31 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -291,7 +291,7 @@  static inline void *phys_to_virt(phys_addr_t x)
  */
 #define __pa(x)			__virt_to_phys((unsigned long)(x))
 #define __va(x)			((void *)__phys_to_virt((phys_addr_t)(x)))
-#define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
+#define pfn_to_kaddr(pfn)	__va((phys_addr_t)(pfn) << PAGE_SHIFT)
 
 extern phys_addr_t (*arch_virt_to_idmap)(unsigned long x);