tpm: add CRB device model

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2018-06-08 17:42:40 -04:00 committed by Cole Robinson
parent c04733c10d
commit 67cb191e82
4 changed files with 16 additions and 2 deletions

View File

@ -143,6 +143,11 @@
<device path="/dev/tpm0"/>
</backend>
</tpm>
<tpm model="tpm-crb">
<backend type="passthrough">
<device path="/dev/tpm0"/>
</backend>
</tpm>
<graphics type="vnc" port="-1"/>
<watchdog model="ib700" action="pause"/>
<memballoon model="virtio"/>
@ -312,6 +317,11 @@
<device path="/dev/tpm0"/>
</backend>
</tpm>
<tpm model="tpm-crb">
<backend type="passthrough">
<device path="/dev/tpm0"/>
</backend>
</tpm>
<graphics type="vnc" port="-1"/>
<watchdog model="ib700" action="pause"/>
<memballoon model="virtio"/>

View File

@ -449,6 +449,7 @@ cache.mode=emulate,cache.level=3 \
--memballoon virtio \
--watchdog ib700,action=pause \
--tpm passthrough,model=tpm-tis,path=/dev/tpm0 \
--tpm passthrough,model=tpm-crb,path=/dev/tpm0 \
--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind,backend_connect_host=foo,backend_connect_service=708 \
--panic iobase=0x506 \
""", "singleton-config-2")

View File

@ -909,7 +909,7 @@ class XMLParseTest(unittest.TestCase):
check = self._make_checker(dev1)
check("type", "passthrough", "foo", "passthrough")
check("model", "tpm-tis", "tpm-tis")
check("model", "tpm-tis", "tpm-crb", "tpm-tis")
check("device_path", "/dev/tpm0", "frob")
self._alter_compare(guest.get_xml_config(), outfile)

View File

@ -21,8 +21,9 @@ class DeviceTpm(Device):
TYPES = [TYPE_PASSTHROUGH]
MODEL_TIS = "tpm-tis"
MODEL_CRB = "tpm-crb"
MODEL_DEFAULT = "default"
MODELS = [MODEL_TIS]
MODELS = [MODEL_TIS, MODEL_CRB]
@staticmethod
def get_pretty_type(tpm_type):
@ -34,6 +35,8 @@ class DeviceTpm(Device):
def get_pretty_model(tpm_model):
if tpm_model == DeviceTpm.MODEL_TIS:
return _("TIS")
if tpm_model == DeviceTpm.MODEL_CRB:
return _("CRB")
return tpm_model
def supports_property(self, propname):