On 23.04.2018 12:44, David Gibson wrote: > On Mon, Apr 23, 2018 at 11:36:48AM +0200, David Hildenbrand wrote: >> On 23.04.2018 05:28, David Gibson wrote: >>> On Fri, Apr 20, 2018 at 02:34:55PM +0200, David Hildenbrand wrote: >>>> Let's allow to query the MemoryHotplugState from the machine. >>>> >>>> This allows us to generically detect if a certain machine has support >>>> for memory devices, and to generically manage it (find free address >>>> range, plug/unplug a memory region). >>>> >>>> Signed-off-by: David Hildenbrand <da...@redhat.com> >>> >>> So, we're creating a hook where it seems very likely that the only >>> implementationss will be simply to retrieve the right field from the >>> machine specific structure. >>> >>> So.. should we instead just move the hotplug_memory structure to the >>> based MachineState type? >> >> It allows us in patch nr. 3 to report different error messages. >> >> "Not supported" vs. "Not enabled (maxmem)". >> >> We could also handle that via a simple boolean flag inside of the >> struct. What do you think? > > A third option would be to make it a pointer, rather than directly > embedded in the MachineState. That would also avoid the extra > allocation for machines that don't use it. >
That sounds like a good alternative, will look into it! Thanks! -- Thanks, David / dhildenb