From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAgWG-0007Zy-Lb for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:58:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAgWA-0007Ru-IT for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:58:32 -0500 Message-ID: <52F0E883.1020704@redhat.com> Date: Tue, 04 Feb 2014 14:17:55 +0100 From: Paolo Bonzini MIME-Version: 1.0 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Alexander Graf , Peter Maydell Cc: Nitin Srivastava , Mark Cave-Ayland , Stefano Stabellini , Michael Tokarev , qemu-devel , "qemu-ppc@nongnu.org" , Anthony PERARD 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? I wouldn't mind sticking a "xen_enabled()" in there, and/or a comment to document why we do it. Paolo