From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Luiz Capitulino" <lcapitulino@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Michael Walle" <michael@walle.cc>
Subject: [Qemu-devel] [PATCH v2 4/6] intc/lm32_pic: implement InterruptStatsProvider interface
Date: Mon, 26 Sep 2016 22:23:26 +0200 [thread overview]
Message-ID: <1474921408-24710-5-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1474921408-24710-1-git-send-email-hpoussin@reactos.org>
We have to change the vmstate version due to changes in statistics counters.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
hw/intc/lm32_pic.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c
index 3dad01c..c045b99 100644
--- a/hw/intc/lm32_pic.c
+++ b/hw/intc/lm32_pic.c
@@ -25,6 +25,7 @@
#include "hw/sysbus.h"
#include "trace.h"
#include "hw/lm32/lm32_pic.h"
+#include "hw/intc/intc.h"
#define TYPE_LM32_PIC "lm32-pic"
#define LM32_PIC(obj) OBJECT_CHECK(LM32PicState, (obj), TYPE_LM32_PIC)
@@ -38,7 +39,7 @@ struct LM32PicState {
uint32_t irq_state;
/* statistics */
- uint32_t stats_irq_count[32];
+ uint64_t stats_irq_count[32];
};
typedef struct LM32PicState LM32PicState;
@@ -152,6 +153,22 @@ static void pic_reset(DeviceState *d)
}
}
+static bool lm32_get_statistics(InterruptStatsProvider *obj,
+ uint64_t **irq_counts, unsigned int *nb_irqs)
+{
+ LM32PicState *s = LM32_PIC(obj);
+ *irq_counts = s->stats_irq_count;
+ *nb_irqs = ARRAY_SIZE(s->stats_irq_count);
+ return true;
+}
+
+static void lm32_print_info(InterruptStatsProvider *obj, Monitor *mon)
+{
+ LM32PicState *s = LM32_PIC(obj);
+ monitor_printf(mon, "lm32-pic: im=%08x ip=%08x irq_state=%08x\n",
+ s->im, s->ip, s->irq_state);
+}
+
static void lm32_pic_init(Object *obj)
{
DeviceState *dev = DEVICE(obj);
@@ -166,13 +183,13 @@ static void lm32_pic_init(Object *obj)
static const VMStateDescription vmstate_lm32_pic = {
.name = "lm32-pic",
- .version_id = 1,
- .minimum_version_id = 1,
+ .version_id = 2,
+ .minimum_version_id = 2,
.fields = (VMStateField[]) {
VMSTATE_UINT32(im, LM32PicState),
VMSTATE_UINT32(ip, LM32PicState),
VMSTATE_UINT32(irq_state, LM32PicState),
- VMSTATE_UINT32_ARRAY(stats_irq_count, LM32PicState, 32),
+ VMSTATE_UINT64_ARRAY(stats_irq_count, LM32PicState, 32),
VMSTATE_END_OF_LIST()
}
};
@@ -180,9 +197,12 @@ static const VMStateDescription vmstate_lm32_pic = {
static void lm32_pic_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(klass);
dc->reset = pic_reset;
dc->vmsd = &vmstate_lm32_pic;
+ ic->get_statistics = lm32_get_statistics;
+ ic->print_info = lm32_print_info;
}
static const TypeInfo lm32_pic_info = {
@@ -191,6 +211,10 @@ static const TypeInfo lm32_pic_info = {
.instance_size = sizeof(LM32PicState),
.instance_init = lm32_pic_init,
.class_init = lm32_pic_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_INTERRUPT_STATS_PROVIDER },
+ { }
+ },
};
static void lm32_pic_register_types(void)
--
2.1.4
next prev parent reply other threads:[~2016-09-26 20:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 20:23 [Qemu-devel] [PATCH v2 0/6] intc: change 'info irq' and 'info pic' to be target-agnostic Hervé Poussineau
2016-09-26 20:23 ` [Qemu-devel] [PATCH v2 1/6] intc: add an interface to gather statistics/informations on interrupt controllers Hervé Poussineau
2016-09-26 20:23 ` [Qemu-devel] [PATCH v2 2/6] intc/i8259: implement InterruptStatsProvider interface Hervé Poussineau
2016-09-27 4:11 ` David Gibson
2016-09-27 18:49 ` Hervé Poussineau
2016-09-28 1:37 ` David Gibson
2016-09-28 5:22 ` Hervé Poussineau
2016-09-28 7:29 ` David Gibson
2016-09-26 20:23 ` [Qemu-devel] [PATCH v2 3/6] intc/slavio_intctl: " Hervé Poussineau
2016-09-27 14:53 ` Artyom Tarasenko
2016-09-27 18:39 ` Hervé Poussineau
2016-09-28 8:35 ` Artyom Tarasenko
2016-09-26 20:23 ` Hervé Poussineau [this message]
2016-09-26 20:23 ` [Qemu-devel] [PATCH v2 5/6] intc: make HMP 'info irq' and 'info pic' commands use " Hervé Poussineau
2016-09-30 11:23 ` Paolo Bonzini
2016-09-26 20:23 ` [Qemu-devel] [PATCH v2 6/6] intc: make HMP 'info irq' and 'info pic' commands available on all targets Hervé Poussineau
2016-09-27 4:08 ` [Qemu-devel] [PATCH v2 0/6] intc: change 'info irq' and 'info pic' to be target-agnostic David Gibson
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=1474921408-24710-5-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=lcapitulino@redhat.com \
--cc=michael@walle.cc \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 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.