target-ppc: Update PowerPCCPU to QOM realizefn
Adapt ppc_cpu_realize() signature, hook it up to DeviceClass and set realized = true in cpu_ppc_init(). Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
		
							parent
							
								
									c296262bc9
								
							
						
					
					
						commit
						4776ce6003
					
				| 
						 | 
				
			
			@ -40,6 +40,7 @@
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * PowerPCCPUClass:
 | 
			
		||||
 * @parent_realize: The parent class' realize handler.
 | 
			
		||||
 * @parent_reset: The parent class' reset handler.
 | 
			
		||||
 *
 | 
			
		||||
 * A PowerPC CPU model.
 | 
			
		||||
| 
						 | 
				
			
			@ -49,6 +50,7 @@ typedef struct PowerPCCPUClass {
 | 
			
		|||
    CPUClass parent_class;
 | 
			
		||||
    /*< public >*/
 | 
			
		||||
 | 
			
		||||
    DeviceRealize parent_realize;
 | 
			
		||||
    void (*parent_reset)(CPUState *cpu);
 | 
			
		||||
 | 
			
		||||
    /* TODO inline fields here */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10030,9 +10030,9 @@ static int ppc_fixup_cpu(PowerPCCPU *cpu)
 | 
			
		|||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void ppc_cpu_realize(Object *obj, Error **errp)
 | 
			
		||||
static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    PowerPCCPU *cpu = POWERPC_CPU(obj);
 | 
			
		||||
    PowerPCCPU *cpu = POWERPC_CPU(dev);
 | 
			
		||||
    CPUPPCState *env = &cpu->env;
 | 
			
		||||
    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
 | 
			
		||||
    ppc_def_t *def = pcc->info;
 | 
			
		||||
| 
						 | 
				
			
			@ -10083,6 +10083,8 @@ static void ppc_cpu_realize(Object *obj, Error **errp)
 | 
			
		|||
 | 
			
		||||
    qemu_init_vcpu(env);
 | 
			
		||||
 | 
			
		||||
    pcc->parent_realize(dev, errp);
 | 
			
		||||
 | 
			
		||||
#if defined(PPC_DUMP_CPU)
 | 
			
		||||
    {
 | 
			
		||||
        const char *mmu_model, *excp_model, *bus_model;
 | 
			
		||||
| 
						 | 
				
			
			@ -10354,7 +10356,7 @@ PowerPCCPU *cpu_ppc_init(const char *cpu_model)
 | 
			
		|||
 | 
			
		||||
    env->cpu_model_str = cpu_model;
 | 
			
		||||
 | 
			
		||||
    ppc_cpu_realize(OBJECT(cpu), &err);
 | 
			
		||||
    object_property_set_bool(OBJECT(cpu), true, "realized", &err);
 | 
			
		||||
    if (err != NULL) {
 | 
			
		||||
        fprintf(stderr, "%s\n", error_get_pretty(err));
 | 
			
		||||
        error_free(err);
 | 
			
		||||
| 
						 | 
				
			
			@ -10575,6 +10577,10 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
 | 
			
		|||
{
 | 
			
		||||
    PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
 | 
			
		||||
    CPUClass *cc = CPU_CLASS(oc);
 | 
			
		||||
    DeviceClass *dc = DEVICE_CLASS(oc);
 | 
			
		||||
 | 
			
		||||
    pcc->parent_realize = dc->realize;
 | 
			
		||||
    dc->realize = ppc_cpu_realizefn;
 | 
			
		||||
 | 
			
		||||
    pcc->parent_reset = cc->reset;
 | 
			
		||||
    cc->reset = ppc_cpu_reset;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue