[libvirt PATCH 2/3] qemu: fill in domain capabilities for TPMs

Daniel P. Berrangé berrange at redhat.com
Wed Nov 24 09:13:40 UTC 2021


On Wed, Nov 24, 2021 at 10:06:12AM +0100, Michal Prívozník wrote:
> On 11/23/21 19:04, Daniel P. Berrangé wrote:
> > This reports what TPM features QEMU supports, provided that swtpm is
> > installed in the host.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> > ---
> 
> >  71 files changed, 104 insertions(+)
> > 
> > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> > index a4c492dde2..374909bef2 100644
> > --- a/src/qemu/qemu_capabilities.c
> > +++ b/src/qemu/qemu_capabilities.c
> > @@ -49,6 +49,7 @@
> >  #include "qemu_process.h"
> >  #include "qemu_firmware.h"
> >  #include "virutil.h"
> > +#include "virtpm.h"
> >  
> >  #include <fcntl.h>
> >  #include <sys/stat.h>
> > @@ -6206,6 +6207,35 @@ virQEMUCapsFillDomainDeviceFSCaps(virQEMUCaps *qemuCaps,
> >  }
> >  
> >  
> > +void
> > +virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps,
> > +                                   virDomainCapsDeviceTPM *tpm)
> > +{
> > +    if (virTPMEmulatorInit() < 0) {
> > +        virResetLastError();
> > +        tpm->supported = VIR_TRISTATE_BOOL_NO;
> > +    } else {
> 
> Nitpick. Put 'return' in the branch above and drop 'else'. One level of
> indendation can be saved this way.

THis logic is wrong actually, as even if swtpm is not present, we can
still support passthrough mode TPMs.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list