Re: [PATCH 3/3] accel/tcg: Make TCGCPUOps::cpu_exec_halt mandatory

Peter Maydell <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <CAFEAcA-Kv+G14+3AVPgP+jGbogC8nARiiE7vsR8L+J+e2CmmgA@mail.gmail.com>
On Tue, 18 Aug 2026 at 14:35, Philippe Mathieu-Daudé
<[email protected]> wrote:
>
> On 3/6/24 18:09, Peter Maydell wrote:
> > Now that all targets set TCGCPUOps::cpu_exec_halt, we can make it
> > mandatory and remove the fallback handling that calls cpu_has_work.
> >
> > Signed-off-by: Peter Maydell <[email protected]>

> >        * Return true to indicate that the CPU should now leave halt, false
> > -     * if it should remain in the halted state.
> > +     * if it should remain in the halted state. (This should generally
> > +     * be the same value that cpu_has_work() would return.)
> >        *
> > -     * If this method is not provided, the default is to do nothing, and
> > -     * to leave halt if cpu_has_work() returns true.
> > +     * This method must be provided. If the target does not need to
> > +     * do anything special for halt, the same function used for its
> > +     * CPUClass::has_work method can be used here, as they have the
> > +     * same function signature.
>
> With retrospective, has_work() should be idempotent, taking a const
> CPUState, while cpu_exec_halt() is expected to change CPUState
> internal fields.

Mmm; we added the "should be idempotent" comment to the has_work docs
in include/hw/core/sysemu-cpu-ops.h, but it still takes a plain CPUState*.
Constifying wouldn't be trivial because e.g. cpu_env() and cpu_test_interrupt()
and so on take a non-const pointer.

-- PMM
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.