From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXPA4-0004es-0I for qemu-devel@nongnu.org; Fri, 26 Sep 2014 02:37:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXPA1-00060Q-UN for qemu-devel@nongnu.org; Fri, 26 Sep 2014 02:37:47 -0400 Date: Fri, 26 Sep 2014 15:39:23 +1000 From: David Gibson Message-ID: <20140926053923.GD20209@voom.redhat.com> References: <1409307142-2600-1-git-send-email-aik@ozlabs.ru> <1409307142-2600-14-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tEFtbjk+mNEviIIX" Content-Disposition: inline In-Reply-To: <1409307142-2600-14-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [RFC PATCH v3 13/18] spapr_pci: Enable DDW 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, Alexander Graf --tEFtbjk+mNEviIIX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 29, 2014 at 08:12:17PM +1000, Alexey Kardashevskiy wrote: > This implements DDW for emulated PHB. >=20 > This advertises the query/create/remove RTAS tokens in device tree. > This does not advertise the reset RTAS token though, will be added later. >=20 > The "ddw" property is enabled by default on a PHB but for compatibility > pseries-2.1 machine disables it. >=20 > Since QEMU does not implement any 64bit DMA capable device, this hack > has been used to enable 64bit DMA on E1000: >=20 > diff --git a/hw/net/e1000.c b/hw/net/e1000.c > index 0fc29a0..131f80a 100644 > --- a/hw/net/e1000.c > +++ b/hw/net/e1000.c > @@ -240,6 +240,7 @@ static const uint32_t mac_reg_init[] =3D { > [STATUS] =3D 0x80000000 | E1000_STATUS_GIO_MASTER_ENABLE | > E1000_STATUS_ASDV | E1000_STATUS_MTXCKOK | > E1000_STATUS_SPEED_1000 | E1000_STATUS_FD | > + E1000_STATUS_PCIX_MODE | > E1000_STATUS_LU, > [MANC] =3D E1000_MANC_EN_MNG2HOST | E1000_MANC_RCV_TCO_EN | > E1000_MANC_ARP_EN | E1000_MANC_0298_EN | >=20 > Signed-off-by: Alexey Kardashevskiy > --- > Changes: > v3: > * removed reset > * windows_num is now 1 or bigger rather than 0-based value and it is only > changed in PHB code, not in RTAS > * added page mask check in create() >=20 > v2: > * tested on hacked emulated E1000 > * implemented DDW reset on the PHB reset > * spapr_pci_ddw_remove/spapr_pci_ddw_reset are public for reuse by VFIO > --- > hw/ppc/spapr.c | 9 +++++ > hw/ppc/spapr_pci.c | 94 +++++++++++++++++++++++++++++++++++++++= ++++++ > include/hw/pci-host/spapr.h | 7 ++++ > 3 files changed, 110 insertions(+) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index d2d3c27..663cb75 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1670,11 +1670,20 @@ static const TypeInfo spapr_machine_info =3D { > static void spapr_machine_2_1_class_init(ObjectClass *oc, void *data) > { > MachineClass *mc =3D MACHINE_CLASS(oc); > + static GlobalProperty compat_props[] =3D { > + { > + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, > + .property =3D "ddw", > + .value =3D stringify(off), > + }, > + { /* end of list */ } > + }; > =20 > mc->name =3D "pseries-2.1"; > mc->desc =3D "pSeries Logical Partition (PAPR compliant) v2.1"; > mc->alias =3D "pseries"; > mc->is_default =3D 1; > + mc->compat_props =3D compat_props; > } > =20 > static const TypeInfo spapr_machine_2_1_info =3D { > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index 2968b39..04ee1dc 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -470,6 +470,76 @@ static const MemoryRegionOps spapr_msi_ops =3D { > }; > =20 > /* > + * Dynamic DMA windows > + */ > +static int spapr_pci_ddw_query(sPAPRPHBState *sphb, > + uint32_t *windows_available, > + uint32_t *page_size_mask) > +{ > + *windows_available =3D 1; > + *page_size_mask =3D DDW_PGSIZE_64K | DDW_PGSIZE_16M; > + > + return 0; > +} > + > +static int spapr_pci_ddw_create(sPAPRPHBState *sphb, uint32_t page_shift, > + uint32_t window_shift, uint32_t liobn, > + sPAPRTCETable **ptcet) > +{ I think the callbacks should check the ddw_enabled parameter and fail if ddw is disabled, rather than just relying on the guest not calling them if they're not advertised. --=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 --tEFtbjk+mNEviIIX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUJPwKAAoJEGw4ysog2bOSOMkP/06Y5OICXnJLferX+tZK+IZX XVG8xe1ItZken2WniWcmlLhoyd6Yf8h0UveZwf72vFWw1lZsYfu0OK1ulW+ZiEL5 S7yf4t51/7Ev6OublSe1mj7HDNCWcoPK3898vWlxp2zfwPLsOIkDieWUXbUYadWK klyyWHoJapbw3ztYNJ63WFor115I0g/R5//aoeloeAAwR8s9uHOfbLSIH0njK5hK vJcD4U3qgSiv2x8IhxSWo4HmageDVHIoUlGgTN3E4KXQm6jviDczS8azC1eU8KAb x7rLql7ee1MwTgqy1/UonFZPlJf3wM4RcSgvwwtkaYE3EhWQiyCOxkvv45XLYUhJ sKfnfUNKFvbJbEYRmJB0waS8SmPl7etdwUewz9OMML5puyyvUko18z+S1sKZl6RT nF2dpwF8yrGYssuA3oXu8JKrCYFwBPzKHJjimLnkZy2+Drr0ay471zD4h2gvpz2t hRvYNSP4AB+kXskwTTKlV1BcPMDHvu8ghOz3/xtwrS7IM7gxXe9tCxKdx54Z6h4L /LmItWPW7qGXDZBdtqnpo6MV9dpHb47b53oQpyU42kGMDdjtROaklxJEWHubRa8g x+wXWuvoABcQGESey5WuPtWN+drtzhtp7to1YaJUmY7M+CyXQYoIaIfpKbrVLx70 z3qbXW5oUsLb/kbEzmh2 =meTO -----END PGP SIGNATURE----- --tEFtbjk+mNEviIIX--