From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x234.google.com (mail-wr0-x234.google.com [IPv6:2a00:1450:400c:c0c::234]) (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 D1F3381F28 for ; Tue, 28 Feb 2017 04:13:23 -0800 (PST) Received: by mail-wr0-x234.google.com with SMTP id g10so7497918wrg.2 for ; Tue, 28 Feb 2017 04:13:23 -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=EX48uUnEO1Aff6Et/rl/Zr7vysAHZnMKiBG1TZhmWbw=; b=Ncj75egN3qVUxUj9R7pPnmE88w+VLipTfXisUeNa5Xv0XSZaDZi5oUBR3hiCVoj7Lr NnULqNulLneHns0qfcdi/fRZJErEZy8RkpiitJvN/XRin9lRU/98kFG4DEeFJE8YGPng B7DsfR+ZImHIFKVze9e3tocMeLL4RWijV2siY= 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=EX48uUnEO1Aff6Et/rl/Zr7vysAHZnMKiBG1TZhmWbw=; b=Oq3beduL8APULnLcA8yiMZdoenLNxdShzRKsGVMtKWyjDF0VCR92NIJabbcOK+8GXA GggX8cAr9VPoRLhspWZckY272O90Ij3YeuiOIlD9F7SlFuhyZAznCxGHWUvig0ymoshJ foETiMFqfy1m4iBLt1jh1xTCKj38R/wdWWhoImlbBFi8PRial04SJIKxwj58EZj2MrMg Ag6HAgfAaxqKk/sQmUrihf3eYPynwqDa2EwY1np1C6TAOgVGkxlBpXmhEk7jM5sZuZWC 2+TujBZFGohIUqVIhMcTDaSEv0EycNx1LU5DHbzTAaL8zPD0ef1hrP6zoZheOcR9BdZy r7tA== X-Gm-Message-State: AMke39khHr4iYFep2DRJQS5ktKezSdilgAUK7paayDUWjwBCpxSoRMpHx6oARkZcxcCl60wm X-Received: by 10.223.160.220 with SMTP id n28mr2068059wrn.31.1488284002206; Tue, 28 Feb 2017 04:13:22 -0800 (PST) Received: from localhost.localdomain ([105.149.201.216]) by smtp.gmail.com with ESMTPSA id x193sm2403690wme.23.2017.02.28.04.13.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 04:13:21 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Cc: Ard Biesheuvel Date: Tue, 28 Feb 2017 12:13:11 +0000 Message-Id: <1488283992-32104-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488283992-32104-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488283992-32104-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH 2/3] ArmPkg/UncachedMemoryAllocationLib: use CWG value to align pool allocations X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2017 12:13:24 -0000 Uncached pool allocations are aligned to the data cache line length under the assumption that this is sufficient to prevent cache maintenance from corrupting adjacent allocations. However, the value to use in such cases is architecturally called the Cache Writeback Granule (CWG), which is essentially the maximum Dcache line length rather than the minimum. Note that this is mostly a cosmetical fix, given that the pool allocation is turned into a page allocation later, and rounded up accordingly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c index cd13a7da92e0..0d8abad23433 100644 --- a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c +++ b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c @@ -545,7 +545,7 @@ UncachedInternalAllocatePool ( IN UINTN AllocationSize ) { - UINTN CacheLineLength = ArmDataCacheLineLength (); + UINTN CacheLineLength = ArmCacheWritebackGranule (); return UncachedInternalAllocateAlignedPool (MemoryType, AllocationSize, CacheLineLength); } -- 2.7.4