From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAka3-0001Jw-Gx for qemu-devel@nongnu.org; Tue, 04 Feb 2014 13:18:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAkZx-0001Qs-H0 for qemu-devel@nongnu.org; Tue, 04 Feb 2014 13:18:43 -0500 Date: Tue, 4 Feb 2014 18:18:23 +0000 From: Anthony PERARD Message-ID: <20140204181822.GH1775@perard.uk.xensource.com> References: <246b6975027245a0bc428eb33808390d@CO1PR05MB490.namprd05.prod.outlook.com> <52EFFFC1.7040303@ilande.co.uk> <94B55321-62FD-4F57-8A91-4B77E1B74E19@suse.de> <7FC332AA-AB7D-47F2-84D2-CD66DCAE3277@suse.de> <52F0E883.1020704@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <52F0E883.1020704@redhat.com> Subject: Re: [Qemu-devel] [Qemu-ppc] standard test image not booting with qemu-system-ppc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , Nitin Srivastava , Mark Cave-Ayland , Stefano Stabellini , Michael Tokarev , Alexander Graf , qemu-devel , "qemu-ppc@nongnu.org" On Tue, Feb 04, 2014 at 02:17:55PM +0100, Paolo Bonzini wrote: > Il 04/02/2014 08:55, Alexander Graf ha scritto: > >> With this change, the > >> memory system is now refusing to allow an access of size > >> 2 through, because it's greater than the region length. So > > > > Ouch. Yes, for ioport reads/writes we definitely have to only cap the port range, not the length. > > We can do it in general for MMIO. Something like this? > > diff --git a/exec.c b/exec.c > index 9ad0a4b..9a1eef3 100644 > --- a/exec.c > +++ b/exec.c > @@ -325,7 +325,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x > hwaddr *plen, bool resolve_subpage) > { > MemoryRegionSection *section; > - Int128 diff, diff_page; > + Int128 diff; > > section = address_space_lookup_region(d, addr, resolve_subpage); > /* Compute offset within MemoryRegionSection */ > @@ -334,9 +334,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x > /* Compute offset within MemoryRegion */ > *xlat = addr + section->offset_within_region; > > - diff_page = int128_make64(((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr); > diff = int128_sub(section->mr->size, int128_make64(addr)); > - diff = int128_min(diff, diff_page); > *plen = int128_get64(int128_min(diff, int128_make64(*plen))); > return section; > } > @@ -370,6 +368,11 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, > as = iotlb.target_as; > } > > + if (memory_access_is_direct(mr, is_write)) { > + hwaddr page = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE - addr; > + len = MIN(page, len); > + } > + > *plen = len; > *xlat = addr; > return mr; > > > Stefano, Anthony, can you test it on Xen? This patches works fine (after adding a prototype for memory_access_is_direct before the function). -- Anthony PERARD