From patchwork Tue Sep 8 16:51:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 53286 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id DAED022B05 for ; Tue, 8 Sep 2015 17:23:53 +0000 (UTC) Received: by lanb10 with SMTP id b10sf41073440lan.3 for ; Tue, 08 Sep 2015 10:23:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=+OfxVrwd7ZvN+KbaUPPChwvY8ArUTKRyhAXkLkcXM7o=; b=V2zU+Qzki+juSjyE2q73d7oTd2hz6WrNP086wZDGIUuXAu8AjUE525xhFHWebzEPqH kjMe30W6EiyAB8c9Bp6T2+5amfCe6lX2AYqowFb4fqBj4g37IrzTMSmC4KDutMvY9ok3 aPwymoxNfgXRaBxnQwq0f7qJExfSpahh8GCGYyU/PaB1IM2haF6E2+8I3IghwUp/yrPv BFFB5nJNwSIgvxHS5BvvEaIFU27pgVjSa90dUljm5s4rtyKTyu+kLAMDbOj3gD02WEJH FK6OLXJiF1Mv9i5DcAEny681kUfvd+E41a+jboILmLIgHr0S/A+OM4i+TgCj0YplEUms w9RA== X-Gm-Message-State: ALoCoQmrBPdwu1SPuXK6osgSUkWCAAEtCUHmKZt4CPK4+52Ay9sX9V/09j4xEi9C5zOQXbBZBTIj X-Received: by 10.194.118.65 with SMTP id kk1mr6942085wjb.5.1441733032804; Tue, 08 Sep 2015 10:23:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.130 with SMTP id r2ls85459laa.87.gmail; Tue, 08 Sep 2015 10:23:52 -0700 (PDT) X-Received: by 10.152.37.227 with SMTP id b3mr23659821lak.91.1441733032623; Tue, 08 Sep 2015 10:23:52 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id l10si3876982lah.173.2015.09.08.10.23.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 10:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbcjc2 with SMTP id jc2so57356184lbc.0 for ; Tue, 08 Sep 2015 10:23:52 -0700 (PDT) X-Received: by 10.152.18.164 with SMTP id x4mr24515487lad.35.1441733032504; Tue, 08 Sep 2015 10:23:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1112069lbq; Tue, 8 Sep 2015 10:23:51 -0700 (PDT) X-Received: by 10.140.85.165 with SMTP id n34mr37340293qgd.83.1441733030064; Tue, 08 Sep 2015 10:23:50 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s21si4574163qgs.97.2015.09.08.10.23.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 08 Sep 2015 10:23:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZMAU-0006df-Bp for patch@linaro.org; Tue, 08 Sep 2015 12:54:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZM7X-0002Wa-Nl for qemu-devel@nongnu.org; Tue, 08 Sep 2015 12:51:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZM7R-0007lO-Pa for qemu-devel@nongnu.org; Tue, 08 Sep 2015 12:51:47 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZM7R-0007b2-Id for qemu-devel@nongnu.org; Tue, 08 Sep 2015 12:51:41 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZZM7I-0001ha-7F for qemu-devel@nongnu.org; Tue, 08 Sep 2015 17:51:32 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 8 Sep 2015 17:51:13 +0100 Message-Id: <1441731092-6513-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1441731092-6513-1-git-send-email-peter.maydell@linaro.org> References: <1441731092-6513-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 01/20] armv7m_nvic: Implement ICSR without using internal GIC state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Change the implementation of the Interrupt Control and State Register in the v7M NVIC to not use the running_irq and last_active internal state fields in the GIC. These fields don't correspond to state in a real GIC and will be removed soon. The changes to the ICSR are: * the VECTACTIVE field is documented as identical to the IPSR[8:0] field, so implement it that way * implement RETTOBASE via looking at the active state bits Signed-off-by: Peter Maydell Message-id: 1438089748-5528-2-git-send-email-peter.maydell@linaro.org --- hw/intc/armv7m_nvic.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index e13b729..3ec8408 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -185,26 +185,25 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset) return cpu->midr; case 0xd04: /* Interrupt Control State. */ /* VECTACTIVE */ - val = s->gic.running_irq[0]; + cpu = ARM_CPU(current_cpu); + val = cpu->env.v7m.exception; if (val == 1023) { val = 0; } else if (val >= 32) { val -= 16; } - /* RETTOBASE */ - if (s->gic.running_irq[0] == 1023 - || s->gic.last_active[s->gic.running_irq[0]][0] == 1023) { - val |= (1 << 11); - } /* VECTPENDING */ if (s->gic.current_pending[0] != 1023) val |= (s->gic.current_pending[0] << 12); - /* ISRPENDING */ + /* ISRPENDING and RETTOBASE */ for (irq = 32; irq < s->num_irq; irq++) { if (s->gic.irq_state[irq].pending) { val |= (1 << 22); break; } + if (irq != cpu->env.v7m.exception && s->gic.irq_state[irq].active) { + val |= (1 << 11); + } } /* PENDSTSET */ if (s->gic.irq_state[ARMV7M_EXCP_SYSTICK].pending)