All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC v5 0/4] vITS save/restore
@ 2017-04-14 12:46 Eric Auger
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 1/4] linux-headers: Update for " Eric Auger
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Eric Auger @ 2017-04-14 12:46 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, qemu-arm, qemu-devel
  Cc: vijay.kilari, Vijaya.Kumar, drjones, christoffer.dall, quintela,
	dgilbert

This series allows ITS save/restore and migration use cases.
It relies on not upstreamed kernel series [1].

ITS tables are flushed into guest RAM on VM stop while registers
are save on pre_save() callback. Tables and registers are restored
on ITS post_load().

Redistributor pending tables also are flushed on VM stop, independently
on ITS tables.

That work was tested on Cavium ThunderX using virsh save/restore and
virt-manager live migration.

Best Regards

Eric

Host Kernel dependencies:
- [1] [PATCH v5 00/22] vITS save/restore

History:
v4 -> v5:
- adapt to the new user API
- new patch "hw/intc/arm_gicv3_kvm: Implement pending table save"
  as the pending table save now is handled on GICV3 side.

v3 -> v4:
- oversight in v3, missed a last minute correction related to
  reg useless declaration in kvm_arm_its_pre_save

v2 -> v3:
- GITS_IIDR is now saved and restored to check ABI revision.
- get/put functions renamed into pre_save/post_load
- unmigratable = false removed
- changed the migration blocker message
- remove the extract64 round s->ctlr
- reword some comments

v1 -> v2:
- rebase on 2.9 soft release code
- handle case where migrate_add_blocker fails
- add comments along with ITS and GICv3 migration priorities


Eric Auger (4):
  linux-headers: Update for vITS save/restore
  hw/intc/arm_gicv3_its: Implement state save/restore
  hw/intc/arm_gicv3_kvm: Implement pending table save
  hw/intc/arm_gicv3_its: Allow save/restore

 hw/intc/arm_gicv3_common.c             |   1 +
 hw/intc/arm_gicv3_its_common.c         |  11 ++-
 hw/intc/arm_gicv3_its_kvm.c            | 120 +++++++++++++++++++++++++++++----
 hw/intc/arm_gicv3_kvm.c                |  25 +++++++
 include/hw/intc/arm_gicv3_its_common.h |   8 +++
 include/migration/vmstate.h            |   2 +
 linux-headers/asm-arm/kvm.h            |   6 +-
 linux-headers/asm-arm64/kvm.h          |   6 +-
 8 files changed, 164 insertions(+), 15 deletions(-)

-- 
2.5.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [RFC v5 1/4] linux-headers: Update for vITS save/restore
  2017-04-14 12:46 [Qemu-devel] [RFC v5 0/4] vITS save/restore Eric Auger
@ 2017-04-14 12:46 ` Eric Auger
  2017-04-26 11:39   ` Prakash B
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore Eric Auger
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Eric Auger @ 2017-04-14 12:46 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, qemu-arm, qemu-devel
  Cc: vijay.kilari, Vijaya.Kumar, drjones, christoffer.dall, quintela,
	dgilbert

This is a linux header update against 4.11-rc6 plus the non
upstreamed ITS migration series.

https://github.com/eauger/linux/tree/v4.11-rc6-its-mig-v5

It aims at enhancing the KVM user API with vITS save/restore
capability. Those are new attributes supported in the
ITS and GICv3 KVM device KVM_DEV_ARM_VGIC_GRP_CTRL groups.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 linux-headers/asm-arm/kvm.h   | 6 +++++-
 linux-headers/asm-arm64/kvm.h | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h
index 1101d55..ca7b5bf 100644
--- a/linux-headers/asm-arm/kvm.h
+++ b/linux-headers/asm-arm/kvm.h
@@ -192,13 +192,17 @@ struct kvm_arch_memory_slot {
 #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5
 #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
 #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO  7
+#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS	8
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT	10
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \
 			(0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff
 #define VGIC_LEVEL_INFO_LINE_LEVEL	0
 
-#define   KVM_DEV_ARM_VGIC_CTRL_INIT    0
+#define   KVM_DEV_ARM_VGIC_CTRL_INIT		0
+#define   KVM_DEV_ARM_ITS_SAVE_TABLES		1
+#define   KVM_DEV_ARM_ITS_RESTORE_TABLES	2
+#define   KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES	3
 
 /* KVM_IRQ_LINE irq field index values */
 #define KVM_ARM_IRQ_TYPE_SHIFT		24
diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h
index 651ec30..d1a9046 100644
--- a/linux-headers/asm-arm64/kvm.h
+++ b/linux-headers/asm-arm64/kvm.h
@@ -212,13 +212,17 @@ struct kvm_arch_memory_slot {
 #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5
 #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
 #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO  7
+#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT	10
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \
 			(0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK	0x3ff
 #define VGIC_LEVEL_INFO_LINE_LEVEL	0
 
-#define   KVM_DEV_ARM_VGIC_CTRL_INIT	0
+#define   KVM_DEV_ARM_VGIC_CTRL_INIT		0
+#define   KVM_DEV_ARM_ITS_SAVE_TABLES           1
+#define   KVM_DEV_ARM_ITS_RESTORE_TABLES        2
+#define   KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES	3
 
 /* Device Control API on vcpu fd */
 #define KVM_ARM_VCPU_PMU_V3_CTRL	0
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore
  2017-04-14 12:46 [Qemu-devel] [RFC v5 0/4] vITS save/restore Eric Auger
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 1/4] linux-headers: Update for " Eric Auger
@ 2017-04-14 12:46 ` Eric Auger
  2017-04-26 11:40   ` Prakash B
  2017-06-09  1:28   ` Shannon Zhao
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 3/4] hw/intc/arm_gicv3_kvm: Implement pending table save Eric Auger
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 15+ messages in thread
From: Eric Auger @ 2017-04-14 12:46 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, qemu-arm, qemu-devel
  Cc: vijay.kilari, Vijaya.Kumar, drjones, christoffer.dall, quintela,
	dgilbert

We need to handle both registers and ITS tables. While
register handling is standard, ITS table handling is more
challenging since the kernel API is devised so that the
tables are flushed into guest RAM and not in vmstate buffers.

Flushing the ITS tables on device pre_save() is too late
since the guest RAM is already saved at this point.

Table flushing needs to happen when we are sure the vcpus
are stopped and before the last dirty page saving. The
right point is RUN_STATE_FINISH_MIGRATE but sometimes the
VM gets stopped before migration launch so let's simply
flush the tables each time the VM gets stopped.

For regular ITS registers we just can use vmstate pre_save()
and post_load() callbacks.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

---
v4 -> v5:
- Use the new user API, ie. attributes in
  KVM_DEV_ARM_VGIC_GRP_CTRL group

v3 -> v4:
- remove useless reg declaration in pre_save()

v2 -> v3:
- take into account Peter's comments:
  - add iidr save/restore
  - reword comments
  - remove s->ctlr = extract64(reg, 0, 32);
  - rename get()/put() function into pre_save()/post_load()
- do not execute put() if iidr == 0

Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 hw/intc/arm_gicv3_its_common.c         |  9 ++++
 hw/intc/arm_gicv3_its_kvm.c            | 96 ++++++++++++++++++++++++++++++++++
 include/hw/intc/arm_gicv3_its_common.h |  8 +++
 3 files changed, 113 insertions(+)

diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c
index 9d67c5c..efab8c7 100644
--- a/hw/intc/arm_gicv3_its_common.c
+++ b/hw/intc/arm_gicv3_its_common.c
@@ -49,6 +49,15 @@ static const VMStateDescription vmstate_its = {
     .pre_save = gicv3_its_pre_save,
     .post_load = gicv3_its_post_load,
     .unmigratable = true,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT32(ctlr, GICv3ITSState),
+        VMSTATE_UINT32(iidr, GICv3ITSState),
+        VMSTATE_UINT64(cbaser, GICv3ITSState),
+        VMSTATE_UINT64(cwriter, GICv3ITSState),
+        VMSTATE_UINT64(creadr, GICv3ITSState),
+        VMSTATE_UINT64_ARRAY(baser, GICv3ITSState, 8),
+        VMSTATE_END_OF_LIST()
+    },
 };
 
 static MemTxResult gicv3_its_trans_read(void *opaque, hwaddr offset,
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
index bd4f3aa..7c5502c 100644
--- a/hw/intc/arm_gicv3_its_kvm.c
+++ b/hw/intc/arm_gicv3_its_kvm.c
@@ -53,6 +53,25 @@ static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid)
     return kvm_vm_ioctl(kvm_state, KVM_SIGNAL_MSI, &msi);
 }
 
+/**
+ * vm_change_state_handler - VM change state callback aiming at flushing
+ * ITS tables into guest RAM
+ *
+ * The tables get flushed to guest RAM whenever the VM gets stopped.
+ */
+static void vm_change_state_handler(void *opaque, int running,
+                                    RunState state)
+{
+    GICv3ITSState *s = (GICv3ITSState *)opaque;
+
+    if (running) {
+        return;
+    }
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                      KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true);
+}
+
 static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
 {
     GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
@@ -89,6 +108,8 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
     kvm_msi_use_devid = true;
     kvm_gsi_direct_mapping = false;
     kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
+
+    qemu_add_vm_change_state_handler(vm_change_state_handler, s);
 }
 
 static void kvm_arm_its_init(Object *obj)
@@ -102,6 +123,79 @@ static void kvm_arm_its_init(Object *obj)
                              &error_abort);
 }
 
+/**
+ * kvm_arm_its_pre_save - handles the saving of ITS registers.
+ * ITS tables are flushed into guest RAM separately and earlier,
+ * through the VM change state handler, since at the moment pre_save()
+ * is called, the guest RAM has already been saved.
+ */
+static void kvm_arm_its_pre_save(GICv3ITSState *s)
+{
+    int i;
+
+    for (i = 0; i < 8; i++) {
+        kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                          GITS_BASER + i * 8, &s->baser[i], false);
+    }
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CTLR, &s->ctlr, false);
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CBASER, &s->cbaser, false);
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CREADR, &s->creadr, false);
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CWRITER, &s->cwriter, false);
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_IIDR, &s->iidr, false);
+}
+
+/**
+ * kvm_arm_its_post_load - Restore both the ITS registers and tables
+ */
+static void kvm_arm_its_post_load(GICv3ITSState *s)
+{
+    uint64_t reg;
+    int i;
+
+    if (!s->iidr) {
+        return;
+    }
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_IIDR, &s->iidr, true);
+
+    /*
+     * must be written before GITS_CREADR since GITS_CBASER write
+     * access resets GITS_CREADR.
+     */
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CBASER, &s->cbaser, true);
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CREADR, &s->creadr, true);
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CWRITER, &s->cwriter, true);
+
+
+    for (i = 0; i < 8; i++) {
+        kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                          GITS_BASER + i * 8, &s->baser[i], true);
+    }
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                      KVM_DEV_ARM_ITS_RESTORE_TABLES, NULL, true);
+
+    reg = s->ctlr;
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+                      GITS_CTLR, &reg, true);
+}
+
 static void kvm_arm_its_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -109,6 +203,8 @@ static void kvm_arm_its_class_init(ObjectClass *klass, void *data)
 
     dc->realize = kvm_arm_its_realize;
     icc->send_msi = kvm_its_send_msi;
+    icc->pre_save = kvm_arm_its_pre_save;
+    icc->post_load = kvm_arm_its_post_load;
 }
 
 static const TypeInfo kvm_arm_its_info = {
diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_gicv3_its_common.h
index 1ba1894..fd1fe64 100644
--- a/include/hw/intc/arm_gicv3_its_common.h
+++ b/include/hw/intc/arm_gicv3_its_common.h
@@ -28,6 +28,13 @@
 #define ITS_TRANS_SIZE   0x10000
 #define ITS_SIZE         (ITS_CONTROL_SIZE + ITS_TRANS_SIZE)
 
+#define GITS_CTLR        0x0
+#define GITS_IIDR        0x4
+#define GITS_CBASER      0x80
+#define GITS_CWRITER     0x88
+#define GITS_CREADR      0x90
+#define GITS_BASER       0x100
+
 struct GICv3ITSState {
     SysBusDevice parent_obj;
 
@@ -43,6 +50,7 @@ struct GICv3ITSState {
 
     /* Registers */
     uint32_t ctlr;
+    uint32_t iidr;
     uint64_t cbaser;
     uint64_t cwriter;
     uint64_t creadr;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [RFC v5 3/4] hw/intc/arm_gicv3_kvm: Implement pending table save
  2017-04-14 12:46 [Qemu-devel] [RFC v5 0/4] vITS save/restore Eric Auger
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 1/4] linux-headers: Update for " Eric Auger
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore Eric Auger
@ 2017-04-14 12:46 ` Eric Auger
  2017-04-26 11:40   ` Prakash B
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore Eric Auger
  2017-04-26 11:18 ` [Qemu-devel] [RFC v5 0/4] vITS save/restore Prakash B
  4 siblings, 1 reply; 15+ messages in thread
From: Eric Auger @ 2017-04-14 12:46 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, qemu-arm, qemu-devel
  Cc: vijay.kilari, Vijaya.Kumar, drjones, christoffer.dall, quintela,
	dgilbert

This patch adds the flush of the LPI pending bits into the
redistributor pending tables. This happens on VM stop.

There is no explicit restore as the tables are implicitly sync'ed
on ITS table restore and on LPI enable at redistributor level.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

---

v5: new
---
 hw/intc/arm_gicv3_kvm.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index 19aab56..9898c49 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -25,6 +25,7 @@
 #include "hw/sysbus.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
+#include "sysemu/sysemu.h"
 #include "kvm_arm.h"
 #include "gicv3_internal.h"
 #include "vgic_common.h"
@@ -680,6 +681,26 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = {
     REGINFO_SENTINEL
 };
 
+/**
+ * vm_change_state_handler - VM change state callback aiming at flushing
+ * RDIST pending tables into guest RAM
+ *
+ * The tables get flushed to guest RAM whenever the VM gets stopped.
+ */
+static void vm_change_state_handler(void *opaque, int running,
+                                    RunState state)
+{
+    GICv3State *s = (GICv3State *)opaque;
+
+    if (running) {
+        return;
+    }
+
+    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                      KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES, NULL, true);
+}
+
+
 static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
 {
     GICv3State *s = KVM_ARM_GICV3(dev);
@@ -751,6 +772,10 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
             return;
         }
     }
+    if (kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                              KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES)) {
+        qemu_add_vm_change_state_handler(vm_change_state_handler, s);
+    }
 }
 
 static void kvm_arm_gicv3_class_init(ObjectClass *klass, void *data)
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore
  2017-04-14 12:46 [Qemu-devel] [RFC v5 0/4] vITS save/restore Eric Auger
                   ` (2 preceding siblings ...)
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 3/4] hw/intc/arm_gicv3_kvm: Implement pending table save Eric Auger
@ 2017-04-14 12:46 ` Eric Auger
  2017-04-26 11:41   ` Prakash B
  2017-05-19 10:30   ` Shannon Zhao
  2017-04-26 11:18 ` [Qemu-devel] [RFC v5 0/4] vITS save/restore Prakash B
  4 siblings, 2 replies; 15+ messages in thread
From: Eric Auger @ 2017-04-14 12:46 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, qemu-arm, qemu-devel
  Cc: vijay.kilari, Vijaya.Kumar, drjones, christoffer.dall, quintela,
	dgilbert

We change the restoration priority of both the GICv3 and ITS. The
GICv3 must be restored before the ITS and the ITS needs to be restored
before PCIe devices since it translates their MSI transactions.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>

---
v2 -> v3:
- reword migration blocker message
- remove unmigratable setting to false

v1 -> v2:
- handle case where migrate_add_blocker fails
- add comments along with ITS and GICv3 migration priorities
---
 hw/intc/arm_gicv3_common.c     |  1 +
 hw/intc/arm_gicv3_its_common.c |  2 +-
 hw/intc/arm_gicv3_its_kvm.c    | 24 ++++++++++++------------
 include/migration/vmstate.h    |  2 ++
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
index c6493d6..4228b7c 100644
--- a/hw/intc/arm_gicv3_common.c
+++ b/hw/intc/arm_gicv3_common.c
@@ -145,6 +145,7 @@ static const VMStateDescription vmstate_gicv3 = {
     .minimum_version_id = 1,
     .pre_save = gicv3_pre_save,
     .post_load = gicv3_post_load,
+    .priority = MIG_PRI_GICV3,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(gicd_ctlr, GICv3State),
         VMSTATE_UINT32_ARRAY(gicd_statusr, GICv3State, 2),
diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c
index efab8c7..22ce4c4 100644
--- a/hw/intc/arm_gicv3_its_common.c
+++ b/hw/intc/arm_gicv3_its_common.c
@@ -48,7 +48,7 @@ static const VMStateDescription vmstate_its = {
     .name = "arm_gicv3_its",
     .pre_save = gicv3_its_pre_save,
     .post_load = gicv3_its_post_load,
-    .unmigratable = true,
+    .priority = MIG_PRI_GICV3_ITS,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(ctlr, GICv3ITSState),
         VMSTATE_UINT32(iidr, GICv3ITSState),
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
index 7c5502c..8401d2f 100644
--- a/hw/intc/arm_gicv3_its_kvm.c
+++ b/hw/intc/arm_gicv3_its_kvm.c
@@ -77,18 +77,6 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
     GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
     Error *local_err = NULL;
 
-    /*
-     * Block migration of a KVM GICv3 ITS device: the API for saving and
-     * restoring the state in the kernel is not yet available
-     */
-    error_setg(&s->migration_blocker, "vITS migration is not implemented");
-    migrate_add_blocker(s->migration_blocker, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        error_free(s->migration_blocker);
-        return;
-    }
-
     s->dev_fd = kvm_create_device(kvm_state, KVM_DEV_TYPE_ARM_VGIC_ITS, false);
     if (s->dev_fd < 0) {
         error_setg_errno(errp, -s->dev_fd, "error creating in-kernel ITS");
@@ -105,6 +93,18 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
 
     gicv3_its_init_mmio(s, NULL);
 
+    if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
+        GITS_CTLR)) {
+        error_setg(&s->migration_blocker, "This operating system kernel "
+                   "does not support vGICv3 migration");
+        migrate_add_blocker(s->migration_blocker, &local_err);
+        if (local_err) {
+            error_propagate(errp, local_err);
+            error_free(s->migration_blocker);
+            return;
+        }
+    }
+
     kvm_msi_use_devid = true;
     kvm_gsi_direct_mapping = false;
     kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index f2dbf84..8dab9c7 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -198,6 +198,8 @@ enum VMStateFlags {
 typedef enum {
     MIG_PRI_DEFAULT = 0,
     MIG_PRI_IOMMU,              /* Must happen before PCI devices */
+    MIG_PRI_GICV3_ITS,          /* Must happen before PCI devices */
+    MIG_PRI_GICV3,              /* Must happen before the ITS */
     MIG_PRI_MAX,
 } MigrationPriority;
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 0/4] vITS save/restore
  2017-04-14 12:46 [Qemu-devel] [RFC v5 0/4] vITS save/restore Eric Auger
                   ` (3 preceding siblings ...)
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore Eric Auger
@ 2017-04-26 11:18 ` Prakash B
  2017-04-27  6:58   ` Auger Eric
  4 siblings, 1 reply; 15+ messages in thread
From: Prakash B @ 2017-04-26 11:18 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, Peter Maydell, qemu-arm, qemu-devel, drjones,
	Vijay Kilari, quintela, dgilbert, Vijaya.Kumar, Christoffer Dall

Verified on Cavium ThunderX platform
Continousily migrated Guest more than 500 times b/w different  hosts.
Please feel free to add  Tested-by: Prakash, Brahmajyosyula
<Brahmajyosyula.Prakash@cavium.com>

On Fri, Apr 14, 2017 at 6:16 PM, Eric Auger <eric.auger@redhat.com> wrote:
> This series allows ITS save/restore and migration use cases.
> It relies on not upstreamed kernel series [1].
>
> ITS tables are flushed into guest RAM on VM stop while registers
> are save on pre_save() callback. Tables and registers are restored
> on ITS post_load().
>
> Redistributor pending tables also are flushed on VM stop, independently
> on ITS tables.
>
> That work was tested on Cavium ThunderX using virsh save/restore and
> virt-manager live migration.
>
> Best Regards
>
> Eric
>
> Host Kernel dependencies:
> - [1] [PATCH v5 00/22] vITS save/restore
>
> History:
> v4 -> v5:
> - adapt to the new user API
> - new patch "hw/intc/arm_gicv3_kvm: Implement pending table save"
>   as the pending table save now is handled on GICV3 side.
>
> v3 -> v4:
> - oversight in v3, missed a last minute correction related to
>   reg useless declaration in kvm_arm_its_pre_save
>
> v2 -> v3:
> - GITS_IIDR is now saved and restored to check ABI revision.
> - get/put functions renamed into pre_save/post_load
> - unmigratable = false removed
> - changed the migration blocker message
> - remove the extract64 round s->ctlr
> - reword some comments
>
> v1 -> v2:
> - rebase on 2.9 soft release code
> - handle case where migrate_add_blocker fails
> - add comments along with ITS and GICv3 migration priorities
>
>
> Eric Auger (4):
>   linux-headers: Update for vITS save/restore
>   hw/intc/arm_gicv3_its: Implement state save/restore
>   hw/intc/arm_gicv3_kvm: Implement pending table save
>   hw/intc/arm_gicv3_its: Allow save/restore
>
>  hw/intc/arm_gicv3_common.c             |   1 +
>  hw/intc/arm_gicv3_its_common.c         |  11 ++-
>  hw/intc/arm_gicv3_its_kvm.c            | 120 +++++++++++++++++++++++++++++----
>  hw/intc/arm_gicv3_kvm.c                |  25 +++++++
>  include/hw/intc/arm_gicv3_its_common.h |   8 +++
>  include/migration/vmstate.h            |   2 +
>  linux-headers/asm-arm/kvm.h            |   6 +-
>  linux-headers/asm-arm64/kvm.h          |   6 +-
>  8 files changed, 164 insertions(+), 15 deletions(-)
>
> --
> 2.5.5
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 1/4] linux-headers: Update for vITS save/restore
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 1/4] linux-headers: Update for " Eric Auger
@ 2017-04-26 11:39   ` Prakash B
  0 siblings, 0 replies; 15+ messages in thread
From: Prakash B @ 2017-04-26 11:39 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, Peter Maydell, qemu-arm, qemu-devel, drjones,
	Vijay Kilari, quintela, dgilbert, Vijaya.Kumar, Christoffer Dall

On Fri, Apr 14, 2017 at 6:16 PM, Eric Auger <eric.auger@redhat.com> wrote:
> This is a linux header update against 4.11-rc6 plus the non
> upstreamed ITS migration series.
>
> https://github.com/eauger/linux/tree/v4.11-rc6-its-mig-v5
>
> It aims at enhancing the KVM user API with vITS save/restore
> capability. Those are new attributes supported in the
> ITS and GICv3 KVM device KVM_DEV_ARM_VGIC_GRP_CTRL groups.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>

Tested-by: Prakash, Brahmajyosyula <Brahmajyosyula.Prakash@cavium.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore Eric Auger
@ 2017-04-26 11:40   ` Prakash B
  2017-06-09  1:28   ` Shannon Zhao
  1 sibling, 0 replies; 15+ messages in thread
From: Prakash B @ 2017-04-26 11:40 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, Peter Maydell, qemu-arm, qemu-devel, drjones,
	Vijay Kilari, quintela, dgilbert, Vijaya.Kumar, Christoffer Dall

On Fri, Apr 14, 2017 at 6:16 PM, Eric Auger <eric.auger@redhat.com> wrote:
> We need to handle both registers and ITS tables. While
> register handling is standard, ITS table handling is more
> challenging since the kernel API is devised so that the
> tables are flushed into guest RAM and not in vmstate buffers.
>
> Flushing the ITS tables on device pre_save() is too late
> since the guest RAM is already saved at this point.
>
> Table flushing needs to happen when we are sure the vcpus
> are stopped and before the last dirty page saving. The
> right point is RUN_STATE_FINISH_MIGRATE but sometimes the
> VM gets stopped before migration launch so let's simply
> flush the tables each time the VM gets stopped.
>
> For regular ITS registers we just can use vmstate pre_save()
> and post_load() callbacks.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Prakash, Brahmajyosyula <Brahmajyosyula.Prakash@cavium.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 3/4] hw/intc/arm_gicv3_kvm: Implement pending table save
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 3/4] hw/intc/arm_gicv3_kvm: Implement pending table save Eric Auger
@ 2017-04-26 11:40   ` Prakash B
  0 siblings, 0 replies; 15+ messages in thread
From: Prakash B @ 2017-04-26 11:40 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, Peter Maydell, qemu-arm, qemu-devel, drjones,
	Vijay Kilari, quintela, dgilbert, Vijaya.Kumar, Christoffer Dall

On Fri, Apr 14, 2017 at 6:16 PM, Eric Auger <eric.auger@redhat.com> wrote:
> This patch adds the flush of the LPI pending bits into the
> redistributor pending tables. This happens on VM stop.
>
> There is no explicit restore as the tables are implicitly sync'ed
> on ITS table restore and on LPI enable at redistributor level.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Prakash, Brahmajyosyula <Brahmajyosyula.Prakash@cavium.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore Eric Auger
@ 2017-04-26 11:41   ` Prakash B
  2017-05-19 10:30   ` Shannon Zhao
  1 sibling, 0 replies; 15+ messages in thread
From: Prakash B @ 2017-04-26 11:41 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, Peter Maydell, qemu-arm, qemu-devel, drjones,
	Vijay Kilari, quintela, dgilbert, Vijaya.Kumar, Christoffer Dall

On Fri, Apr 14, 2017 at 6:16 PM, Eric Auger <eric.auger@redhat.com> wrote:
> We change the restoration priority of both the GICv3 and ITS. The
> GICv3 must be restored before the ITS and the ITS needs to be restored
> before PCIe devices since it translates their MSI transactions.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
Tested-by: Prakash, Brahmajyosyula <Brahmajyosyula.Prakash@cavium.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 0/4] vITS save/restore
  2017-04-26 11:18 ` [Qemu-devel] [RFC v5 0/4] vITS save/restore Prakash B
@ 2017-04-27  6:58   ` Auger Eric
  0 siblings, 0 replies; 15+ messages in thread
From: Auger Eric @ 2017-04-27  6:58 UTC (permalink / raw)
  To: Prakash B
  Cc: Peter Maydell, drjones, Vijay Kilari, quintela, qemu-devel,
	dgilbert, qemu-arm, Vijaya.Kumar, Christoffer Dall,
	eric.auger.pro

Hi Brahmajyosyula,

On 26/04/2017 13:18, Prakash B wrote:
> Verified on Cavium ThunderX platform
> Continousily migrated Guest more than 500 times b/w different  hosts.
> Please feel free to add  Tested-by: Prakash, Brahmajyosyula
> <Brahmajyosyula.Prakash@cavium.com>


Many thanks for your testing efforts!

Best Regards

Eric
> 
> On Fri, Apr 14, 2017 at 6:16 PM, Eric Auger <eric.auger@redhat.com> wrote:
>> This series allows ITS save/restore and migration use cases.
>> It relies on not upstreamed kernel series [1].
>>
>> ITS tables are flushed into guest RAM on VM stop while registers
>> are save on pre_save() callback. Tables and registers are restored
>> on ITS post_load().
>>
>> Redistributor pending tables also are flushed on VM stop, independently
>> on ITS tables.
>>
>> That work was tested on Cavium ThunderX using virsh save/restore and
>> virt-manager live migration.
>>
>> Best Regards
>>
>> Eric
>>
>> Host Kernel dependencies:
>> - [1] [PATCH v5 00/22] vITS save/restore
>>
>> History:
>> v4 -> v5:
>> - adapt to the new user API
>> - new patch "hw/intc/arm_gicv3_kvm: Implement pending table save"
>>   as the pending table save now is handled on GICV3 side.
>>
>> v3 -> v4:
>> - oversight in v3, missed a last minute correction related to
>>   reg useless declaration in kvm_arm_its_pre_save
>>
>> v2 -> v3:
>> - GITS_IIDR is now saved and restored to check ABI revision.
>> - get/put functions renamed into pre_save/post_load
>> - unmigratable = false removed
>> - changed the migration blocker message
>> - remove the extract64 round s->ctlr
>> - reword some comments
>>
>> v1 -> v2:
>> - rebase on 2.9 soft release code
>> - handle case where migrate_add_blocker fails
>> - add comments along with ITS and GICv3 migration priorities
>>
>>
>> Eric Auger (4):
>>   linux-headers: Update for vITS save/restore
>>   hw/intc/arm_gicv3_its: Implement state save/restore
>>   hw/intc/arm_gicv3_kvm: Implement pending table save
>>   hw/intc/arm_gicv3_its: Allow save/restore
>>
>>  hw/intc/arm_gicv3_common.c             |   1 +
>>  hw/intc/arm_gicv3_its_common.c         |  11 ++-
>>  hw/intc/arm_gicv3_its_kvm.c            | 120 +++++++++++++++++++++++++++++----
>>  hw/intc/arm_gicv3_kvm.c                |  25 +++++++
>>  include/hw/intc/arm_gicv3_its_common.h |   8 +++
>>  include/migration/vmstate.h            |   2 +
>>  linux-headers/asm-arm/kvm.h            |   6 +-
>>  linux-headers/asm-arm64/kvm.h          |   6 +-
>>  8 files changed, 164 insertions(+), 15 deletions(-)
>>
>> --
>> 2.5.5
>>
>>
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore Eric Auger
  2017-04-26 11:41   ` Prakash B
@ 2017-05-19 10:30   ` Shannon Zhao
  2017-06-08 13:52     ` Auger Eric
  1 sibling, 1 reply; 15+ messages in thread
From: Shannon Zhao @ 2017-05-19 10:30 UTC (permalink / raw)
  To: Eric Auger, eric.auger.pro, peter.maydell, qemu-arm, qemu-devel
  Cc: drjones, vijay.kilari, quintela, dgilbert, Vijaya.Kumar,
	christoffer.dall



On 2017/4/14 20:46, Eric Auger wrote:
> We change the restoration priority of both the GICv3 and ITS. The
> GICv3 must be restored before the ITS and the ITS needs to be restored
> before PCIe devices since it translates their MSI transactions.
> 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
> 
> ---
> v2 -> v3:
> - reword migration blocker message
> - remove unmigratable setting to false
> 
> v1 -> v2:
> - handle case where migrate_add_blocker fails
> - add comments along with ITS and GICv3 migration priorities
> ---
>  hw/intc/arm_gicv3_common.c     |  1 +
>  hw/intc/arm_gicv3_its_common.c |  2 +-
>  hw/intc/arm_gicv3_its_kvm.c    | 24 ++++++++++++------------
>  include/migration/vmstate.h    |  2 ++
>  4 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
> index c6493d6..4228b7c 100644
> --- a/hw/intc/arm_gicv3_common.c
> +++ b/hw/intc/arm_gicv3_common.c
> @@ -145,6 +145,7 @@ static const VMStateDescription vmstate_gicv3 = {
>      .minimum_version_id = 1,
>      .pre_save = gicv3_pre_save,
>      .post_load = gicv3_post_load,
> +    .priority = MIG_PRI_GICV3,
>      .fields = (VMStateField[]) {
>          VMSTATE_UINT32(gicd_ctlr, GICv3State),
>          VMSTATE_UINT32_ARRAY(gicd_statusr, GICv3State, 2),
> diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c
> index efab8c7..22ce4c4 100644
> --- a/hw/intc/arm_gicv3_its_common.c
> +++ b/hw/intc/arm_gicv3_its_common.c
> @@ -48,7 +48,7 @@ static const VMStateDescription vmstate_its = {
>      .name = "arm_gicv3_its",
>      .pre_save = gicv3_its_pre_save,
>      .post_load = gicv3_its_post_load,
> -    .unmigratable = true,
> +    .priority = MIG_PRI_GICV3_ITS,
>      .fields = (VMStateField[]) {
>          VMSTATE_UINT32(ctlr, GICv3ITSState),
>          VMSTATE_UINT32(iidr, GICv3ITSState),
> diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
> index 7c5502c..8401d2f 100644
> --- a/hw/intc/arm_gicv3_its_kvm.c
> +++ b/hw/intc/arm_gicv3_its_kvm.c
> @@ -77,18 +77,6 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
>      GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
>      Error *local_err = NULL;
>  
> -    /*
> -     * Block migration of a KVM GICv3 ITS device: the API for saving and
> -     * restoring the state in the kernel is not yet available
> -     */
> -    error_setg(&s->migration_blocker, "vITS migration is not implemented");
> -    migrate_add_blocker(s->migration_blocker, &local_err);
> -    if (local_err) {
> -        error_propagate(errp, local_err);
> -        error_free(s->migration_blocker);
> -        return;
> -    }
> -
>      s->dev_fd = kvm_create_device(kvm_state, KVM_DEV_TYPE_ARM_VGIC_ITS, false);
>      if (s->dev_fd < 0) {
>          error_setg_errno(errp, -s->dev_fd, "error creating in-kernel ITS");
> @@ -105,6 +93,18 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
>  
>      gicv3_its_init_mmio(s, NULL);
>  
> +    if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
> +        GITS_CTLR)) {
> +        error_setg(&s->migration_blocker, "This operating system kernel "
> +                   "does not support vGICv3 migration");
s/vGICv3/vITS
> +        migrate_add_blocker(s->migration_blocker, &local_err);
> +        if (local_err) {
> +            error_propagate(errp, local_err);
> +            error_free(s->migration_blocker);
> +            return;
> +        }
> +    }
> +
>      kvm_msi_use_devid = true;
>      kvm_gsi_direct_mapping = false;
>      kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index f2dbf84..8dab9c7 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -198,6 +198,8 @@ enum VMStateFlags {
>  typedef enum {
>      MIG_PRI_DEFAULT = 0,
>      MIG_PRI_IOMMU,              /* Must happen before PCI devices */
> +    MIG_PRI_GICV3_ITS,          /* Must happen before PCI devices */
> +    MIG_PRI_GICV3,              /* Must happen before the ITS */
>      MIG_PRI_MAX,
>  } MigrationPriority;
>  
> 

Thanks,
-- 
Shannon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore
  2017-05-19 10:30   ` Shannon Zhao
@ 2017-06-08 13:52     ` Auger Eric
  0 siblings, 0 replies; 15+ messages in thread
From: Auger Eric @ 2017-06-08 13:52 UTC (permalink / raw)
  To: Shannon Zhao, eric.auger.pro, peter.maydell, qemu-arm, qemu-devel
  Cc: drjones, vijay.kilari, quintela, dgilbert, Vijaya.Kumar,
	christoffer.dall

Hi Shannon,
On 19/05/2017 12:30, Shannon Zhao wrote:
> 
> 
> On 2017/4/14 20:46, Eric Auger wrote:
>> We change the restoration priority of both the GICv3 and ITS. The
>> GICv3 must be restored before the ITS and the ITS needs to be restored
>> before PCIe devices since it translates their MSI transactions.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> Reviewed-by: Juan Quintela <quintela@redhat.com>
>>
>> ---
>> v2 -> v3:
>> - reword migration blocker message
>> - remove unmigratable setting to false
>>
>> v1 -> v2:
>> - handle case where migrate_add_blocker fails
>> - add comments along with ITS and GICv3 migration priorities
>> ---
>>  hw/intc/arm_gicv3_common.c     |  1 +
>>  hw/intc/arm_gicv3_its_common.c |  2 +-
>>  hw/intc/arm_gicv3_its_kvm.c    | 24 ++++++++++++------------
>>  include/migration/vmstate.h    |  2 ++
>>  4 files changed, 16 insertions(+), 13 deletions(-)
>>
>> diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
>> index c6493d6..4228b7c 100644
>> --- a/hw/intc/arm_gicv3_common.c
>> +++ b/hw/intc/arm_gicv3_common.c
>> @@ -145,6 +145,7 @@ static const VMStateDescription vmstate_gicv3 = {
>>      .minimum_version_id = 1,
>>      .pre_save = gicv3_pre_save,
>>      .post_load = gicv3_post_load,
>> +    .priority = MIG_PRI_GICV3,
>>      .fields = (VMStateField[]) {
>>          VMSTATE_UINT32(gicd_ctlr, GICv3State),
>>          VMSTATE_UINT32_ARRAY(gicd_statusr, GICv3State, 2),
>> diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c
>> index efab8c7..22ce4c4 100644
>> --- a/hw/intc/arm_gicv3_its_common.c
>> +++ b/hw/intc/arm_gicv3_its_common.c
>> @@ -48,7 +48,7 @@ static const VMStateDescription vmstate_its = {
>>      .name = "arm_gicv3_its",
>>      .pre_save = gicv3_its_pre_save,
>>      .post_load = gicv3_its_post_load,
>> -    .unmigratable = true,
>> +    .priority = MIG_PRI_GICV3_ITS,
>>      .fields = (VMStateField[]) {
>>          VMSTATE_UINT32(ctlr, GICv3ITSState),
>>          VMSTATE_UINT32(iidr, GICv3ITSState),
>> diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
>> index 7c5502c..8401d2f 100644
>> --- a/hw/intc/arm_gicv3_its_kvm.c
>> +++ b/hw/intc/arm_gicv3_its_kvm.c
>> @@ -77,18 +77,6 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
>>      GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
>>      Error *local_err = NULL;
>>  
>> -    /*
>> -     * Block migration of a KVM GICv3 ITS device: the API for saving and
>> -     * restoring the state in the kernel is not yet available
>> -     */
>> -    error_setg(&s->migration_blocker, "vITS migration is not implemented");
>> -    migrate_add_blocker(s->migration_blocker, &local_err);
>> -    if (local_err) {
>> -        error_propagate(errp, local_err);
>> -        error_free(s->migration_blocker);
>> -        return;
>> -    }
>> -
>>      s->dev_fd = kvm_create_device(kvm_state, KVM_DEV_TYPE_ARM_VGIC_ITS, false);
>>      if (s->dev_fd < 0) {
>>          error_setg_errno(errp, -s->dev_fd, "error creating in-kernel ITS");
>> @@ -105,6 +93,18 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
>>  
>>      gicv3_its_init_mmio(s, NULL);
>>  
>> +    if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
>> +        GITS_CTLR)) {
>> +        error_setg(&s->migration_blocker, "This operating system kernel "
>> +                   "does not support vGICv3 migration");
> s/vGICv3/vITS
Done

Thanks for reporting this!

Eric
>> +        migrate_add_blocker(s->migration_blocker, &local_err);
>> +        if (local_err) {
>> +            error_propagate(errp, local_err);
>> +            error_free(s->migration_blocker);
>> +            return;
>> +        }
>> +    }
>> +
>>      kvm_msi_use_devid = true;
>>      kvm_gsi_direct_mapping = false;
>>      kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
>> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
>> index f2dbf84..8dab9c7 100644
>> --- a/include/migration/vmstate.h
>> +++ b/include/migration/vmstate.h
>> @@ -198,6 +198,8 @@ enum VMStateFlags {
>>  typedef enum {
>>      MIG_PRI_DEFAULT = 0,
>>      MIG_PRI_IOMMU,              /* Must happen before PCI devices */
>> +    MIG_PRI_GICV3_ITS,          /* Must happen before PCI devices */
>> +    MIG_PRI_GICV3,              /* Must happen before the ITS */
>>      MIG_PRI_MAX,
>>  } MigrationPriority;
>>  
>>
> 
> Thanks,
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore
  2017-04-14 12:46 ` [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore Eric Auger
  2017-04-26 11:40   ` Prakash B
@ 2017-06-09  1:28   ` Shannon Zhao
  2017-06-09 15:53     ` Auger Eric
  1 sibling, 1 reply; 15+ messages in thread
From: Shannon Zhao @ 2017-06-09  1:28 UTC (permalink / raw)
  To: Eric Auger, eric.auger.pro, peter.maydell, qemu-arm, qemu-devel
  Cc: drjones, vijay.kilari, quintela, dgilbert, Vijaya.Kumar,
	christoffer.dall



On 2017/4/14 20:46, Eric Auger wrote:
[...]
> @@ -43,6 +50,7 @@ struct GICv3ITSState {
>  
>      /* Registers */
>      uint32_t ctlr;
> +    uint32_t iidr;
I think this should reset in gicv3_its_common_reset

Thanks,
-- 
Shannon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore
  2017-06-09  1:28   ` Shannon Zhao
@ 2017-06-09 15:53     ` Auger Eric
  0 siblings, 0 replies; 15+ messages in thread
From: Auger Eric @ 2017-06-09 15:53 UTC (permalink / raw)
  To: Shannon Zhao, eric.auger.pro, peter.maydell, qemu-arm, qemu-devel
  Cc: drjones, vijay.kilari, quintela, dgilbert, Vijaya.Kumar,
	christoffer.dall

Hi Shannon,

On 09/06/2017 03:28, Shannon Zhao wrote:
> 
> 
> On 2017/4/14 20:46, Eric Auger wrote:
> [...]
>> @@ -43,6 +50,7 @@ struct GICv3ITSState {
>>  
>>      /* Registers */
>>      uint32_t ctlr;
>> +    uint32_t iidr;
> I think this should reset in gicv3_its_common_reset

Done.

Thanks!

Eric
> 
> Thanks,
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-06-09 15:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 12:46 [Qemu-devel] [RFC v5 0/4] vITS save/restore Eric Auger
2017-04-14 12:46 ` [Qemu-devel] [RFC v5 1/4] linux-headers: Update for " Eric Auger
2017-04-26 11:39   ` Prakash B
2017-04-14 12:46 ` [Qemu-devel] [RFC v5 2/4] hw/intc/arm_gicv3_its: Implement state save/restore Eric Auger
2017-04-26 11:40   ` Prakash B
2017-06-09  1:28   ` Shannon Zhao
2017-06-09 15:53     ` Auger Eric
2017-04-14 12:46 ` [Qemu-devel] [RFC v5 3/4] hw/intc/arm_gicv3_kvm: Implement pending table save Eric Auger
2017-04-26 11:40   ` Prakash B
2017-04-14 12:46 ` [Qemu-devel] [RFC v5 4/4] hw/intc/arm_gicv3_its: Allow save/restore Eric Auger
2017-04-26 11:41   ` Prakash B
2017-05-19 10:30   ` Shannon Zhao
2017-06-08 13:52     ` Auger Eric
2017-04-26 11:18 ` [Qemu-devel] [RFC v5 0/4] vITS save/restore Prakash B
2017-04-27  6:58   ` Auger Eric

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.