On Tue, Mar 05, 2019 at 09:46:07AM -0300, Daniel Henrique Barboza wrote: > There are a lot of documentation in the comments about how > PPC64 handles passthrough VFIO devices to calculate the > memLockLimit. And more will be added with the PPC64 NVLink2 > support code. > > Let's remove the PPC64 code from qemuDomainGetMemLockLimitBytes > body and put it into a helper function. This will simply the s/simply/simplify > flow of qemuDomainGetMemLockLimitBytes that handles all other > platforms and improves the readability of PPC64 specifics. > > Suggested-by: Erik Skultety <eskultet@xxxxxxxxxx> > Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> > --- > src/qemu/qemu_domain.c | 169 ++++++++++++++++++++++------------------- > 1 file changed, 91 insertions(+), 78 deletions(-) > > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c > index 099097fe62..77548c224c 100644 > --- a/src/qemu/qemu_domain.c > +++ b/src/qemu/qemu_domain.c > @@ -10343,6 +10343,95 @@ qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm) > } > > > +/** > + * getPPC64MemLockLimitBytes: > + * @def: domain definition > + * > + * A PPC64 helper that calculates the memory locking limit in order for > + * the guest to operate properly. > + */ > +static unsigned long long > +getPPC64MemLockLimitBytes(virDomainDefPtr def) > +{ > + unsigned long long memKB = 0; > + unsigned long long baseLimit, memory, maxMemory; One variable per line. [...] I'll squash this in before pushing: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 77548c224c..535ee78c6f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10354,7 +10354,9 @@ static unsigned long long getPPC64MemLockLimitBytes(virDomainDefPtr def) { unsigned long long memKB = 0; - unsigned long long baseLimit, memory, maxMemory; + unsigned long long baseLimit = 0; + unsigned long long memory = 0; + unsigned long long maxMemory = 0; unsigned long long passthroughLimit = 0; size_t i, nPCIHostBridges = 0; bool usesVFIO = false; Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx> -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list