From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4xiZ-00008G-M2 for qemu-devel@nongnu.org; Mon, 23 May 2016 17:48:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4xiR-0004bB-RK for qemu-devel@nongnu.org; Mon, 23 May 2016 17:48:54 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4xiR-0004b2-K3 for qemu-devel@nongnu.org; Mon, 23 May 2016 17:48:47 -0400 Received: by mail-wm0-x242.google.com with SMTP id q62so403784wmg.3 for ; Mon, 23 May 2016 14:48:47 -0700 (PDT) Reply-To: marcel@redhat.com References: <1463469353-25642-1-git-send-email-peterx@redhat.com> <1463469353-25642-9-git-send-email-peterx@redhat.com> From: Marcel Apfelbaum Message-ID: <57437AAF.4060905@gmail.com> Date: Tue, 24 May 2016 00:48:31 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v7 08/25] x86-iommu: introduce parent class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Kiarie , Peter Xu Cc: ehabkost@redhat.com, "Michael S. Tsirkin" , jasowang@redhat.com, rkrcmar@redhat.com, QEMU Developers , alex.williamson@redhat.com, Jan Kiszka , wexu@redhat.com, pbonzini@redhat.com, Marcel Apfelbaum , imammedo@redhat.com, rth@twiddle.net On 05/23/2016 08:06 PM, David Kiarie wrote: > On Tue, May 17, 2016 at 10:15 AM, Peter Xu wrote: >> Introducing parent class for intel-iommu devices named "x86-iommu". This >> is preparation work to abstract shared functionalities out from Intel >> and AMD IOMMUs. Currently, only the parent class is introduced. It does >> nothing yet. >> >> Signed-off-by: Peter Xu >> --- >> hw/i386/Makefile.objs | 2 +- [...] >> + >> +static const TypeInfo x86_iommu_info = { >> + .name = TYPE_X86_IOMMU_DEVICE, >> + .parent = TYPE_SYS_BUS_DEVICE, >> + .instance_size = sizeof(X86IOMMUState), >> + .class_init = x86_iommu_class_init, >> + .class_size = sizeof(X86IOMMUClass), >> + .abstract = true, >> +}; > > As I suspected am having some trouble parenting a PCI device from a > Bus device but I will investigate further to see if I can manage > something. > You cannot derive from both SYS_BUS_DEVICE and PCI_DEVICE. You would need a composition; your device would be a SYS_BUS_DEVICE and its state would include a PCI_DEVICE (or the other way around). Then you can divide the responsibilities between them. Thanks, Marcel >> + [...]