From patchwork Wed Nov 28 14:33:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152279 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1164346ljp; Wed, 28 Nov 2018 06:34:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vyq82skio1bAFSdBPZ3tPu/8qNZ23uiS+NQtV1l5El2ng8NrDfgksvZXaBdGHErOfZ1HZk X-Received: by 2002:a63:e711:: with SMTP id b17mr32429425pgi.363.1543415672910; Wed, 28 Nov 2018 06:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543415672; cv=none; d=google.com; s=arc-20160816; b=kALyHjh7rKvEqlj0Mgpa9API7Ql1Y+AmYGzBAbMkBC2wrCAQ7xA/rKrVOTMr9aBU7c gWJS79ahDyZX7MlqslftI1SpNFeVm8GnUarHWYpYRDSfkzRS2jGD4ETmiNqE/Y2fO8Lt ZKZBMWfvw0vYA4IEZrH4Lw1Xx4MNGL5ZmsZmEvxIU9LIoUMGwEzGm2Yy2c5JAnmfXFvI c4JK0jI/SQ9KIuOl5mwfZ7p8l9YI5oZ6qyxKUXrNIQJWc5W0hJjYYXYz/q4X8bOR/g/t 9HkqGCJD9byLVFBVEYv4RsnW/ib4ZmpDd4nMezgMMWbRppcX7hZCnU78B++689lV0L+h ggZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=R9+PRUTSmCcZJcADcJPBQhzQjx79PhoRoE+lV8gYnp8=; b=lJL75bgybkrT94qwR+08KMcX19B848wyBYaR9u0H3cTr9g4LkXGulf69f4PtMe58d2 b39pfQbT2bfTXLMk1Oz0dVRs/v8y6lF9sXMBX0RHIXjawi7vxPB5+htXTL4cnAng3Zrk vLwNGDaBxf254kzfzFFSPpcCQK38sntGjVRNGUJU9bvSJAcaSTD6aByFlP+F4ZeE5hx3 /SGK5hxVxAZ4RfrKEl5dYOM7VcReau+wq6eJbybt/WgYg93nt6znvSpNWkbFxIIEUJqu p9/786dZAbEQlgCjZSlpO6Mz2jM9w0XsOi9kB9NRw6FwGFBTBE9IlwH5Q4a639FvIzsL tLCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="h/PFUSIG"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id f21si7551634pgb.371.2018.11.28.06.34.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 06:34:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="h/PFUSIG"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B309821196220; Wed, 28 Nov 2018 06:34:17 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::441; helo=mail-wr1-x441.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1579A21196213 for ; Wed, 28 Nov 2018 06:34:15 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id j10so26531344wru.4 for ; Wed, 28 Nov 2018 06:34:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uETaXBrNv5jsuw8eC89fjrzgEn1ia5ncb6V0hkNlox4=; b=h/PFUSIGa/UaCNebSet6BOi4wmoDSSKsR3DmBoaGtlVycX2YCH8vnQurLMHzcVOQp6 QAJeEZ0wr+1juG1Eqi2c0EWKjSUsKNS0h1b2EKZmiE8+RG+dLoV31360D0A4Pxy6V1g9 JP0+Hsf1Yf9aRiMI5qfTW277jjLQWXjL03ABU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uETaXBrNv5jsuw8eC89fjrzgEn1ia5ncb6V0hkNlox4=; b=Gy18HUReyvRg+ABZtjlxA64wMB1s7WxLkd9sMTzXUm7tWuh8YkmhYNjUKiH3Err0ez hnPLHtDQjSA7m5bjHO3W6zwi9srZ8qjTKe9Zk9njXMW9JDzx1FDg4mYbfy4+ElmeJ0Km aPCcsBJbwiHFAN4bbYZtGbd3fCNM7bF1kgpm6IYx8aGkPulrcNZb6ZuYZB0Vmqbo0TDD dfF1wDREawzgMg107zlWthFKMOj+m9bnwrkHPn6tBbu+p5SLIdm00gbLrkKUT2KJPJps RERW5qFcEkNMwrbPBQxx2VVtAn9P+guRJDhgM1dFehPKNCtoVFEZVgrNvGcIgq7owLeh UHAA== X-Gm-Message-State: AA+aEWbAUgRBajd/15FVbg0dFo3dfKoE2cYMLv1amDMsThrACTh3+5OE whwK9aMZpZdu2tIxr/zx4yWfZMGenUc= X-Received: by 2002:a5d:52ca:: with SMTP id r10mr6817784wrv.123.1543415653297; Wed, 28 Nov 2018 06:34:13 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:296f:238b:c20d:3626]) by smtp.gmail.com with ESMTPSA id 6sm3391891wmk.26.2018.11.28.06.34.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 06:34:12 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Nov 2018 15:33:48 +0100 Message-Id: <20181128143357.991-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128143357.991-1-ard.biesheuvel@linaro.org> References: <20181128143357.991-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v3 07/16] ArmVirtPkg/XenVirtMemInfoLib: refactor reading of the PA space size X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Use the new ArmLib helper to read the CPU's physical address limit so we can drop our own homecooked one. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf | 6 --- ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c | 11 +++--- ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S | 39 -------------------- ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S | 24 ------------ 4 files changed, 5 insertions(+), 75 deletions(-) -- 2.19.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laszlo Ersek diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf index cd4c805a4db9..ae107810e927 100644 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf @@ -24,12 +24,6 @@ [Defines] [Sources] XenVirtMemInfoLib.c -[Sources.ARM] - Arm/PhysAddrTop.S - -[Sources.AARCH64] - AArch64/PhysAddrTop.S - [Packages] ArmPkg/ArmPkg.dec ArmVirtPkg/ArmVirtPkg.dec diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c index 88ff3167cbfd..6701dec50ea8 100644 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c @@ -18,11 +18,6 @@ STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2]; -EFI_PHYSICAL_ADDRESS -ArmGetPhysAddrTop ( - VOID - ); - /** Return the Virtual Memory Map of your platform @@ -42,8 +37,12 @@ ArmVirtGetMemoryMap ( OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap ) { + EFI_PHYSICAL_ADDRESS TopOfAddressSpace; + ASSERT (VirtualMemoryMap != NULL); + TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()); + // // Map the entire physical memory space as cached. The only device // we care about is the GIC, which will be stage 2 mapped as a device @@ -51,7 +50,7 @@ ArmVirtGetMemoryMap ( // mVirtualMemoryTable[0].PhysicalBase = 0x0; mVirtualMemoryTable[0].VirtualBase = 0x0; - mVirtualMemoryTable[0].Length = ArmGetPhysAddrTop (); + mVirtualMemoryTable[0].Length = TopOfAddressSpace; mVirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; mVirtualMemoryTable[1].PhysicalBase = 0x0; diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S b/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S deleted file mode 100644 index a1f6a194d59b..000000000000 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2016-2017, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ASM_FUNC(ArmGetPhysAddrTop) - mrs x0, id_aa64mmfr0_el1 - adr x1, .LPARanges - and x0, x0, #7 - ldrb w1, [x1, x0] - mov x0, #1 - lsl x0, x0, x1 - ret - -// -// Bits 0..2 of the AA64MFR0_EL1 system register encode the size of the -// physical address space support on this CPU: -// 0 == 32 bits, 1 == 36 bits, etc etc -// 6 and 7 are reserved -// -.LPARanges: - .byte 32, 36, 40, 42, 44, 48, -1, -1 - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S b/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S deleted file mode 100644 index 9cd81529fb3d..000000000000 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2014-2017, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ASM_FUNC(ArmGetPhysAddrTop) - mov r0, #0x00000000 - mov r1, #0x10000 - bx lr