Commit c13f2b2b authored by Nick Child's avatar Nick Child Committed by Michael Ellerman

powerpc/mm: Add __init attribute to eligible functions

Some functions defined in 'arch/powerpc/mm' are deserving of an
`__init` macro attribute. These functions are only called by other
initialization functions and therefore should inherit the attribute.
Also, change function declarations in header files to include `__init`.
Signed-off-by: default avatarNick Child <nick.child@ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211216220035.605465-4-nick.child@ibm.com
parent ce0c6be9
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
extern bool hugetlb_disabled; extern bool hugetlb_disabled;
void hugetlbpage_init_default(void); void __init hugetlbpage_init_default(void);
int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
unsigned long len); unsigned long len);
......
...@@ -71,7 +71,7 @@ static inline void switch_mmu_context(struct mm_struct *prev, ...@@ -71,7 +71,7 @@ static inline void switch_mmu_context(struct mm_struct *prev,
} }
extern int hash__alloc_context_id(void); extern int hash__alloc_context_id(void);
extern void hash__reserve_context_id(int id); void __init hash__reserve_context_id(int id);
extern void __destroy_context(int context_id); extern void __destroy_context(int context_id);
static inline void mmu_context_init(void) { } static inline void mmu_context_init(void) { }
......
...@@ -76,7 +76,7 @@ unsigned long p_block_mapped(phys_addr_t pa) ...@@ -76,7 +76,7 @@ unsigned long p_block_mapped(phys_addr_t pa)
return 0; return 0;
} }
static int find_free_bat(void) static int __init find_free_bat(void)
{ {
int b; int b;
int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4;
......
...@@ -662,7 +662,7 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node, ...@@ -662,7 +662,7 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
} }
#endif /* CONFIG_HUGETLB_PAGE */ #endif /* CONFIG_HUGETLB_PAGE */
static void mmu_psize_set_default_penc(void) static void __init mmu_psize_set_default_penc(void)
{ {
int bpsize, apsize; int bpsize, apsize;
for (bpsize = 0; bpsize < MMU_PAGE_COUNT; bpsize++) for (bpsize = 0; bpsize < MMU_PAGE_COUNT; bpsize++)
...@@ -672,7 +672,7 @@ static void mmu_psize_set_default_penc(void) ...@@ -672,7 +672,7 @@ static void mmu_psize_set_default_penc(void)
#ifdef CONFIG_PPC_64K_PAGES #ifdef CONFIG_PPC_64K_PAGES
static bool might_have_hea(void) static bool __init might_have_hea(void)
{ {
/* /*
* The HEA ethernet adapter requires awareness of the * The HEA ethernet adapter requires awareness of the
...@@ -743,7 +743,7 @@ static void __init htab_scan_page_sizes(void) ...@@ -743,7 +743,7 @@ static void __init htab_scan_page_sizes(void)
* low-order N bits as the encoding for the 2^(12+N) byte page size * low-order N bits as the encoding for the 2^(12+N) byte page size
* (if it exists). * (if it exists).
*/ */
static void init_hpte_page_sizes(void) static void __init init_hpte_page_sizes(void)
{ {
long int ap, bp; long int ap, bp;
long int shift, penc; long int shift, penc;
......
...@@ -150,7 +150,7 @@ void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr ...@@ -150,7 +150,7 @@ void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr
set_huge_pte_at(vma->vm_mm, addr, ptep, pte); set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
} }
void hugetlbpage_init_default(void) void __init hugetlbpage_init_default(void)
{ {
/* Set default large page size. Currently, we pick 16M or 1M /* Set default large page size. Currently, we pick 16M or 1M
* depending on what is available * depending on what is available
......
...@@ -32,7 +32,7 @@ static int alloc_context_id(int min_id, int max_id) ...@@ -32,7 +32,7 @@ static int alloc_context_id(int min_id, int max_id)
} }
#ifdef CONFIG_PPC_64S_HASH_MMU #ifdef CONFIG_PPC_64S_HASH_MMU
void hash__reserve_context_id(int id) void __init hash__reserve_context_id(int id)
{ {
int result = ida_alloc_range(&mmu_context_ida, id, id, GFP_KERNEL); int result = ida_alloc_range(&mmu_context_ida, id, id, GFP_KERNEL);
......
...@@ -66,7 +66,7 @@ static int __init dt_scan_storage_keys(unsigned long node, ...@@ -66,7 +66,7 @@ static int __init dt_scan_storage_keys(unsigned long node,
return 1; return 1;
} }
static int scan_pkey_feature(void) static int __init scan_pkey_feature(void)
{ {
int ret; int ret;
int pkeys_total = 0; int pkeys_total = 0;
......
...@@ -499,7 +499,7 @@ static int __init probe_memory_block_size(unsigned long node, const char *uname, ...@@ -499,7 +499,7 @@ static int __init probe_memory_block_size(unsigned long node, const char *uname,
return 1; return 1;
} }
static unsigned long radix_memory_block_size(void) static unsigned long __init radix_memory_block_size(void)
{ {
unsigned long mem_block_size = MIN_MEMORY_BLOCK_SIZE; unsigned long mem_block_size = MIN_MEMORY_BLOCK_SIZE;
...@@ -517,7 +517,7 @@ static unsigned long radix_memory_block_size(void) ...@@ -517,7 +517,7 @@ static unsigned long radix_memory_block_size(void)
#else /* CONFIG_MEMORY_HOTPLUG */ #else /* CONFIG_MEMORY_HOTPLUG */
static unsigned long radix_memory_block_size(void) static unsigned long __init radix_memory_block_size(void)
{ {
return 1UL * 1024 * 1024 * 1024; return 1UL * 1024 * 1024 * 1024;
} }
......
...@@ -38,7 +38,7 @@ int icache_44x_need_flush; ...@@ -38,7 +38,7 @@ int icache_44x_need_flush;
unsigned long tlb_47x_boltmap[1024/8]; unsigned long tlb_47x_boltmap[1024/8];
static void ppc44x_update_tlb_hwater(void) static void __init ppc44x_update_tlb_hwater(void)
{ {
/* The TLB miss handlers hard codes the watermark in a cmpli /* The TLB miss handlers hard codes the watermark in a cmpli
* instruction to improve performances rather than loading it * instruction to improve performances rather than loading it
...@@ -122,7 +122,7 @@ static void __init ppc47x_update_boltmap(void) ...@@ -122,7 +122,7 @@ static void __init ppc47x_update_boltmap(void)
/* /*
* "Pins" a 256MB TLB entry in AS0 for kernel lowmem for 47x type MMU * "Pins" a 256MB TLB entry in AS0 for kernel lowmem for 47x type MMU
*/ */
static void ppc47x_pin_tlb(unsigned int virt, unsigned int phys) static void __init ppc47x_pin_tlb(unsigned int virt, unsigned int phys)
{ {
unsigned int rA; unsigned int rA;
int bolted; int bolted;
......
...@@ -259,7 +259,7 @@ void __init MMU_init_hw(void) ...@@ -259,7 +259,7 @@ void __init MMU_init_hw(void)
flush_instruction_cache(); flush_instruction_cache();
} }
static unsigned long tlbcam_sz(int idx) static unsigned long __init tlbcam_sz(int idx)
{ {
return tlbcam_addrs[idx].limit - tlbcam_addrs[idx].start + 1; return tlbcam_addrs[idx].limit - tlbcam_addrs[idx].start + 1;
} }
......
...@@ -432,7 +432,7 @@ void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address) ...@@ -432,7 +432,7 @@ void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address)
} }
} }
static void setup_page_sizes(void) static void __init setup_page_sizes(void)
{ {
unsigned int tlb0cfg; unsigned int tlb0cfg;
unsigned int tlb0ps; unsigned int tlb0ps;
...@@ -570,7 +570,7 @@ static void setup_page_sizes(void) ...@@ -570,7 +570,7 @@ static void setup_page_sizes(void)
} }
} }
static void setup_mmu_htw(void) static void __init setup_mmu_htw(void)
{ {
/* /*
* If we want to use HW tablewalk, enable it by patching the TLB miss * If we want to use HW tablewalk, enable it by patching the TLB miss
......
...@@ -134,7 +134,7 @@ static int __init fake_numa_create_new_node(unsigned long end_pfn, ...@@ -134,7 +134,7 @@ static int __init fake_numa_create_new_node(unsigned long end_pfn,
return 0; return 0;
} }
static void reset_numa_cpu_lookup_table(void) static void __init reset_numa_cpu_lookup_table(void)
{ {
unsigned int cpu; unsigned int cpu;
...@@ -372,7 +372,7 @@ void update_numa_distance(struct device_node *node) ...@@ -372,7 +372,7 @@ void update_numa_distance(struct device_node *node)
* ibm,numa-lookup-index-table= {N, domainid1, domainid2, ..... domainidN} * ibm,numa-lookup-index-table= {N, domainid1, domainid2, ..... domainidN}
* ibm,numa-distance-table = { N, 1, 2, 4, 5, 1, 6, .... N elements} * ibm,numa-distance-table = { N, 1, 2, 4, 5, 1, 6, .... N elements}
*/ */
static void initialize_form2_numa_distance_lookup_table(void) static void __init initialize_form2_numa_distance_lookup_table(void)
{ {
int i, j; int i, j;
struct device_node *root; struct device_node *root;
...@@ -581,7 +581,7 @@ static int of_get_assoc_arrays(struct assoc_arrays *aa) ...@@ -581,7 +581,7 @@ static int of_get_assoc_arrays(struct assoc_arrays *aa)
return 0; return 0;
} }
static int get_nid_and_numa_distance(struct drmem_lmb *lmb) static int __init get_nid_and_numa_distance(struct drmem_lmb *lmb)
{ {
struct assoc_arrays aa = { .arrays = NULL }; struct assoc_arrays aa = { .arrays = NULL };
int default_nid = NUMA_NO_NODE; int default_nid = NUMA_NO_NODE;
......
...@@ -315,7 +315,7 @@ static int ptdump_show(struct seq_file *m, void *v) ...@@ -315,7 +315,7 @@ static int ptdump_show(struct seq_file *m, void *v)
DEFINE_SHOW_ATTRIBUTE(ptdump); DEFINE_SHOW_ATTRIBUTE(ptdump);
static void build_pgtable_complete_mask(void) static void __init build_pgtable_complete_mask(void)
{ {
unsigned int i, j; unsigned int i, j;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment