From patchwork Tue Feb 3 19:19:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 44284 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5DC1B2034D for ; Tue, 3 Feb 2015 19:20:59 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf7823526lbd.3 for ; Tue, 03 Feb 2015 11:20:58 -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=BkWvDWTRwzr9v1qE3ZuD/GMZeJhYTFPObd3YY+l24IE=; b=b5UFoZhSc1LfFbtH/XiIm2qh7Hlb1XrVsg0N9Td0fe/rGQfZGjj3wNxC3Db4XTjUCE Un91Hk5gV3a2bMC58UZTqp3nfFBcAAF4MsvlS4sdikLxNjtE6ZqAP4UoJlD1nn+ReYfD 8swgQ39Jps7gvZuR0uTqGT1tGdFgFRw4m4I4k+T+o4ajMP6fnlEpSB45W1rI+DqhwY7t ZD+i1sa9tGQEL6DLIlyjEGgYUZum2vEvaLGdrlYX/U6oSJ64SUKC2zfEyAgp0K3fCRkS I4MNfeCNtOtF2rJsXCl5nqqNmXFSs9T0cY3cNBeVS1p8pjRuFEkKXBr9ZObgOOX0hBmd K9IQ== X-Gm-Message-State: ALoCoQmLkKtX41U9ryt1gJMsizlHhjWVTulqUnPljf/zDoDU7PfWKAEbVYpC3kBSLweCB7RpKaUa X-Received: by 10.112.163.42 with SMTP id yf10mr3316313lbb.8.1422991258322; Tue, 03 Feb 2015 11:20:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.2 with SMTP id ku2ls716803lac.64.gmail; Tue, 03 Feb 2015 11:20:58 -0800 (PST) X-Received: by 10.112.40.65 with SMTP id v1mr27032988lbk.26.1422991258176; Tue, 03 Feb 2015 11:20:58 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id ls9si18807288lac.1.2015.02.03.11.20.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 11:20:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id gm9so54267203lab.0 for ; Tue, 03 Feb 2015 11:20:58 -0800 (PST) X-Received: by 10.112.135.196 with SMTP id pu4mr26800749lbb.41.1422991258040; Tue, 03 Feb 2015 11:20:58 -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.35.133 with SMTP id h5csp33706lbj; Tue, 3 Feb 2015 11:20:57 -0800 (PST) X-Received: by 10.107.12.196 with SMTP id 65mr31083081iom.71.1422991256346; Tue, 03 Feb 2015 11:20:56 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id jc2si10406583igb.58.2015.02.03.11.20.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 11:20:56 -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-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YIj1i-00007d-7f; Tue, 03 Feb 2015 19:20:46 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YIj1g-00007T-Rg for edk2-devel@lists.sourceforge.net; Tue, 03 Feb 2015 19:20:44 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.169 as permitted sender) client-ip=74.125.82.169; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f169.google.com; Received: from mail-we0-f169.google.com ([74.125.82.169]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YIj1f-0002R1-Jh for edk2-devel@lists.sourceforge.net; Tue, 03 Feb 2015 19:20:44 +0000 Received: by mail-we0-f169.google.com with SMTP id u56so46880255wes.0 for ; Tue, 03 Feb 2015 11:20:37 -0800 (PST) X-Received: by 10.194.90.210 with SMTP id by18mr28098449wjb.80.1422991237563; Tue, 03 Feb 2015 11:20:37 -0800 (PST) Received: from ards-macbook-pro.local (73.233.28.37.rev.vodafone.pt. [37.28.233.73]) by mx.google.com with ESMTPSA id eb7sm25860139wic.11.2015.02.03.11.20.33 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 11:20:36 -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, julien.grall@linaro.org Date: Tue, 3 Feb 2015 19:19:46 +0000 Message-Id: <1422991212-9257-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422991212-9257-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422991212-9257-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: 1YIj1f-0002R1-Jh Subject: [edk2] [PATCH v3 01/27] 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.215.41 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 Reviewed-by: Olivier Martin Reviewed-by: Laszlo Ersek Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/TimerDxe/TimerDxe.c | 14 +++++++++++--- .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c | 6 +++--- 2 files changed, 14 insertions(+), 6 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..1d44f9ba02b3 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,8 +282,8 @@ 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) - + (InterruptProp[3].Type ? 16 : 0); + 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", SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum));