[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 4/8] hw: arm_gic: Keep track of SGI sources
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v5 4/8] hw: arm_gic: Keep track of SGI sources |
Date: |
Fri, 31 Jan 2014 18:33:25 +0000 |
On 28 January 2014 20:32, Christoffer Dall <address@hidden> wrote:
> Right now the arm gic emulation doesn't keep track of the source of an
> SGI (which apparently Linux guests don't use, or they're fine with
> assuming CPU 0 always).
>
> Add the necessary matrix on the GICState structure and maintain the data
> when setting and clearing the pending state of an IRQ and make the state
> visible to the guest.
>
> Note that we always choose to present the source as the lowest-numbered
> CPU in case multiple cores have signalled the same SGI number to a core
> on the system.
> @@ -531,9 +576,29 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
> GIC_CLEAR_EDGE_TRIGGER(irq + i);
> }
> }
> - } else {
> + } else if (offset < 0xf10) {
> /* 0xf00 is only handled for 32-bit writes. */
> goto bad_reg;
> + } else if (offset < 0xf20) {
> + /* GICD_CPENDSGIRn */
> + if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
> + goto bad_reg;
> + }
> + irq = (offset - 0xf10);
> +
> + GIC_CLEAR_PENDING(irq, 1 << cpu);
> + s->sgi_pending[irq][cpu] &= ~value;
This doesn't look quite right. If the SGI is pending
from multiple source CPUs and we use CPENDSGIRn to
clear the bits corresponding to only some of those
source CPUs, then the interrupt as a whole should stay
pending on this (target) CPU. I think this is:
s->sgi_pending[irq][cpu] &= ~value;
if (s->sgi_pending[irq][cpu] == 0) {
GIC_CLEAR_PENDING(irq, 1 << cpu);
}
(compare the code in gic_acknowledge_irq())
If you fix that, then
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-devel] [PATCH v5 0/8] Support arm-gic-kvm save/restore, Christoffer Dall, 2014/01/28
- [Qemu-devel] [PATCH v5 2/8] arm_gic: Fix GICD_ICPENDR and GICD_ISPENDR writes, Christoffer Dall, 2014/01/28
- [Qemu-devel] [PATCH v5 1/8] arm_gic: Introduce define for GIC_NR_SGIS, Christoffer Dall, 2014/01/28
- [Qemu-devel] [PATCH v5 3/8] arm_gic: Fix GIC pending behavior, Christoffer Dall, 2014/01/28
- [Qemu-devel] [PATCH v5 4/8] hw: arm_gic: Keep track of SGI sources, Christoffer Dall, 2014/01/28
- Re: [Qemu-devel] [PATCH v5 4/8] hw: arm_gic: Keep track of SGI sources,
Peter Maydell <=
- [Qemu-devel] [PATCH v5 5/8] arm_gic: Support setting/getting binary point reg, Christoffer Dall, 2014/01/28
- [Qemu-devel] [PATCH v5 6/8] vmstate: Add uint32 2D-array support, Christoffer Dall, 2014/01/28
- [Qemu-devel] [PATCH v5 7/8] arm_gic: Add GICC_APRn state to the GICState, Christoffer Dall, 2014/01/28
- [Qemu-devel] [PATCH v5 8/8] hw: arm_gic_kvm: Add KVM VGIC save/restore logic, Christoffer Dall, 2014/01/28
- Re: [Qemu-devel] [PATCH v5 0/8] Support arm-gic-kvm save/restore, Peter Maydell, 2014/01/29