From patchwork Thu Jul 16 11:47:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 51175 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C328B22A28 for ; Thu, 16 Jul 2015 11:47:36 +0000 (UTC) Received: by lafd3 with SMTP id d3sf18124132laf.1 for ; Thu, 16 Jul 2015 04:47:35 -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=aRghDKrm+XPWUQBU8F5eRjB4DhebZUsjSbDyA33J5J8=; b=ehguaRIT1Vft31SEVgH4gKZhPwewpfqULiq1/cj09IAKNkFIoEPQuey8ZUccCxlRDy 7sUPgPIacJw/SvSEgk2gy1eIPGc/n1FkS/FXPfTk/B2087mEwLbCTk63BxNjxKT/r9fC u1dV3jCh42X9v4rPTM9IrWh4L08kMwhV+rhClUgfM/Vlan82JnHXd6I9fmx2Pfrrilod b5gQCjgsbRDVuinPL+q+Z97yJX004exFl+bfS0Rp4Zlbx1wjla1HvqBmlyyx9K6TYVeQ iQf1sbOkyijW5NQaoTtl8IY47VHuPQcN8YyL20bbCztHl+L9T4j4o/SrHPW2neYA1/Xe TI0Q== X-Gm-Message-State: ALoCoQkcjWycWlZ3Oj1rR/yDcIyEs4egNVin9yXIMiekDsFgJl0F8W2IvN9QSEDB4Bzu3CP0inu/ X-Received: by 10.112.28.111 with SMTP id a15mr4722848lbh.21.1437047255831; Thu, 16 Jul 2015 04:47:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.242.2 with SMTP id wm2ls329566lac.38.gmail; Thu, 16 Jul 2015 04:47:35 -0700 (PDT) X-Received: by 10.112.118.67 with SMTP id kk3mr8981281lbb.26.1437047255686; Thu, 16 Jul 2015 04:47:35 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id ay4si6750096lab.9.2015.07.16.04.47.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 04:47:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lblf12 with SMTP id f12so42024190lbl.2 for ; Thu, 16 Jul 2015 04:47:35 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr8734933lac.41.1437047255599; Thu, 16 Jul 2015 04:47:35 -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 hn6csp201650lbb; Thu, 16 Jul 2015 04:47:35 -0700 (PDT) X-Received: by 10.112.168.102 with SMTP id zv6mr9023313lbb.45.1437047251825; Thu, 16 Jul 2015 04:47:31 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id e10si6714527lam.131.2015.07.16.04.47.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 04:47:31 -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 1ZFhdR-0000cf-Rg; Thu, 16 Jul 2015 12:47:29 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, "Edgar E. Iglesias" Subject: [PATCH 3/4] hw/arm/virt: Wire up secure timer interrupt Date: Thu, 16 Jul 2015 12:47:28 +0100 Message-Id: <1437047249-2357-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437047249-2357-1-git-send-email-peter.maydell@linaro.org> References: <1437047249-2357-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.217.178 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: , Wire up the secure timer interrupt. Since we've defined that the plain old physical timer is the NS timer, we can drop the now-out-of-date comment about QEMU not having TZ. Use a data-driven loop to wire up the timer interrupts, since we now have four of them and the code is the same for each. Signed-off-by: Peter Maydell --- hw/arm/virt.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index aab99f7..95b1a9a 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -392,20 +392,22 @@ static void create_gic(VirtBoardInfo *vbi, qemu_irq *pic) for (i = 0; i < smp_cpus; i++) { DeviceState *cpudev = DEVICE(qemu_get_cpu(i)); int ppibase = NUM_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; - /* physical timer; we wire it up to the non-secure timer's ID, - * since a real A15 always has TrustZone but QEMU doesn't. + int irq; + /* Mapping from the output timer irq lines from the CPU to the + * GIC PPI inputs we use for the virt board. */ - qdev_connect_gpio_out(cpudev, 0, - qdev_get_gpio_in(gicdev, - ppibase + ARCH_TIMER_NS_EL1_IRQ)); - /* virtual timer */ - qdev_connect_gpio_out(cpudev, 1, - qdev_get_gpio_in(gicdev, - ppibase + ARCH_TIMER_VIRT_IRQ)); - /* Hypervisor timer. */ - qdev_connect_gpio_out(cpudev, 2, - qdev_get_gpio_in(gicdev, - ppibase + ARCH_TIMER_NS_EL2_IRQ)); + const int timer_irq[] = { + [GTIMER_PHYS] = ARCH_TIMER_NS_EL1_IRQ, + [GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ, + [GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ, + [GTIMER_SEC] = ARCH_TIMER_S_EL1_IRQ, + }; + + for (irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) { + qdev_connect_gpio_out(cpudev, irq, + qdev_get_gpio_in(gicdev, + ppibase + timer_irq[irq])); + } sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); sysbus_connect_irq(gicbusdev, i + smp_cpus,