From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::343; helo=mail-wm1-x343.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (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 E0A6F2194D3B3 for ; Fri, 7 Dec 2018 03:23:18 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id q26so4128541wmf.5 for ; Fri, 07 Dec 2018 03:23:18 -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=3IE+0gzD9Q1fewtX4Fi1C84/sWK8X+MtQY2OcUr/9e0=; b=IJ4u+JlTrxdle6zenBvYNzPmfA50Ar8iZGoVNWesMRzg5jbEV56gdvyl1MDjB3loYw OWZVH6JKnmvYl2UDi6gkFC1C5F91fiju6Cyfgd4vnhrBcneiZxiMPYLiBPm+u9Gy2fMn NsMevN7zZ0aycJZdIKjtFZuXejDfl4vWqoBew= 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=3IE+0gzD9Q1fewtX4Fi1C84/sWK8X+MtQY2OcUr/9e0=; b=MbiNlv9qAzztNqpSmCZ0Hq8aqVlnIO8A3NX8Kj8oaxcyRvmPHVEjlUTprUY/ldm+Zb N1SlfrXEfnNBy5RBh1AywXzcMCxms8FxKy8mohJ0L1+yx0+OtkkOS24qhY3YMR2Fvf4q mBDBycAhKM3ruh2tTHP4GG6kexlhL4CBrJL+PZhOyGg682YogoE9Cf1Yi1M7k1QZWhJg VqAscCwRRMbR69Mob/G9FDwTcQidgkp5foa9kXX+9Gp2TFU7sr3K7LjA16NEHOXIo8fa C9OxVrsLbNw80sJdCCQz3mOKc8yaEppAw8+AF/kX6nuFCDCEi6ITOKEHAsVHnjm78pKP LC6Q== X-Gm-Message-State: AA+aEWYz28Dx0QGXL7NzQp0+cQ/0EvU3iSf3s1PpNKjrkq63F7e0H1rd nmRokARDWBbUmuQ9QGxyc3hTqLfDLZtIJw== X-Google-Smtp-Source: AFSGD/Wb3qNXVIs1oVI8F1EZTX4zxU1I4ZIfH0d5Hme59/u49stpX7CLrXKs4pq9NzrfIZOtD6fmPw== X-Received: by 2002:a1c:c2d4:: with SMTP id s203mr1890785wmf.3.1544181797113; Fri, 07 Dec 2018 03:23:17 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:16 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Jian J Wang , Hao Wu , Leif Lindholm , Laszlo Ersek , Eric Auger , Andrew Jones , Philippe Mathieu-Daude Date: Fri, 7 Dec 2018 12:23:03 +0100 Message-Id: <20181207112304.19765-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [RFC PATCH 6/7] ArmVirtPkg/MemoryInitPeiLib: split memory HOB based on 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: , X-List-Received-Date: Fri, 07 Dec 2018 11:23:19 -0000 Content-Transfer-Encoding: 8bit The current ArmVirtMemoryInitPeiLib code splits the memory region passed via PcdSystemMemoryBase/PcdSystemMemorySize in two if the region extends beyond the MAX_ADDRESS limit. This was introduced for 32-bit ARM, which may support more than 4 GB of physical address space, but cannot address all of it via a 1:1 mapping, and a single region that is not mappable in its entirety is unusable by the PEI core. AArch64 is in a similar situation now: platforms may support more than 256 TB of physical address space, but only 256 TB is addressable by the CPU, and so a memory region that extends from below this limit to above it should be split. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c index 05afd1282422..66925fc05ebd 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -75,18 +75,18 @@ MemoryPeim ( SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize); - if (SystemMemoryTop - 1 > MAX_ADDRESS) { + if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) { BuildResourceDescriptorHob ( EFI_RESOURCE_SYSTEM_MEMORY, ResourceAttributes, PcdGet64 (PcdSystemMemoryBase), - (UINT64)MAX_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1 + (UINT64)MAX_ALLOC_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1 ); BuildResourceDescriptorHob ( EFI_RESOURCE_SYSTEM_MEMORY, ResourceAttributes, - (UINT64)MAX_ADDRESS + 1, - SystemMemoryTop - MAX_ADDRESS - 1 + (UINT64)MAX_ALLOC_ADDRESS + 1, + SystemMemoryTop - MAX_ALLOC_ADDRESS - 1 ); } else { BuildResourceDescriptorHob ( -- 2.19.2