From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqzwA-0002VX-A0 for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:07:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uqzw9-00054K-3W for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:07:38 -0400 Received: from mout.web.de ([212.227.15.4]:60993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uqzw8-000548-Qo for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:07:37 -0400 Message-ID: <51C7E21A.9090005@web.de> Date: Mon, 24 Jun 2013 08:07:22 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <51C75FA6.6080903@reactos.org> In-Reply-To: <51C75FA6.6080903@reactos.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2KOOSNXIWCWMMMQSLMAJO" Subject: Re: [Qemu-devel] [PATCH v3 11/14] ioport: Switch dispatching to memory core layer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Herv=E9_Poussineau?= Cc: Paolo Bonzini , Liu Ping Fan , qemu-devel , =?ISO-8859-1?Q?Andreas_F=E4rber?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2KOOSNXIWCWMMMQSLMAJO Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-06-23 22:50, Herv=E9 Poussineau wrote: > Jan Kiszka a =E9crit : >> From: Jan Kiszka >> >> The current ioport dispatcher is a complex beast, mostly due to the >> need to deal with old portio interface users. But we can overcome it >> without converting all portio users by embedding the required base >> address of a MemoryRegionPortio access into that data structure. That >> removes the need to have the additional MemoryRegionIORange structure >> in the loop on every access. >> >> To handle old portio memory ops, we simply install dispatching handler= s >> for portio memory regions when registering them with the memory core. >> This removes the need for the old_portio field. >> >> We can drop the additional aliasing of ioport regions and also the >> special address space listener. cpu_in and cpu_out now simply call >> address_space_read/write. And we can concentrate portio handling in a >> single source file. >> >> Signed-off-by: Jan Kiszka >> --- >=20 > ... >=20 >> + >> +static void portio_write(void *opaque, hwaddr addr, uint64_t data, >> + unsigned size) >> +{ >> + MemoryRegionPortioList *mrpio =3D opaque; >> + const MemoryRegionPortio *mrp =3D find_portio(mrpio, addr, size, >> true); >> + >> + if (mrp) { >> + mrp->write(mrpio->portio_opaque, mrp->base + addr, data); >> + } else if (size =3D=3D 2) { >> + mrp =3D find_portio(mrpio, addr, 1, true); >> + assert(mrp); >> + mrp->write(mrpio->portio_opaque, mrp->base + addr, data & 0xf= f); >> + mrp->write(mrpio->portio_opaque, mrp->base + addr + 1, data >> >> 8); >> + } >> +} >> + >> +static const MemoryRegionOps portio_ops =3D { >> + .read =3D portio_read, >> + .write =3D portio_write, >> + .valid.unaligned =3D true, >> + .impl.unaligned =3D true, >> +}; >> + >=20 > You need to mark these operations as DEVICE_LITTLE_ENDIAN. > In portio_write above, you clearly assume that data is in LE format. Anything behind PIO is little endian, of course. Will add this. >=20 > This fixes PPC PReP emulation, which would otherwise be broken with thi= s > patchset. Thanks, Jan ------enig2KOOSNXIWCWMMMQSLMAJO 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.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlHH4h0ACgkQitSsb3rl5xSpKwCglfxQqDFlTqP9f8gUc0D+LFCn 5CEAn0cB/6P2/n7J/L1+FyoX6uNor8a1 =gZdr -----END PGP SIGNATURE----- ------enig2KOOSNXIWCWMMMQSLMAJO--