memory-device: Track required and actually used memslots in DeviceMemoryState
authorDavid Hildenbrand <david@redhat.com>
Tue, 26 Sep 2023 18:57:28 +0000 (20:57 +0200)
committerDavid Hildenbrand <david@redhat.com>
Thu, 12 Oct 2023 12:15:22 +0000 (14:15 +0200)
commitf9716f4b0d6eaee5d0b1ccf428a102e0c148fa30
tree54c3248b993bfd07c6a580351aa242a84a110ec2
parent759bac673a8de9d6db50b0f96caa7b70cf0d1694
memory-device: Track required and actually used memslots in DeviceMemoryState

Let's track how many memslots are required by plugged memory devices and
how many are currently actually getting used by plugged memory
devices.

"required - used" is the number of reserved memslots. For now, the number
of used and required memslots is always equal, and there are no
reservations. This is a preparation for memory devices that want to
dynamically consume memslots after initially specifying how many they
require -- where we'll end up with reserved memslots.

To track the number of used memslots, create a new address space for
our device memory and register a memory listener (add/remove) for that
address space.

Message-ID: <20230926185738.277351-9-david@redhat.com>
Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
hw/mem/memory-device.c
include/hw/boards.h