summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJuro Bystricky <juro.bystricky@intel.com>2017-08-31 14:33:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-02 00:52:10 +0100
commit1e29d2fcf31cbc8d69f16218f5bb11fff37e76a6 (patch)
tree550d41458486e2a2e817de3aea4a4529c7ac646f /meta
parente855bc8476bb23daec771aaa7d154e61b6aa57e9 (diff)
downloadpoky-1e29d2fcf31cbc8d69f16218f5bb11fff37e76a6.tar.gz
qemu: upgrade to version 2.10.0
Remove recipes for older versions. Remove patches no longer needed. Modify the patch "add-ptest-in-makefile.patch" for version 2.10.0 (From OE-Core rev: 22593f3dd95dd332d2f89429c7de2cb5a09aa3e9) Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/qemu/qemu/0001-osdep-Add-runtime-OFD-lock-detection.patch141
-rw-r--r--meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch71
-rw-r--r--meta/recipes-devtools/qemu/qemu/0004-Add-support-for-VM-suspend-resume-for-TPM-TIS.patch719
-rw-r--r--meta/recipes-devtools/qemu/qemu/add-ptest-in-makefile-v10.patch (renamed from meta/recipes-devtools/qemu/qemu/add-ptest-in-makefile.patch)24
-rw-r--r--meta/recipes-devtools/qemu/qemu_2.10.0.bb (renamed from meta/recipes-devtools/qemu/qemu_2.10.0-rc2.bb)9
-rw-r--r--meta/recipes-devtools/qemu/qemu_2.8.1.1.bb60
6 files changed, 16 insertions, 1008 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0001-osdep-Add-runtime-OFD-lock-detection.patch b/meta/recipes-devtools/qemu/qemu/0001-osdep-Add-runtime-OFD-lock-detection.patch
deleted file mode 100644
index f83f0d2055..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0001-osdep-Add-runtime-OFD-lock-detection.patch
+++ /dev/null
@@ -1,141 +0,0 @@
1From ca749954b09b89e22cd69c4949fb7e689b057963 Mon Sep 17 00:00:00 2001
2From: Fam Zheng <famz@redhat.com>
3Date: Fri, 11 Aug 2017 19:44:46 +0800
4Subject: [PATCH 1/2] osdep: Add runtime OFD lock detection
5
6Build time check of OFD lock is not sufficient and can cause image open
7errors when the runtime environment doesn't support it.
8
9Add a helper function to probe it at runtime, additionally. Also provide
10a qemu_has_ofd_lock() for callers to check the status.
11
12Signed-off-by: Fam Zheng <famz@redhat.com>
13Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14
15Upstream-Status: Backport
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
17---
18 include/qemu/osdep.h | 1 +
19 util/osdep.c | 66 ++++++++++++++++++++++++++++++++++++++++++++--------
20 2 files changed, 57 insertions(+), 10 deletions(-)
21
22diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
23index 3b74f6fcb2..6855b94bbf 100644
24--- a/include/qemu/osdep.h
25+++ b/include/qemu/osdep.h
26@@ -357,6 +357,7 @@ int qemu_dup(int fd);
27 int qemu_lock_fd(int fd, int64_t start, int64_t len, bool exclusive);
28 int qemu_unlock_fd(int fd, int64_t start, int64_t len);
29 int qemu_lock_fd_test(int fd, int64_t start, int64_t len, bool exclusive);
30+bool qemu_has_ofd_lock(void);
31
32 #if defined(__HAIKU__) && defined(__i386__)
33 #define FMT_pid "%ld"
34diff --git a/util/osdep.c b/util/osdep.c
35index a2863c8e53..a479fedc4a 100644
36--- a/util/osdep.c
37+++ b/util/osdep.c
38@@ -38,14 +38,6 @@ extern int madvise(caddr_t, size_t, int);
39 #include "qemu/error-report.h"
40 #include "monitor/monitor.h"
41
42-#ifdef F_OFD_SETLK
43-#define QEMU_SETLK F_OFD_SETLK
44-#define QEMU_GETLK F_OFD_GETLK
45-#else
46-#define QEMU_SETLK F_SETLK
47-#define QEMU_GETLK F_GETLK
48-#endif
49-
50 static bool fips_enabled = false;
51
52 static const char *hw_version = QEMU_HW_VERSION;
53@@ -82,6 +74,10 @@ int qemu_madvise(void *addr, size_t len, int advice)
54 }
55
56 #ifndef _WIN32
57+
58+static int fcntl_op_setlk = -1;
59+static int fcntl_op_getlk = -1;
60+
61 /*
62 * Dups an fd and sets the flags
63 */
64@@ -149,6 +145,54 @@ static int qemu_parse_fdset(const char *param)
65 return qemu_parse_fd(param);
66 }
67
68+static void qemu_probe_lock_ops(void)
69+{
70+ if (fcntl_op_setlk == -1) {
71+#ifdef F_OFD_SETLK
72+ int fd;
73+ int ret;
74+ struct flock fl = {
75+ .l_whence = SEEK_SET,
76+ .l_start = 0,
77+ .l_len = 0,
78+ .l_type = F_WRLCK,
79+ };
80+
81+ fd = open("/dev/null", O_RDWR);
82+ if (fd < 0) {
83+ fprintf(stderr,
84+ "Failed to open /dev/null for OFD lock probing: %s\n",
85+ strerror(errno));
86+ fcntl_op_setlk = F_SETLK;
87+ fcntl_op_getlk = F_GETLK;
88+ return;
89+ }
90+ ret = fcntl(fd, F_OFD_GETLK, &fl);
91+ close(fd);
92+ if (!ret) {
93+ fcntl_op_setlk = F_OFD_SETLK;
94+ fcntl_op_getlk = F_OFD_GETLK;
95+ } else {
96+ fcntl_op_setlk = F_SETLK;
97+ fcntl_op_getlk = F_GETLK;
98+ }
99+#else
100+ fcntl_op_setlk = F_SETLK;
101+ fcntl_op_getlk = F_GETLK;
102+#endif
103+ }
104+}
105+
106+bool qemu_has_ofd_lock(void)
107+{
108+ qemu_probe_lock_ops();
109+#ifdef F_OFD_SETLK
110+ return fcntl_op_setlk == F_OFD_SETLK;
111+#else
112+ return false;
113+#endif
114+}
115+
116 static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type)
117 {
118 int ret;
119@@ -158,7 +202,8 @@ static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type)
120 .l_len = len,
121 .l_type = fl_type,
122 };
123- ret = fcntl(fd, QEMU_SETLK, &fl);
124+ qemu_probe_lock_ops();
125+ ret = fcntl(fd, fcntl_op_setlk, &fl);
126 return ret == -1 ? -errno : 0;
127 }
128
129@@ -181,7 +226,8 @@ int qemu_lock_fd_test(int fd, int64_t start, int64_t len, bool exclusive)
130 .l_len = len,
131 .l_type = exclusive ? F_WRLCK : F_RDLCK,
132 };
133- ret = fcntl(fd, QEMU_GETLK, &fl);
134+ qemu_probe_lock_ops();
135+ ret = fcntl(fd, fcntl_op_getlk, &fl);
136 if (ret == -1) {
137 return -errno;
138 } else {
139--
1402.11.0
141
diff --git a/meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch b/meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch
deleted file mode 100644
index 0dacde46d1..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch
+++ /dev/null
@@ -1,71 +0,0 @@
1From 2b218f5dbcca5fe728b1852d161d7a21fd02b2f5 Mon Sep 17 00:00:00 2001
2From: Fam Zheng <famz@redhat.com>
3Date: Fri, 11 Aug 2017 19:44:47 +0800
4Subject: [PATCH 2/2] file-posix: Do runtime check for ofd lock API
5
6It is reported that on Windows Subsystem for Linux, ofd operations fail
7with -EINVAL. In other words, QEMU binary built with system headers that
8exports F_OFD_SETLK doesn't necessarily run in an environment that
9actually supports it:
10
11$ qemu-system-aarch64 ... -drive file=test.vhdx,if=none,id=hd0 \
12 -device virtio-blk-pci,drive=hd0
13qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
14qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
15qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to lock byte 100
16
17As a matter of fact this is not WSL specific. It can happen when running
18a QEMU compiled against a newer glibc on an older kernel, such as in
19a containerized environment.
20
21Let's do a runtime check to cope with that.
22
23Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
24Reviewed-by: Eric Blake <eblake@redhat.com>
25Signed-off-by: Fam Zheng <famz@redhat.com>
26Signed-off-by: Kevin Wolf <kwolf@redhat.com>
27
28Upstream-Status: Backport
29Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
30---
31 block/file-posix.c | 19 ++++++++-----------
32 1 file changed, 8 insertions(+), 11 deletions(-)
33
34diff --git a/block/file-posix.c b/block/file-posix.c
35index f4de022ae0..cb3bfce147 100644
36--- a/block/file-posix.c
37+++ b/block/file-posix.c
38@@ -457,22 +457,19 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
39 switch (locking) {
40 case ON_OFF_AUTO_ON:
41 s->use_lock = true;
42-#ifndef F_OFD_SETLK
43- fprintf(stderr,
44- "File lock requested but OFD locking syscall is unavailable, "
45- "falling back to POSIX file locks.\n"
46- "Due to the implementation, locks can be lost unexpectedly.\n");
47-#endif
48+ if (!qemu_has_ofd_lock()) {
49+ fprintf(stderr,
50+ "File lock requested but OFD locking syscall is "
51+ "unavailable, falling back to POSIX file locks.\n"
52+ "Due to the implementation, locks can be lost "
53+ "unexpectedly.\n");
54+ }
55 break;
56 case ON_OFF_AUTO_OFF:
57 s->use_lock = false;
58 break;
59 case ON_OFF_AUTO_AUTO:
60-#ifdef F_OFD_SETLK
61- s->use_lock = true;
62-#else
63- s->use_lock = false;
64-#endif
65+ s->use_lock = qemu_has_ofd_lock();
66 break;
67 default:
68 abort();
69--
702.11.0
71
diff --git a/meta/recipes-devtools/qemu/qemu/0004-Add-support-for-VM-suspend-resume-for-TPM-TIS.patch b/meta/recipes-devtools/qemu/qemu/0004-Add-support-for-VM-suspend-resume-for-TPM-TIS.patch
deleted file mode 100644
index b8a783d4e9..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0004-Add-support-for-VM-suspend-resume-for-TPM-TIS.patch
+++ /dev/null
@@ -1,719 +0,0 @@
1From 5e9dd9063f514447ea4f54046793f4f01c297ed4 Mon Sep 17 00:00:00 2001
2From: Stefan Berger <stefanb@linux.vnet.ibm.com>
3Date: Sat, 31 Dec 2016 11:23:32 -0500
4Subject: [PATCH 4/4] Add support for VM suspend/resume for TPM TIS
5
6Extend the TPM TIS code to support suspend/resume. In case a command
7is being processed by the external TPM when suspending, wait for the command
8to complete to catch the result. In case the bottom half did not run,
9run the one function the bottom half is supposed to run. This then
10makes the resume operation work.
11
12The passthrough backend does not support suspend/resume operation
13and is therefore blocked from suspend/resume and migration.
14
15The CUSE TPM's supported capabilities are tested and if sufficient
16capabilities are implemented, suspend/resume, snapshotting and
17migration are supported by the CUSE TPM.
18
19Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
20
21Upstream-Status: Pending [https://lists.nongnu.org/archive/html/qemu-devel/2016-06/msg00252.html]
22Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
23---
24 hw/tpm/tpm_passthrough.c | 130 +++++++++++++++++++++++--
25 hw/tpm/tpm_tis.c | 137 +++++++++++++++++++++++++-
26 hw/tpm/tpm_tis.h | 2 +
27 hw/tpm/tpm_util.c | 223 +++++++++++++++++++++++++++++++++++++++++++
28 hw/tpm/tpm_util.h | 7 ++
29 include/sysemu/tpm_backend.h | 12 +++
30 6 files changed, 503 insertions(+), 8 deletions(-)
31
32diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
33index 44739ebad2..bc8072d0bc 100644
34--- a/hw/tpm/tpm_passthrough.c
35+++ b/hw/tpm/tpm_passthrough.c
36@@ -34,6 +34,8 @@
37 #include "tpm_tis.h"
38 #include "tpm_util.h"
39 #include "tpm_ioctl.h"
40+#include "migration/migration.h"
41+#include "qapi/error.h"
42
43 #define DEBUG_TPM 0
44
45@@ -49,6 +51,7 @@
46 #define TYPE_TPM_CUSE "tpm-cuse"
47
48 static const TPMDriverOps tpm_passthrough_driver;
49+static const VMStateDescription vmstate_tpm_cuse;
50
51 /* data structures */
52 typedef struct TPMPassthruThreadParams {
53@@ -79,6 +82,10 @@ struct TPMPassthruState {
54 QemuMutex state_lock;
55 QemuCond cmd_complete; /* singnaled once tpm_busy is false */
56 bool tpm_busy;
57+
58+ Error *migration_blocker;
59+
60+ TPMBlobBuffers tpm_blobs;
61 };
62
63 typedef struct TPMPassthruState TPMPassthruState;
64@@ -306,6 +313,10 @@ static void tpm_passthrough_shutdown(TPMPassthruState *tpm_pt)
65 strerror(errno));
66 }
67 }
68+ if (tpm_pt->migration_blocker) {
69+ migrate_del_blocker(tpm_pt->migration_blocker);
70+ error_free(tpm_pt->migration_blocker);
71+ }
72 }
73
74 /*
75@@ -360,12 +371,14 @@ static int tpm_passthrough_cuse_check_caps(TPMPassthruState *tpm_pt)
76 /*
77 * Initialize the external CUSE TPM
78 */
79-static int tpm_passthrough_cuse_init(TPMPassthruState *tpm_pt)
80+static int tpm_passthrough_cuse_init(TPMPassthruState *tpm_pt,
81+ bool is_resume)
82 {
83 int rc = 0;
84- ptm_init init = {
85- .u.req.init_flags = PTM_INIT_FLAG_DELETE_VOLATILE,
86- };
87+ ptm_init init;
88+ if (is_resume) {
89+ init.u.req.init_flags = PTM_INIT_FLAG_DELETE_VOLATILE;
90+ }
91
92 if (TPM_PASSTHROUGH_USES_CUSE_TPM(tpm_pt)) {
93 if (ioctl(tpm_pt->tpm_fd, PTM_INIT, &init) < 0) {
94@@ -394,7 +407,7 @@ static int tpm_passthrough_startup_tpm(TPMBackend *tb)
95 tpm_passthrough_worker_thread,
96 &tpm_pt->tpm_thread_params);
97
98- tpm_passthrough_cuse_init(tpm_pt);
99+ tpm_passthrough_cuse_init(tpm_pt, false);
100
101 return 0;
102 }
103@@ -466,6 +479,32 @@ static int tpm_passthrough_reset_tpm_established_flag(TPMBackend *tb,
104 return rc;
105 }
106
107+static int tpm_cuse_get_state_blobs(TPMBackend *tb,
108+ bool decrypted_blobs,
109+ TPMBlobBuffers *tpm_blobs)
110+{
111+ TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
112+
113+ assert(TPM_PASSTHROUGH_USES_CUSE_TPM(tpm_pt));
114+
115+ return tpm_util_cuse_get_state_blobs(tpm_pt->tpm_fd, decrypted_blobs,
116+ tpm_blobs);
117+}
118+
119+static int tpm_cuse_set_state_blobs(TPMBackend *tb,
120+ TPMBlobBuffers *tpm_blobs)
121+{
122+ TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
123+
124+ assert(TPM_PASSTHROUGH_USES_CUSE_TPM(tpm_pt));
125+
126+ if (tpm_util_cuse_set_state_blobs(tpm_pt->tpm_fd, tpm_blobs)) {
127+ return 1;
128+ }
129+
130+ return tpm_passthrough_cuse_init(tpm_pt, true);
131+}
132+
133 static bool tpm_passthrough_get_startup_error(TPMBackend *tb)
134 {
135 TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
136@@ -488,7 +527,7 @@ static void tpm_passthrough_deliver_request(TPMBackend *tb)
137 {
138 TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
139
140- /* TPM considered busy once TPM Request scheduled for processing */
141+ /* TPM considered busy once TPM request scheduled for processing */
142 qemu_mutex_lock(&tpm_pt->state_lock);
143 tpm_pt->tpm_busy = true;
144 qemu_mutex_unlock(&tpm_pt->state_lock);
145@@ -601,6 +640,25 @@ static int tpm_passthrough_open_sysfs_cancel(TPMBackend *tb)
146 return fd;
147 }
148
149+static void tpm_passthrough_block_migration(TPMPassthruState *tpm_pt)
150+{
151+ ptm_cap caps;
152+
153+ if (TPM_PASSTHROUGH_USES_CUSE_TPM(tpm_pt)) {
154+ caps = PTM_CAP_GET_STATEBLOB | PTM_CAP_SET_STATEBLOB |
155+ PTM_CAP_STOP;
156+ if (!TPM_CUSE_IMPLEMENTS_ALL(tpm_pt, caps)) {
157+ error_setg(&tpm_pt->migration_blocker,
158+ "Migration disabled: CUSE TPM lacks necessary capabilities");
159+ migrate_add_blocker(tpm_pt->migration_blocker);
160+ }
161+ } else {
162+ error_setg(&tpm_pt->migration_blocker,
163+ "Migration disabled: Passthrough TPM does not support migration");
164+ migrate_add_blocker(tpm_pt->migration_blocker);
165+ }
166+}
167+
168 static int tpm_passthrough_handle_device_opts(QemuOpts *opts, TPMBackend *tb)
169 {
170 TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
171@@ -642,7 +700,7 @@ static int tpm_passthrough_handle_device_opts(QemuOpts *opts, TPMBackend *tb)
172 goto err_close_tpmdev;
173 }
174 /* init TPM for probing */
175- if (tpm_passthrough_cuse_init(tpm_pt)) {
176+ if (tpm_passthrough_cuse_init(tpm_pt, false)) {
177 goto err_close_tpmdev;
178 }
179 }
180@@ -659,6 +717,7 @@ static int tpm_passthrough_handle_device_opts(QemuOpts *opts, TPMBackend *tb)
181 }
182 }
183
184+ tpm_passthrough_block_migration(tpm_pt);
185
186 return 0;
187
188@@ -766,10 +825,13 @@ static void tpm_passthrough_inst_init(Object *obj)
189
190 qemu_mutex_init(&tpm_pt->state_lock);
191 qemu_cond_init(&tpm_pt->cmd_complete);
192+
193+ vmstate_register(NULL, -1, &vmstate_tpm_cuse, obj);
194 }
195
196 static void tpm_passthrough_inst_finalize(Object *obj)
197 {
198+ vmstate_unregister(NULL, &vmstate_tpm_cuse, obj);
199 }
200
201 static void tpm_passthrough_class_init(ObjectClass *klass, void *data)
202@@ -802,6 +864,60 @@ static const char *tpm_passthrough_cuse_create_desc(void)
203 return "CUSE TPM backend driver";
204 }
205
206+static void tpm_cuse_pre_save(void *opaque)
207+{
208+ TPMPassthruState *tpm_pt = opaque;
209+ TPMBackend *tb = &tpm_pt->parent;
210+
211+ qemu_mutex_lock(&tpm_pt->state_lock);
212+ /* wait for TPM to finish processing */
213+ if (tpm_pt->tpm_busy) {
214+ qemu_cond_wait(&tpm_pt->cmd_complete, &tpm_pt->state_lock);
215+ }
216+ qemu_mutex_unlock(&tpm_pt->state_lock);
217+
218+ /* get the decrypted state blobs from the TPM */
219+ tpm_cuse_get_state_blobs(tb, TRUE, &tpm_pt->tpm_blobs);
220+}
221+
222+static int tpm_cuse_post_load(void *opaque,
223+ int version_id __attribute__((unused)))
224+{
225+ TPMPassthruState *tpm_pt = opaque;
226+ TPMBackend *tb = &tpm_pt->parent;
227+
228+ return tpm_cuse_set_state_blobs(tb, &tpm_pt->tpm_blobs);
229+}
230+
231+static const VMStateDescription vmstate_tpm_cuse = {
232+ .name = "cuse-tpm",
233+ .version_id = 1,
234+ .minimum_version_id = 0,
235+ .minimum_version_id_old = 0,
236+ .pre_save = tpm_cuse_pre_save,
237+ .post_load = tpm_cuse_post_load,
238+ .fields = (VMStateField[]) {
239+ VMSTATE_UINT32(tpm_blobs.permanent_flags, TPMPassthruState),
240+ VMSTATE_UINT32(tpm_blobs.permanent.size, TPMPassthruState),
241+ VMSTATE_VBUFFER_ALLOC_UINT32(tpm_blobs.permanent.buffer,
242+ TPMPassthruState, 1, NULL, 0,
243+ tpm_blobs.permanent.size),
244+
245+ VMSTATE_UINT32(tpm_blobs.volatil_flags, TPMPassthruState),
246+ VMSTATE_UINT32(tpm_blobs.volatil.size, TPMPassthruState),
247+ VMSTATE_VBUFFER_ALLOC_UINT32(tpm_blobs.volatil.buffer,
248+ TPMPassthruState, 1, NULL, 0,
249+ tpm_blobs.volatil.size),
250+
251+ VMSTATE_UINT32(tpm_blobs.savestate_flags, TPMPassthruState),
252+ VMSTATE_UINT32(tpm_blobs.savestate.size, TPMPassthruState),
253+ VMSTATE_VBUFFER_ALLOC_UINT32(tpm_blobs.savestate.buffer,
254+ TPMPassthruState, 1, NULL, 0,
255+ tpm_blobs.savestate.size),
256+ VMSTATE_END_OF_LIST()
257+ }
258+};
259+
260 static const TPMDriverOps tpm_cuse_driver = {
261 .type = TPM_TYPE_CUSE_TPM,
262 .opts = tpm_passthrough_cmdline_opts,
263diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
264index 14d9e83ea2..9b660cf737 100644
265--- a/hw/tpm/tpm_tis.c
266+++ b/hw/tpm/tpm_tis.c
267@@ -368,6 +368,8 @@ static void tpm_tis_receive_bh(void *opaque)
268 TPMTISEmuState *tis = &s->s.tis;
269 uint8_t locty = s->locty_number;
270
271+ tis->bh_scheduled = false;
272+
273 qemu_mutex_lock(&s->state_lock);
274
275 tpm_tis_sts_set(&tis->loc[locty],
276@@ -415,6 +417,8 @@ static void tpm_tis_receive_cb(TPMState *s, uint8_t locty,
277 qemu_mutex_unlock(&s->state_lock);
278
279 qemu_bh_schedule(tis->bh);
280+
281+ tis->bh_scheduled = true;
282 }
283
284 /*
285@@ -1030,9 +1034,140 @@ static void tpm_tis_reset(DeviceState *dev)
286 tpm_tis_do_startup_tpm(s);
287 }
288
289+
290+/* persistent state handling */
291+
292+static void tpm_tis_pre_save(void *opaque)
293+{
294+ TPMState *s = opaque;
295+ TPMTISEmuState *tis = &s->s.tis;
296+ uint8_t locty = tis->active_locty;
297+
298+ DPRINTF("tpm_tis: suspend: locty = %d : r_offset = %d, w_offset = %d\n",
299+ locty, tis->loc[0].r_offset, tis->loc[0].w_offset);
300+#ifdef DEBUG_TIS
301+ tpm_tis_dump_state(opaque, 0);
302+#endif
303+
304+ qemu_mutex_lock(&s->state_lock);
305+
306+ /* wait for outstanding request to complete */
307+ if (TPM_TIS_IS_VALID_LOCTY(locty) &&
308+ tis->loc[locty].state == TPM_TIS_STATE_EXECUTION) {
309+ /*
310+ * If we get here when the bh is scheduled but did not run,
311+ * we won't get notified...
312+ */
313+ if (!tis->bh_scheduled) {
314+ /* backend thread to notify us */
315+ qemu_cond_wait(&s->cmd_complete, &s->state_lock);
316+ }
317+ if (tis->loc[locty].state == TPM_TIS_STATE_EXECUTION) {
318+ /* bottom half did not run - run its function */
319+ qemu_mutex_unlock(&s->state_lock);
320+ tpm_tis_receive_bh(opaque);
321+ qemu_mutex_lock(&s->state_lock);
322+ }
323+ }
324+
325+ qemu_mutex_unlock(&s->state_lock);
326+
327+ /* copy current active read or write buffer into the buffer
328+ written to disk */
329+ if (TPM_TIS_IS_VALID_LOCTY(locty)) {
330+ switch (tis->loc[locty].state) {
331+ case TPM_TIS_STATE_RECEPTION:
332+ memcpy(tis->buf,
333+ tis->loc[locty].w_buffer.buffer,
334+ MIN(sizeof(tis->buf),
335+ tis->loc[locty].w_buffer.size));
336+ tis->offset = tis->loc[locty].w_offset;
337+ break;
338+ case TPM_TIS_STATE_COMPLETION:
339+ memcpy(tis->buf,
340+ tis->loc[locty].r_buffer.buffer,
341+ MIN(sizeof(tis->buf),
342+ tis->loc[locty].r_buffer.size));
343+ tis->offset = tis->loc[locty].r_offset;
344+ break;
345+ default:
346+ /* leak nothing */
347+ memset(tis->buf, 0x0, sizeof(tis->buf));
348+ break;
349+ }
350+ }
351+}
352+
353+static int tpm_tis_post_load(void *opaque,
354+ int version_id __attribute__((unused)))
355+{
356+ TPMState *s = opaque;
357+ TPMTISEmuState *tis = &s->s.tis;
358+
359+ uint8_t locty = tis->active_locty;
360+
361+ if (TPM_TIS_IS_VALID_LOCTY(locty)) {
362+ switch (tis->loc[locty].state) {
363+ case TPM_TIS_STATE_RECEPTION:
364+ memcpy(tis->loc[locty].w_buffer.buffer,
365+ tis->buf,
366+ MIN(sizeof(tis->buf),
367+ tis->loc[locty].w_buffer.size));
368+ tis->loc[locty].w_offset = tis->offset;
369+ break;
370+ case TPM_TIS_STATE_COMPLETION:
371+ memcpy(tis->loc[locty].r_buffer.buffer,
372+ tis->buf,
373+ MIN(sizeof(tis->buf),
374+ tis->loc[locty].r_buffer.size));
375+ tis->loc[locty].r_offset = tis->offset;
376+ break;
377+ default:
378+ break;
379+ }
380+ }
381+
382+ DPRINTF("tpm_tis: resume : locty = %d : r_offset = %d, w_offset = %d\n",
383+ locty, tis->loc[0].r_offset, tis->loc[0].w_offset);
384+
385+ return 0;
386+}
387+
388+static const VMStateDescription vmstate_locty = {
389+ .name = "loc",
390+ .version_id = 1,
391+ .minimum_version_id = 0,
392+ .minimum_version_id_old = 0,
393+ .fields = (VMStateField[]) {
394+ VMSTATE_UINT32(state, TPMLocality),
395+ VMSTATE_UINT32(inte, TPMLocality),
396+ VMSTATE_UINT32(ints, TPMLocality),
397+ VMSTATE_UINT8(access, TPMLocality),
398+ VMSTATE_UINT32(sts, TPMLocality),
399+ VMSTATE_UINT32(iface_id, TPMLocality),
400+ VMSTATE_END_OF_LIST(),
401+ }
402+};
403+
404 static const VMStateDescription vmstate_tpm_tis = {
405 .name = "tpm",
406- .unmigratable = 1,
407+ .version_id = 1,
408+ .minimum_version_id = 0,
409+ .minimum_version_id_old = 0,
410+ .pre_save = tpm_tis_pre_save,
411+ .post_load = tpm_tis_post_load,
412+ .fields = (VMStateField[]) {
413+ VMSTATE_UINT32(s.tis.offset, TPMState),
414+ VMSTATE_BUFFER(s.tis.buf, TPMState),
415+ VMSTATE_UINT8(s.tis.active_locty, TPMState),
416+ VMSTATE_UINT8(s.tis.aborting_locty, TPMState),
417+ VMSTATE_UINT8(s.tis.next_locty, TPMState),
418+
419+ VMSTATE_STRUCT_ARRAY(s.tis.loc, TPMState, TPM_TIS_NUM_LOCALITIES, 1,
420+ vmstate_locty, TPMLocality),
421+
422+ VMSTATE_END_OF_LIST()
423+ }
424 };
425
426 static Property tpm_tis_properties[] = {
427diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
428index a1df41fa21..b7fc0ea1a9 100644
429--- a/hw/tpm/tpm_tis.h
430+++ b/hw/tpm/tpm_tis.h
431@@ -54,6 +54,8 @@ typedef struct TPMLocality {
432
433 typedef struct TPMTISEmuState {
434 QEMUBH *bh;
435+ bool bh_scheduled; /* bh scheduled but did not run yet */
436+
437 uint32_t offset;
438 uint8_t buf[TPM_TIS_BUFFER_MAX];
439
440diff --git a/hw/tpm/tpm_util.c b/hw/tpm/tpm_util.c
441index 7b35429725..b6ff74d946 100644
442--- a/hw/tpm/tpm_util.c
443+++ b/hw/tpm/tpm_util.c
444@@ -22,6 +22,17 @@
445 #include "qemu/osdep.h"
446 #include "tpm_util.h"
447 #include "tpm_int.h"
448+#include "tpm_ioctl.h"
449+#include "qemu/error-report.h"
450+
451+#define DEBUG_TPM 0
452+
453+#define DPRINTF(fmt, ...) do { \
454+ if (DEBUG_TPM) { \
455+ fprintf(stderr, fmt, ## __VA_ARGS__); \
456+ } \
457+} while (0)
458+
459
460 /*
461 * A basic test of a TPM device. We expect a well formatted response header
462@@ -125,3 +136,215 @@ int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_version)
463
464 return 1;
465 }
466+
467+static void tpm_sized_buffer_reset(TPMSizedBuffer *tsb)
468+{
469+ g_free(tsb->buffer);
470+ tsb->buffer = NULL;
471+ tsb->size = 0;
472+}
473+
474+/*
475+ * Transfer a TPM state blob from the TPM into a provided buffer.
476+ *
477+ * @fd: file descriptor to talk to the CUSE TPM
478+ * @type: the type of blob to transfer
479+ * @decrypted_blob: whether we request to receive decrypted blobs
480+ * @tsb: the TPMSizeBuffer to fill with the blob
481+ * @flags: the flags to return to the caller
482+ */
483+static int tpm_util_cuse_get_state_blob(int fd,
484+ uint8_t type,
485+ bool decrypted_blob,
486+ TPMSizedBuffer *tsb,
487+ uint32_t *flags)
488+{
489+ ptm_getstate pgs;
490+ uint16_t offset = 0;
491+ ptm_res res;
492+ ssize_t n;
493+ size_t to_read;
494+
495+ tpm_sized_buffer_reset(tsb);
496+
497+ pgs.u.req.state_flags = (decrypted_blob) ? PTM_STATE_FLAG_DECRYPTED : 0;
498+ pgs.u.req.type = type;
499+ pgs.u.req.offset = offset;
500+
501+ if (ioctl(fd, PTM_GET_STATEBLOB, &pgs) < 0) {
502+ error_report("CUSE TPM PTM_GET_STATEBLOB ioctl failed: %s",
503+ strerror(errno));
504+ goto err_exit;
505+ }
506+ res = pgs.u.resp.tpm_result;
507+ if (res != 0 && (res & 0x800) == 0) {
508+ error_report("Getting the stateblob (type %d) failed with a TPM "
509+ "error 0x%x", type, res);
510+ goto err_exit;
511+ }
512+
513+ *flags = pgs.u.resp.state_flags;
514+
515+ tsb->buffer = g_malloc(pgs.u.resp.totlength);
516+ memcpy(tsb->buffer, pgs.u.resp.data, pgs.u.resp.length);
517+ tsb->size = pgs.u.resp.length;
518+
519+ /* if there are bytes left to get use read() interface */
520+ while (tsb->size < pgs.u.resp.totlength) {
521+ to_read = pgs.u.resp.totlength - tsb->size;
522+ if (unlikely(to_read > SSIZE_MAX)) {
523+ to_read = SSIZE_MAX;
524+ }
525+
526+ n = read(fd, &tsb->buffer[tsb->size], to_read);
527+ if (n != to_read) {
528+ error_report("Could not read stateblob (type %d) : %s",
529+ type, strerror(errno));
530+ goto err_exit;
531+ }
532+ tsb->size += to_read;
533+ }
534+
535+ DPRINTF("tpm_util: got state blob type %d, %d bytes, flags 0x%08x, "
536+ "decrypted=%d\n", type, tsb->size, *flags, decrypted_blob);
537+
538+ return 0;
539+
540+err_exit:
541+ return 1;
542+}
543+
544+int tpm_util_cuse_get_state_blobs(int tpm_fd,
545+ bool decrypted_blobs,
546+ TPMBlobBuffers *tpm_blobs)
547+{
548+ if (tpm_util_cuse_get_state_blob(tpm_fd, PTM_BLOB_TYPE_PERMANENT,
549+ decrypted_blobs,
550+ &tpm_blobs->permanent,
551+ &tpm_blobs->permanent_flags) ||
552+ tpm_util_cuse_get_state_blob(tpm_fd, PTM_BLOB_TYPE_VOLATILE,
553+ decrypted_blobs,
554+ &tpm_blobs->volatil,
555+ &tpm_blobs->volatil_flags) ||
556+ tpm_util_cuse_get_state_blob(tpm_fd, PTM_BLOB_TYPE_SAVESTATE,
557+ decrypted_blobs,
558+ &tpm_blobs->savestate,
559+ &tpm_blobs->savestate_flags)) {
560+ goto err_exit;
561+ }
562+
563+ return 0;
564+
565+ err_exit:
566+ tpm_sized_buffer_reset(&tpm_blobs->volatil);
567+ tpm_sized_buffer_reset(&tpm_blobs->permanent);
568+ tpm_sized_buffer_reset(&tpm_blobs->savestate);
569+
570+ return 1;
571+}
572+
573+static int tpm_util_cuse_do_set_stateblob_ioctl(int fd,
574+ uint32_t flags,
575+ uint32_t type,
576+ uint32_t length)
577+{
578+ ptm_setstate pss;
579+
580+ pss.u.req.state_flags = flags;
581+ pss.u.req.type = type;
582+ pss.u.req.length = length;
583+
584+ if (ioctl(fd, PTM_SET_STATEBLOB, &pss) < 0) {
585+ error_report("CUSE TPM PTM_SET_STATEBLOB ioctl failed: %s",
586+ strerror(errno));
587+ return 1;
588+ }
589+
590+ if (pss.u.resp.tpm_result != 0) {
591+ error_report("Setting the stateblob (type %d) failed with a TPM "
592+ "error 0x%x", type, pss.u.resp.tpm_result);
593+ return 1;
594+ }
595+
596+ return 0;
597+}
598+
599+
600+/*
601+ * Transfer a TPM state blob to the CUSE TPM.
602+ *
603+ * @fd: file descriptor to talk to the CUSE TPM
604+ * @type: the type of TPM state blob to transfer
605+ * @tsb: TPMSizeBuffer containing the TPM state blob
606+ * @flags: Flags describing the (encryption) state of the TPM state blob
607+ */
608+static int tpm_util_cuse_set_state_blob(int fd,
609+ uint32_t type,
610+ TPMSizedBuffer *tsb,
611+ uint32_t flags)
612+{
613+ uint32_t offset = 0;
614+ ssize_t n;
615+ size_t to_write;
616+
617+ /* initiate the transfer to the CUSE TPM */
618+ if (tpm_util_cuse_do_set_stateblob_ioctl(fd, flags, type, 0)) {
619+ return 1;
620+ }
621+
622+ /* use the write() interface for transferring the state blob */
623+ while (offset < tsb->size) {
624+ to_write = tsb->size - offset;
625+ if (unlikely(to_write > SSIZE_MAX)) {
626+ to_write = SSIZE_MAX;
627+ }
628+
629+ n = write(fd, &tsb->buffer[offset], to_write);
630+ if (n != to_write) {
631+ error_report("Writing the stateblob (type %d) failed: %s",
632+ type, strerror(errno));
633+ goto err_exit;
634+ }
635+ offset += to_write;
636+ }
637+
638+ /* inidicate that the transfer is finished */
639+ if (tpm_util_cuse_do_set_stateblob_ioctl(fd, flags, type, 0)) {
640+ goto err_exit;
641+ }
642+
643+ DPRINTF("tpm_util: set the state blob type %d, %d bytes, flags 0x%08x\n",
644+ type, tsb->size, flags);
645+
646+ return 0;
647+
648+err_exit:
649+ return 1;
650+}
651+
652+int tpm_util_cuse_set_state_blobs(int tpm_fd,
653+ TPMBlobBuffers *tpm_blobs)
654+{
655+ ptm_res res;
656+
657+ if (ioctl(tpm_fd, PTM_STOP, &res) < 0) {
658+ error_report("tpm_passthrough: Could not stop "
659+ "the CUSE TPM: %s (%i)",
660+ strerror(errno), errno);
661+ return 1;
662+ }
663+
664+ if (tpm_util_cuse_set_state_blob(tpm_fd, PTM_BLOB_TYPE_PERMANENT,
665+ &tpm_blobs->permanent,
666+ tpm_blobs->permanent_flags) ||
667+ tpm_util_cuse_set_state_blob(tpm_fd, PTM_BLOB_TYPE_VOLATILE,
668+ &tpm_blobs->volatil,
669+ tpm_blobs->volatil_flags) ||
670+ tpm_util_cuse_set_state_blob(tpm_fd, PTM_BLOB_TYPE_SAVESTATE,
671+ &tpm_blobs->savestate,
672+ tpm_blobs->savestate_flags)) {
673+ return 1;
674+ }
675+
676+ return 0;
677+}
678diff --git a/hw/tpm/tpm_util.h b/hw/tpm/tpm_util.h
679index df76245e6e..c24071d812 100644
680--- a/hw/tpm/tpm_util.h
681+++ b/hw/tpm/tpm_util.h
682@@ -26,4 +26,11 @@
683
684 int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_version);
685
686+int tpm_util_cuse_get_state_blobs(int tpm_fd,
687+ bool decrypted_blobs,
688+ TPMBlobBuffers *tpm_blobs);
689+
690+int tpm_util_cuse_set_state_blobs(int tpm_fd,
691+ TPMBlobBuffers *tpm_blobs);
692+
693 #endif /* TPM_TPM_UTIL_H */
694diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
695index b58f52d39f..3403821b9d 100644
696--- a/include/sysemu/tpm_backend.h
697+++ b/include/sysemu/tpm_backend.h
698@@ -62,6 +62,18 @@ typedef struct TPMSizedBuffer {
699 uint8_t *buffer;
700 } TPMSizedBuffer;
701
702+/* blobs from the TPM; part of VM state when migrating */
703+typedef struct TPMBlobBuffers {
704+ uint32_t permanent_flags;
705+ TPMSizedBuffer permanent;
706+
707+ uint32_t volatil_flags;
708+ TPMSizedBuffer volatil;
709+
710+ uint32_t savestate_flags;
711+ TPMSizedBuffer savestate;
712+} TPMBlobBuffers;
713+
714 struct TPMDriverOps {
715 enum TpmType type;
716 const QemuOptDesc *opts;
717--
7182.11.0
719
diff --git a/meta/recipes-devtools/qemu/qemu/add-ptest-in-makefile.patch b/meta/recipes-devtools/qemu/qemu/add-ptest-in-makefile-v10.patch
index 2ce3478e4a..e9639820be 100644
--- a/meta/recipes-devtools/qemu/qemu/add-ptest-in-makefile.patch
+++ b/meta/recipes-devtools/qemu/qemu/add-ptest-in-makefile-v10.patch
@@ -1,21 +1,22 @@
1Upstream-Status: Pending 1From 4201a5791fc4798a45a9b9f881602d7bacb74ed1 Mon Sep 17 00:00:00 2001
2From: Juro Bystricky <juro.bystricky@intel.com>
3Date: Thu, 31 Aug 2017 11:06:56 -0700
4Subject: Add subpackage -ptest which runs all unit test cases for qemu.
2 5
3Add subpackage -ptest which runs all unit test cases for qemu. 6Upstream-Status: Pending
4 7
5Signed-off-by: Kai Kang <kai.kang@windriver.com> 8Signed-off-by: Kai Kang <kai.kang@windriver.com>
6--- 9
7 tests/Makefile.include | 8 ++++++++ 10Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
8 1 file changed, 8 insertions(+)
9 11
10diff --git a/tests/Makefile.include b/tests/Makefile.include 12diff --git a/tests/Makefile.include b/tests/Makefile.include
11index 14be491..0fce37a 100644 13index f08b741..3d1b3e9 100644
12--- a/tests/Makefile.include 14--- a/tests/Makefile.include
13+++ b/tests/Makefile.include 15+++ b/tests/Makefile.include
14@@ -776,3 +776,11 @@ all: $(QEMU_IOTESTS_HELPERS-y) 16@@ -924,4 +924,12 @@ all: $(QEMU_IOTESTS_HELPERS-y)
15
16 -include $(wildcard tests/*.d) 17 -include $(wildcard tests/*.d)
17 -include $(wildcard tests/libqos/*.d) 18 -include $(wildcard tests/libqos/*.d)
18+ 19
19+buildtest-TESTS: $(check-unit-y) 20+buildtest-TESTS: $(check-unit-y)
20+ 21+
21+runtest-TESTS: 22+runtest-TESTS:
@@ -23,6 +24,5 @@ index 14be491..0fce37a 100644
23+ nf=$$(echo $$f | sed 's/tests\//\.\//g'); \ 24+ nf=$$(echo $$f | sed 's/tests\//\.\//g'); \
24+ $$nf; \ 25+ $$nf; \
25+ done 26+ done
26-- 27+
272.9.0 28 endif
28
diff --git a/meta/recipes-devtools/qemu/qemu_2.10.0-rc2.bb b/meta/recipes-devtools/qemu/qemu_2.10.0.bb
index 204e36fd2e..835577a603 100644
--- a/meta/recipes-devtools/qemu/qemu_2.10.0-rc2.bb
+++ b/meta/recipes-devtools/qemu/qemu_2.10.0.bb
@@ -12,7 +12,7 @@ SRC_URI = "http://wiki.qemu-project.org/download/${BP}.tar.bz2 \
12 file://disable-grabs.patch \ 12 file://disable-grabs.patch \
13 file://exclude-some-arm-EABI-obsolete-syscalls.patch \ 13 file://exclude-some-arm-EABI-obsolete-syscalls.patch \
14 file://wacom.patch \ 14 file://wacom.patch \
15 file://add-ptest-in-makefile.patch \ 15 file://add-ptest-in-makefile-v10.patch \
16 file://run-ptest \ 16 file://run-ptest \
17 file://qemu-enlarge-env-entry-size.patch \ 17 file://qemu-enlarge-env-entry-size.patch \
18 file://no-valgrind.patch \ 18 file://no-valgrind.patch \
@@ -24,8 +24,6 @@ SRC_URI = "http://wiki.qemu-project.org/download/${BP}.tar.bz2 \
24 file://0003-Introduce-condition-in-TPM-backend-for-notification.patch \ 24 file://0003-Introduce-condition-in-TPM-backend-for-notification.patch \
25 file://0004-Add-support-for-VM-suspend-resume-for-TPM-TIS-v2.9.patch \ 25 file://0004-Add-support-for-VM-suspend-resume-for-TPM-TIS-v2.9.patch \
26 file://apic-fixup-fallthrough-to-PIC.patch \ 26 file://apic-fixup-fallthrough-to-PIC.patch \
27 file://0001-osdep-Add-runtime-OFD-lock-detection.patch \
28 file://0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch \
29 " 27 "
30UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+\..*)\.tar" 28UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+\..*)\.tar"
31 29
@@ -34,8 +32,9 @@ SRC_URI_append_class-native = " \
34 file://fix-libcap-header-issue-on-some-distro.patch \ 32 file://fix-libcap-header-issue-on-some-distro.patch \
35 file://cpus.c-qemu_cpu_kick_thread_debugging.patch \ 33 file://cpus.c-qemu_cpu_kick_thread_debugging.patch \
36 " 34 "
37SRC_URI[md5sum] = "634c498476e4b5643cf7a89e7416d0ae" 35
38SRC_URI[sha256sum] = "9f8aaa2839634a2226a49d0f305ef922a7b0bc850d343aaee41948fd6f45700a" 36SRC_URI[md5sum] = "ca73441de73a9b52c6c49c97190d2185"
37SRC_URI[sha256sum] = "7e9f39e1306e6dcc595494e91c1464d4b03f55ddd2053183e0e1b69f7f776d48"
39 38
40COMPATIBLE_HOST_mipsarchn32 = "null" 39COMPATIBLE_HOST_mipsarchn32 = "null"
41COMPATIBLE_HOST_mipsarchn64 = "null" 40COMPATIBLE_HOST_mipsarchn64 = "null"
diff --git a/meta/recipes-devtools/qemu/qemu_2.8.1.1.bb b/meta/recipes-devtools/qemu/qemu_2.8.1.1.bb
deleted file mode 100644
index a4ddb7f989..0000000000
--- a/meta/recipes-devtools/qemu/qemu_2.8.1.1.bb
+++ /dev/null
@@ -1,60 +0,0 @@
1require qemu.inc
2
3inherit ptest
4
5RDEPENDS_${PN}-ptest = "bash make"
6
7LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
8 file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
9
10SRC_URI = "http://wiki.qemu-project.org/download/${BP}.tar.bz2 \
11 file://powerpc_rom.bin \
12 file://disable-grabs.patch \
13 file://exclude-some-arm-EABI-obsolete-syscalls.patch \
14 file://wacom.patch \
15 file://add-ptest-in-makefile.patch \
16 file://run-ptest \
17 file://configure-fix-Darwin-target-detection.patch \
18 file://qemu-enlarge-env-entry-size.patch \
19 file://no-valgrind.patch \
20 file://pathlimit.patch \
21 file://qemu-2.5.0-cflags.patch \
22 file://glibc-2.25.patch \
23 file://0001-Provide-support-for-the-CUSE-TPM.patch \
24 file://0002-Introduce-condition-to-notify-waiters-of-completed-c.patch \
25 file://0003-Introduce-condition-in-TPM-backend-for-notification.patch \
26 file://0004-Add-support-for-VM-suspend-resume-for-TPM-TIS.patch \
27 file://CVE-2016-9908.patch \
28 file://CVE-2016-9912.patch \
29 file://0001-replace-struct-ucontext-with-ucontext_t-type.patch \
30 file://apic-fixup-fallthrough-to-PIC.patch \
31 "
32
33SRC_URI_append_class-native = " \
34 file://fix-libcap-header-issue-on-some-distro.patch \
35 file://cpus.c-qemu_cpu_kick_thread_debugging.patch \
36 "
37
38SRC_URI[md5sum] = "a6a23a0c59fd0f8ec564b0fb89a79954"
39SRC_URI[sha256sum] = "f62ab18a1fb9ff5b4c81ed44becc945b11581eff777618141bdb787da55d3638"
40
41COMPATIBLE_HOST_mipsarchn32 = "null"
42COMPATIBLE_HOST_mipsarchn64 = "null"
43
44do_install_append() {
45 # Prevent QA warnings about installed ${localstatedir}/run
46 if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
47 install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu
48}
49
50do_compile_ptest() {
51 make buildtest-TESTS
52}
53
54do_install_ptest() {
55 cp -rL ${B}/tests ${D}${PTEST_PATH}
56 find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {}
57
58 cp ${S}/tests/Makefile.include ${D}${PTEST_PATH}/tests
59}
60