From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abJZW-0000vw-ED for qemu-devel@nongnu.org; Wed, 02 Mar 2016 22:05:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abJZT-0003pr-73 for qemu-devel@nongnu.org; Wed, 02 Mar 2016 22:05:02 -0500 Date: Thu, 3 Mar 2016 14:02:27 +1100 From: David Gibson Message-ID: <20160303030227.GF1620@voom.redhat.com> References: <1456823441-46757-1-git-send-email-aik@ozlabs.ru> <1456823441-46757-7-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="juZjCTNxrMaZdGZC" Content-Disposition: inline In-Reply-To: <1456823441-46757-7-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH qemu v13 06/16] spapr_pci: Reset DMA config on PHB reset 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 --juZjCTNxrMaZdGZC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 01, 2016 at 08:10:31PM +1100, Alexey Kardashevskiy wrote: > LoPAPR dictates that during system reset all DMA windows must be removed > and the default DMA32 window must be created so does the patch. >=20 > At the moment there is just one window supported so no change in > behaviour is expected. >=20 > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson > --- > hw/ppc/spapr_iommu.c | 2 +- > hw/ppc/spapr_pci.c | 29 +++++++++++++++++++++++------ > include/hw/ppc/spapr.h | 1 + > 3 files changed, 25 insertions(+), 7 deletions(-) >=20 > diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c > index ba9ddbb..8a88a74 100644 > --- a/hw/ppc/spapr_iommu.c > +++ b/hw/ppc/spapr_iommu.c > @@ -279,7 +279,7 @@ void spapr_tce_table_enable(sPAPRTCETable *tcet, > spapr_tce_table_do_enable(tcet); > } > =20 > -static void spapr_tce_table_disable(sPAPRTCETable *tcet) > +void spapr_tce_table_disable(sPAPRTCETable *tcet) > { > if (!tcet->enabled) { > return; > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index 7b40687..ee0fecf 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -825,6 +825,19 @@ static int spapr_phb_dma_window_enable(sPAPRPHBState= *sphb, > return 0; > } > =20 > +static int spapr_phb_dma_window_disable(sPAPRPHBState *sphb, uint32_t li= obn) > +{ > + sPAPRTCETable *tcet =3D spapr_tce_find_by_liobn(liobn); > + > + if (!tcet) { > + return -1; > + } > + > + spapr_tce_table_disable(tcet); > + > + return 0; > +} > + > /* Macros to operate with address in OF binding to PCI */ > #define b_x(x, p, l) (((x) & ((1<<(l))-1)) << (p)) > #define b_n(x) b_x((x), 31, 1) /* 0 if relocatable */ > @@ -1412,12 +1425,6 @@ static void spapr_phb_realize(DeviceState *dev, Er= ror **errp) > memory_region_add_subregion(&sphb->iommu_root, 0, > spapr_tce_get_iommu(tcet)); > =20 > - /* Register default 32bit DMA window */ > - spapr_phb_dma_window_enable(sphb, sphb->dma_liobn, > - SPAPR_TCE_PAGE_SHIFT, > - sphb->dma_win_addr, > - sphb->dma_win_size); > - > sphb->msi =3D g_hash_table_new_full(g_int_hash, g_int_equal, g_free,= g_free); > } > =20 > @@ -1434,6 +1441,16 @@ static int spapr_phb_children_reset(Object *child,= void *opaque) > =20 > static void spapr_phb_reset(DeviceState *qdev) > { > + sPAPRPHBState *sphb =3D SPAPR_PCI_HOST_BRIDGE(qdev); > + > + spapr_phb_dma_window_disable(sphb, sphb->dma_liobn); > + > + /* Register default 32bit DMA window */ > + spapr_phb_dma_window_enable(sphb, sphb->dma_liobn, > + SPAPR_TCE_PAGE_SHIFT, > + sphb->dma_win_addr, > + sphb->dma_win_size); > + > /* Reset the IOMMU state */ > object_child_foreach(OBJECT(qdev), spapr_phb_children_reset, NULL); > =20 > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index bdf27ec..8aa0c45 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -571,6 +571,7 @@ sPAPRTCETable *spapr_tce_new_table(DeviceState *owner= , uint32_t liobn); > void spapr_tce_table_enable(sPAPRTCETable *tcet, > uint32_t page_shift, uint64_t bus_offset, > uint32_t nb_table, bool vfio_accel); > +void spapr_tce_table_disable(sPAPRTCETable *tcet); > void spapr_tce_set_need_vfio(sPAPRTCETable *tcet, bool need_vfio); > =20 > MemoryRegion *spapr_tce_get_iommu(sPAPRTCETable *tcet); --=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 --juZjCTNxrMaZdGZC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJW16lDAAoJEGw4ysog2bOSIE0P/2wJV/AFwG4XEZD4QB+zs6de ZI2aKL12jVPNFxurSP+xqSdruYspWda/NuapL4i6p6OPvSDSu/Xary8aInMJEK7f xpe2W0wyfWHhbAgl5EMhk26ESAuy5ZLscRLRaKU8oZdhd9OXWJl6k8bT1TMdXydw j8G5jHQCqMH3ido2EyYxObFs8zg5Aa5vmNnJ7N/oGOXWj1Vy5Rt49Xe9OYe6hgCR 9qW2xM+YX9W6+wQgpntpRyvMcm521D4dPF5Y2jBlK5wL4wBPHDTRnRXpLE4NVyM+ avaxhs2pcba6aiVDYvYbs5fFzFICEMd8zd+2bPPTe9EryWViXz6/PalD6DvwBFBV tAP2wwSJyQvdTZOxY9HlLx5G0I3f5Y1bGwiQJms0yuuCNkvu8yy5jyl5I3/EEUmB 7dnPVAsIET+suG2Tb8yK7SxyalQnMnbVnoPKFfUh9KI68AwMjJb6tUs6OUz0kVda YEhLV/39mMPYqHpWlVGz7X7qZcE4csZAZvg7tYswc8f6qpeVoIQjokydLWrtVEvZ 0Tl8BbvBcL9pKnAmBx3pXRjKXH/YR3STmmfaIb5C4k7UtryK7pcmnZBhp+6OsGDX wkb3z0z4cpbuN5lY0whO/b4yxhT5qXI1SZcclq1+o5XYLpgH8ZcMyUiZN6Ss6M/f 1g3kSl3Hgx6Fhs9vea0T =HZ4G -----END PGP SIGNATURE----- --juZjCTNxrMaZdGZC--