qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 08/10] accel/tcg: push i386 specific hacks into handle_cpu_in


From: Alex Bennée
Subject: Re: [PATCH 08/10] accel/tcg: push i386 specific hacks into handle_cpu_interrupt callback
Date: Mon, 20 Mar 2023 17:14:19 +0000
User-agent: mu4e 1.9.22; emacs 29.0.60

Richard Henderson <richard.henderson@linaro.org> writes:

> On 3/20/23 03:10, Alex Bennée wrote:
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>   include/hw/core/sysemu-cpu-ops.h | 11 +++++++++++
>>   target/i386/cpu-internal.h       |  1 +
>>   accel/tcg/cpu-exec-softmmu.c     | 16 ++++++++++++++++
>>   accel/tcg/cpu-exec.c             | 31 ++++++++++---------------------
>>   target/i386/cpu-sysemu.c         | 17 +++++++++++++++++
>>   target/i386/cpu.c                |  1 +
>>   6 files changed, 56 insertions(+), 21 deletions(-)
>> diff --git a/include/hw/core/sysemu-cpu-ops.h
>> b/include/hw/core/sysemu-cpu-ops.h
>> index c9d30172c4..d53907b517 100644
>> --- a/include/hw/core/sysemu-cpu-ops.h
>> +++ b/include/hw/core/sysemu-cpu-ops.h
>> @@ -53,6 +53,15 @@ typedef struct SysemuCPUOps {
>>        * @cs: The CPUState
>>        */
>>       void (*handle_cpu_halt)(CPUState *cpu);
>> +    /**
>> +     * @handle_cpu_interrupt: handle init/reset interrupts
>> +     * @cs: The CPUState
>> +     * @irq_request: the interrupt request
>> +     *
>> +     * Most architectures share a common handler. Returns true if the
>> +     * handler did indeed handle and interrupt.
>> +     */
>
> and -> the? or any?
>
> This should be a tcg hook, not a sysemu hook, per the previous one.
> I would very much like it to never be NULL, but instead your new
> common_cpu_handle_interrupt function.

I was trying to figure out how to instantiate a default but ran into
const problems eventually forcing me to give up.

Why a TCG hook? Do we not process any interrupts for KVM or HVF?

>
>> -#if defined(TARGET_I386)
>> -        else if (interrupt_request & CPU_INTERRUPT_INIT) {
>> -            X86CPU *x86_cpu = X86_CPU(cpu);
>> -            CPUArchState *env = &x86_cpu->env;
>> -            replay_interrupt();
>> -            cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0, 0);
>> -            do_cpu_init(x86_cpu);
>> -            cpu->exception_index = EXCP_HALTED;
>> -            return true;
>> -        }
>> -#else
>> -        else if (interrupt_request & CPU_INTERRUPT_RESET) {
>> -            replay_interrupt();
>> -            cpu_reset(cpu);
>> +        else if (cpu->cc->sysemu_ops->handle_cpu_interrupt &&
>> +                 cpu->cc->sysemu_ops->handle_cpu_interrupt(cpu, 
>> interrupt_request)) {
>> +                return true;
>> +        } else if (common_cpu_handle_interrupt(cpu, interrupt_request)) {
>>               return true;
>
> ... because this is pretty ugly, and incorrectly indented.
>
>
> r~


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



reply via email to

[Prev in Thread] Current Thread [Next in Thread]