|
|
4a2fec |
From ef9a83242e22841ce988c14870fd9391dc832a99 Mon Sep 17 00:00:00 2001
|
|
|
4a2fec |
From: Auger Eric <eric.auger@redhat.com>
|
|
|
4a2fec |
Date: Tue, 28 Nov 2017 15:14:06 +0100
|
|
|
4a2fec |
Subject: [PATCH 5/9] hw/intc/arm_gicv3_its: Implement a minimalist reset
|
|
|
4a2fec |
|
|
|
4a2fec |
RH-Author: Auger Eric <eric.auger@redhat.com>
|
|
|
4a2fec |
Message-id: <1511882048-11256-6-git-send-email-eric.auger@redhat.com>
|
|
|
4a2fec |
Patchwork-id: 77943
|
|
|
4a2fec |
O-Subject: [RHV7.5 qemu-kvm-ma PATCH 5/7] hw/intc/arm_gicv3_its: Implement a minimalist reset
|
|
|
4a2fec |
Bugzilla: 1513323
|
|
|
4a2fec |
RH-Acked-by: Andrew Jones <drjones@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Wei Huang <wei@redhat.com>
|
|
|
4a2fec |
|
|
|
4a2fec |
At the moment the ITS is not properly reset and this causes
|
|
|
4a2fec |
various bugs on save/restore. We implement a minimalist reset
|
|
|
4a2fec |
through individual register writes but for kernel versions
|
|
|
4a2fec |
before v4.15 this fails voiding the vITS cache. We cannot
|
|
|
4a2fec |
claim we have a comprehensive reset (hence the error message)
|
|
|
4a2fec |
but that's better than nothing.
|
|
|
4a2fec |
|
|
|
4a2fec |
Signed-off-by: Eric Auger <eric.auger@redhat.com>
|
|
|
4a2fec |
|
|
|
4a2fec |
---
|
|
|
4a2fec |
v5 -> v6:
|
|
|
4a2fec |
- add class_size
|
|
|
4a2fec |
|
|
|
4a2fec |
v4 -> v5:
|
|
|
4a2fec |
- correct error message
|
|
|
4a2fec |
|
|
|
4a2fec |
v2 -> v3:
|
|
|
4a2fec |
- individual register writes performed in kvm_arm_its_reset
|
|
|
4a2fec |
- check KVM_DEV_ARM_VGIC_GRP_ITS_REGS support
|
|
|
4a2fec |
|
|
|
4a2fec |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
4a2fec |
---
|
|
|
4a2fec |
hw/intc/arm_gicv3_its_kvm.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
4a2fec |
1 file changed, 42 insertions(+)
|
|
|
4a2fec |
|
|
|
4a2fec |
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
|
|
|
4a2fec |
index b1b322b..1c663ac 100644
|
|
|
4a2fec |
--- a/hw/intc/arm_gicv3_its_kvm.c
|
|
|
4a2fec |
+++ b/hw/intc/arm_gicv3_its_kvm.c
|
|
|
4a2fec |
@@ -28,6 +28,16 @@
|
|
|
4a2fec |
|
|
|
4a2fec |
#define TYPE_KVM_ARM_ITS "arm-its-kvm"
|
|
|
4a2fec |
#define KVM_ARM_ITS(obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS)
|
|
|
4a2fec |
+#define KVM_ARM_ITS_CLASS(klass) \
|
|
|
4a2fec |
+ OBJECT_CLASS_CHECK(KVMARMITSClass, (klass), TYPE_KVM_ARM_ITS)
|
|
|
4a2fec |
+#define KVM_ARM_ITS_GET_CLASS(obj) \
|
|
|
4a2fec |
+ OBJECT_GET_CLASS(KVMARMITSClass, (obj), TYPE_KVM_ARM_ITS)
|
|
|
4a2fec |
+
|
|
|
4a2fec |
+typedef struct KVMARMITSClass {
|
|
|
4a2fec |
+ GICv3ITSCommonClass parent_class;
|
|
|
4a2fec |
+ void (*parent_reset)(DeviceState *dev);
|
|
|
4a2fec |
+} KVMARMITSClass;
|
|
|
4a2fec |
+
|
|
|
4a2fec |
|
|
|
4a2fec |
static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid)
|
|
|
4a2fec |
{
|
|
|
4a2fec |
@@ -186,6 +196,34 @@ static void kvm_arm_its_post_load(GICv3ITSState *s)
|
|
|
4a2fec |
GITS_CTLR, &s->ctlr, true, &error_abort);
|
|
|
4a2fec |
}
|
|
|
4a2fec |
|
|
|
4a2fec |
+static void kvm_arm_its_reset(DeviceState *dev)
|
|
|
4a2fec |
+{
|
|
|
4a2fec |
+ GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
|
|
|
4a2fec |
+ KVMARMITSClass *c = KVM_ARM_ITS_GET_CLASS(s);
|
|
|
4a2fec |
+ int i;
|
|
|
4a2fec |
+
|
|
|
4a2fec |
+ c->parent_reset(dev);
|
|
|
4a2fec |
+
|
|
|
4a2fec |
+ error_report("ITS KVM: full reset is not supported by QEMU");
|
|
|
4a2fec |
+
|
|
|
4a2fec |
+ if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
|
|
|
4a2fec |
+ GITS_CTLR)) {
|
|
|
4a2fec |
+ return;
|
|
|
4a2fec |
+ }
|
|
|
4a2fec |
+
|
|
|
4a2fec |
+ kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
|
|
|
4a2fec |
+ GITS_CTLR, &s->ctlr, true, &error_abort);
|
|
|
4a2fec |
+
|
|
|
4a2fec |
+ kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
|
|
|
4a2fec |
+ GITS_CBASER, &s->cbaser, true, &error_abort);
|
|
|
4a2fec |
+
|
|
|
4a2fec |
+ for (i = 0; i < 8; i++) {
|
|
|
4a2fec |
+ kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
|
|
|
4a2fec |
+ GITS_BASER + i * 8, &s->baser[i], true,
|
|
|
4a2fec |
+ &error_abort);
|
|
|
4a2fec |
+ }
|
|
|
4a2fec |
+}
|
|
|
4a2fec |
+
|
|
|
4a2fec |
static Property kvm_arm_its_props[] = {
|
|
|
4a2fec |
DEFINE_PROP_LINK("parent-gicv3", GICv3ITSState, gicv3, "kvm-arm-gicv3",
|
|
|
4a2fec |
GICv3State *),
|
|
|
4a2fec |
@@ -196,12 +234,15 @@ static void kvm_arm_its_class_init(ObjectClass *klass, void *data)
|
|
|
4a2fec |
{
|
|
|
4a2fec |
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
4a2fec |
GICv3ITSCommonClass *icc = ARM_GICV3_ITS_COMMON_CLASS(klass);
|
|
|
4a2fec |
+ KVMARMITSClass *ic = KVM_ARM_ITS_CLASS(klass);
|
|
|
4a2fec |
|
|
|
4a2fec |
dc->realize = kvm_arm_its_realize;
|
|
|
4a2fec |
dc->props = kvm_arm_its_props;
|
|
|
4a2fec |
+ ic->parent_reset = dc->reset;
|
|
|
4a2fec |
icc->send_msi = kvm_its_send_msi;
|
|
|
4a2fec |
icc->pre_save = kvm_arm_its_pre_save;
|
|
|
4a2fec |
icc->post_load = kvm_arm_its_post_load;
|
|
|
4a2fec |
+ dc->reset = kvm_arm_its_reset;
|
|
|
4a2fec |
}
|
|
|
4a2fec |
|
|
|
4a2fec |
static const TypeInfo kvm_arm_its_info = {
|
|
|
4a2fec |
@@ -209,6 +250,7 @@ static const TypeInfo kvm_arm_its_info = {
|
|
|
4a2fec |
.parent = TYPE_ARM_GICV3_ITS_COMMON,
|
|
|
4a2fec |
.instance_size = sizeof(GICv3ITSState),
|
|
|
4a2fec |
.class_init = kvm_arm_its_class_init,
|
|
|
4a2fec |
+ .class_size = sizeof(KVMARMITSClass),
|
|
|
4a2fec |
};
|
|
|
4a2fec |
|
|
|
4a2fec |
static void kvm_arm_its_register_types(void)
|
|
|
4a2fec |
--
|
|
|
4a2fec |
1.8.3.1
|
|
|
4a2fec |
|