* [PATCH] arm64/mm: Drop use_1G_block()
@ 2022-02-16 5:06 Anshuman Khandual
2022-02-16 5:14 ` Anshuman Khandual
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Anshuman Khandual @ 2022-02-16 5:06 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, linux-kernel
pud_sect_supported() already checks for PUD level block mapping support i.e
on ARM64_4K_PAGES config. Hence pud_sect_supported(), along with some other
required alignment checks can help completely drop use_1G_block().
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v5.17-rc4
arch/arm64/mm/mmu.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index acfae9b41cc8..5a7954c9e6ec 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -294,18 +294,6 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
} while (addr = next, addr != end);
}
-static inline bool use_1G_block(unsigned long addr, unsigned long next,
- unsigned long phys)
-{
- if (PAGE_SHIFT != 12)
- return false;
-
- if (((addr | next | phys) & ~PUD_MASK) != 0)
- return false;
-
- return true;
-}
-
static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
phys_addr_t phys, pgprot_t prot,
phys_addr_t (*pgtable_alloc)(int),
@@ -338,7 +326,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
/*
* For 4K granule only, attempt to put down a 1GB block
*/
- if (use_1G_block(addr, next, phys) &&
+ if (pud_sect_supported() &&
+ ((addr | next | phys) & ~PUD_MASK) == 0 &&
(flags & NO_BLOCK_MAPPINGS) == 0) {
pud_set_huge(pudp, phys, prot);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/mm: Drop use_1G_block()
2022-02-16 5:06 [PATCH] arm64/mm: Drop use_1G_block() Anshuman Khandual
@ 2022-02-16 5:14 ` Anshuman Khandual
2022-03-07 16:37 ` Catalin Marinas
2022-03-07 22:03 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2022-02-16 5:14 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Catalin Marinas, Will Deacon, linux-kernel
On 2/16/22 10:36 AM, Anshuman Khandual wrote:
> pud_sect_supported() already checks for PUD level block mapping support i.e
> on ARM64_4K_PAGES config. Hence pud_sect_supported(), along with some other
> required alignment checks can help completely drop use_1G_block().
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This applies on v5.17-rc4
>
> arch/arm64/mm/mmu.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index acfae9b41cc8..5a7954c9e6ec 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -294,18 +294,6 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
> } while (addr = next, addr != end);
> }
>
> -static inline bool use_1G_block(unsigned long addr, unsigned long next,
> - unsigned long phys)
> -{
> - if (PAGE_SHIFT != 12)
> - return false;
> -
> - if (((addr | next | phys) & ~PUD_MASK) != 0)
> - return false;
> -
> - return true;
> -}
> -
> static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
> phys_addr_t phys, pgprot_t prot,
> phys_addr_t (*pgtable_alloc)(int),
> @@ -338,7 +326,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
> /*
> * For 4K granule only, attempt to put down a 1GB block
> */
> - if (use_1G_block(addr, next, phys) &&
> + if (pud_sect_supported() &&
> + ((addr | next | phys) & ~PUD_MASK) == 0 &&
> (flags & NO_BLOCK_MAPPINGS) == 0) {
This is now very similar to init_pmd() block mapping check.
> pud_set_huge(pudp, phys, prot);
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/mm: Drop use_1G_block()
2022-02-16 5:06 [PATCH] arm64/mm: Drop use_1G_block() Anshuman Khandual
2022-02-16 5:14 ` Anshuman Khandual
@ 2022-03-07 16:37 ` Catalin Marinas
2022-03-07 22:03 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2022-03-07 16:37 UTC (permalink / raw)
To: Anshuman Khandual; +Cc: linux-arm-kernel, Will Deacon, linux-kernel
On Wed, Feb 16, 2022 at 10:36:52AM +0530, Anshuman Khandual wrote:
> pud_sect_supported() already checks for PUD level block mapping support i.e
> on ARM64_4K_PAGES config. Hence pud_sect_supported(), along with some other
> required alignment checks can help completely drop use_1G_block().
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
(in case Will still picks stuff for 5.18)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/mm: Drop use_1G_block()
2022-02-16 5:06 [PATCH] arm64/mm: Drop use_1G_block() Anshuman Khandual
2022-02-16 5:14 ` Anshuman Khandual
2022-03-07 16:37 ` Catalin Marinas
@ 2022-03-07 22:03 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2022-03-07 22:03 UTC (permalink / raw)
To: linux-arm-kernel, Anshuman Khandual
Cc: catalin.marinas, kernel-team, Will Deacon, linux-kernel
On Wed, 16 Feb 2022 10:36:52 +0530, Anshuman Khandual wrote:
> pud_sect_supported() already checks for PUD level block mapping support i.e
> on ARM64_4K_PAGES config. Hence pud_sect_supported(), along with some other
> required alignment checks can help completely drop use_1G_block().
>
>
Applied to arm64 (for-next/mm), thanks!
[1/1] arm64/mm: Drop use_1G_block()
https://git.kernel.org/arm64/c/1310222c276b
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-07 22:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 5:06 [PATCH] arm64/mm: Drop use_1G_block() Anshuman Khandual
2022-02-16 5:14 ` Anshuman Khandual
2022-03-07 16:37 ` Catalin Marinas
2022-03-07 22:03 ` Will Deacon
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).