From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web09.15466.1583513033978722953 for ; Fri, 06 Mar 2020 08:43:54 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=jonCSjUY; spf=pass (domain: linaro.org, ip: 209.85.221.66, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f66.google.com with SMTP id x7so3158505wrr.0 for ; Fri, 06 Mar 2020 08:43:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2LICleDX+rwUPb1MBJLu7X4sEwXO7VT8f1skzb9lsWQ=; b=jonCSjUYbfL9Y0jRZf0t0vNP+ilQp+6oydD9sMZZ386S+6GDdqgOFv5+u8RW/VBiAh oXbT7y7tq7PQLs3gJN21yICFji6cYM6HvERxGeeuKYbQ8V3GifSnaUpfOuGTJeNWZlBy 0t8N/nJc9M9/ytJf8U6R57D4vKyYXAOJ2yzwUE+CGcmh7ozA4ZWDx3s7BNIJyHQ8h74T HAGqZdvpF0AoTbTqc1ojv2vpWi41v7O1C0lVtJ1YeaDDR16V2jGGLJEEMkGz1IYxDMze UhSih4VXFm1r14kLZnyVa2u8YNxH7dquia2Cbktsj89zPw8IMBkfYIs5DHciIjWDbCxO YhiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2LICleDX+rwUPb1MBJLu7X4sEwXO7VT8f1skzb9lsWQ=; b=ET6tzQZbkSdpVu/M1VtFjsWVc5HsZYxoRocYFPGhBjJRWXGakp8+A87APJjr/fvUnc /9p3zmCnLOjgG07NWtmApyTU2ryGeTRQaYR5NrCt0qJGCez4tkUDkdKdLwXLei+ew9gP gP/pOELM+oq3/LmhXAD7oEl4XUU/QTrPt7c5mSi6oij7pCm7fIEes4wMJP2PHU+/ZfHy 2dAD6rk/s9wV5/p88QZAvRwhaWovo/0WHqVBYj3xzuHiDobWB8Za16FhegVECwkazSXe 2Ye+7gh9qmMpD4BTcDbnjJPMiCfyukJ6aNv9GM+2itMTuiD0eZBnJxkd27Kpm7qrG+kd OEQQ== X-Gm-Message-State: ANhLgQ1jvojJf5LYVB6liC5P0x5nTehbWba9JVSoYi6cXtqMnZi2RIeY lx7/6LA/uoXr32UY8fgOCr/qyPt9PPsPlLP40Hs9CQ== X-Google-Smtp-Source: ADFU+vsU1yc3LSqOSn4XUoQjZ0wIdFoAR/6o3jZYm08jw618IJ/ykkhP3TsJdp+j+RyqLWGRzU2VdDxXmUe7IHIGi3Y= X-Received: by 2002:adf:f84a:: with SMTP id d10mr4971509wrq.208.1583513032534; Fri, 06 Mar 2020 08:43:52 -0800 (PST) MIME-Version: 1.0 References: <20200305224605.7705-1-andrey.warkentin@gmail.com> <15F9B446FF373668.16592@groups.io> <741e7302-80e8-2daf-78fa-44cd49bdff4d@akeo.ie> In-Reply-To: <741e7302-80e8-2daf-78fa-44cd49bdff4d@akeo.ie> From: "Ard Biesheuvel" Date: Fri, 6 Mar 2020 17:43:41 +0100 Message-ID: Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back To: Pete Batard Cc: edk2-devel-groups-io , Andrei Warkentin , Leif Lindholm , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Content-Type: text/plain; charset="UTF-8" On Fri, 6 Mar 2020 at 12:51, Pete Batard wrote: > > On 2020.03.06 11:42, Pete Batard via Groups.Io wrote: > > This currently produces an ASSERT for me: > > > > ASSERT [ArmPlatformPrePiUniCore] > > /usr/src/edk2/ArmPlatformPkg/PrePi/PrePi.c(75): (((UINT64)0x00000000ULL > > > mSystemMemoryEnd) || ((0x00000000ULL + 0x00200000U) < 0x00200000ULL)) > > || ((0x00000000ULL >= 0x00200000ULL) && ((UINT64)(0x00000000ULL + > > 0x00200000U) > > > > Please hold off integration until we've looked into it further. > > Disregard. I was missing the fix IS_XIP dependency mentioned below. > > With this: > Reviewed-by: Pete Batard > Tested-by: Pete Batard > Pushed as f9d42079600c..91ed4f904e16 Thanks all > > > > Regards, > > > > /Pete > > > > > > On 2020.03.05 22:46, Andrei Warkentin wrote: > >> From: Andrei Warkentin > >> > >> The RPi4 TF-A is much smaller than RPi3 TF-A, and doesn't need > >> an extra 2MB region. > >> > >> Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP. > >> > >> Signed-off-by: Andrei Warkentin > >> --- > >> Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 22 > >> ++++++++++++-------- > >> Platform/RaspberryPi/RPi4/RPi4.dsc | 4 ++-- > >> 2 files changed, 15 insertions(+), 11 deletions(-) > >> > >> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > >> b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > >> index 901e5e3e..e795a885 100644 > >> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > >> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > >> @@ -39,8 +39,6 @@ STATIC RPI_MEMORY_REGION_INFO > >> VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIP > >> FixedPcdGet32(PcdFdSize) - \ > >> VariablesSize) > >> -#define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + > >> FixedPcdGet32(PcdFdSize)) > >> - > >> /** > >> Return the Virtual Memory Map of your platform > >> @@ -96,13 +94,19 @@ ArmPlatformGetVirtualMemoryMap ( > >> VirtualMemoryInfo[Index].Type = RPI_MEM_RUNTIME_REGION; > >> VirtualMemoryInfo[Index++].Name = L"FD Variables"; > >> - // TF-A reserved RAM > >> - VirtualMemoryTable[Index].PhysicalBase = ATFBase; > >> - VirtualMemoryTable[Index].VirtualBase = > >> VirtualMemoryTable[Index].PhysicalBase; > >> - VirtualMemoryTable[Index].Length = FixedPcdGet64 > >> (PcdSystemMemoryBase) - ATFBase; > >> - VirtualMemoryTable[Index].Attributes = > >> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > >> - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION; > >> - VirtualMemoryInfo[Index++].Name = L"TF-A RAM"; > >> + if (BCM2711_SOC_REGISTERS == 0) { > >> + // > >> + // TF-A reserved RAM only exists for the Pi 3 TF-A. > >> + // > >> + // This is 2MB that directly follows the FD. > >> + // > >> + VirtualMemoryTable[Index].PhysicalBase = > >> (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize)); > >> + VirtualMemoryTable[Index].VirtualBase = > >> VirtualMemoryTable[Index].PhysicalBase; > >> + VirtualMemoryTable[Index].Length = FixedPcdGet64 > >> (PcdSystemMemoryBase) - VirtualMemoryTable[Index].PhysicalBase; > >> + VirtualMemoryTable[Index].Attributes = > >> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > >> + VirtualMemoryInfo[Index].Type = > >> RPI_MEM_RESERVED_REGION; > >> + VirtualMemoryInfo[Index++].Name = L"TF-A RAM"; > >> + } > >> // Base System RAM > >> VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 > >> (PcdSystemMemoryBase); > >> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc > >> b/Platform/RaspberryPi/RPi4/RPi4.dsc > >> index 79295729..da62dc5b 100644 > >> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc > >> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc > >> @@ -396,8 +396,8 @@ > >> # This matches PcdFvBaseAddress, since everything less is ATF, and > >> # will be reserved away. > >> # > >> - gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000 > >> - gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000 > >> + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000 > >> + gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000 > >> # > >> # Device specific addresses > >> > > > > > > > > >