powerpc/mm: Add __init attribute to eligible functions
authorNick Child <nick.child@ibm.com>
Thu, 16 Dec 2021 22:00:18 +0000 (17:00 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 23 Dec 2021 11:33:11 +0000 (22:33 +1100)
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: Nick Child <nick.child@ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211216220035.605465-4-nick.child@ibm.com
13 files changed:
arch/powerpc/include/asm/hugetlb.h
arch/powerpc/include/asm/mmu_context.h
arch/powerpc/mm/book3s32/mmu.c
arch/powerpc/mm/book3s64/hash_utils.c
arch/powerpc/mm/book3s64/hugetlbpage.c
arch/powerpc/mm/book3s64/mmu_context.c
arch/powerpc/mm/book3s64/pkeys.c
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/powerpc/mm/nohash/44x.c
arch/powerpc/mm/nohash/fsl_book3e.c
arch/powerpc/mm/nohash/tlb.c
arch/powerpc/mm/numa.c
arch/powerpc/mm/ptdump/ptdump.c

index f18c543bc01de36adee0ddc670d19cc0aac75b0f..962708fa1017823e9be09e8fd7a7917625272298 100644 (file)
@@ -15,7 +15,7 @@
 
 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,
                           unsigned long len);
index e46394d2778544ef8698a03517829a296ab3c32e..fd277b15635c06c4e3bfe60a6103201ea5148a0f 100644 (file)
@@ -71,7 +71,7 @@ static inline void switch_mmu_context(struct mm_struct *prev,
 }
 
 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);
 static inline void mmu_context_init(void) { }
 
index 33ab63d56435d4e1a95654dab6fce92430c59ab4..94045b265b6b9f5ad6adcc25356be71e5fb4ac08 100644 (file)
@@ -76,7 +76,7 @@ unsigned long p_block_mapped(phys_addr_t pa)
        return 0;
 }
 
-static int find_free_bat(void)
+static int __init find_free_bat(void)
 {
        int b;
        int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4;
index eced266dc5e98c3efe76b8ee122494f62502a113..7abf82a698d32bf3a2c3bdb0dd7d3c444a819c3b 100644 (file)
@@ -662,7 +662,7 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
 }
 #endif /* CONFIG_HUGETLB_PAGE */
 
-static void mmu_psize_set_default_penc(void)
+static void __init mmu_psize_set_default_penc(void)
 {
        int bpsize, apsize;
        for (bpsize = 0; bpsize < MMU_PAGE_COUNT; bpsize++)
@@ -672,7 +672,7 @@ static void mmu_psize_set_default_penc(void)
 
 #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
@@ -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
  * (if it exists).
  */
-static void init_hpte_page_sizes(void)
+static void __init init_hpte_page_sizes(void)
 {
        long int ap, bp;
        long int shift, penc;
index 95b2a283fd6e163166695d78355b86af84dff0f2..ea8f83afb0ae2650799c96e47849d6744a64401a 100644 (file)
@@ -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);
 }
 
-void hugetlbpage_init_default(void)
+void __init hugetlbpage_init_default(void)
 {
        /* Set default large page size. Currently, we pick 16M or 1M
         * depending on what is available
index 24aa953c931148bad7f1f059ae5de94399f3a7fc..c766e4c26e42ddbd3a20fd25d96d72561e936a6a 100644 (file)
@@ -32,7 +32,7 @@ static int alloc_context_id(int min_id, int max_id)
 }
 
 #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);
 
index a2d9ad1387094778146a058953dccf67de33bf04..753e62ba67af61c08adcb684083f480119f19b40 100644 (file)
@@ -66,7 +66,7 @@ static int __init dt_scan_storage_keys(unsigned long node,
        return 1;
 }
 
-static int scan_pkey_feature(void)
+static int __init scan_pkey_feature(void)
 {
        int ret;
        int pkeys_total = 0;
index ca23f5d1883ac6c2c907b7681b6d1af653d2cfe8..def04631a74d525322170fb36e06dc10d2b4b09e 100644 (file)
@@ -499,7 +499,7 @@ static int __init probe_memory_block_size(unsigned long node, const char *uname,
        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;
 
@@ -517,7 +517,7 @@ static unsigned long radix_memory_block_size(void)
 
 #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;
 }
index 796c824acc8cef9e90def637885a5d5070c03b4d..1beae802bb1c0d62140a45d90982ca862b8e3da9 100644 (file)
@@ -38,7 +38,7 @@ int icache_44x_need_flush;
 
 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
         * instruction to improve performances rather than loading it
@@ -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
  */
-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;
        int bolted;
index 7f71bc3bf85ffb0f2b2795128fc9d26339555b27..dfe715e0f70ac741ffb93f630d9bc155c900df0e 100644 (file)
@@ -259,7 +259,7 @@ void __init MMU_init_hw(void)
        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;
 }
index 311281063d48f70b79cdcfb93006831f6a64bf0a..fd2c77af5c5549b4d473c14ff6da17f4538d92fa 100644 (file)
@@ -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 tlb0ps;
@@ -570,7 +570,7 @@ out:
        }
 }
 
-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
index 59d3cfcd78879a5f443e5b6d803f011029e0e606..9d5f710d2c2054dd33416169541668b6807927cf 100644 (file)
@@ -134,7 +134,7 @@ static int __init fake_numa_create_new_node(unsigned long end_pfn,
        return 0;
 }
 
-static void reset_numa_cpu_lookup_table(void)
+static void __init reset_numa_cpu_lookup_table(void)
 {
        unsigned int cpu;
 
@@ -372,7 +372,7 @@ void update_numa_distance(struct device_node *node)
  * ibm,numa-lookup-index-table= {N, domainid1, domainid2, ..... domainidN}
  * 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;
        struct device_node *root;
@@ -581,7 +581,7 @@ static int of_get_assoc_arrays(struct assoc_arrays *aa)
        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 };
        int default_nid = NUMA_NO_NODE;
index 031956d0ee84d96da066bebbbccf384e39ea71b8..473960e4b07a1ed047522d60da04b151a5481bee 100644 (file)
@@ -315,7 +315,7 @@ static int ptdump_show(struct seq_file *m, void *v)
 
 DEFINE_SHOW_ATTRIBUTE(ptdump);
 
-static void build_pgtable_complete_mask(void)
+static void __init build_pgtable_complete_mask(void)
 {
        unsigned int i, j;