Am 01.08.2013 05:22, schrieb Alexey Kardashevskiy: > On 08/01/2013 01:07 PM, Andreas Färber wrote: >> Am 01.08.2013 04:08, schrieb Alexey Kardashevskiy: >>> On 08/01/2013 11:29 AM, Andreas Färber wrote: >>>> Am 01.08.2013 02:14, schrieb Alexey Kardashevskiy: >>>>> On 08/01/2013 05:52 AM, Andreas Färber wrote: >>>>>> Am 17.07.2013 08:37, schrieb Alexey Kardashevskiy: >>>>>>> +/* >>>>>>> + * XICS-KVM >>>>>>> + */ >>>>>>> +static void xics_kvm_cpu_setup(XICSState *icp, PowerPCCPU *cpu) >>>>>>> +{ >>>>>>> + CPUState *cs; >>>>>>> + ICPState *ss; >>>>>>> + XICSStateKVM *icpkvm = (XICSStateKVM *) object_dynamic_cast( >>>>>>> + OBJECT(icp), TYPE_XICS_KVM); >>>>>>> + XICSStateClass *xics_info = >>>>>>> XICS_CLASS(object_class_by_name(TYPE_XICS)); >>>>>> >>>>>> Are you intentionally accessing that class by name rather than using >>>>>> XICS_GET_CLASS(icp), which allows the KVM variant to overwrite things? >>>>> >>>>> >>>>> This is KVM's CPU_setup(). I want to call non-KVM CPU_setup afterwards, >>>>> i.e. "call parent method". XICS_GET_CLASS will return XICS_KVM class but >>>>> not XICS, no? >>>> >>>> OK, then I'll CC you on my upcoming virtio v2 series that introduces a >>>> more comprehensable macro for this purpose: I would/will recommend to >>>> use a local macro KVM_XICS_GET_PARENT_CLASS(obj) - where you could move >>>> your current inline implementation - to make more obvious that it's not >>>> a mistake. >>> >>> Oh. So. This has to wait till that virtio thing gets to upstream. Correct? >> >> Not quite, there is no dependency on virtio. >> >> a) You could do >> #define KVM_XICS_GET_PARENT_CLASS(obj) \ >> object_class_by_name(TYPE_KVM_XICS) > > TYPE_KVM_XICS or TYPE_XICS?
Sorry for late reply: When using object_class_by_name() directly, then TYPE_XICS (or now TYPE_COMMON_XICS); when using object_get_parent() or the wrapping OBJECT_GET_PARENT_CLASS() then TYPE_KVM_XICS, i.e. the QOM type to which the C function belongs. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg