lkml.org 
[lkml]   [2020]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip: perf/core] powerpc/8xx: Implement pXX_leaf_size() support
    The following commit has been merged into the perf/core branch of tip:

    Commit-ID: c88a82f668cff457561272632a06a4a63dbf2fe0
    Gitweb: https://git.kernel.org/tip/c88a82f668cff457561272632a06a4a63dbf2fe0
    Author: Peter Zijlstra <peterz@infradead.org>
    AuthorDate: Thu, 26 Nov 2020 11:53:33 +01:00
    Committer: Peter Zijlstra <peterz@infradead.org>
    CommitterDate: Thu, 03 Dec 2020 10:14:52 +01:00

    powerpc/8xx: Implement pXX_leaf_size() support

    Christophe Leroy wrote:

    > I can help with powerpc 8xx. It is a 32 bits powerpc. The PGD has 1024
    > entries, that means each entry maps 4M.
    >
    > Page sizes are 4k, 16k, 512k and 8M.
    >
    > For the 8M pages we use hugepd with a single entry. The two related PGD
    > entries point to the same hugepd.
    >
    > For the other sizes, they are in standard page tables. 16k pages appear
    > 4 times in the page table. 512k entries appear 128 times in the page
    > table.
    >
    > When the PGD entry has _PMD_PAGE_8M bits, the PMD entry points to a
    > hugepd with holds the single 8M entry.
    >
    > In the PTE, we have two bits: _PAGE_SPS and _PAGE_HUGE
    >
    > _PAGE_HUGE means it is a 512k page
    > _PAGE_SPS means it is not a 4k page
    >
    > The kernel can by build either with 4k pages as standard page size, or
    > 16k pages. It doesn't change the page table layout though.

    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20201126121121.364451610@infradead.org
    ---
    arch/powerpc/include/asm/nohash/32/pte-8xx.h | 23 +++++++++++++++++++-
    1 file changed, 23 insertions(+)

    diff --git a/arch/powerpc/include/asm/nohash/32/pte-8xx.h b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
    index 1581204..fcc48d5 100644
    --- a/arch/powerpc/include/asm/nohash/32/pte-8xx.h
    +++ b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
    @@ -135,6 +135,29 @@ static inline pte_t pte_mkhuge(pte_t pte)
    }

    #define pte_mkhuge pte_mkhuge
    +
    +static inline unsigned long pgd_leaf_size(pgd_t pgd)
    +{
    + if (pgd_val(pgd) & _PMD_PAGE_8M)
    + return SZ_8M;
    + return SZ_4M;
    +}
    +
    +#define pgd_leaf_size pgd_leaf_size
    +
    +static inline unsigned long pte_leaf_size(pte_t pte)
    +{
    + pte_basic_t val = pte_val(pte);
    +
    + if (val & _PAGE_HUGE)
    + return SZ_512K;
    + if (val & _PAGE_SPS)
    + return SZ_16K;
    + return SZ_4K;
    +}
    +
    +#define pte_leaf_size pte_leaf_size
    +
    #endif

    #endif /* __KERNEL__ */
    \
     
     \ /
      Last update: 2020-12-03 10:27    [W:3.411 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site