From patchwork Fri Jan 23 15:02:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43651 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 529E5218DB for ; Fri, 23 Jan 2015 15:03:52 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id bs8sf1695349wib.1 for ; Fri, 23 Jan 2015 07:03:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=Jm3SMR8CBUdT8BTtTKsPweycutFPicXT2IG1G6/PV+g=; b=Rr94g3ObzzMDnZSXBeAej07lvDkBXLS7yusAE43OxZwPuPWitV2ba3BjUOotF9WJVW gXkE3husNb/jGDD7G5mHDiXt2y/KMhu9WsWhmPgCRRfG4QJsEIDGtuk+Fdws7+wZqvkv NfQFrdidl0rqoUxA/S6ZMx7+oJI0FqK5VL+M+Kwp5szNjYVfVYZ9hA1lRNVBOzJOYBPm 2RBLPrxlGWL0kZ+db11y8RVINb8ZT2OwEz8K7T9m5+6NfN7MNSJs4DkE/A+tAfZh/Jeq NX7gjFo1UlXK5QcR2qHl7JQi7UgAWfdKpHsKGeXlsRgAji5vrNxcBhx0Y3AeETcO9Bze 4k+g== X-Gm-Message-State: ALoCoQkuZrAJGJICSiR/YLcJ5ICyusTfmVammlO4IdtmqXDadFTCZ1xrPm5Dmb8ZvCALiasO2p+7 X-Received: by 10.194.142.174 with SMTP id rx14mr73716wjb.4.1422025431675; Fri, 23 Jan 2015 07:03:51 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.168 with SMTP id an8ls291834lac.62.gmail; Fri, 23 Jan 2015 07:03:51 -0800 (PST) X-Received: by 10.152.27.69 with SMTP id r5mr2762089lag.18.1422025431438; Fri, 23 Jan 2015 07:03:51 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id rb6si1625339lbb.8.2015.01.23.07.03.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jan 2015 07:03:51 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id w7so7493562lbi.1 for ; Fri, 23 Jan 2015 07:03:51 -0800 (PST) X-Received: by 10.152.18.135 with SMTP id w7mr7560711lad.47.1422025431197; Fri, 23 Jan 2015 07:03:51 -0800 (PST) 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.9.200 with SMTP id c8csp282946lbb; Fri, 23 Jan 2015 07:03:50 -0800 (PST) X-Received: by 10.107.165.193 with SMTP id o184mr3519415ioe.90.1422025429683; Fri, 23 Jan 2015 07:03:49 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id 71si1280232ioq.82.2015.01.23.07.03.48 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 23 Jan 2015 07:03:49 -0800 (PST) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YEfls-0007Hd-Lt; Fri, 23 Jan 2015 15:03:40 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YEflr-0007HS-Er for edk2-devel@lists.sourceforge.net; Fri, 23 Jan 2015 15:03:39 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.181 as permitted sender) client-ip=209.85.212.181; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f181.google.com; Received: from mail-wi0-f181.google.com ([209.85.212.181]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YEfll-0001ql-Tp for edk2-devel@lists.sourceforge.net; Fri, 23 Jan 2015 15:03:39 +0000 Received: by mail-wi0-f181.google.com with SMTP id fb4so3412931wid.2 for ; Fri, 23 Jan 2015 07:03:27 -0800 (PST) X-Received: by 10.180.90.206 with SMTP id by14mr4771042wib.0.1422025407722; Fri, 23 Jan 2015 07:03:27 -0800 (PST) Received: from ards-macbook-pro.local ([197.129.136.117]) by mx.google.com with ESMTPSA id pl1sm2176036wic.16.2015.01.23.07.03.25 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 07:03:26 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, christoffer.dall@linaro.org, xen-devel@lists.xen.org, ilias.biris@linaro.org Date: Fri, 23 Jan 2015 15:02:50 +0000 Message-Id: <1422025390-8036-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422025390-8036-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422025390-8036-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1YEfll-0001ql-Tp Subject: [edk2] [PATCH v1 01/21] ArmPkg: allow HYP timer interrupt to be omitted X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@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.170 as permitted sender) smtp.mail=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 The DT binding for the ARM generic timer describes the secure, non-secure, virtual and hypervisor timer interrupts, respectively. However, under virtualization, only the virtual timer is usable, and the device tree may omit the hypervisor timer interrupt. (Other timer interrupts cannot be omitted simply due to the fact that the virtual timer is listed third) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/TimerDxe/TimerDxe.c | 14 +++++++++++--- .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c index d0a819fc2729..1169d426b255 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c @@ -369,7 +369,8 @@ TimerInitialize ( { EFI_HANDLE Handle = NULL; EFI_STATUS Status; - UINTN TimerCtrlReg; + UINTN TimerCtrlReg; + UINT32 TimerHypIntrNum; if (ArmIsArchTimerImplemented () == 0) { DEBUG ((EFI_D_ERROR, "ARM Architectural Timer is not available in the CPU, hence cann't use this Driver \n")); @@ -395,8 +396,15 @@ TimerInitialize ( Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 (PcdArmArchTimerVirtIntrNum), TimerInterruptHandler); ASSERT_EFI_ERROR (Status); - Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 (PcdArmArchTimerHypIntrNum), TimerInterruptHandler); - ASSERT_EFI_ERROR (Status); + // + // The hypervisor timer interrupt may be omitted by implementations that + // execute under virtualization. + // + TimerHypIntrNum = PcdGet32 (PcdArmArchTimerHypIntrNum); + if (TimerHypIntrNum != 0) { + Status = gInterrupt->RegisterInterruptSource (gInterrupt, TimerHypIntrNum, TimerInterruptHandler); + ASSERT_EFI_ERROR (Status); + } Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 (PcdArmArchTimerSecIntrNum), TimerInterruptHandler); ASSERT_EFI_ERROR (Status); diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c index 751864d4db9c..4e4f608923d3 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c @@ -274,7 +274,7 @@ InitializeVirtFdtDxe ( // hypervisor timers, in that order. // InterruptProp = fdt_getprop (DeviceTreeBase, Node, "interrupts", &Len); - ASSERT (Len == 48); + ASSERT (Len == 36 || Len == 48); SecIntrNum = fdt32_to_cpu (InterruptProp[0].Number) + (InterruptProp[0].Type ? 16 : 0); @@ -282,7 +282,7 @@ InitializeVirtFdtDxe ( + (InterruptProp[1].Type ? 16 : 0); VirtIntrNum = fdt32_to_cpu (InterruptProp[2].Number) + (InterruptProp[2].Type ? 16 : 0); - HypIntrNum = fdt32_to_cpu (InterruptProp[3].Number) + HypIntrNum = Len < 48 ? 0 : fdt32_to_cpu (InterruptProp[3].Number) + (InterruptProp[3].Type ? 16 : 0); DEBUG ((EFI_D_INFO, "Found Timer interrupts %d, %d, %d, %d\n",