summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/0008-tpm-backend-Move-realloc_buffer-implementation-to-tp.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/0008-tpm-backend-Move-realloc_buffer-implementation-to-tp.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/0008-tpm-backend-Move-realloc_buffer-implementation-to-tp.patch140
1 files changed, 0 insertions, 140 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0008-tpm-backend-Move-realloc_buffer-implementation-to-tp.patch b/meta/recipes-devtools/qemu/qemu/0008-tpm-backend-Move-realloc_buffer-implementation-to-tp.patch
deleted file mode 100644
index 94cc6c542c..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0008-tpm-backend-Move-realloc_buffer-implementation-to-tp.patch
+++ /dev/null
@@ -1,140 +0,0 @@
1From 02189909fdc5e73b3ca54362084c16f0b67a3fdf Mon Sep 17 00:00:00 2001
2From: Amarnath Valluri <amarnath.valluri@intel.com>
3Date: Fri, 7 Apr 2017 10:57:28 +0300
4Subject: [PATCH 08/12] tpm-backend: Move realloc_buffer() implementation to
5 tpm-tis model
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10buffer reallocation is very unlikely to be backend specific. Hence move inside
11the tis.
12
13Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
14Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
15Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
16
17Upstream-Status: Backport [d0c519bdffa303d141727369e55b157c45b03147]
18---
19 backends/tpm.c | 9 ---------
20 hw/tpm/tpm_passthrough.c | 12 ------------
21 hw/tpm/tpm_tis.c | 14 ++++++++++++--
22 include/sysemu/tpm_backend.h | 12 ------------
23 4 files changed, 12 insertions(+), 35 deletions(-)
24
25diff --git a/backends/tpm.c b/backends/tpm.c
26index de313c9d5a..37c84b7c66 100644
27--- a/backends/tpm.c
28+++ b/backends/tpm.c
29@@ -80,15 +80,6 @@ bool tpm_backend_had_startup_error(TPMBackend *s)
30 return s->had_startup_error;
31 }
32
33-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb)
34-{
35- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
36-
37- assert(k->ops->realloc_buffer);
38-
39- return k->ops->realloc_buffer(sb);
40-}
41-
42 void tpm_backend_deliver_request(TPMBackend *s)
43 {
44 g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD,
45diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
46index 84fc49a4d3..22d3460550 100644
47--- a/hw/tpm/tpm_passthrough.c
48+++ b/hw/tpm/tpm_passthrough.c
49@@ -247,17 +247,6 @@ static int tpm_passthrough_reset_tpm_established_flag(TPMBackend *tb,
50 return 0;
51 }
52
53-static size_t tpm_passthrough_realloc_buffer(TPMSizedBuffer *sb)
54-{
55- size_t wanted_size = 4096; /* Linux tpm.c buffer size */
56-
57- if (sb->size != wanted_size) {
58- sb->buffer = g_realloc(sb->buffer, wanted_size);
59- sb->size = wanted_size;
60- }
61- return sb->size;
62-}
63-
64 static void tpm_passthrough_cancel_cmd(TPMBackend *tb)
65 {
66 TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
67@@ -435,7 +424,6 @@ static const TPMDriverOps tpm_passthrough_driver = {
68 .opts = tpm_passthrough_cmdline_opts,
69 .desc = "Passthrough TPM backend driver",
70 .create = tpm_passthrough_create,
71- .realloc_buffer = tpm_passthrough_realloc_buffer,
72 .reset = tpm_passthrough_reset,
73 .cancel_cmd = tpm_passthrough_cancel_cmd,
74 .get_tpm_established_flag = tpm_passthrough_get_tpm_established_flag,
75diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
76index a6440fef91..d5118e7f60 100644
77--- a/hw/tpm/tpm_tis.c
78+++ b/hw/tpm/tpm_tis.c
79@@ -963,6 +963,16 @@ static int tpm_tis_do_startup_tpm(TPMState *s)
80 return tpm_backend_startup_tpm(s->be_driver);
81 }
82
83+static void tpm_tis_realloc_buffer(TPMSizedBuffer *sb)
84+{
85+ size_t wanted_size = 4096; /* Linux tpm.c buffer size */
86+
87+ if (sb->size != wanted_size) {
88+ sb->buffer = g_realloc(sb->buffer, wanted_size);
89+ sb->size = wanted_size;
90+ }
91+}
92+
93 /*
94 * Get the TPMVersion of the backend device being used
95 */
96@@ -1010,9 +1020,9 @@ static void tpm_tis_reset(DeviceState *dev)
97 tis->loc[c].state = TPM_TIS_STATE_IDLE;
98
99 tis->loc[c].w_offset = 0;
100- tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].w_buffer);
101+ tpm_tis_realloc_buffer(&tis->loc[c].w_buffer);
102 tis->loc[c].r_offset = 0;
103- tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].r_buffer);
104+ tpm_tis_realloc_buffer(&tis->loc[c].r_buffer);
105 }
106
107 tpm_tis_do_startup_tpm(s);
108diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
109index e96c1918cc..2c798a1eb4 100644
110--- a/include/sysemu/tpm_backend.h
111+++ b/include/sysemu/tpm_backend.h
112@@ -84,8 +84,6 @@ struct TPMDriverOps {
113 /* start up the TPM on the backend */
114 int (*startup_tpm)(TPMBackend *t);
115
116- size_t (*realloc_buffer)(TPMSizedBuffer *sb);
117-
118 void (*reset)(TPMBackend *t);
119
120 void (*cancel_cmd)(TPMBackend *t);
121@@ -140,16 +138,6 @@ int tpm_backend_startup_tpm(TPMBackend *s);
122 bool tpm_backend_had_startup_error(TPMBackend *s);
123
124 /**
125- * tpm_backend_realloc_buffer:
126- * @s: the backend
127- * @sb: the TPMSizedBuffer to re-allocated to the size suitable for the
128- * backend.
129- *
130- * This function returns the size of the allocated buffer
131- */
132-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb);
133-
134-/**
135 * tpm_backend_deliver_request:
136 * @s: the backend to send the request to
137 *
138--
1392.11.0
140