summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-07-22 10:14:18 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-07-22 10:14:18 -0500
commitc9fea5d701f8fd33f0843728ec264d95cee3ed37 (patch)
tree16d34b137699c16d62ff516d5b32d8c1ec73427b
parenta20bd9eec3cf3f9dd7e27d45a96d7b1b9ab09ebd (diff)
parente1622f4b15391bd44eb0f99a244fdf19a20fd981 (diff)
downloadfocaccia-qemu-c9fea5d701f8fd33f0843728ec264d95cee3ed37.tar.gz
focaccia-qemu-c9fea5d701f8fd33f0843728ec264d95cee3ed37.zip
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
# By Paolo Bonzini (2) and others
# Via Paolo Bonzini
* bonzini/iommu-for-anthony:
  exec: fix incorrect assumptions in memory_access_size
  memory: Return -1 again on reads from unsigned regions
  memory: actually set the owner
  exec.c: Pass correct pointer type to qemu_ram_ptr_length

Message-id: 1374264478-23913-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--exec.c11
-rw-r--r--memory.c3
2 files changed, 3 insertions, 11 deletions
diff --git a/exec.c b/exec.c
index c99a8839c5..c8658c6f9d 100644
--- a/exec.c
+++ b/exec.c
@@ -1379,7 +1379,7 @@ static void *qemu_safe_ram_ptr(ram_addr_t addr)
 
 /* Return a host pointer to guest's ram. Similar to qemu_get_ram_ptr
  * but takes a size argument */
-static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
+static void *qemu_ram_ptr_length(ram_addr_t addr, hwaddr *size)
 {
     if (*size == 0) {
         return NULL;
@@ -1898,14 +1898,10 @@ static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
 
 static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
 {
-    unsigned access_size_min = mr->ops->impl.min_access_size;
-    unsigned access_size_max = mr->ops->impl.max_access_size;
+    unsigned access_size_max = mr->ops->valid.max_access_size;
 
     /* Regions are assumed to support 1-4 byte accesses unless
        otherwise specified.  */
-    if (access_size_min == 0) {
-        access_size_min = 1;
-    }
     if (access_size_max == 0) {
         access_size_max = 4;
     }
@@ -1922,9 +1918,6 @@ static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
     if (l > access_size_max) {
         l = access_size_max;
     }
-    /* ??? The users of this function are wrong, not supporting minimums larger
-       than the remaining length.  C.f. memory.c:access_with_adjusted_size.  */
-    assert(l >= access_size_min);
 
     return l;
 }
diff --git a/memory.c b/memory.c
index c8f9a2bfb3..34a088e90f 100644
--- a/memory.c
+++ b/memory.c
@@ -805,7 +805,6 @@ void memory_region_init(MemoryRegion *mr,
     mr->owner = owner;
     mr->iommu_ops = NULL;
     mr->parent = NULL;
-    mr->owner = NULL;
     mr->size = int128_make64(size);
     if (size == UINT64_MAX) {
         mr->size = int128_2_64();
@@ -841,7 +840,7 @@ static uint64_t unassigned_mem_read(void *opaque, hwaddr addr,
     if (current_cpu != NULL) {
         cpu_unassigned_access(current_cpu, addr, false, false, 0, size);
     }
-    return 0;
+    return -1ULL;
 }
 
 static void unassigned_mem_write(void *opaque, hwaddr addr,