From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Paul Mackerras via Linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
linuxppc-dev@lists.ozlabs.org
Cc: Michael Ellerman <mpe@ellerman.id.au>, Paul Mackerras <paulus@samba.org>
Subject: Re: [RFC PATCH 3/9] powerpc/mm/64: Use physical addresses in upper page table tree levels
Date: Sat, 20 Feb 2016 22:05:58 +0530 [thread overview]
Message-ID: <87y4af730x.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1455948760-24710-4-git-send-email-paulus@samba.org>
Paul Mackerras <paulus@samba.org> writes:
> This changes the Linux page tables to store physical addresses
> rather than kernel virtual addresses in the upper levels of the
> tree (pgd, pud and pmd) for all 64-bit machines.
>
> This frees up some high order bits, and will be needed with book3s
> PowerISA v3.0 machines which read the page table tree in hardware
> in radix mode.
Should we not update pmd_pgtable ? I have the below patch in my series.
http://mid.gmane.org/1455814254-10226-13-git-send-email-aneesh.kumar@linux.vnet.ibm.com
>
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> ---
> arch/powerpc/include/asm/book3s/64/hash-4k.h | 2 +-
> arch/powerpc/include/asm/book3s/64/hash.h | 10 ++++------
> arch/powerpc/include/asm/nohash/64/pgtable-4k.h | 2 +-
> arch/powerpc/include/asm/nohash/64/pgtable.h | 10 ++++------
> arch/powerpc/include/asm/pgalloc-64.h | 16 ++++++++--------
> 5 files changed, 18 insertions(+), 22 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> index bee3643..0425d3e 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> @@ -64,7 +64,7 @@
> #define pgd_none(pgd) (!pgd_val(pgd))
> #define pgd_bad(pgd) (pgd_val(pgd) == 0)
> #define pgd_present(pgd) (pgd_val(pgd) != 0)
> -#define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)
> +#define pgd_page_vaddr(pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS)
>
> static inline void pgd_clear(pgd_t *pgdp)
> {
> diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h
> index 64eff40..fcab33f 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash.h
> @@ -222,13 +222,11 @@
> #define PUD_BAD_BITS (PMD_TABLE_SIZE-1)
>
> #ifndef __ASSEMBLY__
> -#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \
> - || (pmd_val(pmd) & PMD_BAD_BITS))
> -#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
> +#define pmd_bad(pmd) (pmd_val(pmd) & PMD_BAD_BITS)
> +#define pmd_page_vaddr(pmd) __va(pmd_val(pmd) & ~PMD_MASKED_BITS)
>
> -#define pud_bad(pud) (!is_kernel_addr(pud_val(pud)) \
> - || (pud_val(pud) & PUD_BAD_BITS))
> -#define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
> +#define pud_bad(pud) (pud_val(pud) & PUD_BAD_BITS)
> +#define pud_page_vaddr(pud) __va(pud_val(pud) & ~PUD_MASKED_BITS)
>
> #define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1))
> #define pmd_index(address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1))
> diff --git a/arch/powerpc/include/asm/nohash/64/pgtable-4k.h b/arch/powerpc/include/asm/nohash/64/pgtable-4k.h
> index fc7d517..c8319e8 100644
> --- a/arch/powerpc/include/asm/nohash/64/pgtable-4k.h
> +++ b/arch/powerpc/include/asm/nohash/64/pgtable-4k.h
> @@ -55,7 +55,7 @@
> #define pgd_none(pgd) (!pgd_val(pgd))
> #define pgd_bad(pgd) (pgd_val(pgd) == 0)
> #define pgd_present(pgd) (pgd_val(pgd) != 0)
> -#define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)
> +#define pgd_page_vaddr(pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS)
>
> #ifndef __ASSEMBLY__
>
> diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h
> index b9f734d..484c0e1 100644
> --- a/arch/powerpc/include/asm/nohash/64/pgtable.h
> +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h
> @@ -127,10 +127,9 @@ static inline pte_t pmd_pte(pmd_t pmd)
> }
>
> #define pmd_none(pmd) (!pmd_val(pmd))
> -#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \
> - || (pmd_val(pmd) & PMD_BAD_BITS))
> +#define pmd_bad(pmd) (pmd_val(pmd) & PMD_BAD_BITS)
> #define pmd_present(pmd) (!pmd_none(pmd))
> -#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
> +#define pmd_page_vaddr(pmd) __va(pmd_val(pmd) & ~PMD_MASKED_BITS)
> extern struct page *pmd_page(pmd_t pmd);
>
> static inline void pud_set(pud_t *pudp, unsigned long val)
> @@ -144,10 +143,9 @@ static inline void pud_clear(pud_t *pudp)
> }
>
> #define pud_none(pud) (!pud_val(pud))
> -#define pud_bad(pud) (!is_kernel_addr(pud_val(pud)) \
> - || (pud_val(pud) & PUD_BAD_BITS))
> +#define pud_bad(pud) (pud_val(pud) & PUD_BAD_BITS)
> #define pud_present(pud) (pud_val(pud) != 0)
> -#define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
> +#define pud_page_vaddr(pud) __va(pud_val(pud) & ~PUD_MASKED_BITS)
>
> extern struct page *pud_page(pud_t pud);
>
> diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
> index 69ef28a..4f4609d 100644
> --- a/arch/powerpc/include/asm/pgalloc-64.h
> +++ b/arch/powerpc/include/asm/pgalloc-64.h
> @@ -53,7 +53,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
>
> #ifndef CONFIG_PPC_64K_PAGES
>
> -#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, (unsigned long)PUD)
> +#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, __pa(PUD))
>
> static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
> {
> @@ -68,19 +68,19 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
>
> static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
> {
> - pud_set(pud, (unsigned long)pmd);
> + pud_set(pud, __pa(pmd));
> }
>
> static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
> pte_t *pte)
> {
> - pmd_set(pmd, (unsigned long)pte);
> + pmd_set(pmd, __pa(pte));
> }
>
> static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
> pgtable_t pte_page)
> {
> - pmd_set(pmd, (unsigned long)page_address(pte_page));
> + pmd_set(pmd, __pa(page_address(pte_page)));
> }
>
> #define pmd_pgtable(pmd) pmd_page(pmd)
> @@ -171,23 +171,23 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift);
> extern void __tlb_remove_table(void *_table);
> #endif
>
> -#define pud_populate(mm, pud, pmd) pud_set(pud, (unsigned long)pmd)
> +#define pud_populate(mm, pud, pmd) pud_set(pud, __pa(pmd))
>
> static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
> pte_t *pte)
> {
> - pmd_set(pmd, (unsigned long)pte);
> + pmd_set(pmd, __pa(pte));
> }
>
> static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
> pgtable_t pte_page)
> {
> - pmd_set(pmd, (unsigned long)pte_page);
> + pmd_set(pmd, __pa(pte_page));
> }
>
> static inline pgtable_t pmd_pgtable(pmd_t pmd)
> {
> - return (pgtable_t)(pmd_val(pmd) & ~PMD_MASKED_BITS);
> + return (pgtable_t)__va(pmd_val(pmd) & ~PMD_MASKED_BITS);
> }
>
> static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
> --
> 2.5.0
next prev parent reply other threads:[~2016-02-20 16:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-20 6:12 [RFC PATCH 0/9] powerpc/mm: Restructure Linux PTE on Book3S/64 to radix format Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 1/9] powerpc/mm/book3s-64: Clean up some obsolete or misleading comments Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 2/9] powerpc/mm/book3s-64: Free up 7 high-order bits in the Linux PTE Paul Mackerras
2016-02-20 16:16 ` Aneesh Kumar K.V
2016-02-21 22:43 ` Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 3/9] powerpc/mm/64: Use physical addresses in upper page table tree levels Paul Mackerras
2016-02-20 16:35 ` Aneesh Kumar K.V [this message]
2016-02-21 22:45 ` Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 4/9] powerpc/mm/book3s-64: Move _PAGE_PRESENT to the most significant bit Paul Mackerras
2016-02-20 8:33 ` kbuild test robot
2016-02-20 16:41 ` Aneesh Kumar K.V
2016-02-21 22:40 ` Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 5/9] powerpc/mm/book3s-64: Move _PAGE_PTE to 2nd " Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 6/9] powerpc/mm/book3s-64: Move HPTE-related bits in PTE to upper end Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 7/9] powerpc/mm/book3s-64: Shuffle read, write, execute and user bits in PTE Paul Mackerras
2016-02-21 7:30 ` Aneesh Kumar K.V
2016-02-21 22:36 ` Paul Mackerras
2016-02-22 0:27 ` Michael Ellerman
2016-02-20 6:12 ` [RFC PATCH 8/9] powerpc/mm/book3s-64: Move software-used " Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 9/9] powerpc/mm/book3s-64: Expand the real page number field of the Linux PTE Paul Mackerras
2016-02-20 14:40 ` [RFC PATCH 0/9] powerpc/mm: Restructure Linux PTE on Book3S/64 to radix format Aneesh Kumar K.V
2016-02-20 15:32 ` Aneesh Kumar K.V
2016-02-21 7:41 ` Aneesh Kumar K.V
2016-02-21 22:31 ` Paul Mackerras
2016-02-22 0:30 ` Michael Ellerman
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=87y4af730x.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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.