Hi Michal,
You asked how NVDIMM hotplug should work if the domain was launched
without -M nvdimm=on. I'm not very familiar with ACPI so this may be
incorrect.
Hotplug relies on the presence of ACPI tables (SSDT Device=NVDR
_HID=ACPI0012) added by -M nvdimm=on. The ACPI tables contain the
interface needed to handle hotplug events.
The device_add command fails with the following message if -M nvdimm=on
is missing:
nvdimm is not enabled: missing 'nvdimm' in '-M'
I'm not sure if ACPI allows SSDT tables to be dynamically added but in
any case the current QEMU code doesn't support that.
Options for libvirt:
1. Rely on QEMU's device_add error.
Pro: If QEMU behavior ever changes then libvirt will also start
working without code changes.
Cons: Does libvirt interpret QMP error strings?
2. Only allow NVDIMM hotplug if the domain was started with -M
nvdimm=on.
I think QEMU will not add -M nvdimm=on to the "pc" machine type by
default since it adds the NVDIMM DSM hardware interface that increases
the security attack surface.
Stefan