qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC v9 17/32] accel/tcg: split TCG-only code from cpu_exec_realizef


From: Claudio Fontana
Subject: Re: [RFC v9 17/32] accel/tcg: split TCG-only code from cpu_exec_realizefn
Date: Wed, 9 Dec 2020 12:22:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

On 12/9/20 11:42 AM, Alex Bennée wrote:
> 
> Claudio Fontana <cfontana@suse.de> writes:
> 
>> move away TCG-only code, make it compile only on TCG.
>>
>> Signed-off-by: Claudio Fontana <cfontana@suse.de>
>> ---
>>  accel/tcg/cpu-exec.c  | 28 +++++++++++++++++
>>  cpu.c                 | 70 ++++++++++++++++++++-----------------------
>>  hw/core/cpu.c         |  6 +++-
>>  include/hw/core/cpu.h |  8 +++++
>>  4 files changed, 74 insertions(+), 38 deletions(-)
>>
>> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
>> index 64cba89356..436dfbf155 100644
>> --- a/accel/tcg/cpu-exec.c
>> +++ b/accel/tcg/cpu-exec.c
>> @@ -801,6 +801,34 @@ int cpu_exec(CPUState *cpu)
>>      return ret;
>>  }
>>  
>> +void tcg_exec_realizefn(CPUState *cpu, Error **errp)
>> +{
>> +    static bool tcg_target_initialized;
>> +    CPUClass *cc = CPU_GET_CLASS(cpu);
>> +
>> +    if (!tcg_target_initialized) {
>> +        tcg_target_initialized = true;
>> +        cc->tcg_ops.initialize();
> 
> nit: it makes no difference but stylistically it makes sense to set
> tcg_target_initialized after we have in fact initialised.
> 
> Also we've dropped the tcg_enabled() check,


The tcg_enabled() check should be there, not here but in cpu_exec_realizefn,

if (tcg_enabled()) {
  tcg_exec_realizefn(...)
}

will check, thanks!


> if indeed it will always be
> true should we not assert it to ensure the statement for tcg_exec_init
> remains the case: "Must be called before using the QEMU cpus."
> 
> Otherwise LGTM:
> 
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> 




reply via email to

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