Skip to content

Commit f3205de

Browse files
Eugeniy Paltsevvineetgarc
authored andcommitted
ARC: mcip: update MCIP debug mask when the new cpu came online
As of today we use hardcoded MCIP debug mask, so if we launch kernel via debugger and kick fever cores than HW has all cpus hang at the momemt of setup MCIP debug mask. So update MCIP debug mask when the new cpu came online, instead of use hardcoded MCIP debug mask. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 07423d0 commit f3205de

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

‎arch/arc/kernel/mcip.c‎

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,34 @@ static void mcip_update_gfrc_halt_mask(int cpu)
5151
raw_spin_unlock_irqrestore(&mcip_lock, flags);
5252
}
5353

54+
static void mcip_update_debug_halt_mask(int cpu)
55+
{
56+
u32 mcip_mask = 0;
57+
unsigned long flags;
58+
59+
raw_spin_lock_irqsave(&mcip_lock, flags);
60+
61+
/*
62+
* mcip_mask is same for CMD_DEBUG_SET_SELECT and CMD_DEBUG_SET_MASK
63+
* commands. So read it once instead of reading both CMD_DEBUG_READ_MASK
64+
* and CMD_DEBUG_READ_SELECT.
65+
*/
66+
__mcip_cmd(CMD_DEBUG_READ_SELECT, 0);
67+
mcip_mask = read_aux_reg(ARC_REG_MCIP_READBACK);
68+
69+
mcip_mask |= BIT(cpu);
70+
71+
__mcip_cmd_data(CMD_DEBUG_SET_SELECT, 0, mcip_mask);
72+
/*
73+
* Parameter specified halt cause:
74+
* STATUS32[H]/actionpoint/breakpoint/self-halt
75+
* We choose all of them (0xF).
76+
*/
77+
__mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xF, mcip_mask);
78+
79+
raw_spin_unlock_irqrestore(&mcip_lock, flags);
80+
}
81+
5482
static void mcip_setup_per_cpu(int cpu)
5583
{
5684
struct mcip_bcr mp;
@@ -63,6 +91,10 @@ static void mcip_setup_per_cpu(int cpu)
6391
/* Update GFRC halt mask as new CPU came online */
6492
if (mp.gfrc)
6593
mcip_update_gfrc_halt_mask(cpu);
94+
95+
/* Update MCIP debug mask as new CPU came online */
96+
if (mp.dbg)
97+
mcip_update_debug_halt_mask(cpu);
6698
}
6799

68100
static void mcip_ipi_send(int cpu)
@@ -138,11 +170,6 @@ static void mcip_probe_n_setup(void)
138170
IS_AVAIL1(mp.gfrc, "GFRC"));
139171

140172
cpuinfo_arc700[0].extn.gfrc = mp.gfrc;
141-
142-
if (mp.dbg) {
143-
__mcip_cmd_data(CMD_DEBUG_SET_SELECT, 0, 0xf);
144-
__mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xf, 0xf);
145-
}
146173
}
147174

148175
struct plat_smp_ops plat_smp_ops = {

‎include/soc/arc/mcip.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ struct mcip_cmd {
3737
#define CMD_SEMA_RELEASE 0x12
3838

3939
#define CMD_DEBUG_SET_MASK 0x34
40+
#define CMD_DEBUG_READ_MASK 0x35
4041
#define CMD_DEBUG_SET_SELECT 0x36
42+
#define CMD_DEBUG_READ_SELECT 0x37
4143

4244
#define CMD_GFRC_READ_LO 0x42
4345
#define CMD_GFRC_READ_HI 0x43

0 commit comments

Comments
 (0)