mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
qemu: process: sev: Fill missing 'cbitpos' & 'reducedPhysBits' from caps
These XML attributes have been mandatory since the introduction of SEV support to libvirt. This design decision was based on QEMU's requirement for these to be mandatory for migration purposes, as differences in these values across platforms must result in the pre-migration checks failing (not that migration with SEV works at the time of this patch). This patch enables autofill of these attributes right before launching QEMU and thus updating the live XML. Signed-off-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
1fdc907325
commit
ccb40cf288
@ -2491,7 +2491,9 @@ struct _virDomainSEVDef {
|
||||
char *dh_cert;
|
||||
char *session;
|
||||
unsigned int policy;
|
||||
bool haveCbitpos;
|
||||
unsigned int cbitpos;
|
||||
bool haveReducedPhysBits;
|
||||
unsigned int reduced_phys_bits;
|
||||
};
|
||||
|
||||
|
@ -6233,6 +6233,33 @@ qemuProcessPrepareAllowReboot(virDomainObjPtr vm)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessUpdateSEVInfo(virDomainObjPtr vm)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
|
||||
virDomainSEVDefPtr sev = vm->def->sev;
|
||||
virSEVCapabilityPtr sevCaps = NULL;
|
||||
|
||||
/* if platform specific info like 'cbitpos' and 'reducedPhysBits' have
|
||||
* not been supplied, we need to autofill them from caps now as both are
|
||||
* mandatory on QEMU cmdline
|
||||
*/
|
||||
sevCaps = virQEMUCapsGetSEVCapabilities(qemuCaps);
|
||||
if (!sev->haveCbitpos) {
|
||||
sev->cbitpos = sevCaps->cbitpos;
|
||||
sev->haveCbitpos = true;
|
||||
}
|
||||
|
||||
if (!sev->haveReducedPhysBits) {
|
||||
sev->reduced_phys_bits = sevCaps->reduced_phys_bits;
|
||||
sev->haveReducedPhysBits = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuProcessPrepareDomain:
|
||||
* @driver: qemu driver
|
||||
@ -6361,6 +6388,12 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
|
||||
for (i = 0; i < vm->def->nshmems; i++)
|
||||
qemuDomainPrepareShmemChardev(vm->def->shmems[i]);
|
||||
|
||||
if (vm->def->sev) {
|
||||
VIR_DEBUG("Updating SEV platform info");
|
||||
if (qemuProcessUpdateSEVInfo(vm) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user