From patchwork Tue Feb 28 12:13:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 94609 Delivered-To: patch@linaro.org Received: by 10.140.20.113 with SMTP id 104csp1291459qgi; Tue, 28 Feb 2017 04:13:27 -0800 (PST) X-Received: by 10.98.150.70 with SMTP id c67mr2254692pfe.84.1488284006952; Tue, 28 Feb 2017 04:13:26 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id p17si1626219pgi.67.2017.02.28.04.13.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 04:13:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7F4CF81F56; Tue, 28 Feb 2017 04:13:26 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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: [edk2] [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: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm 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); }