Received: from eggs.gnu.org ([2001:4830:134:3::10]:41548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6g2m-0007JK-Nv for qemu-devel@nongnu.org; Tue, 06 Aug 2013 08:07:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6g2a-0007qR-JC for qemu-devel@nongnu.org; Tue, 06 Aug 2013 08:07:16 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:63413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6g2a-0007pz-CW for qemu-devel@nongnu.org; Tue, 06 Aug 2013 08:07:04 -0400 Received: by mail-pd0-f181.google.com with SMTP id g10so252358pdj.40 for ; Tue, 06 Aug 2013 05:07:03 -0700 (PDT) Message-ID: <5200E6E0.5030403@ozlabs.ru> Date: Tue, 06 Aug 2013 22:06:56 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1375777673-20274-1-git-send-email-aik@ozlabs.ru> <1375777673-20274-7-git-send-email-aik@ozlabs.ru> <5200CC0D.5000908@suse.de> In-Reply-To: <5200CC0D.5000908@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 6/6] xics-kvm: Support for in-kernel XICS interrupt controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: Anthony Liguori , Alexander Graf , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Paul Mackerras , David Gibson On 08/06/2013 08:12 PM, Andreas Färber wrote: >> diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h >> index 1066f69..e5889e9 100644 >> --- a/include/hw/ppc/xics.h >> +++ b/include/hw/ppc/xics.h >> @@ -35,6 +35,9 @@ >> #define TYPE_XICS "xics" >> #define XICS(obj) OBJECT_CHECK(XICSState, (obj), TYPE_XICS) >> >> +#define TYPE_KVM_XICS "xics-kvm" >> +#define KVM_XICS(obj) OBJECT_CHECK(KVMXICSState, (obj), TYPE_KVM_XICS) >> + >> #define XICS_COMMON_CLASS(klass) \ >> OBJECT_CLASS_CHECK(XICSStateClass, (klass), TYPE_XICS_COMMON) >> #define XICS_CLASS(klass) \ >> @@ -44,6 +47,9 @@ >> #define XICS_GET_CLASS(obj) \ >> OBJECT_GET_CLASS(XICSStateClass, (obj), TYPE_XICS) >> >> +#define XICS_GET_PARENT_CLASS(obj) \ >> + (XICSStateClass *) object_class_get_parent(object_get_class(obj)) > > This is dangerous in that it takes the parent class of whatever type the > obj argument turns out to have. This has been discussed in lengths in > the context of Peter C.'s proposal for ISA/ARM realize cleanup. How is it dangerous? I perfectly know what I call it with. And simple run will crash QEMU if something is wrong. > This should therefore be a macro per type specifying the TYPE_*, either > for object_class_by_name() or to my proposed macro which abstracts the > implementation to core QOM code. Please, be more specific. What type should be used in macro here - XICS_COMMON or KVM_XICS? I asked already in the other thread but somehow you missed it. Neither really makes sense for me as I believe that get_parent is exactly for the cases (and this is the case) when I do not want to know exact parent type and I already know the current type. Thanks. > XICS_CLASS() would be nicer than open-coding, but why cast here? > DeviceClass can be needed just as well. I do not need DeviceClass, at all, anywhere. I need a pointer to a my specific cpu_setup callback, this is all about it. -- Alexey