提交 7becc900 编写于 作者: N Nicholas Piggin 提交者: Yang Yingliang

arm64: inline huge vmap supported functions

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI
CVE: NA

https://lwn.net/ml/linux-kernel/20200825145753.529284-8-npiggin@gmail.com/
--------------

This allows unsupported levels to be constant folded away, and so
p4d_free_pud_page can be removed because it's no longer linked to.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
Signed-off-by: NRui Xiang <rui.xiang@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NZefan Li <lizefan@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 bce273b7
...@@ -4,9 +4,26 @@ ...@@ -4,9 +4,26 @@
#include <asm/page.h> #include <asm/page.h>
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
bool arch_vmap_p4d_supported(pgprot_t prot); static inline bool arch_vmap_p4d_supported(pgprot_t prot)
bool arch_vmap_pud_supported(pgprot_t prot); {
bool arch_vmap_pmd_supported(pgprot_t prot); return false;
}
static inline bool arch_vmap_pud_supported(pgprot_t prot)
{
/*
* Only 4k granule supports level 1 block mappings.
* SW table walks can't handle removal of intermediate entries.
*/
return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
!IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
}
static inline bool arch_vmap_pmd_supported(pgprot_t prot)
{
/* See arch_vmap_pud_supported() */
return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
}
#endif #endif
#endif /* _ASM_ARM64_VMALLOC_H */ #endif /* _ASM_ARM64_VMALLOC_H */
...@@ -921,27 +921,6 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys) ...@@ -921,27 +921,6 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
return dt_virt; return dt_virt;
} }
bool arch_vmap_p4d_supported(pgprot_t prot)
{
return false;
}
bool arch_vmap_pud_supported(pgprot_t prot)
{
/*
* Only 4k granule supports level 1 block mappings.
* SW table walks can't handle removal of intermediate entries.
*/
return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
!IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS);
}
bool arch_vmap_pmd_supported(pgprot_t prot)
{
/* See arch_vmap_pud_supported() */
return !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS);
}
int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
{ {
pgprot_t sect_prot = __pgprot(PUD_TYPE_SECT | pgprot_t sect_prot = __pgprot(PUD_TYPE_SECT |
...@@ -1041,11 +1020,6 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr) ...@@ -1041,11 +1020,6 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr)
return 1; return 1;
} }
int p4d_free_pud_page(p4d_t *p4d, unsigned long addr)
{
return 0; /* Don't attempt a block mapping */
}
#ifdef CONFIG_MEMORY_HOTPLUG #ifdef CONFIG_MEMORY_HOTPLUG
int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap, int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
bool want_memblock) bool want_memblock)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册