From 58eaa2174e99d9a05172d03fd2799ab8fd9e6f60 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Mon, 22 Feb 2016 16:34:55 +0800 Subject: exec: store RAMBlock pointer into memory region Each RAM memory region has a unique corresponding RAMBlock. In the current realization, the memory region only stored the ram_addr which means the offset of RAM address space, We need to qurey the global ram.list to find the ram block by ram_addr if we want to get the ram block, which is very expensive. Now, we store the RAMBlock pointer into memory region structure. So, if we know the mr, we can easily get the RAMBlock. Signed-off-by: Gonglei Message-Id: <1456130097-4208-2-git-send-email-arei.gonglei@huawei.com> Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/exec/memory.h') diff --git a/include/exec/memory.h b/include/exec/memory.h index c92734ae2b..683be46cd0 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -34,6 +34,7 @@ #include "qapi/error.h" #include "qom/object.h" #include "qemu/rcu.h" +#include "qemu/typedefs.h" #define MAX_PHYS_ADDR_SPACE_BITS 62 #define MAX_PHYS_ADDR (((hwaddr)1 << MAX_PHYS_ADDR_SPACE_BITS) - 1) @@ -172,6 +173,7 @@ struct MemoryRegion { bool global_locking; uint8_t dirty_log_mask; ram_addr_t ram_addr; + RAMBlock *ram_block; Object *owner; const MemoryRegionIOMMUOps *iommu_ops; -- cgit v1.2.3