From patchwork Sun Apr 15 10:48:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 133421 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp2499706ljb; Sun, 15 Apr 2018 03:48:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/eL0hMPtllGEpygkYCwmA7DNc3csvh/7aywXsAlaCB1xTiFboKAiHs+U5GMqtEZQyQff88 X-Received: by 10.80.179.45 with SMTP id q42mr28059567edd.264.1523789315345; Sun, 15 Apr 2018 03:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523789315; cv=none; d=google.com; s=arc-20160816; b=e7fr/ynC8YDVVBscd7FnHSdYwFZwDavTNF3MOUL6lNQzzpnXT6lntGa3EghBfjns+6 CheUn1rLNcx5D3oUuJJvpwRlx7OAN+2yyQrD4sGTdWSe2sHq4l63xJPJ/1/8uxpV+Ynh YjPmZFMKuwXkPek0hwDeONemtyTOb/rilVAukZtWFce4vhqe8kgQkVmS46/9NcGhL/q+ M9BH+5VzPgIM0SOjD2mVU4wAoEl39Bf3uUsAgwKcx8qIbe0YioEB98oH/Is1PB0XVzmr A8kuSXkaNr+qiK0R1g89kFzOANUZYvzq+GXUdawborbgp+xKyjBCR3roXFcJAuV41wNy mTMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=BoQIfEHRGyobUizBlJHwRHUH72n4r2519TQmksbuwB4=; b=1H30Ps3Obr/X4IXHyKBME9x7iO2NFJ4mE0k/OQkjjDhi5CBg4Y2IAUtHdkYO8E1Xvp kVReG574tqTURz4bTtyl9hzcr24db4d5FfLNRIo5wo3uEjiUzwAmXfx3/+R7T9Px+M/V UNnU6jsAI9OIH9S1TMi89f9OhAxNvmTXyvw4pFC1feInfA6UPJsg65yKMV1Yst4iv/CF K8dhYaq1e+bvFyJxrJ/NBpsRqPEgGdVexZ9po1EHFcxR3+NhPpXxkE1PgVBwN3ZZJiZd BfaWxJwe+U35KSniBqqC/uwLgmY2XQC15R/vHQm5+mlnflS8jGpaAvyyojPWZWFV0JGG 2BtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UrGPXvvU; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 35si8869440edo.234.2018.04.15.03.48.35; Sun, 15 Apr 2018 03:48:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UrGPXvvU; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id D62F0C21EB1; Sun, 15 Apr 2018 10:48:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C445CC21DB5; Sun, 15 Apr 2018 10:48:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 92AF9C21DB5; Sun, 15 Apr 2018 10:48:22 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by lists.denx.de (Postfix) with ESMTPS id 1CA43C21D8A for ; Sun, 15 Apr 2018 10:48:21 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id l49so18363861wrl.4 for ; Sun, 15 Apr 2018 03:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=+B9XibWFD35/LPIlsCpwj85qjCCyF7hre7yg4cWMG+Y=; b=UrGPXvvU45tNxrcFV/+2Ay/IJyGhuCX8DtxmEQmnvfMz/8f4YEE3cm8gH+kPnuj8V4 WkcR6ON2QLjv+lS8OLjWknKQjch84ZYU0fykVTj93YjaG0L93MzmHYRefKqitNARZ3OB 0m7XCDEssBDKIutUngh4ElpbnZagQ7VR30DAs= 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; bh=+B9XibWFD35/LPIlsCpwj85qjCCyF7hre7yg4cWMG+Y=; b=Q7AVipVCpRr1aziFEhtlUQfL5/rhNEuBeilBWHxyq7kE72Rz1OsJqEyeNXgOc0q7Hv K4YZvd5EZkzXHfhIa5eBJxkghF98+kx2F6e2ECMfkRaXERCgAiUotcT4qYZYxgPlwS/O vWjL0E1DCGgUHd/sF+P64rowqUMXk1lnRieFpU108U+34nUJpf9PKqHLExptmsDRrhEr WMi1/Ln0Zec2c2hlj8GI4CjKyWNS/S/EWv+R7dwN6rvp7tG8D7CV2dT/dK8bthWWfVV8 cjTuEyFCvjHCn5JzXFotuUjptf5tUXyEwlFhLgZxxudy/j4A9MtAfr9G140rqjTOEJ1s 3mbg== X-Gm-Message-State: ALQs6tBhW4JLE0pzVtZjvEDp6Z6MBVcWkIsmf4Ut3GUATUBFQhZT1k3M q7x7J1XlQTWb7LEnCQA8qh1mA5AhdME= X-Received: by 10.80.231.13 with SMTP id a13mr28373675edn.212.1523789300353; Sun, 15 Apr 2018 03:48:20 -0700 (PDT) Received: from localhost.localdomain (D4CCACC7.cm-2.dynamic.ziggo.nl. [212.204.172.199]) by smtp.gmail.com with ESMTPSA id i17sm5677024ede.13.2018.04.15.03.48.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Apr 2018 03:48:19 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Sun, 15 Apr 2018 11:48:17 +0100 Message-Id: <1523789297-8011-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [U-Boot] [PATCH v2] bootm: Align cache flush begin address X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" commit b4d956f6bc0f ("bootm: Align cache flush end address correctly") aligns the end address of the cache flush operation to a cache-line size to ensure lower-layers in the code accept the range provided and flush. A similar action should be taken for the begin address of a cache flush operation. The load address may not be aligned to a cache-line boundary, so ensure the passed address is aligned. Signed-off-by: Bryan O'Donoghue Reported-by: Breno Matheus Lima Suggested-by: Tom Rini Cc: Simon Glass Tested-by: Breno Lima Reviewed-by: Simon Glass --- common/bootm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/bootm.c b/common/bootm.c index adb1213..3616291 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -434,6 +434,8 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end, ulong blob_end = os.end; ulong image_start = os.image_start; ulong image_len = os.image_len; + ulong flush_start = ALIGN_DOWN(load, ARCH_DMA_MINALIGN); + ulong flush_len = *load_end - load; bool no_overlap; void *load_buf, *image_buf; int err; @@ -447,7 +449,11 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end, bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE); return err; } - flush_cache(load, ALIGN(*load_end - load, ARCH_DMA_MINALIGN)); + + if (flush_start < load) + flush_len += load - flush_start; + + flush_cache(flush_start, ALIGN(flush_len, ARCH_DMA_MINALIGN)); debug(" kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end); bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);