mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 17:18:01 +03:00
qemu_domain.c: do not auto-align ppc64 NVDIMMs
We don't need the auto-alignment now that the user is handling it by hand. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
0ccceaa57c
commit
07de813924
@ -8054,44 +8054,6 @@ qemuDomainGetMemoryModuleSizeAlignment(const virDomainDef *def,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainNVDimmAlignSizePseries(virDomainDefPtr def,
|
||||
virDomainMemoryDefPtr mem)
|
||||
{
|
||||
/* For NVDIMMs in ppc64 in we want to align down the guest
|
||||
* visible space, instead of align up, to avoid writing
|
||||
* beyond the end of file by adding a potential 256MiB
|
||||
* to the user specified size.
|
||||
*
|
||||
* The label-size is mandatory for ppc64 as well, meaning that
|
||||
* the guest visible space will be target_size-label_size.
|
||||
*
|
||||
* Finally, target_size must include label_size.
|
||||
*
|
||||
* The above can be summed up as follows:
|
||||
*
|
||||
* target_size = AlignDown(target_size - label_size) + label_size
|
||||
*/
|
||||
unsigned long long ppc64AlignSize = qemuDomainGetMemorySizeAlignment(def);
|
||||
unsigned long long guestArea = mem->size - mem->labelsize;
|
||||
|
||||
/* Align down guest_area. 256MiB is the minimum size. Error
|
||||
* out if target_size is smaller than 256MiB + label_size,
|
||||
* since aligning it up will cause QEMU errors. */
|
||||
if (mem->size < (ppc64AlignSize + mem->labelsize)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("minimum target size for the NVDIMM "
|
||||
"must be 256MB plus the label size"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
guestArea = (guestArea/ppc64AlignSize) * ppc64AlignSize;
|
||||
mem->size = guestArea + mem->labelsize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuDomainAlignMemorySizes(virDomainDefPtr def)
|
||||
{
|
||||
@ -8138,11 +8100,8 @@ qemuDomainAlignMemorySizes(virDomainDefPtr def)
|
||||
|
||||
/* Align memory module sizes */
|
||||
for (i = 0; i < def->nmems; i++) {
|
||||
if (def->mems[i]->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
|
||||
ARCH_IS_PPC64(def->os.arch)) {
|
||||
if (qemuDomainNVDimmAlignSizePseries(def, def->mems[i]) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
if (!(def->mems[i]->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
|
||||
ARCH_IS_PPC64(def->os.arch))) {
|
||||
align = qemuDomainGetMemoryModuleSizeAlignment(def, def->mems[i]);
|
||||
def->mems[i]->size = VIR_ROUND_UP(def->mems[i]->size, align);
|
||||
}
|
||||
@ -8175,10 +8134,8 @@ int
|
||||
qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
|
||||
virDomainMemoryDefPtr mem)
|
||||
{
|
||||
if (mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
|
||||
ARCH_IS_PPC64(def->os.arch)) {
|
||||
return qemuDomainNVDimmAlignSizePseries(def, mem);
|
||||
} else {
|
||||
if (!(mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
|
||||
ARCH_IS_PPC64(def->os.arch))) {
|
||||
mem->size = VIR_ROUND_UP(mem->size,
|
||||
qemuDomainGetMemorySizeAlignment(def));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user