From patchwork Mon Jan 14 17:02:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 155566 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3883781jaa; Mon, 14 Jan 2019 09:02:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN7Q2U9FX5Mdc7miOSnk0MhgbVOBEsPIOiu2Mg56SuMgTcxEQqUOeo84lFspTSOpjGpvM96f X-Received: by 2002:a63:4e41:: with SMTP id o1mr24223389pgl.282.1547485346729; Mon, 14 Jan 2019 09:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547485346; cv=none; d=google.com; s=arc-20160816; b=oOJXYmKF6P6yl5ZTPnQ5xASpThiTOjaTWcRHpfA4Gy6JgzpeHe88R0y+RujPyokV9b 8mrygUSE7lEcEZStWbA7KsGSrBgqwaRGe0ivD69mPBntHOOdH7SRfNFwLoKHgkO/gSV0 QdINhW/FGwnsjwG0GriAxwStNrQEd/Ei3LqjJV9jyI4YCB1uGIMzhflh39NqEQYY9G4o kUAe6QcbhblunPN1OY2Y7eixRGtawBTb9wvUq5n1AVH/VrLm0cY98tJQsCB+q63Mmx4G o+Xu1IQ2JF+ARqA4ExxuD+qoZkp2lzcJmI0GUEes6bTc8cFbScJVsVsrE2TO8f8WBfjp 7s7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=Brg4JkOiXDTCTq1HcVfrkxIdCXXh3NKXSjun5RELPhA=; b=O0QdX9fsEc6t5f3802nqQ2KyVaSiMHeQp5bQCWJW6gzNi8RoAd/hCX39Ms58CDRrJ8 SkfCUiIEq5LFI3vVlmwwfJXkr2N/fMYz7t7+i9J0Z9mggukIhHGLsEonNwD9bkap0AAZ F6AZBwt2keyrG6IRMWISOlk9T+1fJlRY6Th7NhqkLO0ns4BjimL/JWblT9UP4TFrOZJW jc0NIOsfF5lB9NqoPnohQkphkJqyZEn9HZ0OH6in1rYQkfEf7coJXKGtad9hslqKndpC 3EL56rQZ5p7jLiXe+xfIcYdHXolQFkpmcxcpLySIhBEjOla2oHuTy20i3oPQjY+E0L6t WMYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fnK2KzAD; 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 y13si747562pgj.157.2019.01.14.09.02.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 09:02:26 -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=fnK2KzAD; 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 60501211B736D; Mon, 14 Jan 2019 09:02: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::342; helo=mail-wm1-x342.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 15F37211B6C33 for ; Mon, 14 Jan 2019 09:02:15 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id d15so304490wmb.3 for ; Mon, 14 Jan 2019 09:02: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; bh=XdQ5sklo+Qz80Ae4y52qxp7E/lOGURYTmKjPIcTjcjY=; b=fnK2KzAD8RO2pk1jyat0xNdFXoepJ6zaju8s5+evqdlEOoJg89O9Fc+1om6Ekryn0a 2RJAcfyMVSVWoXryTx5Zn+WtI+ExZHBFjrVEc51ynKT9WcdMgLe9vW/vaVUButSKHINN vhIqBBlinvpLSWpErFxULj1MZlqYH0QOSc/6I= 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; bh=XdQ5sklo+Qz80Ae4y52qxp7E/lOGURYTmKjPIcTjcjY=; b=ihtotBQYHzhwq7wt6DEZ5uk0Q5uQbHS4f33SnyIEjg8P8E77HziRfqOfLbzcapMYSU JDCvencAnUKa+36q1jdTy7V2mRSWf/mlCJrgk92gv95vkH2/SWL0x9PUe9q0XVjt4qeV pB8F8ILLT0VzEozlyv2/LKHHvEkuoIwS+Jxb33oD9SbZUJfmYSQVFgj3eJveusKTD5Uf tFWO4rlyZxzykM/3wztcqjNRjv3XZhqoB6cktq4YwRver4zK6GmugQ/DBzvi2uDumS4f 5A+rHQxZyodG8eXEzOred8HiGwvNyNU03XNbhOCGOrvq9DSvZKneii37SPE0Y2tIdshq dmgw== X-Gm-Message-State: AJcUukdZYqaGEKNzCZKZTrSYVatzFth/XjhVq6/znTkWkRAvmgGBPlA+ UspIg7BFWTd9RcR57J6R0ZSUOYoCYpwMtw== X-Received: by 2002:a1c:e18a:: with SMTP id y132mr97077wmg.48.1547485333205; Mon, 14 Jan 2019 09:02:13 -0800 (PST) Received: from dogfood.home ([2a01:cb1d:112:6f00:2ced:5cd0:34f4:7bab]) by smtp.gmail.com with ESMTPSA id h184sm17224319wmf.0.2019.01.14.09.02.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 09:02:12 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 14 Jan 2019 18:02:01 +0100 Message-Id: <20190114170205.9748-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114170205.9748-1-ard.biesheuvel@linaro.org> References: <20190114170205.9748-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 4/8] Silicon/SynQuacerMemoryInitPeiLib: don't map memory above MAX_ALLOC_ADDRESS 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: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" When encountering memory that is above the threshold of what we can map, don't add it to the virtual memory table. This table is only used by the early MMU code that creates the 1:1 mapping, and since it cannot be mapped in the first place, there is no point. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c index 1402ecafce4a..3955b6df84a0 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c @@ -156,17 +156,22 @@ DeclareDram ( DramDescriptor = *VirtualMemoryTable + ARRAY_SIZE (mVirtualMemoryTable); - for (Idx = 0; Idx < RegionCount; Idx++, DramDescriptor++) { + for (Idx = 0; Idx < RegionCount; Idx++) { Status = DramInfo->GetRegion (Idx, &Base, &Size); ASSERT_EFI_ERROR (Status); BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, mDramResourceAttributes, Base, Size); + if (Base > MAX_ALLOC_ADDRESS - Size + 1) { + continue; + } + DramDescriptor->PhysicalBase = Base; DramDescriptor->VirtualBase = Base; - DramDescriptor->Length = Size; + DramDescriptor->Length = MIN (Size, MAX_ALLOC_ADDRESS - Base + 1); DramDescriptor->Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; + DramDescriptor++; } DramDescriptor->PhysicalBase = 0;