Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1235505 > unrolled thread

Re: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h

Started byNicolas Pitre <nicolas.pitre@linaro.org>
First post2015-09-29 21:30 +0200
Last post2015-09-29 21:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to  asm/generic/memory_model.h Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-09-29 21:30 +0200
    Re: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h Tyler Baker <tyler.baker@linaro.org> - 2015-09-29 21:40 +0200
      Re: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to  asm/generic/memory_model.h Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-09-29 21:50 +0200

#1235505 — Re: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h

FromNicolas Pitre <nicolas.pitre@linaro.org>
Date2015-09-29 21:30 +0200
SubjectRe: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h
Message-ID<qe8L7-7kd-17@gated-at.bofh.it>
On Tue, 25 Aug 2015, Dan Williams wrote:

> From: Christoph Hellwig <hch@lst.de>
> 
> Three architectures already define these, and we'll need them genericly
> soon.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  arch/arm/include/asm/memory.h       |    6 ------
>  arch/arm64/include/asm/memory.h     |    6 ------
>  arch/unicore32/include/asm/memory.h |    6 ------
>  include/asm-generic/memory_model.h  |    6 ++++++
>  4 files changed, 6 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
> index b7f6fb462ea0..98d58bb04ac5 100644
> --- a/arch/arm/include/asm/memory.h
> +++ b/arch/arm/include/asm/memory.h
> @@ -119,12 +119,6 @@
>  #endif
>  
>  /*
> - * Convert a physical address to a Page Frame Number and back
> - */
> -#define	__phys_to_pfn(paddr)	((unsigned long)((paddr) >> PAGE_SHIFT))
> -#define	__pfn_to_phys(pfn)	((phys_addr_t)(pfn) << PAGE_SHIFT)
> -
> -/*
>   * Convert a page to/from a physical address
>   */
>  #define page_to_phys(page)	(__pfn_to_phys(page_to_pfn(page)))

[...]

> diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
> index 14909b0b9cae..f20f407ce45d 100644
> --- a/include/asm-generic/memory_model.h
> +++ b/include/asm-generic/memory_model.h
> @@ -69,6 +69,12 @@
>  })
>  #endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
>  
> +/*
> + * Convert a physical address to a Page Frame Number and back
> + */
> +#define	__phys_to_pfn(paddr)	((unsigned long)((paddr) >> PAGE_SHIFT))
> +#define	__pfn_to_phys(pfn)	((pfn) << PAGE_SHIFT)
> +

This patch, currently in mainline as commit 012dcef3f0, breaks LPAE on 
ARM32 with more than 4GB of RAM. The phys_addr_t cast in the original 
ARM definition is important when LPAE is enabled as phys_addr_t is 64 
bits while longs are 32 bits.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1235508 — Re: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h

FromTyler Baker <tyler.baker@linaro.org>
Date2015-09-29 21:40 +0200
SubjectRe: [PATCH v2 2/9] mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h
Message-ID<qe8UO-7vh-27@gated-at.bofh.it>
In reply to#1235505
On 29 September 2015 at 12:21, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
> On Tue, 25 Aug 2015, Dan Williams wrote:
>
>> From: Christoph Hellwig <hch@lst.de>
>>
>> Three architectures already define these, and we'll need them genericly
>> soon.
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>>  arch/arm/include/asm/memory.h       |    6 ------
>>  arch/arm64/include/asm/memory.h     |    6 ------
>>  arch/unicore32/include/asm/memory.h |    6 ------
>>  include/asm-generic/memory_model.h  |    6 ++++++
>>  4 files changed, 6 insertions(+), 18 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
>> index b7f6fb462ea0..98d58bb04ac5 100644
>> --- a/arch/arm/include/asm/memory.h
>> +++ b/arch/arm/include/asm/memory.h
>> @@ -119,12 +119,6 @@
>>  #endif
>>
>>  /*
>> - * Convert a physical address to a Page Frame Number and back
>> - */
>> -#define      __phys_to_pfn(paddr)    ((unsigned long)((paddr) >> PAGE_SHIFT))
>> -#define      __pfn_to_phys(pfn)      ((phys_addr_t)(pfn) << PAGE_SHIFT)
>> -
>> -/*
>>   * Convert a page to/from a physical address
>>   */
>>  #define page_to_phys(page)   (__pfn_to_phys(page_to_pfn(page)))
>
> [...]
>
>> diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
>> index 14909b0b9cae..f20f407ce45d 100644
>> --- a/include/asm-generic/memory_model.h
>> +++ b/include/asm-generic/memory_model.h
>> @@ -69,6 +69,12 @@
>>  })
>>  #endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
>>
>> +/*
>> + * Convert a physical address to a Page Frame Number and back
>> + */
>> +#define      __phys_to_pfn(paddr)    ((unsigned long)((paddr) >> PAGE_SHIFT))
>> +#define      __pfn_to_phys(pfn)      ((pfn) << PAGE_SHIFT)
>> +
>
> This patch, currently in mainline as commit 012dcef3f0, breaks LPAE on
> ARM32 with more than 4GB of RAM. The phys_addr_t cast in the original
> ARM definition is important when LPAE is enabled as phys_addr_t is 64
> bits while longs are 32 bits.

Dan sent my fix above to Linus already, which is in mainline as commit
ae4f97696889.

Cheers,

Tyler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235513

FromNicolas Pitre <nicolas.pitre@linaro.org>
Date2015-09-29 21:50 +0200
Message-ID<qe94u-7GE-25@gated-at.bofh.it>
In reply to#1235508
On Tue, 29 Sep 2015, Tyler Baker wrote:

> On 29 September 2015 at 12:21, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
> > On Tue, 25 Aug 2015, Dan Williams wrote:
> >
> >> From: Christoph Hellwig <hch@lst.de>
> >>
> >> Three architectures already define these, and we'll need them genericly
> >> soon.
> >>
> >> Signed-off-by: Christoph Hellwig <hch@lst.de>
> >> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> >> ---
> >>  arch/arm/include/asm/memory.h       |    6 ------
> >>  arch/arm64/include/asm/memory.h     |    6 ------
> >>  arch/unicore32/include/asm/memory.h |    6 ------
> >>  include/asm-generic/memory_model.h  |    6 ++++++
> >>  4 files changed, 6 insertions(+), 18 deletions(-)
> >>
> >> diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
> >> index b7f6fb462ea0..98d58bb04ac5 100644
> >> --- a/arch/arm/include/asm/memory.h
> >> +++ b/arch/arm/include/asm/memory.h
> >> @@ -119,12 +119,6 @@
> >>  #endif
> >>
> >>  /*
> >> - * Convert a physical address to a Page Frame Number and back
> >> - */
> >> -#define      __phys_to_pfn(paddr)    ((unsigned long)((paddr) >> PAGE_SHIFT))
> >> -#define      __pfn_to_phys(pfn)      ((phys_addr_t)(pfn) << PAGE_SHIFT)
> >> -
> >> -/*
> >>   * Convert a page to/from a physical address
> >>   */
> >>  #define page_to_phys(page)   (__pfn_to_phys(page_to_pfn(page)))
> >
> > [...]
> >
> >> diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
> >> index 14909b0b9cae..f20f407ce45d 100644
> >> --- a/include/asm-generic/memory_model.h
> >> +++ b/include/asm-generic/memory_model.h
> >> @@ -69,6 +69,12 @@
> >>  })
> >>  #endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
> >>
> >> +/*
> >> + * Convert a physical address to a Page Frame Number and back
> >> + */
> >> +#define      __phys_to_pfn(paddr)    ((unsigned long)((paddr) >> PAGE_SHIFT))
> >> +#define      __pfn_to_phys(pfn)      ((pfn) << PAGE_SHIFT)
> >> +
> >
> > This patch, currently in mainline as commit 012dcef3f0, breaks LPAE on
> > ARM32 with more than 4GB of RAM. The phys_addr_t cast in the original
> > ARM definition is important when LPAE is enabled as phys_addr_t is 64
> > bits while longs are 32 bits.
> 
> Dan sent my fix above to Linus already, which is in mainline as commit
> ae4f97696889.

Excellent.  Somehow I was looking at v4.3-rc1 and not the latest.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web