From patchwork Mon Jan 26 19:03:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43782 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA7AB20D5D for ; Mon, 26 Jan 2015 19:04:41 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf5297485lbj.0 for ; Mon, 26 Jan 2015 11:04:40 -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=RyittoZ6gHkOTp33hP9Ft1yk2Tu+XLSkj4UIZv8pIg0=; b=gRcF22G5dzj2NfogGrnH809x7dks1C5LWQ6ZQncWGLQ+P+RpHhgQLQP4qZlUmcaKlr HNFym6MhUOwMfmYauuu5ro5f5mEBnjwDIdsbiplzcPdrDfCfQIuigQoO32qTZgmAHPPc bWslG81vTPrL2We5QEM/px08wmzR6bDbOfDATkPaVHspn4WmUcgd6eaP3cBgptvoccle pwA2DTjpijxCpTBCsky0Bc/D/Tu5uQq/P8Uu69GSGL10E3sIRGM3jfMPNeTC7wdd6mNS LVOTh0pzHPS9nX4Q8R8Kds5HM/YekyVPO0ggihxQLTGBPvK7QNX83QLL2/1rppuy6EUC /vLA== X-Gm-Message-State: ALoCoQkEYQS0+T0zeHC8OFrM4K8Zi6eDu6O0f3mXTwrKsTyh+Art2rAF6GKnv0zNYFsc2DmvwFAR X-Received: by 10.112.133.98 with SMTP id pb2mr2802708lbb.2.1422299080826; Mon, 26 Jan 2015 11:04:40 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.169 with SMTP id x9ls120436lad.72.gmail; Mon, 26 Jan 2015 11:04:40 -0800 (PST) X-Received: by 10.112.148.34 with SMTP id tp2mr5325716lbb.94.1422299080680; Mon, 26 Jan 2015 11:04:40 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id u14si9778286laz.93.2015.01.26.11.04.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:40 -0800 (PST) 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 mail-lb0-f178.google.com with SMTP id u10so9255160lbd.9 for ; Mon, 26 Jan 2015 11:04:40 -0800 (PST) X-Received: by 10.112.125.41 with SMTP id mn9mr22838525lbb.80.1422299080564; Mon, 26 Jan 2015 11:04:40 -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 h5csp870341lbj; Mon, 26 Jan 2015 11:04:39 -0800 (PST) X-Received: by 10.50.138.40 with SMTP id qn8mr18257214igb.27.1422299079058; Mon, 26 Jan 2015 11:04:39 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id bo2si8508878icc.80.2015.01.26.11.04.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:39 -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 1YFoxV-0002x6-NB; Mon, 26 Jan 2015 19:04:25 +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 1YFoxT-0002wn-NR for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:23 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.177 as permitted sender) client-ip=74.125.82.177; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f177.google.com; Received: from mail-we0-f177.google.com ([74.125.82.177]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YFoxT-0005ca-Nw for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:25 +0000 Received: by mail-we0-f177.google.com with SMTP id l61so10826223wev.8 for ; Mon, 26 Jan 2015 11:04:18 -0800 (PST) X-Received: by 10.194.10.68 with SMTP id g4mr47855793wjb.5.1422299058542; Mon, 26 Jan 2015 11:04:18 -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.04.15 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:17 -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:12 +0000 Message-Id: <1422299011-2409-11-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 X-Headers-End: 1YFoxT-0005ca-Nw Subject: [edk2] [PATCH v2 10/29] ArmPlatformPkg/PrePi: allow unicore PrePi on multicore capable CPU 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.178 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 Under virtualization, typically, the guest is entered with only a single CPU turned on, and any remaining CPUs are started by the OS using PSCI. So refactor the PrePi code in such a way that we can implement a unicore flavor which can be allowed to execute on a MPcore CPU. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/PrePi/MainMPCore.c | 2 +- ArmPlatformPkg/PrePi/MainUniCore.c | 2 +- ArmPlatformPkg/PrePi/PrePi.c | 9 ++++----- ArmPlatformPkg/PrePi/PrePi.h | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ArmPlatformPkg/PrePi/MainMPCore.c b/ArmPlatformPkg/PrePi/MainMPCore.c index bf813730d341..8e5f9947d499 100644 --- a/ArmPlatformPkg/PrePi/MainMPCore.c +++ b/ArmPlatformPkg/PrePi/MainMPCore.c @@ -35,7 +35,7 @@ PrimaryMain ( ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId)); } - PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); + PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp, ArmIsMpCore()); // We must never return ASSERT(FALSE); diff --git a/ArmPlatformPkg/PrePi/MainUniCore.c b/ArmPlatformPkg/PrePi/MainUniCore.c index 43588a50ddb5..918ea4dcdf7b 100644 --- a/ArmPlatformPkg/PrePi/MainUniCore.c +++ b/ArmPlatformPkg/PrePi/MainUniCore.c @@ -27,7 +27,7 @@ PrimaryMain ( ASSERT(ArmIsMpCore() == 0); DEBUG_CODE_END(); - PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); + PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp, ArmIsMpCore()); // We must never return ASSERT(FALSE); diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c index 0e551c518d6b..5b058dba80fa 100755 --- a/ArmPlatformPkg/PrePi/PrePi.c +++ b/ArmPlatformPkg/PrePi/PrePi.c @@ -94,7 +94,8 @@ PrePiMain ( IN UINTN UefiMemoryBase, IN UINTN StacksBase, IN UINTN GlobalVariableBase, - IN UINT64 StartTimeStamp + IN UINT64 StartTimeStamp, + IN BOOLEAN IsMpCore ) { EFI_HOB_HANDOFF_INFO_TABLE* HobList; @@ -138,7 +139,7 @@ PrePiMain ( ASSERT_EFI_ERROR (Status); // Create the Stacks HOB (reserve the memory for all stacks) - if (ArmIsMpCore ()) { + if (IsMpCore) { StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize) + ((FixedPcdGet32 (PcdCoreCount) - 1) * FixedPcdGet32 (PcdCPUCoreSecondaryStackSize)); } else { @@ -152,7 +153,7 @@ PrePiMain ( //TODO: Call CpuPei as a library BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize)); - if (ArmIsMpCore ()) { + if (IsMpCore) { // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi); @@ -209,8 +210,6 @@ CEntryPoint ( { UINT64 StartTimeStamp; - ASSERT(!ArmIsMpCore() || (PcdGet32 (PcdCoreCount) > 1)); - // Initialize the platform specific controllers ArmPlatformInitialize (MpId); diff --git a/ArmPlatformPkg/PrePi/PrePi.h b/ArmPlatformPkg/PrePi/PrePi.h index e67795f4490a..468569b3a28b 100644 --- a/ArmPlatformPkg/PrePi/PrePi.h +++ b/ArmPlatformPkg/PrePi/PrePi.h @@ -40,7 +40,8 @@ PrePiMain ( IN UINTN UefiMemoryBase, IN UINTN StacksBase, IN UINTN GlobalVariableBase, - IN UINT64 StartTimeStamp + IN UINT64 StartTimeStamp, + IN BOOLEAN IsMpCore ); EFI_STATUS