From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web11.2236.1576063568946175067 for ; Wed, 11 Dec 2019 03:26:09 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=0MrDNAJt; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.68, mailfrom: pete@akeo.ie) Received: by mail-wr1-f68.google.com with SMTP id b6so23650999wrq.0 for ; Wed, 11 Dec 2019 03:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iP+HE34K8z4likqu06eOzCLB/YBr0AVbArei3Br9P1o=; b=0MrDNAJtjG7tsBfXV2VevLW+q7IAyB9LMNLJsS3NIj2FMiKOp+Bs0jRKz+JZaOEPKr C1sUMqwLax5dzxxIJZVTENPP4FqIlzVPttC5n/o41KWzcM6UohbgNPreWhPizNPpEb5G N4ussH71wgjD0qDZJB1NlEednCcW5aU+7sfhkNc1i99dPE/r0zmGhrs6i6U5QxFRU2G3 y2Q5pSLcOE4Mjwis7oPN9KlNcaZhT70PLcEM9o0k/wKNMiYeJaV/8R1qHC5zBII/EEXd 5B/kqZfacO2r/xuoveGn29/Z/jhT8UoFRKc1OPdZgHmdp2mDC+QQEdqbTamZf0oJHYPt QTxQ== 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=iP+HE34K8z4likqu06eOzCLB/YBr0AVbArei3Br9P1o=; b=PMYPEyPE4ys22ZJNfEsEZPHwiicWBaJLjlV4lIuJvLDjJc0uTxtCPm55hA0lvzCFrB CWmctg+MDALpRrwZxzZiOoNsNog8BkHXtFhUDxMQBvWbBmtisHMC77F4N5oq7nvHdlaX xJALLYRUqj3Xp5Gf/mCVS2ian0Ff/4wYlsQ0oUhqG2fr7oqkjZ2OXwBcH8pNDBODSoxB KZfCTatisrZGa/oUyanz8Vf2J6odTwtACvi/DOTnWHTjp0wlS534dodEZnQtJqqOHLtO USRB73+shl45RL1SpVzRtxnJWBVyVBfTn46KT5jcry/39nMPFzrD3sy5umykDZV5TcVe AfYA== X-Gm-Message-State: APjAAAW/Vjf89/+gwnJMTXZDwEYEE3JWLyktkp9xHw8jNP90bJpQQm5r 3ICvqHeAfe7XcoqSO6pwFcIT2grq+6wzqQ== X-Google-Smtp-Source: APXvYqwkDzjI+qjL5En9gHQXf/ixvfaPySxqBEdsSmMAJ4iK80WKJ1UuvB2g+yTBHJnhPWXMJrTtaw== X-Received: by 2002:a5d:62d1:: with SMTP id o17mr3481923wrv.9.1576063567218; Wed, 11 Dec 2019 03:26:07 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id q8sm190460wmq.3.2019.12.11.03.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 03:26:06 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory Date: Wed, 11 Dec 2019 11:25:49 +0000 Message-Id: <20191211112552.15900-3-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20191211112552.15900-1-pete@akeo.ie> References: <20191211112552.15900-1-pete@akeo.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 -- 2.21.0.windows.1