mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP
Instead of clearing mask in riscv_cpu_update_mip() for VSTIP, we
should call riscv_cpu_update_mip() with mask == 0 from timer_helper.c
for VSTIP.
Fixes: 3ec0fe18a3
("target/riscv: Add vstimecmp suppor")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230120125950.2246378-3-apatel@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
2cfb3b6c9b
commit
14cb78bfaf
2 changed files with 8 additions and 6 deletions
|
@ -27,7 +27,7 @@ static void riscv_vstimer_cb(void *opaque)
|
|||
RISCVCPU *cpu = opaque;
|
||||
CPURISCVState *env = &cpu->env;
|
||||
env->vstime_irq = 1;
|
||||
riscv_cpu_update_mip(cpu, MIP_VSTIP, BOOL_TO_MASK(1));
|
||||
riscv_cpu_update_mip(cpu, 0, BOOL_TO_MASK(1));
|
||||
}
|
||||
|
||||
static void riscv_stimer_cb(void *opaque)
|
||||
|
@ -57,16 +57,20 @@ void riscv_timer_write_timecmp(RISCVCPU *cpu, QEMUTimer *timer,
|
|||
*/
|
||||
if (timer_irq == MIP_VSTIP) {
|
||||
env->vstime_irq = 1;
|
||||
riscv_cpu_update_mip(cpu, 0, BOOL_TO_MASK(1));
|
||||
} else {
|
||||
riscv_cpu_update_mip(cpu, MIP_STIP, BOOL_TO_MASK(1));
|
||||
}
|
||||
riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(1));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Clear the [VS|S]TIP bit in mip */
|
||||
if (timer_irq == MIP_VSTIP) {
|
||||
env->vstime_irq = 0;
|
||||
riscv_cpu_update_mip(cpu, 0, BOOL_TO_MASK(0));
|
||||
} else {
|
||||
riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(0));
|
||||
}
|
||||
/* Clear the [V]STIP bit in mip */
|
||||
riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(0));
|
||||
|
||||
/* otherwise, set up the future timer interrupt */
|
||||
diff = timecmp - rtc_r;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue