On Mon, Feb 03, 2020 at 10:59:19AM -0500, Stefan Berger wrote:
Extend QEMU with tpm-spapr support. Assign a device address to the
vTPM device model.
Signed-off-by: Stefan Berger <stefanb(a)linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
src/qemu/qemu_command.c | 15 ++++++++++-----
src/qemu/qemu_domain.c | 2 ++
src/qemu/qemu_domain_address.c | 10 ++++++++++
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 409d850a06..ef17e84d7c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -35,6 +35,7 @@ VIR_LOG_INIT("qemu.qemu_domain_address");
#define VIO_ADDR_SCSI 0x2000ul
#define VIO_ADDR_SERIAL 0x30000000ul
#define VIO_ADDR_NVRAM 0x3000ul
+#define VIO_ADDR_TPM 0x4000ul
/**
@@ -267,6 +268,15 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
return -1;
}
+ if (def->tpm) {
+ if (ARCH_IS_PPC64(def->os.arch) &&
+ STRPREFIX(def->os.machine, "pseries"))
if (qemuDomainIsPSeries(def))
as the condition right above uses
+ def->tpm->info.type =
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
+ if (qemuDomainAssignSpaprVIOAddress(def, &def->tpm->info,
+ VIO_ADDR_TPM) < 0)
+ return -1;
+ }
+
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano