linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: use the correct pointer when setting a 2M pte
@ 2017-01-25 15:54 Reza Arbab
  2017-01-28 15:59 ` Aneesh Kumar K.V
  2017-01-30 11:34 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Reza Arbab @ 2017-01-25 15:54 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, Aneesh Kumar K.V, Balbir Singh

When setting a 2M pte, radix__map_kernel_page() is using the address

	ptep = (pte_t *)pudp;

Fix this conversion to use pmdp instead. Use pmdp_ptep() to do this
instead of casting the pointer.

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
 arch/powerpc/mm/pgtable-radix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index cfa53cc..34f1a0d 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -65,7 +65,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa,
 		if (!pmdp)
 			return -ENOMEM;
 		if (map_page_size == PMD_SIZE) {
-			ptep = (pte_t *)pudp;
+			ptep = pmdp_ptep(pmdp);
 			goto set_the_pte;
 		}
 		ptep = pte_alloc_kernel(pmdp, ea);
@@ -90,7 +90,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa,
 		}
 		pmdp = pmd_offset(pudp, ea);
 		if (map_page_size == PMD_SIZE) {
-			ptep = (pte_t *)pudp;
+			ptep = pmdp_ptep(pmdp);
 			goto set_the_pte;
 		}
 		if (!pmd_present(*pmdp)) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/mm: use the correct pointer when setting a 2M pte
  2017-01-25 15:54 [PATCH] powerpc/mm: use the correct pointer when setting a 2M pte Reza Arbab
@ 2017-01-28 15:59 ` Aneesh Kumar K.V
  2017-01-30 11:34 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2017-01-28 15:59 UTC (permalink / raw)
  To: Reza Arbab, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras
  Cc: linuxppc-dev, Balbir Singh

Reza Arbab <arbab@linux.vnet.ibm.com> writes:

> When setting a 2M pte, radix__map_kernel_page() is using the address
>
> 	ptep = (pte_t *)pudp;
>
> Fix this conversion to use pmdp instead. Use pmdp_ptep() to do this
> instead of casting the pointer.
>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
> ---
>  arch/powerpc/mm/pgtable-radix.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
> index cfa53cc..34f1a0d 100644
> --- a/arch/powerpc/mm/pgtable-radix.c
> +++ b/arch/powerpc/mm/pgtable-radix.c
> @@ -65,7 +65,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa,
>  		if (!pmdp)
>  			return -ENOMEM;
>  		if (map_page_size == PMD_SIZE) {
> -			ptep = (pte_t *)pudp;
> +			ptep = pmdp_ptep(pmdp);
>  			goto set_the_pte;
>  		}
>  		ptep = pte_alloc_kernel(pmdp, ea);
> @@ -90,7 +90,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa,
>  		}
>  		pmdp = pmd_offset(pudp, ea);
>  		if (map_page_size == PMD_SIZE) {
> -			ptep = (pte_t *)pudp;
> +			ptep = pmdp_ptep(pmdp);
>  			goto set_the_pte;
>  		}
>  		if (!pmd_present(*pmdp)) {
> -- 
> 1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: powerpc/mm: use the correct pointer when setting a 2M pte
  2017-01-25 15:54 [PATCH] powerpc/mm: use the correct pointer when setting a 2M pte Reza Arbab
  2017-01-28 15:59 ` Aneesh Kumar K.V
@ 2017-01-30 11:34 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-01-30 11:34 UTC (permalink / raw)
  To: Reza Arbab, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, Aneesh Kumar K.V

On Wed, 2017-01-25 at 15:54:33 UTC, Reza Arbab wrote:
> When setting a 2M pte, radix__map_kernel_page() is using the address
> 
> 	ptep = (pte_t *)pudp;
> 
> Fix this conversion to use pmdp instead. Use pmdp_ptep() to do this
> instead of casting the pointer.
> 
> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/a0615a16f7d0ceb5804d295203c302

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-30 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-25 15:54 [PATCH] powerpc/mm: use the correct pointer when setting a 2M pte Reza Arbab
2017-01-28 15:59 ` Aneesh Kumar K.V
2017-01-30 11:34 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).