From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeuvE-0004EF-0g for qemu-devel@nongnu.org; Wed, 23 Sep 2015 21:02:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeuvD-00058S-1J for qemu-devel@nongnu.org; Wed, 23 Sep 2015 21:02:03 -0400 Date: Thu, 24 Sep 2015 09:54:59 +1000 From: David Gibson Message-ID: <20150923235459.GG15944@voom.fritz.box> References: <1442495357-26547-1-git-send-email-david@gibson.dropbear.id.au> <1442495357-26547-8-git-send-email-david@gibson.dropbear.id.au> <5602F585.4000800@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="j2AXaZ4YhVcLc+PQ" Content-Disposition: inline In-Reply-To: <5602F585.4000800@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 07/10] spapr_pci: Allow PCI host bridge DMA window to be configured List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: thuth@redhat.com, aik@ozlabs.ru, gwshan@linux.vnet.ibm.com, qemu-devel@nongnu.org, alex.williamson@redhat.com, qemu-ppc@nongnu.org, pbonzini@redhat.com --j2AXaZ4YhVcLc+PQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 23, 2015 at 08:55:01PM +0200, Laurent Vivier wrote: >=20 >=20 > On 17/09/2015 15:09, David Gibson wrote: > > At present the PCI host bridge (PHB) for the pseries machine type has a > > fixed DMA window from 0..1GB (in PCI address space) which is mapped to = real > > memory via the PAPR paravirtualized IOMMU. > >=20 > > For better support of VFIO devices, we're going to want to allow for > > different configurations of the DMA window. > >=20 > > Eventually we'll want to allow the guest itself to reconfigure the wind= ow > > via the PAPR dynamic DMA window interface, but as a preliminary this pa= tch > > allows the user to reconfigure the window with new properties on the PHB > > device. > >=20 > > Signed-off-by: David Gibson > > --- > > hw/ppc/spapr_pci.c | 7 +++++-- > > include/hw/pci-host/spapr.h | 3 +-- > > 2 files changed, 6 insertions(+), 4 deletions(-) > >=20 > > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > > index b088491..622c4ac 100644 > > --- a/hw/ppc/spapr_pci.c > > +++ b/hw/ppc/spapr_pci.c > > @@ -1394,7 +1394,7 @@ static void spapr_phb_finish_realize(sPAPRPHBStat= e *sphb, Error **errp) > > sPAPRTCETable *tcet; > > uint32_t nb_table; > > =20 > > - nb_table =3D SPAPR_PCI_DMA32_SIZE >> SPAPR_TCE_PAGE_SHIFT; > > + nb_table =3D sphb->dma_win_size >> SPAPR_TCE_PAGE_SHIFT; > > tcet =3D spapr_tce_new_table(DEVICE(sphb), sphb->dma_liobn, > > 0, SPAPR_TCE_PAGE_SHIFT, nb_table, fals= e); > > if (!tcet) { > > @@ -1404,7 +1404,7 @@ static void spapr_phb_finish_realize(sPAPRPHBStat= e *sphb, Error **errp) > > } > > =20 > > /* Register default 32bit DMA window */ > > - memory_region_add_subregion(&sphb->iommu_root, 0, > > + memory_region_add_subregion(&sphb->iommu_root, sphb->dma_win_addr, > > spapr_tce_get_iommu(tcet)); > > } > > =20 > > @@ -1437,6 +1437,9 @@ static Property spapr_phb_properties[] =3D { > > SPAPR_PCI_IO_WIN_SIZE), > > DEFINE_PROP_BOOL("dynamic-reconfiguration", sPAPRPHBState, dr_enab= led, > > true), > > + /* Default DMA window is 0..1GB */ > > + DEFINE_PROP_UINT64("dma_win_addr", sPAPRPHBState, dma_win_addr, 0), > > + DEFINE_PROP_UINT64("dma_win_size", sPAPRPHBState, dma_win_size, 0x= 40000000), > > DEFINE_PROP_END_OF_LIST(), > > }; >=20 > Add them too to the vmstate_spapr_pci ? No. At least, not just now. This is the sort of configuration information that typically isn't migrated, instead requiring the far end to be set up matching. Which is a problem, but not one within the scope of this patch series. In any case just transferring the values wouldn't be enough - we'd need post_load handlers to actually rewire the TCE table accordingly. We will need to do this once we add dynamic DMA window support, but again, not in scope just now. --=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 --j2AXaZ4YhVcLc+PQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWAzvTAAoJEGw4ysog2bOS78sP/A6asI9RYDdqsEaMc8sGptU7 Xw/O4m2LZ6L6RWWBNVdyguA+RolzXEzk1+6Ayonf0XdyboSSej7vNrRhcxlIBbKY 4TJJjPkvgsVuAUpHtQJwSL8+rpni2JWEWk8uaPO+8dtiwouPntDZPy5SSYlPgHuz zrM9Lne4RYKuPn7VYRwxUXiUeHd+dAB6Xi9yYKS4rqzLqKVYPhplCCp47M2/Kflh sx82+RGLE5r4ctCiu5D8xcfSrs16XvkfiHGqDlvndKdbXgZ8JRt/7KnfkEaqjXMD oxAoDPPbuieJ/jZxIBfXR78VCRM5NISPREs7LrMAlUpMeWPVAmIZXHxie5Q9mSyD obRqQ3WHBJiuaJGUlKYEoAIKHqaWS3wLc4PZ7ImATpD8ZI/BHNZqscX9/1AqvQtO q3IIxVmEpwxXnQENxIE4bMnfwG2RR5uJKjWlcAPffAkT9EVi3QL5pAW3qizVwJOR xAV8x/qor5WQZL3g5uMjMij06xTWBpfTdxHgj6MH9WTEO/k1Fb011lB16Bj2yWl+ XPo5oSa/zS0bgywyrRTdkEHPm2hBgdlYPO/xv6u/4Ufi/QfyiPoTp+qsC1+PJHGo ZB/ul0qsTIzQ/vlpcuLm4MLC/MD53+iPB1r8d7hoCjNU27MQ1NGAxi1kVCSE3sUx 8kBLiuhEiupO7i2/8kYJ =5kOe -----END PGP SIGNATURE----- --j2AXaZ4YhVcLc+PQ--