Hi Richard,

May 25, 2025 at 2:14 PM, Richard Henderson wrote:
> Having read the whole series now, I think it would be better to change the 
> TCGCPUOps.do_interrupt interface.
> 
> Instead of having each target call qemu_plugin_*, instead have each 
> do_interrupt return the discontinuity type, or 0 if the interrupt is blocked 
> so no state change.
> 
> Change to cpu_handle_exception would be of the form:
> 
>  if (qemu_plugin_discon_enabled(cpu)) {
>  vaddr from = tcg_ops->get_pc(cpu);
>  unsigned ev = tcg_ops->do_interrupt(cpu);
>  if (ev) {
>  qemu_plugin_vcpu_discon_cb(cpu, ev, from);
>  }
>  } else {
>  tcg_ops->do_interrupt(cpu);
>  }

Personally, I'd be in favour of that. However, I do see some obstacles
to that.

Quite a few targets to call their do_interrupt function internally,
usually from their exec_interrupt. We would then handle that function's
return value at the call site?

Also, some targets such as tricore only have a dummy/stub do_interrupt
and handle exceptions differently inside non-returning functions. For
those, we would call the hooks directly from there as we do now?

And then we have some targets that deviate in some other way. For
example, s390x_cpu_do_interrupt effectively contains a loop, and we
potentially need to call one of the hooks for each iteration.

Regards,
Julian

Reply via email to