From patchwork Tue Jun 30 13:07:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 50476 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F40CD229DF for ; Tue, 30 Jun 2015 13:07:43 +0000 (UTC) Received: by wgjx7 with SMTP id x7sf3680128wgj.3 for ; Tue, 30 Jun 2015 06:07:43 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=vII5Ue3bCUkqYj4VGHftC7IhAgIr164gKROfJUUoaGU=; b=Z6Ni1Kaefv92thXGlYaI7W4eZGV3IY33VXTJahqnRCjzOHFz1906SAKLcmhZNr4+MD Gq9ruEsJu+AK+K4DqyF9iArd5FGtNrSusYs1VFyV0+1IagHmxtqLmqhIZl0Rd7Ww3Hwj 4cMSLdHf8ozPdkpJpiqFLAnXXM7MjFLPyzqQKihpO9R2EAcPj9aFM5G97ddppSa+53ry MJnQ3mpZP9J6nx5N+HP1P/ZHSA/SN5zhAxOsiZleFVSYRwaJ/cMlgJPrhZUiRhbbbYph VXSdpOY24YOQ0Zkwq1Vfcj4lLd1TJ9ga6ZcOPekajf/qbHsa+NorSPprxtHqqQJhKP3+ 9ZsA== X-Gm-Message-State: ALoCoQm9Ao3VebU7nlbAvX4vA4egQ4iPW1INmX8tvSUgxvT7qRGjzK9xQueNJmi0BN9n2aMm6Y8S X-Received: by 10.112.14.101 with SMTP id o5mr14029006lbc.3.1435669662950; Tue, 30 Jun 2015 06:07:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.161 with SMTP id jp1ls38572lab.96.gmail; Tue, 30 Jun 2015 06:07:42 -0700 (PDT) X-Received: by 10.152.10.72 with SMTP id g8mr19298934lab.97.1435669662806; Tue, 30 Jun 2015 06:07:42 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ci2si3459810lbd.65.2015.06.30.06.07.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 06:07:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lagx9 with SMTP id x9so12666902lag.1 for ; Tue, 30 Jun 2015 06:07:42 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr19437745lay.72.1435669662348; Tue, 30 Jun 2015 06:07:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2437267lbb; Tue, 30 Jun 2015 06:07:41 -0700 (PDT) X-Received: by 10.60.85.39 with SMTP id e7mr19167293oez.81.1435669657703; Tue, 30 Jun 2015 06:07:37 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id n15si32453257pdj.103.2015.06.30.06.07.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 30 Jun 2015 06:07:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Z9vG5-0000nU-Rz; Tue, 30 Jun 2015 14:07:29 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Peter Crosthwaite , "Edgar E. Iglesias" , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 1/5] hw/intc/arm_gic_common.c: Reset all registers Date: Tue, 30 Jun 2015 14:07:25 +0100 Message-Id: <1435669649-3035-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1435669649-3035-1-git-send-email-peter.maydell@linaro.org> References: <1435669649-3035-1-git-send-email-peter.maydell@linaro.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.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The arm_gic_common reset function was missing reset code for several of the GIC's state fields: * bpr[] * abpr[] * priority1[] * priority2[] * sgi_pending[] * irq_target[] (SMP configurations only) These probably went unnoticed because most guests will either never touch them, or will write to them in the process of configuring the GIC before enabling interrupts. Signed-off-by: Peter Maydell --- hw/intc/arm_gic_common.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 044ad66..a64d071 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -123,7 +123,7 @@ static void arm_gic_common_realize(DeviceState *dev, Error **errp) static void arm_gic_common_reset(DeviceState *dev) { GICState *s = ARM_GIC_COMMON(dev); - int i; + int i, j; memset(s->irq_state, 0, GIC_MAXIRQ * sizeof(gic_irq_state)); for (i = 0 ; i < s->num_cpu; i++) { if (s->revision == REV_11MPCORE) { @@ -135,15 +135,30 @@ static void arm_gic_common_reset(DeviceState *dev) s->running_irq[i] = 1023; s->running_priority[i] = 0x100; s->cpu_ctlr[i] = 0; + s->bpr[i] = GIC_MIN_BPR; + s->abpr[i] = GIC_MIN_ABPR; + for (j = 0; j < GIC_INTERNAL; j++) { + s->priority1[j][i] = 0; + } + for (j = 0; j < GIC_NR_SGIS; j++) { + s->sgi_pending[j][i] = 0; + } } for (i = 0; i < GIC_NR_SGIS; i++) { GIC_SET_ENABLED(i, ALL_CPU_MASK); GIC_SET_EDGE_TRIGGER(i); } - if (s->num_cpu == 1) { + + for (i = 0; i < ARRAY_SIZE(s->priority2); i++) { + s->priority2[i] = 0; + } + + for (i = 0; i < GIC_MAXIRQ; i++) { /* For uniprocessor GICs all interrupts always target the sole CPU */ - for (i = 0; i < GIC_MAXIRQ; i++) { + if (s->num_cpu == 1) { s->irq_target[i] = 1; + } else { + s->irq_target[i] = 0; } } s->ctlr = 0;