On Tue, May 24, 2016 at 2:02 PM, David Kiarie <davidkiar...@gmail.com> wrote: > On Tue, May 24, 2016 at 1:40 PM, Jan Kiszka <jan.kis...@web.de> wrote: >> On 2016-05-23 23:48, Marcel Apfelbaum wrote: >>> On 05/23/2016 08:06 PM, David Kiarie wrote: >>>> On Tue, May 17, 2016 at 10:15 AM, Peter Xu <pet...@redhat.com> 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 <pet...@redhat.com> >>>>> --- >>>>> 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. >> >> Given that the AMD IOMMU is more a platform than a PCI device, I would >> also go for deriving from SYS_BUS_DEVICE (and later on a common x86 >> IOMMU class) and embedding a PCI_DEVICE. And the Intel IOMMU has no PCI >> device feature at all.
huh, should it be possible to embed the whole PCI device state ?Haven't tried that yet. > > Yes, I managed to do that by getting rid of PCI device specific > callbacks(replaced them with DeviceState callbacks) so I get a compile > and no runtime fatality but device(AMD IOMMU) never appears in the > device tree. > >> >> Jan >> >>