[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/42] hw/intc/i8259: Introduce i8259 proxy "isa-pic"
From: |
Bernhard Beschow |
Subject: |
[PATCH 07/42] hw/intc/i8259: Introduce i8259 proxy "isa-pic" |
Date: |
Thu, 1 Sep 2022 18:25:38 +0200 |
Having an i8259 proxy allows for ISA PICs to be created and wired up in
southbridges. This is especially interesting for PIIX3 for two reasons:
First, the southbridge doesn't need to care about the virtualization
technology used (KVM, TCG, Xen) due to in-IRQs (where devices get
attached) and out-IRQs (which will trigger the IRQs of the respective
virtzalization technology) are separated. Second, since the in-IRQs are
populated with fully initialized qemu_irq's, they can already be wired
up inside PIIX3.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/intc/i8259.c | 27 +++++++++++++++++++++++++++
include/hw/intc/i8259.h | 14 ++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index cc4e21ffec..531f6cca53 100644
--- a/hw/intc/i8259.c
+++ b/hw/intc/i8259.c
@@ -458,9 +458,36 @@ static const TypeInfo i8259_info = {
.class_size = sizeof(PICClass),
};
+static void isapic_set_irq(void *opaque, int irq, int level)
+{
+ ISAPICState *s = opaque;
+
+ qemu_set_irq(s->out_irqs[irq], level);
+}
+
+static void isapic_init(Object *obj)
+{
+ ISAPICState *s = ISA_PIC(obj);
+
+ qdev_init_gpio_in(DEVICE(s), isapic_set_irq, ISA_NUM_IRQS);
+ qdev_init_gpio_out(DEVICE(s), s->out_irqs, ISA_NUM_IRQS);
+
+ for (int i = 0; i < ISA_NUM_IRQS; ++i) {
+ s->in_irqs[i] = qdev_get_gpio_in(DEVICE(s), i);
+ }
+}
+
+static const TypeInfo isapic_info = {
+ .name = TYPE_ISA_PIC,
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISAPICState),
+ .instance_init = isapic_init,
+};
+
static void pic_register_types(void)
{
type_register_static(&i8259_info);
+ type_register_static(&isapic_info);
}
type_init(pic_register_types)
diff --git a/include/hw/intc/i8259.h b/include/hw/intc/i8259.h
index e2b1e8c59a..0246ab6ac6 100644
--- a/include/hw/intc/i8259.h
+++ b/include/hw/intc/i8259.h
@@ -1,6 +1,20 @@
#ifndef HW_I8259_H
#define HW_I8259_H
+#include "qom/object.h"
+#include "hw/isa/isa.h"
+#include "qemu/typedefs.h"
+
+#define TYPE_ISA_PIC "isa-pic"
+OBJECT_DECLARE_SIMPLE_TYPE(ISAPICState, ISA_PIC)
+
+struct ISAPICState {
+ ISADevice parent_obj;
+
+ qemu_irq in_irqs[ISA_NUM_IRQS];
+ qemu_irq out_irqs[ISA_NUM_IRQS];
+};
+
/* i8259.c */
extern DeviceState *isa_pic;
--
2.37.3
- [PATCH 00/42] Consolidate PIIX south bridges, Bernhard Beschow, 2022/09/01
- [PATCH 01/42] hw/i386/pc: Create DMA controllers in south bridges, Bernhard Beschow, 2022/09/01
- [PATCH 04/42] hw/i386/pc_piix: Allow for setting properties before realizing PIIX3 south bridge, Bernhard Beschow, 2022/09/01
- [PATCH 05/42] hw/isa/piix3: Create USB controller in host device, Bernhard Beschow, 2022/09/01
- [PATCH 03/42] hw/i386/pc: No need for rtc_state to be an out-parameter, Bernhard Beschow, 2022/09/01
- [PATCH 02/42] hw/i386/pc: Create RTC controllers in south bridges, Bernhard Beschow, 2022/09/01
- [PATCH 06/42] hw/isa/piix3: Create power management controller in host device, Bernhard Beschow, 2022/09/01
- [PATCH 07/42] hw/intc/i8259: Introduce i8259 proxy "isa-pic",
Bernhard Beschow <=
- [PATCH 08/42] hw/isa/piix3: Create ISA PIC in host device, Bernhard Beschow, 2022/09/01
- [PATCH 10/42] hw/isa/piix3: Wire up ACPI interrupt internally, Bernhard Beschow, 2022/09/01
- [PATCH 11/42] hw/isa/piix3: Remove extra ';' outside of functions, Bernhard Beschow, 2022/09/01
- [PATCH 09/42] hw/isa/piix3: Create IDE controller in host device, Bernhard Beschow, 2022/09/01
- [PATCH 12/42] hw/isa/piix3: Remove unused include, Bernhard Beschow, 2022/09/01
- [PATCH 14/42] hw/isa/piix3: Modernize reset handling, Bernhard Beschow, 2022/09/01