From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBE3W-0002GX-SE for qemu-devel@nongnu.org; Tue, 13 Jan 2015 21:51:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBE3T-0007J2-Kb for qemu-devel@nongnu.org; Tue, 13 Jan 2015 21:51:38 -0500 Date: Wed, 14 Jan 2015 13:42:58 +1100 From: David Gibson Message-ID: <20150114024258.GT3654@voom.BigPond> References: <1420765371-25342-1-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Sx3M3By4KbPIrykT" Content-Disposition: inline In-Reply-To: <1420765371-25342-1-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [RFC PATCH] spapr_vio/spapr_iommu: Move VIO bypass where it belongs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf --Sx3M3By4KbPIrykT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 09, 2015 at 12:02:51PM +1100, Alexey Kardashevskiy wrote: > Instead of tweaking a TCE table device by adding there a bypass flag, > let's add an alias to RAM and IOMMU memory region, and enable/disable > those according to the selected bypass mode. > This way IOMMU memory region can have size of the actual window rather > than ram_size which is essential for upcoming DDW support. >=20 > Signed-off-by: Alexey Kardashevskiy > --- >=20 > The main reason for this patch is DDW and the fact that sPAPRTCETable > used for DMA windows for VFIO. My latest approach removes all DMA windows > on the guest reset (and creates a new 32bit one) which means than VFIO > unmaps everything and this fails as normally sPAPRTCETable MemoryRegion is > ram_size big (to support bypass) while it should be 1-2GB. Paolo already mentioned the only significant problem I see with this, which is migration backwards compat. Otherwise it looks good, sorry I messed it up in the first place :). [snip] > @@ -456,14 +469,25 @@ static int spapr_vio_busdev_init(DeviceState *qdev) > =20 > if (pc->rtce_window_size) { > uint32_t liobn =3D SPAPR_VIO_BASE_LIOBN | dev->reg; > + > + memory_region_init(&dev->mrroot, OBJECT(dev), "iommu-spapr-root", > + ram_size); > + memory_region_init_alias(&dev->mrbypass, OBJECT(dev), > + "iommu-spapr-bypass", get_system_memory= (), > + 0, ram_size); > + memory_region_add_subregion_overlap(&dev->mrroot, 0, &dev->mrbyp= ass, 1); > + address_space_init(&dev->as, &dev->mrroot, qdev->id); > + > dev->tcet =3D spapr_tce_new_table(qdev, liobn, > 0, > SPAPR_TCE_PAGE_SHIFT, > pc->rtce_window_size >> > SPAPR_TCE_PAGE_SHIFT, false); > - address_space_init(&dev->as, spapr_tce_get_iommu(dev->tcet), qde= v->id); > + memory_region_add_subregion_overlap(&dev->mrroot, 0, > + spapr_tce_get_iommu(dev->tce= t), 2); > } > =20 > + ^^ Tiny nit, extraneous whitespace change. --=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 --Sx3M3By4KbPIrykT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUtdeyAAoJEGw4ysog2bOSaS0QALDNyvktgPlJmZrKWKa2k9sC +Q+8zTDEh+JL1A9gZBobsItppzoOgLl70YvkONqN21SG6XWuRDg7mKXIpg9Ln94D D8xcKcdMwSY8ehEdt3faKXicExW/abuQ7MyXbLNCuxB1HZ3twwW3wbOAmIcgQHw5 UPwb2XU81SHJKsq3DVxH4N++cPzCFMGvbpZ5TgHHirfKGyt/81qq4zxvY6voGwj1 eSgkzfzsKfV1rfcoRgtvQKxUmcNI4kV9DMsL/sk9dCiaHmQ1TfDFrfXygbGBCaI0 gb/MGu/hEPXpHj/DOgmk5dIXNyYH8kO+lEr4Ccu2rL7Zp1OBQFAEG0FGhTlul+Hz IKziQTA0TyzFsO2B8gTpoPLstkBzNfbeyUtW+j6DtW9WVVYTnGAukUI1Po+7naV4 FSlMOMlO6bPymWW22duaT2wgChUUieeB79LDCW2xaees1sg97iI2H3qPXAe7l1qI Vt3odmuZ4QY8DBl7UrkGBJdgabvQNEVP6qX4zG0Sb7huEoru9RP0hjixpHxWjQfI R4v7mpY0fVltMEzZQLbspDpQdVnl9U3MNyVCag24FKqVl7uN2TxOjZHf6Va8VXl7 ln4DmBClWTpIcDyA0YLdEeGV2cmeCJWB5AdRtHQQ8bH2zi73pLLWXvzl/tzwYyuk 4lys9rTQ1dNRmjpLDpE4 =dS0T -----END PGP SIGNATURE----- --Sx3M3By4KbPIrykT--