[resending after bounce] Am 10.05.2013 17:06, schrieb Anthony Liguori: > Andreas Färber <afaer...@suse.de> writes: > >> A transition from CPUPPCState to PowerPCCPU can be considered safe, >> just like PowerPCCPU::env access in the opposite direction. >> >> This should slightly improve interrupt performance. >> >> Reported-by: Anthony Liguori <aligu...@us.ibm.com> >> Signed-off-by: Andreas Färber <afaer...@suse.de> > > Another option would be to leave it and do something like: > > diff --git a/qom/object.c b/qom/object.c > index 75e6aac..cba1d88 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -126,8 +126,13 @@ static TypeImpl *type_register_internal(const TypeInfo > *info) > > TypeImpl *type_register(const TypeInfo *info) > { > + TypeImpl *impl; > + > assert(info->parent); > - return type_register_internal(info); > + impl = type_register_internal(info); > + g_free(impl->name); > + impl->name = info->name; > + return impl; > } > > TypeImpl *type_register_static(const TypeInfo *info) > @@ -449,10 +490,16 @@ Object *object_dynamic_cast_assert(Object *obj, const > char *typename) > ObjectClass *object_class_dynamic_cast(ObjectClass *class, > const char *typename) > { > - TypeImpl *target_type = type_get_by_name(typename); > + TypeImpl *target_type; > TypeImpl *type = class->type; > ObjectClass *ret = NULL; > > + if (type->name == typename) { > + return class; > + } > + > + target_type = type_get_by_name(typename); > + > if (!target_type) { > /* target class type unknown, so fail the cast */ > return NULL; > > Which makes casting an object to it's concrete class free.
Doesn't help here since concrete class is POWER7_v2.1-ppc64-cpu whereas we're casting to ppc64-cpu, with two-level hierarchy by now: POWER7_v2.1 -> POWER7 -> ppc64 -> device -> object. Regards, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg