xemu/hw/intc
Christoffer Dall 8d999995e4 arm_gic: Fix GIC pending behavior
The existing implementation of the pending behavior in gic_set_irq,
gic_complete_irq, and the distributor pending set/clear registers does
not follow the semantics of the GICv2.0 specs, but may implement the
11MPCore support.  Therefore, maintain the existing semantics for
11MPCore and v7M NVIC and change the behavior to be in accordance with
the GICv2.0 specs for "generic implementations" (s->revision == 1 ||
s->revision == 2).

Generic implementations distinguish between setting a level-triggered
interrupt pending through writes to the GICD_ISPENDR and when hardware
raises the interrupt line.  Writing to the GICD_ICPENDR will not cause
the interrupt to become non-pending if the line is still active, and
conversely, if the line is deactivated but the interrupt is marked as
pending through a write to GICD_ISPENDR, the interrupt remains pending.
Handle this situation in the GIC_TEST_PENDING (which now becomes a
static inline named gic_test_pending) and let the 'pending' field
correspond only to the latched state of the D-flip flop in the GICv2.0
specs Figure 4-10.

The following changes are added:

gic_test_pending:
Make this a static inline and split out the 11MPCore from the generic
behavior.  For the generic behavior, consider interrupts pending if:
    ((s->irq_state[irq].pending & (cm) != 0) ||
       (!GIC_TEST_EDGE_TRIGGER(irq) && GIC_TEST_LEVEL(irq, cm))

gic_set_irq:
Split out the 11MPCore from the generic behavior.  For the generic
behavior, always GIC_SET_LEVEL() on positive level, but only
GIC_SET_PENDING for edge-triggered interrupts and always simply
GIC_CLEAR_LEVEL() on negative level.

gic_complete_irq:
Only resample the line for line-triggered interrupts on an 11MPCore.
Generic implementations will sample the line directly in
gic_test_pending().

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-02-08 14:47:28 +00:00
..
allwinner-a10-pic.c hw/intc: add allwinner A10 interrupt controller 2013-12-17 20:12:51 +00:00
apic_common.c icc_bus: QOM'ify ICC 2013-12-24 18:02:18 +01:00
apic.c apic: QOM'ify APIC 2013-12-24 18:02:18 +01:00
arm_gic_common.c QOM infrastructure fixes and device conversions 2014-01-09 11:24:48 -08:00
arm_gic_kvm.c sysbus: Set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:22 +01:00
arm_gic.c arm_gic: Fix GIC pending behavior 2014-02-08 14:47:28 +00:00
armv7m_nvic.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
etraxfs_pic.c hw: cannot_instantiate_with_device_add_yet due to pointer props 2013-12-24 17:27:17 +01:00
exynos4210_combiner.c exynos4210_combiner: QOM cast cleanup 2013-07-29 21:06:57 +02:00
exynos4210_gic.c exynos4210_gic: QOM cast cleanup for exynos4210.irq_gate 2013-07-29 21:06:57 +02:00
gic_internal.h arm_gic: Fix GIC pending behavior 2014-02-08 14:47:28 +00:00
grlib_irqmp.c hw: cannot_instantiate_with_device_add_yet due to pointer props 2013-12-24 17:27:17 +01:00
heathrow_pic.c memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
i8259_common.c isa: Clean up use of cannot_instantiate_with_device_add_yet 2013-12-23 00:27:23 +01:00
i8259.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
imx_avic.c imx_avic: QOM cast cleanup 2013-07-29 21:06:05 +02:00
ioapic_common.c ioapic: QOM'ify ioapic 2013-12-24 18:02:18 +01:00
ioapic.c ioapic: QOM'ify ioapic 2013-12-24 18:02:18 +01:00
lm32_pic.c lm32_pic: QOM cast cleanup 2013-07-29 21:06:57 +02:00
Makefile.objs hw/intc: add allwinner A10 interrupt controller 2013-12-17 20:12:51 +00:00
omap_intc.c hw: cannot_instantiate_with_device_add_yet due to pointer props 2013-12-24 17:27:17 +01:00
openpic_kvm.c hw/i*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
openpic.c intc/openpic: Build openpic only once 2013-07-09 21:33:02 +02:00
pl190.c sysbus: Set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:22 +01:00
puv3_intc.c puv3_intc: QOM cast cleanup 2013-07-29 21:06:58 +02:00
realview_gic.c realview_gic: Prepare for QOM embedding 2013-11-05 17:47:30 +01:00
sh_intc.c cpu: Make first_cpu and next_cpu CPUState 2013-07-09 21:32:54 +02:00
slavio_intctl.c slavio_intctl: QOM cast cleanup 2013-07-29 21:06:58 +02:00
xics_kvm.c xics-kvm: enable irqfd for MSI 2013-10-25 23:25:47 +02:00
xics.c spapr-rtas: replace return code constants with macros 2013-12-20 01:57:59 +01:00
xilinx_intc.c xilinx_intc: QOM cast cleanup 2013-07-29 21:06:58 +02:00