[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 19/19] vfio-user: add migration cli options and version negot
From: |
Elena Ufimtseva |
Subject: |
[PATCH RFC 19/19] vfio-user: add migration cli options and version negotiation |
Date: |
Sun, 18 Jul 2021 23:27:58 -0700 |
From: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
---
hw/vfio/user.h | 4 ++++
hw/vfio/pci.c | 5 +++++
hw/vfio/user.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+)
diff --git a/hw/vfio/user.h b/hw/vfio/user.h
index eeb328c0a9..5542aa1932 100644
--- a/hw/vfio/user.h
+++ b/hw/vfio/user.h
@@ -70,6 +70,10 @@ struct vfio_user_version {
/* "capabilities" members */
#define VFIO_USER_CAP_MAX_FDS "max_msg_fds"
#define VFIO_USER_CAP_MAX_XFER "max_data_xfer_size"
+#define VFIO_USER_CAP_MIGR "migration"
+
+/* "migration" member */
+#define VFIO_USER_CAP_PGSIZE "pgsize"
#define VFIO_USER_DEF_MAX_FDS 8
#define VFIO_USER_MAX_MAX_FDS 16
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 36f8524e7c..2f97160147 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3688,6 +3688,11 @@ static void vfio_user_pci_reset(DeviceState *dev)
static Property vfio_user_pci_dev_properties[] = {
DEFINE_PROP_STRING("socket", VFIOUserPCIDevice, sock_name),
DEFINE_PROP_BOOL("secure-dma", VFIOUserPCIDevice, secure, false),
+ DEFINE_PROP_BOOL("x-enable-migration", VFIOPCIDevice,
+ vbasedev.enable_migration, false),
+ DEFINE_PROP_ON_OFF_AUTO("x-pre-copy-dirty-page-tracking", VFIOPCIDevice,
+ vbasedev.pre_copy_dirty_page_tracking,
+ ON_OFF_AUTO_ON),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/vfio/user.c b/hw/vfio/user.c
index eceaeeccea..23ace82bbb 100644
--- a/hw/vfio/user.c
+++ b/hw/vfio/user.c
@@ -393,6 +393,23 @@ static int caps_parse(QDict *qdict, struct cap_entry
caps[], Error **errp)
return 0;
}
+static int check_pgsize(QObject *qobj, Error **errp)
+{
+ QNum *qn = qobject_to(QNum, qobj);
+ uint64_t pgsize;
+
+ if (qn == NULL || !qnum_get_try_uint(qn, &pgsize)) {
+ error_setg(errp, "malformed %s", VFIO_USER_CAP_PGSIZE);
+ return -1;
+ }
+ return pgsize == 4096 ? 0 : -1;
+}
+
+static struct cap_entry caps_migr[] = {
+ { VFIO_USER_CAP_PGSIZE, check_pgsize },
+ { NULL }
+};
+
static int check_max_fds(QObject *qobj, Error **errp)
{
QNum *qn = qobject_to(QNum, qobj);
@@ -417,9 +434,21 @@ static int check_max_xfer(QObject *qobj, Error **errp)
return 0;
}
+static int check_migr(QObject *qobj, Error **errp)
+{
+ QDict *qdict = qobject_to(QDict, qobj);
+
+ if (qdict == NULL || caps_parse(qdict, caps_migr, errp)) {
+ error_setg(errp, "malformed %s", VFIO_USER_CAP_MAX_FDS);
+ return -1;
+ }
+ return 0;
+}
+
static struct cap_entry caps_cap[] = {
{ VFIO_USER_CAP_MAX_FDS, check_max_fds },
{ VFIO_USER_CAP_MAX_XFER, check_max_xfer },
+ { VFIO_USER_CAP_MIGR, check_migr },
{ NULL }
};
@@ -466,8 +495,12 @@ static GString *caps_json(void)
{
QDict *dict = qdict_new();
QDict *capdict = qdict_new();
+ QDict *migdict = qdict_new();
GString *str;
+ qdict_put_int(migdict, VFIO_USER_CAP_PGSIZE, 4096);
+ qdict_put_obj(capdict, VFIO_USER_CAP_MIGR, QOBJECT(migdict));
+
qdict_put_int(capdict, VFIO_USER_CAP_MAX_FDS, VFIO_USER_MAX_MAX_FDS);
qdict_put_int(capdict, VFIO_USER_CAP_MAX_XFER, VFIO_USER_DEF_MAX_XFER);
--
2.25.1
- [PATCH RFC 05/19] vfio-user: connect vfio proxy to remote server, (continued)
- [PATCH RFC 15/19] vfio-user: vfio user device realize, Elena Ufimtseva, 2021/07/19
- [PATCH RFC 13/19] vfio-user: respond to remote DMA read/write requests, Elena Ufimtseva, 2021/07/19
- [PATCH RFC 18/19] vfio-user: migration support, Elena Ufimtseva, 2021/07/19
- [PATCH RFC 17/19] vfio-user: probe remote device ROM BAR, Elena Ufimtseva, 2021/07/19
- [PATCH RFC 19/19] vfio-user: add migration cli options and version negotiation,
Elena Ufimtseva <=
- [PATCH RFC 16/19] vfio-user: pci reset, Elena Ufimtseva, 2021/07/19
- [PATCH RFC server 00/11] vfio-user server in QEMU, Jagannathan Raman, 2021/07/19
- [PATCH RFC server 07/11] vfio-user: handle DMA mappings, Jagannathan Raman, 2021/07/19
- [PATCH RFC server 08/11] vfio-user: handle PCI BAR accesses, Jagannathan Raman, 2021/07/19
- [PATCH RFC server 10/11] vfio-user: register handlers to facilitate migration, Jagannathan Raman, 2021/07/19
- [PATCH RFC server 09/11] vfio-user: handle device interrupts, Jagannathan Raman, 2021/07/19
- [PATCH RFC server 11/11] vfio-user: acceptance test, Jagannathan Raman, 2021/07/19