[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/39] intc/i8259: implement InterruptStatsProvider i
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/39] intc/i8259: implement InterruptStatsProvider interface |
Date: |
Fri, 7 Oct 2016 18:57:29 +0200 |
From: Hervé Poussineau <address@hidden>
Signed-off-by: Hervé Poussineau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/intc/i8259.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index c2607a5..75c8d22 100644
--- a/hw/intc/i8259.c
+++ b/hw/intc/i8259.c
@@ -29,6 +29,7 @@
#include "qemu/timer.h"
#include "qemu/log.h"
#include "hw/isa/i8259_internal.h"
+#include "hw/intc/intc.h"
/* debug PIC */
//#define DEBUG_PIC
@@ -251,6 +252,35 @@ static void pic_reset(DeviceState *dev)
pic_init_reset(s);
}
+static bool pic_get_statistics(InterruptStatsProvider *obj,
+ uint64_t **irq_counts, unsigned int *nb_irqs)
+{
+ PICCommonState *s = PIC_COMMON(obj);
+
+ if (s->master) {
+#ifdef DEBUG_IRQ_COUNT
+ *irq_counts = irq_count;
+ *nb_irqs = ARRAY_SIZE(irq_count);
+#else
+ return false;
+#endif
+ } else {
+ *irq_counts = NULL;
+ *nb_irqs = 0;
+ }
+ return true;
+}
+
+static void pic_print_info(InterruptStatsProvider *obj, Monitor *mon)
+{
+ PICCommonState *s = PIC_COMMON(obj);
+ monitor_printf(mon, "pic%d: irr=%02x imr=%02x isr=%02x hprio=%d "
+ "irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n",
+ s->master ? 0 : 1, s->irr, s->imr, s->isr, s->priority_add,
+ s->irq_base, s->read_reg_select, s->elcr,
+ s->special_fully_nested_mode);
+}
+
static void pic_ioport_write(void *opaque, hwaddr addr64,
uint64_t val64, unsigned size)
{
@@ -503,10 +533,13 @@ static void i8259_class_init(ObjectClass *klass, void
*data)
{
PICClass *k = PIC_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
+ InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(klass);
k->parent_realize = dc->realize;
dc->realize = pic_realize;
dc->reset = pic_reset;
+ ic->get_statistics = pic_get_statistics;
+ ic->print_info = pic_print_info;
}
static const TypeInfo i8259_info = {
@@ -515,6 +548,10 @@ static const TypeInfo i8259_info = {
.parent = TYPE_PIC_COMMON,
.class_init = i8259_class_init,
.class_size = sizeof(PICClass),
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_INTERRUPT_STATS_PROVIDER },
+ { }
+ },
};
static void pic_register_types(void)
--
2.7.4
- [Qemu-devel] [PULL 00/39] Misc patches for 2016-10-07, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 02/39] MC146818 RTC: coordinate guest clock base to destination host after migration, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 01/39] hw/iommu: Fix problems reported by Coverity scan, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 03/39] hw/misc/edu: support MSI interrupt, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 04/39] intc: add an interface to gather statistics/informations on interrupt controllers, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 05/39] intc/i8259: implement InterruptStatsProvider interface,
Paolo Bonzini <=
- [Qemu-devel] [PULL 06/39] intc/slavio_intctl: implement InterruptStatsProvider interface, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 07/39] intc/lm32_pic: implement InterruptStatsProvider interface, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 08/39] intc: make HMP 'info irq' and 'info pic' commands use InterruptStatsProvider interface, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 09/39] intc: make HMP 'info irq' and 'info pic' commands available on all targets, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 10/39] atomic.h: fix __SANITIZE_THREAD__ build, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 11/39] atomic.h: comment on use of atomic_read/set, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 12/39] tcg/optimize: move default return out of if statement, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 13/39] seqlock: use atomic writes for the sequence, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 14/39] qom/object: update class cache atomically, Paolo Bonzini, 2016/10/07
- [Qemu-devel] [PULL 15/39] qom/cpu: atomically clear the tb_jmp_cache, Paolo Bonzini, 2016/10/07