Received: from eggs.gnu.org ([2001:4830:134:3::10]:52926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCMkT-0005If-40 for qemu-devel@nongnu.org; Mon, 13 Jun 2016 03:57:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCMkO-0004XC-Vk for qemu-devel@nongnu.org; Mon, 13 Jun 2016 03:57:28 -0400 Message-ID: <575E673E.2080500@huawei.com> Date: Mon, 13 Jun 2016 15:56:46 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1464274540-19693-1-git-send-email-peter.maydell@linaro.org> <1464274540-19693-17-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1464274540-19693-17-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 16/22] hw/intc/arm_gicv3: Implement gicv3_cpuif_update() 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: > +void gicv3_cpuif_update(GICv3CPUState *cs) > +{ > + /* Tell the CPU about its highest priority pending interrupt */ > + int irqlevel = 0; > + int fiqlevel = 0; > + ARMCPU *cpu = ARM_CPU(cs->cpu); > + CPUARMState *env = &cpu->env; > + > + trace_gicv3_cpuif_update(gicv3_redist_affid(cs), cs->hppi.irq, > + cs->hppi.grp, cs->hppi.prio); > + > + if (cs->hppi.grp == GICV3_G1 && !arm_feature(env, ARM_FEATURE_EL3)) { > + /* If a Security-enabled GIC sends a G1S interrupt to a > + * Security-disabled CPU, we must treat it as if it were G0. > + */ > + cs->hppi.grp = GICV3_G0; > + } > + > + if (icc_hppi_can_preempt(cs)) { > + /* We have an interrupt: should we signal it as IRQ or FIQ? > + * This is described in the GICv3 spec section 4.6.2. > + */ > + bool isfiq; > + > + switch (cs->hppi.grp) { > + case GICV3_G0: > + isfiq = true; > + break; > + case GICV3_G1: > + isfiq = (!arm_is_secure(env) || > + (arm_current_el(env) == 3 && arm_el_is_aa64(env, 3))); > + break; > + case GICV3_G1NS: > + isfiq = arm_is_secure(env); > + break; > + default: > + g_assert_not_reached(); > + } > + > + if (isfiq) { > + fiqlevel = 1; > + } else { > + irqlevel = 1; > + } > + } > + > + trace_gicv3_cpuif_set_irqs(gicv3_redist_affid(cs), fiqlevel, irqlevel); > + > + qemu_set_irq(cs->parent_fiq, fiqlevel); > + qemu_set_irq(cs->parent_irq, irqlevel); Does it need to set both fiq and irq for one interrupt? I think it should be called differently based on the value of isfiq. Thanks, -- Shannon