[libvirt] [PATCH v5 10/11] conf: Add support for choosing emulation of a TPM 2

Stefan Berger stefanb at linux.vnet.ibm.com
Tue May 22 12:37:18 UTC 2018


On 05/21/2018 06:49 PM, John Ferlan wrote:
>
> On 05/15/2018 08:26 PM, Stefan Berger wrote:
>> This patch extends the TPM's device XML with TPM 2 support. This only works
>> for the emulator type backend and looks as follows:
>>
>>      <tpm model='tpm-tis'>
>>        <backend type='emulator' version='2'/>
>>      </tpm>
>>
>> The swtpm process now has --tpm2 as an additional parameter:
>>
>> system_u:system_r:svirt_t:s0:c597,c632 tss 18477 11.8  0.0 28364  3868 ?        Rs   11:13  13:50 /usr/bin/swtpm socket --daemon --ctrl type=unixio,path=/var/run/libvirt/qemu/swtpm/testvm-swtpm.sock,mode=0660 --tpmstate dir=/var/lib/libvirt/swtpm/testvm/tpm2,mode=0640 --log file=/var/log/swtpm/libvirt/qemu/testvm-swtpm.log --tpm2 --pid file=/var/run/libvirt/qemu/swtpm/testvm-swtpm.pid
>>
>> The version of the TPM can be changed and the state of the TPM is preserved.
>>
>> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>> ---
>>   docs/formatdomain.html.in                          | 15 ++++-
>>   docs/schemas/domaincommon.rng                      | 12 ++++
>>   src/conf/domain_conf.c                             | 27 ++++++++-
>>   src/conf/domain_conf.h                             |  6 ++
>>   src/qemu/qemu_tpm.c                                | 64 +++++++++++++++++++++-
>>   .../tpm-emulator-tpm2.x86_64-latest.args           | 33 +++++++++++
>>   tests/qemuxml2argvdata/tpm-emulator-tpm2.xml       | 30 ++++++++++
>>   tests/qemuxml2argvtest.c                           |  1 +
>>   tests/qemuxml2xmloutdata/tpm-emulator-tpm2.xml     | 34 ++++++++++++
>>   9 files changed, 217 insertions(+), 5 deletions(-)
>>   create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.args
>>   create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2.xml
>>   create mode 100644 tests/qemuxml2xmloutdata/tpm-emulator-tpm2.xml
>>
> Reviewed-by: John Ferlan <jferlan at redhat.com>
>
> John
>
> Too bad we're stuck with help scraping for swtpm_setup rather than using
> some sort of ioctl to get the version support...
>

Thanks for the review. swtpm_setup is not a daemon or so that's running 
and we could ask for its version...




More information about the libvir-list mailing list