From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNs1S-0007cK-Ja for qemu-devel@nongnu.org; Tue, 17 Feb 2015 18:57:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNs1M-0003JA-Qk for qemu-devel@nongnu.org; Tue, 17 Feb 2015 18:57:46 -0500 Date: Wed, 18 Feb 2015 10:56:41 +1100 From: David Gibson Message-ID: <20150217235641.GM26645@voom.fritz.box> References: <1422523650-2888-1-git-send-email-aik@ozlabs.ru> <1422523650-2888-19-git-send-email-aik@ozlabs.ru> <20150205044927.GQ25675@voom.fritz.box> <54E2A936.4020304@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hnsKUeImFCk/igEn" Content-Disposition: inline In-Reply-To: <54E2A936.4020304@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH v4 18/18] vfio: Enable in-kernel acceleration via VFIO KVM device 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, Alexander Graf --hnsKUeImFCk/igEn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 17, 2015 at 01:36:38PM +1100, Alexey Kardashevskiy wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > On 02/05/2015 03:49 PM, David Gibson wrote: > > On Thu, Jan 29, 2015 at 08:27:30PM +1100, Alexey Kardashevskiy wrote: > >> TCE hypercalls (H_PUT_TCE, H_PUT_TCE_INDIRECT, H_STUFF_TCE) use a > >> logical bus number (LIOBN) to identify which TCE table the request > >> is addressed to. However VFIO kernel driver operates with IOMMU > >> group IDs and has no idea about which LIOBN corresponds to which > >> group. If the host kernel supports in-kernel acceleration for TCE > >> calls, we have to provide the LIOBN to IOMMU mapping information. > >>=20 > >> This makes use of a VFIO KVM device's=20 > >> KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE_LIOBN attribute to set the link=20 > >> between LIOBN and IOMMU group. > >>=20 > >> The vfio_container_spapr_set_liobn() helper is implemented > >> completely in vfio.c because kvm_vfio_spapr_tce_liobn needs a group > >> fd and we do not want to share resources likes that outside vfio.c. > >=20 > > I thought you'd moved away from the idea of in-kernel TCE=20 > > acceleration, since big DMA windows made it unnecessary. >=20 >=20 > Not entirely. DDW may not be supported by some hardware (like nVidia > being able to generate only 40bit DMA addresses without hacks). DMA > memory registering is pretty much about it - when we preregister pages, > the KVM acceleration becomes lot simpler as it does not have to take care > of pinning or locked_vm accounting. Ok, that makes sense. > But I should have not posted it here anyway, too early :) > >> Signed-off-by: Alexey Kardashevskiy ---=20 > >> hw/ppc/spapr_iommu.c | 1 + hw/ppc/spapr_pci_vfio.c | 11 > >> +++++++++++ hw/vfio/common.c | 33 > >> +++++++++++++++++++++++++++++++++ include/hw/vfio/vfio.h | 4 ++++=20 > >> 4 files changed, 49 insertions(+) > >>=20 > >> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index > >> 258f837..3de95d7 100644 --- a/hw/ppc/spapr_iommu.c +++ > >> b/hw/ppc/spapr_iommu.c @@ -142,6 +142,7 @@ static int > >> spapr_tce_table_realize(DeviceState *dev) if (!tcet->table) { size_t > >> table_size =3D tcet->nb_table * sizeof(uint64_t); tcet->table =3D > >> g_malloc0(table_size); + tcet->vfio_accel =3D false; > >=20 > > This should probably have a qdev prop so that it can be explicitly=20 > > disabled on a per-device basis for testing. >=20 >=20 > It is a TCE table's property, how can you disable it if it is not created > via the command line? Uh, yeah it would have to be a property on VIO devices and on VFIO host bridges which the propagates the option to the TCE table. Hrm, that does sound a bit messy now I think about it. --=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 --hnsKUeImFCk/igEn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU49U5AAoJEGw4ysog2bOSKa4QAIPfpRHn4fYOb64xdCEQQNF3 VfZvQDO64J12U9fvO4mTm7GpIHJQiwvuva80icWsmlnX6Du/zI0vdZ4EmQaFvnZT EjJUnPxarttmfpHT8XIwPWzMzooH5BmxTXN5vdZCaKlooG4qdlb1C3NOtl9F1CUc IutcF/p0BQEM9UJBtVNEsuGfFDjo4KTVk06t8OV0tKn1gaARZ45+gUE8LjvQOgzs WfcL4fy0DbFFqH0Jz61UsPZ2hipDbS4KGB9Smbfn3F8mfUZ5DSSokH96HG4vMQCU ckusHYx6cMe2ifMtqkKjsUHSRbDSCHxmvGtogmkd+s9fvTf/FfMz/6ipTB8R0y7W 1nTtbPV0FSPSvgclcqL+ZrKKkodGPvCvTdsaEnfq6ECMuBLC/5IDUe0rK2VXzE14 gwbOm+NSsGNjfCviwvt6mEIRH7kPUrLzM+SAah1GuUnI9rBGpWS9oeuGy0OndUhm QdTn1K16r4+3csIppL7Blu7ZJg75qQg6uOWeuPwbaeOcFd6T+Iw+HY/k/ZVQAht7 bFNZDtuLdxA/tw/4U5WCJLUZy9xBlr2FAahU+E5kIxi3xF5uype0TH0inJzb+rrF glmMPysjxeL/Z1Br/Wi3vMe/KwrCf4adITGujh2AuxGCEvm3VrovY3WQ3YRYgJ1k 903Sxv/lUyGE14UpZpDU =vDEo -----END PGP SIGNATURE----- --hnsKUeImFCk/igEn--