From: Eric Auger <eric.auger@redhat.com>
To: eric.auger.pro@gmail.com, eric.auger@redhat.com,
peter.maydell@linaro.org, qemu-arm@nongnu.org,
qemu-devel@nongnu.org, wanghaibin.wang@huawei.com
Cc: vijay.kilari@gmail.com, drjones@redhat.com, wei@redhat.com,
quintela@redhat.com, dgilbert@redhat.com,
christoffer.dall@linaro.org, wu.wubin@huawei.com
Subject: [Qemu-devel] [RFC 3/3] hw/intc/arm_gicv3_its: Implement reset
Date: Wed, 27 Sep 2017 16:56:45 +0200 [thread overview]
Message-ID: <1506524205-20763-4-git-send-email-eric.auger@redhat.com> (raw)
In-Reply-To: <1506524205-20763-1-git-send-email-eric.auger@redhat.com>
Currently the ITS is not reset and this causes trouble
when state backup is initiated before the guest has initialized
the ITS registers and especially GITS_CBASER<n>.
We are likely to save register values set before the reset/
restart. The register values may not be consistent with the
data structures in RAM.
So let's use the ITS KVM device new combo,
KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_ITS_CTRL_RESET
to explicitly force the in-kernel emulated reset.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
hw/intc/arm_gicv3_its_common.c | 5 ++---
hw/intc/arm_gicv3_its_kvm.c | 22 ++++++++++++++++++----
include/hw/intc/arm_gicv3_its_common.h | 1 +
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c
index 68b20fc..a2fe561 100644
--- a/hw/intc/arm_gicv3_its_common.c
+++ b/hw/intc/arm_gicv3_its_common.c
@@ -129,15 +129,14 @@ static void gicv3_its_common_reset(DeviceState *dev)
s->creadr = 0;
s->iidr = 0;
memset(&s->baser, 0, sizeof(s->baser));
-
- gicv3_its_post_load(s, 0);
}
static void gicv3_its_common_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ GICv3ITSCommonClass *c = ARM_GICV3_ITS_COMMON_CLASS(klass);
- dc->reset = gicv3_its_common_reset;
+ c->parent_reset = gicv3_its_common_reset;
dc->vmsd = &vmstate_its;
}
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
index 120b86d..3c2e724 100644
--- a/hw/intc/arm_gicv3_its_kvm.c
+++ b/hw/intc/arm_gicv3_its_kvm.c
@@ -156,10 +156,6 @@ static void kvm_arm_its_post_load(GICv3ITSState *s)
Error *err = NULL;
int i;
- if (!s->iidr) {
- return;
- }
-
kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
GITS_IIDR, &s->iidr, true, &error_abort);
@@ -195,6 +191,23 @@ static void kvm_arm_its_post_load(GICv3ITSState *s)
GITS_CTLR, &s->ctlr, true, &error_abort);
}
+static void kvm_arm_its_reset(DeviceState *dev)
+{
+ GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
+ GICv3ITSCommonClass *c = ARM_GICV3_ITS_COMMON_GET_CLASS(s);
+
+ c->parent_reset(dev);
+
+ if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
+ KVM_DEV_ARM_ITS_CTRL_RESET)) {
+ error_report("ITS KVM: reset is not supported by the kernel");
+ return;
+ }
+
+ kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
+ KVM_DEV_ARM_ITS_CTRL_RESET, NULL, true, &error_abort);
+}
+
static Property kvm_arm_its_props[] = {
DEFINE_PROP_LINK("parent-gicv3", GICv3ITSState, gicv3, "kvm-arm-gicv3",
GICv3State *),
@@ -211,6 +224,7 @@ static void kvm_arm_its_class_init(ObjectClass *klass, void *data)
icc->send_msi = kvm_its_send_msi;
icc->pre_save = kvm_arm_its_pre_save;
icc->post_load = kvm_arm_its_post_load;
+ dc->reset = kvm_arm_its_reset;
}
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 fd1fe64..c158e9f 100644
--- a/include/hw/intc/arm_gicv3_its_common.h
+++ b/include/hw/intc/arm_gicv3_its_common.h
@@ -79,6 +79,7 @@ struct GICv3ITSCommonClass {
int (*send_msi)(GICv3ITSState *s, uint32_t data, uint16_t devid);
void (*pre_save)(GICv3ITSState *s);
void (*post_load)(GICv3ITSState *s);
+ void (*parent_reset)(DeviceState *dev);
};
typedef struct GICv3ITSCommonClass GICv3ITSCommonClass;
--
2.5.5
next prev parent reply other threads:[~2017-09-27 14:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 14:56 [Qemu-devel] [RFC 0/3] vITS Reset Eric Auger
2017-09-27 14:56 ` [Qemu-devel] [RFC 1/3] hw/intc/arm_gicv3_its: Don't abort on table save/restore Eric Auger
2017-10-12 11:54 ` Peter Maydell
2017-10-17 12:54 ` Auger Eric
2017-09-27 14:56 ` [Qemu-devel] [RFC 2/3] linux-headers: Partial header update for ITS reset Eric Auger
2017-09-27 14:56 ` Eric Auger [this message]
2017-10-12 11:52 ` [Qemu-devel] [RFC 3/3] hw/intc/arm_gicv3_its: Implement reset Peter Maydell
2017-10-09 18:17 ` [Qemu-devel] [RFC 0/3] vITS Reset Peter Maydell
2017-10-11 16:06 ` Auger Eric
2017-10-12 10:36 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506524205-20763-4-git-send-email-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=dgilbert@redhat.com \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=vijay.kilari@gmail.com \
--cc=wanghaibin.wang@huawei.com \
--cc=wei@redhat.com \
--cc=wu.wubin@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).