From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqrFR-0002IW-Rk for qemu-devel@nongnu.org; Sun, 23 Jun 2013 16:50:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UqrFQ-00071Q-UA for qemu-devel@nongnu.org; Sun, 23 Jun 2013 16:50:57 -0400 Received: from smtp1-g21.free.fr ([2a01:e0c:1:1599::10]:53618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqrFP-00071G-TE for qemu-devel@nongnu.org; Sun, 23 Jun 2013 16:50:56 -0400 Message-ID: <51C75FA6.6080903@reactos.org> Date: Sun, 23 Jun 2013 22:50:46 +0200 From: =?ISO-8859-1?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable 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: Jan Kiszka Cc: Paolo Bonzini , Liu Ping Fan , Jan Kiszka , qemu-devel , =?ISO-8859-1?Q?Andreas_F=E4rber?= Jan Kiszka a =E9crit : > From: Jan Kiszka >=20 > 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. >=20 > To handle old portio memory ops, we simply install dispatching handlers > for portio memory regions when registering them with the memory core. > This removes the need for the old_portio field. >=20 > 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. >=20 > Signed-off-by: Jan Kiszka > --- ... > + > +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, t= rue); > + > + 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 & 0xff= ); > + 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, > +}; > + You need to mark these operations as DEVICE_LITTLE_ENDIAN. In portio_write above, you clearly assume that data is in LE format. This fixes PPC PReP emulation, which would otherwise be broken with this=20 patchset. Herv=E9