From patchwork Thu Aug 13 10:44:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 52380 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 6AEC62031F for ; Thu, 13 Aug 2015 11:10:14 +0000 (UTC) Received: by wilj18 with SMTP id j18sf15924058wil.0 for ; Thu, 13 Aug 2015 04:10:13 -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=8oXMPC1mwLErxlZD1W0utj8Le6gFSJPcAVsXdjHsygg=; b=e+9XC0beg8dcjm1ba7AyUilJEYEC/k3B651NhrjXNLVj8sQlB5GpEOumJPNbRGQxKM SvtMQhnz4qYJPBBSjrb1m4ZiPe6uUQzSiF80ZvtFmZvbN3IK9IOTGdqku++nFeNC27QI wi/ceGPoDjvbbLohQk327KX8n2/F8oeO9uHkF+yCyGMte6F0bV/w02KT9YQcNqe0voJr kfUhBuan+WhGQljPSJ0h8Nb6nor6W8iSQAQJMHAeYjJea6RD7YoGK467SvfDpD2/yjKz H0+EcCxmxfhtYC88bpc7/janWGhYtCbBT6R3GGoltWzucQiyx7U6xzFY5Kmdj0InXvEm Ikyw== X-Gm-Message-State: ALoCoQkIYUMztHBws85BeGNHFfqWvYdd3vJjdPTX9bhevvDF9kJYDewKfZQ6QS3r+F5v6+1Z7uGh X-Received: by 10.112.138.2 with SMTP id qm2mr11119818lbb.19.1439464213734; Thu, 13 Aug 2015 04:10:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.33 with SMTP id f1ls201869lab.49.gmail; Thu, 13 Aug 2015 04:10:13 -0700 (PDT) X-Received: by 10.152.44.196 with SMTP id g4mr17512196lam.56.1439464213457; Thu, 13 Aug 2015 04:10:13 -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 ra3si1848125lbb.160.2015.08.13.04.10.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 04:10:13 -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 lbbtg9 with SMTP id tg9so25175377lbb.1 for ; Thu, 13 Aug 2015 04:10:13 -0700 (PDT) X-Received: by 10.152.22.133 with SMTP id d5mr29244300laf.112.1439464213321; Thu, 13 Aug 2015 04:10:13 -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.7.198 with SMTP id l6csp868871lba; Thu, 13 Aug 2015 04:10:12 -0700 (PDT) X-Received: by 10.50.129.10 with SMTP id ns10mr29214845igb.90.1439464196439; Thu, 13 Aug 2015 04:09:56 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l16si1234136iod.1.2015.08.13.04.09.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Aug 2015 04:09:56 -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]:41860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPqOR-0006xf-7T for patch@linaro.org; Thu, 13 Aug 2015 07:09:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPq0T-0005b8-Qo for qemu-devel@nongnu.org; Thu, 13 Aug 2015 06:45:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPq0N-0005Sm-L6 for qemu-devel@nongnu.org; Thu, 13 Aug 2015 06:45:09 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPq0N-0005DT-DU for qemu-devel@nongnu.org; Thu, 13 Aug 2015 06:45:03 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZPq08-000720-D9 for qemu-devel@nongnu.org; Thu, 13 Aug 2015 11:44:48 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 13 Aug 2015 11:44:45 +0100 Message-Id: <1439462687-26903-26-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1439462687-26903-1-git-send-email-peter.maydell@linaro.org> References: <1439462687-26903-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 25/27] hw/arm/virt: Wire up secure timer interrupt 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.178 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 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 Message-id: 1437047249-2357-4-git-send-email-peter.maydell@linaro.org Reviewed-by: Edgar E. Iglesias --- 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 94694d6..d5a8417 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -391,20 +391,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,