Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eugeniy Paltsev and committed by
Vineet Gupta
f3205de9 07423d00

+34 -5
+32 -5
arch/arc/kernel/mcip.c
··· 51 51 raw_spin_unlock_irqrestore(&mcip_lock, flags); 52 52 } 53 53 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 + 54 82 static void mcip_setup_per_cpu(int cpu) 55 83 { 56 84 struct mcip_bcr mp; ··· 91 63 /* Update GFRC halt mask as new CPU came online */ 92 64 if (mp.gfrc) 93 65 mcip_update_gfrc_halt_mask(cpu); 66 + 67 + /* Update MCIP debug mask as new CPU came online */ 68 + if (mp.dbg) 69 + mcip_update_debug_halt_mask(cpu); 94 70 } 95 71 96 72 static void mcip_ipi_send(int cpu) ··· 170 138 IS_AVAIL1(mp.gfrc, "GFRC")); 171 139 172 140 cpuinfo_arc700[0].extn.gfrc = mp.gfrc; 173 - 174 - if (mp.dbg) { 175 - __mcip_cmd_data(CMD_DEBUG_SET_SELECT, 0, 0xf); 176 - __mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xf, 0xf); 177 - } 178 141 } 179 142 180 143 struct plat_smp_ops plat_smp_ops = {
+2
include/soc/arc/mcip.h
··· 37 37 #define CMD_SEMA_RELEASE 0x12 38 38 39 39 #define CMD_DEBUG_SET_MASK 0x34 40 + #define CMD_DEBUG_READ_MASK 0x35 40 41 #define CMD_DEBUG_SET_SELECT 0x36 42 + #define CMD_DEBUG_READ_SELECT 0x37 41 43 42 44 #define CMD_GFRC_READ_LO 0x42 43 45 #define CMD_GFRC_READ_HI 0x43