* [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt()
@ 2025-10-30 16:59 Igor Mammedov
2025-10-31 7:34 ` Thomas Huth
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Igor Mammedov @ 2025-10-30 16:59 UTC (permalink / raw)
To: qemu-devel; +Cc: yoshinori.sato, Thomas Huth
Commit [1] broke interrupt handling, replacing interrupts fetch with a bool
and then the remaining code attempting to check individual bits
on that bool value, which effectively masked those interrupts.
Fix it by checking individual interrupt bits directly instead of
old 'fetch then check' approach.
1)
Fixes: 87511341c30d ("add cpu_test_interrupt()/cpu_set_interrupt() helpers and use them tree wide")
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
target/rx/helper.c | 41 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)
diff --git a/target/rx/helper.c b/target/rx/helper.c
index 41c9606fd1..19af212b7d 100644
--- a/target/rx/helper.c
+++ b/target/rx/helper.c
@@ -40,11 +40,9 @@ void rx_cpu_unpack_psw(CPURXState *env, uint32_t psw, int rte)
env->psw_c = FIELD_EX32(psw, PSW, C);
}
-#define INT_FLAGS (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIR)
void rx_cpu_do_interrupt(CPUState *cs)
{
CPURXState *env = cpu_env(cs);
- int do_irq = cpu_test_interrupt(cs, INT_FLAGS);
uint32_t save_psw;
env->in_sleep = 0;
@@ -57,27 +55,24 @@ void rx_cpu_do_interrupt(CPUState *cs)
save_psw = rx_cpu_pack_psw(env);
env->psw_pm = env->psw_i = env->psw_u = 0;
- if (do_irq) {
- if (do_irq & CPU_INTERRUPT_FIR) {
- env->bpc = env->pc;
- env->bpsw = save_psw;
- env->pc = env->fintv;
- env->psw_ipl = 15;
- cpu_reset_interrupt(cs, CPU_INTERRUPT_FIR);
- qemu_set_irq(env->ack, env->ack_irq);
- qemu_log_mask(CPU_LOG_INT, "fast interrupt raised\n");
- } else if (do_irq & CPU_INTERRUPT_HARD) {
- env->isp -= 4;
- cpu_stl_data(env, env->isp, save_psw);
- env->isp -= 4;
- cpu_stl_data(env, env->isp, env->pc);
- env->pc = cpu_ldl_data(env, env->intb + env->ack_irq * 4);
- env->psw_ipl = env->ack_ipl;
- cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
- qemu_set_irq(env->ack, env->ack_irq);
- qemu_log_mask(CPU_LOG_INT,
- "interrupt 0x%02x raised\n", env->ack_irq);
- }
+ if (cpu_test_interrupt(cs, CPU_INTERRUPT_FIR)) {
+ env->bpc = env->pc;
+ env->bpsw = save_psw;
+ env->pc = env->fintv;
+ env->psw_ipl = 15;
+ cpu_reset_interrupt(cs, CPU_INTERRUPT_FIR);
+ qemu_set_irq(env->ack, env->ack_irq);
+ qemu_log_mask(CPU_LOG_INT, "fast interrupt raised\n");
+ } else if (cpu_test_interrupt(cs, CPU_INTERRUPT_HARD)) {
+ env->isp -= 4;
+ cpu_stl_data(env, env->isp, save_psw);
+ env->isp -= 4;
+ cpu_stl_data(env, env->isp, env->pc);
+ env->pc = cpu_ldl_data(env, env->intb + env->ack_irq * 4);
+ env->psw_ipl = env->ack_ipl;
+ cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
+ qemu_set_irq(env->ack, env->ack_irq);
+ qemu_log_mask(CPU_LOG_INT, "interrupt 0x%02x raised\n", env->ack_irq);
} else {
uint32_t vec = cs->exception_index;
const char *expname = "unknown exception";
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt()
2025-10-30 16:59 [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt() Igor Mammedov
@ 2025-10-31 7:34 ` Thomas Huth
2025-10-31 8:12 ` Philippe Mathieu-Daudé
2025-10-31 20:28 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2025-10-31 7:34 UTC (permalink / raw)
To: Igor Mammedov, qemu-devel; +Cc: yoshinori.sato
On 30/10/2025 17.59, Igor Mammedov wrote:
> Commit [1] broke interrupt handling, replacing interrupts fetch with a bool
> and then the remaining code attempting to check individual bits
> on that bool value, which effectively masked those interrupts.
>
> Fix it by checking individual interrupt bits directly instead of
> old 'fetch then check' approach.
>
> 1)
> Fixes: 87511341c30d ("add cpu_test_interrupt()/cpu_set_interrupt() helpers and use them tree wide")
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> target/rx/helper.c | 41 ++++++++++++++++++-----------------------
> 1 file changed, 18 insertions(+), 23 deletions(-)
Thanks, this fixes the problem, indeed!
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt()
2025-10-30 16:59 [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt() Igor Mammedov
2025-10-31 7:34 ` Thomas Huth
@ 2025-10-31 8:12 ` Philippe Mathieu-Daudé
2025-10-31 20:28 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-31 8:12 UTC (permalink / raw)
To: Igor Mammedov, qemu-devel; +Cc: yoshinori.sato, Thomas Huth
On 30/10/25 17:59, Igor Mammedov wrote:
> Commit [1] broke interrupt handling, replacing interrupts fetch with a bool
> and then the remaining code attempting to check individual bits
> on that bool value, which effectively masked those interrupts.
>
> Fix it by checking individual interrupt bits directly instead of
> old 'fetch then check' approach.
>
> 1)
> Fixes: 87511341c30d ("add cpu_test_interrupt()/cpu_set_interrupt() helpers and use them tree wide")
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> target/rx/helper.c | 41 ++++++++++++++++++-----------------------
> 1 file changed, 18 insertions(+), 23 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt()
2025-10-30 16:59 [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt() Igor Mammedov
2025-10-31 7:34 ` Thomas Huth
2025-10-31 8:12 ` Philippe Mathieu-Daudé
@ 2025-10-31 20:28 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-31 20:28 UTC (permalink / raw)
To: Igor Mammedov, qemu-devel; +Cc: yoshinori.sato, Thomas Huth
On 30/10/25 17:59, Igor Mammedov wrote:
> Commit [1] broke interrupt handling, replacing interrupts fetch with a bool
> and then the remaining code attempting to check individual bits
> on that bool value, which effectively masked those interrupts.
>
> Fix it by checking individual interrupt bits directly instead of
> old 'fetch then check' approach.
>
> 1)
> Fixes: 87511341c30d ("add cpu_test_interrupt()/cpu_set_interrupt() helpers and use them tree wide")
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> target/rx/helper.c | 41 ++++++++++++++++++-----------------------
> 1 file changed, 18 insertions(+), 23 deletions(-)
Queued, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-31 20:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 16:59 [PATCH] rx: cpu: fix interrupts check in rx_cpu_do_interrupt() Igor Mammedov
2025-10-31 7:34 ` Thomas Huth
2025-10-31 8:12 ` Philippe Mathieu-Daudé
2025-10-31 20:28 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).