From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1VPN-00027z-FV for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:26:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1VPK-0003hO-8A for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:26:33 -0500 Date: Wed, 25 Nov 2015 17:22:22 +1100 From: David Gibson Message-ID: <20151125062222.GL26118@voom.fritz.box> References: <1447907368-9208-1-git-send-email-david@gibson.dropbear.id.au> <1447907368-9208-4-git-send-email-david@gibson.dropbear.id.au> <5654271F.2050609@suse.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AQNmCumFClRcGgHG" Content-Disposition: inline In-Reply-To: <5654271F.2050609@suse.de> Subject: Re: [Qemu-devel] [Qemu-ppc] [RFC 03/12] spapr_pci: Eliminate class callbacks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: alex.williamson@redhat.com, qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, gwshan@au1.ibm.com, qemu-devel@nongnu.org --AQNmCumFClRcGgHG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 24, 2015 at 10:00:15AM +0100, Alexander Graf wrote: >=20 >=20 > On 19.11.15 05:29, David Gibson wrote: > > The EEH operations in the spapr-vfio-pci-host-bridge no longer rely on = the > > special groupid field in sPAPRPHBVFIOState. So we can simplify, removi= ng > > the class specific callbacks with direct calls based on a simple > > spapr_phb_eeh_enabled() helper. For now we implement that in terms of > > a boolean in the class, but we'll continue to clean that up later. > >=20 > > On its own this is a rather strange way of doing things, but it's a use= ful > > intermediate step to further cleanups. > >=20 > > Signed-off-by: David Gibson > > --- > > hw/ppc/spapr_pci.c | 44 ++++++++++++++++++++++---------------= ------- > > hw/ppc/spapr_pci_vfio.c | 18 +++++++----------- > > include/hw/pci-host/spapr.h | 13 +++++++++---- > > 3 files changed, 38 insertions(+), 37 deletions(-) > >=20 > > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > > index 55fa8db..9203d15 100644 > > --- a/hw/ppc/spapr_pci.c > > +++ b/hw/ppc/spapr_pci.c > > @@ -91,6 +91,13 @@ PCIDevice *spapr_pci_find_dev(sPAPRMachineState *spa= pr, uint64_t buid, > > return pci_find_device(phb->bus, bus_num, devfn); > > } > > =20 > > +static bool spapr_phb_eeh_available(sPAPRPHBState *sphb) > > +{ > > + sPAPRPHBClass *spc =3D SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); > > + > > + return spc->eeh_available; > > +} > > + > > static uint32_t rtas_pci_cfgaddr(uint32_t arg) > > { > > /* This handles the encoding of extended config space addresses */ > > @@ -430,7 +437,6 @@ static void rtas_ibm_set_eeh_option(PowerPCCPU *cpu, > > target_ulong rets) > > { > > sPAPRPHBState *sphb; > > - sPAPRPHBClass *spc; > > uint32_t addr, option; > > uint64_t buid; > > int ret; > > @@ -448,12 +454,11 @@ static void rtas_ibm_set_eeh_option(PowerPCCPU *c= pu, > > goto param_error_exit; > > } > > =20 > > - spc =3D SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); > > - if (!spc->eeh_set_option) { > > + if (!spapr_phb_eeh_available(sphb)) { > > goto param_error_exit; > > } > > =20 > > - ret =3D spc->eeh_set_option(sphb, addr, option); > > + ret =3D spapr_phb_vfio_eeh_set_option(sphb, addr, option); >=20 > First of all, I think the direction you're taking with this series is sou= nd. >=20 > However the hunk above would break compilation on systems that don't > have VFIO enabled (such as Windows hosts for example). Ah drat, good point. > The same holds true for the defines you're using later in the series. > Things like VFIO_EEH_PE_GET_STATE are not defined for non-Linux hosts. >=20 > I think the best path to get to where we really want to be is to define > qemu internal defines and eeh helpers for emulated phb mode. Make sure > the constants match the VFIO constants and use them interchangibly (with > a big fat comment saying that they are, and a number of ifdefs making > sure they stay identical). I'll see what I can do. --=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 --AQNmCumFClRcGgHG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWVVOeAAoJEGw4ysog2bOS048QAKw0cXjF9FltZ217FuAw6+I3 jBfvBqI7JwQCo39B3G7Kf8NCi+r8Xiat9Xc51IOYIYQ45Or0FatAQhSD1E7mkAQ2 tlBM7jxLFmyNR2nOCEHTon92XKdnhduX+xdefO8NtIEPVHXegRQA2wk+yFy7vE0B tAcALPddh4Kiw1ame/8VbKOamAIWzwJfXpQ+UM6K1Y6EfYz0wXsE7xAzA4v5Jztc ZptbUy3jB7ve3jOfbFQ/w/aT7GfWuT9sEmXqTi90VMTEp42gWqHGrdGY1oxSIIFe 3Vlx/nUhmEJLlnNowKaMsTYCV7xLFZddBizcprU3COcb6P17SjEDPw9pIL2qMLbK Y4c53Tnlm76B2ScRtUeMMrnmMtVzFM94vZ2tTzcWmXfWwZnIVspyZy8fnX9J0g5m /5aEHBm2qWQp5s64OBPKIeW+xc5GTZQEifs2YVsdLr3VsbjMJ3avtosUdwu8PaYj AWVTvG9GlTjW9CwgcgiUFVOMmU3xGZ0lP8UI2oLTKmmZ5a2UMguRVLsnoRETEkFS O3mGjQ2TPEroeOvaA4qMPTfyoMrjsqvDtIUWmZ53rfMNXLwiiHNCtanSuweM1C2q EI7s/J0stI/G0P3HMi04DqkTox+t1aVUaECPzQy0V3RcvhpOSFZUO1Dsg4gjeMQF NakTsyqem8ciZ/zhGG6T =3jH2 -----END PGP SIGNATURE----- --AQNmCumFClRcGgHG--