[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V9 28/46] hostmem-epc: cpr support
From: |
Steve Sistare |
Subject: |
[PATCH V9 28/46] hostmem-epc: cpr support |
Date: |
Tue, 26 Jul 2022 09:10:25 -0700 |
Preserve memory-backend-epc memory objects during cpr.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
backends/hostmem-epc.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/backends/hostmem-epc.c b/backends/hostmem-epc.c
index 037292d..c6b1fe4 100644
--- a/backends/hostmem-epc.c
+++ b/backends/hostmem-epc.c
@@ -16,32 +16,34 @@
#include "qapi/error.h"
#include "sysemu/hostmem.h"
#include "hw/i386/hostmem-epc.h"
+#include "migration/cpr-state.h"
static void
sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{
uint32_t ram_flags;
- char *name;
- int fd;
+ g_autofree char *name = object_get_canonical_path(OBJECT(backend));
+ int fd = cpr_find_fd(name, 0);
if (!backend->size) {
error_setg(errp, "can't create backend with size 0");
return;
}
- fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
if (fd < 0) {
- error_setg_errno(errp, errno,
- "failed to open /dev/sgx_vepc to alloc SGX EPC");
- return;
+ fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
+ if (fd < 0) {
+ error_setg_errno(errp, errno,
+ "failed to open /dev/sgx_vepc to alloc SGX EPC");
+ return;
+ }
+ cpr_save_fd(name, 0, fd);
}
- name = object_get_canonical_path(OBJECT(backend));
ram_flags = (backend->share ? RAM_SHARED : 0) | RAM_PROTECTED;
memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend),
name, backend->size, ram_flags,
fd, 0, errp);
- g_free(name);
}
static void sgx_epc_backend_instance_init(Object *obj)
--
1.8.3.1
- [PATCH V9 04/46] migration: mode parameter, (continued)
- [PATCH V9 04/46] migration: mode parameter, Steve Sistare, 2022/07/26
- [PATCH V9 21/46] cpr: preserve extra state, Steve Sistare, 2022/07/26
- [PATCH V9 19/46] oslib: qemu_clear_cloexec, Steve Sistare, 2022/07/26
- [PATCH V9 30/46] vfio-pci: refactor for cpr, Steve Sistare, 2022/07/26
- [PATCH V9 27/46] hostmem-memfd: cpr support, Steve Sistare, 2022/07/26
- [PATCH V9 25/46] cpr: only-cpr-capable, Steve Sistare, 2022/07/26
- [PATCH V9 20/46] vl: helper to request re-exec, Steve Sistare, 2022/07/26
- [PATCH V9 05/46] migration: migrate-enable-mode option, Steve Sistare, 2022/07/26
- [PATCH V9 24/46] cpr: ram block blockers, Steve Sistare, 2022/07/26
- [PATCH V9 08/46] cpr: relax some blockers, Steve Sistare, 2022/07/26
- [PATCH V9 28/46] hostmem-epc: cpr support,
Steve Sistare <=
- [PATCH V9 33/46] vfio-pci: cpr part 3 (intx), Steve Sistare, 2022/07/26
- [PATCH V9 06/46] migration: simplify blockers, Steve Sistare, 2022/07/26
- [PATCH V9 10/46] qdev-properties: strList, Steve Sistare, 2022/07/26
- [PATCH V9 29/46] pci: export msix_is_pending, Steve Sistare, 2022/07/26
- [PATCH V9 11/46] qapi: strList_from_string, Steve Sistare, 2022/07/26
- [PATCH V9 07/46] migration: per-mode blockers, Steve Sistare, 2022/07/26
- [PATCH V9 35/46] vhost: reset vhost devices for cpr, Steve Sistare, 2022/07/26
- [PATCH V9 22/46] cpr: exec mode, Steve Sistare, 2022/07/26
- [PATCH V9 16/46] migration: simplify notifiers, Steve Sistare, 2022/07/26
- [PATCH V9 26/46] cpr: Mismatched GPAs fix, Steve Sistare, 2022/07/26