Skip to content

Commit 1308fd7

Browse files
committed
Merge tag 'arc-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC updates from Vineet Gupta: - support IDU intc for UP builds - support gz, lzma compressed uImage [Daniel Mentz] - adjust /proc/cpuinfo for non-continuous cpu ids [Noam Camus] - syscall for userspace cmpxchg assist for configs lacking hardware atomics - rework of boot log printing mainly for identifying older arc700 cores - retiring some old code, build toggles * tag 'arc-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: module: print pretty section names ARC: module: elide loop to save reference to .eh_frame ARC: mm: retire ARC_DBG_TLB_MISS_COUNT... ARC: build: retire old toggles ARC: boot log: refactor cpu name/release printing ARC: boot log: remove awkward space comma from MMU line ARC: boot log: don't assume SWAPE instruction support ARC: boot log: refactor printing abt features not captured in BCRs ARCv2: boot log: print IOC exists as well as enabled status ARCv2: IOC: use @ioc_enable not @ioc_exist where intended ARC: syscall for userspace cmpxchg assist ARC: fix build warning in elf.h ARC: Adjust cpuinfo for non-continuous cpu ids ARC: [build] Support gz, lzma compressed uImage ARCv2: intc: untangle SMP, MCIP and IDU
2 parents 6fcc8ce + b75dcd9 commit 1308fd7

File tree

20 files changed

+203
-273
lines changed

20 files changed

+203
-273
lines changed

arch/arc/Kconfig

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ config ARC
4141
select PERF_USE_VMALLOC
4242
select HAVE_DEBUG_STACKOVERFLOW
4343
select HAVE_GENERIC_DMA_COHERENT
44+
select HAVE_KERNEL_GZIP
45+
select HAVE_KERNEL_LZMA
4446

4547
config MIGHT_HAVE_PCI
4648
bool
@@ -186,14 +188,6 @@ if SMP
186188
config ARC_HAS_COH_CACHES
187189
def_bool n
188190

189-
config ARC_MCIP
190-
bool "ARConnect Multicore IP (MCIP) Support "
191-
depends on ISA_ARCV2
192-
help
193-
This IP block enables SMP in ARC-HS38 cores.
194-
It provides for cross-core interrupts, multi-core debug
195-
hardware semaphores, shared memory,....
196-
197191
config NR_CPUS
198192
int "Maximum number of CPUs (2-4096)"
199193
range 2 4096
@@ -211,6 +205,15 @@ config ARC_SMP_HALT_ON_RESET
211205

212206
endif #SMP
213207

208+
config ARC_MCIP
209+
bool "ARConnect Multicore IP (MCIP) Support "
210+
depends on ISA_ARCV2
211+
default y if SMP
212+
help
213+
This IP block enables SMP in ARC-HS38 cores.
214+
It provides for cross-core interrupts, multi-core debug
215+
hardware semaphores, shared memory,....
216+
214217
menuconfig ARC_CACHE
215218
bool "Enable Cache Support"
216219
default y
@@ -537,14 +540,6 @@ config ARC_DBG_TLB_PARANOIA
537540
bool "Paranoia Checks in Low Level TLB Handlers"
538541
default n
539542

540-
config ARC_DBG_TLB_MISS_COUNT
541-
bool "Profile TLB Misses"
542-
default n
543-
select DEBUG_FS
544-
help
545-
Counts number of I and D TLB Misses and exports them via Debugfs
546-
The counters can be cleared via Debugfs as well
547-
548543
endif
549544

550545
config ARC_UBOOT_SUPPORT

arch/arc/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y)
5050

5151
cflags-$(atleast_gcc44) += -fsection-anchors
5252

53-
cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
54-
cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
55-
5653
ifdef CONFIG_ISA_ARCV2
5754

5855
ifndef CONFIG_ARC_HAS_LL64

arch/arc/boot/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,34 @@ UIMAGE_ENTRYADDR = $(LINUX_START_TEXT)
1414

1515
suffix-y := bin
1616
suffix-$(CONFIG_KERNEL_GZIP) := gz
17+
suffix-$(CONFIG_KERNEL_LZMA) := lzma
1718

18-
targets += uImage uImage.bin uImage.gz
19-
extra-y += vmlinux.bin vmlinux.bin.gz
19+
targets += uImage
20+
targets += uImage.bin
21+
targets += uImage.gz
22+
targets += uImage.lzma
23+
extra-y += vmlinux.bin
24+
extra-y += vmlinux.bin.gz
25+
extra-y += vmlinux.bin.lzma
2026

2127
$(obj)/vmlinux.bin: vmlinux FORCE
2228
$(call if_changed,objcopy)
2329

2430
$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
2531
$(call if_changed,gzip)
2632

33+
$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
34+
$(call if_changed,lzma)
35+
2736
$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
2837
$(call if_changed,uimage,none)
2938

3039
$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
3140
$(call if_changed,uimage,gzip)
3241

42+
$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
43+
$(call if_changed,uimage,lzma)
44+
3345
$(obj)/uImage: $(obj)/uImage.$(suffix-y)
3446
@ln -sf $(notdir $<) $@
3547
@echo ' Image $@ is ready'

arch/arc/include/asm/arcregs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,11 @@ struct cpuinfo_arc {
349349
struct cpuinfo_arc_bpu bpu;
350350
struct bcr_identity core;
351351
struct bcr_isa isa;
352+
const char *details, *name;
352353
unsigned int vec_base;
353354
struct cpuinfo_arc_ccm iccm, dccm;
354355
struct {
355-
unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, pad1:3,
356+
unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2,
356357
fpu_sp:1, fpu_dp:1, pad2:6,
357358
debug:1, ap:1, smart:1, rtt:1, pad3:4,
358359
timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4;

arch/arc/include/asm/cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extern void arc_cache_init(void);
5353
extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
5454
extern void read_decode_cache_bcr(void);
5555

56-
extern int ioc_exists;
56+
extern int ioc_enable;
5757
extern unsigned long perip_base, perip_end;
5858

5959
#endif /* !__ASSEMBLY__ */

arch/arc/include/asm/elf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extern int elf_check_arch(const struct elf32_hdr *);
5454
* the loader. We need to make sure that it is out of the way of the program
5555
* that it will "exec", and that there is sufficient room for the brk.
5656
*/
57-
#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
57+
#define ELF_ET_DYN_BASE (2UL * TASK_SIZE / 3)
5858

5959
/*
6060
* When the program starts, a1 contains a pointer to a function to be

arch/arc/include/asm/mcip.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ struct mcip_cmd {
5555
#define IDU_M_DISTRI_DEST 0x2
5656
};
5757

58+
struct mcip_bcr {
59+
#ifdef CONFIG_CPU_BIG_ENDIAN
60+
unsigned int pad3:8,
61+
idu:1, llm:1, num_cores:6,
62+
iocoh:1, gfrc:1, dbg:1, pad2:1,
63+
msg:1, sem:1, ipi:1, pad:1,
64+
ver:8;
65+
#else
66+
unsigned int ver:8,
67+
pad:1, ipi:1, sem:1, msg:1,
68+
pad2:1, dbg:1, gfrc:1, iocoh:1,
69+
num_cores:6, llm:1, idu:1,
70+
pad3:8;
71+
#endif
72+
};
73+
5874
/*
5975
* MCIP programming model
6076
*

arch/arc/include/asm/module.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
struct mod_arch_specific {
1919
void *unw_info;
2020
int unw_sec_idx;
21+
const char *secstr;
2122
};
2223
#endif
2324

arch/arc/include/asm/setup.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ struct id_to_str {
2727
const char *str;
2828
};
2929

30-
struct cpuinfo_data {
31-
struct id_to_str info;
32-
int up_range;
33-
};
34-
3530
extern int root_mountflags, end_mem;
3631

3732
void setup_processor(void);
@@ -43,5 +38,6 @@ void __init setup_arch_memory(void);
4338
#define IS_USED_RUN(v) ((v) ? "" : "(not used) ")
4439
#define IS_USED_CFG(cfg) IS_USED_RUN(IS_ENABLED(cfg))
4540
#define IS_AVAIL2(v, s, cfg) IS_AVAIL1(v, s), IS_AVAIL1(v, IS_USED_CFG(cfg))
41+
#define IS_AVAIL3(v, v2, s) IS_AVAIL1(v, s), IS_AVAIL1(v, IS_DISABLED_RUN(v2))
4642

4743
#endif /* __ASMARC_SETUP_H */

arch/arc/include/asm/syscalls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ int sys_clone_wrapper(int, int, int, int, int);
1717
int sys_cacheflush(uint32_t, uint32_t uint32_t);
1818
int sys_arc_settls(void *);
1919
int sys_arc_gettls(void);
20+
int sys_arc_usr_cmpxchg(int *, int, int);
2021

2122
#include <asm-generic/syscalls.h>
2223

arch/arc/include/uapi/asm/unistd.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@
2727

2828
#define NR_syscalls __NR_syscalls
2929

30+
/* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
31+
#define __NR_sysfs (__NR_arch_specific_syscall + 3)
32+
3033
/* ARC specific syscall */
3134
#define __NR_cacheflush (__NR_arch_specific_syscall + 0)
3235
#define __NR_arc_settls (__NR_arch_specific_syscall + 1)
3336
#define __NR_arc_gettls (__NR_arch_specific_syscall + 2)
37+
#define __NR_arc_usr_cmpxchg (__NR_arch_specific_syscall + 4)
3438

3539
__SYSCALL(__NR_cacheflush, sys_cacheflush)
3640
__SYSCALL(__NR_arc_settls, sys_arc_settls)
3741
__SYSCALL(__NR_arc_gettls, sys_arc_gettls)
38-
39-
40-
/* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
41-
#define __NR_sysfs (__NR_arch_specific_syscall + 3)
42+
__SYSCALL(__NR_arc_usr_cmpxchg, sys_arc_usr_cmpxchg)
4243
__SYSCALL(__NR_sysfs, sys_sysfs)
4344

4445
#undef __SYSCALL

arch/arc/kernel/mcip.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
#include <asm/mcip.h>
1616
#include <asm/setup.h>
1717

18-
static char smp_cpuinfo_buf[128];
19-
static int idu_detected;
20-
2118
static DEFINE_RAW_SPINLOCK(mcip_lock);
2219

20+
#ifdef CONFIG_SMP
21+
22+
static char smp_cpuinfo_buf[128];
23+
2324
static void mcip_setup_per_cpu(int cpu)
2425
{
2526
smp_ipi_irq_setup(cpu, IPI_IRQ);
@@ -86,21 +87,7 @@ static void mcip_ipi_clear(int irq)
8687

8788
static void mcip_probe_n_setup(void)
8889
{
89-
struct mcip_bcr {
90-
#ifdef CONFIG_CPU_BIG_ENDIAN
91-
unsigned int pad3:8,
92-
idu:1, llm:1, num_cores:6,
93-
iocoh:1, gfrc:1, dbg:1, pad2:1,
94-
msg:1, sem:1, ipi:1, pad:1,
95-
ver:8;
96-
#else
97-
unsigned int ver:8,
98-
pad:1, ipi:1, sem:1, msg:1,
99-
pad2:1, dbg:1, gfrc:1, iocoh:1,
100-
num_cores:6, llm:1, idu:1,
101-
pad3:8;
102-
#endif
103-
} mp;
90+
struct mcip_bcr mp;
10491

10592
READ_BCR(ARC_REG_MCIP_BCR, mp);
10693

@@ -114,7 +101,6 @@ static void mcip_probe_n_setup(void)
114101
IS_AVAIL1(mp.gfrc, "GFRC"));
115102

116103
cpuinfo_arc700[0].extn.gfrc = mp.gfrc;
117-
idu_detected = mp.idu;
118104

119105
if (mp.dbg) {
120106
__mcip_cmd_data(CMD_DEBUG_SET_SELECT, 0, 0xf);
@@ -130,6 +116,8 @@ struct plat_smp_ops plat_smp_ops = {
130116
.ipi_clear = mcip_ipi_clear,
131117
};
132118

119+
#endif
120+
133121
/***************************************************************************
134122
* ARCv2 Interrupt Distribution Unit (IDU)
135123
*
@@ -295,8 +283,11 @@ idu_of_init(struct device_node *intc, struct device_node *parent)
295283
/* Read IDU BCR to confirm nr_irqs */
296284
int nr_irqs = of_irq_count(intc);
297285
int i, irq;
286+
struct mcip_bcr mp;
287+
288+
READ_BCR(ARC_REG_MCIP_BCR, mp);
298289

299-
if (!idu_detected)
290+
if (!mp.idu)
300291
panic("IDU not detected, but DeviceTree using it");
301292

302293
pr_info("MCIP: IDU referenced from Devicetree %d irqs\n", nr_irqs);

arch/arc/kernel/module.c

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
3030
char *secstr, struct module *mod)
3131
{
3232
#ifdef CONFIG_ARC_DW2_UNWIND
33-
int i;
34-
3533
mod->arch.unw_sec_idx = 0;
3634
mod->arch.unw_info = NULL;
37-
38-
for (i = 1; i < hdr->e_shnum; i++) {
39-
if (strcmp(secstr+sechdrs[i].sh_name, ".eh_frame") == 0) {
40-
mod->arch.unw_sec_idx = i;
41-
break;
42-
}
43-
}
35+
mod->arch.secstr = secstr;
4436
#endif
4537
return 0;
4638
}
@@ -59,40 +51,49 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
5951
unsigned int relsec, /* sec index for relo sec */
6052
struct module *module)
6153
{
62-
int i, n;
54+
int i, n, relo_type;
6355
Elf32_Rela *rel_entry = (void *)sechdrs[relsec].sh_addr;
6456
Elf32_Sym *sym_entry, *sym_sec;
65-
Elf32_Addr relocation;
66-
Elf32_Addr location;
67-
Elf32_Addr sec_to_patch;
68-
int relo_type;
69-
70-
sec_to_patch = sechdrs[sechdrs[relsec].sh_info].sh_addr;
57+
Elf32_Addr relocation, location, tgt_addr;
58+
unsigned int tgtsec;
59+
60+
/*
61+
* @relsec has relocations e.g. .rela.init.text
62+
* @tgtsec is section to patch e.g. .init.text
63+
*/
64+
tgtsec = sechdrs[relsec].sh_info;
65+
tgt_addr = sechdrs[tgtsec].sh_addr;
7166
sym_sec = (Elf32_Sym *) sechdrs[symindex].sh_addr;
7267
n = sechdrs[relsec].sh_size / sizeof(*rel_entry);
7368

74-
pr_debug("\n========== Module Sym reloc ===========================\n");
75-
pr_debug("Section to fixup %x\n", sec_to_patch);
69+
pr_debug("\nSection to fixup %s @%x\n",
70+
module->arch.secstr + sechdrs[tgtsec].sh_name, tgt_addr);
7671
pr_debug("=========================================================\n");
77-
pr_debug("rela->r_off | rela->addend | sym->st_value | ADDR | VALUE\n");
72+
pr_debug("r_off\tr_add\tst_value ADDRESS VALUE\n");
7873
pr_debug("=========================================================\n");
7974

8075
/* Loop thru entries in relocation section */
8176
for (i = 0; i < n; i++) {
77+
const char *s;
8278

8379
/* This is where to make the change */
84-
location = sec_to_patch + rel_entry[i].r_offset;
80+
location = tgt_addr + rel_entry[i].r_offset;
8581

8682
/* This is the symbol it is referring to. Note that all
8783
undefined symbols have been resolved. */
8884
sym_entry = sym_sec + ELF32_R_SYM(rel_entry[i].r_info);
8985

9086
relocation = sym_entry->st_value + rel_entry[i].r_addend;
9187

92-
pr_debug("\t%x\t\t%x\t\t%x %x %x [%s]\n",
93-
rel_entry[i].r_offset, rel_entry[i].r_addend,
94-
sym_entry->st_value, location, relocation,
95-
strtab + sym_entry->st_name);
88+
if (sym_entry->st_name == 0 && ELF_ST_TYPE (sym_entry->st_info) == STT_SECTION) {
89+
s = module->arch.secstr + sechdrs[sym_entry->st_shndx].sh_name;
90+
} else {
91+
s = strtab + sym_entry->st_name;
92+
}
93+
94+
pr_debug(" %x\t%x\t%x %x %x [%s]\n",
95+
rel_entry[i].r_offset, rel_entry[i].r_addend,
96+
sym_entry->st_value, location, relocation, s);
9697

9798
/* This assumes modules are built with -mlong-calls
9899
* so any branches/jumps are absolute 32 bit jmps
@@ -111,6 +112,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
111112
goto relo_err;
112113

113114
}
115+
116+
if (strcmp(module->arch.secstr+sechdrs[tgtsec].sh_name, ".eh_frame") == 0)
117+
module->arch.unw_sec_idx = tgtsec;
118+
114119
return 0;
115120

116121
relo_err:

0 commit comments

Comments
 (0)