From nobody Tue Feb 10 22:18:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516381701233791.9473888315994; Fri, 19 Jan 2018 09:08:21 -0800 (PST) Received: from localhost ([::1]:59965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eca9M-0001hB-FD for importer@patchew.org; Fri, 19 Jan 2018 12:08:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecY7W-0002pF-AG for qemu-devel@nongnu.org; Fri, 19 Jan 2018 09:58:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecY7V-0003mY-Ej for qemu-devel@nongnu.org; Fri, 19 Jan 2018 09:58:18 -0500 Received: from greensocs.com ([193.104.36.180]:39271) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecY7Q-0003iJ-07; Fri, 19 Jan 2018 09:58:12 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id E0338319FD9; Fri, 19 Jan 2018 15:58:02 +0100 (CET) Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gFFmqKY4nc5C; Fri, 19 Jan 2018 15:58:01 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id 56E995E2F8; Fri, 19 Jan 2018 15:58:00 +0100 (CET) Received: from michell-laptop.hive.antfield.fr (tima-dhcp-h14.imag.fr [147.171.132.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luc.michel@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id 109C9319FC8; Fri, 19 Jan 2018 15:58:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1516373882; bh=v+8I3H1qOqPd2WU9LWyfosRG0vDqmGje0yEI+Fsyyg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=7a9JZIa8ayVlAqcYbgJU2tVEH293HQOLYeKYyg27d+BCLrnx6BNDo+r8gI3MMllf6 Zoml2ETjJYhlFvW9Rc2PRzTWtldiF4/hZDBRr1x5JAqQf9ll+CLzDUnIpvpZ1U/ne4 Lc2I1w6ObaXPySbcxY7yCydUd1yH6+mK6OZp7qo8= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com header.b=tSpuIPYz; dkim=pass (1024-bit key) header.d=greensocs.com header.b=tSpuIPYz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1516373880; bh=v+8I3H1qOqPd2WU9LWyfosRG0vDqmGje0yEI+Fsyyg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tSpuIPYzP4aWXyPfcXrerPQtWwfMfEF6crRt9Ie1vgtOjTwhNkM6RUdZrG0RfovLk w85GBNHGTpBfRWm2KJLmRpE47vDM2hP/6mwx6wvG7t6uIUhayVSEqSp3Tg3/Hvw06R C3zkx9LxvbwXlgGiLVcaknbVieDAevb08YgIyews= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1516373880; bh=v+8I3H1qOqPd2WU9LWyfosRG0vDqmGje0yEI+Fsyyg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tSpuIPYzP4aWXyPfcXrerPQtWwfMfEF6crRt9Ie1vgtOjTwhNkM6RUdZrG0RfovLk w85GBNHGTpBfRWm2KJLmRpE47vDM2hP/6mwx6wvG7t6uIUhayVSEqSp3Tg3/Hvw06R C3zkx9LxvbwXlgGiLVcaknbVieDAevb08YgIyews= From: luc.michel@greensocs.com To: qemu-devel@nongnu.org Date: Fri, 19 Jan 2018 15:57:54 +0100 Message-Id: <20180119145756.7629-4-luc.michel@greensocs.com> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180119145756.7629-1-luc.michel@greensocs.com> References: <20180119145756.7629-1-luc.michel@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 193.104.36.180 X-Mailman-Approved-At: Fri, 19 Jan 2018 11:42:55 -0500 Subject: [Qemu-devel] [PATCH 2/4] hw/intc/arm_gic: Fix C_RPR value on idle priority X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" , Peter Maydell , Alistair Francis , qemu-arm@nongnu.org, Luc MICHEL Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Luc MICHEL When there is no active interrupts in the GIC, a read to the C_RPR register should return the value of the "Idle priority", which is either the maximum value an IRQ priority field can be set to, or 0xff. Since the QEMU GIC model implements all the 8 priority bits, the Idle priority is 0xff. Internally, when there is no active interrupt, the running priority value is 0x100. The gic_get_running_priority function returns an uint8_t and thus, truncate this value to 0x00 when returning it. This is wrong since a value of 0x00 correspond to the maximum possible priority. This commit fixes the returned value when the internal value is 0x100. Note that it is correct for the Non-Secure view to return 0xff even though from the NS world point of view, only 7 priority bits are implemented. The specification states that the Idle priority can be 0xff even when not all the 8 priority bits are implemented. This has been verified against a real GICv2 hardware on a Xilinx ZynqMP based board. Regarding the ARM11MPCore version of the GIC, the specification is not clear on that point, so this commit does not alter its behavior. Signed-off-by: Luc MICHEL --- hw/intc/arm_gic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index dad383ea12..713de3084f 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -504,6 +504,11 @@ static void gic_set_cpu_control(GICState *s, int cpu, = uint32_t value, =20 static uint8_t gic_get_running_priority(GICState *s, int cpu, MemTxAttrs a= ttrs) { + if ((s->revision !=3D REV_11MPCORE) && (s->running_priority[cpu] > 0xf= f)) { + /* Idle priority */ + return 0xff; + } + if (s->security_extn && !attrs.secure) { if (s->running_priority[cpu] & 0x80) { /* Running priority in upper half of range: return the Non-sec= ure --=20 2.16.0