From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH2Pp-0001Qp-O5 for qemu-devel@nongnu.org; Mon, 11 Aug 2014 23:06:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XH2Pe-00037E-A2 for qemu-devel@nongnu.org; Mon, 11 Aug 2014 23:06:25 -0400 Received: from ozlabs.org ([103.22.144.67]:57238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH2Pd-00036x-WD for qemu-devel@nongnu.org; Mon, 11 Aug 2014 23:06:14 -0400 Date: Tue, 12 Aug 2014 12:34:17 +1000 From: David Gibson Message-ID: <20140812023417.GC23065@voom.redhat.com> References: <1407594349-9291-1-git-send-email-eric.auger@linaro.org> <1407594349-9291-4-git-send-email-eric.auger@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gr/z0/N6AeWAPJVB" Content-Disposition: inline In-Reply-To: <1407594349-9291-4-git-send-email-eric.auger@linaro.org> Subject: Re: [Qemu-devel] [PATCH v5 03/10] hw/vfio/pci: introduce VFIODevice List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Auger Cc: peter.maydell@linaro.org, kim.phillips@freescale.com, eric.auger@st.com, patches@linaro.org, joel.schopp@amd.com, will.deacon@arm.com, qemu-devel@nongnu.org, a.rigo@virtualopensystems.com, Bharat.Bhushan@freescale.com, agraf@suse.de, alex.williamson@redhat.com, stuart.yoder@freescale.com, a.motakis@virtualopensystems.com, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org --gr/z0/N6AeWAPJVB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 09, 2014 at 03:25:42PM +0100, Eric Auger wrote: > Introduce the VFIODevice struct that is going to be shared by > VFIOPCIDevice and VFIOPlatformDevice. >=20 > Additional fields will be added there later on for review > convenience. >=20 > the group's device_list becomes a list of VFIODevice >=20 > This obliges to rework the reset_handler which becomes generic and > calls VFIODevice ops that are specialized in each parent object. > Also functions that iterate on this list must take care that the > devices can be something else than VFIOPCIDevice. The type is used > to discriminate them. >=20 > we profit from this step to change the prototype of > vfio_unmask_intx, vfio_mask_intx, vfio_disable_irqindex which now > apply to VFIODevice. They are renamed as *_irqindex. > The index is passed as parameter to anticipate their usage for > platform IRQs >=20 > Signed-off-by: Eric Auger >=20 > --- >=20 > v4->v5: > - fix style issues > - in vfio_initfn, rework allocation of vdev->vbasedev.name and > replace snprintf by g_strdup_printf > --- > hw/vfio/pci.c | 239 +++++++++++++++++++++++++++++++++++-----------------= ------ > 1 file changed, 146 insertions(+), 93 deletions(-) >=20 > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index c2cdd73..ae827c5 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -56,6 +56,11 @@ > #define VFIO_ALLOW_KVM_MSI 1 > #define VFIO_ALLOW_KVM_MSIX 1 > =20 > +enum { > + VFIO_DEVICE_TYPE_PCI =3D 0, > + VFIO_DEVICE_TYPE_PLATFORM =3D 1, > +}; > + > struct VFIOPCIDevice; > =20 > typedef struct VFIOQuirk { > @@ -193,9 +198,27 @@ typedef struct VFIOMSIXInfo { > void *mmap; > } VFIOMSIXInfo; > =20 > +typedef struct VFIODeviceOps VFIODeviceOps; > + > +typedef struct VFIODevice { > + QLIST_ENTRY(VFIODevice) next; > + struct VFIOGroup *group; > + char *name; > + int fd; > + int type; I'm assuming this takes values from the enum above. Is this actually necessary as a field, or could the same information be derived from the device's QOM class information? > + bool reset_works; > + bool needs_reset; > + VFIODeviceOps *ops; > +} VFIODevice; > + > +struct VFIODeviceOps { > + bool (*vfio_compute_needs_reset)(VFIODevice *vdev); > + int (*vfio_hot_reset_multi)(VFIODevice *vdev); > +}; Shouldn't these be methods in the QOM class, rather than a separate ops structure? --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --gr/z0/N6AeWAPJVB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJT6X0pAAoJEGw4ysog2bOS6aUP/185Xad+Q9Gy1i8ksN7AB/1Q Hj62mdz1iGKYD6Xpn9IU/Q8S7TKZggmLW+J7d0CZ4DzGzUrjDn2IKDwHEmjZK8bS hcfm6zkmR9QDA67H4UVQgsG/TiNZ43Hd+NqBJ+5aMcLI2/gd64Fro32jcPb1AK1u L4KEvaaN8f7frbMJv5PB6l2G+m5S25lWQS3DQtpY42tEXjxUnY3ircrMyZxdGBoN fD0IieGPvkCyOm5Dd+68n6ACpcrIBB/8I54ehd0kV+iA40gQv6yWV81qUKBCV0/2 n4/FTXgMW+KxNnz6iHrrkuca7zGTQKe4pfM1BkdjqASi7PbEJwtKeBNLeAbsqbEb xzczfEn3ekYf9mxyCcd7fp5rRoprQoCaOHGQWtJTBu44FAqNL7cBHKVcAMOyNhtR QAlLuk8tbedju0DZHiLhnF0NIxfoMtkxavf0jwdLBN0P71wIRsbgVvuEhZiiCkKE 93HbptPNNKfZR2LAbTnfZUYvPE82Nd65pPdhzGL3UsXcNgKYKEybC908ixFioA/s 0iiU70U6XrLDQLaGvOnclJ4dFuay76o8idffkk1K+bU32fgBazdMX7bCpnRGSGrE AC3wO62c9IR7G52bwfIFi4gzc1B6JjvhwTT6piHYP5eO7bkajD6XDUigvOcwy0CU h5kGuboOkbeCtRQ5BDe8 =Tnqd -----END PGP SIGNATURE----- --gr/z0/N6AeWAPJVB--