From patchwork Fri May 1 15:35:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 47888 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3EA1520553 for ; Fri, 1 May 2015 15:36:14 +0000 (UTC) Received: by wizk4 with SMTP id k4sf17507306wiz.2 for ; Fri, 01 May 2015 08:36: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: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=aq8M35jcfT/7aBxyWrMzbK2GdDD0jnWjQIdszZAOsAY=; b=DCntfEjP0x5JKy3Pp92CuvgqxLN/HYDIn05xaDsiP7OGkDrXNkeNtOdQJclu8qbRZ0 xmF3EqNmOOBosCivQdpsr82L5GBTYqaxCnCMaCz99Hey8pRNC0XwU664o7AM7pw9uDgz zfPS7HxQW9aSGTnY3DxpKOMiMqv5of52392Cmk/DLCnN4KUDAzXpXM7nxDOBaZ48YMNb Lbxzo1oD+fX9XQflBM1MPpOmD/oy5+3BVIZbamSv5jrZWqNQbidXqJzCcot0T5xRTM8R 9zyBa23+WEy14QskJzBhqngO2Q+3/FLXVJcL38oeSNjOQDF2prK6q/SysNBBHZPgIiaz 9pdg== X-Gm-Message-State: ALoCoQlEjDnzjFsn1Dw37D2yNyFTNf9vZplzhnXdfOzHf7zpCwjdm1zoLrtNBp+fPxAPKLmksPYi X-Received: by 10.152.26.134 with SMTP id l6mr8409968lag.10.1430494572348; Fri, 01 May 2015 08:36:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.133 with SMTP id kq5ls475726lac.102.gmail; Fri, 01 May 2015 08:36:12 -0700 (PDT) X-Received: by 10.112.119.139 with SMTP id ku11mr8397085lbb.49.1430494572206; Fri, 01 May 2015 08:36:12 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id h8si4185660lbc.56.2015.05.01.08.36.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 May 2015 08:36:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbuc2 with SMTP id uc2so66833766lbb.2 for ; Fri, 01 May 2015 08:36:12 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr395666lbc.32.1430494571974; Fri, 01 May 2015 08:36:11 -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.67.65 with SMTP id l1csp350094lbt; Fri, 1 May 2015 08:36:11 -0700 (PDT) X-Received: by 10.50.21.1 with SMTP id r1mr293314ige.46.1430494568831; Fri, 01 May 2015 08:36:08 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id 79si4522465iod.4.2015.05.01.08.36.08 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 01 May 2015 08:36:08 -0700 (PDT) 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-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YoCyu-0008JM-1K; Fri, 01 May 2015 15:36:00 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YoCys-0008JE-Ef for edk2-devel@lists.sourceforge.net; Fri, 01 May 2015 15:35:58 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.177 as permitted sender) client-ip=209.85.212.177; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f177.google.com; Received: from mail-wi0-f177.google.com ([209.85.212.177]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YoCyr-0000LA-Jr for edk2-devel@lists.sourceforge.net; Fri, 01 May 2015 15:35:58 +0000 Received: by widdi4 with SMTP id di4so51339294wid.0 for ; Fri, 01 May 2015 08:35:51 -0700 (PDT) X-Received: by 10.180.83.193 with SMTP id s1mr15119014wiy.22.1430494551599; Fri, 01 May 2015 08:35:51 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id 16sm7998511wjs.41.2015.05.01.08.35.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 May 2015 08:35:50 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, olivier.martin@arm.com, leif.lindholm@linaro.org, roy.franz@linaro.org, geoff@infradead.org, edk2-devel@lists.sourceforge.net Date: Fri, 1 May 2015 17:35:34 +0200 Message-Id: <1430494534-4151-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430494534-4151-1-git-send-email-ard.biesheuvel@linaro.org> References: <1430494534-4151-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: 1YoCyr-0000LA-Jr Subject: [edk2] [PATCH v3 2/2] ArmVExpressPkg: disallow the use of ArmVExpressSysConfigLib at runtime 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.182 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 ArmVExpressSysConfigLib library does not (and cannot) runtime remap its MMIO registers, so return RETURN_UNSUPPORTED when trying to use it after calling SetVirtualAddressMap(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- .../Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c | 6 ++++++ .../Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf | 1 + 2 files changed, 7 insertions(+) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c index 6dfbacd11762..87ecb63c6c23 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c @@ -13,8 +13,10 @@ **/ #include +#include #include #include +#include #include #include @@ -72,6 +74,10 @@ AccessSysCfgRegister ( { UINT32 SysCfgCtrl; + if (EfiGoneVirtual ()) { + return RETURN_UNSUPPORTED; + } + // Clear the COMPLETE bit MmioAnd32(ARM_VE_SYS_CFGSTAT_REG, ~SYS_CFGSTAT_COMPLETE); diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf index c1647756efbe..268202cc2038 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf @@ -33,3 +33,4 @@ [LibraryClasses] BaseLib IoLib + UefiRuntimeLib