From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UflG1-0008CN-F2 for qemu-devel@nongnu.org; Fri, 24 May 2013 02:13:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UflFz-0001k9-9Z for qemu-devel@nongnu.org; Fri, 24 May 2013 02:13:41 -0400 Received: from mout.web.de ([212.227.17.12]:54471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UflFz-0001jh-1G for qemu-devel@nongnu.org; Fri, 24 May 2013 02:13:39 -0400 Message-ID: <519F050C.7020903@web.de> Date: Fri, 24 May 2013 08:13:32 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> <1369133851-1894-16-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2WGMDJMIIODCMNGCJLPRS" Subject: Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , qemu-devel@nongnu.org, David Gibson This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2WGMDJMIIODCMNGCJLPRS Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-05-23 20:04, Peter Maydell wrote: > On 21 May 2013 11:57, Paolo Bonzini wrote: >> +bool address_space_valid(AddressSpace *as, hwaddr addr, int len, bool= is_write) >> +{ >> + AddressSpaceDispatch *d =3D as->dispatch; >> + MemoryRegionSection *section; >> + int l; >> + hwaddr page; >> + >> + while (len > 0) { >> + page =3D addr & TARGET_PAGE_MASK; >> + l =3D (page + TARGET_PAGE_SIZE) - addr; >> + if (l > len) { >> + l =3D len; >> + } >> + section =3D phys_page_find(d, addr >> TARGET_PAGE_BITS); >> + if (section->mr =3D=3D &io_mem_unassigned || >> + (is_write && section->mr->readonly)) { >=20 > It's kind of bogus that io_mem_unassigned is the only MemoryRegion > that can be unreadable. Why is 'readonly' a MemoryRegion attribute > and 'writeonly' not? Shouldn't we be calling the MemoryRegionOps > accepts() callback here? What about access alignment constraints > and access size restrictions? What if the validity of the range > changes between the time you asked and when you actually do the > access? >=20 > The whole API is kind of unconvincing really, especially since > the only thing we seem to use it for is some parameter checking > in spapr_llan.c (via a huge pile of intermediate wrappers). I'll also have a use for it: replace isa_is_ioport_assigned. Jan ------enig2WGMDJMIIODCMNGCJLPRS 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/ iEYEARECAAYFAlGfBQ0ACgkQitSsb3rl5xRSegCffs8uItnicVQ5DO8BQ3Pz6ijV UaQAoMaj//r6Tx2CPpotr4DcQ+PLTUWz =23JL -----END PGP SIGNATURE----- ------enig2WGMDJMIIODCMNGCJLPRS--