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(a)redhat.com>
---
src/conf/domain_validate.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index ac32fa1477..e423383e22 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2221,6 +2221,7 @@ static int
virDomainMemoryDefValidate(const virDomainMemoryDef *mem,
const virDomainDef *def)
{
+ const long pagesize = virGetSystemPageSize();
unsigned long long thpSize;
/* Guest NUMA nodes are continuous and indexed from zero. */
@@ -2295,6 +2296,14 @@ virDomainMemoryDefValidate(const virDomainMemoryDef *mem,
_("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:
--
2.41.0