[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfac
From: |
Claudio Fontana |
Subject: |
Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces |
Date: |
Thu, 26 Nov 2020 15:42:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
On 11/24/20 9:13 PM, Paolo Bonzini wrote:
> On 24/11/20 17:22, Claudio Fontana wrote:
>> +static void x86_cpu_accel_init(void)
>> {
>> - X86CPUAccelClass *acc;
>> + const char *ac_name;
>> + ObjectClass *ac;
>> + char *xac_name;
>> + ObjectClass *xac;
>>
>> - acc = X86_CPU_ACCEL_CLASS(object_class_by_name(accel_name));
>> - g_assert(acc != NULL);
>> + ac = object_get_class(OBJECT(current_accel()));
>> + g_assert(ac != NULL);
>> + ac_name = object_class_get_name(ac);
>> + g_assert(ac_name != NULL);
>>
>> - object_class_foreach(x86_cpu_accel_init_aux, TYPE_X86_CPU, false, &acc);
>> + xac_name = g_strdup_printf("%s-%s", ac_name, TYPE_X86_CPU);
>> + xac = object_class_by_name(xac_name);
>> + g_free(xac_name);
>> +
>> + if (xac) {
>> + object_class_foreach(x86_cpu_accel_init_aux, TYPE_X86_CPU, false,
>> xac);
>> + }
>> }
>> +
>> +accel_cpu_init(x86_cpu_accel_init);
>
> If this and cpus_accel_ops_init are the only call to accel_cpu_init, I'd
> rather make them functions in CPUClass (which you find and call via
> CPU_RESOLVING_TYPE) and AccelClass respectively.
>
> Paolo
>
Hi Paolo,
this works well.
The only thing is, setting the ops in the AccelClass is basically useless:
we need to cache the AccelClass * in cpus.c anyway, so I ended up not putting
it in AccelClass, as nobody ends up using it.
Maybe you could look for this in the series I am posting later today,
Ciao, thanks!
Claudio
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, (continued)
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Paolo Bonzini, 2020/11/24
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Eduardo Habkost, 2020/11/24
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Claudio Fontana, 2020/11/25
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Claudio Fontana, 2020/11/26
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Eduardo Habkost, 2020/11/26
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Claudio Fontana, 2020/11/26
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Eduardo Habkost, 2020/11/26
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Claudio Fontana, 2020/11/26
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Claudio Fontana, 2020/11/25
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces,
Claudio Fontana <=
[RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Claudio Fontana, 2020/11/24
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Eduardo Habkost, 2020/11/24
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Claudio Fontana, 2020/11/24
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Eduardo Habkost, 2020/11/24
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Claudio Fontana, 2020/11/24
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Eduardo Habkost, 2020/11/24
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Claudio Fontana, 2020/11/25
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Claudio Fontana, 2020/11/25
- Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps, Eduardo Habkost, 2020/11/25
Re: [RFC v5 00/12] i386 cleanup, Paolo Bonzini, 2020/11/24