Received: from eggs.gnu.org ([2001:4830:134:3::10]:51443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCMdp-0002LG-0T for qemu-devel@nongnu.org; Mon, 13 Jun 2016 03:50:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCMdk-0003Z8-SG for qemu-devel@nongnu.org; Mon, 13 Jun 2016 03:50:35 -0400 Message-ID: <575E65A4.1080802@huawei.com> Date: Mon, 13 Jun 2016 15:49:56 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1464274540-19693-1-git-send-email-peter.maydell@linaro.org> <1464274540-19693-15-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1464274540-19693-15-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 14/22] hw/intc/arm_gicv3: Implement gicv3_set_irq() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, Shlomo Pongratz , Shlomo Pongratz , Pavel Fedin , Shannon Zhao , Christoffer Dall On 2016/5/26 22:55, Peter Maydell wrote: > Implement the code which updates the GIC state when an interrupt > input into the GIC is asserted. > > Signed-off-by: Peter Maydell > --- > hw/intc/arm_gicv3.c | 20 +++++++++++++++++++- > hw/intc/arm_gicv3_dist.c | 21 +++++++++++++++++++++ > hw/intc/arm_gicv3_redist.c | 21 +++++++++++++++++++++ > hw/intc/gicv3_internal.h | 2 ++ > trace-events | 2 ++ > 5 files changed, 65 insertions(+), 1 deletion(-) > > diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c > index e8f6766..e770409 100644 > --- a/hw/intc/arm_gicv3.c > +++ b/hw/intc/arm_gicv3.c > @@ -311,7 +311,25 @@ static void gicv3_set_irq(void *opaque, int irq, int level) > * [N+32..N+63] : PPI (internal interrupts for CPU 1 > * ... > */ > - /* Do nothing for now */ > + GICv3State *s = opaque; > + > + if (irq < (s->num_irq - GIC_INTERNAL)) { > + /* external interrupt (SPI) */ > + gicv3_dist_set_irq(s, irq + GIC_INTERNAL, level); > + } else { > + /* per-cpu interrupt (PPI) */ > + int cpu; > + > + irq -= (s->num_irq - GIC_INTERNAL); > + cpu = irq / GIC_INTERNAL; > + irq %= GIC_INTERNAL; > + assert(cpu < s->num_cpu); > + /* Raising SGIs via this function would be a bug in how the board > + * model wires up interrupts. > + */ > + assert(irq >= 16 && irq < 32); Nit: Use GIC_NR_SGIS instead and irq < 32 is unnecessary. Reviewed-by: Shannon Zhao -- Shannon