mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 01:43:39 +00:00
![Eric Auger](/assets/img/avatar_default.png)
ISA and sysbus TPM-TIS devices will share their tests. Only the main() will change (instantiation option is different). Also the base address of the TPM-TIS device is going to be different. on x86 it is located at 0xFED40000 while on ARM it can be located at any location, discovered through the device tree description. So we put shared test functions in a new object module. Each test needs to set tpm_tis_base_addr global variable. Also take benefit of this move to fix "block comments using a leading */ on a separate line" checkpatch warnings. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-id: 20200305165149.618-10-eric.auger@redhat.com Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
58 lines
1.9 KiB
C
58 lines
1.9 KiB
C
/*
|
|
* QTest TPM utilities
|
|
*
|
|
* Copyright (c) 2018 IBM Corporation
|
|
*
|
|
* Authors:
|
|
* Stefan Berger <stefanb@linux.vnet.ibm.com>
|
|
*
|
|
* 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 TESTS_TPM_UTIL_H
|
|
#define TESTS_TPM_UTIL_H
|
|
|
|
#include "io/channel-socket.h"
|
|
|
|
extern uint64_t tpm_tis_base_addr;
|
|
|
|
#define TIS_REG(LOCTY, REG) \
|
|
(tpm_tis_base_addr + ((LOCTY) << 12) + REG)
|
|
|
|
typedef void (tx_func)(QTestState *s,
|
|
const unsigned char *req, size_t req_size,
|
|
unsigned char *rsp, size_t rsp_size);
|
|
|
|
void tpm_util_crb_transfer(QTestState *s,
|
|
const unsigned char *req, size_t req_size,
|
|
unsigned char *rsp, size_t rsp_size);
|
|
void tpm_util_tis_transfer(QTestState *s,
|
|
const unsigned char *req, size_t req_size,
|
|
unsigned char *rsp, size_t rsp_size);
|
|
|
|
void tpm_util_startup(QTestState *s, tx_func *tx);
|
|
void tpm_util_pcrextend(QTestState *s, tx_func *tx);
|
|
void tpm_util_pcrread(QTestState *s, tx_func *tx,
|
|
const unsigned char *exp_resp, size_t exp_resp_size);
|
|
|
|
bool tpm_util_swtpm_has_tpm2(void);
|
|
|
|
gboolean tpm_util_swtpm_start(const char *path, GPid *pid,
|
|
SocketAddress **addr, GError **error);
|
|
void tpm_util_swtpm_kill(GPid pid);
|
|
|
|
void tpm_util_migrate(QTestState *who, const char *uri);
|
|
|
|
void tpm_util_migration_start_qemu(QTestState **src_qemu,
|
|
QTestState **dst_qemu,
|
|
SocketAddress *src_tpm_addr,
|
|
SocketAddress *dst_tpm_addr,
|
|
const char *miguri,
|
|
const char *ifmodel,
|
|
const char *machine_options);
|
|
|
|
void tpm_util_wait_for_migration_complete(QTestState *who);
|
|
|
|
#endif /* TESTS_TPM_UTIL_H */
|