diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-02 20:20:12 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-02 20:20:12 -0700 |
commit | f5a8eb632b562bd9c16c389f5db3a5260fba4157 (patch) | |
tree | 82687234d772ff8f72a31e598fe16553885c56c9 /arch/blackfin/kernel/module.c | |
parent | c9297d284126b80c9cfd72c690e0da531c99fc48 (diff) | |
parent | dd3b8c329aa270027fba61a02a12600972dc3983 (diff) |
Merge tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pul removal of obsolete architecture ports from Arnd Bergmann:
"This removes the entire architecture code for blackfin, cris, frv,
m32r, metag, mn10300, score, and tile, including the associated device
drivers.
I have been working with the (former) maintainers for each one to
ensure that my interpretation was right and the code is definitely
unused in mainline kernels. Many had fond memories of working on the
respective ports to start with and getting them included in upstream,
but also saw no point in keeping the port alive without any users.
In the end, it seems that while the eight architectures are extremely
different, they all suffered the same fate: There was one company in
charge of an SoC line, a CPU microarchitecture and a software
ecosystem, which was more costly than licensing newer off-the-shelf
CPU cores from a third party (typically ARM, MIPS, or RISC-V). It
seems that all the SoC product lines are still around, but have not
used the custom CPU architectures for several years at this point. In
contrast, CPU instruction sets that remain popular and have actively
maintained kernel ports tend to all be used across multiple licensees.
[ See the new nds32 port merged in the previous commit for the next
generation of "one company in charge of an SoC line, a CPU
microarchitecture and a software ecosystem" - Linus ]
The removal came out of a discussion that is now documented at
https://lwn.net/Articles/748074/. Unlike the original plans, I'm not
marking any ports as deprecated but remove them all at once after I
made sure that they are all unused. Some architectures (notably tile,
mn10300, and blackfin) are still being shipped in products with old
kernels, but those products will never be updated to newer kernel
releases.
After this series, we still have a few architectures without mainline
gcc support:
- unicore32 and hexagon both have very outdated gcc releases, but the
maintainers promised to work on providing something newer. At least
in case of hexagon, this will only be llvm, not gcc.
- openrisc, risc-v and nds32 are still in the process of finishing
their support or getting it added to mainline gcc in the first
place. They all have patched gcc-7.3 ports that work to some
degree, but complete upstream support won't happen before gcc-8.1.
Csky posted their first kernel patch set last week, their situation
will be similar
[ Palmer Dabbelt points out that RISC-V support is in mainline gcc
since gcc-7, although gcc-7.3.0 is the recommended minimum - Linus ]"
This really says it all:
2498 files changed, 95 insertions(+), 467668 deletions(-)
* tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (74 commits)
MAINTAINERS: UNICORE32: Change email account
staging: iio: remove iio-trig-bfin-timer driver
tty: hvc: remove tile driver
tty: remove bfin_jtag_comm and hvc_bfin_jtag drivers
serial: remove tile uart driver
serial: remove m32r_sio driver
serial: remove blackfin drivers
serial: remove cris/etrax uart drivers
usb: Remove Blackfin references in USB support
usb: isp1362: remove blackfin arch glue
usb: musb: remove blackfin port
usb: host: remove tilegx platform glue
pwm: remove pwm-bfin driver
i2c: remove bfin-twi driver
spi: remove blackfin related host drivers
watchdog: remove bfin_wdt driver
can: remove bfin_can driver
mmc: remove bfin_sdh driver
input: misc: remove blackfin rotary driver
input: keyboard: remove bf54x driver
...
Diffstat (limited to 'arch/blackfin/kernel/module.c')
-rw-r--r-- | arch/blackfin/kernel/module.c | 292 |
1 files changed, 0 insertions, 292 deletions
diff --git a/arch/blackfin/kernel/module.c b/arch/blackfin/kernel/module.c deleted file mode 100644 index 15af5768c403..000000000000 --- a/arch/blackfin/kernel/module.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright 2004-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later - */ - -#include <linux/moduleloader.h> -#include <linux/elf.h> -#include <linux/vmalloc.h> -#include <linux/fs.h> -#include <linux/string.h> -#include <linux/kernel.h> -#include <asm/dma.h> -#include <asm/cacheflush.h> -#include <linux/uaccess.h> - -#define mod_err(mod, fmt, ...) \ - pr_err("module %s: " fmt, (mod)->name, ##__VA_ARGS__) -#define mod_debug(mod, fmt, ...) \ - pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__) - -/* Transfer the section to the L1 memory */ -int -module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, - char *secstrings, struct module *mod) -{ - /* - * XXX: sechdrs are vmalloced in kernel/module.c - * and would be vfreed just after module is loaded, - * so we hack to keep the only information we needed - * in mod->arch to correctly free L1 I/D sram later. - * NOTE: this breaks the semantic of mod->arch structure. - */ - Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; - void *dest; - - for (s = sechdrs; s < sechdrs_end; ++s) { - const char *shname = secstrings + s->sh_name; - - if (s->sh_size == 0) - continue; - - if (!strcmp(".l1.text", shname) || - (!strcmp(".text", shname) && - (hdr->e_flags & EF_BFIN_CODE_IN_L1))) { - - dest = l1_inst_sram_alloc(s->sh_size); - mod->arch.text_l1 = dest; - if (dest == NULL) { - mod_err(mod, "L1 inst memory allocation failed\n"); - return -1; - } - dma_memcpy(dest, (void *)s->sh_addr, s->sh_size); - - } else if (!strcmp(".l1.data", shname) || - (!strcmp(".data", shname) && - (hdr->e_flags & EF_BFIN_DATA_IN_L1))) { - - dest = l1_data_sram_alloc(s->sh_size); - mod->arch.data_a_l1 = dest; - if (dest == NULL) { - mod_err(mod, "L1 data memory allocation failed\n"); - return -1; - } - memcpy(dest, (void *)s->sh_addr, s->sh_size); - - } else if (!strcmp(".l1.bss", shname) || - (!strcmp(".bss", shname) && - (hdr->e_flags & EF_BFIN_DATA_IN_L1))) { - - dest = l1_data_sram_zalloc(s->sh_size); - mod->arch.bss_a_l1 = dest; - if (dest == NULL) { - mod_err(mod, "L1 data memory allocation failed\n"); - return -1; - } - - } else if (!strcmp(".l1.data.B", shname)) { - - dest = l1_data_B_sram_alloc(s->sh_size); - mod->arch.data_b_l1 = dest; - if (dest == NULL) { - mod_err(mod, "L1 data memory allocation failed\n"); - return -1; - } - memcpy(dest, (void *)s->sh_addr, s->sh_size); - - } else if (!strcmp(".l1.bss.B", shname)) { - - dest = l1_data_B_sram_alloc(s->sh_size); - mod->arch.bss_b_l1 = dest; - if (dest == NULL) { - mod_err(mod, "L1 data memory allocation failed\n"); - return -1; - } - memset(dest, 0, s->sh_size); - - } else if (!strcmp(".l2.text", shname) || - (!strcmp(".text", shname) && - (hdr->e_flags & EF_BFIN_CODE_IN_L2))) { - - dest = l2_sram_alloc(s->sh_size); - mod->arch.text_l2 = dest; - if (dest == NULL) { - mod_err(mod, "L2 SRAM allocation failed\n"); - return -1; - } - memcpy(dest, (void *)s->sh_addr, s->sh_size); - - } else if (!strcmp(".l2.data", shname) || - (!strcmp(".data", shname) && - (hdr->e_flags & EF_BFIN_DATA_IN_L2))) { - - dest = l2_sram_alloc(s->sh_size); - mod->arch.data_l2 = dest; - if (dest == NULL) { - mod_err(mod, "L2 SRAM allocation failed\n"); - return -1; - } - memcpy(dest, (void *)s->sh_addr, s->sh_size); - - } else if (!strcmp(".l2.bss", shname) || - (!strcmp(".bss", shname) && - (hdr->e_flags & EF_BFIN_DATA_IN_L2))) { - - dest = l2_sram_zalloc(s->sh_size); - mod->arch.bss_l2 = dest; - if (dest == NULL) { - mod_err(mod, "L2 SRAM allocation failed\n"); - return -1; - } - - } else - continue; - - s->sh_flags &= ~SHF_ALLOC; - s->sh_addr = (unsigned long)dest; - } - - return 0; -} - -/*************************************************************************/ -/* FUNCTION : apply_relocate_add */ -/* ABSTRACT : Blackfin specific relocation handling for the loadable */ -/* modules. Modules are expected to be .o files. */ -/* Arithmetic relocations are handled. */ -/* We do not expect LSETUP to be split and hence is not */ -/* handled. */ -/* R_BFIN_BYTE and R_BFIN_BYTE2 are also not handled as the */ -/* gas does not generate it. */ -/*************************************************************************/ -int -apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, - unsigned int symindex, unsigned int relsec, - struct module *mod) -{ - unsigned int i; - Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; - Elf32_Sym *sym; - unsigned long location, value, size; - - mod_debug(mod, "applying relocate section %u to %u\n", - relsec, sechdrs[relsec].sh_info); - - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { - /* This is where to make the change */ - location = sechdrs[sechdrs[relsec].sh_info].sh_addr + - rel[i].r_offset; - - /* This is the symbol it is referring to. Note that all - undefined symbols have been resolved. */ - sym = (Elf32_Sym *) sechdrs[symindex].sh_addr - + ELF32_R_SYM(rel[i].r_info); - value = sym->st_value; - value += rel[i].r_addend; - -#ifdef CONFIG_SMP - if (location >= COREB_L1_DATA_A_START) { - mod_err(mod, "cannot relocate in L1: %u (SMP kernel)\n", - ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - } -#endif - - mod_debug(mod, "location is %lx, value is %lx type is %d\n", - location, value, ELF32_R_TYPE(rel[i].r_info)); - - switch (ELF32_R_TYPE(rel[i].r_info)) { - - case R_BFIN_HUIMM16: - value >>= 16; - case R_BFIN_LUIMM16: - case R_BFIN_RIMM16: - size = 2; - break; - case R_BFIN_BYTE4_DATA: - size = 4; - break; - - case R_BFIN_PCREL24: - case R_BFIN_PCREL24_JUMP_L: - case R_BFIN_PCREL12_JUMP: - case R_BFIN_PCREL12_JUMP_S: - case R_BFIN_PCREL10: - mod_err(mod, "unsupported relocation: %u (no -mlong-calls?)\n", - ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - - default: - mod_err(mod, "unknown relocation: %u\n", - ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - } - - switch (bfin_mem_access_type(location, size)) { - case BFIN_MEM_ACCESS_CORE: - case BFIN_MEM_ACCESS_CORE_ONLY: - memcpy((void *)location, &value, size); - break; - case BFIN_MEM_ACCESS_DMA: - dma_memcpy((void *)location, &value, size); - break; - case BFIN_MEM_ACCESS_ITEST: - isram_memcpy((void *)location, &value, size); - break; - default: - mod_err(mod, "invalid relocation for %#lx\n", location); - return -ENOEXEC; - } - } - - return 0; -} - -int -module_finalize(const Elf_Ehdr * hdr, - const Elf_Shdr * sechdrs, struct module *mod) -{ - unsigned int i, strindex = 0, symindex = 0; - char *secstrings; - long err = 0; - - secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; - - for (i = 1; i < hdr->e_shnum; i++) { - /* Internal symbols and strings. */ - if (sechdrs[i].sh_type == SHT_SYMTAB) { - symindex = i; - strindex = sechdrs[i].sh_link; - } - } - - for (i = 1; i < hdr->e_shnum; i++) { - const char *strtab = (char *)sechdrs[strindex].sh_addr; - unsigned int info = sechdrs[i].sh_info; - const char *shname = secstrings + sechdrs[i].sh_name; - - /* Not a valid relocation section? */ - if (info >= hdr->e_shnum) - continue; - - /* Only support RELA relocation types */ - if (sechdrs[i].sh_type != SHT_RELA) - continue; - - if (!strcmp(".rela.l2.text", shname) || - !strcmp(".rela.l1.text", shname) || - (!strcmp(".rela.text", shname) && - (hdr->e_flags & (EF_BFIN_CODE_IN_L1 | EF_BFIN_CODE_IN_L2)))) { - - err = apply_relocate_add((Elf_Shdr *) sechdrs, strtab, - symindex, i, mod); - if (err < 0) - return -ENOEXEC; - } - } - - return 0; -} - -void module_arch_cleanup(struct module *mod) -{ - l1_inst_sram_free(mod->arch.text_l1); - l1_data_A_sram_free(mod->arch.data_a_l1); - l1_data_A_sram_free(mod->arch.bss_a_l1); - l1_data_B_sram_free(mod->arch.data_b_l1); - l1_data_B_sram_free(mod->arch.bss_b_l1); - l2_sram_free(mod->arch.text_l2); - l2_sram_free(mod->arch.data_l2); - l2_sram_free(mod->arch.bss_l2); -} |