virDomainMemoryDefCheckConflict: Check dimm & nvdimm models too

So far we check whether virtio-mem and/or virtio-pmem memory
devices do not overlap with each other. But we allow specifying
address where dimm and nvdimm memory devices are mapped too. And
there are left out from this collision check. Not anymore.

This leaves just sgx model out, but that's expected since it
can't have any address (see virDomainMemoryDefValidate()).

Resolves: https://issues.redhat.com/browse/RHEL-4452
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2023-11-02 16:06:00 +01:00
parent 3d017fb651
commit 3c2cb7d7b3

View File

@ -2234,6 +2234,10 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
break;
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
thisStart = mem->info.addr.dimm.base;
}
break;
case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
case VIR_DOMAIN_MEMORY_MODEL_NONE:
case VIR_DOMAIN_MEMORY_MODEL_LAST:
@ -2271,13 +2275,17 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
switch (other->model) {
case VIR_DOMAIN_MEMORY_MODEL_NONE:
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
case VIR_DOMAIN_MEMORY_MODEL_LAST:
continue;
break;
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
if (other->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
otherStart = other->info.addr.dimm.base;
}
break;
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
otherStart = other->target.virtio_pmem.address;
break;