From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFeiU-0006xS-FQ for qemu-devel@nongnu.org; Wed, 22 Jun 2016 05:45:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFeiQ-0005KM-8D for qemu-devel@nongnu.org; Wed, 22 Jun 2016 05:45:01 -0400 References: <1466471645-5396-1-git-send-email-aik@ozlabs.ru> <1466471645-5396-6-git-send-email-aik@ozlabs.ru> <20160622023523.GJ17957@voom.fritz.box> From: Thomas Huth Message-ID: <576A5E0F.2060801@redhat.com> Date: Wed, 22 Jun 2016 11:44:47 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LMg0PvfE8HuroAvRsOU4COpGdJJOVVrkw" Subject: Re: [Qemu-devel] [PATCH qemu v18 5/5] spapr_pci/spapr_pci_vfio: Support Dynamic DMA Windows (DDW) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , David Gibson Cc: Alex Williamson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LMg0PvfE8HuroAvRsOU4COpGdJJOVVrkw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 22.06.2016 05:23, Alexey Kardashevskiy wrote: > On 22/06/16 12:35, David Gibson wrote: >> On Tue, Jun 21, 2016 at 11:14:05AM +1000, Alexey Kardashevskiy wrote: >>> This adds support for Dynamic DMA Windows (DDW) option defined by >>> the SPAPR specification which allows to have additional DMA window(s)= >>> >>> The "ddw" property is enabled by default on a PHB but for compatibili= ty >>> the pseries-2.6 machine and older disable it. >>> This also creates a single DMA window for the older machines to >>> maintain backward migration. >>> >>> This implements DDW for PHB with emulated and VFIO devices. The host >>> kernel support is required. The advertised IOMMU page sizes are 4K an= d >>> 64K; 16M pages are supported but not advertised by default, in order = to >>> enable them, the user has to specify "pgsz" property for PHB and >>> enable huge pages for RAM. >>> >>> The existing linux guests try creating one additional huge DMA window= >>> with 64K or 16MB pages and map the entire guest RAM to. If succeeded,= >>> the guest switches to dma_direct_ops and never calls TCE hypercalls >>> (H_PUT_TCE,...) again. This enables VFIO devices to use the entire RA= M >>> and not waste time on map/unmap later. This adds a "dma64_win_addr" >>> property which is a bus address for the 64bit window and by default >>> set to 0x800.0000.0000.0000 as this is what the modern POWER8 hardwar= e >>> uses and this allows having emulated and VFIO devices on the same bus= =2E >>> >>> This adds 4 RTAS handlers: >>> * ibm,query-pe-dma-window >>> * ibm,create-pe-dma-window >>> * ibm,remove-pe-dma-window >>> * ibm,reset-pe-dma-window >>> These are registered from type_init() callback. >>> >>> These RTAS handlers are implemented in a separate file to avoid pollu= ting >>> spapr_iommu.c with PCI. >>> >>> This changes sPAPRPHBState::dma_liobn to an array to allow 2 LIOBNs. >>> >>> Signed-off-by: Alexey Kardashevskiy [...] >>> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c >>> index 9f28fb3..0cb51dd 100644 >>> --- a/hw/ppc/spapr_pci.c >>> +++ b/hw/ppc/spapr_pci.c [...] >>> @@ -1515,7 +1531,8 @@ static void spapr_phb_reset(DeviceState *qdev) >>> static Property spapr_phb_properties[] =3D { >>> DEFINE_PROP_UINT32("index", sPAPRPHBState, index, -1), >>> DEFINE_PROP_UINT64("buid", sPAPRPHBState, buid, -1), >>> - DEFINE_PROP_UINT32("liobn", sPAPRPHBState, dma_liobn, -1), >>> + DEFINE_PROP_UINT32("liobn", sPAPRPHBState, dma_liobn[0], -1), >>> + DEFINE_PROP_UINT32("liobn64", sPAPRPHBState, dma_liobn[1], -1), >>> DEFINE_PROP_UINT64("mem_win_addr", sPAPRPHBState, mem_win_addr, = -1), >>> DEFINE_PROP_UINT64("mem_win_size", sPAPRPHBState, mem_win_size, >>> SPAPR_PCI_MMIO_WIN_SIZE), >>> @@ -1527,6 +1544,11 @@ static Property spapr_phb_properties[] =3D { >>> /* 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, = 0x40000000), >>> + DEFINE_PROP_UINT64("dma64_win_addr", sPAPRPHBState, dma64_win_ad= dr, >>> + 0x800000000000000ULL), >>> + DEFINE_PROP_BOOL("ddw", sPAPRPHBState, ddw_enabled, true), >>> + DEFINE_PROP_UINT64("pgsz", sPAPRPHBState, page_size_mask, >>> + (1ULL << 12) | (1ULL << 16)), >>> DEFINE_PROP_END_OF_LIST(), >>> }; >>> =20 >>> @@ -1603,7 +1625,7 @@ static const VMStateDescription vmstate_spapr_p= ci =3D { >>> .post_load =3D spapr_pci_post_load, >>> .fields =3D (VMStateField[]) { >>> VMSTATE_UINT64_EQUAL(buid, sPAPRPHBState), >>> - VMSTATE_UINT32_EQUAL(dma_liobn, sPAPRPHBState), >>> + VMSTATE_UNUSED(4), /* dma_liobn */ >> >> It's not obvious to me why this change is necessary. >=20 > It is not. But I was touching liobn and this is a proper cleanup which > needs to be done anyway as _EQUAL() macros are sort of deprecated and > rather pointless. Not sure, but if you mark this field as unused now, is migration backwards to an older version of QEMU still working? If not, you might need to bump the version number, too? Thomas --LMg0PvfE8HuroAvRsOU4COpGdJJOVVrkw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXal4TAAoJEC7Z13T+cC21YFwP/0n0DpLGyJijL5gpV3CzLyqS 6MdbmSPy9aRxMWHz6vmY++dla604jfTafcLR4OYuaQ96rLEOevUbuWOQeHjuQIax 7C0s2t4Ge8xvLhSMWMBrdEbEG9G62pLCV9KDDaZ0QypikGvx9ciOrvgB3FiM17HZ 0poGck+1SpXmqbvAaaHYMTio+waVCFJM2ZpqzasLr4xkwPEjO3zj96T7g1vB+33c WHSIJJmdlXRV/++lwrCMHCPmd11KUnQPyX7sVenVwyiqkf3gbhqSqbZBSSGgLdeS OuWg6HpL7o0s9xbnC5eckqzDv59FaK1RUSoHxGMCjkNj01OWzceH5fHedMrtYsah FRFDFEjeCeYaNJi4MOdHmIE+1mryI2tXTPRnY5mPYFWPPR6rCHHR2ehH0YV0D7kQ dZcKP6SMTJ4uQJRqbrftLoWopLdpY5U+5wljpnXjJGrGJcMLy6YE6aHfNvCFtxAB Jb2Hh0AO2VW6ReKxjHl++gQwCOqBIrXOYS7w+bysjQVbMmSjSJVzpLIVDl7eonSO StfZIGHXLqcGGRv/4SUsQlFVJ2o1D9Fdl95R61RHJsQm3Xy18SouBquBx61hHx89 vX9ZWQlYDDzchcti0bf8B2S68r1HQgpgA7BT4Ld/DNq4hiSGDGxFrasaZMLa9AiC WHKT741W/z72yC3Cexen =VTGt -----END PGP SIGNATURE----- --LMg0PvfE8HuroAvRsOU4COpGdJJOVVrkw--