Skip to content

Commit 587da64

Browse files
committed
hv_exc: Be a bit more paranoid handling IPIs
Signed-off-by: Hector Martin <[email protected]>
1 parent b0c3f6d commit 587da64

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/hv_exc.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,21 +289,25 @@ static bool hv_handle_msr(struct exc_info *ctx, u64 iss)
289289
case SYSREG_ISS(SYS_IMP_APL_IPI_RR_LOCAL_EL1): {
290290
assert(!is_read);
291291
u64 mpidr = (regs[rt] & 0xff) | (mrs(MPIDR_EL1) & 0xffff00);
292-
msr(SYS_IMP_APL_IPI_RR_LOCAL_EL1, regs[rt]);
293292
for (int i = 0; i < MAX_CPUS; i++)
294-
if (mpidr == smp_get_mpidr(i))
293+
if (mpidr == smp_get_mpidr(i)) {
295294
pcpu[i].ipi_queued = true;
296-
return true;
295+
msr(SYS_IMP_APL_IPI_RR_LOCAL_EL1, regs[rt]);
296+
return true;
297+
}
298+
return false;
297299
}
298300
case SYSREG_ISS(SYS_IMP_APL_IPI_RR_GLOBAL_EL1):
299301
assert(!is_read);
300302
u64 mpidr = (regs[rt] & 0xff) | ((regs[rt] & 0xff0000) >> 8);
301-
msr(SYS_IMP_APL_IPI_RR_GLOBAL_EL1, regs[rt]);
302303
for (int i = 0; i < MAX_CPUS; i++) {
303-
if (mpidr == (smp_get_mpidr(i) & 0xffff))
304+
if (mpidr == (smp_get_mpidr(i) & 0xffff)) {
304305
pcpu[i].ipi_queued = true;
306+
msr(SYS_IMP_APL_IPI_RR_GLOBAL_EL1, regs[rt]);
307+
return true;
308+
}
305309
}
306-
return true;
310+
return false;
307311
case SYSREG_ISS(SYS_IMP_APL_IPI_SR_EL1):
308312
if (is_read)
309313
regs[rt] = PERCPU(ipi_pending) ? IPI_SR_PENDING : 0;

0 commit comments

Comments
 (0)