QEMU mandates the VIRTIO_PMEM address is aligned to a pagesize.
This is a very reasonable requirement. So much so, that it
deserves to be in hypervisor agnostic validation code
(virDomainMemoryDefValidate()). Not that any other hypervisor
would support VIRTIO_PMEM yet. But even if they did, this would
surely be still valid.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
virDomainMemoryDefValidate(const virDomainMemoryDef *mem,
const virDomainDef *def)
{
+ const long pagesize = virGetSystemPageSize();
unsigned long long thpSize;
/* Guest NUMA nodes are continuous and indexed from zero. */
_("virtio-pmem does not support NUMA nodes"));
return -1;
}
+
+ if (pagesize > 0 &&
+ mem->target.virtio_pmem.address % pagesize != 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("memory address must be aligned to %1$ld bytes"),
+ pagesize);
+ return -1;
+ }
break;
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: