From 5ead62185d23caad41ef2afc80773fb384e40229 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Tue, 2 Nov 2021 17:43:16 +0100 Subject: memory: Make memory_region_is_mapped() succeed when mapped via an alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit memory_region_is_mapped() currently does not return "true" when a memory region is mapped via an alias. Assuming we have: alias (A0) -> alias (A1) -> region (R0) Mapping A0 would currently only make memory_region_is_mapped() succeed on A0, but not on A1 and R0. Let's fix that by adding a "mapped_via_alias" counter to memory regions and updating it accordingly when an alias gets (un)mapped. I am not aware of actual issues, this is rather a cleanup to make it consistent. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Signed-off-by: David Hildenbrand Message-Id: <20211102164317.45658-3-david@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- include/exec/memory.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/exec') diff --git a/include/exec/memory.h b/include/exec/memory.h index 20f1b27377..fea1a493b9 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -738,6 +738,7 @@ struct MemoryRegion { const MemoryRegionOps *ops; void *opaque; MemoryRegion *container; + int mapped_via_alias; /* Mapped via an alias, container might be NULL */ Int128 size; hwaddr addr; void (*destructor)(MemoryRegion *mr); -- cgit v1.2.3