]> git.proxmox.com Git - mirror_qemu.git/blame - tests/qtest/tpm-util.h
netdev: set timeout depending on loadavg
[mirror_qemu.git] / tests / qtest / tpm-util.h
CommitLineData
b21373d0
SB
1/*
2 * QTest TPM utilities
3 *
4 * Copyright (c) 2018 IBM Corporation
5 *
6 * Authors:
7 * Stefan Berger <stefanb@linux.vnet.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
11 */
12
13#ifndef TESTS_TPM_UTIL_H
14#define TESTS_TPM_UTIL_H
15
b21373d0
SB
16#include "io/channel-socket.h"
17
5166c326
EA
18extern uint64_t tpm_tis_base_addr;
19
20#define TIS_REG(LOCTY, REG) \
21 (tpm_tis_base_addr + ((LOCTY) << 12) + REG)
22
b21373d0
SB
23typedef void (tx_func)(QTestState *s,
24 const unsigned char *req, size_t req_size,
25 unsigned char *rsp, size_t rsp_size);
26
27void tpm_util_crb_transfer(QTestState *s,
28 const unsigned char *req, size_t req_size,
70663851 29 unsigned char *rsp, size_t rsp_size);
b21373d0
SB
30
31void tpm_util_startup(QTestState *s, tx_func *tx);
32void tpm_util_pcrextend(QTestState *s, tx_func *tx);
33void tpm_util_pcrread(QTestState *s, tx_func *tx,
34 const unsigned char *exp_resp, size_t exp_resp_size);
35
e2f246a5
MAL
36bool tpm_util_swtpm_has_tpm2(void);
37
b21373d0
SB
38gboolean tpm_util_swtpm_start(const char *path, GPid *pid,
39 SocketAddress **addr, GError **error);
40void tpm_util_swtpm_kill(GPid pid);
41
b1e4b7c6
SB
42void tpm_util_migrate(QTestState *who, const char *uri);
43
44void tpm_util_migration_start_qemu(QTestState **src_qemu,
45 QTestState **dst_qemu,
46 SocketAddress *src_tpm_addr,
47 SocketAddress *dst_tpm_addr,
ea71a336 48 const char *miguri,
551cabdf
EA
49 const char *ifmodel,
50 const char *machine_options);
b1e4b7c6
SB
51
52void tpm_util_wait_for_migration_complete(QTestState *who);
daa8bb57 53void tpm_util_rmdir(const char *path);
b1e4b7c6 54
b21373d0 55#endif /* TESTS_TPM_UTIL_H */