From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC4OM-0006f4-Qd for qemu-devel@nongnu.org; Mon, 06 Jul 2015 07:16:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZC4OI-0006Sk-Iy for qemu-devel@nongnu.org; Mon, 06 Jul 2015 07:16:53 -0400 Date: Mon, 6 Jul 2015 20:27:19 +1000 From: David Gibson Message-ID: <20150706102719.GD17857@voom.redhat.com> References: <1436148670-6592-1-git-send-email-aik@ozlabs.ru> <1436148670-6592-11-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OaZoDhBhXzo6bW1J" Content-Disposition: inline In-Reply-To: <1436148670-6592-11-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH qemu v10 10/14] spapr_pci: Enable vfio-pci hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Michael Roth , Alex Williamson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Gavin Shan --OaZoDhBhXzo6bW1J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 06, 2015 at 12:11:06PM +1000, Alexey Kardashevskiy wrote: > sPAPR IOMMU is managing two copies of an TCE table: > 1) a guest view of the table - this is what emulated devices use and > this is where H_GET_TCE reads from; > 2) a hardware TCE table - only present if there is at least one vfio-pci > device on a PHB; it is updated via a memory listener on a PHB address > space which forwards map/unmap requests to vfio-pci IOMMU host driver. >=20 > At the moment presence of vfio-pci devices on a bus affect the way > the guest view table is allocated. If there is no vfio-pci on a PHB > and the host kernel supports KVM acceleration of H_PUT_TCE, a table > is allocated in KVM. However, if there is vfio-pci and we do yet not > support KVM acceleration for these, the table has to be allocated > by the userspace. >=20 > When vfio-pci device is hotplugged and there were no vfio-pci devices > already, the guest view table could have been allocated by KVM which > means that H_PUT_TCE is handled by the host kernel and since we > do not support vfio-pci in KVM, the hardware table will not be updated. >=20 > This reallocates the guest view table in QEMU if the first vfio-pci > device has just been plugged. spapr_tce_realloc_userspace() handles this. >=20 > This replays all the mappings to make sure that the tables are in sync. > This will not have a visible effect though as for a new device > the guest kernel will allocate-and-map new addresses and therefore > existing mappings from emulated devices will not be used by vfio-pci > devices. >=20 > This adds calls to spapr_phb_dma_capabilities_update() in PCI hotplug > hooks. >=20 > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson --=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 --OaZoDhBhXzo6bW1J Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVmlgHAAoJEGw4ysog2bOSfV4P/0u1TnGl/2YNddSvWJWFrMW2 u72M+0sk+DB19xkM9pRnI/bDOI04PMGm1IiFvPL2IqIoqQWnaJq85nQeOWFCsUWv glAziG0REjjY7/VwS9a/0LDycRJG4GL7oGWczmv1DEjdnzy9Z6Yi0SFp56z6E2Q6 seAgLtgth9NV/QgNNx3XDYdlOooedxGZ1x19TDytQ7l5fOkZX8s0LU8JyIpMSJqm e+u5PKo9IghzbDzr/80IMFNHus6DGja3+YfjBAvarXaciVlO9VYDv4Zy/dhytYRX bvHGTmyItwY5emOGwiUdhh1/fhjhG3v8FSxWRABVz7kR/F1+EFOs2AjvaxkfNwkp 9p1yWZvtR/cY+x05ao3v9/VvMnkkB7lfeISgowVpnP3QDwsVBPKdQkhiKhGnzu5c m6gusKrU9sYcrlFa2BJqjybVEmREc6Wk4sbZHVjdzJqwwW/w/bxSb81j6bLWW3iL VFcGKzkqibEKHnuZtX0yyHhyAya+DcDaTNFKnw3mUg9MlDgYBraUnI7Iyi7QqYbj qdL7hpqYIVNH5dByihQVn8d+D4/VQHfAKr2dLdV2vZKiWiGslXIJ2hh5Q9LpJHFd +Fh2dnp273g+gMneWHjEfzb8yKxuIdr9oQbx/PP8qWIAvgPGkx4bwqqX+HkELRvs 5PFIN/gCXxswXu9ywFOD =nPW+ -----END PGP SIGNATURE----- --OaZoDhBhXzo6bW1J--