[mmotm:master 125/157] arch/powerpc/kernel/machine_kexec_64.c:420:29: error: 'kexec_file_loaders' undeclared

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://git.cmpxchg.org/linux-mmotm.git master
head:   fe4cd888f71ef173e0e5a0f9dccc42904c0107f3
commit: a9575b2675ab592db97df85078d2f7745ca31233 [125/157] powerpc: implement kexec_file_load
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-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 a9575b2675ab592db97df85078d2f7745ca31233
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/list.h:8:0,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from arch/powerpc/include/asm/io.h:27,
                    from include/linux/kexec.h:17,
                    from arch/powerpc/kernel/machine_kexec_64.c:13:
   arch/powerpc/kernel/machine_kexec_64.c: In function 'arch_kexec_kernel_image_probe':
>> arch/powerpc/kernel/machine_kexec_64.c:420:29: error: 'kexec_file_loaders' undeclared (first use in this function)
     for (i = 0; i < ARRAY_SIZE(kexec_file_loaders); i++) {
                                ^
   include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                    ^~~
   arch/powerpc/kernel/machine_kexec_64.c:420:29: note: each undeclared identifier is reported only once for each function it appears in
     for (i = 0; i < ARRAY_SIZE(kexec_file_loaders); i++) {
                                ^
   include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                    ^~~
   In file included from arch/powerpc/include/asm/mmu.h:115:0,
                    from arch/powerpc/include/asm/lppaca.h:36,
                    from arch/powerpc/include/asm/paca.h:21,
                    from arch/powerpc/include/asm/current.h:16,
                    from include/linux/mutex.h:13,
                    from include/linux/kernfs.h:13,
                    from include/linux/sysfs.h:15,
                    from include/linux/kobject.h:21,
                    from include/linux/device.h:17,
                    from arch/powerpc/include/asm/io.h:27,
                    from include/linux/kexec.h:17,
                    from arch/powerpc/kernel/machine_kexec_64.c:13:
   include/linux/bug.h:37:45: error: bit-field '<anonymous>' width not an integer constant
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^~~~~~~~~~~~~~~
>> arch/powerpc/kernel/machine_kexec_64.c:420:18: note: in expansion of macro 'ARRAY_SIZE'
     for (i = 0; i < ARRAY_SIZE(kexec_file_loaders); i++) {
                     ^~~~~~~~~~
   arch/powerpc/kernel/machine_kexec_64.c: In function 'setup_purgatory':
>> arch/powerpc/kernel/machine_kexec_64.c:568:27: error: 'SLAVE_CODE_SIZE' undeclared (first use in this function)
     slave_code_buf = kmalloc(SLAVE_CODE_SIZE, GFP_KERNEL);
                              ^~~~~~~~~~~~~~~

vim +/kexec_file_loaders +420 arch/powerpc/kernel/machine_kexec_64.c

   414		struct kexec_file_ops *fops;
   415	
   416		/* We don't support crash kernels yet. */
   417		if (image->type == KEXEC_TYPE_CRASH)
   418			return -ENOTSUPP;
   419	
 > 420		for (i = 0; i < ARRAY_SIZE(kexec_file_loaders); i++) {
   421			fops = kexec_file_loaders[i];
   422			if (!fops || !fops->probe)
   423				continue;
   424	
   425			ret = fops->probe(buf, buf_len);
   426			if (!ret) {
   427				image->fops = fops;
   428				return ret;
   429			}
   430		}
   431	
   432		return ret;
   433	}
   434	
   435	void *arch_kexec_kernel_image_load(struct kimage *image)
   436	{
   437		if (!image->fops || !image->fops->load)
   438			return ERR_PTR(-ENOEXEC);
   439	
   440		return image->fops->load(image, image->kernel_buf,
   441					 image->kernel_buf_len, image->initrd_buf,
   442					 image->initrd_buf_len, image->cmdline_buf,
   443					 image->cmdline_buf_len);
   444	}
   445	
   446	int arch_kimage_file_post_load_cleanup(struct kimage *image)
   447	{
   448		if (!image->fops || !image->fops->cleanup)
   449			return 0;
   450	
   451		return image->fops->cleanup(image->image_loader_data);
   452	}
   453	
   454	/**
   455	 * arch_kexec_walk_mem() - call func(data) for each unreserved memory block
   456	 * @kbuf:	Context info for the search. Also passed to @func.
   457	 * @func:	Function to call for each memory block.
   458	 *
   459	 * This function is used by kexec_add_buffer and kexec_locate_mem_hole
   460	 * to find unreserved memory to load kexec segments into.
   461	 *
   462	 * Return: The memory walk will stop when func returns a non-zero value
   463	 * and that value will be returned. If all free regions are visited without
   464	 * func returning non-zero, then zero will be returned.
   465	 */
   466	int arch_kexec_walk_mem(struct kexec_buf *kbuf, int (*func)(u64, u64, void *))
   467	{
   468		int ret = 0;
   469		u64 i;
   470		phys_addr_t mstart, mend;
   471	
   472		if (kbuf->top_down) {
   473			for_each_free_mem_range_reverse(i, NUMA_NO_NODE, 0,
   474							&mstart, &mend, NULL) {
   475				/*
   476				 * In memblock, end points to the first byte after the
   477				 * range while in kexec, end points to the last byte
   478				 * in the range.
   479				 */
   480				ret = func(mstart, mend - 1, kbuf);
   481				if (ret)
   482					break;
   483			}
   484		} else {
   485			for_each_free_mem_range(i, NUMA_NO_NODE, 0, &mstart, &mend,
   486						NULL) {
   487				/*
   488				 * In memblock, end points to the first byte after the
   489				 * range while in kexec, end points to the last byte
   490				 * in the range.
   491				 */
   492				ret = func(mstart, mend - 1, kbuf);
   493				if (ret)
   494					break;
   495			}
   496		}
   497	
   498		return ret;
   499	}
   500	
   501	/**
   502	 * arch_kexec_apply_relocations_add() - apply purgatory relocations
   503	 * @ehdr:	Pointer to ELF headers.
   504	 * @sechdrs:	Pointer to section headers.
   505	 * @relsec:	Section index of SHT_RELA section.
   506	 *
   507	 * Elf64_Shdr.sh_offset has been modified to keep the pointer to the section
   508	 * contents, while Elf64_Shdr.sh_addr points to the final address of the
   509	 * section in memory.
   510	 */
   511	int arch_kexec_apply_relocations_add(const Elf64_Ehdr *ehdr,
   512					     Elf64_Shdr *sechdrs, unsigned int relsec)
   513	{
   514		/* Section containing the relocation entries. */
   515		Elf64_Shdr *rel_section = &sechdrs[relsec];
   516		const Elf64_Rela *rela = (const Elf64_Rela *) rel_section->sh_offset;
   517		unsigned int num_rela = rel_section->sh_size / sizeof(Elf64_Rela);
   518		/* Section to which relocations apply. */
   519		Elf64_Shdr *target_section = &sechdrs[rel_section->sh_info];
   520		/* Associated symbol table. */
   521		Elf64_Shdr *symtabsec = &sechdrs[rel_section->sh_link];
   522		void *syms_base = (void *) symtabsec->sh_offset;
   523		void *loc_base = (void *) target_section->sh_offset;
   524		Elf64_Addr addr_base = target_section->sh_addr;
   525		struct elf_info elf_info;
   526		const char *strtab;
   527	
   528		if (symtabsec->sh_link >= ehdr->e_shnum) {
   529			/* Invalid strtab section number */
   530			pr_err("Invalid string table section index %d\n",
   531			       symtabsec->sh_link);
   532			return -ENOEXEC;
   533		}
   534		/* String table for the associated symbol table. */
   535		strtab = (const char *) sechdrs[symtabsec->sh_link].sh_offset;
   536	
   537		elf_init_elf_info(ehdr, sechdrs, &elf_info);
   538	
   539		return elf64_apply_relocate_add(&elf_info, strtab, rela, num_rela,
   540						syms_base, loc_base, addr_base,
   541						true, true, "kexec purgatory");
   542	}
   543	
   544	/**
   545	 * setup_purgatory() - setup the purgatory runtime variables
   546	 * @image:		kexec image.
   547	 * @slave_code:		Slave code for the purgatory.
   548	 * @fdt:		Flattened device tree for the next kernel.
   549	 * @kernel_load_addr:	Address where the kernel is loaded.
   550	 * @fdt_load_addr:	Address where the flattened device tree is loaded.
   551	 * @stack_top:		Address where the purgatory can place its stack.
   552	 * @debug:		Can the purgatory print messages to the console?
   553	 *
   554	 * Return: 0 on success, or negative errno on error.
   555	 */
   556	int setup_purgatory(struct kimage *image, const void *slave_code,
   557			    const void *fdt, unsigned long kernel_load_addr,
   558			    unsigned long fdt_load_addr, unsigned long stack_top,
   559			    int debug)
   560	{
   561		int ret, tree_node;
   562		const void *prop;
   563		unsigned long opal_base, opal_entry;
   564		uint64_t toc;
   565		unsigned int *slave_code_buf, master_entry;
   566		struct elf_info purg_info;
   567	
 > 568		slave_code_buf = kmalloc(SLAVE_CODE_SIZE, GFP_KERNEL);
   569		if (!slave_code_buf)
   570			return -ENOMEM;
   571	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]