[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: |
Eduardo Habkost |
Subject: |
Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces |
Date: |
Tue, 24 Nov 2020 16:31:59 -0500 |
On Tue, Nov 24, 2020 at 09:13:13PM +0100, 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.
Making x86_cpu_accel_init() be a CPUClass method sounds like a
good idea. This way we won't need a arch_cpu_accel_init() stub
for non-x86.
accel.c can't use cpu.h, correct? We can add a:
CPUClass *arch_base_cpu_type(void)
{
return object_class_by_name(CPU_RESOLVING_TYPE);
}
function to arch_init.c, to allow target-independent code call
target-specific code.
--
Eduardo
- [RFC v5 04/12] i386: hvf: remove stale MAINTAINERS entry for old hvf stubs, (continued)
- [RFC v5 04/12] i386: hvf: remove stale MAINTAINERS entry for old hvf stubs, Claudio Fontana, 2020/11/24
- [RFC v5 07/12] i386: move TCG cpu class initialization out of helper.c, Claudio Fontana, 2020/11/24
- [RFC v5 10/12] i386: split cpu accelerators from cpu.c, Claudio Fontana, 2020/11/24
- [RFC v5 03/12] i386: move hax accel files into hax/, Claudio Fontana, 2020/11/24
- [RFC v5 05/12] i386: move TCG accel files into tcg/, Claudio Fontana, 2020/11/24
- [RFC v5 01/12] i386: move kvm accel files into kvm/, Claudio Fontana, 2020/11/24
- [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces, Claudio Fontana, 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, Paolo Bonzini, 2020/11/24
- Re: [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces,
Eduardo Habkost <=
- 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, 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