[tip:WIP.sched/core 144/144] arch/powerpc/lib/feature-fixups.c:178:16: error: '__start___mmu_ftr_fixup' undeclared

From: kbuild test robot
Date: Fri Feb 03 2017 - 20:35:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.sched/core
head: f83f0b0647162b099f62e62c203b1cfb90b40239
commit: f83f0b0647162b099f62e62c203b1cfb90b40239 [144/144] sched/headers: Remove the <linux/mm_types.h> dependency from <linux/sched.h>
config: powerpc-sam440ep_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout f83f0b0647162b099f62e62c203b1cfb90b40239
# save the attached .config to linux build tree
make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

In file included from arch/powerpc/lib/feature-fixups.c:24:0:
arch/powerpc/lib/feature-fixups.c: In function 'apply_feature_fixups':
>> arch/powerpc/lib/feature-fixups.c:178:16: error: '__start___mmu_ftr_fixup' undeclared (first use in this function)
PTRRELOC(&__start___mmu_ftr_fixup),
^
arch/powerpc/include/asm/setup.h:22:30: note: in definition of macro 'PTRRELOC'
#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
^
arch/powerpc/lib/feature-fixups.c:178:16: note: each undeclared identifier is reported only once for each function it appears in
PTRRELOC(&__start___mmu_ftr_fixup),
^
arch/powerpc/include/asm/setup.h:22:30: note: in definition of macro 'PTRRELOC'
#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
^
>> arch/powerpc/lib/feature-fixups.c:179:16: error: '__stop___mmu_ftr_fixup' undeclared (first use in this function)
PTRRELOC(&__stop___mmu_ftr_fixup));
^
arch/powerpc/include/asm/setup.h:22:30: note: in definition of macro 'PTRRELOC'
#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
^
arch/powerpc/lib/feature-fixups.c: In function 'setup_feature_keys':
>> arch/powerpc/lib/feature-fixups.c:202:2: error: implicit declaration of function 'mmu_feature_keys_init' [-Werror=implicit-function-declaration]
mmu_feature_keys_init();
^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

vim +/__start___mmu_ftr_fixup +178 arch/powerpc/lib/feature-fixups.c

362e7701 Michael Ellerman 2008-06-24 18 #include <linux/string.h>
362e7701 Michael Ellerman 2008-06-24 19 #include <linux/init.h>
51c52e86 Michael Ellerman 2008-06-24 20 #include <asm/cputable.h>
51c52e86 Michael Ellerman 2008-06-24 21 #include <asm/code-patching.h>
d715e433 Anton Blanchard 2011-11-14 22 #include <asm/page.h>
d715e433 Anton Blanchard 2011-11-14 23 #include <asm/sections.h>
9402c684 Benjamin Herrenschmidt 2016-07-05 @24 #include <asm/setup.h>
9402c684 Benjamin Herrenschmidt 2016-07-05 25 #include <asm/firmware.h>
51c52e86 Michael Ellerman 2008-06-24 26
51c52e86 Michael Ellerman 2008-06-24 27 struct fixup_entry {
51c52e86 Michael Ellerman 2008-06-24 28 unsigned long mask;
51c52e86 Michael Ellerman 2008-06-24 29 unsigned long value;
51c52e86 Michael Ellerman 2008-06-24 30 long start_off;
51c52e86 Michael Ellerman 2008-06-24 31 long end_off;
fac23fe4 Michael Ellerman 2008-06-24 32 long alt_start_off;
fac23fe4 Michael Ellerman 2008-06-24 33 long alt_end_off;
51c52e86 Michael Ellerman 2008-06-24 34 };
51c52e86 Michael Ellerman 2008-06-24 35
9b1a735d Michael Ellerman 2008-06-24 36 static unsigned int *calc_addr(struct fixup_entry *fcur, long offset)
51c52e86 Michael Ellerman 2008-06-24 37 {
9b1a735d Michael Ellerman 2008-06-24 38 /*
9b1a735d Michael Ellerman 2008-06-24 39 * We store the offset to the code as a negative offset from
9b1a735d Michael Ellerman 2008-06-24 40 * the start of the alt_entry, to support the VDSO. This
9b1a735d Michael Ellerman 2008-06-24 41 * routine converts that back into an actual address.
9b1a735d Michael Ellerman 2008-06-24 42 */
9b1a735d Michael Ellerman 2008-06-24 43 return (unsigned int *)((unsigned long)fcur + offset);
9b1a735d Michael Ellerman 2008-06-24 44 }
9b1a735d Michael Ellerman 2008-06-24 45
9b1a735d Michael Ellerman 2008-06-24 46 static int patch_alt_instruction(unsigned int *src, unsigned int *dest,
9b1a735d Michael Ellerman 2008-06-24 47 unsigned int *alt_start, unsigned int *alt_end)
9b1a735d Michael Ellerman 2008-06-24 48 {
9b1a735d Michael Ellerman 2008-06-24 49 unsigned int instr;
9b1a735d Michael Ellerman 2008-06-24 50
9b1a735d Michael Ellerman 2008-06-24 51 instr = *src;
9b1a735d Michael Ellerman 2008-06-24 52
9b1a735d Michael Ellerman 2008-06-24 53 if (instr_is_relative_branch(*src)) {
9b1a735d Michael Ellerman 2008-06-24 54 unsigned int *target = (unsigned int *)branch_target(src);
9b1a735d Michael Ellerman 2008-06-24 55
9b1a735d Michael Ellerman 2008-06-24 56 /* Branch within the section doesn't need translating */
9b1a735d Michael Ellerman 2008-06-24 57 if (target < alt_start || target >= alt_end) {
9b1a735d Michael Ellerman 2008-06-24 58 instr = translate_branch(dest, src);
9b1a735d Michael Ellerman 2008-06-24 59 if (!instr)
9b1a735d Michael Ellerman 2008-06-24 60 return 1;
9b1a735d Michael Ellerman 2008-06-24 61 }
9b1a735d Michael Ellerman 2008-06-24 62 }
9b1a735d Michael Ellerman 2008-06-24 63
9b1a735d Michael Ellerman 2008-06-24 64 patch_instruction(dest, instr);
9b1a735d Michael Ellerman 2008-06-24 65
9b1a735d Michael Ellerman 2008-06-24 66 return 0;
9b1a735d Michael Ellerman 2008-06-24 67 }
9b1a735d Michael Ellerman 2008-06-24 68
9b1a735d Michael Ellerman 2008-06-24 69 static int patch_feature_section(unsigned long value, struct fixup_entry *fcur)
9b1a735d Michael Ellerman 2008-06-24 70 {
9b1a735d Michael Ellerman 2008-06-24 71 unsigned int *start, *end, *alt_start, *alt_end, *src, *dest;
9b1a735d Michael Ellerman 2008-06-24 72
9b1a735d Michael Ellerman 2008-06-24 73 start = calc_addr(fcur, fcur->start_off);
9b1a735d Michael Ellerman 2008-06-24 74 end = calc_addr(fcur, fcur->end_off);
9b1a735d Michael Ellerman 2008-06-24 75 alt_start = calc_addr(fcur, fcur->alt_start_off);
9b1a735d Michael Ellerman 2008-06-24 76 alt_end = calc_addr(fcur, fcur->alt_end_off);
9b1a735d Michael Ellerman 2008-06-24 77
9b1a735d Michael Ellerman 2008-06-24 78 if ((alt_end - alt_start) > (end - start))
9b1a735d Michael Ellerman 2008-06-24 79 return 1;
51c52e86 Michael Ellerman 2008-06-24 80
51c52e86 Michael Ellerman 2008-06-24 81 if ((value & fcur->mask) == fcur->value)
9b1a735d Michael Ellerman 2008-06-24 82 return 0;
51c52e86 Michael Ellerman 2008-06-24 83
9b1a735d Michael Ellerman 2008-06-24 84 src = alt_start;
9b1a735d Michael Ellerman 2008-06-24 85 dest = start;
51c52e86 Michael Ellerman 2008-06-24 86
9b1a735d Michael Ellerman 2008-06-24 87 for (; src < alt_end; src++, dest++) {
9b1a735d Michael Ellerman 2008-06-24 88 if (patch_alt_instruction(src, dest, alt_start, alt_end))
9b1a735d Michael Ellerman 2008-06-24 89 return 1;
51c52e86 Michael Ellerman 2008-06-24 90 }
9b1a735d Michael Ellerman 2008-06-24 91
9b1a735d Michael Ellerman 2008-06-24 92 for (; dest < end; dest++)
16c57b36 Kumar Gala 2009-02-10 93 patch_instruction(dest, PPC_INST_NOP);
9b1a735d Michael Ellerman 2008-06-24 94
9b1a735d Michael Ellerman 2008-06-24 95 return 0;
51c52e86 Michael Ellerman 2008-06-24 96 }
51c52e86 Michael Ellerman 2008-06-24 97
51c52e86 Michael Ellerman 2008-06-24 98 void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
51c52e86 Michael Ellerman 2008-06-24 99 {
51c52e86 Michael Ellerman 2008-06-24 100 struct fixup_entry *fcur, *fend;
51c52e86 Michael Ellerman 2008-06-24 101
51c52e86 Michael Ellerman 2008-06-24 102 fcur = fixup_start;
51c52e86 Michael Ellerman 2008-06-24 103 fend = fixup_end;
51c52e86 Michael Ellerman 2008-06-24 104
9b1a735d Michael Ellerman 2008-06-24 105 for (; fcur < fend; fcur++) {
9b1a735d Michael Ellerman 2008-06-24 106 if (patch_feature_section(value, fcur)) {
1856c020 Michael Ellerman 2008-07-17 107 WARN_ON(1);
9b1a735d Michael Ellerman 2008-06-24 108 printk("Unable to patch feature section at %p - %p" \
9b1a735d Michael Ellerman 2008-06-24 109 " with %p - %p\n",
9b1a735d Michael Ellerman 2008-06-24 110 calc_addr(fcur, fcur->start_off),
9b1a735d Michael Ellerman 2008-06-24 111 calc_addr(fcur, fcur->end_off),
9b1a735d Michael Ellerman 2008-06-24 112 calc_addr(fcur, fcur->alt_start_off),
9b1a735d Michael Ellerman 2008-06-24 113 calc_addr(fcur, fcur->alt_end_off));
9b1a735d Michael Ellerman 2008-06-24 114 }
9b1a735d Michael Ellerman 2008-06-24 115 }
51c52e86 Michael Ellerman 2008-06-24 116 }
362e7701 Michael Ellerman 2008-06-24 117
2d1b2027 Kumar Gala 2008-07-02 118 void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end)
2d1b2027 Kumar Gala 2008-07-02 119 {
3d98ffbf Benjamin Herrenschmidt 2010-02-26 120 long *start, *end;
3d98ffbf Benjamin Herrenschmidt 2010-02-26 121 unsigned int *dest;
2d1b2027 Kumar Gala 2008-07-02 122
2d1b2027 Kumar Gala 2008-07-02 123 if (!(value & CPU_FTR_LWSYNC))
2d1b2027 Kumar Gala 2008-07-02 124 return ;
2d1b2027 Kumar Gala 2008-07-02 125
2d1b2027 Kumar Gala 2008-07-02 126 start = fixup_start;
2d1b2027 Kumar Gala 2008-07-02 127 end = fixup_end;
2d1b2027 Kumar Gala 2008-07-02 128
2d1b2027 Kumar Gala 2008-07-02 129 for (; start < end; start++) {
2d1b2027 Kumar Gala 2008-07-02 130 dest = (void *)start + *start;
16c57b36 Kumar Gala 2009-02-10 131 patch_instruction(dest, PPC_INST_LWSYNC);
2d1b2027 Kumar Gala 2008-07-02 132 }
2d1b2027 Kumar Gala 2008-07-02 133 }
2d1b2027 Kumar Gala 2008-07-02 134
9402c684 Benjamin Herrenschmidt 2016-07-05 135 static void do_final_fixups(void)
d715e433 Anton Blanchard 2011-11-14 136 {
d715e433 Anton Blanchard 2011-11-14 137 #if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE)
d715e433 Anton Blanchard 2011-11-14 138 int *src, *dest;
d715e433 Anton Blanchard 2011-11-14 139 unsigned long length;
d715e433 Anton Blanchard 2011-11-14 140
d715e433 Anton Blanchard 2011-11-14 141 if (PHYSICAL_START == 0)
d715e433 Anton Blanchard 2011-11-14 142 return;
d715e433 Anton Blanchard 2011-11-14 143
d715e433 Anton Blanchard 2011-11-14 144 src = (int *)(KERNELBASE + PHYSICAL_START);
d715e433 Anton Blanchard 2011-11-14 145 dest = (int *)KERNELBASE;
d715e433 Anton Blanchard 2011-11-14 146 length = (__end_interrupts - _stext) / sizeof(int);
d715e433 Anton Blanchard 2011-11-14 147
d715e433 Anton Blanchard 2011-11-14 148 while (length--) {
d715e433 Anton Blanchard 2011-11-14 149 patch_instruction(dest, *src);
d715e433 Anton Blanchard 2011-11-14 150 src++;
d715e433 Anton Blanchard 2011-11-14 151 dest++;
d715e433 Anton Blanchard 2011-11-14 152 }
d715e433 Anton Blanchard 2011-11-14 153 #endif
d715e433 Anton Blanchard 2011-11-14 154 }
d715e433 Anton Blanchard 2011-11-14 155
a28e46f1 Michael Ellerman 2016-07-26 156 static unsigned long __initdata saved_cpu_features;
a28e46f1 Michael Ellerman 2016-07-26 157 static unsigned int __initdata saved_mmu_features;
a28e46f1 Michael Ellerman 2016-07-26 158 #ifdef CONFIG_PPC64
a28e46f1 Michael Ellerman 2016-07-26 159 static unsigned long __initdata saved_firmware_features;
a28e46f1 Michael Ellerman 2016-07-26 160 #endif
a28e46f1 Michael Ellerman 2016-07-26 161
a28e46f1 Michael Ellerman 2016-07-26 162 void __init apply_feature_fixups(void)
9402c684 Benjamin Herrenschmidt 2016-07-05 163 {
2c0f9951 Benjamin Herrenschmidt 2016-08-02 164 struct cpu_spec *spec = PTRRELOC(*PTRRELOC(&cur_cpu_spec));
9402c684 Benjamin Herrenschmidt 2016-07-05 165
a28e46f1 Michael Ellerman 2016-07-26 166 *PTRRELOC(&saved_cpu_features) = spec->cpu_features;
a28e46f1 Michael Ellerman 2016-07-26 167 *PTRRELOC(&saved_mmu_features) = spec->mmu_features;
a28e46f1 Michael Ellerman 2016-07-26 168
9402c684 Benjamin Herrenschmidt 2016-07-05 169 /*
9402c684 Benjamin Herrenschmidt 2016-07-05 170 * Apply the CPU-specific and firmware specific fixups to kernel text
9402c684 Benjamin Herrenschmidt 2016-07-05 171 * (nop out sections not relevant to this CPU or this firmware).
9402c684 Benjamin Herrenschmidt 2016-07-05 172 */
9402c684 Benjamin Herrenschmidt 2016-07-05 173 do_feature_fixups(spec->cpu_features,
9402c684 Benjamin Herrenschmidt 2016-07-05 174 PTRRELOC(&__start___ftr_fixup),
9402c684 Benjamin Herrenschmidt 2016-07-05 175 PTRRELOC(&__stop___ftr_fixup));
9402c684 Benjamin Herrenschmidt 2016-07-05 176
9402c684 Benjamin Herrenschmidt 2016-07-05 177 do_feature_fixups(spec->mmu_features,
9402c684 Benjamin Herrenschmidt 2016-07-05 @178 PTRRELOC(&__start___mmu_ftr_fixup),
9402c684 Benjamin Herrenschmidt 2016-07-05 @179 PTRRELOC(&__stop___mmu_ftr_fixup));
9402c684 Benjamin Herrenschmidt 2016-07-05 180
9402c684 Benjamin Herrenschmidt 2016-07-05 181 do_lwsync_fixups(spec->cpu_features,
9402c684 Benjamin Herrenschmidt 2016-07-05 182 PTRRELOC(&__start___lwsync_fixup),
9402c684 Benjamin Herrenschmidt 2016-07-05 183 PTRRELOC(&__stop___lwsync_fixup));
9402c684 Benjamin Herrenschmidt 2016-07-05 184
9402c684 Benjamin Herrenschmidt 2016-07-05 185 #ifdef CONFIG_PPC64
a28e46f1 Michael Ellerman 2016-07-26 186 saved_firmware_features = powerpc_firmware_features;
9402c684 Benjamin Herrenschmidt 2016-07-05 187 do_feature_fixups(powerpc_firmware_features,
9402c684 Benjamin Herrenschmidt 2016-07-05 188 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
9402c684 Benjamin Herrenschmidt 2016-07-05 189 #endif
9402c684 Benjamin Herrenschmidt 2016-07-05 190 do_final_fixups();
97f6e0cc Benjamin Herrenschmidt 2016-08-10 191 }
309b315b Aneesh Kumar K.V 2016-07-23 192
97f6e0cc Benjamin Herrenschmidt 2016-08-10 193 void __init setup_feature_keys(void)
97f6e0cc Benjamin Herrenschmidt 2016-08-10 194 {
309b315b Aneesh Kumar K.V 2016-07-23 195 /*
309b315b Aneesh Kumar K.V 2016-07-23 196 * Initialise jump label. This causes all the cpu/mmu_has_feature()
309b315b Aneesh Kumar K.V 2016-07-23 197 * checks to take on their correct polarity based on the current set of
309b315b Aneesh Kumar K.V 2016-07-23 198 * CPU/MMU features.
309b315b Aneesh Kumar K.V 2016-07-23 199 */
309b315b Aneesh Kumar K.V 2016-07-23 200 jump_label_init();
4db73271 Kevin Hao 2016-07-23 201 cpu_feature_keys_init();
c12e6f24 Kevin Hao 2016-07-23 @202 mmu_feature_keys_init();
9402c684 Benjamin Herrenschmidt 2016-07-05 203 }
9402c684 Benjamin Herrenschmidt 2016-07-05 204
a28e46f1 Michael Ellerman 2016-07-26 205 static int __init check_features(void)

:::::: The code at line 178 was first introduced by commit
:::::: 9402c684613163888714df0955fa1f17142b08bf powerpc: Factor do_feature_fixup calls

:::::: TO: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
:::::: CC: Michael Ellerman <mpe@xxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip