All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 5/5] Revert "exec: Respect as_tranlsate_internal length clamp"
Date: Wed,  1 Apr 2015 12:29:37 +0200	[thread overview]
Message-ID: <1427884177-4928-6-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1427884177-4928-1-git-send-email-pbonzini@redhat.com>

This reverts commit c3c1bb99d1c11978d9ce94d1bdcf0705378c1459.
It causes problems with boards that declare memory regions shorter
than the registers they contain.

Reported-by: Zoltan Balaton <balaton@eik.bme.hu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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

  parent reply	other threads:[~2015-04-01 10:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 10:29 [Qemu-devel] [PULL 0/5] Bugfixes for 2.3.0-rc2 Paolo Bonzini
2015-04-01 10:29 ` [Qemu-devel] [PULL 1/5] qom: Add can_be_deleted callback to UserCreatableClass Paolo Bonzini
2015-04-01 10:29 ` [Qemu-devel] [PULL 2/5] hostmem: Prevent removing an in-use memory backend Paolo Bonzini
2015-04-01 10:29 ` [Qemu-devel] [PULL 3/5] pc: acpi: fix pvpanic regression Paolo Bonzini
2015-04-01 10:29 ` [Qemu-devel] [PULL 4/5] rcu: do not create thread in pthread_atfork callback Paolo Bonzini
2015-04-01 10:29 ` Paolo Bonzini [this message]
2015-04-01 12:27   ` [Qemu-devel] [PULL 5/5] Revert "exec: Respect as_tranlsate_internal length clamp" Eric Blake
2015-04-01 12:31     ` Peter Maydell
2015-04-01 13:18       ` Paolo Bonzini
2015-04-01 12:21 ` [Qemu-devel] [PULL 0/5] Bugfixes for 2.3.0-rc2 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427884177-4928-6-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.