From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCLNC-0004pk-Gf for qemu-devel@nongnu.org; Mon, 13 Jun 2016 02:29:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCLN9-0004Vs-Bi for qemu-devel@nongnu.org; Mon, 13 Jun 2016 02:29:22 -0400 Message-ID: <575E5239.6030408@huawei.com> Date: Mon, 13 Jun 2016 14:27:05 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1464274540-19693-1-git-send-email-peter.maydell@linaro.org> <1464274540-19693-12-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1464274540-19693-12-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 11/22] hw/intc/arm_gicv3: Implement GICv3 distributor registers 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: > +static uint8_t gicd_read_ipriorityr(GICv3State *s, MemTxAttrs attrs, int irq) > +{ > + /* Read the value of GICD_IPRIORITYR for the specified interrupt, > + * honouring security state (these are RAZ/WI for Group 0 or Secure > + * Group 1 interrupts). > + */ > + uint32_t prio; > + > + if (irq < GIC_INTERNAL || irq >= s->num_irq) { > + return 0; > + } > + > + prio = s->gicd_ipriority[irq]; > + > + if (!attrs.secure && !(s->gicd_ctlr & GICD_CTLR_DS)) { > + if (!gicv3_gicd_group_test(s, irq)) { > + /* Fields for Group 0 or Secure Group 1 interrupts are RAZ/WI */ Here this check assure this interrupt belongs to Group 0 and NS access is not permitted, so it should return 0. But it doesn't say anything about Secure Group 1. > + return 0; > + } > + /* NS view of the interrupt priority */ > + prio = (prio << 1) & 0xff; > + } So maybe here it should check if attrs.secure is true and the Group is 1, then return 0. > + return prio; > +} > + > +static void gicd_write_ipriorityr(GICv3State *s, MemTxAttrs attrs, int irq, > + uint8_t value) > +{ > + /* Write the value of GICD_IPRIORITYR for the specified interrupt, > + * honouring security state (these are RAZ/WI for Group 0 or Secure > + * Group 1 interrupts). > + */ > + if (irq < GIC_INTERNAL || irq >= s->num_irq) { > + return; > + } > + > + if (!attrs.secure && !(s->gicd_ctlr & GICD_CTLR_DS)) { > + if (!gicv3_gicd_group_test(s, irq)) { > + /* Fields for Group 0 or Secure Group 1 interrupts are RAZ/WI */ Same here. > + return; > + } > + /* NS view of the interrupt priority */ > + value = 0x80 | (value >> 1); > + } > + s->gicd_ipriority[irq] = value; > +} -- Shannon