memory-device: Track used region size in DeviceMemoryState

Let's avoid iterating over all devices and simply track it in the
DeviceMemoryState.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20230623124553.400585-11-david@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
This commit is contained in:
David Hildenbrand 2023-06-23 14:45:53 +02:00
parent d7f4891c85
commit ac23dd2f29
2 changed files with 5 additions and 19 deletions

View file

@ -298,11 +298,13 @@ struct MachineClass {
* address space for memory devices starts
* @mr: address space container for memory devices
* @dimm_size: the sum of plugged DIMMs' sizes
* @used_region_size: the part of @mr already used by memory devices
*/
typedef struct DeviceMemoryState {
hwaddr base;
MemoryRegion mr;
uint64_t dimm_size;
uint64_t used_region_size;
} DeviceMemoryState;
/**