From patchwork Mon Jan 26 19:03:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43774 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 631B020D5D for ; Mon, 26 Jan 2015 19:04:12 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf5292078lbd.3 for ; Mon, 26 Jan 2015 11:04:11 -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=WoKijQ8ggZpWV5QDKbRm/Sc6OpnBOVcUpmjRVRrq4k4=; b=XRmiRAkDoFvY1Tr3xrm2PZQpnqE40rTSxX79DDa6Uj+gZXAXdJlePwzvzOfyj0p11+ a0IgJ0LLLkAaqEqWCcGtYJpJsyRJIkN5R4rv/BOdaoQi1XbIvw0wnlDTyHxd/GIFLvDW 0N0S+nSneHwsxnn7f379uSD9f2R8Ahz5E4w8jDVv54A6TxvhBFEoTP1S9C4YD9sEyuXT jsJggYxpfoZ2h0SL9+ScNlGRtlp1+7Q6wlQD6jLMm4NhywDwI06PTXnsnVu3SDf79QHA mvwqP59jp9MQ5EDmoMMbjRNpGla294jrInCZx0k5MnLQiHdK3/IxE3nxFJnZ6/teiq3X mFQA== X-Gm-Message-State: ALoCoQkFTtSmsvLP/tZxkMmG0kWlIt6iYHVasNHR7lbzPi83kkm9WCTM3xL8Jp6xbP9v7ETPIgqI X-Received: by 10.112.42.104 with SMTP id n8mr1475178lbl.19.1422299051353; Mon, 26 Jan 2015 11:04:11 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.137 with SMTP id 9ls507378lau.26.gmail; Mon, 26 Jan 2015 11:04:11 -0800 (PST) X-Received: by 10.152.44.193 with SMTP id g1mr22662397lam.15.1422299051203; Mon, 26 Jan 2015 11:04:11 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id i1si9814335lae.46.2015.01.26.11.04.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:11 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ge10so9402372lab.10 for ; Mon, 26 Jan 2015 11:04:11 -0800 (PST) X-Received: by 10.112.131.1 with SMTP id oi1mr22553899lbb.2.1422299051095; Mon, 26 Jan 2015 11:04:11 -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 h5csp870211lbj; Mon, 26 Jan 2015 11:04:10 -0800 (PST) X-Received: by 10.107.151.80 with SMTP id z77mr19895931iod.51.1422299048179; Mon, 26 Jan 2015 11:04:08 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id vf12si7802598igb.8.2015.01.26.11.04.07 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:08 -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 1YFox4-0004l9-LR; Mon, 26 Jan 2015 19:03:58 +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 1YFox3-0004kt-CK for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:03:57 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.54 as permitted sender) client-ip=74.125.82.54; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f54.google.com; Received: from mail-wg0-f54.google.com ([74.125.82.54]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YFowz-0005bP-3c for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:03:57 +0000 Received: by mail-wg0-f54.google.com with SMTP id b13so10701912wgh.13 for ; Mon, 26 Jan 2015 11:03:48 -0800 (PST) X-Received: by 10.194.86.135 with SMTP id p7mr47336518wjz.89.1422299028155; Mon, 26 Jan 2015 11:03:48 -0800 (PST) Received: from ards-macbook-pro.local ([197.129.8.190]) by mx.google.com with ESMTPSA id fo17sm15471007wjc.19.2015.01.26.11.03.45 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:03:47 -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: Mon, 26 Jan 2015 19:03:03 +0000 Message-Id: <1422299011-2409-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422299011-2409-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422299011-2409-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 -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1YFowz-0005bP-3c Subject: [edk2] [PATCH v2 01/29] 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.51 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 Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/TimerDxe/TimerDxe.c | 14 +++++++++++--- ArmPlatformPkg/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));