[PATCH v5 11/18] powerpc/e500: Switch to 64 bits PGD on 85xx (32 bits)

2024-06-09 Thread Christophe Leroy
At the time being when CONFIG_PTE_64BIT is selected, PTE entries are 64 bits but PGD entries are still 32 bits. In order to allow leaf PMD entries, switch the PGD to 64 bits entries. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/pgtable-types.h | 4

[PATCH v5 10/18] powerpc/e500: Remove enc and ind fields from struct mmu_psize_def

2024-06-09 Thread Christophe Leroy
enc field is hidden behind BOOK3E_PAGESZ_XX macros, and when you look closer you realise that this field is nothing else than the value of shift minus ten. So remove enc field and calculate tsize from shift field. Also remove inc field which is unused. Signed-off-by: Christophe Leroy

[PATCH v5 09/18] powerpc/8xx: Simplify struct mmu_psize_def

2024-06-09 Thread Christophe Leroy
On 8xx, only the shift field is used in struct mmu_psize_def Remove other fields and related macros. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git

[PATCH v5 08/18] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-06-09 Thread Christophe Leroy
In order to fit better with standard Linux page tables layout, add support for 8M pages using contiguous PTE entries in a standard page table. Page tables will then be populated with 1024 similar entries and two PMD entries will point to that page table. The PMD entries also get a flag to tell it

[PATCH v5 07/18] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-06-09 Thread Christophe Leroy
set_huge_pte_at() expects the size of the hugepage as an int, not the psize which is the index of the page definition in table mmu_psize_defs[] Fixes: 935d4f0c6dc8 ("mm: hugetlb: add huge page size param to set_huge_pte_at()") Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador ---

[PATCH v5 06/18] powerpc/mm: Allow hugepages without hugepd

2024-06-09 Thread Christophe Leroy
In preparation of implementing huge pages on powerpc 8xx without hugepd, enclose hugepd related code inside an ifdef CONFIG_ARCH_HAS_HUGEPD This also allows removing some stubs. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: - Prepare huge_pte_alloc() for full standard

[PATCH v5 05/18] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries

2024-06-09 Thread Christophe Leroy
Building on 32 bits with pmd_leaf() not returning always false leads to the following error: CC arch/powerpc/mm/pgtable.o arch/powerpc/mm/pgtable.c: In function '__find_linux_pte': arch/powerpc/mm/pgtable.c:506:1: error: function may return address of local variable

[PATCH v5 04/18] powerpc/mm: Remove _PAGE_PSIZE

2024-06-09 Thread Christophe Leroy
_PAGE_PSIZE macro is never used outside the place it is defined and is used only on 8xx and e500. Remove indirection, remove it and use its content directly. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/pte-40x.h | 3 ---

[PATCH v5 03/18] mm: Provide mm_struct and address to huge_ptep_get()

2024-06-09 Thread Christophe Leroy
On powerpc 8xx huge_ptep_get() will need to know whether the given ptep is a PTE entry or a PMD entry. This cannot be known with the PMD entry itself because there is no easy way to know it from the content of the entry. So huge_ptep_get() will need to know either the size of the page or get the

[PATCH v5 01/18] powerpc/64e: Remove unused IBM HTW code [SQUASHED]

2024-06-09 Thread Christophe Leroy
From: Michael Ellerman This is a squash of series from Michael https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20240524073141.1637736-1-...@ellerman.id.au/ The nohash HTW_IBM (Hardware Table Walk) code is unused since support for A2 was removed in commit fb5a515704d7 ("powerpc: Remove

[PATCH v5 02/18] mm: Define __pte_leaf_size() to also take a PMD entry

2024-06-09 Thread Christophe Leroy
On powerpc 8xx, when a page is 8M size, the information is in the PMD entry. So allow architectures to provide __pte_leaf_size() instead of pte_leaf_size() and provide the PMD entry to that function. When __pte_leaf_size() is not defined, define it as a pte_leaf_size() so that architectures not

[PATCH v5 00/18] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

2024-06-09 Thread Christophe Leroy
This series has reached maturity to not send it as an RFC anymore. Only the book3s/64 part maybe needs more attention. Alternatively we could simply disable HUGE pages on book3s/64 in hash-4k mode if we want to be on the safe side. Also see https://github.com/linuxppc/issues/issues/483 Unlike

[PATCH 03/14] KVM: PPC: replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-09 Thread Julia Lawall
Since SLOB was removed, it is not necessary to use call_rcu when the callback only performs kmem_cache_free. Use kfree_rcu() directly. The changes were done using the following Coccinelle semantic patch. This semantic patch is designed to ignore cases where the callback function is used in

[PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-09 Thread Julia Lawall
Since SLOB was removed, it is not necessary to use call_rcu when the callback only performs kmem_cache_free. Use kfree_rcu() directly. The changes were done using the following Coccinelle semantic patch. This semantic patch is designed to ignore cases where the callback function is used in