[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 09/14] vTPM/TPM2: Support 'tpm2' extra command line.
On 12/31/2014 12:51 AM, Quan Xu wrote: Make vtpm-stubdom domain compatible to launch on TPM 1.x / TPM 2.0. Add: .. extra="tpm2" .. to launch vtpm-stubdom domain on TPM 2.0, ignore it on TPM 1.x. for example, vtpm-stubdom domain configuration on TPM 2.0: kernel="/usr/lib/xen/boot/vtpmmgr-stubdom.gz" memory=16 disk=["file:/var/scale/vdisk/vmgr,hda,w"] name="vtpmmgr" iomem=["fed40,5"] extra="tpm2" vtpm-stubdom domain configuration on TPM 1.x: kernel="/usr/lib/xen/boot/vtpmmgr-stubdom.gz" memory=16 disk=["file:/var/scale/vdisk/vmgr,hda,w"] name="vtpmmgr" iomem=["fed40,5"] Signed-off-by: Quan Xu <quan.xu@xxxxxxxxx> --- stubdom/vtpmmgr/vtpmmgr.c | 46 ++++++++++++++++++++++++++++++++++++++++------ stubdom/vtpmmgr/vtpmmgr.h | 14 ++++++++++++++ 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/stubdom/vtpmmgr/vtpmmgr.c b/stubdom/vtpmmgr/vtpmmgr.c index 270ca8a..f743ca6 100644 --- a/stubdom/vtpmmgr/vtpmmgr.c +++ b/stubdom/vtpmmgr/vtpmmgr.c @@ -45,6 +45,27 @@ #include "vtpmmgr.h" #include "tcg.h" +struct tpm_hardware_version hardware_version = { + .hw_version = TPM1_HARDWARE, +}; + +int parse_cmdline_hw(int argc, char** argv) +{ + int i; + + for (i = 1; i < argc; ++i) { + if (!strncmp(argv[i], TPM2_EXTRA_OPT, 4)) { + hardware_version.hw_version = TPM2_HARDWARE; + break; + } + } + return 0; +} I would change this from strncmp to strcmp so that it does not just match any argument that starts with "tpm2". If you also want to support "tpm2=1", then checking for that explicitly is preferred. Currently, "tpm2=0" will enable the tpm2 driver, which is confusing. -- Daniel De Graaf National Security Agency _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |