mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +00:00
domain_validate: Validate VIRTIO_PMEM address alignment
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>
This commit is contained in:
parent
1839c5c46e
commit
d54b70a7e4
@ -2221,6 +2221,7 @@ static int
|
|||||||
virDomainMemoryDefValidate(const virDomainMemoryDef *mem,
|
virDomainMemoryDefValidate(const virDomainMemoryDef *mem,
|
||||||
const virDomainDef *def)
|
const virDomainDef *def)
|
||||||
{
|
{
|
||||||
|
const long pagesize = virGetSystemPageSize();
|
||||||
unsigned long long thpSize;
|
unsigned long long thpSize;
|
||||||
|
|
||||||
/* Guest NUMA nodes are continuous and indexed from zero. */
|
/* Guest NUMA nodes are continuous and indexed from zero. */
|
||||||
@ -2295,6 +2296,14 @@ virDomainMemoryDefValidate(const virDomainMemoryDef *mem,
|
|||||||
_("virtio-pmem does not support NUMA nodes"));
|
_("virtio-pmem does not support NUMA nodes"));
|
||||||
return -1;
|
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;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
|
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
|
||||||
|
Loading…
Reference in New Issue
Block a user