On Mon, Feb 08, 2021 at 16:14:54 +0100, Michal Privoznik wrote: > A few commits back I've introduced new 'virtio-pmem' <memory/> > device. Since it's virtio it goes onto PCI bus. Therefore, on > hotplug new PCI address is generated (or provided one is > reserved). However, if hotplug fails (for whatever reason) the > address needs to be released. This is different to 'dimm' type of > address because for that type we don't keep a map of used slots > rather generate one on each address assign request. The map is > then thrown away. But for PCI addresses we keep internal state > and thus has to keep it updated. Therefore, this new > qemuDomainReleaseMemoryDeviceSlot() function is NOP for those > models which use 'dimm' address type ('dimm' and 'nvdimm'). > > While I'm at it, let's release the address in case of hot unplug. > Not that is supported (any such attempt fails with the following > error: > > "virtio based memory devices cannot be unplugged" > > But if QEMU ever implements hot unplug then we don't have to > remember to fix our code. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > src/qemu/qemu_domain_address.c | 23 +++++++++++++++++++++++ > src/qemu/qemu_domain_address.h | 3 +++ > src/qemu/qemu_hotplug.c | 6 ++++++ > 3 files changed, 32 insertions(+) Reviewed-by: Jiri Denemark <jdenemar@xxxxxxxxxx>