tpm: express dependencies with Kconfig

This automatically removes the TPM backends from the
binary altogether if no front-ends are selected.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2019-01-23 14:56:07 +08:00
parent b42075bb77
commit 7aaa6a1637
2 changed files with 21 additions and 13 deletions

24
configure vendored
View File

@ -466,7 +466,7 @@ gcrypt_hmac="no"
auth_pam="" auth_pam=""
vte="" vte=""
virglrenderer="" virglrenderer=""
tpm="yes" tpm=""
libssh2="" libssh2=""
live_block_migration="yes" live_block_migration="yes"
numa="" numa=""
@ -3877,20 +3877,20 @@ EOF
fi fi
########################################## ##########################################
# TPM passthrough is only on x86 Linux # TPM emulation is only on POSIX
if test "$targetos" = Linux && { test "$cpu" = i386 || test "$cpu" = x86_64; }; then if test "$tpm" = ""; then
tpm_passthrough=$tpm if test "$mingw32" = "yes"; then
else tpm=no
tpm_passthrough=no else
tpm=yes
fi
elif test "$tpm" = "yes"; then
if test "$mingw32" = "yes" ; then
error_exit "TPM emulation only available on POSIX systems"
fi
fi fi
# TPM emulator is for all posix systems
if test "$mingw32" != "yes"; then
tpm_emulator=$tpm
else
tpm_emulator=no
fi
########################################## ##########################################
# attr probe # attr probe

View File

@ -1,16 +1,24 @@
config TPM config TPMDEV
bool bool
depends on TPM
config TPM_TIS config TPM_TIS
bool bool
depends on TPM && ISA_BUS depends on TPM && ISA_BUS
select TPMDEV
config TPM_CRB config TPM_CRB
bool bool
depends on TPM && PC depends on TPM && PC
select TPMDEV
config TPM_PASSTHROUGH config TPM_PASSTHROUGH
bool bool
default y
# FIXME: should check for x86 host as well
depends on TPMDEV && LINUX
config TPM_EMULATOR config TPM_EMULATOR
bool bool
default y
depends on TPMDEV