From nobody Mon Feb 9 05:17:07 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557230912; cv=none; d=zoho.com; s=zohoarc; b=RUqnLOpO8KSGKxOTkwB9dS+IEsHqZuD3J4N+Am4qyxfBCH8OqpW51zlBMsX1mO6n0QB0TCmcLXEmVc8FmJO2QvKr/8FFqN6JxPNFAb8EShsFcBOi37Fj1UlvEKp2h8E4GvPWKZS86VF4GNhCmQ8UTWxVeD2RQD0vCs7LsiedTEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557230912; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4X9sIu0YHhUgKH1JkMRhAu/b2BTcREHijf9rjBQvr1M=; b=GqKXSG406fK8CpvnbXe5pKGo0twhCHhsaLLRCU7ZQciOyvHldXoB9httV/QibMyktQW2jG733h5kfp/VM98LqO7C2F7ccjS08AfHNLHJNL/JB76ChESTSbB6mFJ9vxifc5u0h5612uQ7sjqv+jxIuQ1DjX0gPwpfg+jbwUyqMy0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557230912118439.25988826071887; Tue, 7 May 2019 05:08:32 -0700 (PDT) Received: from localhost ([127.0.0.1]:45707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNytM-0004ub-OV for importer@patchew.org; Tue, 07 May 2019 08:08:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNyls-0007es-FY for qemu-devel@nongnu.org; Tue, 07 May 2019 08:00:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNylr-0003tY-Ay for qemu-devel@nongnu.org; Tue, 07 May 2019 08:00:32 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:50237) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNylr-0003sk-2w for qemu-devel@nongnu.org; Tue, 07 May 2019 08:00:31 -0400 Received: by mail-wm1-x335.google.com with SMTP id p21so20096483wmc.0 for ; Tue, 07 May 2019 05:00:31 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id g3sm12348596wmf.9.2019.05.07.05.00.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 05:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4X9sIu0YHhUgKH1JkMRhAu/b2BTcREHijf9rjBQvr1M=; b=yHqgs6Gin2rh9sgOlzbNyzAKEozyhGUduxcLnaVx1ixK/fZpHp63Zgi7YYCc4lE/FH M12euWCVPrzIt8W+XWf2NXdaihoCWD+llKBNCknbY6qkFdcqJrtx819qYCbeTN003LSF +w9uInyLEz1Du1NKwQrtdUSV3nLnXQtdn5EqqySjcTYNR3U+XT8AywqYs0Zb2lbZZcUv jljHZQXpZS9rcdUdOB2VyUlwWTyoVxnXo2x4k6M2OEvJSORhSpfIxPV+3G1rwDzz44SN paO5H2/G26Y3DVqnZ+fW89HOEmcPb+2S+N3cKMKazwJ7CPrFoTGAIAg8n4M+GECq0xw6 WXHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4X9sIu0YHhUgKH1JkMRhAu/b2BTcREHijf9rjBQvr1M=; b=Q1lKfTbiPvyMaN07gVqIGkvrDr1CP58aXpTSDco+qm3LWT11Olwz5garr/a1QT4/iD XRJ4p195gt3tf+faY3rDpF6WXsLZFSZxUtPR+JkEKE8E9XH7qmw8t/C8QUwFu+kjnZDf 53WNhgHavL9AIsVScZc41/v1GzjDW+EKvNprVXtH/gOAGoizoppltRUv5PKIz9p5dunk JAg6AjCvEUV/4TTiY+Ewp9JORtHMe5Ilgy2gVme6bIBndol9NAN52wEfTf/HJKNefXVX u+A7TmTv9CZmqqgePS5WfTL8lQU4fB6AhKJh1cCdiJ3kY6NVbnHbUr+PVeN9ADLrmT9+ T4Lw== X-Gm-Message-State: APjAAAWSwArHIWrkx2hAllSp9GkAwFcTuJRvbYYNFXVIra9JXRuQ3CxI ovPSUJS3JEotk+20TbUlHHsVTP1AY2s= X-Google-Smtp-Source: APXvYqwirlip1MywsFoQJkk5J+gaPhAmLOMCw+fC1p6us/PuB8dwFB+I+ZTfP8ccIvjG3gVkpmBa8g== X-Received: by 2002:a1c:5f42:: with SMTP id t63mr19473242wmb.94.1557230429767; Tue, 07 May 2019 05:00:29 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 7 May 2019 13:00:07 +0100 Message-Id: <20190507120011.18100-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190507120011.18100-1-peter.maydell@linaro.org> References: <20190507120011.18100-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 Subject: [Qemu-devel] [PULL 11/15] hw/arm/armv7m_nvic: Check subpriority in nvic_recompute_state_secure() 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Rule R_CQRV says that if two pending interrupts have the same group priority then ties are broken by looking at the subpriority. We had a comment describing this but had forgotten to actually implement the subpriority comparison. Correct the omission. (The further tie break rules of "lowest exception number" and "secure before non-secure" are handled implicitly by the order in which we iterate through the exceptions in the loops.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190430131439.25251-2-peter.maydell@linaro.org --- hw/intc/armv7m_nvic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index fff6e694e60..131b5938b9a 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -213,6 +213,7 @@ static void nvic_recompute_state_secure(NVICState *s) int active_prio =3D NVIC_NOEXC_PRIO; int pend_irq =3D 0; bool pending_is_s_banked =3D false; + int pend_subprio =3D 0; =20 /* R_CQRV: precedence is by: * - lowest group priority; if both the same then @@ -226,7 +227,7 @@ static void nvic_recompute_state_secure(NVICState *s) for (i =3D 1; i < s->num_irq; i++) { for (bank =3D M_REG_S; bank >=3D M_REG_NS; bank--) { VecInfo *vec; - int prio; + int prio, subprio; bool targets_secure; =20 if (bank =3D=3D M_REG_S) { @@ -241,8 +242,12 @@ static void nvic_recompute_state_secure(NVICState *s) } =20 prio =3D exc_group_prio(s, vec->prio, targets_secure); - if (vec->enabled && vec->pending && prio < pend_prio) { + subprio =3D vec->prio & ~nvic_gprio_mask(s, targets_secure); + if (vec->enabled && vec->pending && + ((prio < pend_prio) || + (prio =3D=3D pend_prio && prio >=3D 0 && subprio < pend_s= ubprio))) { pend_prio =3D prio; + pend_subprio =3D subprio; pend_irq =3D i; pending_is_s_banked =3D (bank =3D=3D M_REG_S); } --=20 2.20.1