From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b59lJ-0004sE-U9 for qemu-devel@nongnu.org; Tue, 24 May 2016 06:40:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b59lF-0004SV-P5 for qemu-devel@nongnu.org; Tue, 24 May 2016 06:40:32 -0400 Received: from mout.web.de ([212.227.17.11]:60019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b59lF-0004SM-EO for qemu-devel@nongnu.org; Tue, 24 May 2016 06:40:29 -0400 References: <1463469353-25642-1-git-send-email-peterx@redhat.com> <1463469353-25642-9-git-send-email-peterx@redhat.com> <57437AAF.4060905@gmail.com> From: Jan Kiszka Message-ID: <57442F8E.1090302@web.de> Date: Tue, 24 May 2016 12:40:14 +0200 MIME-Version: 1.0 In-Reply-To: <57437AAF.4060905@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2v2m7eHilil8bxPMntCe0cj9CqRnEUVqA" 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: marcel@redhat.com, David Kiarie , Peter Xu Cc: ehabkost@redhat.com, "Michael S. Tsirkin" , jasowang@redhat.com, rkrcmar@redhat.com, QEMU Developers , alex.williamson@redhat.com, wexu@redhat.com, pbonzini@redhat.com, imammedo@redhat.com, rth@twiddle.net This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2v2m7eHilil8bxPMntCe0cj9CqRnEUVqA From: Jan Kiszka To: marcel@redhat.com, David Kiarie , Peter Xu Cc: ehabkost@redhat.com, "Michael S. Tsirkin" , jasowang@redhat.com, rkrcmar@redhat.com, QEMU Developers , alex.williamson@redhat.com, wexu@redhat.com, pbonzini@redhat.com, imammedo@redhat.com, rth@twiddle.net Message-ID: <57442F8E.1090302@web.de> Subject: Re: [Qemu-devel] [PATCH v7 08/25] x86-iommu: introduce parent class References: <1463469353-25642-1-git-send-email-peterx@redhat.com> <1463469353-25642-9-git-send-email-peterx@redhat.com> <57437AAF.4060905@gmail.com> In-Reply-To: <57437AAF.4060905@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 wrote: >>> Introducing parent class for intel-iommu devices named "x86-iommu". T= his >>> is preparation work to abstract shared functionalities out from Intel= >>> and AMD IOMMUs. Currently, only the parent class is introduced. It do= es >>> nothing yet. >>> >>> Signed-off-by: Peter Xu >>> --- >>> hw/i386/Makefile.objs | 2 +- >=20 > [...] >=20 >>> + >>> +static const TypeInfo x86_iommu_info =3D { >>> + .name =3D TYPE_X86_IOMMU_DEVICE, >>> + .parent =3D TYPE_SYS_BUS_DEVICE, >>> + .instance_size =3D sizeof(X86IOMMUState), >>> + .class_init =3D x86_iommu_class_init, >>> + .class_size =3D sizeof(X86IOMMUClass), >>> + .abstract =3D 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. >> >=20 > 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. Jan --2v2m7eHilil8bxPMntCe0cj9CqRnEUVqA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAldEL44ACgkQitSsb3rl5xQKIwCgslJLlnBYZB5xVSf0M7JgXRYV IjwAn2PBPlWWB6QSKEzT/S6cLdresneK =v2V0 -----END PGP SIGNATURE----- --2v2m7eHilil8bxPMntCe0cj9CqRnEUVqA--