From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Neq-0001zv-U7 for qemu-devel@nongnu.org; Thu, 19 May 2016 09:06:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Nem-0006gk-Mw for qemu-devel@nongnu.org; Thu, 19 May 2016 09:06:31 -0400 Message-ID: <573DB8A2.1000701@huawei.com> Date: Thu, 19 May 2016 20:59:14 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1462814989-24360-1-git-send-email-peter.maydell@linaro.org> <1462814989-24360-11-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1462814989-24360-11-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/23] hw/intc/arm_gicv3: Implement functions to identify next pending 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/10 1:29, Peter Maydell wrote: > + uint32_t pend, grpmask; > + uint32_t pending = *gic_bmp_ptr32(s->pending, irq - GIC_INTERNAL); > + uint32_t edge_trigger = *gic_bmp_ptr32(s->edge_trigger, irq - GIC_INTERNAL); > + uint32_t level = *gic_bmp_ptr32(s->level, irq - GIC_INTERNAL); > + uint32_t group = *gic_bmp_ptr32(s->group, irq - GIC_INTERNAL); > + uint32_t grpmod = *gic_bmp_ptr32(s->grpmod, irq - GIC_INTERNAL); > + uint32_t enable = *gic_bmp_ptr32(s->enabled, irq - GIC_INTERNAL); > + Since you use "irq - GIC_INTERNAL" many times, how about moving into the gic_bmp_ptr32()? [...] > +/* Update the GIC status after state in the distributor has > + * changed affecting @len interrupts starting at @start, > + * but don't tell the CPU i/f. > + */ > +static void gicv3_update_noirqset(GICv3State *s, int start, int len) > +{ > + int i; > + uint8_t prio; > + uint32_t pend = 0; > + > + for (i = 0; i < s->num_cpu; i++) { > + s->cpu[i].seenbetter = false; > + } > + > + /* Find the highest priority pending interrupt in this range. */ > + for (i = start; i < start + len; i++) { > + GICv3CPUState *cs; > + The i should start from GIC_INTERNAL or you should change the parameter of the callers. > + if (i == start || (i & 0x1f) == 0) { > + /* Calculate the next 32 bits worth of pending status */ > + pend = gicd_int_pending(s, i & ~0x1f); > + } > + [...] > + > + /* Note that we can guarantee that these functions will not > + * recursively call back into gicv3_full_update(), because > + * at each point the "previous best" is always outside the > + * range we ask them to update. > + */ > + gicv3_update_noirqset(s, 0, s->num_irq); > + use GIC_INTERNAL instead of 0? > /** > + * gicv3_irq_group: > + * > + * Return the group which this interrupt is configured as (GICV3_G0, > + * GICV3_G1 or GICV3_G1NS). > + */ > +static inline int gicv3_irq_group(GICv3State *s, GICv3CPUState *cs, int irq) use uint32_t instead of int in this and other functions? Thanks, -- Shannon