From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web09.2690.1576066962038409216 for ; Wed, 11 Dec 2019 04:22:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DdDzoINH; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576066961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o2rW3VJj5KofysxUX6sboPkOCPsU8a82KzcXXHr5hs0=; b=DdDzoINHUkXLPS0cmq48eORSVBdbkeEx0rEQhy0DI//ldNDF9rgg/5DIGZ1mSVb/ugkPSU VK+DNOMxVcg8caNVWwXRchMIy8SKosnVCx+GL1Qn6q690V/AhpN7vUwkKozPXVGoUDHs/l FwE28brhNMthp2bx1dvU4Elx0iiTvSY= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-oExugp8JPqSWGpn_bi6r_Q-1; Wed, 11 Dec 2019 07:22:40 -0500 Received: by mail-wr1-f69.google.com with SMTP id d8so10339574wrq.12 for ; Wed, 11 Dec 2019 04:22:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=o2rW3VJj5KofysxUX6sboPkOCPsU8a82KzcXXHr5hs0=; b=fMqgwJafL1isREd+JRZUKC06Kp48hnolWRzXTkOo6DbL3mWKg8tBsaHWB2x+p9ODS2 AY/xOWYeybCZWtNyislRq5L2E97Sw/rRVM0SJfxxOID446UPH7lwlqvecg/0t5xj7T9b e+jL6GDwq3cgYQoLXUlnQxyy4fQ1DxKXhiidjcu0GfVwfXexEDjCoGflXhgh5MCxazoK ZCnfVmHbxqGUzj2++TF3lqE6n1Mp814nAeRgjggfsP3/O4eIIWF/TQk3zLSDetgKYqnn 3f8Bog4Oy7GM/DU9QxJRqALdykrz2w9krj75C+23kKAo7bcWvFAsdnw3O2+/5YFBTOMt VNLg== X-Gm-Message-State: APjAAAXLCDrk2s/dAgj/80qC0TLuarqv4UN3P3bmsKfHjuuMfnc2b5SR FDn18UTehHAmywxdeKlgL5iH6SOqRHPz/KyPSFr4vsC3J2/EUlxzCP2raJ8zVw6TfuLQbas+NS2 Z2bJs5fUvlsIIrg== X-Received: by 2002:a1c:a98e:: with SMTP id s136mr3238712wme.140.1576066958903; Wed, 11 Dec 2019 04:22:38 -0800 (PST) X-Google-Smtp-Source: APXvYqx3KUTbFR5do/1Br1ISyGsU08DZEWsf7YLMdB/HG6CJM+xUl30ft5kz6hA4BuhlZ8NO4IdaYQ== X-Received: by 2002:a1c:a98e:: with SMTP id s136mr3238685wme.140.1576066958648; Wed, 11 Dec 2019 04:22:38 -0800 (PST) Return-Path: Received: from [10.201.33.164] ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id f1sm2119192wrp.93.2019.12.11.04.22.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2019 04:22:38 -0800 (PST) Subject: Re: [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory To: Pete Batard , devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com References: <20191211112552.15900-1-pete@akeo.ie> <20191211112552.15900-3-pete@akeo.ie> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <16fc8664-5dc0-3bb2-56b0-52107b9bce4d@redhat.com> Date: Wed, 11 Dec 2019 13:22:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191211112552.15900-3-pete@akeo.ie> X-MC-Unique: oExugp8JPqSWGpn_bi6r_Q-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 12/11/19 12:25 PM, Pete Batard wrote: > From: Ard Biesheuvel > > When using ACPI OpRegions to poke device registers, Linux will use > the UEFI memory map to decide which memory attributes to use, and > so they should not be described as cacheable memory. > > Since MMIO regions that don't require an OS virtual mapping at runtime > don't really belong in the UEFI memory map to begin with, omit them > entirely. > > Signed-off-by: Pete Batard > --- > Platform/RaspberryPi/Include/Library/RPiMem.h | 7 ++++--- > Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 10 ++++++++++ > Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 6 +++--- > 3 files changed, 17 insertions(+), 6 deletions(-) > > diff --git a/Platform/RaspberryPi/Include/Library/RPiMem.h b/Platform/RaspberryPi/Include/Library/RPiMem.h > index 9d38e4b6cfb3..a033af369bb0 100644 > --- a/Platform/RaspberryPi/Include/Library/RPiMem.h > +++ b/Platform/RaspberryPi/Include/Library/RPiMem.h > @@ -9,9 +9,10 @@ > #ifndef RPI_MEM_H__ > #define RPI_MEM_H__ > > -#define RPI_MEM_BASIC_REGION 0 > -#define RPI_MEM_RUNTIME_REGION 1 > -#define RPI_MEM_RESERVED_REGION 2 > +#define RPI_MEM_UNMAPPED_REGION 0 > +#define RPI_MEM_BASIC_REGION 1 > +#define RPI_MEM_RUNTIME_REGION 2 > +#define RPI_MEM_RESERVED_REGION 3 > > typedef struct { > CONST CHAR16* Name; > diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c > index 3a0f7e19e993..7ba1cc5602d2 100644 > --- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c > +++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c > @@ -72,6 +72,15 @@ AddRuntimeServicesRegion ( > ); > } > > +STATIC > +VOID > +AddUnmappedMemoryRegion ( > + IN ARM_MEMORY_REGION_DESCRIPTOR *Desc > + ) > +{ > + // Do nothing > +} > + > STATIC > VOID > AddReservedMemoryRegion ( > @@ -88,6 +97,7 @@ AddReservedMemoryRegion ( > } > > void (*AddRegion[]) (IN ARM_MEMORY_REGION_DESCRIPTOR *Desc) = { > + AddUnmappedMemoryRegion, > AddBasicMemoryRegion, > AddRuntimeServicesRegion, > AddReservedMemoryRegion, > diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > index 781cf78b83d3..f8223d1b94e8 100644 > --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > @@ -117,7 +117,7 @@ ArmPlatformGetVirtualMemoryMap ( > VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; > VirtualMemoryTable[Index].Length = mVideoCoreSize; > VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; > - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION; > + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION; > VirtualMemoryInfo[Index++].Name = L"GPU Reserved"; > > // Compute the total RAM size available on this platform > @@ -139,7 +139,7 @@ ArmPlatformGetVirtualMemoryMap ( > VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; > VirtualMemoryTable[Index].Length = BCM2711_SOC_REGISTER_LENGTH; > VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; > - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION; > + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION; > VirtualMemoryInfo[Index++].Name = L"SoC Reserved (27xx)"; > } > > @@ -152,7 +152,7 @@ ArmPlatformGetVirtualMemoryMap ( > VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; > VirtualMemoryTable[Index].Length = BCM2836_SOC_REGISTER_LENGTH; > VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; > - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION; > + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION; > VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)"; > > // If we have RAM above the 1 GB mark, declare it > Reviewed-by: Philippe Mathieu-Daude