From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abR2O-0002pq-BS for qemu-devel@nongnu.org; Thu, 03 Mar 2016 06:03:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abR2J-0001t2-SL for qemu-devel@nongnu.org; Thu, 03 Mar 2016 06:03:20 -0500 Date: Thu, 3 Mar 2016 17:38:57 +1100 From: David Gibson Message-ID: <20160303063857.GN1620@voom.redhat.com> References: <1456823441-46757-1-git-send-email-aik@ozlabs.ru> <1456823441-46757-14-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NJSRbAqOy4NeGDns" Content-Disposition: inline In-Reply-To: <1456823441-46757-14-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH qemu v13 13/16] spapr_iommu: Remove need_vfio flag from sPAPRTCETable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Alex Williamson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org --NJSRbAqOy4NeGDns Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 01, 2016 at 08:10:38PM +1100, Alexey Kardashevskiy wrote: > sPAPRTCETable has a need_vfio flag which is passed to > kvmppc_create_spapr_tce() and controls whether to create a guest view > table in KVM as this depends on the host kernel ability to accelerate > H_PUT_TCE for VFIO devices. We would set this flag at the moment > when sPAPRTCETable is created in spapr_tce_new_table() and > use when the table is allocated in spapr_tce_table_realize(). >=20 > Now we explicitly enable/disable DMA windows via spapr_tce_table_enable() > and spapr_tce_table_disable() and can pass this flag directly without > caching it in sPAPRTCETable. >=20 > This removes the flag. This should cause no behavioural change. >=20 > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson > --- > hw/ppc/spapr_iommu.c | 13 +++++-------- > include/hw/ppc/spapr.h | 1 - > 2 files changed, 5 insertions(+), 9 deletions(-) >=20 > diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c > index 4c52cf4..8aa2238 100644 > --- a/hw/ppc/spapr_iommu.c > +++ b/hw/ppc/spapr_iommu.c > @@ -210,8 +210,9 @@ void spapr_tce_set_need_vfio(sPAPRTCETable *tcet, boo= l need_vfio) > { > size_t table_size =3D tcet->nb_table * sizeof(uint64_t); > void *newtable; > + bool tcet_can_vfio =3D tcet->fd < 0; > =20 > - if (need_vfio =3D=3D tcet->need_vfio) { > + if (need_vfio =3D=3D tcet_can_vfio) { > /* Nothing to do */ > return; > } > @@ -222,8 +223,6 @@ void spapr_tce_set_need_vfio(sPAPRTCETable *tcet, boo= l need_vfio) > return; > } > =20 > - tcet->need_vfio =3D true; > - > if (tcet->fd < 0) { > /* Table is already in userspace, nothing to be do */ > return; > @@ -261,7 +260,7 @@ sPAPRTCETable *spapr_tce_new_table(DeviceState *owner= , uint32_t liobn) > return tcet; > } > =20 > -static void spapr_tce_table_do_enable(sPAPRTCETable *tcet) > +static void spapr_tce_table_do_enable(sPAPRTCETable *tcet, bool need_vfi= o) > { > if (!tcet->nb_table) { > return; > @@ -271,7 +270,7 @@ static void spapr_tce_table_do_enable(sPAPRTCETable *= tcet) > tcet->page_shift, > tcet->nb_table, > &tcet->fd, > - tcet->need_vfio); > + need_vfio); > =20 > memory_region_set_size(&tcet->iommu, > (uint64_t)tcet->nb_table << tcet->page_shift); > @@ -291,9 +290,8 @@ void spapr_tce_table_enable(sPAPRTCETable *tcet, > tcet->bus_offset =3D bus_offset; > tcet->page_shift =3D page_shift; > tcet->nb_table =3D nb_table; > - tcet->need_vfio =3D need_vfio; > =20 > - spapr_tce_table_do_enable(tcet); > + spapr_tce_table_do_enable(tcet, need_vfio); > } > =20 > void spapr_tce_table_disable(sPAPRTCETable *tcet) > @@ -312,7 +310,6 @@ void spapr_tce_table_disable(sPAPRTCETable *tcet) > tcet->bus_offset =3D 0; > tcet->page_shift =3D 0; > tcet->nb_table =3D 0; > - tcet->need_vfio =3D false; > } > =20 > static void spapr_tce_table_unrealize(DeviceState *dev, Error **errp) > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 5d2f8f4..505cb3a 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -546,7 +546,6 @@ struct sPAPRTCETable { > uint32_t page_shift; > uint64_t *table; > bool bypass; > - bool need_vfio; > int fd; > MemoryRegion root, iommu; > struct VIOsPAPRDevice *vdev; /* for @bypass migration compatibility = only */ --=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 --NJSRbAqOy4NeGDns Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJW19wBAAoJEGw4ysog2bOSilsP+gJzQYn1EYYCerUkJiCPvrFz JApemfsU2dOz8FHWfG5hFWuDPN9KZmJbIX5pfyGJbCN4C6HUKkyTz4GAvSZ0dI1P EEEUEEIBfiA9zAUJ5SUK1/DgRg+1Qbhf9pDNReS+UmOxVKMmb/PmSjKUgIsA9/Jb 7PIrCw0GXmerg/kBu4C4fvcVsPl0/wx0mtG8BPjlj2t6Uk931QB6TYLJm08UV2lF dC5O1g655QDNc5wM2TEcC7u8k5tqoQu1G6W6S/3h8SeDgTXO4W18jdpvRi+R0Nab On6tRNbK9bsceDRNTpPJNDDm2UeZoREV5LfYqSftWddJeqntFkdMdG4pVZO4IiyG qwjLXmoIEpMKZxB13CLKV6KfagAEXxX6WPtIeBprhss90tMeOscyYodFdwkjrspu yDqYG/+64GTIjFv+2gCSL9MoYmWCZJiCztTr/ySAGUYQmya1OKE3nVM4NZEn1ESl V75GPxRjY8l6J8EGt8UgZ5YeSNN6vGBKCp7YT+LPdMOskcsiR3auUrBsh7hRXb6j R9IX50VEOptNIPC/3w/emCXlW5iorY4JdfP+ikh0QU9SqS8RZun0NDSQZFyOj8x9 MyuKEyV2UpTRKJSfadXU4/drrwCmPXN5357qzLKQpKzXhU9isAdnCIw+Mk5lOej5 ItZxGgirQx9zN4Q8ajah =0vC3 -----END PGP SIGNATURE----- --NJSRbAqOy4NeGDns--