From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6u8G-00013u-62 for qemu-devel@nongnu.org; Mon, 22 Jun 2015 01:18:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6u8C-0007C4-9C for qemu-devel@nongnu.org; Mon, 22 Jun 2015 01:18:56 -0400 Date: Mon, 22 Jun 2015 15:14:20 +1000 From: David Gibson Message-ID: <20150622051420.GU13352@voom.redhat.com> References: <1434627456-13745-1-git-send-email-aik@ozlabs.ru> <1434627456-13745-12-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ClNI7qcIuZbdM87U" Content-Disposition: inline In-Reply-To: <1434627456-13745-12-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH qemu v8 11/14] spapr_pci: Enable vfio-pci hotplug 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, Gavin Shan , Alexander Graf --ClNI7qcIuZbdM87U Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 18, 2015 at 09:37:33PM +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 Please ignore comment about hotplug I made on the previous patch, not having read this one. --=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 --ClNI7qcIuZbdM87U Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVh5msAAoJEGw4ysog2bOSZ2IQAIfC9VzWByQ4ueys2T0uZ9mH zCUC5SO2bjnHbAqo1dtv4pnW9osSAx7PzfK8aEts1AC7dukmPPX2R64Les70GNLW mHcVEH4N8fA0uZz6MrK3jAi6XYQPVHNgFSU6Ohlccj/sZaqKxMnJDgdlVKr1VHfS Uu2v67U/W4BALMlVFYILjKFUxpn/ZgcGl5PnzOjWjlnFH8HGRTO4hENdVNaQWQgy ODESiCjW7ruRpOMJcuTH8GtDhSH9Cul517pdO5sgeBhxLAjw0QvSgQ/X/07qHl3x Yhu1HVNThW0vUoJTp/vzXkRdTzD6DBZ4kYVdtsP5SH9cWCEyr+C9uOQHzyXxi863 l65vTyX0K8ZTdhfcCe1y3yGKQ3xuDhOAYtTRUKFemWQ3Qvl1erNtiwYAynzoF/Ml NWWH82p5w5c9T+zbDDNYY7ALiDyB/6aixPyF+EZ1UeeFQTicmAv7txSGpBo7HJoS 4wZ7RP1FAng7kSjiDi10biZ4c2+X3INJq6+JlBU5AOkQarjm1yIJ7Yn4vwrD5wk/ HYJ61tI84xIAVyMRyAfbkt7lYpsKFfLeS9N0dFSxX5lnKnMWqOLcgOZZmZIwuvAF 24Fq/sDwQ6HEeg87GWG7kSw6t7P8Td6eHWKLasJiGKIx0a5vcf/VKl9BnhJu4OIF N1VD18UtKBxubtFG1BBN =Y4Ub -----END PGP SIGNATURE----- --ClNI7qcIuZbdM87U--