From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [QEMU][RFC PATCH 3/6] memory: Add xen memory hook Date: Thu, 22 Mar 2012 18:44:40 +0100 Message-ID: <4F6B6508.7080205@web.de> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD65C01A4DDE38813F8A77079" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Julien Grall Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Stefano Stabellini , julian.pidancet@citrix.com List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD65C01A4DDE38813F8A77079 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2012-03-22 17:01, Julien Grall wrote: > QEMU will now register all memory range (PIO and MMIO) in Xen. > We distinct two phases in memory registered : > - initialization > - running >=20 > For all range registered during the initialization, QEMU will > check with XenStore if it is authorized to use them. > After the initialization, QEMU can register all range. Indeed, > the new ranges will be for PCI Bar. >=20 > Signed-off-by: Julien Grall > --- > exec.c | 9 ++++++ > ioport.c | 17 ++++++++++++ > xen-all.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 3 files changed, 109 insertions(+), 0 deletions(-) >=20 > diff --git a/exec.c b/exec.c > index 780f63f..42d8c56 100644 > --- a/exec.c > +++ b/exec.c > @@ -3557,12 +3557,21 @@ static void core_commit(MemoryListener *listene= r) > static void core_region_add(MemoryListener *listener, > MemoryRegionSection *section) > { > + if (xen_enabled()) { > + xen_map_iorange(section->offset_within_address_space, > + section->size, 1); > + } > + > cpu_register_physical_memory_log(section, section->readonly); > } > =20 > static void core_region_del(MemoryListener *listener, > MemoryRegionSection *section) > { > + if (xen_enabled()) { > + xen_unmap_iorange(section->offset_within_address_space, > + section->size, 1); > + } > } memory_listener_register(xen_io_hooks, system_memory)? > =20 > static void core_region_nop(MemoryListener *listener, > diff --git a/ioport.c b/ioport.c > index 78a3b89..073ed75 100644 > --- a/ioport.c > +++ b/ioport.c > @@ -28,6 +28,7 @@ > #include "ioport.h" > #include "trace.h" > #include "memory.h" > +#include "hw/xen.h" > =20 > /***********************************************************/ > /* IO Port */ > @@ -155,6 +156,11 @@ int register_ioport_read(pio_addr_t start, int len= gth, int size, > i); > ioport_opaque[i] =3D opaque; > } > + > + if (xen_enabled()) { > + xen_map_iorange(start, length, 0); > + } > + > return 0; > } > =20 > @@ -175,7 +181,13 @@ int register_ioport_write(pio_addr_t start, int le= ngth, int size, > i); > ioport_opaque[i] =3D opaque; > } > + > + if (xen_enabled()) { > + xen_map_iorange(start, length, 0); > + } > + > return 0; > + > } > =20 > static uint32_t ioport_readb_thunk(void *opaque, uint32_t addr) > @@ -260,6 +272,11 @@ void isa_unassign_ioport(pio_addr_t start, int len= gth) > ioport_destructor_table[start](ioport_opaque[start]); > ioport_destructor_table[start] =3D NULL; > } > + > + if (xen_enabled()) { > + xen_unmap_iorange(start, length, 0); > + } > + > for(i =3D start; i < start + length; i++) { > ioport_read_table[0][i] =3D NULL; > ioport_read_table[1][i] =3D NULL; memory_listener_register(xen_hooks, system_io)? Even if that is not yet powerful enough, tuning the hooks is usually better than open-coding. Jan --------------enigD65C01A4DDE38813F8A77079 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 Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9rZQgACgkQitSsb3rl5xRMzgCgiX7N1m3/BeMewJ5h1hIGwYZm DzEAoNF8KrS+8rfxGdJFCb+4T5jCCex6 =obCA -----END PGP SIGNATURE----- --------------enigD65C01A4DDE38813F8A77079--