Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2020-06-23-1' into staging

Merge tpm 2020/06/23 v1

# gpg: Signature made Tue 23 Jun 2020 12:35:03 BST
# gpg:                using RSA key B818B9CADF9089C2D5CEC66B75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2020-06-23-1:
  tpm: Move backend code under the 'backends/' directory
  hw/tpm: Make 'tpm_util.h' publicly accessible as "sysemu/tpm_util.h"
  hw/tpm: Move DEFINE_PROP_TPMBE() macro to 'tmp_prop.h' local header
  hw/tpm: Move few declarations from 'tpm_util.h' to 'tpm_int.h'
  hw/tpm: Make TRACE_TPM_UTIL_SHOW_BUFFER check local to tpm_util.c
  hw/tpm: Remove unnecessary 'tpm_int.h' header inclusion
  hw/tpm: Move 'hw/acpi/tpm.h' inclusion from header to sources
  hw/tpm: Include missing 'qemu/option.h' header
  hw/tpm: Do not include 'qemu/osdep.h' in header
  hw/tpm: Rename TPMDEV as TPM_BACKEND in Kconfig
  backends: Add TPM files into their own directory
  docs/specs/tpm: Correct header path name

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2020-06-24 21:19:53 +01:00
29 changed files with 136 additions and 103 deletions
+1 -1
View File
@@ -2431,7 +2431,7 @@ F: hw/tpm/*
F: include/hw/acpi/tpm.h
F: include/sysemu/tpm*
F: qapi/tpm.json
F: backends/tpm.c
F: backends/tpm/
F: tests/qtest/*tpm*
T: git https://github.com/stefanberger/qemu-tpm.git tpm-next
+1 -1
View File
@@ -418,7 +418,7 @@ MINIKCONF_ARGS = \
CONFIG_LINUX=$(CONFIG_LINUX) \
CONFIG_PVRDMA=$(CONFIG_PVRDMA)
MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig
MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/backends/Kconfig $(SRC_PATH)/hw/Kconfig
MINIKCONF_DEPS = $(MINIKCONF_INPUTS) $(wildcard $(SRC_PATH)/hw/*/Kconfig)
MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \
+1
View File
@@ -125,6 +125,7 @@ trace-events-subdirs =
trace-events-subdirs += accel/kvm
trace-events-subdirs += accel/tcg
trace-events-subdirs += backends
trace-events-subdirs += backends/tpm
trace-events-subdirs += crypto
trace-events-subdirs += monitor
ifeq ($(CONFIG_USER_ONLY),y)
+1
View File
@@ -0,0 +1 @@
source tpm/Kconfig
+1 -1
View File
@@ -1,7 +1,7 @@
common-obj-y += rng.o rng-egd.o rng-builtin.o
common-obj-$(CONFIG_POSIX) += rng-random.o
common-obj-$(CONFIG_TPM) += tpm.o
common-obj-$(CONFIG_TPM) += tpm/
common-obj-y += hostmem.o hostmem-ram.o
common-obj-$(CONFIG_POSIX) += hostmem-file.o
+14
View File
@@ -0,0 +1,14 @@
config TPM_BACKEND
bool
depends on TPM
config TPM_PASSTHROUGH
bool
default y
# FIXME: should check for x86 host as well
depends on TPM_BACKEND && LINUX
config TPM_EMULATOR
bool
default y
depends on TPM_BACKEND
+4
View File
@@ -0,0 +1,4 @@
common-obj-y += tpm_backend.o
common-obj-y += tpm_util.o
common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o
common-obj-$(CONFIG_TPM_EMULATOR) += tpm_emulator.o
@@ -32,8 +32,8 @@
#include "qemu/sockets.h"
#include "io/channel-socket.h"
#include "sysemu/tpm_backend.h"
#include "sysemu/tpm_util.h"
#include "tpm_int.h"
#include "tpm_util.h"
#include "tpm_ioctl.h"
#include "migration/blocker.h"
#include "migration/vmstate.h"
+16 -3
View File
@@ -9,8 +9,11 @@
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef TPM_TPM_INT_H
#define TPM_TPM_INT_H
#ifndef BACKENDS_TPM_INT_H
#define BACKENDS_TPM_INT_H
#include "qemu/option.h"
#include "sysemu/tpm.h"
#define TPM_STANDARD_CMDLINE_OPTS \
{ \
@@ -72,4 +75,14 @@ struct tpm_resp_hdr {
#define TPM_RC_FAILURE 0x101
#define TPM_RC_LOCALITY 0x907
#endif /* TPM_TPM_INT_H */
int tpm_util_get_buffer_size(int tpm_fd, TPMVersion tpm_version,
size_t *buffersize);
typedef struct TPMSizedBuffer {
uint32_t size;
uint8_t *buffer;
} TPMSizedBuffer;
void tpm_sized_buffer_reset(TPMSizedBuffer *tsb);
#endif /* BACKENDS_TPM_INT_H */
@@ -28,10 +28,10 @@
#include "qemu/module.h"
#include "qemu/sockets.h"
#include "sysemu/tpm_backend.h"
#include "sysemu/tpm_util.h"
#include "tpm_int.h"
#include "qapi/clone-visitor.h"
#include "qapi/qapi-visit-tpm.h"
#include "tpm_util.h"
#include "trace.h"
#define TYPE_TPM_PASSTHROUGH "tpm-passthrough"
@@ -23,11 +23,11 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/visitor.h"
#include "tpm_util.h"
#include "tpm_int.h"
#include "exec/memory.h"
#include "hw/qdev-properties.h"
#include "sysemu/tpm_backend.h"
#include "sysemu/tpm_util.h"
#include "trace.h"
/* tpm backend property */
@@ -357,6 +357,9 @@ void tpm_util_show_buffer(const unsigned char *buffer,
size_t len, i;
char *line_buffer, *p;
if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER)) {
return;
}
len = MIN(tpm_cmd_get_size(buffer), buffer_size);
/*
+33
View File
@@ -0,0 +1,33 @@
# See docs/devel/tracing.txt for syntax documentation.
# tpm_passthrough.c
tpm_passthrough_handle_request(void *cmd) "processing command %p"
tpm_passthrough_reset(void) "reset"
# tpm_util.c
tpm_util_get_buffer_size_hdr_len(uint32_t len, size_t expected) "tpm_resp->hdr.len = %u, expected = %zu"
tpm_util_get_buffer_size_len(uint32_t len, size_t expected) "tpm_resp->len = %u, expected = %zu"
tpm_util_get_buffer_size_hdr_len2(uint32_t len, size_t expected) "tpm2_resp->hdr.len = %u, expected = %zu"
tpm_util_get_buffer_size_len2(uint32_t len, size_t expected) "tpm2_resp->len = %u, expected = %zu"
tpm_util_get_buffer_size(size_t len) "buffersize of device: %zu"
tpm_util_show_buffer(const char *direction, size_t len, const char *buf) "direction: %s len: %zu\n%s"
# tpm_emulator.c
tpm_emulator_set_locality(uint8_t locty) "setting locality to %d"
tpm_emulator_handle_request(void) "processing TPM command"
tpm_emulator_probe_caps(uint64_t caps) "capabilities: 0x%"PRIx64
tpm_emulator_set_buffer_size(uint32_t buffersize, uint32_t minsize, uint32_t maxsize) "buffer size: %u, min: %u, max: %u"
tpm_emulator_startup_tpm_resume(bool is_resume, size_t buffersize) "is_resume: %d, buffer size: %zu"
tpm_emulator_get_tpm_established_flag(uint8_t flag) "got established flag: %d"
tpm_emulator_cancel_cmd_not_supt(void) "Backend does not support CANCEL_TPM_CMD"
tpm_emulator_handle_device_opts_tpm12(void) "TPM Version 1.2"
tpm_emulator_handle_device_opts_tpm2(void) "TPM Version 2"
tpm_emulator_handle_device_opts_unspec(void) "TPM Version Unspecified"
tpm_emulator_handle_device_opts_startup_error(void) "Startup error"
tpm_emulator_get_state_blob(uint8_t type, uint32_t size, uint32_t flags) "got state blob type %d, %u bytes, flags 0x%08x"
tpm_emulator_set_state_blob(uint8_t type, uint32_t size, uint32_t flags) "set state blob type %d, %u bytes, flags 0x%08x"
tpm_emulator_set_state_blobs(void) "setting state blobs"
tpm_emulator_set_state_blobs_error(const char *msg) "error while setting state blobs: %s"
tpm_emulator_set_state_blobs_done(void) "Done setting state blobs"
tpm_emulator_pre_save(void) ""
tpm_emulator_inst_init(void) ""
+7 -7
View File
@@ -199,8 +199,8 @@ to be used with the passthrough backend or the swtpm backend.
QEMU files related to TPM backends:
- ``backends/tpm.c``
- ``include/sysemu/tpm.h``
- ``include/sysemu/tpm_backend.h``
- ``include/sysemu/tpm_backend_int.h``
The QEMU TPM passthrough device
-------------------------------
@@ -232,9 +232,9 @@ Integrity Measurement Architecture (IMA), are not expecting to share
PCRs.
QEMU files related to the TPM passthrough device:
- ``hw/tpm/tpm_passthrough.c``
- ``hw/tpm/tpm_util.c``
- ``hw/tpm/tpm_util.h``
- ``backends/tpm/tpm_passthrough.c``
- ``backends/tpm/tpm_util.c``
- ``include/sysemu/tpm_util.h``
Command line to start QEMU with the TPM passthrough device using the host's
@@ -292,9 +292,9 @@ instrumented to initialize a TPM 1.2 or TPM 2 device using this
command.
QEMU files related to the TPM emulator device:
- ``hw/tpm/tpm_emulator.c``
- ``hw/tpm/tpm_util.c``
- ``hw/tpm/tpm_util.h``
- ``backends/tpm/tpm_emulator.c``
- ``backends/tpm/tpm_util.c``
- ``include/sysemu/tpm_util.h``
The following commands start the swtpm with a UnixIO control channel over
a socket interface. They do not need to be run as root.
+3 -18
View File
@@ -1,7 +1,3 @@
config TPMDEV
bool
depends on TPM
config TPM_TIS_ISA
bool
depends on TPM && ISA_BUS
@@ -15,26 +11,15 @@ config TPM_TIS_SYSBUS
config TPM_TIS
bool
depends on TPM
select TPMDEV
select TPM_BACKEND
config TPM_CRB
bool
depends on TPM && PC
select TPMDEV
config TPM_PASSTHROUGH
bool
default y
# FIXME: should check for x86 host as well
depends on TPMDEV && LINUX
config TPM_EMULATOR
bool
default y
depends on TPMDEV
select TPM_BACKEND
config TPM_SPAPR
bool
default y
depends on TPM && PSERIES
select TPMDEV
select TPM_BACKEND
-3
View File
@@ -1,9 +1,6 @@
common-obj-$(CONFIG_TPM) += tpm_util.o
obj-$(call lor,$(CONFIG_TPM_TIS),$(CONFIG_TPM_CRB)) += tpm_ppi.o
common-obj-$(CONFIG_TPM_TIS_ISA) += tpm_tis_isa.o
common-obj-$(CONFIG_TPM_TIS_SYSBUS) += tpm_tis_sysbus.o
common-obj-$(CONFIG_TPM_TIS) += tpm_tis_common.o
common-obj-$(CONFIG_TPM_CRB) += tpm_crb.o
common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o
common-obj-$(CONFIG_TPM_EMULATOR) += tpm_emulator.o
obj-$(CONFIG_TPM_SPAPR) += tpm_spapr.o
+2 -2
View File
@@ -24,9 +24,9 @@
#include "hw/acpi/tpm.h"
#include "migration/vmstate.h"
#include "sysemu/tpm_backend.h"
#include "sysemu/tpm_util.h"
#include "sysemu/reset.h"
#include "tpm_int.h"
#include "tpm_util.h"
#include "tpm_prop.h"
#include "tpm_ppi.h"
#include "trace.h"
+1
View File
@@ -17,6 +17,7 @@
#include "cpu.h"
#include "sysemu/memory_mapping.h"
#include "migration/vmstate.h"
#include "hw/acpi/tpm.h"
#include "tpm_ppi.h"
#include "trace.h"
-1
View File
@@ -12,7 +12,6 @@
#ifndef TPM_TPM_PPI_H
#define TPM_TPM_PPI_H
#include "hw/acpi/tpm.h"
#include "exec/address-spaces.h"
typedef struct TPMPPI {

Some files were not shown because too many files have changed in this diff Show More