From patchwork Tue Feb 5 05:22:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 2096281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 78317DF24C for ; Tue, 5 Feb 2013 05:28:57 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U2b3D-0000DE-0J; Tue, 05 Feb 2013 05:26:35 +0000 Received: from relais.videotron.ca ([24.201.245.36]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U2b0b-0006fb-TV for linux-arm-kernel@lists.infradead.org; Tue, 05 Feb 2013 05:23:55 +0000 Received: from yoda.home ([24.202.213.203]) by VL-VM-MR004.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MHQ00A5IEZ4SY20@VL-VM-MR004.ip.videotron.ca> for linux-arm-kernel@lists.infradead.org; Tue, 05 Feb 2013 00:23:29 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 571A02DA01A0; Tue, 05 Feb 2013 00:23:29 -0500 (EST) From: Nicolas Pitre To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 12/15] ARM: CCI: ensure powerdown-time data is flushed from cache Date: Tue, 05 Feb 2013 00:22:09 -0500 Message-id: <1360041732-17936-13-git-send-email-nicolas.pitre@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-reply-to: <1360041732-17936-1-git-send-email-nicolas.pitre@linaro.org> References: <1360041732-17936-1-git-send-email-nicolas.pitre@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130205_002354_043314_071D0061 X-CRM114-Status: GOOD ( 12.41 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [24.201.245.36 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: dave.martin@linaro.org, lorenzo.pieralisi@arm.com, pawel.moll@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, santosh.shilimkar@ti.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Dave Martin Non-local variables used by the CCI management function called after disabling the cache must be flushed out to main memory in advance, otherwise incoherency of those values may occur if they are sitting in the cache of some other CPU when cci_disable() executes. This patch adds the appropriate flushing to the CCI driver to ensure that the relevant data is available in RAM ahead of time. Because this creates a dependency on arch-specific cacheflushing functions, this patch also makes ARM_CCI depend on ARM. Signed-off-by: Dave Martin Signed-off-by: Nicolas Pitre Reviewed-by: Santosh Shilimkar --- drivers/bus/Kconfig | 1 + drivers/bus/arm-cci.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index d032f74ff2..cd4ac9f001 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -22,5 +22,6 @@ config OMAP_INTERCONNECT config ARM_CCI bool "ARM CCI driver support" + depends on ARM endmenu diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c index 11c1513440..3bdab2c135 100644 --- a/drivers/bus/arm-cci.c +++ b/drivers/bus/arm-cci.c @@ -21,6 +21,10 @@ #include #include +#include +#include +#include + #define CCI_STATUS_OFFSET 0xc #define STATUS_CHANGE_PENDING (1 << 0) @@ -78,6 +82,15 @@ static int cci_driver_probe(struct platform_device *pdev) goto ioremap_err; } + /* + * Multi-cluster systems may need this data when non-coherent, during + * cluster power-up/power-down. Make sure it reaches main memory: + */ + __cpuc_flush_dcache_area(info, sizeof *info); + __cpuc_flush_dcache_area(&info, sizeof info); + outer_clean_range(virt_to_phys(info), virt_to_phys(info + 1)); + outer_clean_range(virt_to_phys(&info), virt_to_phys(&info + 1)); + platform_set_drvdata(pdev, info); pr_info("CCI loaded at %p\n", info->baseaddr);