mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
memory-device,vhost: Support memory devices that dynamically consume memslots
We want to support memory devices that have a dynamically managed memory region container as device memory region. This device memory region maps multiple RAM memory subregions (e.g., aliases to the same RAM memory region), whereby these subregions can be (un)mapped on demand. Each RAM subregion will consume a memslot in KVM and vhost, resulting in such a new device consuming memslots dynamically, and initially usually 0. We already track the number of used vs. required memslots for all memslots. From that, we can derive the number of reserved memslots that must not be used otherwise. The target use case is virtio-mem and the hyper-v balloon, which will dynamically map aliases to RAM memory region into their device memory region container. Properly document what's supported and what's not and extend the vhost memslot check accordingly. Message-ID: <20230926185738.277351-10-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>
This commit is contained in:
parent
f9716f4b0d
commit
766aa0a654
4 changed files with 53 additions and 6 deletions
|
@ -46,6 +46,12 @@ typedef struct MemoryDeviceState MemoryDeviceState;
|
|||
* single RAM memory region or a memory region container with subregions
|
||||
* that are RAM memory regions or aliases to RAM memory regions. Other
|
||||
* memory regions or subregions are not supported.
|
||||
*
|
||||
* If the device memory region returned via @get_memory_region is a
|
||||
* memory region container, it's supported to dynamically (un)map subregions
|
||||
* as long as the number of memslots returned by @get_memslots() won't
|
||||
* be exceeded and as long as all memory regions are of the same kind (e.g.,
|
||||
* all RAM or all ROM).
|
||||
*/
|
||||
struct MemoryDeviceClass {
|
||||
/* private */
|
||||
|
@ -125,6 +131,7 @@ struct MemoryDeviceClass {
|
|||
|
||||
MemoryDeviceInfoList *qmp_memory_device_list(void);
|
||||
uint64_t get_plugged_memory_size(void);
|
||||
unsigned int memory_devices_get_reserved_memslots(void);
|
||||
void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
|
||||
const uint64_t *legacy_align, Error **errp);
|
||||
void memory_device_plug(MemoryDeviceState *md, MachineState *ms);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue