diff mbox series

[PULL,099/136] memory: Correctly return alias region type

Message ID 1582631466-13880-99-git-send-email-pbonzini@redhat.com
State New
Headers show
Series None | expand

Commit Message

Paolo Bonzini Feb. 25, 2020, 11:50 a.m. UTC
From: Philippe Mathieu-Daudé <philmd@redhat.com>

Since memory region aliases are neither rom nor ram, they are
described as i/o, which is often incorrect. Return instead the
type of the original region we are aliasing.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200224205533.23798-2-philmd@redhat.com>
Supersedes: <20200221173049.18134-1-philmd@redhat.com>
---
 memory.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/memory.c b/memory.c
index aeaa8dc..ce11798 100644
--- a/memory.c
+++ b/memory.c
@@ -2818,6 +2818,9 @@  void address_space_destroy(AddressSpace *as)
 
 static const char *memory_region_type(MemoryRegion *mr)
 {
+    if (mr->alias) {
+        return memory_region_type(mr->alias);
+    }
     if (memory_region_is_ram_device(mr)) {
         return "ramd";
     } else if (memory_region_is_romd(mr)) {