Enable the TPM CRB to be specified in the domain XML. This
now allows to describe the TPM device like this:
Extend the XML schema to also allow tpm-crb.
Extend the documentation.
Add a test case for testing the XML parser and formatter.
Signed-off-by: Stefan Berger
---
docs/formatdomain.html.in| 6 +++-
docs/schemas/domaincommon.rng| 5 +++-
src/conf/domain_conf.c | 5 ++--
src/conf/domain_conf.h | 1 +
tests/qemuxml2argvdata/tpm-passthrough-crb.xml | 32 +
tests/qemuxml2xmloutdata/tpm-passthrough-crb.xml | 36
tests/qemuxml2xmltest.c | 1 +
7 files changed, 81 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/tpm-passthrough-crb.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-passthrough-crb.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 8e864f7..d48e335 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7625,7 +7625,8 @@ qemu-kvm -net nic,model=? /dev/null
The TPM device enables a QEMU guest to have access to TPM
- functionality.
+ functionality. The TPM device may either be a TPM 1.2 or
+ a TPM 2.
The TPM passthrough device type provides access to the host's TPM
@@ -7655,6 +7656,9 @@ qemu-kvm -net nic,model=? /dev/null
The model attribute specifies what device
model QEMU provides to the guest. If no model name is provided,
tpm-tis will automatically be chosen.
+ Since 4.3.0, another available choice
+ is the tpm-crb, which should only be used when the
+ backend device is a TPM 2.
backend
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3569b92..1a73c4c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4115,7 +4115,10 @@
- tpm-tis
+
+tpm-tis
+tpm-crb
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b025706..6a2e28a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -860,7 +860,8 @@ VIR_ENUM_IMPL(virDomainRNGBackend,
"egd");
VIR_ENUM_IMPL(virDomainTPMModel, VIR_DOMAIN_TPM_MODEL_LAST,
- "tpm-tis")
+ "tpm-tis",
+ "tpm-crb")
VIR_ENUM_IMPL(virDomainTPMBackend, VIR_DOMAIN_TPM_TYPE_LAST,
"passthrough")
@@ -12606,8 +12607,6 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unknown TPM frontend model '%s'"), model);
goto error;
-} else {
-def->model = VIR_DOMAIN_TPM_MODEL_TIS;
}
ctxt->node = node;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3c7eccb..8b82cf9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1282,6 +1282,7 @@ struct _virDomainHubDef {
typedef enum {
VIR_DOMAIN_TPM_MODEL_TIS,
+VIR_DOMAIN_TPM_MODEL_CRB,
VIR_DOMAIN_TPM_MODEL_LAST
} virDomainTPMModel;
diff --git a/tests/qemuxml2argvdata/tpm-passthrough-crb.xml
b/tests/qemuxml2argvdata/tpm-passthrough-crb.xml
new file mode 100644
index 000..2fce5ca
--- /dev/null
+++ b/tests/qemuxml2argvdata/tpm-passthrough-crb.xml
@@ -0,0 +1,32 @@
+
+ TPM-VM
+ 11d7cd22-da89-3094-6212-079a48a309a1
+ 2097152
+ 512288
+ 1
+
+hvm
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+/usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/tpm-passthrough-crb.xml
b/tests/qemuxml2xmloutdata/tpm-passthrough-crb.xml
new file mode 100644
index 000..67ada46
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/tpm-passthrough-crb.xml
@@ -0,0 +1,36 @@
+
+ TPM-VM
+ 11d7cd22-da89-3094-6212-079a48a309a1
+ 2097152
+ 512288
+ 1
+
+hvm
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+/usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 4b5aa23..21fb411 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -672,6 +672,7 @@ mymain(void)
DO_TEST("usb-ich9-ehci-addr", NONE);
DO_TEST("disk-copy_on_read", NONE);
DO_TEST("tpm-passthrough", NONE);
+DO_TEST("tpm-passthrough-crb", NONE);
DO_TEST("metadata", NONE);
DO_TEST("metadata-duplicate", NONE);
--
2.5.5
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list