From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdFuB-0006e4-8T for qemu-devel@nongnu.org; Wed, 01 Apr 2015 06:29:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdFuA-0000mS-38 for qemu-devel@nongnu.org; Wed, 01 Apr 2015 06:29:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdFu9-0000m4-VA for qemu-devel@nongnu.org; Wed, 01 Apr 2015 06:29:50 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 9F6AD91769 for ; Wed, 1 Apr 2015 10:29:49 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-45.ams2.redhat.com [10.36.112.45]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t31ATbYT032332 for ; Wed, 1 Apr 2015 06:29:48 -0400 From: Paolo Bonzini Date: Wed, 1 Apr 2015 12:29:37 +0200 Message-Id: <1427884177-4928-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1427884177-4928-1-git-send-email-pbonzini@redhat.com> References: <1427884177-4928-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 5/5] Revert "exec: Respect as_tranlsate_internal length clamp" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This reverts commit c3c1bb99d1c11978d9ce94d1bdcf0705378c1459. It causes problems with boards that declare memory regions shorter than the registers they contain. Reported-by: Zoltan Balaton Signed-off-by: Paolo Bonzini --- exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 6d1e1e4..874ecfc 100644 --- a/exec.c +++ b/exec.c @@ -380,6 +380,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, IOMMUTLBEntry iotlb; MemoryRegionSection *section; MemoryRegion *mr; + hwaddr len = *plen; rcu_read_lock(); for (;;) { @@ -394,7 +395,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, iotlb = mr->iommu_ops->translate(mr, addr, is_write); addr = ((iotlb.translated_addr & ~iotlb.addr_mask) | (addr & iotlb.addr_mask)); - *plen = MIN(*plen, (addr | iotlb.addr_mask) - addr + 1); + len = MIN(len, (addr | iotlb.addr_mask) - addr + 1); if (!(iotlb.perm & (1 << is_write))) { mr = &io_mem_unassigned; break; @@ -405,9 +406,10 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, if (xen_enabled() && memory_access_is_direct(mr, is_write)) { hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr; - *plen = MIN(page, *plen); + len = MIN(page, len); } + *plen = len; *xlat = addr; rcu_read_unlock(); return mr; -- 2.3.4