Skip to content

Commit ef1dce9

Browse files
committed
Merge tag 'arc-4.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC fixes from Vineet Gupta: "Hopefully last set of changes for ARC for 4.10: - fix for unaligned access emulation corner case - fix for udelay loop inline asm regression - fix irq affinity finally for AXS103 board [Yuriy] - final fixes for setting IO-coherency sanely in SMP" * tag 'arc-4.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: [arcompact] handle unaligned access delay slot corner case ARCv2: smp-boot: wake_flag polling by non-Masters needs to be uncached ARC: smp-boot: Decouple Non masters waiting API from jump to entry point ARCv2: MCIP: update the BCR per current changes ARC: udelay: fix inline assembler by adding LP_COUNT to clobber list ARCv2: MCIP: Deprecate setting of affinity in Device Tree
2 parents 1b1bc42 + 9aed02f commit ef1dce9

File tree

7 files changed

+66
-54
lines changed

7 files changed

+66
-54
lines changed

Documentation/devicetree/bindings/interrupt-controller/snps,archs-idu-intc.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Properties:
1515
Second cell specifies the irq distribution mode to cores
1616
0=Round Robin; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3
1717

18+
The second cell in interrupts property is deprecated and may be ignored by
19+
the kernel.
20+
1821
intc accessed via the special ARC AUX register interface, hence "reg" property
1922
is not specified.
2023

arch/arc/include/asm/delay.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ static inline void __delay(unsigned long loops)
2626
" lp 1f \n"
2727
" nop \n"
2828
"1: \n"
29-
: : "r"(loops));
29+
:
30+
: "r"(loops)
31+
: "lp_count");
3032
}
3133

3234
extern void __bad_udelay(void);

arch/arc/kernel/head.S

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ ENTRY(stext)
7171
GET_CPU_ID r5
7272
cmp r5, 0
7373
mov.nz r0, r5
74-
#ifdef CONFIG_ARC_SMP_HALT_ON_RESET
75-
; Non-Master can proceed as system would be booted sufficiently
76-
jnz first_lines_of_secondary
77-
#else
74+
bz .Lmaster_proceed
75+
7876
; Non-Masters wait for Master to boot enough and bring them up
79-
jnz arc_platform_smp_wait_to_boot
80-
#endif
81-
; Master falls thru
77+
; when they resume, tail-call to entry point
78+
mov blink, @first_lines_of_secondary
79+
j arc_platform_smp_wait_to_boot
80+
81+
.Lmaster_proceed:
8282
#endif
8383

8484
; Clear BSS before updating any globals

arch/arc/kernel/mcip.c

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ static void mcip_probe_n_setup(void)
9393
READ_BCR(ARC_REG_MCIP_BCR, mp);
9494

9595
sprintf(smp_cpuinfo_buf,
96-
"Extn [SMP]\t: ARConnect (v%d): %d cores with %s%s%s%s%s\n",
96+
"Extn [SMP]\t: ARConnect (v%d): %d cores with %s%s%s%s\n",
9797
mp.ver, mp.num_cores,
9898
IS_AVAIL1(mp.ipi, "IPI "),
9999
IS_AVAIL1(mp.idu, "IDU "),
100-
IS_AVAIL1(mp.llm, "LLM "),
101100
IS_AVAIL1(mp.dbg, "DEBUG "),
102101
IS_AVAIL1(mp.gfrc, "GFRC"));
103102

@@ -175,7 +174,6 @@ static void idu_irq_unmask(struct irq_data *data)
175174
raw_spin_unlock_irqrestore(&mcip_lock, flags);
176175
}
177176

178-
#ifdef CONFIG_SMP
179177
static int
180178
idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
181179
bool force)
@@ -205,12 +203,27 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
205203

206204
return IRQ_SET_MASK_OK;
207205
}
208-
#endif
206+
207+
static void idu_irq_enable(struct irq_data *data)
208+
{
209+
/*
210+
* By default send all common interrupts to all available online CPUs.
211+
* The affinity of common interrupts in IDU must be set manually since
212+
* in some cases the kernel will not call irq_set_affinity() by itself:
213+
* 1. When the kernel is not configured with support of SMP.
214+
* 2. When the kernel is configured with support of SMP but upper
215+
* interrupt controllers does not support setting of the affinity
216+
* and cannot propagate it to IDU.
217+
*/
218+
idu_irq_set_affinity(data, cpu_online_mask, false);
219+
idu_irq_unmask(data);
220+
}
209221

210222
static struct irq_chip idu_irq_chip = {
211223
.name = "MCIP IDU Intc",
212224
.irq_mask = idu_irq_mask,
213225
.irq_unmask = idu_irq_unmask,
226+
.irq_enable = idu_irq_enable,
214227
#ifdef CONFIG_SMP
215228
.irq_set_affinity = idu_irq_set_affinity,
216229
#endif
@@ -243,36 +256,14 @@ static int idu_irq_xlate(struct irq_domain *d, struct device_node *n,
243256
const u32 *intspec, unsigned int intsize,
244257
irq_hw_number_t *out_hwirq, unsigned int *out_type)
245258
{
246-
irq_hw_number_t hwirq = *out_hwirq = intspec[0];
247-
int distri = intspec[1];
248-
unsigned long flags;
249-
259+
/*
260+
* Ignore value of interrupt distribution mode for common interrupts in
261+
* IDU which resides in intspec[1] since setting an affinity using value
262+
* from Device Tree is deprecated in ARC.
263+
*/
264+
*out_hwirq = intspec[0];
250265
*out_type = IRQ_TYPE_NONE;
251266

252-
/* XXX: validate distribution scheme again online cpu mask */
253-
if (distri == 0) {
254-
/* 0 - Round Robin to all cpus, otherwise 1 bit per core */
255-
raw_spin_lock_irqsave(&mcip_lock, flags);
256-
idu_set_dest(hwirq, BIT(num_online_cpus()) - 1);
257-
idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
258-
raw_spin_unlock_irqrestore(&mcip_lock, flags);
259-
} else {
260-
/*
261-
* DEST based distribution for Level Triggered intr can only
262-
* have 1 CPU, so generalize it to always contain 1 cpu
263-
*/
264-
int cpu = ffs(distri);
265-
266-
if (cpu != fls(distri))
267-
pr_warn("IDU irq %lx distri mode set to cpu %x\n",
268-
hwirq, cpu);
269-
270-
raw_spin_lock_irqsave(&mcip_lock, flags);
271-
idu_set_dest(hwirq, cpu);
272-
idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_DEST);
273-
raw_spin_unlock_irqrestore(&mcip_lock, flags);
274-
}
275-
276267
return 0;
277268
}
278269

arch/arc/kernel/smp.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,37 @@ void __init smp_cpus_done(unsigned int max_cpus)
9090
*/
9191
static volatile int wake_flag;
9292

93+
#ifdef CONFIG_ISA_ARCOMPACT
94+
95+
#define __boot_read(f) f
96+
#define __boot_write(f, v) f = v
97+
98+
#else
99+
100+
#define __boot_read(f) arc_read_uncached_32(&f)
101+
#define __boot_write(f, v) arc_write_uncached_32(&f, v)
102+
103+
#endif
104+
93105
static void arc_default_smp_cpu_kick(int cpu, unsigned long pc)
94106
{
95107
BUG_ON(cpu == 0);
96-
wake_flag = cpu;
108+
109+
__boot_write(wake_flag, cpu);
97110
}
98111

99112
void arc_platform_smp_wait_to_boot(int cpu)
100113
{
101-
while (wake_flag != cpu)
114+
/* for halt-on-reset, we've waited already */
115+
if (IS_ENABLED(CONFIG_ARC_SMP_HALT_ON_RESET))
116+
return;
117+
118+
while (__boot_read(wake_flag) != cpu)
102119
;
103120

104-
wake_flag = 0;
105-
__asm__ __volatile__("j @first_lines_of_secondary \n");
121+
__boot_write(wake_flag, 0);
106122
}
107123

108-
109124
const char *arc_platform_smp_cpuinfo(void)
110125
{
111126
return plat_smp_ops.info ? : "";

arch/arc/kernel/unaligned.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,9 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs,
241241
if (state.fault)
242242
goto fault;
243243

244+
/* clear any remanants of delay slot */
244245
if (delay_mode(regs)) {
245-
regs->ret = regs->bta;
246+
regs->ret = regs->bta ~1U;
246247
regs->status32 &= ~STATUS_DE_MASK;
247248
} else {
248249
regs->ret += state.instr_len;

include/soc/arc/mcip.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ struct mcip_cmd {
5555

5656
struct mcip_bcr {
5757
#ifdef CONFIG_CPU_BIG_ENDIAN
58-
unsigned int pad3:8,
59-
idu:1, llm:1, num_cores:6,
60-
iocoh:1, gfrc:1, dbg:1, pad2:1,
61-
msg:1, sem:1, ipi:1, pad:1,
58+
unsigned int pad4:6, pw_dom:1, pad3:1,
59+
idu:1, pad2:1, num_cores:6,
60+
pad:1, gfrc:1, dbg:1, pw:1,
61+
msg:1, sem:1, ipi:1, slv:1,
6262
ver:8;
6363
#else
6464
unsigned int ver:8,
65-
pad:1, ipi:1, sem:1, msg:1,
66-
pad2:1, dbg:1, gfrc:1, iocoh:1,
67-
num_cores:6, llm:1, idu:1,
68-
pad3:8;
65+
slv:1, ipi:1, sem:1, msg:1,
66+
pw:1, dbg:1, gfrc:1, pad:1,
67+
num_cores:6, pad2:1, idu:1,
68+
pad3:1, pw_dom:1, pad4:6;
6969
#endif
7070
};
7171

0 commit comments

Comments
 (0)